Jump to content
Andy Vandijck

New OPEMU supporting fully till SSE4.1

7 posts in this topic

Recommended Posts

I've made a new OPEMU.

It's included in the attachment.

It is required for High Sierra and Mojave

 

# OPEMU
osfmk/OPEMU/opemu.c		standard
osfmk/OPEMU/opemu_math.c	standard
osfmk/OPEMU/ssse3.c		standard
osfmk/OPEMU/sse42.c		standard
osfmk/OPEMU/sse41.c		standard
osfmk/OPEMU/sse3.c		standard
osfmk/OPEMU/libudis86/decode.c standard
osfmk/OPEMU/libudis86/itab.c standard
osfmk/OPEMU/libudis86/syn.c standard
osfmk/OPEMU/libudis86/syn-intel.c standard
osfmk/OPEMU/libudis86/udis86.c standard

 

OPEMU.zip

Share this post


Link to post
Share on other sites
Advertisement
5 hours ago, Andy Vandijck said:

I've made a new OPEMU.

It's included in the attachment.

It is required for High Sierra and Mojave

 


# OPEMU
osfmk/OPEMU/opemu.c		standard
osfmk/OPEMU/opemu_math.c	standard
osfmk/OPEMU/ssse3.c		standard
osfmk/OPEMU/sse42.c		standard
osfmk/OPEMU/sse41.c		standard
osfmk/OPEMU/sse3.c		standard
osfmk/OPEMU/libudis86/decode.c standard
osfmk/OPEMU/libudis86/itab.c standard
osfmk/OPEMU/libudis86/syn.c standard
osfmk/OPEMU/libudis86/syn-intel.c standard
osfmk/OPEMU/libudis86/udis86.c standard

 

OPEMU.zip

Hope some genius can develope a new kernel for AMD K10 CPUs hackintosh or Intel LGA 775 MB as soon as possible !

Share this post


Link to post
Share on other sites

Nice work...

however it breaks kernels past some 10.13 version (10.13.6? idk) as it accesses user data while SMAP is enabled and the flag is not cleared. Mind adding one hook before accessing user data and another after being done (there does not seem to be one unified return path, so should be a bunch)? The hook would be NOP for old kernels and call clac/stac for new kernels.

 

Thx, DF

Share this post


Link to post
Share on other sites
10 hours ago, Andy Vandijck said:

I've made a new OPEMU.

It's included in the attachment.

It is required for High Sierra and Mojave

 


# OPEMU
osfmk/OPEMU/opemu.c		standard
osfmk/OPEMU/opemu_math.c	standard
osfmk/OPEMU/ssse3.c		standard
osfmk/OPEMU/sse42.c		standard
osfmk/OPEMU/sse41.c		standard
osfmk/OPEMU/sse3.c		standard
osfmk/OPEMU/libudis86/decode.c standard
osfmk/OPEMU/libudis86/itab.c standard
osfmk/OPEMU/libudis86/syn.c standard
osfmk/OPEMU/libudis86/syn-intel.c standard
osfmk/OPEMU/libudis86/udis86.c standard

 

OPEMU.zip

 

Thanks for the update. Having issues compiling though,

 

CC  opemu.o
CC  opemu_math.o
In file included from /Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:38:
In file included from /Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.h:5:
In file included from /Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/libudis86/extern.h:33:
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/libudis86/types.h:152:3: error: unknown type name 'int128_t'
  int128_t   sqqword;
  ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/libudis86/types.h:153:3: error: unknown type name 'uint128_t'
  uint128_t  uqqword;
  ^
In file included from /Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:38:
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.h:32:11: warning: parameter 'state:' not found in the function declaration [-Wdocumentation]
 * @param state: xnu's trap.c saved thread state
          ^~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.h:32:11: note: did you mean 'state'?
 * @param state: xnu's trap.c saved thread state
          ^~~~~~
          state
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:65:13: error: use of undeclared identifier 'islongmode'
        if (islongmode)
            ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:90:13: error: use of undeclared identifier 'islongmode'
        if (islongmode)
            ^
