Jacek Caban : ntdll: Export builtin functions as cdecl.

Alexandre Julliard julliard at winehq.org
Tue Jun 9 15:27:47 CDT 2020


Module: wine
Branch: master
Commit: f2e886a0068e8662c239b5a7e412216e51e5c191
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f2e886a0068e8662c239b5a7e412216e51e5c191

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jun  8 18:13:44 2020 +0200

ntdll: Export builtin functions as cdecl.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/large_int.c              | 101 ++++++++++++++++++++----------------
 dlls/ntdll/ntdll.spec               |  16 +++---
 dlls/ntoskrnl.exe/ntoskrnl.exe.spec |  16 +++---
 3 files changed, 71 insertions(+), 62 deletions(-)

diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c
index cf8a3df093..748d17adb9 100644
--- a/dlls/ntdll/large_int.c
+++ b/dlls/ntdll/large_int.c
@@ -545,6 +545,15 @@ NTSTATUS WINAPI RtlInt64ToUnicodeString(
 
 #ifdef __i386__
 
+/* those builtin functions use stdcall calling convention, but compilers reference them without stdcall declarations */
+#if defined(__MINGW32__) || defined(_MSC_VER)
+LONGLONG WINAPI _alldiv( LONGLONG a, LONGLONG b ) asm("_alldiv");
+LONGLONG WINAPI _allmul( LONGLONG a, LONGLONG b ) asm("_allmul");
+LONGLONG WINAPI _allrem( LONGLONG a, LONGLONG b ) asm("_allrem");
+ULONGLONG WINAPI _aulldiv( ULONGLONG a, ULONGLONG b ) asm("_aulldiv");
+ULONGLONG WINAPI _aullrem( ULONGLONG a, ULONGLONG b ) asm("_aullrem");
+#endif
+
 static ULONGLONG udivmod(ULONGLONG a, ULONGLONG b, ULONGLONG *rem)
 {
     const ULARGE_INTEGER n = { .QuadPart = a };
@@ -873,29 +882,29 @@ LONGLONG WINAPI _allshr( LONGLONG a, LONG b )
  *  Returns the quotient of a and b in edx:eax.
  *  Returns the remainder of a and b in ebx:ecx.
  */
-__ASM_STDCALL_FUNC( _alldvrm, 16,
-                    "pushl %ebp\n\t"
-                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
-                    __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
-                    "movl %esp,%ebp\n\t"
-                    __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
-                    "pushl 20(%ebp)\n\t"
-                    "pushl 16(%ebp)\n\t"
-                    "pushl 12(%ebp)\n\t"
-                    "pushl 8(%ebp)\n\t"
-                    "call " __ASM_NAME("_allrem") "\n\t"
-                    "movl %edx,%ebx\n\t"
-                    "pushl %eax\n\t"
-                    "pushl 20(%ebp)\n\t"
-                    "pushl 16(%ebp)\n\t"
-                    "pushl 12(%ebp)\n\t"
-                    "pushl 8(%ebp)\n\t"
-                    "call " __ASM_NAME("_alldiv") "\n\t"
-                    "popl %ecx\n\t"
-                    "leave\n\t"
-                    __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
-                    __ASM_CFI(".cfi_same_value %ebp\n\t")
-                    "ret $16" )
+__ASM_GLOBAL_FUNC( _alldvrm,
+                   "pushl %ebp\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
+                   "movl %esp,%ebp\n\t"
+                   __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+                   "pushl 20(%ebp)\n\t"
+                   "pushl 16(%ebp)\n\t"
+                   "pushl 12(%ebp)\n\t"
+                   "pushl 8(%ebp)\n\t"
+                   "call " __ASM_NAME("_allrem") "\n\t"
+                   "movl %edx,%ebx\n\t"
+                   "pushl %eax\n\t"
+                   "pushl 20(%ebp)\n\t"
+                   "pushl 16(%ebp)\n\t"
+                   "pushl 12(%ebp)\n\t"
+                   "pushl 8(%ebp)\n\t"
+                   "call " __ASM_NAME("_alldiv") "\n\t"
+                   "popl %ecx\n\t"
+                   "leave\n\t"
+                   __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+                   __ASM_CFI(".cfi_same_value %ebp\n\t")
+                   "ret $16" )
 
 /******************************************************************************
  *        _aullrem   (NTDLL.@)
@@ -946,28 +955,28 @@ ULONGLONG WINAPI _aullshr( ULONGLONG a, LONG b )
  *  Returns the quotient of a and b in edx:eax.
  *  Returns the remainder of a and b in ebx:ecx.
  */
-__ASM_STDCALL_FUNC( _aulldvrm, 16,
-                    "pushl %ebp\n\t"
-                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
-                    __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
-                    "movl %esp,%ebp\n\t"
-                    __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
-                    "pushl 20(%ebp)\n\t"
-                    "pushl 16(%ebp)\n\t"
-                    "pushl 12(%ebp)\n\t"
-                    "pushl 8(%ebp)\n\t"
-                    "call " __ASM_NAME("_aullrem") "\n\t"
-                    "movl %edx,%ebx\n\t"
-                    "pushl %eax\n\t"
-                    "pushl 20(%ebp)\n\t"
-                    "pushl 16(%ebp)\n\t"
-                    "pushl 12(%ebp)\n\t"
-                    "pushl 8(%ebp)\n\t"
-                    "call " __ASM_NAME("_aulldiv") "\n\t"
-                    "popl %ecx\n\t"
-                    "leave\n\t"
-                    __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
-                    __ASM_CFI(".cfi_same_value %ebp\n\t")
-                    "ret $16" )
+__ASM_GLOBAL_FUNC( _aulldvrm,
+                   "pushl %ebp\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
+                   "movl %esp,%ebp\n\t"
+                   __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+                   "pushl 20(%ebp)\n\t"
+                   "pushl 16(%ebp)\n\t"
+                   "pushl 12(%ebp)\n\t"
+                   "pushl 8(%ebp)\n\t"
+                   "call " __ASM_NAME("_aullrem") "\n\t"
+                   "movl %edx,%ebx\n\t"
+                   "pushl %eax\n\t"
+                   "pushl 20(%ebp)\n\t"
+                   "pushl 16(%ebp)\n\t"
+                   "pushl 12(%ebp)\n\t"
+                   "pushl 8(%ebp)\n\t"
+                   "call " __ASM_NAME("_aulldiv") "\n\t"
+                   "popl %ecx\n\t"
+                   "leave\n\t"
+                   __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+                   __ASM_CFI(".cfi_same_value %ebp\n\t")
+                   "ret $16" )
 
 #endif  /* __i386__ */
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index ce5c580bd5..e054eabba3 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1427,17 +1427,17 @@
 @ cdecl __iscsym(long) NTDLL___iscsym
 @ cdecl __iscsymf(long) NTDLL___iscsymf
 @ cdecl __toascii(long) NTDLL___toascii
-@ stdcall -arch=i386 -ret64 _alldiv(int64 int64)
-@ stdcall -arch=i386 -norelay _alldvrm(int64 int64)
-@ stdcall -arch=i386 -ret64 _allmul(int64 int64)
-@ stdcall -arch=i386 -norelay _alloca_probe()
-@ stdcall -arch=i386 -ret64 _allrem(int64 int64)
+@ cdecl -arch=i386 -ret64 _alldiv(int64 int64)
+@ cdecl -arch=i386 -norelay _alldvrm(int64 int64)
+@ cdecl -arch=i386 -ret64 _allmul(int64 int64)
+@ cdecl -arch=i386 -norelay _alloca_probe()
+@ cdecl -arch=i386 -ret64 _allrem(int64 int64)
 @ stdcall -arch=i386 -ret64 _allshl(int64 long)
 @ stdcall -arch=i386 -ret64 _allshr(int64 long)
 @ cdecl -ret64 _atoi64(str)
-@ stdcall -arch=i386 -ret64 _aulldiv(int64 int64)
-@ stdcall -arch=i386 -norelay _aulldvrm(int64 int64)
-@ stdcall -arch=i386 -ret64 _aullrem(int64 int64)
+@ cdecl -arch=i386 -ret64 _aulldiv(int64 int64)
+@ cdecl -arch=i386 -norelay _aulldvrm(int64 int64)
+@ cdecl -arch=i386 -ret64 _aullrem(int64 int64)
 @ stdcall -arch=i386 -ret64 _aullshr(int64 long)
 @ cdecl -arch=i386 -norelay _chkstk()
 @ stub _fltused
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 902609b071..6acdec5dc5 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1514,16 +1514,16 @@
 @ cdecl -private -arch=i386 _CIsin()
 @ cdecl -private -arch=i386 _CIsqrt()
 @ cdecl -private _abnormal_termination()
-@ stdcall -arch=i386 -ret64 _alldiv(int64 int64)
-@ stdcall -arch=i386 -norelay _alldvrm(int64 int64)
-@ stdcall -arch=i386 -ret64 _allmul(int64 int64)
-@ stdcall -arch=i386 -norelay _alloca_probe()
-@ stdcall -arch=i386 -ret64 _allrem(int64 int64)
+@ cdecl -arch=i386 -ret64 _alldiv(int64 int64)
+@ cdecl -arch=i386 -norelay _alldvrm(int64 int64)
+@ cdecl -arch=i386 -ret64 _allmul(int64 int64)
+@ cdecl -arch=i386 -norelay _alloca_probe()
+@ cdecl -arch=i386 -ret64 _allrem(int64 int64)
 @ stdcall -arch=i386 -ret64 _allshl(int64 long)
 @ stdcall -arch=i386 -ret64 _allshr(int64 long)
-@ stdcall -arch=i386 -ret64 _aulldiv(int64 int64)
-@ stdcall -arch=i386 -norelay _aulldvrm(int64 int64)
-@ stdcall -arch=i386 -ret64 _aullrem(int64 int64)
+@ cdecl -arch=i386 -ret64 _aulldiv(int64 int64)
+@ cdecl -arch=i386 -norelay _aulldvrm(int64 int64)
+@ cdecl -arch=i386 -ret64 _aullrem(int64 int64)
 @ stdcall -arch=i386 -ret64 _aullshr(int64 long)
 @ cdecl -arch=i386 -norelay _chkstk()
 @ cdecl -arch=i386 _except_handler2(ptr ptr ptr ptr)




More information about the wine-cvs mailing list