<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > ARM處理器寄存器和匯編指令系統(tǒng)

          ARM處理器寄存器和匯編指令系統(tǒng)

          作者: 時(shí)間:2016-11-09 來(lái)源:網(wǎng)絡(luò) 收藏
          1.ARM的處理器模式

          ARM體系結(jié)構(gòu)支持7種處理器模式,分別是:用戶、FIQ、IRQ、管理、中止(abort)、未定義和系統(tǒng)模式。除了用戶模式外,其余都稱之為特權(quán)模式。除了用戶和系統(tǒng)模式外,其余都稱之為異常模式。

          本文引用地址:http://www.ex-cimer.com/article/201611/317752.htm

          2.ARM的存儲(chǔ)器組織

          ARM處理器總共有37個(gè)寄存器:包括31個(gè)通用寄存器、包括程序計(jì)數(shù)器(PC)、和6個(gè)狀態(tài)寄存器。這些寄存器在不同模式下,不能被同時(shí)看到,有些名稱是重疊的。分為三類:不分組寄存器,分組寄存器和程序計(jì)數(shù)器

          1)不分組寄存器R0~R7

          所有的處理模式下、它們都是訪問(wèn)同一個(gè)寄存器,因此只有8個(gè)不分組寄存器。

          2)分組寄存器R8~R14

          每一個(gè)訪問(wèn)的物理寄存器取決于當(dāng)前的處理器模式,有些是共用的,而有些事分離的。具體可以查詢相關(guān)資料。

          R13就是堆棧寄存器SP,而R14就是鏈接寄存器LR

          3)程序計(jì)數(shù)器R15

          在ARM狀態(tài)PC的位[1:0]為0,而在Thumb狀態(tài),位[0]為0.

          4)程序狀態(tài)寄存器CPSR和程序狀態(tài)保存寄存器SPSR

          CPSR只有一個(gè),代表了當(dāng)前的程序狀態(tài)。而每個(gè)異常模式都有獨(dú)立的一個(gè)SPSR,用于保存CPSR的狀態(tài)。


          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1
          2

          3.ARM的常用匯編指令

          1)基本尋址方式

          包括有寄存器尋址、立即尋址、寄存器移位尋址、寄存器間尋址、變址尋址、多寄存器尋址、堆棧尋址、塊復(fù)制尋址和相對(duì)尋址

          2)條件執(zhí)行

          幾乎所有的ARM指令都可以包含一個(gè)可選的條件碼,句法中以{cond}來(lái)標(biāo)識(shí)。可用的條件碼如下面所示。幾乎所有的ARM數(shù)據(jù)處理指令均可以根據(jù)執(zhí)行結(jié)果來(lái)選擇是否更新條件碼標(biāo)志,即在指令中包含后綴S。


          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          --> 1
          2
          3
          4650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />0010 CS/HS C置位 大于或等于(無(wú)符號(hào)>=)
          5650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />0011 CC/LO C清零 小于(無(wú)符號(hào)<)
          6650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />0100 MI N置位 負(fù)
          7650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />0101 PL N清零 正或零
          8650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />0110 VS V置位 溢出
          9650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />0111 VC V清零 未溢出
          10650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1000 HI C置位且Z清零 大于(無(wú)符號(hào)>)
          11650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1001 LS C清零或Z置位 小于或等于(無(wú)符號(hào)<=)
          12650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1010 GE N和V相同 帶符號(hào)>=
          13650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1011 LT N和V不同 帶符號(hào)<
          14650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1100 GT Z清零且N和V相同 帶符號(hào)>
          15650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1101 LE Z置位或N和V不同 帶符號(hào)<=
          16650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />1110 AL 任何 總是(通常省略)

          3)存儲(chǔ)器訪問(wèn)指令

          3.1)LDR和STR(字與無(wú)符號(hào)字節(jié))語(yǔ)法如下

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} {B} {T} Rd, [Rn]
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} {B} Rd, [Rn, Flexoffset] {!} //前索引偏移
          3650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} {B} Rd, label
          4650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} {B} {T} Rd, [Rn], Flexoffset //后索引偏移

          其中:

          op 是操作碼即指令LDR或STR。

          cond 就是上面所說(shuō)的條件碼,因此指令可以變成LDREQ或STRNE類似的名稱,表示滿足某些條件時(shí)該條指令才會(huì)執(zhí)行。

          B 可選后綴,表示傳送Rd的最低有效字節(jié),就是所謂的無(wú)符號(hào)字節(jié)傳送,字節(jié)加載的時(shí)候是用0來(lái)擴(kuò)展到32位的。

          T 可選后綴,即使處理器是在特權(quán)模式下,存儲(chǔ)系統(tǒng)也將訪問(wèn)看成是處理器在用戶模式下。不能和前索引偏移一起使用。

          Rd 用于加載或存儲(chǔ)的ARM寄存器

          Rn 存儲(chǔ)器的基址寄存器。若指令是帶寫回的前索引或后索引(后索引都是寫回的),則Rd和Rn不能相同

          Flexoffset 加到Rn上的靈活的偏移量

          label 程序相對(duì)偏移表達(dá)式。label必須是當(dāng)前指令的+-4KB范圍內(nèi)

          ! 可選后綴,前索引寫回標(biāo)志,若Rn是R15,則不能用后綴!

          Flexoffset的句法包括下面兩種

          1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />#expr
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />{-} Rm {, shift}
          - 是可選符號(hào),表示從Rn中減去偏移量,否則是加
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />expr 表達(dá)式,取值范圍-4095~+4095的整數(shù)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />Rm 內(nèi)含偏移量的寄存器。Rm不允許是R15
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />shift Rm的可選移位方法,可以是下列形式的任何一種
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> ASR n算術(shù)右移n位(1<=n<=32)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> LSL n邏輯左移n位(0<=n<=31)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> LSR n邏輯右移n位(1<=n<=32)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> ROR n循環(huán)右移n位(1<=n<=31)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> RRX 循環(huán)右移1位,帶擴(kuò)展

          3.2)LDR和STR(半字和帶符號(hào)字節(jié))語(yǔ)法如下:

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} type Rd, [Rn]
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} type Rd, [Rn, offset] {!}
          3650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} type Rd, label
          4650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} type Rd, [Rn], offset

          其中:

          type 必須是以下所列其中之一

          SH 對(duì)帶符號(hào)半字(僅LDR)

          H 對(duì)無(wú)符號(hào)半字

          SB 對(duì)帶符號(hào)字節(jié)(僅LDR)

          label 程序相對(duì)偏移表達(dá)式。必須是當(dāng)前指令+-255字節(jié)范圍

          offset 加在Rn上的偏移量,可以是以下兩種形式之一

          #expr //值為+-255范圍內(nèi)的整數(shù)。

          {-} Rm

          3.3)LDR和STR(雙字)加載兩個(gè)相鄰的存儲(chǔ)器和存儲(chǔ)兩個(gè)相鄰的寄存器,語(yǔ)法如下:

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} D Rd, [Rn]
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} D Rd, [Rn, offset] {!}
          3650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} D Rd, label
          4650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} D Rd, [Rn], offset

          其中:

          Rd 加載或存儲(chǔ)寄存器其中一個(gè),另一個(gè)是R(d+1)。但Rd必須是偶數(shù)寄存器,且不能是R14。

          Rn 除非指令為零偏移,或不帶寫回的前索引,否則Rn不允許與Rd和R(d+1)相同

          offset 加在Rn上的偏移量

          label 程序相對(duì)偏移表達(dá)式。必須是當(dāng)前指令+-255字節(jié)范圍

          3.4)LDM和STM 加載多個(gè)寄存器或存儲(chǔ)多個(gè)寄存器,可以傳送R0~R15的任何組合

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} mode Rn{!}, reglist{^}

          其中:

          mode是下列情況中之一:

          IA 每次傳送后地址加1

          IB 每次傳送前地址加1

          DA 每次傳送后地址減1

          DB 每次傳送前地址減1

          FD 滿遞減堆棧

          ED 空遞減堆棧

          FA 滿遞增堆棧

          EA 空遞增堆棧

          Rn 基址寄存器,傳送數(shù)據(jù)的初始地址。不允許是R15

          ! 可選后綴。若有!,則最后的地址寫回Rn

          reglist 加載或存儲(chǔ)的寄存器列表 可以寫出如下形式

          {R0, R2, R9}

          {R3-R6, R11, R12}

          {R0, R4-R7, LR}

          3.4) SWP 在寄存器和存儲(chǔ)器之間進(jìn)行數(shù)據(jù)交換。

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />SWP {cond} {B} Rd, Rm, [Rn]

          其中:

          B 可選后綴。若有B,則是交換字節(jié),否則交換字

          Rd 數(shù)據(jù)從存儲(chǔ)器加載到Rd

          Rm Rm的內(nèi)容存儲(chǔ)到存儲(chǔ)器。如果Rm和Rd的相同,則是交換寄存器和存儲(chǔ)器的內(nèi)容

          Rn Rn的內(nèi)容指定要進(jìn)行數(shù)據(jù)交換的存儲(chǔ)器的地址。 Rn必須和Rm和Rd不同

          4)ARM數(shù)據(jù)處理指令

          4.1)靈活的第二操作數(shù),在數(shù)據(jù)處理指令中會(huì)經(jīng)常出現(xiàn)第二操作數(shù),即Operand2,它有如下的兩種可能形式。

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /># immed_8r
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />Rm{, shift}

          其中:

          immed_8r 取值為數(shù)字常量的表達(dá)式。常量必須對(duì)應(yīng)8位位圖在32位字中被循環(huán)移位偶數(shù)位(0,2,4,6,...,28,30)后的值

          合法的常量有:0xFF,0x104,0xFF0,0xFF000,0xF0000000F等

          非法的常量有:0x101,0x102,0xFF1,0xFF04等

          Rm 存儲(chǔ)第二操作數(shù)數(shù)據(jù)的寄存器,可以用各種方法對(duì)寄存器中的位圖進(jìn)行移位或循環(huán)移位,操作結(jié)果用于Operand2

          但Rm本身不改變。

          shift 對(duì)Rm的可選移位方法,可以是以下方法的任何一種

          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> ASR n算術(shù)右移n位(1<=n<=32)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> LSL n邏輯左移n位(0<=n<=31)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> LSR n邏輯右移n位(1<=n<=32)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> ROR n循環(huán)右移n位(1<=n<=31)
          650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /> RRX 循環(huán)右移1位,帶擴(kuò)展

          type Rs 其中type為上面ASR、LSL、LSR、ROR中的一種;Rs為提供移位量的寄存器,僅使用最低有效字節(jié)

          4.2)ADD、SUB、RSB、ADC、SBC和RSC

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} {S} Rd, Rn, Operand2

          其中:

          op 是上面眾多指令中的一個(gè)

          S 可選后綴,會(huì)根據(jù)結(jié)果來(lái)更新條件碼標(biāo)志

          Rd 結(jié)果寄存器

          Rn 保存第一操作數(shù)的寄存器

          Operand2 第二操作數(shù)

          ADD 表示Rn加Operand2的值存到Rd

          SUB 表示Rn減去Operand2

          RSB 表示Operand2減去Rn

          ADC 將Rn和Operand2相加后再加上進(jìn)位標(biāo)志

          SBC 從Rn的值中減去Operand2的值,若進(jìn)位標(biāo)志是清零的,則結(jié)果減去1

          RSC 從Operand2中減去Rn的值,若進(jìn)位是清零的,則結(jié)果減去1

          4.3)AND、ORR、EOR和BIC

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond} {S} Rd, Rn, Operand2

          其中:AND是與、ORR是或、EOR是異或和BIC是位清零

          都是Rn和Operand2中的值做處理,然后結(jié)果保存在Rd中

          BIC 用于將Rn中的位于Operand2中相應(yīng)位的反碼,進(jìn)行與操作。

          4.3)MOV和MVN 傳送與傳送非

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MOV {cond} {S} Rd,Operand2
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MVN {cond} {S} Rd,Operand2

          MOV將Operand2中的值拷貝到Rd中

          而MVN將Operand2的值進(jìn)行按位邏輯非之后再傳送到Rd

          4.4)CMP和CMN 比較與比較反值

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />CMP {cond} Rn, Operand2
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />CMN {cond} Rn, Operand2

          CMP比較大小,從Rn中減去Operand2的值,但丟棄結(jié)果,更新標(biāo)志位,指令的主要目的是更新標(biāo)志位

          CMN是將Rn和Operand2相加,丟棄結(jié)果再更新標(biāo)志位。

          4.5)TST和TEQ 測(cè)試和測(cè)試相等

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />TST {cond} Rn, Operand2
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />TEQ {cond} Rn, Operand2

          TST對(duì)Rn和Operand2的值進(jìn)行按位與操作,更新標(biāo)志位,丟棄結(jié)果

          TEQ對(duì)Rn和Operand2的值進(jìn)行異或操作,更新標(biāo)志位,丟棄結(jié)果

          4.6)CLZ 前導(dǎo)零計(jì)數(shù)

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />CLZ {cond} Rd, Rm

          Rd 結(jié)果寄存器,不允許是R15

          Rm 操作數(shù)寄存器。CLZ對(duì)Rm中的前導(dǎo)零的個(gè)數(shù)進(jìn)行計(jì)數(shù),結(jié)果放在Rd中,若Rm全為0,則結(jié)果為32

          若位[31]是1,則結(jié)果為0

          4.7)MUL和MLA 乘法和乘加運(yùn)算

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MUL {cond} {S} Rd,Rm,Rs
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MLA {cond} {S} Rd,Rm,Rs,Rn

          其中:

          Rd 結(jié)果寄存器,不能使R15

          Rm,Rs,Rn 操作寄存器,不能是R15,Rd不能和Rm相同

          MUL 將Rm和Rs相乘,并將最低有效32位結(jié)果放在Rd中

          MLA 將Rm和Rs相乘,再加上Rn的值,將最低有效32位結(jié)果放在Rd中

          4.8)UMULL、UMLAL、SMULL和SMLAL 無(wú)符號(hào)和帶符號(hào)長(zhǎng)整數(shù)乘法和乘加,結(jié)果是64位

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />op {cond}{S} RdLo,RdHi,Rm,Rs

          其中:

          RdLo和RdHi 是結(jié)果寄存器

          Rm和Rs 是操作數(shù)寄存器

          UMULL 將Rm和Rs中的值解釋為無(wú)符號(hào)整數(shù)。將兩數(shù)相乘,并將結(jié)果的最低32位放RdLo中,高32位放RdHi中

          UMLAL 將Rm和Rs中的值解釋為無(wú)符號(hào)整數(shù)。將兩數(shù)相乘,并將結(jié)果加回到RdLo和RdHi的64位無(wú)符號(hào)整數(shù)上。

          SMULL 將Rm和Rs中的值解釋為有符號(hào)補(bǔ)碼整數(shù)。將兩數(shù)相乘,并將結(jié)果的最低32位放RdLo中,高32位放RdHi中

          SMLAL 將Rm和Rs中的值解釋為有符號(hào)補(bǔ)碼整數(shù)。并將結(jié)果加回到RdLo和RdHi的64位無(wú)符號(hào)整數(shù)上。

          5)ARM轉(zhuǎn)移指令

          5.1)B和BL 跳轉(zhuǎn)指令

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />B {cond} label
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />BL {cond} label

          其中:

          label 是程序相對(duì)偏移表達(dá)式。兩條指令都會(huì)令程序轉(zhuǎn)移到label上,而BL還會(huì)將原來(lái)的下一條指令地址保存在R14上

          6)ARM協(xié)處理指令

          7)其他指令

          7.1)SWI 軟件中斷

          7.2)MRS 將CPSR或SPSR的內(nèi)容保存到寄存器中

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MRS {cond} Rd,psr

          其中:

          Rd 目標(biāo)寄存器,Rd不允許為R15

          psr CPSR或SPSR

          7.3)MSR 將立即數(shù)或通用寄存器的內(nèi)容加載到CPSR或SPSR的指定區(qū)域

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MSR {cond} _,#immed_8r
          2650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />MSR {cond} _,Rm

          其中:

          psr 即是CPSR或SPSR

          fileds是制定傳送區(qū)域,可以是

          c 控制域屏蔽字節(jié)(PSR[7:0])

          x 擴(kuò)展域屏蔽字節(jié)(PSR[15:8])

          s 狀態(tài)域屏蔽字節(jié)(PSR[23:16])

          f 標(biāo)志域屏蔽字節(jié)(PSR[31:24])

          8)偽指令

          8.1)ADR 將程序的相對(duì)偏移或寄存器相對(duì)偏移地址加載到寄存器中

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />ADR {cond} register,expr

          其中:

          register 是加載的寄存器

          expr 是程序相對(duì)偏移或寄存器相對(duì)偏移表達(dá)式,取值可以是

          非字節(jié)對(duì)齊地址-255~255

          字節(jié)對(duì)齊地址-1020~1020

          請(qǐng)注意,這條指令是用來(lái)獲取相對(duì)偏移地址的。

          即是用當(dāng)前PC的值,去減去某一個(gè)適當(dāng)?shù)闹担ň幾g器自動(dòng)計(jì)算),從而得到expr這個(gè)標(biāo)號(hào)的相對(duì)地址,將這個(gè)標(biāo)號(hào)的相對(duì)于當(dāng)前pc的偏移地址存儲(chǔ)到register中。正是因?yàn)檫@樣,這條指令才是一條偽指令,這樣的好處是可以繞過(guò)程序入口地址的影響,而始終能跳轉(zhuǎn)到準(zhǔn)確的地址,因?yàn)锽這樣的跳轉(zhuǎn)指令是跳轉(zhuǎn)到絕對(duì)地址上的,而ADR可以獲取到一個(gè)相對(duì)于當(dāng)前PC的地址,所以用處非常大。

          8.2)LDR 用常量或地址加載寄存器

          Code highlighting produced by Actipro CodeHighlighter (freeware)
          http://www.CodeHighlighter.com/

          -->1650) this.width=650;" alt="" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />LDR {cond} register,=[expr | label-expr]

          其中:

          register 加載寄存器

          expr 賦值成數(shù)字常量

          label-expr 程序相對(duì)偏移或外部表達(dá)式

          匯編器可自動(dòng)識(shí)別數(shù)字常量,從而完成對(duì)register賦值的操作。




          評(píng)論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();