constants-aarch32.h revision d3832965c62a8ad461b9ea9eb0994ca6b0a3da2c
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
31namespace vixl {
32namespace aarch32 {
33
34const unsigned kRegSizeInBits = 32;
35const unsigned kRegSizeInBytes = kRegSizeInBits / 8;
36const unsigned kSRegSizeInBits = 32;
37const unsigned kSRegSizeInBytes = kSRegSizeInBits / 8;
38const unsigned kDRegSizeInBits = 64;
39const unsigned kDRegSizeInBytes = kDRegSizeInBits / 8;
40const unsigned kQRegSizeInBits = 128;
41const unsigned kQRegSizeInBytes = kQRegSizeInBits / 8;
42
43const unsigned kNumberOfRegisters = 16;
44const unsigned kNumberOfSRegisters = 32;
45const unsigned kMaxNumberOfDRegisters = 32;
46const unsigned kNumberOfQRegisters = 16;
47const unsigned kNumberOfT32LowRegisters = 8;
48
49const unsigned kIpCode = 12;
50const unsigned kSpCode = 13;
51const unsigned kLrCode = 14;
52const unsigned kPcCode = 15;
53
54const unsigned kT32PcDelta = 4;
55const unsigned kA32PcDelta = 8;
56
57const unsigned kRRXEncodedValue = 3;
58
59const unsigned kCoprocMask = 0xe;
60const unsigned kInvalidCoprocMask = 0xa;
61
62const unsigned kLowestT32_32Opcode = 0xe8000000;
63
64const uint32_t kUnknownValue = 0xdeadbeef;
65
66const uint32_t kMaxInstructionSizeInBytes = 4;
67const uint32_t kA32InstructionSizeInBytes = 4;
68const uint32_t k32BitT32InstructionSizeInBytes = 4;
69const uint32_t k16BitT32InstructionSizeInBytes = 2;
70
71// Maximum size emitted by a single T32 unconditional macro-instruction.
72const uint32_t kMaxT32MacroInstructionSizeInBytes = 32;
73
74const uint32_t kCallerSavedRegistersMask = 0x500f;
75
76enum SystemFunctionsOpcodes { kPrintfCode };
77
78}  // namespace aarch32
79}  // namespace vixl
80
81#endif  // VIXL_CONSTANTS_AARCH32_H_
82