[PATCH 0/1] MR11557: ntdll: Run native-ready .net applications as ARM64EC on ARM64.
As found by @madewokherd and @bshanks, this matches recent Windows behavior, avoiding problems for applications marked as IL-only, but actually expect x86. There is a new manifest that can be used to prefer actual ARM64 processes (https://devblogs.microsoft.com/visualstudio/how-to-run-net-apps-natively-on-...). It also avoids such applications from failing to launch due to missing ARM64 wine-mono support. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11557
From: Jacek Caban <jacek@codeweavers.com> --- dlls/ntdll/unix/loader.c | 5 +++-- server/mapping.c | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c1321ce679d..2b6dbf248f0 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -482,7 +482,8 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const struct pe_image_info char preloader_reserve[64], socket_env[64]; if (pe_info->wine_fakedll) res_start = res_end = 0; - if (pe_info->image_flags & IMAGE_FLAGS_ComPlusNativeReady) machine = native_machine; + if (pe_info->image_flags & IMAGE_FLAGS_ComPlusNativeReady) + machine = is_machine_64bit( native_machine ) ? IMAGE_FILE_MACHINE_AMD64 : native_machine; signal( SIGPIPE, SIG_DFL ); @@ -1438,7 +1439,7 @@ static NTSTATUS open_main_image( UNICODE_STRING *nt_name, void **module, SECTION status = virtual_map_module( mapping, module, &size, info, 0, 0, machine ); if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH && info->ComPlusNativeReady) { - info->Machine = native_machine; + info->Machine = is_machine_64bit( native_machine ) ? IMAGE_FILE_MACHINE_AMD64 : native_machine; status = STATUS_SUCCESS; } NtClose( mapping ); diff --git a/server/mapping.c b/server/mapping.c index eb49ae37237..b2571d56bb0 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -1678,8 +1678,11 @@ DECL_HANDLER(map_image_view) if (add_process_view( current, view )) { current->entry_point = view->base + req->entry; - current->process->machine = (view->image.image_flags & IMAGE_FLAGS_ComPlusNativeReady) ? - native_machine : req->machine; + if (view->image.image_flags & IMAGE_FLAGS_ComPlusNativeReady) + current->process->machine = is_machine_64bit( native_machine ) + ? IMAGE_FILE_MACHINE_AMD64 : native_machine; + else + current->process->machine = req->machine; } if (view->base != (mapping->image.map_addr ? mapping->image.map_addr : mapping->image.base) + req->offset) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11557
FWIW we still need ARM64 support in Wine Mono, and I'm working on that, but it should only be used for applications explicitly supporting ARM. Also ideally we'd have ARM64EC support in Wine Mono so that, in a truly pure IL application, the whole process would be native (EC) code. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11557#note_147692
participants (3)
-
Esme Povirk (@madewokherd) -
Jacek Caban -
Jacek Caban (@jacek)