ARM Addressing Modes

来源:互联网 发布:知乎spam 编辑:程序博客网 时间:2024/04/18 20:56

arm的寻址方式果然不同!

 

ARM一共有五种不同的寻址模式,每个模式下面又有不同的子类

• Addressing Mode 1 - Data-processing operands on page A5-2

貌似加减乘除这几种运算用这种形式的比较多些。

<opcode>{<cond>}{S} <Rd>, <Rn>, <shifter_operand>
where <shifter_operand> is one of the following:
1. #<immediate>
2. <Rm>
3. <Rm>, LSL #<shift_imm>
4. <Rm>, LSL <Rs>
5. <Rm>, LSR #<shift_imm>
6. <Rm>, LSR <Rs>
7. <Rm>, ASR #<shift_imm>
8. <Rm>, ASR <Rs>
9. <Rm>, ROR #<shift_imm>
10. <Rm>, ROR <Rs>
11. <Rm>, RRX

• Addressing Mode 2 - Load and Store Word or Unsigned Byte on page A5-18

这里有两个新的概念,pre-index和post-index。 值两者的区别是pre-index的address是更新过的,而post-index的address是未更新的。

LDR|STR{<cond>}{B}{T} <Rd>, <addressing_mode>
where <addressing_mode> is one of the nine options listed below.
All nine of the following options are available for LDR, LDRB, STR and STRB. For LDRBT, LDRT, STRBT and STRBT,
only the post-indexed options (the last three in the list) are available. For the PLD instruction described in
PLD on page A4-90, only the offset options (the first three in the list) are available.
1. [<Rn>, #+/-<offset_12>]
2. [<Rn>, +/-<Rm>]
3. [<Rn>, +/-<Rm>, <shift> #<shift_imm>]

下面这三个有感叹号的是pre-index mode
4. [<Rn>, #+/-<offset_12>]!
5. [<Rn>, +/-<Rm>]!
6. [<Rn>, +/-<Rm>, <shift> #<shift_imm>]!

下面这三个(我也看不出有啥特别),是post-index mode
7. [<Rn>], #+/-<offset_12>
8. [<Rn>], +/-<Rm>
9. [<Rn>], +/-<Rm>, <shift> #<shift_imm>

Addressing Mode 3 - Miscellaneous Loads and Stores on page A5-33

这种类型和上面的类型比较,都少了shift的情况。

LDR|STR{<cond>}H|SH|SB|D <Rd>, <addressing_mode>
where <addressing_mode> is one of the following six options:
1. [<Rn>, #+/-<offset_8>]
2. [<Rn>, +/-<Rm>]

pre-index mode
3. [<Rn>, #+/-<offset_8>]!
4. [<Rn>, +/-<Rm>]!

post-index mode
5. [<Rn>], #+/-<offset_8>
6. [<Rn>], +/-<Rm>


• Addressing Mode 4 - Load and Store Multiple on page A5-41


LDM|STM{<cond>}<addressing_mode> <Rn>{!}, <registers>{^}
where <addressing_mode> is one of the following four addressing modes:
1. IA (Increment After)
2. IB (Increment Before)
3. DA (Decrement After)
4. DB (Decrement Before)

 

• Addressing Mode 5 - Load and Store Coprocessor on page A5-49.

<opcode>{<cond>}{L} <coproc>,<CRd>,<addressing_mode>
where <addressing_mode> is one of the following four options:
1. [<Rn>,#+/-<offset_8>*4]
2. [<Rn>,#+/-<offset_8>*4]!
3. [<Rn>],#+/-<offset_8>*4
4. [<Rn>],<option>

 

原创粉丝点击