marcjal / pyemu

Automatically exported from code.google.com/p/pyemu
0 stars 0 forks source link

LEA instruction is not properly implemented #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

just, watch this. eax is incorrect.

eax=00000001 ebx=00000003 ecx=00000200 edx=00000004 esi=00000300 edi=00000006
eip=004001ef esp=0095e800 ebp=00000100 iopl=00
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000    eflags=[]

004001ef  lea eax,[esi+ecx-0x1]

[*] Executing [0x4001ef][8d] lea eax,[esi+ecx-0x1]

eax=000005ff ebx=00000003 ecx=00000200 edx=00000004 esi=00000300 edi=00000006
eip=004001f3 esp=0095e800 ebp=00000100 iopl=00
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000    eflags=[]

What is the expected output? What do you see instead?

: eax should be 0x4ff instead of 0x5ff. because 8bit displacement of LEA 
instruction is treated like unsigned 8bit. 0xFF is not subtracting 1 instead 
its adding 255.
this makes the incorrect behavior of some of the lea instrustions.

What version of the product are you using? On what operating system?

: latest from here. https://github.com/codypierce/pyemu

Please provide any additional information below.

additionally, PyMemory.py is missing from https://github.com/codypierce/pyemu

Original issue reported on code.google.com by daehee87...@gmail.com on 29 May 2015 at 5:30

GoogleCodeExporter commented 8 years ago
to patch this bug, from remove the "& 0xff" stuffs from PyCpu.py - 
get_memory_address's op.displacement codes.

Original comment by daehee87...@gmail.com on 29 May 2015 at 5:54