- 1、本文档共5页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
1、实验三,完成一块存储区的拷贝程序——原代码及简单分析.doc
1、实验三,完成一块存储区的拷贝程序——原代码及简单分析
原实验程序
该程序的核心思想:使用8字的块传输
核心语句: ldmia r0!, {r4-r11}
stmia r1!, {r4-r11}
一次拷贝8个字,所以,需要计算得到num个字需要循环多少次(每次拷贝8字),于是有了循环初值的设置:movs r3,r2, LSR #3 (R2中保存的是NUM:mov r2, #num )
但是,num一定是8的整倍数的话,显然通过ands r2, r2, #7,z标志会置位,则beq stop;假如num不是8的整倍数,那么R2通过ands r2, r2, #7 就成了逐字拷贝的循环计数初值。
在
wordcopy:
ldr r3, [r0], #4 /* a word from the source */
str r3, [r1], #4 /* store a word to the destination */
subs r2, r2, #1 /* decrement the counter */
bne wordcopy
这段代码中,实现了以R2为-1计数的按字拷贝的循环。
这就是验证程序的基本思路。
原代码如下:
/*--------------------------*/
/* constant define */
/*--------------------------*/
.global _start
/*--------------------------*/
/* code */
/*--------------------------*/
.text
.equ num, 20 /* Set number of words to be copied */
_start:
ldr r0, =src /* r0 = pointer to source block */
ldr r1, =dst /* r1 = pointer to destination block */
mov r2, #num /* r2 = number of words to copy */
mov sp, #0x400 /* set up stack pointer (r13) */
blockcopy:
movs r3,r2, LSR #3 /* number of eight word multiples */
beq copywords /* less than eight words to move ? */
stmfd sp!, {r4-r11} /* save some working registers */
octcopy:
ldmia r0!, {r4-r11} /* load 8 words from the source */
stmia r1!, {r4-r11} /* and put them at the destination */
subs r3, r3, #1 /* decrement the counter */
bne octcopy /* ... copy more */
ldmfd sp!, {r4-r11} /* dont need these now - restore originals */
copywords:
ands r2, r2, #7 /* number of odd words to copy */
beq stop /* No words left to copy ? */
wordcopy:
ldr r3, [r0], #4 /* a word from the source */
str r3, [r1], #4 /* store a word to the destination */
subs r2, r2, #1 /* decrement the counter */
bne wordcopy /* ... copy more */
stop:
b stop
/*----------------------------------*/
/* make a word pool */
/*----------------------
您可能关注的文档
- 1.Linux介绍-山东大学课程中心.ppt
- 1.SAPR3系统中的财会子系统.doc
- 1.VIM基本三种模式.ppt
- 1.偏导数和全微分的概念.ppt
- 1.创建ODBC数据源.ppt
- 1.安装系统.doc
- 1.层次数据模型.ppt
- 1.店面型销售单.doc
- 1.所图书馆常用电子资源详解-中国科学院地理科学与资源研究所.ppt
- 1.招聘岗位表.doc
- springbooot+vue基于java的房屋维修系统毕业论文.doc
- 中国消防救援学院《单片机系统实验》2023-2024学年第一学期期末试卷.doc
- 2025年溧阳纺织化学品项目申请.pptx
- 景区门票包销合同模板(3篇).docx
- 【股票技术指标学习指南】第七章第三节货币需要量的测算.doc
- 2025春 _ 人教版七年级英语下册【unit4】看音标写单词.doc
- 2025春 _ 人教版七年级英语下册【unit5】看音标写单词.doc
- 2025春 _ 人教版七年级英语下册【unit6】看音标写单词.doc
- 2025春 _ 人教版七年级英语下册【unit7】看音标写单词.doc
- 2025春 _ 人教版七年级英语下册【unit8】看音标写单词.doc
最近下载
- 《中国利用外资情况》课件.ppt VIP
- 花艺空间装置课件.pptx VIP
- 2024年巴东县选调县外在职在编教师真题.docx VIP
- 2025年广州市中考语文试题卷(含答案及解析).docx
- 农村生态环境保护与可持续发展.pptx VIP
- GB50243-2016通风与空调工程施工质量验收规范附条文.docx VIP
- 合伙公司章程丶教育咨询管理有限公司章程丶劳动合同范本.doc(doc21页).docx VIP
- 三级眼镜验光员理论考试题库(下部分).pdf VIP
- 2025湖北恩施州巴东县选调县外在职在编教师35人笔试备考题库及答案解析.docx VIP
- GBT5836.1-2018 建筑排水用硬聚氯乙烯(PVC-U)管材.pdf VIP
文档评论(0)