Rebase against e80df2d2d54a3f16389bea77f6863cc1c05d6251.

This commit is contained in:
Zebediah Figura
2020-06-18 19:12:14 -05:00
parent 02913f754f
commit d799e8fd82
24 changed files with 293 additions and 1011 deletions

View File

@@ -1,4 +1,4 @@
From a88ac4ac286c6c345efc3722d6fd4cc5b6ad29ca Mon Sep 17 00:00:00 2001
From 4236b5607067148efa76cbe090d9efd58b297e32 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Mon, 30 Dec 2019 13:27:53 +0300
Subject: [PATCH] ntdll: Support x86_64 syscall emulation.
@@ -14,15 +14,15 @@ is used for trapping syscalls.
dlls/ntdll/unix/signal_x86_64.c | 105 ++++++++++++++++++++++++++++++++
dlls/ntdll/unix/thread.c | 8 ++-
dlls/ntdll/unix/unix_private.h | 6 +-
dlls/ntdll/unixlib.h | 5 +-
dlls/ntdll/unixlib.h | 3 +-
tools/winebuild/spec32.c | 9 ++-
7 files changed, 135 insertions(+), 7 deletions(-)
7 files changed, 134 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index d57b0713856..7bd3da1e175 100644
index 9c5f76669df..f245c2f1507 100644
--- a/configure.ac
+++ b/configure.ac
@@ -474,6 +474,7 @@ AC_CHECK_HEADERS(\
@@ -464,6 +464,7 @@ AC_CHECK_HEADERS(\
linux/joystick.h \
linux/major.h \
linux/param.h \
@@ -31,10 +31,10 @@ index d57b0713856..7bd3da1e175 100644
linux/types.h \
linux/ucdrom.h \
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 18db4fd4780..e4f0293ab5a 100644
index 557747062e4..0d65546588f 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -229,6 +229,12 @@ void __wine_syscall_dispatcher( void )
@@ -103,6 +103,12 @@ void __wine_syscall_dispatcher( void )
}
#endif
@@ -47,7 +47,7 @@ index 18db4fd4780..e4f0293ab5a 100644
void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
{
UNICODE_STRING name;
@@ -272,7 +278,7 @@ void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
@@ -146,7 +152,7 @@ void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
TEB *thread_init( SIZE_T *info_size, BOOL *suspend )
{
TEB *teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, suspend, &server_cpus,
@@ -57,7 +57,7 @@ index 18db4fd4780..e4f0293ab5a 100644
peb = teb->Peb;
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 1d1b879310e..c8a8d1d1d33 100644
index 12ea74f7f5c..26097702985 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -28,6 +28,7 @@
@@ -194,7 +194,7 @@ index 1d1b879310e..c8a8d1d1d33 100644
error:
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 0279690806c..6969a528eeb 100644
index 196dc2d8c4e..dae792bd78b 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -58,6 +58,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh);
@@ -217,7 +217,7 @@ index 0279690806c..6969a528eeb 100644
{
TEB *teb;
SIZE_T info_size;
@@ -95,6 +99,8 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ
@@ -94,6 +98,8 @@ TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZ
*ldt_copy = &__wine_ldt_copy;
#endif
nb_threads = nb_threads_ptr;
@@ -227,10 +227,10 @@ index 0279690806c..6969a528eeb 100644
teb = virtual_alloc_first_teb();
teb->WOW32Reserved = syscall_handler;
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 19196dbb296..e99e89864c2 100644
index df508e569f9..bcb80ddab85 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -108,7 +108,8 @@ extern void CDECL server_release_fd( HANDLE handle, int unix_fd ) DECLSPEC_HIDDE
@@ -113,7 +113,8 @@ extern void CDECL server_release_fd( HANDLE handle, int unix_fd ) DECLSPEC_HIDDE
extern void CDECL server_init_process_done( void *relay ) DECLSPEC_HIDDEN;
extern TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size,
BOOL *suspend, unsigned int *cpus, BOOL *wow64,
@@ -239,10 +239,10 @@ index 19196dbb296..e99e89864c2 100644
+ unsigned int syscall_count ) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN exit_process( int status ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_len ) DECLSPEC_HIDDEN;
@@ -140,6 +141,9 @@ extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
extern NTSTATUS exec_wineloader( char **argv, int socketfd, int is_child_64bit,
ULONGLONG res_start, ULONGLONG res_end ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status ) DECLSPEC_HIDDEN;
@@ -146,6 +147,9 @@ extern NTSTATUS exec_wineloader( char **argv, int socketfd, int is_child_64bit,
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
extern ULONG_PTR get_image_address(void) DECLSPEC_HIDDEN;
+extern unsigned int __wine_nb_syscalls DECLSPEC_HIDDEN;
+extern void *__wine_syscall_dispatcher DECLSPEC_HIDDEN;
@@ -251,19 +251,10 @@ index 19196dbb296..e99e89864c2 100644
extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index b09f4942f05..b952af4596a 100644
index a9803478a37..e3bb8f7ce8e 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -28,7 +28,7 @@ struct ldt_copy;
struct msghdr;
/* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 53
+#define NTDLL_UNIXLIB_VERSION 54
struct unix_funcs
{
@@ -281,7 +281,8 @@ struct unix_funcs
@@ -302,7 +302,8 @@ struct unix_funcs
/* thread/process functions */
TEB * (CDECL *init_threading)( int *nb_threads_ptr, struct ldt_copy **ldt_copy, SIZE_T *size,
@@ -272,7 +263,7 @@ index b09f4942f05..b952af4596a 100644
+ void *syscall_handler, unsigned int syscall_count );
void (CDECL *exit_thread)( int status );
void (CDECL *exit_process)( int status );
NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len );
NTSTATUS (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 9cc4698d0d7..c572fe49923 100644
--- a/tools/winebuild/spec32.c