Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Register name not found via translate_register_name #119

Open
frapik99 opened this issue Apr 23, 2017 · 3 comments
Open

Register name not found via translate_register_name #119

frapik99 opened this issue Apr 23, 2017 · 3 comments

Comments

@frapik99
Copy link

Hi,
analysing a project I encountered the following assembly instruction:

0x901e774:	or	ah, 0x10

This was translated into:

09 | ------ IMark(0x901e774, 3, 0) ------
10 | t4 = GET:I8(9)
11 | t2 = Or8(t4,0x10)
12 | PUT(cc_op) = 0x0000000d
13 | t13 = 8Uto32(t2)
14 | PUT(cc_dep1) = t13
15 | PUT(cc_dep2) = 0x00000000
16 | PUT(cc_ndep) = 0x00000000
17 | PUT(9) = t2

I suspect for some reason the ah register was not found so also the pp() function prints the output in that way.

I tried to obtain the right register name using source = self.project.arch.translate_register_name(instruction.data.offset, 8) but I have always 9 as result. For all the other instructions all was correct. Any idea on how to fix it?

Thanks

@zardus
Copy link
Member

zardus commented Apr 25, 2017

Register names are resolved using this dict: https://github.com/angr/archinfo/blob/master/archinfo/arch_x86.py#L127

It looks like we don't have the partial registers there ah, al, etc. Adding them to that dict (and sending a PR!) should get them to display.

@rhelmot
Copy link
Member

rhelmot commented Apr 25, 2017 via email

@ltfish
Copy link
Member

ltfish commented Apr 25, 2017

This issue has been fixed by my commit to archinfo (see here). You want to use the latest version of both PyVEX and archinfo.

Here is an example output from IPython with the latest version of everything from GitHub:

In [1]: import angr

In [2]: import archinfo

In [3]: block = angr.block.Block(addr=0, arch=archinfo.ArchX86(), byte_string="\x80\xcc\x10")

In [4]: block.vex.pp()
IRSB {
   t0:Ity_I8 t1:Ity_I8 t2:Ity_I8 t3:Ity_I32 t4:Ity_I32

   00 | ------ IMark(0x0, 3, 0) ------
   01 | t2 = GET:I8(ah)
   02 | t0 = Or8(t2,0x10)
   03 | PUT(cc_op) = 0x0000000d
   04 | t3 = 8Uto32(t0)
   05 | PUT(cc_dep1) = t3
   06 | PUT(cc_dep2) = 0x00000000
   07 | PUT(cc_ndep) = 0x00000000
   08 | PUT(ah) = t0
   NEXT: PUT(eip) = 0x00000003; Ijk_Boring
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants