程序示例
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
push {lr}
adr r4, .L1
ldmea r4, {r1, r2, r3}
ldr r0, =.LC1
bl printf
mov r0, #0
pop {pc}
.L0:
.word 0x1111
.word 0x2222
.word 0x3333
.L1:
.word 0x0
程序示例
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
push {lr}
adr r4, .L0
ldmed r4, {r1-r3}
ldr r0, =.LC1
bl printf
mov r0, #0
pop {pc}
.L0:
.word 0x1111
.word 0x2222
.word 0x3333
.L1:
.word 0x0
程序示例
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
push {lr}
adr r4, .L1
ldmfa r4, {r1-r3}
ldr r0, =.LC1
bl printf
mov r0, #0
pop {pc}
.L0:
.word 0x1111
.word 0x2222
.word 0x3333
.L1:
.word 0x0
程序示例
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
push {lr}
adr r4, .L0
ldmfd r4, {r1-r3}
ldr r0, =.LC1
bl printf
mov r0, #0
pop {pc}
.L0:
.word 0x1111
.word 0x2222
.word 0x3333
.L1:
.word 0x0
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
stmfd sp!, {lr}
mov fp, sp
sub sp, sp, #12
mov r1, #1
mov r2, #2
mov r3, #3
stmea sp, {r1, r2, r3}
ldmfd sp, {r1, r2, r3}
ldr r0, =.LC1
bl printf
mov r0, #0
mov sp, fp
ldmfd sp!, {lr}
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
stmfd sp!, {lr}
mov fp, sp
sub sp, sp, #4
mov r1, #1
mov r2, #2
mov r3, #3
stmed sp!, {r1, r2, r3}
ldmed sp!, {r1, r2, r3}
ldr r0, =.LC1
bl printf
mov r0, #0
mov sp, fp
ldmfd sp!, {lr}
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
stmfd sp!, {lr}
mov fp, sp
sub sp, sp, #16
mov r1, #1
mov r2, #2
mov r3, #3
stmfa sp, {r1, r2, r3}
ldmed sp, {r1, r2, r3}
ldr r0, =.LC1
bl printf
mov r0, #0
mov sp, fp
ldmfd sp!, {lr}
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.section .text
.align 2
.global main
main:
stmfd sp!, {lr}
mov fp, sp
mov r1, #1
mov r2, #2
mov r3, #3
stmfd sp, {r1, r2, r3}
ldmea sp, {r1, r2, r3}
ldr r0, =.LC1
bl printf
mov r0, #0
mov sp, fp
ldmfd sp!, {lr}
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello world\n"
.LC1:
.string "var = %p %p %p\n"
.LC2:
.string "val = %d\n"
.section .text
.align 2
.global main
main:
stmfd sp!, {lr}
mov fp, sp
sub sp, sp, #4
mov r0, #10
str r0, [sp]
mov r2, #20
swp r1, r2, [sp]
ldr r0, =.LC2
bl printf
ldr r1, [sp]
ldr r0, =.LC2
bl printf
mov r0, #0
mov sp, fp
ldmfd sp!, {lr}
6.1 【ARM】Load Store指令