更新时间:2021-07-29 02:06:12
在Thumb模式下, PUSH
指令的三种编码.第一个是16位长,自ARMv4T(原始的Thumb实现)以来就存在:
There are three encodings of the PUSH
instruction in Thumb mode. The first one is 16 bits long and exists since ARMv4T (original Thumb implementation):
15141312|11|109|8| 7..0 |
1 0 1 1| 0| 10|M| register_list|
由于 register_list
是8位,因此它只能将寄存器 R0
推送到 R7
(和 LR
,如果 M
位置1).
Since register_list
is 8 bits, it can only push registers R0
to R7
(and LR
, if M
bit is set).
在Thumb-2(ARMv6T2,ARMv7和更高版本)中,添加了两个以上的编码.它们都是32位长:
In Thumb-2 (ARMv6T2, ARMv7 and later), two more encodings have been added. They are both 32 bits long:
1514131211|109|876|5|4|3210||151413| 12 .. 0 |
1 1 1 0 1| 00|100|1|0|1101|| 0 M 0| register_list |
在此代码中, register_list
是13位,因此它可以将 R0
推入 R12
和 LR
.
In this one, register_list
is 13 bits, so it can push R0
to R12
and LR
.
我不会列出第三种编码,但是它可以推送任何单个寄存器.
I won't list the third encoding, but it can push any single register.
BTW, POP
编码非常相似.
BTW, POP
encodings are very similar.
16位 POP
:
15141312|11|109|8| 7..0 |
1 0 1 1| 1| 10|P| register_list|
可以将 R0
弹出到 R7
和 PC
(位 P
).
Can pop R0
to R7
and PC
(bit P
).
32位 POP
多个:
1514131211|109|876|5|4|3210||151413| 12 .. 0 |
1 1 1 0 1| 00|010|1|0|1101|| P M 0| register_list |
可以弹出 R0
到 R12
, PC
(位 P
)和 LR
(位 M
).
Can pop R0
to R12
, PC
(bit P
) and LR
(bit M
).