winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
1051 discussions
Start a n
N
ew thread
Alexandre Julliard : wow64: Implement Wow64ApcRoutine().
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 477478f79ce901a74a22d43f5dab83da22cea46c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=477478f79ce901a74a22d43f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 16:39:22 2021 +0200 wow64: Implement Wow64ApcRoutine(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/syscall.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 6f443557e16..364e1a778dd 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -543,7 +543,71 @@ void * WINAPI Wow64AllocateTemp( SIZE_T size ) */ void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CONTEXT *context ) { - FIXME( "stub %lx %lx %lx\n", arg1, arg2, arg3 ); + NTSTATUS retval; + +#ifdef __x86_64__ + retval = context->Rax; +#elif defined(__aarch64__) + retval = context->X0; +#endif + + /* cf. 32-bit call_user_apc_dispatcher */ + switch (current_machine) + { + case IMAGE_FILE_MACHINE_I386: + { + struct apc_stack_layout + { + ULONG ret; + ULONG context_ptr; + ULONG arg1; + ULONG arg2; + ULONG arg3; + ULONG func; + I386_CONTEXT context; + } *stack; + I386_CONTEXT ctx = { CONTEXT_I386_FULL }; + + NtQueryInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx), NULL ); + stack = (struct apc_stack_layout *)ULongToPtr( ctx.Esp & ~3 ) - 1; + stack->context_ptr = PtrToUlong( &stack->context ); + stack->func = arg1 >> 32; + stack->arg1 = arg1; + stack->arg2 = arg2; + stack->arg3 = arg3; + stack->context = ctx; + stack->context.Eax = retval; + ctx.Esp = PtrToUlong( stack ); + ctx.Eip = pLdrSystemDllInitBlock->pKiUserApcDispatcher; + NtSetInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx) ); + } + break; + + case IMAGE_FILE_MACHINE_ARMNT: + { + struct apc_stack_layout + { + ULONG func; + ULONG align[3]; + ARM_CONTEXT context; + } *stack; + ARM_CONTEXT ctx = { CONTEXT_ARM_FULL }; + + NtQueryInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx), NULL ); + stack = (struct apc_stack_layout *)ULongToPtr( ctx.Sp & ~15 ) - 1; + stack->func = arg1 >> 32; + stack->context = ctx; + stack->context.R0 = retval; + ctx.Sp = PtrToUlong( stack ); + ctx.Pc = pLdrSystemDllInitBlock->pKiUserApcDispatcher; + ctx.R0 = PtrToUlong( &stack->context ); + ctx.R1 = arg1; + ctx.R2 = arg2; + ctx.R3 = arg3; + NtSetInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx) ); + } + break; + } }
1
0
0
0
Alexandre Julliard : wow64: Add support for jumping to 32-bit code in Wow64LdrpInitialize().
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: ae21ddb0240fbe917473cc92669ac09e356197e9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ae21ddb0240fbe917473cc92…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 12:25:52 2021 +0200 wow64: Add support for jumping to 32-bit code in Wow64LdrpInitialize(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/process.c | 15 ++++++++++++ dlls/wow64/sync.c | 9 ++++++++ dlls/wow64/syscall.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++------ dlls/wow64/syscall.h | 2 ++ 4 files changed, 83 insertions(+), 7 deletions(-) diff --git a/dlls/wow64/process.c b/dlls/wow64/process.c index 44380535d9c..764a2ba46ca 100644 --- a/dlls/wow64/process.c +++ b/dlls/wow64/process.c @@ -309,6 +309,21 @@ NTSTATUS WINAPI wow64_NtAssignProcessToJobObject( UINT *args ) } +/********************************************************************** + * wow64_NtContinue + */ +NTSTATUS WINAPI wow64_NtContinue( UINT *args ) +{ + void *context = get_ptr( &args ); + BOOLEAN alertable = get_ulong( &args ); + + NtSetInformationThread( GetCurrentThread(), ThreadWow64Context, + context, get_machine_context_size( current_machine )); + if (alertable) NtTestAlert(); + return STATUS_SUCCESS; +} + + /********************************************************************** * wow64_NtCreateThread */ diff --git a/dlls/wow64/sync.c b/dlls/wow64/sync.c index 1b4c3c864c3..400deeb8422 100644 --- a/dlls/wow64/sync.c +++ b/dlls/wow64/sync.c @@ -1461,6 +1461,15 @@ NTSTATUS WINAPI wow64_NtTerminateJobObject( UINT *args ) } +/********************************************************************** + * wow64_NtTestAlert + */ +NTSTATUS WINAPI wow64_NtTestAlert( UINT *args ) +{ + return NtTestAlert(); +} + + /********************************************************************** * wow64_NtWaitForDebugEvent */ diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index e120ed022cd..6f443557e16 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -393,7 +393,7 @@ static HMODULE load_cpu_dll(void) /********************************************************************** * process_init */ -static void process_init(void) +static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **context ) { HMODULE module; UNICODE_STRING str; @@ -421,11 +421,63 @@ static void process_init(void) *pWow64Transition = *p__wine_syscall_dispatcher = pBTCpuGetBopCode(); init_file_redirects(); + return TRUE; #undef GET_PTR } +/********************************************************************** + * thread_init + */ +static void thread_init(void) +{ + /* update initial context to jump to 32-bit LdrInitializeThunk (cf. 32-bit call_init_thunk) */ + switch (current_machine) + { + case IMAGE_FILE_MACHINE_I386: + { + I386_CONTEXT *ctx_ptr, ctx = { CONTEXT_I386_ALL }; + ULONG *stack; + + NtQueryInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx), NULL ); + ctx_ptr = (I386_CONTEXT *)ULongToPtr( ctx.Esp ) - 1; + *ctx_ptr = ctx; + + stack = (ULONG *)ctx_ptr; + *(--stack) = 0; + *(--stack) = 0; + *(--stack) = 0; + *(--stack) = PtrToUlong( ctx_ptr ); + *(--stack) = 0xdeadbabe; + ctx.Esp = PtrToUlong( stack ); + ctx.Eip = pLdrSystemDllInitBlock->pLdrInitializeThunk; + NtSetInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx) ); + } + break; + + case IMAGE_FILE_MACHINE_ARMNT: + { + ARM_CONTEXT *ctx_ptr, ctx = { CONTEXT_ARM_ALL }; + + NtQueryInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx), NULL ); + ctx_ptr = (ARM_CONTEXT *)ULongToPtr( ctx.Sp & ~15 ) - 1; + *ctx_ptr = ctx; + + ctx.R0 = PtrToUlong( ctx_ptr ); + ctx.Sp = PtrToUlong( ctx_ptr ); + ctx.Pc = pLdrSystemDllInitBlock->pLdrInitializeThunk; + NtSetInformationThread( GetCurrentThread(), ThreadWow64Context, &ctx, sizeof(ctx) ); + } + break; + + default: + ERR( "not supported machine %x\n", current_machine ); + NtTerminateProcess( GetCurrentProcess(), STATUS_INVALID_IMAGE_FORMAT ); + } +} + + /********************************************************************** * free_temp_data */ @@ -500,11 +552,9 @@ void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CON */ void WINAPI Wow64LdrpInitialize( CONTEXT *context ) { - static BOOL init_done; + static RTL_RUN_ONCE init_done; - if (!init_done) - { - init_done = TRUE; - process_init(); - } + RtlRunOnceExecuteOnce( &init_done, process_init, NULL, NULL ); + thread_init(); + pBTCpuSimulate(); } diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 782a7a78c18..f794d35cee4 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -43,6 +43,7 @@ SYSCALL_ENTRY( NtClose ) \ SYSCALL_ENTRY( NtCompleteConnectPort ) \ SYSCALL_ENTRY( NtConnectPort ) \ + SYSCALL_ENTRY( NtContinue ) \ SYSCALL_ENTRY( NtCreateDebugObject ) \ SYSCALL_ENTRY( NtCreateDirectoryObject ) \ SYSCALL_ENTRY( NtCreateEvent ) \ @@ -217,6 +218,7 @@ SYSCALL_ENTRY( NtTerminateJobObject ) \ SYSCALL_ENTRY( NtTerminateProcess ) \ SYSCALL_ENTRY( NtTerminateThread ) \ + SYSCALL_ENTRY( NtTestAlert ) \ SYSCALL_ENTRY( NtUnloadDriver ) \ SYSCALL_ENTRY( NtUnloadKey ) \ SYSCALL_ENTRY( NtUnlockFile ) \
1
0
0
0
Alexandre Julliard : wow64: Make the syscall dispatcher point to the wow64cpu syscall wrapper.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 9f24bc44bcb5e147e46a74de4e8d570641aa1377 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9f24bc44bcb5e147e46a74de…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 12:06:27 2021 +0200 wow64: Make the syscall dispatcher point to the wow64cpu syscall wrapper. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64/syscall.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 2fd9f309b1b..e120ed022cd 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -62,8 +62,16 @@ struct mem_header BYTE data[1]; }; +static void **pWow64Transition; +static void **p__wine_syscall_dispatcher; static SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock; +/* cpu backend dll functions */ +static void * (WINAPI *pBTCpuGetBopCode)(void); +static void (WINAPI *pBTCpuProcessInit)(void); +static void (WINAPI *pBTCpuSimulate)(void); + + void *dummy = RtlUnwind; BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) @@ -400,9 +408,17 @@ static void process_init(void) GET_PTR( LdrSystemDllInitBlock ); module = (HMODULE)(ULONG_PTR)pLdrSystemDllInitBlock->ntdll_handle; + GET_PTR( Wow64Transition ); + GET_PTR( __wine_syscall_dispatcher ); init_syscall_table( module ); - load_cpu_dll(); + module = load_cpu_dll(); + GET_PTR( BTCpuGetBopCode ); + GET_PTR( BTCpuProcessInit ); + GET_PTR( BTCpuSimulate ); + + pBTCpuProcessInit(); + *pWow64Transition = *p__wine_syscall_dispatcher = pBTCpuGetBopCode(); init_file_redirects();
1
0
0
0
Alexandre Julliard : wow64cpu: Restore the full 32-bit context when changed externally.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: e30f091f3b2acbd133edb599a72b4bea381c0b55 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e30f091f3b2acbd133edb599…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 12:13:21 2021 +0200 wow64cpu: Restore the full 32-bit context when changed externally. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/signal_x86_64.c | 3 +++ dlls/wow64cpu/cpu.c | 40 +++++++++++++++++++++++++++++++++++++++- dlls/wow64cpu/wow64cpu.spec | 4 ++-- include/winternl.h | 2 ++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index bfc5b34a464..d02a7946945 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1957,12 +1957,15 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size ) } if (flags & CONTEXT_I386_CONTROL) { + WOW64_CPURESERVED *cpu = NtCurrentTeb()->TlsSlots[WOW64_TLS_CPURESERVED]; + wow_frame->Esp = context->Esp; wow_frame->Ebp = context->Ebp; wow_frame->Eip = context->Eip; wow_frame->EFlags = context->EFlags; wow_frame->SegCs = cs32_sel; wow_frame->SegSs = ds64_sel; + cpu->Flags |= WOW64_CPURESERVED_FLAG_RESET_STATE; } if (flags & CONTEXT_I386_SEGMENTS) { diff --git a/dlls/wow64cpu/cpu.c b/dlls/wow64cpu/cpu.c index df292221117..8293d596ec4 100644 --- a/dlls/wow64cpu/cpu.c +++ b/dlls/wow64cpu/cpu.c @@ -82,13 +82,33 @@ __ASM_GLOBAL_FUNC( syscall_32to64, "movl 0xa0(%r13),%esi\n\t" /* context->Esi */ "movl 0xa4(%r13),%ebx\n\t" /* context->Ebx */ "movl 0xb4(%r13),%ebp\n\t" /* context->Ebp */ + "btrl $0,-4(%r13)\n\t" /* cpu->Flags & WOW64_CPURESERVED_FLAG_RESET_STATE */ + "jc 1f\n\t" "movl 0xb8(%r13),%edx\n\t" /* context->Eip */ "movl %edx,(%rsp)\n\t" "movl 0xbc(%r13),%edx\n\t" /* context->SegCs */ "movl %edx,4(%rsp)\n\t" "movl 0xc4(%r13),%r14d\n\t" /* context->Esp */ "xchgq %r14,%rsp\n\t" - "ljmp *(%r14)" ) + "ljmp *(%r14)\n" + "1:\tmovq %rsp,%r14\n\t" + "movl 0xa8(%r13),%edx\n\t" /* context->Edx */ + "movl 0xac(%r13),%ecx\n\t" /* context->Ecx */ + "movl 0xc8(%r13),%eax\n\t" /* context->SegSs */ + "movq %rax,0x20(%rsp)\n\t" + "mov %ax,%ds\n\t" + "mov %ax,%es\n\t" + "mov 0x90(%r13),%fs\n\t" /* context->SegFs */ + "movl 0xc4(%r13),%eax\n\t" /* context->Esp */ + "movq %rax,0x18(%rsp)\n\t" + "movl 0xc0(%r13),%eax\n\t" /* context->EFlags */ + "movq %rax,0x10(%rsp)\n\t" + "movl 0xbc(%r13),%eax\n\t" /* context->SegCs */ + "movq %rax,0x8(%rsp)\n\t" + "movl 0xb8(%r13),%eax\n\t" /* context->Eip */ + "movq %rax,(%rsp)\n\t" + "movl 0xb0(%r13),%eax\n\t" /* context->Eax */ + "iretq" ) /********************************************************************** @@ -137,3 +157,21 @@ void * WINAPI BTCpuGetBopCode(void) { return code_buffer; } + + +/********************************************************************** + * BTCpuGetContext (wow64cpu.@) + */ +NTSTATUS WINAPI BTCpuGetContext( HANDLE thread, HANDLE process, void *unknown, I386_CONTEXT *ctx ) +{ + return NtQueryInformationThread( thread, ThreadWow64Context, ctx, sizeof(*ctx), NULL ); +} + + +/********************************************************************** + * BTCpuSetContext (wow64cpu.@) + */ +NTSTATUS WINAPI BTCpuSetContext( HANDLE thread, HANDLE process, void *unknown, I386_CONTEXT *ctx ) +{ + return NtSetInformationThread( thread, ThreadWow64Context, ctx, sizeof(*ctx) ); +} diff --git a/dlls/wow64cpu/wow64cpu.spec b/dlls/wow64cpu/wow64cpu.spec index ba0abb7a8ed..b86481563f2 100644 --- a/dlls/wow64cpu/wow64cpu.spec +++ b/dlls/wow64cpu/wow64cpu.spec @@ -1,8 +1,8 @@ @ stdcall BTCpuGetBopCode() -#@ stub BTCpuGetContext +@ stdcall BTCpuGetContext(long long ptr ptr) @ stdcall BTCpuProcessInit() #@ stub BTCpuResetToConsistentState -#@ stub BTCpuSetContext +@ stdcall BTCpuSetContext(long long ptr ptr) @ stdcall BTCpuSimulate() #@ stub BTCpuTurboThunkControl #@ stub TurboDispatchJumpAddressEnd diff --git a/include/winternl.h b/include/winternl.h index 9dff3a98bed..a048b9546ee 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3727,6 +3727,8 @@ typedef struct _WOW64_CPURESERVED /* CONTEXT_EX *context_ex */ } WOW64_CPURESERVED, *PWOW64_CPURESERVED; +#define WOW64_CPURESERVED_FLAG_RESET_STATE 1 + typedef struct _WOW64_CPU_AREA_INFO { void *Context;
1
0
0
0
Alexandre Julliard : wow64cpu: Implement 32<->64 bit code switching.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: f60fd0e9ae35503f1a334607c2b8294595058e67 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f60fd0e9ae35503f1a334607…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 12:06:02 2021 +0200 wow64cpu: Implement 32<->64 bit code switching. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wow64cpu/Makefile.in | 5 ++ dlls/wow64cpu/cpu.c | 139 ++++++++++++++++++++++++++++++++++++++++++++ dlls/wow64cpu/wow64cpu.spec | 18 +++--- 3 files changed, 153 insertions(+), 9 deletions(-) diff --git a/dlls/wow64cpu/Makefile.in b/dlls/wow64cpu/Makefile.in index 261363fa72a..d574b68aee5 100644 --- a/dlls/wow64cpu/Makefile.in +++ b/dlls/wow64cpu/Makefile.in @@ -1 +1,6 @@ MODULE = wow64cpu.dll +IMPORTS = wow64 ntdll winecrt0 + +EXTRADLLFLAGS = -nodefaultlibs -mno-cygwin -Wl,--image-base,0x6f100000 + +C_SRCS = cpu.c diff --git a/dlls/wow64cpu/cpu.c b/dlls/wow64cpu/cpu.c new file mode 100644 index 00000000000..df292221117 --- /dev/null +++ b/dlls/wow64cpu/cpu.c @@ -0,0 +1,139 @@ +/* + * WoW64 CPU support + * + * Copyright 2021 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winnt.h" +#include "winternl.h" +#include "wine/asm.h" +#include "wine/exception.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wow); + +#include "pshpack1.h" +struct thunk_32to64 +{ + BYTE ljmp; /* ljmp %cs:1f */ + DWORD addr; + WORD cs; +}; +#include "poppack.h" + +static BYTE DECLSPEC_ALIGN(4096) code_buffer[0x1000]; + + +BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) +{ + if (reason == DLL_PROCESS_ATTACH) LdrDisableThreadCalloutsForDll( inst ); + return TRUE; +} + + +/********************************************************************** + * syscall_32to64 + * + * Execute a 64-bit syscall from 32-bit code, then return to 32-bit. + */ +extern void WINAPI syscall_32to64(void) DECLSPEC_HIDDEN; +__ASM_GLOBAL_FUNC( syscall_32to64, + /* cf. BTCpuSimulate prolog */ + __ASM_SEH(".seh_stackalloc 0x28\n\t") + __ASM_SEH(".seh_endprologue\n\t") + __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t") + "xchgq %r14,%rsp\n\t" + "movl %edi,0x9c(%r13)\n\t" /* context->Edi */ + "movl %esi,0xa0(%r13)\n\t" /* context->Esi */ + "movl %ebx,0xa4(%r13)\n\t" /* context->Ebx */ + "movl %ebp,0xb4(%r13)\n\t" /* context->Ebp */ + "movl (%r14),%edx\n\t" + "movl %edx,0xb8(%r13)\n\t" /* context->Eip */ + "pushfq\n\t" + "popq %rdx\n\t" + "movl %edx,0xc0(%r13)\n\t" /* context->EFlags */ + "leaq 4(%r14),%rdx\n\t" + "movl %edx,0xc4(%r13)\n\t" /* context->Esp */ + "movq %rax,%rcx\n\t" /* syscall number */ + "leaq 8(%r14),%rdx\n\t" /* parameters */ + "call " __ASM_NAME("Wow64SystemServiceEx") "\n\t" + + "syscall_32to64_return:\n\t" + "movl 0x9c(%r13),%edi\n\t" /* context->Edi */ + "movl 0xa0(%r13),%esi\n\t" /* context->Esi */ + "movl 0xa4(%r13),%ebx\n\t" /* context->Ebx */ + "movl 0xb4(%r13),%ebp\n\t" /* context->Ebp */ + "movl 0xb8(%r13),%edx\n\t" /* context->Eip */ + "movl %edx,(%rsp)\n\t" + "movl 0xbc(%r13),%edx\n\t" /* context->SegCs */ + "movl %edx,4(%rsp)\n\t" + "movl 0xc4(%r13),%r14d\n\t" /* context->Esp */ + "xchgq %r14,%rsp\n\t" + "ljmp *(%r14)" ) + + +/********************************************************************** + * BTCpuSimulate (wow64cpu.@) + */ +__ASM_STDCALL_FUNC( BTCpuSimulate, 0, + "subq $0x28,%rsp\n" + __ASM_SEH(".seh_stackalloc 0x28\n\t") + __ASM_SEH(".seh_endprologue\n\t") + __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t") + "movq %gs:0x30,%r12\n\t" + "movq 0x1488(%r12),%rcx\n\t" /* NtCurrentTeb()->TlsSlots[WOW64_TLS_CPURESERVED] */ + "leaq 4(%rcx),%r13\n" /* cpu->Context */ + "jmp syscall_32to64_return\n" ) + + +/********************************************************************** + * BTCpuProcessInit (wow64cpu.@) + */ +NTSTATUS WINAPI BTCpuProcessInit(void) +{ + struct thunk_32to64 *thunk = (struct thunk_32to64 *)code_buffer; + SIZE_T size = sizeof(*thunk); + ULONG old_prot; + CONTEXT context; + + if ((ULONG_PTR)syscall_32to64 >> 32) + { + ERR( "wow64cpu loaded above 4G, disabling\n" ); + return STATUS_INVALID_ADDRESS; + } + + RtlCaptureContext( &context ); + thunk->ljmp = 0xea; + thunk->addr = PtrToUlong( syscall_32to64 ); + thunk->cs = context.SegCs; + NtProtectVirtualMemory( GetCurrentProcess(), (void **)&thunk, &size, PAGE_EXECUTE_READ, &old_prot ); + return STATUS_SUCCESS; +} + + +/********************************************************************** + * BTCpuGetBopCode (wow64cpu.@) + */ +void * WINAPI BTCpuGetBopCode(void) +{ + return code_buffer; +} diff --git a/dlls/wow64cpu/wow64cpu.spec b/dlls/wow64cpu/wow64cpu.spec index 768b6627a1d..ba0abb7a8ed 100644 --- a/dlls/wow64cpu/wow64cpu.spec +++ b/dlls/wow64cpu/wow64cpu.spec @@ -1,9 +1,9 @@ -@ stub BTCpuGetBopCode -@ stub BTCpuGetContext -@ stub BTCpuProcessInit -@ stub BTCpuResetToConsistentState -@ stub BTCpuSetContext -@ stub BTCpuSimulate -@ stub BTCpuTurboThunkControl -@ stub TurboDispatchJumpAddressEnd -@ stub TurboDispatchJumpAddressStart +@ stdcall BTCpuGetBopCode() +#@ stub BTCpuGetContext +@ stdcall BTCpuProcessInit() +#@ stub BTCpuResetToConsistentState +#@ stub BTCpuSetContext +@ stdcall BTCpuSimulate() +#@ stub BTCpuTurboThunkControl +#@ stub TurboDispatchJumpAddressEnd +#@ stub TurboDispatchJumpAddressStart
1
0
0
0
Alexandre Julliard : ntdll: Use the 32-bit __wine_ctrl_routine() in Wow64 processes.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 3dd6cafe3d03404eb61eb1585e36a1de6e4259a2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3dd6cafe3d03404eb61eb158…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 12:48:15 2021 +0200 ntdll: Use the 32-bit __wine_ctrl_routine() in Wow64 processes. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c2f79bc2c44..f1dbe9f345e 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -869,6 +869,8 @@ static void load_ntdll_wow64_functions( HMODULE module ) GET_FUNC( RtlpQueryProcessDebugInformationRemote ); #undef GET_FUNC + p__wine_ctrl_routine = (void *)find_named_export( module, exports, "__wine_ctrl_routine" ); + /* also set the 32-bit LdrSystemDllInitBlock */ memcpy( (void *)(ULONG_PTR)pLdrSystemDllInitBlock->pLdrSystemDllInitBlock, pLdrSystemDllInitBlock, sizeof(*pLdrSystemDllInitBlock) );
1
0
0
0
Alexandre Julliard : ntdll: Store the 32-bit PEB in the process initial 32-bit context.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 44de9743bfeb088b0aa038da82ba118ce4ab30a4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=44de9743bfeb088b0aa038da…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 12:42:44 2021 +0200 ntdll: Store the 32-bit PEB in the process initial 32-bit context. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/signal_x86_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 2769ebf24d6..bfc5b34a464 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2929,7 +2929,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B { wow_context->ContextFlags = CONTEXT_I386_ALL; wow_context->Eax = (ULONG_PTR)entry; - wow_context->Ebx = (ULONG_PTR)arg; + wow_context->Ebx = (arg == peb ? get_wow_teb( teb )->Peb : (ULONG_PTR)arg); wow_context->Esp = get_wow_teb( teb )->Tib.StackBase - 16; wow_context->Eip = pLdrSystemDllInitBlock->pRtlUserThreadStart; wow_context->SegCs = cs32_sel;
1
0
0
0
Alexandre Julliard : ntdll: Move the loading of the global options to the Unix side.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 0bce76d83077960763f6e71a0ecf9757ce08325c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0bce76d83077960763f6e71a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Aug 4 11:45:51 2021 +0200 ntdll: Move the loading of the global options to the Unix side. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/process.c | 18 ++++++-- dlls/ntdll/heap.c | 4 +- dlls/ntdll/loader.c | 22 ---------- dlls/ntdll/ntdll_misc.h | 1 - dlls/ntdll/unix/env.c | 100 +++++++++++++++++++++++++++++++++++++----- 5 files changed, 105 insertions(+), 40 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=0bce76d83077960763f6…
1
0
0
0
Rémi Bernon : maintainers: Add myself to some sections.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 7458219e17a472cd34567ea958ede23b0a190200 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7458219e17a472cd34567ea9…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 4 10:39:16 2021 +0200 maintainers: Add myself to some sections. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- MAINTAINERS | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index ad121ab117d..18478a8871f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -89,6 +89,7 @@ F: dlls/d3dxof/ DirectInput P: Andrew Eikum <aeikum(a)codeweavers.com> +P: Rémi Bernon <rbernon(a)codeweavers.com> F: dlls/dinput/ DirectMusic @@ -139,6 +140,7 @@ F: dlls/gphoto2.ds/ HID support M: Aric Stewart <aric(a)codeweavers.com> +P: Rémi Bernon <rbernon(a)codeweavers.com> F: dlls/hid/ F: dlls/hidclass.sys/ F: dlls/winehid.sys/ @@ -148,6 +150,12 @@ M: Zebediah Figura <z.figura12(a)gmail.com> F: dlls/httpapi/ F: dlls/http.sys/ +Input events +P: Rémi Bernon <rbernon(a)codeweavers.com> +F: dlls/user32/input.c +F: dlls/user32/rawinput.c +F: server/queue.c + Input methods M: Aric Stewart <aric(a)codeweavers.com> F: dlls/imm32/ @@ -275,6 +283,7 @@ F: dlls/shdocvw/ WIDL P: Huw Davies <huw(a)codeweavers.com> +P: Rémi Bernon <rbernon(a)codeweavers.com> P: Zebediah Figura <z.figura12(a)gmail.com> F: tools/widl @@ -300,6 +309,10 @@ F: dlls/mfreadwrite/ F: dlls/mfuuid/ F: dlls/rtworkq/ +Wine debugger (GDB backend) +P: Rémi Bernon <rbernon(a)codeweavers.com> +F: programs/winedbg/gdbproxy.c + Wine server, IPC M: Alexandre Julliard <julliard(a)winehq.org> P: Erich E. Hoover <erich.e.hoover(a)wine-staging.com> @@ -323,6 +336,7 @@ F: dlls/wpcap/ X11 Driver M: Alexandre Julliard <julliard(a)winehq.org> +P: Rémi Bernon <rbernon(a)codeweavers.com> F: dlls/winex11.drv/ XML parsing
1
0
0
0
Rémi Bernon : maintainers: Add a WIDL section.
by Alexandre Julliard
04 Aug '21
04 Aug '21
Module: wine Branch: master Commit: 145d6722fc3c034d09d91c94034cc95e242e12c6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=145d6722fc3c034d09d91c94…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 4 10:39:15 2021 +0200 maintainers: Add a WIDL section. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- MAINTAINERS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index c36a70958ed..ad121ab117d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -244,7 +244,6 @@ RPC Runtime P: Huw Davies <huw(a)codeweavers.com> P: Zebediah Figura <z.figura12(a)gmail.com> F: dlls/rpcrt4 -F: tools/widl TWAIN P: Esme Povirk <vincent(a)codeweavers.com> @@ -274,6 +273,11 @@ F: dlls/ieframe/ F: dlls/mshtml/ F: dlls/shdocvw/ +WIDL +P: Huw Davies <huw(a)codeweavers.com> +P: Zebediah Figura <z.figura12(a)gmail.com> +F: tools/widl + Windows Imaging Component M: Esme Povirk <vincent(a)codeweavers.com> F: dlls/windowscodecs/
1
0
0
0
← Newer
1
...
92
93
94
95
96
97
98
...
106
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Results per page:
10
25
50
100
200