Module: wine Branch: master Commit: 338df02010be9d219c0496235b04320dc7f2cec7 URL: https://gitlab.winehq.org/wine/wine/-/commit/338df02010be9d219c0496235b04320...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jun 7 10:23:50 2024 +0200
kernel32: Implement the GetProcAddress wrapper on ARM64EC.
---
dlls/kernel32/module.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index 433366d364b..ed15e57c29c 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -295,7 +295,6 @@ FARPROC get_proc_address( HMODULE hModule, LPCSTR function ) return fp; }
-#ifdef __x86_64__ /* * Work around a Delphi bug on x86_64. When delay loading a symbol, * Delphi saves rcx, rdx, r8 and r9 to the stack. It then calls @@ -305,9 +304,25 @@ FARPROC get_proc_address( HMODULE hModule, LPCSTR function ) * these registers if the function takes floating point parameters. * This wrapper saves xmm0 - 3 to the stack. */ -extern FARPROC get_proc_address_wrapper( HMODULE module, LPCSTR function ); - -__ASM_GLOBAL_FUNC( get_proc_address_wrapper, +#ifdef __arm64ec__ +FARPROC WINAPI __attribute__((naked)) GetProcAddress( HMODULE module, LPCSTR function ) +{ + asm( ".seh_proc "#GetProcAddress"\n\t" + "stp x29, x30, [sp, #-48]!\n\t" + ".seh_save_fplr_x 48\n\t" + ".seh_endprologue\n\t" + "stp d0, d1, [sp, #16]\n\t" + "stp d2, d3, [sp, #32]\n\t" + "bl "#get_proc_address"\n\t" + "ldp d0, d1, [sp, #16]\n\t" + "ldp d2, d3, [sp, #32]\n\t" + "ldp x29, x30, [sp], #48\n\t" + "ret\n\t" + ".seh_endproc" ); +} +#elif defined(__x86_64__) +__ASM_GLOBAL_FUNC( GetProcAddress, + ".byte 0x48\n\t" /* hotpatch prolog */ "pushq %rbp\n\t" __ASM_SEH(".seh_pushreg %rbp\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") @@ -335,14 +350,9 @@ __ASM_GLOBAL_FUNC( get_proc_address_wrapper, "ret" ) #else /* __x86_64__ */
-static inline FARPROC get_proc_address_wrapper( HMODULE module, LPCSTR function ) +FARPROC WINAPI GetProcAddress( HMODULE module, LPCSTR function ) { return get_proc_address( module, function ); }
#endif /* __x86_64__ */ - -FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) -{ - return get_proc_address_wrapper( hModule, function ); -}