【ARM】ARM汇编程序设计(六) stm和ldm
发布日期:2021-06-29 20:47:55
浏览次数:2
分类:技术文章
本文共 3345 字,大约阅读时间需要 11 分钟。
00. 目录
文章目录
01. ldmea指令
程序示例
.section .rodata .align 2.LC0: .string "hello world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n" .section .text .align 2 .global mainmain: 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 world\n".LC1: .string "var = %p %p %p\n".LC2: .string "val = %d\n" .section .text .align 2 .global mainmain: 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
转载地址:https://dengjin.blog.csdn.net/article/details/106910261 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
第一次来,支持一个
[***.219.124.196]2024年04月28日 07时48分19秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
mmap函数实现
2019-04-30
音频基础知识详解
2019-04-30
Linux 命令xxd功能
2019-04-30
repo使用指南
2019-04-30
gstreamer-test
2019-04-30
GDB基本用法
2019-04-30
动态范围控制(DRC)简介
2019-04-30
使用C语言查看一个文件夹中所有文件及目录
2019-04-30
音频硬件基础
2019-04-30
TS流分析
2019-04-30
详解YUV420数据格式
2019-04-30
Gstreamer学习笔记(2):GstElement定义、连接
2019-04-30
GStreamer建议的学习步骤和网页链接汇总
2019-04-30
Ubuntu14.04编译安装GStreamer
2019-04-30
GStreamer(一)
2019-04-30
GStreamer(二)
2019-04-30
Gstreamer学习笔记(1):GStreamer Debugging
2019-04-30
bitbake常用命令
2019-04-30
Git学习(一):git 生成 patch的命令
2019-04-30