Module: wine Branch: master Commit: 5c62fe0bfe167b907af0029aadf8e48144b7c547 URL: https://gitlab.winehq.org/wine/wine/-/commit/5c62fe0bfe167b907af0029aadf8e48...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 14 13:06:14 2023 +0100
ntdll: Replace the __wine_dbg_write() syscall by a Unix call.
---
dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/thread.c | 10 ++++++++++ dlls/ntdll/unix/debug.c | 26 ++++++++++++++++++++++---- dlls/ntdll/unix/loader.c | 3 ++- dlls/ntdll/unix/unix_private.h | 5 +++++ dlls/ntdll/unixlib.h | 7 +++++++ dlls/wow64/syscall.c | 12 ------------ dlls/wow64/syscall.h | 1 - 8 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 537d244c216..c294a605f1e 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1702,7 +1702,7 @@ @ extern -arch=arm64 __wine_current_teb
# Debugging -@ stdcall -syscall -norelay __wine_dbg_write(ptr long) +@ stdcall -norelay __wine_dbg_write(ptr long) @ cdecl -norelay __wine_dbg_get_channel_flags(ptr) @ cdecl -norelay __wine_dbg_header(long long str) @ cdecl -norelay __wine_dbg_output(str) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 1bd8f900d22..b0b61419e37 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -157,6 +157,16 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_ return info->out_pos; }
+/*********************************************************************** + * __wine_dbg_write (NTDLL.@) + */ +int WINAPI __wine_dbg_write( const char *str, unsigned int len ) +{ + struct wine_dbg_write_params params = { str, len }; + + return WINE_UNIX_CALL( unix_wine_dbg_write, ¶ms ); +} + /*********************************************************************** * __wine_dbg_output (NTDLL.@) */ diff --git a/dlls/ntdll/unix/debug.c b/dlls/ntdll/unix/debug.c index aa2d87c304f..bc0e3c1c694 100644 --- a/dlls/ntdll/unix/debug.c +++ b/dlls/ntdll/unix/debug.c @@ -253,12 +253,30 @@ const char * __cdecl __wine_dbg_strdup( const char *str ) }
/*********************************************************************** - * __wine_dbg_write (NTDLL.@) + * unixcall_wine_dbg_write */ -int WINAPI __wine_dbg_write( const char *str, unsigned int len ) +NTSTATUS unixcall_wine_dbg_write( void *args ) { - return write( 2, str, len ); + struct wine_dbg_write_params *params = args; + + return write( 2, params->str, params->len ); +} + +#ifdef _WIN64 +/*********************************************************************** + * wow64_wine_dbg_write + */ +NTSTATUS wow64_wine_dbg_write( void *args ) +{ + struct + { + ULONG str; + unsigned int len; + } const *params32 = args; + + return write( 2, ULongToPtr(params32->str), params32->len ); } +#endif
/*********************************************************************** * __wine_dbg_output (NTDLL.@) @@ -272,7 +290,7 @@ int __cdecl __wine_dbg_output( const char *str ) if (end) { ret += append_output( info, str, end + 1 - str ); - __wine_dbg_write( info->output, info->out_pos ); + write( 2, info->output, info->out_pos ); info->out_pos = 0; str = end + 1; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index dd0c294ea92..b0834c97795 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -357,7 +357,6 @@ static void * const syscalls[] = NtWriteFileGather, NtWriteVirtualMemory, NtYieldExecution, - __wine_dbg_write, __wine_unix_spawnvp, wine_nt_to_unix_file_name, wine_server_call, @@ -2061,6 +2060,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = { load_so_dll, unwind_builtin_dll, + unixcall_wine_dbg_write, system_time_precise, };
@@ -2077,6 +2077,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = { wow64_load_so_dll, wow64_unwind_builtin_dll, + wow64_wine_dbg_write, system_time_precise, };
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 6c196436cc7..fcaf51d9652 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -283,6 +283,11 @@ extern void init_cpu_info(void) DECLSPEC_HIDDEN; extern void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) DECLSPEC_HIDDEN; extern void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULONG_PTR information, BOOL mark_pending ) DECLSPEC_HIDDEN;
+extern NTSTATUS unixcall_wine_dbg_write( void *args ) DECLSPEC_HIDDEN; +#ifdef _WIN64 +extern NTSTATUS wow64_wine_dbg_write( void *args ) DECLSPEC_HIDDEN; +#endif + extern void dbg_init(void) DECLSPEC_HIDDEN;
extern NTSTATUS call_user_apc_dispatcher( CONTEXT *context_ptr, ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index edbfb1f19b3..9fd23627ee9 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -25,6 +25,12 @@
struct _DISPATCHER_CONTEXT;
+struct wine_dbg_write_params +{ + const char *str; + unsigned int len; +}; + struct load_so_dll_params { UNICODE_STRING nt_name; @@ -42,6 +48,7 @@ enum ntdll_unix_funcs { unix_load_so_dll, unix_unwind_builtin_dll, + unix_wine_dbg_write, unix_system_time_precise, };
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index e9b8df76e7c..41215e58bb0 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -541,18 +541,6 @@ NTSTATUS WINAPI wow64_NtSetDefaultUILanguage( UINT *args ) }
-/********************************************************************** - * wow64___wine_dbg_write - */ -NTSTATUS WINAPI wow64___wine_dbg_write( UINT *args ) -{ - const char *str = get_ptr( &args ); - ULONG len = get_ulong( &args ); - - return __wine_dbg_write( str, len ); -} - - /********************************************************************** * wow64___wine_unix_spawnvp */ diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 466821146e6..801bc6054da 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -257,7 +257,6 @@ SYSCALL_ENTRY( NtWriteFileGather ) \ SYSCALL_ENTRY( NtWriteVirtualMemory ) \ SYSCALL_ENTRY( NtYieldExecution ) \ - SYSCALL_ENTRY( __wine_dbg_write ) \ SYSCALL_ENTRY( __wine_unix_spawnvp ) \ SYSCALL_ENTRY( wine_nt_to_unix_file_name ) \ SYSCALL_ENTRY( wine_server_call ) \