libx86emu
libx86emu copied to clipboard
I got a port to Windows working if you are interested
It only took a few very minor changes to adapt the code to compile under Visual Studio 2017. I am pretty sure that this is a comprehensive list all all of the changes it was derived from a diff.
(1) API_SYM was removed everywhere (2) decode.c-------------void decode_hex(x86emu_t *emu, char **p, u64 ofs) (3) api.c -----------------emu->x86.R_EAX = (uint32_t) emu->x86.msr[u]; (4) mem.c---------------six low level port io functions were swapped
#if (_MSC_VER >= 1900) // (Visual Studio 2015 version 14.0)
#include <intrin.h>
#endif
return inb(addr); // becomes __inbyte(addr);
return inw(addr); // becomes __inword(addr);
return inl(addr); // becomes __indword(addr);
outb(val, addr); // becomes __outbyte(val, addr);
outw(val, addr); // becomes __outword(val, addr);
outl(val, addr); // becomes __outdword(val, addr);
(5) x86emu-demo.c-----if(!(f = fopen(file, "rb"))) return 0; (6) I found a good getopt.h that works under Windows. It has a compatible license. https://github.com/skandhurkat/Getopt-for-Visual-Studio/blob/master/getopt.h
To make things very simple I compiled the demo code together with the library files into a single executable. The adapted code also compiles under Linux as a shared library.
Microsoft Visual Studio 2017 Community Edition is freeware. Thanks for adding the --32 option to the demo program. All of these changes have been applied to the most recent commit.
With additional changes it now compiles as c++ in Visual Studio 2017 and gcc.