“分支指令的偏移量是由汇编程序计算的:-通过将分支指令和目标地址之间的差减8(以允许流水线)。”在此信息的某些slides.According中找到了tihs信息,我假设1.行的地址是...4000和400c.So 4000中的BNE循环的地址-400c=-c和-c-8=-14。所以我认为机器码值应该是0001 101 0 1111111111111111111010100。最后一部分是偏移量和它的-14的2的偏移量是真的,我不能确定,但也有一些资源说偏移值应该是-5,所以我不能确定。this is the empty set
loop LDR R2,[R1],#4 ; Loading value from array and ;updating(increment) the address
ADD R3,R3,R2 ; Sum is stored in R3 register
SUB R0,R0,#1 ; Decrementing counter value
CMP R0,#00 ; Checking counter value
BNE loop发布于 2020-06-09 04:39:17
00002000 <loop>:
2000: e4912004 ldr r2, [r1], #4
2004: e0833002 add r3, r3, r2
2008: e2400001 sub r0, r0, #1
200c: e3500000 cmp r0, #0
2010: 1afffffa bne 2000 <loop>组装和链接。
1afffffa条件0b0001,0b1010操作码,分支(非链接)有符号立即24
0xFFFFFA
<target_address>
Specifies the address to branch to. The branch target address is calculated by:
1. Sign-extending the 24-bit signed (two’s complement) immediate to 32 bits.
2. Shifting the result left two bits.
3. Adding this to the contents of the PC, which contains the address of the branch
instruction plus 8.所以:
0xFFFFFFFA<<2 = 0xFFFFFFE8
0xFFFFFFE8+0x2010+8 = 0x2000对象反汇编:
0xFFFFFFE8+0+8 = 0x0要创建指令0x2000 - (0x2010+8) = 0xFFFFFFE8,0xFFFFFFE8>>2 = 0xFFFFFFFA,请修剪为24位0x00FFFFFFA。添加条件和opcopde 0x1AFFFFFA。
对于这类东西,获取原始的ARM ARM,在不搜索非法副本的情况下,您可以从ARM找到的最接近的方法是获取ARMv5 ARM ARM,其中包括像上面这样易于理解的描述。有时ARMv7-AR更好,但在很多时候,原始的手臂直系后代是最好的。
https://stackoverflow.com/questions/62270423
复制相似问题