Alexandre Julliard : ntdll: Call virtual_set_large_address_space() directly from the Unix side.

Alexandre Julliard julliard at winehq.org
Wed Jul 22 16:34:29 CDT 2020


Module: wine
Branch: master
Commit: 9018a377355fb2906d06b50008d04761491bbfd9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9018a377355fb2906d06b50008d04761491bbfd9

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jul 22 14:27:33 2020 +0200

ntdll: Call virtual_set_large_address_space() directly from the Unix side.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c            | 2 --
 dlls/ntdll/unix/loader.c       | 1 -
 dlls/ntdll/unix/server.c       | 1 +
 dlls/ntdll/unix/unix_private.h | 2 +-
 dlls/ntdll/unix/virtual.c      | 5 +----
 dlls/ntdll/unixlib.h           | 3 +--
 6 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index adb1ed871b..bf8d71adeb 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -4008,8 +4008,6 @@ void __wine_process_init(void)
         NtTerminateProcess( GetCurrentProcess(), status );
     }
 
-    unix_funcs->virtual_set_large_address_space();
-
     /* the main exe needs to be the first in the load order list */
     RemoveEntryList( &wm->ldr.InLoadOrderLinks );
     InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks );
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 22ba928541..57b1a7e3a5 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1402,7 +1402,6 @@ static struct unix_funcs unix_funcs =
     virtual_map_section,
     virtual_locked_recvmsg,
     virtual_release_address_space,
-    virtual_set_large_address_space,
     exec_process,
     wine_server_call,
     server_send_fd,
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 21817ad159..fadfcc2f9f 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -1471,6 +1471,7 @@ void CDECL server_init_process_done( void *relay )
 #ifdef __APPLE__
     send_server_task_port();
 #endif
+    if (nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) virtual_set_large_address_space();
 
     /* Install signal handlers; this cannot be done earlier, since we cannot
      * send exceptions to the debugger before the create process event that
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 7b4d34dead..db7ffbf8a9 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -110,7 +110,6 @@ extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsig
                                            ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
 extern ssize_t CDECL virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) DECLSPEC_HIDDEN;
 extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
-extern void CDECL virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
 
 extern void CDECL server_send_fd( int fd ) DECLSPEC_HIDDEN;
 extern NTSTATUS CDECL server_fd_to_handle( int fd, unsigned int access, unsigned int attributes,
@@ -209,6 +208,7 @@ extern BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HI
 extern SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
 extern NTSTATUS virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
 extern void virtual_set_force_exec( BOOL enable ) DECLSPEC_HIDDEN;
+extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
 extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
                                             SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
 
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index f3fec7c29c..883e5cff92 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -3383,11 +3383,8 @@ void CDECL virtual_release_address_space(void)
  *
  * Enable use of a large address space when allowed by the application.
  */
-void CDECL virtual_set_large_address_space(void)
+void virtual_set_large_address_space(void)
 {
-    IMAGE_NT_HEADERS *nt = get_exe_nt_header();
-
-    if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) return;
     /* no large address space on win9x */
     if (NtCurrentTeb()->Peb->OSPlatformId != VER_PLATFORM_WIN32_NT) return;
 
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index a706b174b4..715af51686 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -28,7 +28,7 @@ struct msghdr;
 struct _DISPATCHER_CONTEXT;
 
 /* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 92
+#define NTDLL_UNIXLIB_VERSION 93
 
 struct unix_funcs
 {
@@ -93,7 +93,6 @@ struct unix_funcs
                                                 ULONG protect, pe_image_info_t *image_info );
     ssize_t       (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags );
     void          (CDECL *virtual_release_address_space)(void);
-    void          (CDECL *virtual_set_large_address_space)(void);
 
     /* thread/process functions */
     NTSTATUS      (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );




More information about the wine-cvs mailing list