kernel32: Implement the GetProcAddress wrapper on ARM64EC.

This commit is contained in:
Alexandre Julliard 2024-06-07 10:23:50 +02:00
parent 468fbf5907
commit 338df02010

View file

@ -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 );
}