概述
00. 目录
文章目录
- 00. 目录
- 01. ldmea指令
- 02. ldmed指令
- 03. ldmfa指令
- 04. ldmfd指令
- 05. stmea指令
- 06. stmed指令
- 07. stmfa指令
- 08. stmfd指令
- 09. swp指令
- 06. 附录
01. ldmea指令
程序示例
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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
02. ldmed指令
程序示例
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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
03. ldmfa指令
程序示例
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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
04. ldmfd指令
程序示例
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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
05. stmea指令
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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}
06. stmed指令
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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}
07. stmfa指令
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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}
08. stmfd指令
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.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}
09. swp指令
程序示例:
.section .rodata
.align 2
.LC0:
.string "hello worldn"
.LC1:
.string "var = %p %p %pn"
.LC2:
.string "val = %dn"
.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}
06. 附录
6.1 【ARM】Load Store指令
最后
以上就是热心小懒虫为你收集整理的【ARM】ARM汇编程序设计(六) stm和ldm的全部内容,希望文章能够帮你解决【ARM】ARM汇编程序设计(六) stm和ldm所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复