From 075cbd34747390720e4b28be6b105b1a026c2844 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 26 Mar 2018 22:58:55 +0000 Subject: [PATCH] ntoskrnl.exe: Implement _chkstk. These are just copied from ntdll. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/ntoskrnl.exe/ntoskrnl.c | 30 +++++++++++++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 ++ 2 files changed, 32 insertions(+) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index d8277a9c1a9..e3d72ba9a72 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3373,3 +3373,33 @@ INT __cdecl NTOSKRNL_wcsncmp( LPCWSTR str1, LPCWSTR str2, INT n ) { return strncmpW( str1, str2, n ); } + + +#ifdef __x86_64__ +/************************************************************************** + * __chkstk (NTOSKRNL.@) + * + * Supposed to touch all the stack pages, but we shouldn't need that. + */ +__ASM_GLOBAL_FUNC( __chkstk, "ret" ); + +#elif defined(__i386__) +/************************************************************************** + * _chkstk (NTOSKRNL.@) + */ +__ASM_STDCALL_FUNC( _chkstk, 0, + "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" ) +#elif defined(__arm__) +/************************************************************************** + * __chkstk (NTDLL.@) + * + * Incoming r4 contains words to allocate, converting to bytes then return + */ +__ASM_GLOBAL_FUNC( __chkstk, "lsl r4, r4, #2\n\t" + "bx lr" ) +#endif diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index dca1404d0b6..26afa6f9505 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -1401,6 +1401,7 @@ @ stdcall -private ZwWaitForSingleObject(long long ptr) NtWaitForSingleObject @ stdcall -private ZwWriteFile(long long ptr ptr ptr ptr long ptr ptr) NtWriteFile @ stdcall -private ZwYieldExecution() NtYieldExecution +@ stdcall -private -arch=arm,x86_64 -norelay __chkstk() @ cdecl -private -arch=i386 _CIcos() msvcrt._CIcos @ cdecl -private -arch=i386 _CIsin() msvcrt._CIsin @ cdecl -private -arch=i386 _CIsqrt() msvcrt._CIsqrt @@ -1416,6 +1417,7 @@ @ stub _aulldvrm @ stdcall -private -arch=i386 -ret64 _aullrem(int64 int64) @ stdcall -private -arch=i386 -ret64 _aullshr(int64 long) +@ stdcall -private -arch=i386 -norelay _chkstk() @ cdecl -private -arch=i386 _except_handler2(ptr ptr ptr ptr) msvcrt._except_handler2 @ cdecl -private -arch=i386 _except_handler3(ptr ptr ptr ptr) msvcrt._except_handler3 @ cdecl -private -arch=i386 _global_unwind2(ptr) msvcrt._global_unwind2