asm_book/section_1/regs/ldr_tests.s
2022-06-10 12:41:58 -05:00

27 lines
No EOL
824 B
ArmAsm

.global main
.text
.align 2
main: str x30, [sp, -16]!
ldr x0, =fmt // Loads the address of fmt
ldr x1, =q // Loads the address of q
ldr x2, [x1] // Loads the value at q
bl printf // Calls printf()
ldr x0, =fmt // Loads the address of fmt
ldr x1, q // Loads the VALUE at q
ldr x2, [x1] // CRASH!
bl printf
ldr x30, [sp], 16
mov w0, wzr
ret
.data
q: .quad 0x1122334455667788
fmt: .asciz "address: %p value: %lx\n"
.end