UBUNTU 16.04使libx86emu x86emu-demo正常工作吗?

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

有人知道如何使libx86emu x86emu-demo正常工作吗?

https://github.com/wfeldt/libx86emu

Test.obj  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
000000B0  00 0A 00 00 55 8B EC 51 C7 45 FC 00 00 00 00 8B 
000000C0  45 FC 50 E8 09 00 00 00 83 C4 04 33 C0 8B E5 5D 
000000D0  C3 55 8B EC B8 01 00 00 00 5D C3 00 07 00 00 00 

B4: 55                      push   ebp
B5: 8b ec                   mov    ebp,esp
B7: 51                      push   ecx
B8: c7 45 fc 00 00 00 00    mov    DWORD PTR [ebp-0x4],0x0
BF: 8b 45 fc                mov    eax,DWORD PTR [ebp-0x4]
C2: 50                      push   eax
C3: e8 09 00 00 00          call   0x1d
C8: 83 c4 04                add    esp,0x4
CB: 33 c0                   xor    eax,eax
CD: 8b e5                   mov    esp,ebp
CF: 5d                      pop    ebp
D0: c3                      ret
D1: 55                      push   ebp
D2: 8b ec                   mov    ebp,esp
D4: b8 01 00 00 00          mov    eax,0x1
D9: 5d                      pop    ebp
DA: c3                      ret

./ x86emu-demo -l 0 -s 0xB4 Test.obj

我需要能够执行与上述示例类似的x86机器代码。 libx86emu解码并执行前三个指令,然后错误地解码第四条指令。我只需要能够仿真32位x86,就不需要任何操作系统支持。

只有大约一半的libx86emu x86test回归测试通过。

这是实际执行跟踪

eax 00000000, ebx 00000000, ecx 00000000, edx 00000000
esi 00000000, edi 00000000, ebp 00000000, esp 00000000
cs 0000, ss 0000, ds 0000, es 0000, fs 0000, gs 0000
eip 000000b4, eflags 00000002
x [000000b4] = 55
w [0000fffe] = 0000
0 0000:00b4 55                       push bp

eax 00000000, ebx 00000000, ecx 00000000, edx 00000000
esi 00000000, edi 00000000, ebp 00000000, esp 0000fffe
cs 0000, ss 0000, ds 0000, es 0000, fs 0000, gs 0000
eip 000000b5, eflags 00000002
x [000000b5] = 8b
x [000000b6] = ec
1 0000:00b5 8bec                     mov bp,sp

eax 00000000, ebx 00000000, ecx 00000000, edx 00000000
esi 00000000, edi 00000000, ebp 0000fffe, esp 0000fffe
cs 0000, ss 0000, ds 0000, es 0000, fs 0000, gs 0000
eip 000000b7, eflags 00000002
x [000000b7] = 51
w [0000fffc] = 0000
2 0000:00b7 51                       push cx

eax 00000000, ebx 00000000, ecx 00000000, edx 00000000
esi 00000000, edi 00000000, ebp 0000fffe, esp 0000fffc
cs 0000, ss 0000, ds 0000, es 0000, fs 0000, gs 0000
eip 000000b8, eflags 00000002
x [000000b8] = c7
x [000000b9] = 45
x [000000ba] = fc
x [000000bb] = 0000
w [0000fffc] = 0000
3 0000:00b8 c745fc0000               mov [di-04],0000

eax 00000000, ebx 00000000, ecx 00000000, edx 00000000
esi 00000000, edi 00000000, ebp 0000fffe, esp 0000fffc
cs 0000, ss 0000, ds 0000, es 0000, fs 0000, gs 0000
eip 000000bd, eflags 00000002
x [000000bd] = 00
x [000000be] = 00
r [00000000] = 4c
w [00000000] = 4c
4 0000:00bd 0000                     add [bx+si],al
* no proper code
assembly x86 emulation
1个回答
0
投票

https://github.com/wfeldt/libx86emu/issues/25

libx86emu“ Steffen Winterfeldt”的作者更新:libx86emu / demo / x86emu-demo.c因此它现在具有“ 32位模式”命令行参数。

以前是在默认的16位模式下执行的代码。

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