将ARM7机器语言解码为ARM指令

问题描述 投票:1回答:1

尝试解码:

  1. 0x15882BCD
  2. 0xC3A01B28

我继续得到LDMDAHS指令,但我知道那是不对的。有人可以帮忙吗?

assembly encoding arm decoding arm7
1个回答
0
投票
.inst 0x15882BCD
.inst 0xC3A01B28
.thumb
.inst 0x2BCD
.inst 0x1588
.inst 0x1B28
.inst 0xC3A0

arm-none-eabi-as so.s -o so.o
arm-none-eabi-objdump -D so.o

so.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <.text>:
   0:   15882bcd    strne   r2, [r8, #3021] ; 0xbcd
   4:   c3a01b28    movgt   r1, #40, 22 ; 0xa000
   8:   2bcd        cmp r3, #205    ; 0xcd
   a:   1588        asrs    r0, r1, #22
   c:   1b28        subs    r0, r5, r4
   e:   c3a0        stmia   r3!, {r5, r7}

这与您想要的东西相似吗?

byteswapped

.inst 0xcd2b8815
.inst 0x281ba0c3
.thumb
.inst 0x8815
.inst 0xcd2b
.inst 0xa0c3
.inst 0x281b


00000000 <.text>:
   0:   cd2b8815    stcgt   8, cr8, [r11, #-84]!    ; 0xffffffac
   4:   281ba0c3    ldmdacs r11, {r0, r1, r6, r7, sp, pc}
   8:   8815        ldrh    r5, [r2, #0]
   a:   cd2b        ldmia   r5, {r0, r1, r3, r5}
   c:   a0c3        add r0, pc, #780    ; (adr r0, 31c <.text+0x31c>)
   e:   281b        cmp r0, #27

请注意,根据binutils的版本,您可能需要弄乱.word,.hword,.inst.n,.inst.w,这会让我想起...

.thumb
.syntax unified
.inst.w 0x15882BCD
.inst.w 0xC3A01B28


Disassembly of section .text:

00000000 <.text>:
   0:   1588        asrs    r0, r1, #22
   2:   2bcd        cmp r3, #205    ; 0xcd
   4:   c3a0        stmia   r3!, {r5, r7}
   6:   1b28        subs    r0, r5, r4

是的,这些不是thumb2指令(distict模式),它们看起来不像aarch32,但是...

so.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <.text>:
   0:   15882bcd    b   620af34 <.text+0x620af34>
   4:   c3a01b28    .inst   0xc3a01b28 ; undefined

不要认为它是aarch64

© www.soinside.com 2019 - 2024. All rights reserved.