CC  nat464_utils.o
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:268:11: warning: parameter 'saved_state:' not found in the function declaration
      [-Wdocumentation]
 * @param saved_state: the saved state
          ^~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:269:11: warning: parameter 'base:' not found in the function declaration [-Wdocumentation]
 * @param base:  the register type itself
          ^~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:269:11: note: did you mean 'base'?
 * @param base:  the register type itself
          ^~~~~
          base
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:270:11: warning: parameter 'where:' not found in the function declaration [-Wdocumentation]
 * @param where: reg's value will be stored there
          ^~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:270:11: note: did you mean 'where'?
 * @param where: reg's value will be stored there
          ^~~~~~
          where
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:400:11: warning: parameter 'saved_state:' not found in the function declaration
      [-Wdocumentation]
 * @param saved_state: the saved state
          ^~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:401:11: warning: parameter 'base:' not found in the function declaration [-Wdocumentation]
 * @param base:  the register type itself
          ^~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:401:11: note: did you mean 'base'?
 * @param base:  the register type itself
          ^~~~~
          base
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:402:11: warning: parameter 'where:' not found in the function declaration [-Wdocumentation]
 * @param where: reg's value will be stored there
          ^~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:402:11: note: did you mean 'where'?
 * @param where: reg's value will be stored there
          ^~~~~~
          where
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:413:29: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> isf.rip = where;
            ~~~~~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:417:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rax = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:421:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rcx = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:425:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rdx = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:429:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rbx = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:433:29: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> isf.rsp = where;
            ~~~~~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:437:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rbp = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:441:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rsi = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:445:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> rdi = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:449:24: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> r8 = where;
            ~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:453:24: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> r9 = where;
            ~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:457:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> r10 = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:461:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> r11 = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:465:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> r12 = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:469:25: error: cannot assign to variable 'ss64' with const-qualified type
      'const x86_saved_state64_t *' (aka 'const struct x86_saved_state64 *')
            ss64 -> r13 = where;
            ~~~~~~~~~~~ ^
/Users/shaneee/Desktop/xnu-4903.221.2/osfmk/OPEMU/opemu.c:407:32: note: variable 'ss64' declared const here
    const x86_saved_state64_t *ss64 = saved_state64(state);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
CC  pf.o
make[7]: *** [opemu.o] Error 1
make[7]: *** Waiting for unfinished jobs....
CC  pf_if.o
make[6]: *** [build_all] Error 2
make[5]: *** [do_all] Error 2
make[4]: *** [build_all] Error 2
make[3]: *** [build_all_recurse_into_conf] Error 2
make[2]: *** [build_all_recurse_into_osfmk] Error 2
make[2]: *** Waiting for unfinished jobs....

 

Share this post


Link to post
Share on other sites
Posted (edited)

First up the compiler doesn't seem to like multi line comments starting with /**, removing one asterisk solves that. Also ss32 and ss64 are defined as constants but are constantly changing, so you need to remove the "const" from their definitions too. Also you need to replace int64_t with __int64_t (same thing with uint64_t), that also solves some errors. Doing so greeted me with another wall of errors though coming from xmmintrin.h and its cousins which I'm currently trying to fix, part of it is caused by duplicate declarations, those are an easy fix, but others seem to come from within the header file itself (?) which leads me to believe that my build environment is just really borked... @XLNC is experiencing the same errors though, so IDK about that. I attached the terminal output from how far I got.

 

Edit: Also in some files you forgot to declare islongmode, doing that also resolves some issues

 

opemu.log

Edited by notiflux

Share this post


Link to post
Share on other sites
On ‎1‎/‎2‎/‎2019 at 6:05 AM, Andy Vandijck said:

I've made a new OPEMU.

It's included in the attachment.

It is required for High Sierra and Mojave

 


# OPEMU
osfmk/OPEMU/opemu.c		standard
osfmk/OPEMU/opemu_math.c	standard
osfmk/OPEMU/ssse3.c		standard
osfmk/OPEMU/sse42.c		standard
osfmk/OPEMU/sse41.c		standard
osfmk/OPEMU/sse3.c		standard
osfmk/OPEMU/libudis86/decode.c standard
osfmk/OPEMU/libudis86/itab.c standard
osfmk/OPEMU/libudis86/syn.c standard
osfmk/OPEMU/libudis86/syn-intel.c standard
osfmk/OPEMU/libudis86/udis86.c standard

 

OPEMU.zip

Hi Andy, did you fix the bugs by now?
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×