Alexandre Julliard : ntdll: Reimplemented _chkstk and _alloca_probe directly in assembly.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 15 04:35:12 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 50bbfb3c8c6f69be82291f1d8cf9916343e24a61
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=50bbfb3c8c6f69be82291f1d8cf9916343e24a61

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec 15 10:48:12 2005 +0100

ntdll: Reimplemented _chkstk and _alloca_probe directly in assembly.

---

 dlls/ntdll/ntdll.spec |    4 ++--
 dlls/ntdll/rtl.c      |   24 ++++++++++++++----------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 04ae9f4..64e7daf 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1233,7 +1233,7 @@
 @ stdcall -ret64 _alldiv(double double)
 # @ stub _alldvrm
 @ stdcall -ret64 _allmul(double double)
-@ stdcall -i386 _alloca_probe()
+@ stdcall -i386 -norelay _alloca_probe()
 @ stdcall -ret64 _allrem(double double)
 # @ stub _allshl
 # @ stub _allshr
@@ -1242,7 +1242,7 @@
 # @ stub _aulldvrm
 @ stdcall -ret64 _aullrem(double double)
 # @ stub _aullshr
-@ stdcall -i386 _chkstk()
+@ stdcall -i386 -norelay _chkstk()
 @ stub _fltused
 @ cdecl -ret64 _ftol() NTDLL__ftol
 @ cdecl _i64toa(double ptr long)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index f01dbe4..0881c97 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -391,11 +391,13 @@ DWORD WINAPI RtlDeleteSecurityObject(DWO
  * Glorified "enter xxxx".
  */
 #ifdef __i386__
-void WINAPI __regs__chkstk( CONTEXT86 *context )
-{
-    context->Esp -= context->Eax;
-}
-DEFINE_REGS_ENTRYPOINT( _chkstk, 0, 0 );
+__ASM_GLOBAL_FUNC( _chkstk,
+                   "negl %eax\n\t"
+                   "addl %esp,%eax\n\t"
+                   "xchgl %esp,%eax\n\t"
+                   "movl 0(%eax),%eax\n\t"  /* copy return address from old location */
+                   "movl %eax,0(%esp)\n\t"
+                   "ret" );
 #endif
 
 /**************************************************************************
@@ -404,11 +406,13 @@ DEFINE_REGS_ENTRYPOINT( _chkstk, 0, 0 );
  * Glorified "enter xxxx".
  */
 #ifdef __i386__
-void WINAPI __regs__alloca_probe( CONTEXT86 *context )
-{
-    context->Esp -= context->Eax;
-}
-DEFINE_REGS_ENTRYPOINT( _alloca_probe, 0, 0 );
+__ASM_GLOBAL_FUNC( _alloca_probe,
+                   "negl %eax\n\t"
+                   "addl %esp,%eax\n\t"
+                   "xchgl %esp,%eax\n\t"
+                   "movl 0(%eax),%eax\n\t"  /* copy return address from old location */
+                   "movl %eax,0(%esp)\n\t"
+                   "ret" );
 #endif
 
 




More information about the wine-cvs mailing list