Skip to content

Commit

Permalink
Pass the exe's module handle to the OS/2 process entry point.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 16, 2016
1 parent 6454917 commit af2e92f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lx_loader.c
Expand Up @@ -455,7 +455,7 @@ static __attribute__((noreturn)) void runLxModule(LxModule *lxmod, const int arg
"pushl %%eax \n\t" // cmd
"pushl %%ecx \n\t" // env
"pushl $0 \n\t" // reserved
"pushl $0 \n\t" // module handle !!! FIXME
"pushl %%edx \n\t" // module handle
"leal 1f,%%eax \n\t" // address that entry point should return to.
"pushl %%eax \n\t"
"pushl %%edi \n\t" // the OS/2 process entry point (we'll "ret" to it instead of jmp, so stack and registers are all correct).
Expand All @@ -466,15 +466,14 @@ static __attribute__((noreturn)) void runLxModule(LxModule *lxmod, const int arg
"xorl %%esi,%%esi \n\t"
"xorl %%edi,%%edi \n\t"
"xorl %%ebp,%%ebp \n\t"
// !!! FIXME: init other registers!
"ret \n\t" // go to OS/2 land!
"1: \n\t" // ...and return here.
"andl $-16, %%esp \n\t" // align the stack for macOS.
"subl $-4, %%esp \n\t" // align the stack for macOS.
"pushl %%eax \n\t" // call _exit() with whatever is in %eax.
"call _exit \n\t"
: // no outputs
: "a" (cmd), "c" (env), "S" (stack), "D" (lxmod->eip)
: "a" (cmd), "c" (env), "d" (lxmod), "S" (stack), "D" (lxmod->eip)
: "memory"
);

Expand Down

0 comments on commit af2e92f

Please sign in to comment.