ntdll: Support the __os_arm64x_helper functions in the loader.
This commit is contained in:
parent
fd5b56b96d
commit
4a026f4230
3 changed files with 39 additions and 7 deletions
|
@ -240,18 +240,23 @@ static void module_push_unload_trace( const WINE_MODREF *wm )
|
|||
|
||||
#ifdef __arm64ec__
|
||||
|
||||
static void update_hybrid_pointer( void *module, const IMAGE_SECTION_HEADER *sec, UINT rva, void *ptr )
|
||||
{
|
||||
if (!rva) return;
|
||||
|
||||
if (rva < sec->VirtualAddress || rva >= sec->VirtualAddress + sec->Misc.VirtualSize)
|
||||
ERR( "rva %x outside of section %s (%lx-%lx)\n", rva,
|
||||
sec->Name, sec->VirtualAddress, sec->VirtualAddress + sec->Misc.VirtualSize );
|
||||
else
|
||||
*(void **)get_rva( module, rva ) = ptr;
|
||||
}
|
||||
|
||||
static void update_hybrid_metadata( void *module, IMAGE_NT_HEADERS *nt,
|
||||
const IMAGE_ARM64EC_METADATA *metadata )
|
||||
{
|
||||
DWORD i, protect_old;
|
||||
const IMAGE_SECTION_HEADER *sec = IMAGE_FIRST_SECTION( nt );
|
||||
|
||||
if (metadata->Version != 1)
|
||||
{
|
||||
ERR( "unknown version %lu\n", metadata->Version );
|
||||
return;
|
||||
}
|
||||
|
||||
/* assume that all pointers are in the same section */
|
||||
|
||||
for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
|
||||
|
@ -264,13 +269,22 @@ static void update_hybrid_metadata( void *module, IMAGE_NT_HEADERS *nt,
|
|||
|
||||
NtProtectVirtualMemory( NtCurrentProcess(), &base, &size, PAGE_READWRITE, &protect_old );
|
||||
|
||||
#define SET_FUNC(func,val) *(void **)get_rva( module, metadata->func ) = val
|
||||
#define SET_FUNC(func,val) update_hybrid_pointer( module, sec, metadata->func, val )
|
||||
SET_FUNC( __os_arm64x_dispatch_call, __os_arm64x_check_call );
|
||||
SET_FUNC( __os_arm64x_dispatch_call_no_redirect, __os_arm64x_dispatch_call_no_redirect );
|
||||
SET_FUNC( __os_arm64x_dispatch_fptr, __os_arm64x_dispatch_fptr );
|
||||
SET_FUNC( __os_arm64x_dispatch_icall, __os_arm64x_check_icall );
|
||||
SET_FUNC( __os_arm64x_dispatch_icall_cfg, __os_arm64x_check_icall_cfg );
|
||||
SET_FUNC( __os_arm64x_dispatch_ret, __os_arm64x_dispatch_ret );
|
||||
SET_FUNC( __os_arm64x_helper0, __os_arm64x_helper0 );
|
||||
SET_FUNC( __os_arm64x_helper1, __os_arm64x_helper1 );
|
||||
SET_FUNC( __os_arm64x_helper2, __os_arm64x_helper2 );
|
||||
SET_FUNC( __os_arm64x_helper3, __os_arm64x_helper3 );
|
||||
SET_FUNC( __os_arm64x_helper4, __os_arm64x_helper4 );
|
||||
SET_FUNC( __os_arm64x_helper5, __os_arm64x_helper5 );
|
||||
SET_FUNC( __os_arm64x_helper6, __os_arm64x_helper6 );
|
||||
SET_FUNC( __os_arm64x_helper7, __os_arm64x_helper7 );
|
||||
SET_FUNC( __os_arm64x_helper8, __os_arm64x_helper8 );
|
||||
SET_FUNC( GetX64InformationFunctionPointer, __os_arm64x_get_x64_information );
|
||||
SET_FUNC( SetX64InformationFunctionPointer, __os_arm64x_set_x64_information );
|
||||
#undef SET_FUNC
|
||||
|
|
|
@ -170,6 +170,15 @@ extern void *__os_arm64x_dispatch_fptr;
|
|||
extern void *__os_arm64x_dispatch_ret;
|
||||
extern void *__os_arm64x_get_x64_information;
|
||||
extern void *__os_arm64x_set_x64_information;
|
||||
extern void *__os_arm64x_helper0;
|
||||
extern void *__os_arm64x_helper1;
|
||||
extern void *__os_arm64x_helper2;
|
||||
extern void *__os_arm64x_helper3;
|
||||
extern void *__os_arm64x_helper4;
|
||||
extern void *__os_arm64x_helper5;
|
||||
extern void *__os_arm64x_helper6;
|
||||
extern void *__os_arm64x_helper7;
|
||||
extern void *__os_arm64x_helper8;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4044,6 +4044,15 @@ typedef struct _IMAGE_ARM64EC_METADATA
|
|||
ULONG ExtraRFETableSize;
|
||||
ULONG __os_arm64x_dispatch_fptr;
|
||||
ULONG AuxiliaryIATCopy;
|
||||
ULONG __os_arm64x_helper0;
|
||||
ULONG __os_arm64x_helper1;
|
||||
ULONG __os_arm64x_helper2;
|
||||
ULONG __os_arm64x_helper3;
|
||||
ULONG __os_arm64x_helper4;
|
||||
ULONG __os_arm64x_helper5;
|
||||
ULONG __os_arm64x_helper6;
|
||||
ULONG __os_arm64x_helper7;
|
||||
ULONG __os_arm64x_helper8;
|
||||
} IMAGE_ARM64EC_METADATA;
|
||||
|
||||
typedef struct _IMAGE_ARM64EC_REDIRECTION_ENTRY
|
||||
|
|
Loading…
Add table
Reference in a new issue