include: Move inline assembly definitions to a new wine/asm.h header.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-05-14 12:30:46 +02:00
parent 132cf25ed6
commit d5a372abbb
46 changed files with 116 additions and 364 deletions

245
configure vendored
View File

@ -17271,215 +17271,6 @@ then
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether external symbols need an underscore prefix" >&5
$as_echo_n "checking whether external symbols need an underscore prefix... " >&6; }
if ${ac_cv_c_extern_prefix+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern int ac_test;
int
main ()
{
asm(".globl _ac_test\n_ac_test:\t.long 0"); if (ac_test) return 1
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_c_extern_prefix="yes"
else
ac_cv_c_extern_prefix="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_extern_prefix" >&5
$as_echo "$ac_cv_c_extern_prefix" >&6; }
case $host_cpu in
*i[3456789]86*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether external symbols need stdcall decoration" >&5
$as_echo_n "checking whether external symbols need stdcall decoration... " >&6; }
if ${ac_cv_c_stdcall_suffix+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _MSC_VER
#define __stdcall __attribute__((__stdcall__))
#endif
int __stdcall ac_test(int i) { return i; }
int
main ()
{
asm("jmp _ac_test@4"); if (ac_test(1)) return 1
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_c_stdcall_suffix="yes"
else
ac_cv_c_stdcall_suffix="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stdcall_suffix" >&5
$as_echo "$ac_cv_c_stdcall_suffix" >&6; } ;;
*) ac_cv_c_stdcall_suffix="no" ;;
esac
if test "$ac_cv_c_extern_prefix" = "yes"
then
$as_echo "#define __ASM_NAME(name) \"_\" name" >>confdefs.h
asm_name_prefix="_"
else
$as_echo "#define __ASM_NAME(name) name" >>confdefs.h
asm_name_prefix=""
fi
if test "$ac_cv_c_stdcall_suffix" = "yes"
then
$as_echo "#define __ASM_STDCALL(args) \"@\" #args" >>confdefs.h
else
$as_echo "#define __ASM_STDCALL(args) \"\"" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to define a function in assembly code" >&5
$as_echo_n "checking how to define a function in assembly code... " >&6; }
if ${ac_cv_asm_func_def+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm("\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0");
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_asm_func_def=".def"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm("\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0");
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_asm_func_def=".type @function"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm("\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0");
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_asm_func_def=".type 2"
else
ac_cv_asm_func_def="unknown"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_asm_func_def" >&5
$as_echo "$ac_cv_asm_func_def" >&6; }
case "$ac_cv_asm_func_def" in
".def")
asm_func_header=".def $asm_name_prefix\" #name suffix \"; .scl 2; .type 32; .endef" ;;
".type @function")
asm_func_header=".type $asm_name_prefix\" #name suffix \",@function" ;;
".type 2")
asm_func_header=".type $asm_name_prefix\" #name suffix \",2" ;;
*)
asm_func_header="" ;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether asm() works outside of functions" >&5
$as_echo_n "checking whether asm() works outside of functions... " >&6; }
if ${ac_cv_c_asm_outside_funcs+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
asm(".text\n\t.long 0");
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_asm_outside_funcs="yes"
else
ac_cv_c_asm_outside_funcs="no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_asm_outside_funcs" >&5
$as_echo "$ac_cv_c_asm_outside_funcs" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .previous is supported in assembly code" >&5
$as_echo_n "checking whether .previous is supported in assembly code... " >&6; }
if ${ac_cv_c_dot_previous+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm(".text\nac_test:\t.long 0\n\t.previous");
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_c_dot_previous="yes"
else
ac_cv_c_dot_previous="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_dot_previous" >&5
$as_echo "$ac_cv_c_dot_previous" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CFI directives are supported in assembly code" >&5
$as_echo_n "checking whether CFI directives are supported in assembly code... " >&6; }
if ${ac_cv_c_cfi_support+:} false; then :
@ -17505,52 +17296,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_cfi_support" >&5
$as_echo "$ac_cv_c_cfi_support" >&6; }
asm_func_header=".globl $asm_name_prefix\" #name suffix \"\\n\\t$asm_func_header\\n$asm_name_prefix\" #name suffix \":\\n\\t"
asm_func_trailer=""
if test "$ac_cv_c_dot_previous" = "yes"
then
asm_func_trailer="\\n\\t.previous"
fi
if test "$ac_cv_c_cfi_support" = "yes"
then
asm_func_header="$asm_func_header.cfi_startproc\\n\\t"
asm_func_trailer="\\n\\t.cfi_endproc$asm_func_trailer"
$as_echo "#define __ASM_CFI(str) str" >>confdefs.h
LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables"
else
$as_echo "#define __ASM_CFI(str) \"\"" >>confdefs.h
if test "x$enable_win64" = "xyes"
then
as_fn_append wine_warnings "|building 64-bit Wine without support for CFI directives; exception handling will not work properly."
fi
fi
asm_func_code="$asm_func_header\" code \"$asm_func_trailer"
if test "$ac_cv_c_asm_outside_funcs" = "yes"
then
cat >>confdefs.h <<_ACEOF
#define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t$asm_func_code");
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define __ASM_DEFINE_FUNC(name,suffix,code) void __asm_dummy_##name(void) { asm(".text\n\t.align 4\n\t$asm_func_code"); }
_ACEOF
fi
$as_echo "#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,\"\",code)" >>confdefs.h
$as_echo "#define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(name,__ASM_STDCALL(args),code)" >>confdefs.h
case $build_os in
cygwin*|mingw32*) TOOLSEXT=".exe"

