Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got a port to Windows working if you are interested #29

Open
plolcott opened this issue Feb 18, 2020 · 0 comments
Open

I got a port to Windows working if you are interested #29

plolcott opened this issue Feb 18, 2020 · 0 comments

Comments

@plolcott
Copy link

plolcott commented Feb 18, 2020

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.

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

No branches or pull requests

1 participant