ARMv8 is the machine architecture that the Nintendo Switch uses to process compiled code. It has a very large instruction set and register components.
Contents
Registers
The architecture includes a variety of registers.
GPR
The GPRs have two varieties, 64-bit GPRs and 32-bit GPRs.
Name | Size | Description |
---|---|---|
X0-X7 | 64-bit | Used to pass parameters to a function and to return a result. Can be used as scratch. |
X8 | 64-bit | Indirect result register. Passes the address of an indirect result. |
X9-X15 | 64-bit | Caller-saved temporary registers. |
X16 | 64-bit | IP0 (Intra-Procedure Call) temporary register. Can be used for call veneers and as a caller-saved temporary register. |
X17 | 64-bit | IP1 (Intra-Procedure Call) temporary register. Can be used for call veneers and as a caller-saved temporary register. |
X18 | 64-bit | Platform register, reserved by the platform ABI. For platforms that do not utilize the register, it can be used as a temporary register. |
X19-X29 | 64-bit | Callee-saved temporary registers. |
X30 | 64-bit | Link register (LR). |
The 32-bit registers use the exact same register types, where it starts with W rather than X.
FPR
The architecture has multiple types of registers for floating point.
Name | Size | Description |
---|---|---|
S0-S7 | 32-bit | Used to pass parameters to a function and to return a result. Can be used as scratch. |
S8-S15 | 32-bit | Callee-preserved registers. |
S16-S31 | 32-bit | These registers do not need to be preserved by the caller, nor the callee. |
The following types of floating point registers exist (only the prefixes):
Name | Size |
---|---|
B | 8-bit |
H | 16-bit |
S | 32-bit |
D or V | 64-bit |
Q | 128-bit |
Special Registers
Name | Size | Description |
---|---|---|
WZR | 32-bit | Zero register. Always contains a 32-bit 0x0 value. |
XZR | 64-bit | Zero register. Always contains a 64-bit 0x0 value. |
WSP | 32-bit | Current stack pointer. |
SP | 64-bit | Current stack pointer. |
PC | 64-bit | Program counter. |