我正在调试一个 ARM 程序(android)并对其进行一些修改。我想在0x8436中jmp 0x8684,所以我覆盖了4个字节的blx指令,之后我使用IDA pro加载程序,从IDA的角度来看似乎成功:
IDA view
-----------------------------------------------------------------
.text:00008430 LDR R0, =(aOkkkkkkk___ - 0x8438)
.text:00008432 PUSH {R4,LR}
.text:00008434 ADD R0, PC ; "okkkkkkk..."
.text:00008436 BLX sub_8684
.text:0000843A POP {R4,PC}
HEX view(the machine code)
-----------------------------------------------------------------
00008436 00 F0 25 E9
但是程序运行失败(src程序运行正常):
arm-eabi-gdb
-----------------------------------------------------------------
(gdb) x/10i 0x8430
=> 0x8430: ldr r0, [pc, #8] ; (0x843c)
0x8432: push {r4, lr}
0x8434: add r0, pc
0x8436: ; <UNDEFINED> instruction: 0xf000e925
0x843a: pop {r4, pc}
(gdb) x/10x 0x8436
0x8436: 0xe925f000 0x001cbd10
那么blx指令的机器码错了?请帮帮我...我想知道将blx转换为机器码的正确指令和算法...
原始说明(正常运行)在这里:
ori:
.text:00008430 LDR R0, =(aOkkkkkkk___ - 0x8438)
.text:00008432 PUSH {R4,LR}
.text:00008434 ADD R0, PC ; "okkkkkkk..."
.text:00008436 BLX sub_83F0
.text:0000843A POP {R4,PC}
ori:
00008430 02 48 10 B5 78 44 FF F7 DC EF 10 BD
modified:
00008430 02 48 10 B5 78 44 00 F0 25 E9 10 BD