00. 目录
文章目录
- 00. 目录
- 01. ldmea指令
- 02. ldmed指令
- 03. ldmfa指令
- 04. ldmfd指令
- 05. stmea指令
- 06. stmed指令
- 07. stmfa指令
- 08. stmfd指令
- 09. swp指令
- 06. 附录
01. ldmea指令
程序示例
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35.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指令
程序示例:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34.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指令
程序示例:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38.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汇编程序设计(六)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复