constants-aarch32.h revision bf01e787b9ca4ff28b8c4d4355fd575c4ac81dfa
1// Copyright 2015, VIXL authors
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are met:
6//
7//   * Redistributions of source code must retain the above copyright notice,
8//     this list of conditions and the following disclaimer.
9//   * Redistributions in binary form must reproduce the above copyright
10//     notice, this list of conditions and the following disclaimer in the
11//     documentation and/or other materials provided with the distribution.
12//   * Neither the name of ARM Limited nor the names of its contributors may
13//     be used to endorse or promote products derived from this software
14//     without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26// POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef VIXL_CONSTANTS_AARCH32_H_
29#define VIXL_CONSTANTS_AARCH32_H_
30
31extern "C" {
32#include <stdint.h>
33}
34
35namespace vixl {
36namespace aarch32 {
37
38const unsigned kRegSizeInBits = 32;
39const unsigned kRegSizeInBytes = kRegSizeInBits / 8;
40const unsigned kSRegSizeInBits = 32;
41const unsigned kSRegSizeInBytes = kSRegSizeInBits / 8;
42const unsigned kDRegSizeInBits = 64;
43const unsigned kDRegSizeInBytes = kDRegSizeInBits / 8;
44const unsigned kQRegSizeInBits = 128;
45const unsigned kQRegSizeInBytes = kQRegSizeInBits / 8;
46
47const unsigned kNumberOfRegisters = 16;
48const unsigned kNumberOfSRegisters = 32;
49const unsigned kMaxNumberOfDRegisters = 32;
50const unsigned kNumberOfQRegisters = 16;
51const unsigned kNumberOfT32LowRegisters = 8;
52
53const unsigned kIpCode = 12;
54const unsigned kSpCode = 13;
55const unsigned kLrCode = 14;
56const unsigned kPcCode = 15;
57
58const unsigned kT32PcDelta = 4;
59const unsigned kA32PcDelta = 8;
60
61const unsigned kRRXEncodedValue = 3;
62
63const unsigned kCoprocMask = 0xe;
64const unsigned kInvalidCoprocMask = 0xa;
65
66const unsigned kLowestT32_32Opcode = 0xe8000000;
67
68const uint32_t kUnknownValue = 0xdeadbeef;
69
70const uint32_t kMaxInstructionSizeInBytes = 4;
71const uint32_t kA32InstructionSizeInBytes = 4;
72const uint32_t k32BitT32InstructionSizeInBytes = 4;
73const uint32_t k16BitT32InstructionSizeInBytes = 2;
74
75// Maximum size emitted by a single T32 unconditional macro-instruction.
76const uint32_t kMaxT32MacroInstructionSizeInBytes = 32;
77
78const uint32_t kCallerSavedRegistersMask = 0x500f;
79
80enum SystemFunctionsOpcodes { kPrintfCode };
81
82}  // namespace aarch32
83}  // namespace vixl
84
85#endif  // VIXL_CONSTANTS_AARCH32_H_
86