spo600:aarch64_register_and_instruction_quick_start
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spo600:aarch64_register_and_instruction_quick_start [2024/02/06 18:06] – [Starter Kit] chris | spo600:aarch64_register_and_instruction_quick_start [2025/02/19 16:54] (current) – [General-Purpose Integer Registers] chris | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== AArch64 Register and Instruction Quick Start ===== | ===== AArch64 Register and Instruction Quick Start ===== | ||
- | This page contains very basic information on the AArch64 mode of the [[ARMv8]]/ARMv9 architecture: | + | This page contains very basic information on the AArch64 mode of the [[ARMv8|ARMv8/ARMv9]] architecture: |
===== | ===== | ||
- | ==== General-Purpose Registers | + | ==== General-Purpose |
The aarch64 registers are named: | The aarch64 registers are named: | ||
* r0 through r30 - to refer generally to the registers | * r0 through r30 - to refer generally to the registers | ||
- | | + | |
- | * w0 through w30 - for 32-bit-wide access (same registers - upper 32 bits are either cleared on load or sign-extended (set to the value of the most significant bit of the loaded value)). | + | * w0 through w30 - for 32-bit-wide access (same registers, specifically accessed 32 bits (or less) at a time - upper 32 bits are either cleared on load or sign-extended (set to the value of the most significant bit of the loaded value)). |
Register ' | Register ' | ||
Line 16: | Line 16: | ||
* For all other instructions, | * For all other instructions, | ||
- | Usage during [[Syscalls|syscall]]/ | + | Usage during [[Syscalls|syscall]] |
- | * | + | * r0-r7 are used for integer and pointer |
- | * | + | * For syscalls, the syscall number is in r8 |
- | * | + | * r9-r15 are for temporary values |
* r16-r18 are used for intra-procedure-call and platform values (avoid) | * r16-r18 are used for intra-procedure-call and platform values (avoid) | ||
- | * | + | * r19-r28 |
* r29 and r30 are used as the frame register and link register (avoid) | * r29 and r30 are used as the frame register and link register (avoid) | ||
Line 50: | Line 50: | ||
cmp r0,r1 // compare register r0 with register r1. The comparison sets flags in the processor status register which affect conditional branches. | cmp r0,r1 // compare register r0 with register r1. The comparison sets flags in the processor status register which affect conditional branches. | ||
cmp r0,99 // compare the number 99 with register r0. The comparison sets flags in the processor status register which affect conditional branches. | cmp r0,99 // compare the number 99 with register r0. The comparison sets flags in the processor status register which affect conditional branches. | ||
- | ldr r0, | + | ldr r0, |
- | ldr w0, | + | ldr w0, |
- | ldrb w0, | + | ldrb w0, |
- | ldur r0, | + | ldur r0, |
mov r0,r1 // move data from r1 to r0 | mov r0,r1 // move data from r1 to r0 | ||
mov r0,99 // load r0 with 99 (only certain immediate values are possible) | mov r0,99 // load r0 with 99 (only certain immediate values are possible) | ||
Line 75: | Line 75: | ||
* Character values are indicated by quotation marks. Escapes (such as ' | * Character values are indicated by quotation marks. Escapes (such as ' | ||
* Destinations are given as the first argument (mov r0, r1 moves INTO r0 FROM r1; you can think of this as r0=r1). | * Destinations are given as the first argument (mov r0, r1 moves INTO r0 FROM r1; you can think of this as r0=r1). | ||
- | * For the LDR/STR instructions: | + | * For the LDR/STR instructions: |
* Q = Quadword = 64 bits | * Q = Quadword = 64 bits | ||
* D = Double word = 32 bits | * D = Double word = 32 bits | ||
* W = Word = 16 bits | * W = Word = 16 bits | ||
* B = Byte = 8 bits | * B = Byte = 8 bits | ||
- | * For any LDR/STR instruction that is loading or storing less than 64 bits, use the narrow (32-bit) version of the register name. For example, '' | + | * For any LDR/STR instruction that is loading or storing less than 64 bits, use the narrow (32-bit) version of the register name. For example, '' |
===== Resources | ===== Resources | ||
- | * ARM Aarch64 documentation | + | * ARM Aarch64 documentation |
* [[http:// | * [[http:// | ||
* [[https:// | * [[https:// | ||
- | * The //short// guide to the ARMv8 instruction set: [[https:// | + | * Instruction References |
- | * The //long// guide to the ARMv8 instruction set: [[https:// | + | * [[https:// |
- | | + | * [[https:// |
- | * GAS Manual - Using as, The GNU Assembler: | + | |
+ | * [[https:// | ||
spo600/aarch64_register_and_instruction_quick_start.1707242764.txt.gz · Last modified: 2024/04/16 18:10 (external edit)