DosFlatToSel() needs to save off registers.
It's not syscall calling convention, and CSet/2 generates thunks that call this function but expect %ecx to not be altered by it. Save off a bunch, just in case.
This commit is contained in:
1 parent
aa06257218
commit
185a983b3c
1 file changed
+15
-2
+15
-2
@@ -657,13 +657,26 @@ ULONG _DosFlatToSel(PVOID ptr)
|
||||
} // _DosFlatToSel
|
||||
|
||||
// DosFlatToSel() passes its argument in %eax, so a little asm to bridge that...
|
||||
// Note that this isn't syscall calling conventions at all; CSet/2 generates
|
||||
// thunking code that expects this function to preserve %ecx, so we'll just
|
||||
// go ahead and save a bunch of stuff, just in case.
|
||||
__asm__ (
|
||||
".globl DosFlatToSel \n\t"
|
||||
".type DosFlatToSel, @function \n\t"
|
||||
"DosFlatToSel: \n\t"
|
||||
" pushl %eax \n\t"
|
||||
" pushl %ebx \n\t" // save off a bunch of stuff. Better safe than sorry.
|
||||
" pushl %ecx \n\t"
|
||||
" pushl %edx \n\t"
|
||||
" pushl %edi \n\t"
|
||||
" pushl %esi \n\t"
|
||||
" pushl %eax \n\t" // the actual argument to DosFlatToSel.
|
||||
" call _DosFlatToSel \n\t"
|
||||
" addl $4, %esp \n\t"
|
||||
" addl $4, %esp \n\t" // clear argument to DosFlatToSel.
|
||||
" popl %esi \n\t"
|
||||
" popl %edi \n\t"
|
||||
" popl %edx \n\t" // save off a bunch of stuff.
|
||||
" popl %ecx \n\t"
|
||||
" popl %ebx \n\t"
|
||||
" ret \n\t"
|
||||
".size _DosFlatToSel, .-_DosFlatToSel \n\t"
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user