View File

@ -2046,114 +2046,21 @@ then
CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
fi
dnl **** Check for underscore on external symbols ****
AC_CACHE_CHECK([whether external symbols need an underscore prefix], ac_cv_c_extern_prefix,
WINE_TRY_ASM_LINK([".globl _ac_test\n_ac_test:\t.long 0"],
[extern int ac_test;],
[if (ac_test) return 1],
ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no"))
case $host_cpu in
*i[[3456789]]86*)
AC_CACHE_CHECK([whether external symbols need stdcall decoration], ac_cv_c_stdcall_suffix,
WINE_TRY_ASM_LINK(["jmp _ac_test@4"],
[#ifndef _MSC_VER
#define __stdcall __attribute__((__stdcall__))
#endif
int __stdcall ac_test(int i) { return i; }],
[if (ac_test(1)) return 1],
ac_cv_c_stdcall_suffix="yes",ac_cv_c_stdcall_suffix="no")) ;;
*) ac_cv_c_stdcall_suffix="no" ;;
esac
AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol])
if test "$ac_cv_c_extern_prefix" = "yes"
then
AC_DEFINE([__ASM_NAME(name)], ["_" name])
asm_name_prefix="_"
else
AC_DEFINE([__ASM_NAME(name)], [name])
asm_name_prefix=""
fi
AH_TEMPLATE(__ASM_STDCALL,[Define to a macro to generate an stdcall suffix])
if test "$ac_cv_c_stdcall_suffix" = "yes"
then
AC_DEFINE([__ASM_STDCALL(args)],["@" #args])
else
AC_DEFINE([__ASM_STDCALL(args)],[""])
fi
dnl **** Check how to define a function in assembly code ****
AC_CACHE_CHECK([how to define a function in assembly code], ac_cv_asm_func_def,
WINE_TRY_ASM_LINK(
["\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0"],,,
ac_cv_asm_func_def=".def",
[WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0"],,,
ac_cv_asm_func_def=".type @function",
[WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0"],,,
ac_cv_asm_func_def=".type 2",
ac_cv_asm_func_def="unknown")])]))
case "$ac_cv_asm_func_def" in
".def")
asm_func_header=".def $asm_name_prefix\" #name suffix \"; .scl 2; .type 32; .endef" ;;
".type @function")
asm_func_header=".type $asm_name_prefix\" #name suffix \",@function" ;;
".type 2")
asm_func_header=".type $asm_name_prefix\" #name suffix \",2" ;;
*)
asm_func_header="" ;;
esac
AC_CACHE_CHECK([whether asm() works outside of functions], ac_cv_c_asm_outside_funcs,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\n\t.long 0");]],)],
ac_cv_c_asm_outside_funcs="yes",ac_cv_c_asm_outside_funcs="no"))
AC_CACHE_CHECK([whether .previous is supported in assembly code], ac_cv_c_dot_previous,
WINE_TRY_ASM_LINK([".text\nac_test:\t.long 0\n\t.previous"],,,
ac_cv_c_dot_previous="yes",ac_cv_c_dot_previous="no"))
dnl **** Check for CFI directives support ****
AC_CACHE_CHECK([whether CFI directives are supported in assembly code], ac_cv_c_cfi_support,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\nac_test:\t.cfi_startproc\n\t.long 0\n\t.cfi_endproc");]])],
ac_cv_c_cfi_support="yes",ac_cv_c_cfi_support="no"))
asm_func_header=".globl $asm_name_prefix\" #name suffix \"\\n\\t$asm_func_header\\n$asm_name_prefix\" #name suffix \":\\n\\t"
asm_func_trailer=""
if test "$ac_cv_c_dot_previous" = "yes"
then
asm_func_trailer="\\n\\t.previous"
fi
if test "$ac_cv_c_cfi_support" = "yes"
then
asm_func_header="$asm_func_header.cfi_startproc\\n\\t"
asm_func_trailer="\\n\\t.cfi_endproc$asm_func_trailer"
AC_DEFINE([__ASM_CFI(str)],[str],[Define to a macro to output a .cfi assembly pseudo-op])
LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables"
else
AC_DEFINE([__ASM_CFI(str)],[""])
if test "x$enable_win64" = "xyes"
then
WINE_WARNING([building 64-bit Wine without support for CFI directives; exception handling will not work properly.])
fi
fi
asm_func_code="$asm_func_header\" code \"$asm_func_trailer"
AH_TEMPLATE(__ASM_DEFINE_FUNC,[Define to a macro to define an assembly function])
if test "$ac_cv_c_asm_outside_funcs" = "yes"
then
AC_DEFINE_UNQUOTED([__ASM_DEFINE_FUNC(name,suffix,code)],[asm(".text\n\t.align 4\n\t$asm_func_code");])
else
AC_DEFINE_UNQUOTED([__ASM_DEFINE_FUNC(name,suffix,code)],[void __asm_dummy_##name(void) { asm(".text\n\t.align 4\n\t$asm_func_code"); }])
fi
AC_DEFINE([__ASM_GLOBAL_FUNC(name,code)],[__ASM_DEFINE_FUNC(name,"",code)],
[Define to a macro to generate an assembly function with C calling convention])
AC_DEFINE([__ASM_STDCALL_FUNC(name,args,code)],[__ASM_DEFINE_FUNC(name,__ASM_STDCALL(args),code)],
[Define to a macro to generate an assembly function with stdcall calling convention])
dnl **** Platform-specific checks ****
case $build_os in

View File

@ -29,6 +29,7 @@
#include "dbghelp_private.h"
#include "winternl.h"
#include "psapi.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);

View File

@ -40,6 +40,7 @@
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"

View File

@ -30,6 +30,7 @@
#include "winternl.h"
#include "excpt.h"
#include "ddk/ntddk.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl);

View File

@ -27,6 +27,7 @@
#include "winerror.h"
#include "wine/server.h"
#include "kernel_private.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "wine/exception.h"

View File

@ -41,6 +41,7 @@
#include "wine/exception.h"
#include "wine/list.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "wine/unicode.h"

View File

@ -61,6 +61,7 @@
#include "wine/library.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(process);

View File

@ -40,6 +40,7 @@
#include "winioctl.h"
#include "ddk/wdm.h"
#include "wine/asm.h"
#include "wine/library.h"
#include "wine/unicode.h"
#include "kernel_private.h"

View File

@ -38,6 +38,7 @@
#include "wine/exception.h"
#include "wine/library.h"
#include "wine/server.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "kernel_private.h"

View File

@ -24,6 +24,7 @@
#include "wine/winbase16.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/asm.h"
#include "pshpack1.h"

View File

@ -27,6 +27,7 @@
#include "winuser.h"
#include "ole2.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "mshtml_private.h"

View File

@ -31,6 +31,7 @@
#include "shlobj.h"
#include "shlwapi.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "mshtml_private.h"

View File

@ -35,6 +35,7 @@
#include "msipriv.h"
#include "winemsi.h"
#include "wine/asm.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/unicode.h"

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/asm.h"
/* Copied from dlls/msvcrt/cxx.h */
#undef __thiscall
#ifdef __i386__ /* thiscall functions are i386-specific */

View File

@ -21,6 +21,8 @@
#ifndef __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
#include "wine/asm.h"
#define CXX_FRAME_MAGIC_VC6 0x19930520
#define CXX_FRAME_MAGIC_VC7 0x19930521
#define CXX_FRAME_MAGIC_VC8 0x19930522

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/asm.h"
#undef __thiscall
#ifdef __i386__ /* thiscall functions are i386-specific */

View File

@ -30,6 +30,7 @@
#include "msvcrt.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);

View File

@ -27,6 +27,7 @@
#include "wine/debug.h"
#include "ntsecapi.h"
#include "windows.h"
#include "wine/asm.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);

View File

@ -28,6 +28,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "wine/asm.h"
#ifndef _WIN64

View File

@ -28,6 +28,7 @@
#include "winnt.h"
#include "winternl.h"
#include "wine/server.h"
#include "wine/asm.h"
#define MAX_NT_PATH_LENGTH 277

View File

@ -40,6 +40,7 @@
#include "winbase.h"
#include "winnt.h"
#include "winternl.h"
#include "wine/asm.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "wine/debug.h"

View File

@ -21,6 +21,8 @@
#ifndef __WINE_NTOSKRNL_PRIVATE_H
#define __WINE_NTOSKRNL_PRIVATE_H
#include "wine/asm.h"
struct _OBJECT_TYPE
{
const WCHAR *name; /* object type name used for type validation */

View File

@ -31,6 +31,7 @@
#include "ddk/wdm.h"
#include "ddk/ntifs.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "wine/heap.h"

View File

@ -53,6 +53,7 @@
#include "winnls.h"
#include "winuser.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "dictionary.h"
#include "storage32.h"

View File

@ -73,6 +73,7 @@
#include "typelib.h"
#include "wine/debug.h"
#include "variant.h"
#include "wine/asm.h"
#include "wine/heap.h"
#include "wine/list.h"

View File

@ -28,6 +28,7 @@
#include "richole.h"
#include "imm.h"
#include "textserv.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "editstr.h"

View File

@ -30,6 +30,7 @@
#include "tom.h"
#include "imm.h"
#include "textserv.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "editstr.h"

View File

@ -36,6 +36,7 @@
#include "cpsf.h"
#include "ndr_misc.h"
#include "ndr_stubless.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);

View File

@ -39,6 +39,7 @@
#include "rpcproxy.h"
#include "wine/exception.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "cpsf.h"

View File

@ -77,6 +77,7 @@
#include "user_private.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "winternl.h"

View File

@ -43,6 +43,7 @@
#include "user_private.h"
#include "wine/gdi_driver.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(system);

View File

@ -31,6 +31,7 @@
#include "winver.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "win.h"
#include "user_private.h"
#include "controls.h"

View File

@ -33,6 +33,7 @@
#include "win.h"
#include "user_private.h"
#include "wine/unicode.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DECLARE_DEBUG_CHANNEL(msg);

View File

@ -32,6 +32,7 @@
#include "winternl.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/asm.h"
WINE_DEFAULT_DEBUG_CHANNEL(vcomp);

View File

@ -23,6 +23,7 @@
#include "vss.h"
#include "vswriter.h"
#include "vsbackup.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL( vssapi );

View File

@ -62,6 +62,7 @@
#include "winspool.h"
#include "setupapi.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "wbemprox_private.h"

View File

@ -18,12 +18,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "winternl.h"
#include "wine/exception.h"
#include "wine/asm.h"
#if defined(__x86_64__) && defined(__ASM_GLOBAL_FUNC)
#ifdef __x86_64__
extern void __wine_unwind_trampoline(void);
/* we need an extra call to make sure the stack is correctly aligned */
__ASM_GLOBAL_FUNC( __wine_unwind_trampoline, "callq *%rax" );
@ -47,7 +47,7 @@ void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *
: "=a" (dummy1), "=S" (dummy2), "=D" (dummy3), "=c" (dummy4)
: "0" (RtlUnwind), "1" (frame), "2" (target), "3" (record)
: "edx", "memory" );
#elif defined(__x86_64__) && defined(__ASM_GLOBAL_FUNC)
#elif defined(__x86_64__)
RtlUnwind( frame, __wine_unwind_trampoline, record, target );
#else
RtlUnwind( frame, target, record, 0 );

View File

@ -1469,26 +1469,6 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to a macro to output a .cfi assembly pseudo-op */
#undef __ASM_CFI
/* Define to a macro to define an assembly function */
#undef __ASM_DEFINE_FUNC
/* Define to a macro to generate an assembly function with C calling
convention */
#undef __ASM_GLOBAL_FUNC
/* Define to a macro to generate an assembly name from a C symbol */
#undef __ASM_NAME
/* Define to a macro to generate an stdcall suffix */
#undef __ASM_STDCALL
/* Define to a macro to generate an assembly function with stdcall calling
convention */
#undef __ASM_STDCALL_FUNC
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus

66
include/wine/asm.h Normal file
View File

@ -0,0 +1,66 @@
/*
* Inline assembly support
*
* Copyright 2019 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WINE_ASM_H
#define __WINE_WINE_ASM_H
#if defined(__APPLE__) || (defined(_WIN32) && defined(__i386__))
# define __ASM_NAME(name) "_" name
#else
# define __ASM_NAME(name) name
#endif
#if defined(_WIN32) && defined(__i386__)
# define __ASM_STDCALL(args) "@" #args
#else
# define __ASM_STDCALL(args) ""
#endif
#ifdef __GCC_HAVE_DWARF2_CFI_ASM
# define __ASM_CFI(str) str
#else
# define __ASM_CFI(str) str
#endif
#ifdef _WIN32
# define __ASM_FUNC_TYPE(name) ".def " name "; .scl 2; .type 32; .endef"
#elif defined(__APPLE__)
# define __ASM_FUNC_TYPE(name) ""
#elif defined(__arm__) || defined(__arm64__)
# define __ASM_FUNC_TYPE(name) ".type " name ",%function"
#else
# define __ASM_FUNC_TYPE(name) ".type " name ",@function"
#endif
#ifdef __GNUC__
# define __ASM_DEFINE_FUNC(name,code) \
asm(".text\n\t.align 4\n\t.globl " name "\n\t" __ASM_FUNC_TYPE(name) "\n" name ":\n\t" \
__ASM_CFI(".cfi_startproc\n\t") code __ASM_CFI("\n\t.cfi_endproc") );
#else
# define __ASM_DEFINE_FUNC(name,code) void __asm_dummy_##__LINE__(void) { \
asm(".text\n\t.align 4\n\t.globl " name "\n\t" __ASM_FUNC_TYPE(name) "\n" name ":\n\t" \
__ASM_CFI(".cfi_startproc\n\t") code __ASM_CFI("\n\t.cfi_endproc") ); }
#endif
#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(__ASM_NAME(#name),code)
#define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_NAME(#name) __ASM_STDCALL(args),code)
#endif /* __WINE_WINE_ASM_H */

View File

@ -18,9 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include "basetsd.h"
#include "wine/asm.h"
#ifdef __i386__

View File

@ -32,6 +32,7 @@
#include "windef.h"
#include "winbase.h"
#include "wine/library.h"
#include "wine/asm.h"
#ifdef __i386__

View File

@ -28,6 +28,7 @@
#define WINE_UNICODE_INLINE /* nothing */
#include "wine/unicode.h"
#include "wine/library.h"
#include "wine/asm.h"
/* functions from libwine_port that are also exported from libwine for backwards compatibility,
* on platforms that require it */

View File

@ -93,6 +93,7 @@
# include <sys/link.h>
#endif
#include "wine/asm.h"
#include "main.h"
/* ELF definitions */

View File

@ -51,6 +51,7 @@
#include <mach-o/ldsyms.h>
#endif
#include "wine/asm.h"
#include "main.h"
#ifndef LC_MAIN

View File

@ -75,6 +75,7 @@
#include <wine/svcctl.h>
#include <wine/unicode.h>
#include <wine/library.h>
#include <wine/asm.h>
#include <wine/debug.h>
#include <shlobj.h>