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
February 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
2 participants
915 discussions
Start a n
N
ew thread
Jacek Caban : ntdll: Use syscall frame in x86 set_full_cpu_context implementation.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: 35e43ccf1b42e9f67d7765753f0c3ef8cf102c46 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=35e43ccf1b42e9f67d776575…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Feb 25 18:54:24 2021 +0100 ntdll: Use syscall frame in x86 set_full_cpu_context implementation. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/signal_i386.c | 123 +++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 55 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index be3f1060e4a..73b16b645bb 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -820,16 +820,6 @@ static inline void restore_xstate( const CONTEXT *context ) } -/*********************************************************************** - * signal_restore_full_cpu_context - * - * Restore full context from syscall frame - */ -void signal_restore_full_cpu_context(void) -{ -} - - /*********************************************************************** * fpux_to_fpu * @@ -991,36 +981,36 @@ static inline void restore_context( const struct xcontext *xcontext, ucontext_t * * Set the new CPU context. */ -extern void set_full_cpu_context( const CONTEXT *context ); +extern void set_full_cpu_context(void); __ASM_GLOBAL_FUNC( set_full_cpu_context, - "movl $0,%fs:0x1f8\n\t" /* x86_thread_data()->syscall_frame = NULL */ - "movl 4(%esp),%ecx\n\t" - "movw 0x8c(%ecx),%gs\n\t" /* SegGs */ - "movw 0x90(%ecx),%fs\n\t" /* SegFs */ - "movw 0x94(%ecx),%es\n\t" /* SegEs */ - "movl 0x9c(%ecx),%edi\n\t" /* Edi */ - "movl 0xa0(%ecx),%esi\n\t" /* Esi */ - "movl 0xa4(%ecx),%ebx\n\t" /* Ebx */ - "movl 0xb4(%ecx),%ebp\n\t" /* Ebp */ + "movl %fs:0x1f8,%ecx\n\t" + "movl $0,%fs:0x1f8\n\t" /* x86_thread_data()->syscall_frame = NULL */ + "movw 0x16(%ecx),%gs\n\t" /* SegGs */ + "movw 0x14(%ecx),%fs\n\t" /* SegFs */ + "movw 0x12(%ecx),%es\n\t" /* SegEs */ + "movl 0x1c(%ecx),%ebx\n\t" /* Ebx */ + "movl 0x28(%ecx),%edi\n\t" /* Edi */ + "movl 0x2c(%ecx),%esi\n\t" /* Esi */ + "movl 0x30(%ecx),%ebp\n\t" /* Ebp */ "movw %ss,%ax\n\t" - "cmpw 0xc8(%ecx),%ax\n\t" /* SegSs */ + "cmpw 0x0e(%ecx),%ax\n\t" /* SegSs */ "jne 1f\n\t" /* As soon as we have switched stacks the context structure could * be invalid (when signal handlers are executed for example). Copy * values on the target stack before changing ESP. */ - "movl 0xc4(%ecx),%eax\n\t" /* Esp */ + "movl 0x08(%ecx),%eax\n\t" /* Esp */ "leal -4*4(%eax),%eax\n\t" - "movl 0xc0(%ecx),%edx\n\t" /* EFlags */ + "movl (%ecx),%edx\n\t" /* EFlags */ "movl %edx,3*4(%eax)\n\t" - "movl 0xbc(%ecx),%edx\n\t" /* SegCs */ + "movl 0x0c(%ecx),%edx\n\t" /* SegCs */ "movl %edx,2*4(%eax)\n\t" - "movl 0xb8(%ecx),%edx\n\t" /* Eip */ + "movl 0x04(%ecx),%edx\n\t" /* Eip */ "movl %edx,1*4(%eax)\n\t" - "movl 0xb0(%ecx),%edx\n\t" /* Eax */ + "movl 0x18(%ecx),%edx\n\t" /* Eax */ "movl %edx,0*4(%eax)\n\t" - "pushl 0x98(%ecx)\n\t" /* SegDs */ - "movl 0xa8(%ecx),%edx\n\t" /* Edx */ - "movl 0xac(%ecx),%ecx\n\t" /* Ecx */ + "pushl 0x10(%ecx)\n\t" /* SegDs */ + "movl 0x24(%ecx),%edx\n\t" /* Edx */ + "movl 0x20(%ecx),%ecx\n\t" /* Ecx */ "popl %ds\n\t" "movl %eax,%esp\n\t" "popl %eax\n\t" @@ -1030,19 +1020,30 @@ __ASM_GLOBAL_FUNC( set_full_cpu_context, * is 16 or 32 bit, and 'movl' will throw an exception when we try to * access memory above the limit. */ "1:\n\t" - "movl 0xa8(%ecx),%edx\n\t" /* Edx */ - "movl 0xb0(%ecx),%eax\n\t" /* Eax */ - "movw 0xc8(%ecx),%ss\n\t" /* SegSs */ - "movl 0xc4(%ecx),%esp\n\t" /* Esp */ - "pushl 0xc0(%ecx)\n\t" /* EFlags */ - "pushl 0xbc(%ecx)\n\t" /* SegCs */ - "pushl 0xb8(%ecx)\n\t" /* Eip */ - "pushl 0x98(%ecx)\n\t" /* SegDs */ - "movl 0xac(%ecx),%ecx\n\t" /* Ecx */ + "movl 0x24(%ecx),%edx\n\t" /* Edx */ + "movl 0x18(%ecx),%eax\n\t" /* Eax */ + "movw 0x0e(%ecx),%ss\n\t" /* SegSs */ + "movl 0x08(%ecx),%esp\n\t" /* Esp */ + "pushl 0x00(%ecx)\n\t" /* EFlags */ + "pushl 0x0c(%ecx)\n\t" /* SegCs */ + "pushl 0x04(%ecx)\n\t" /* Eip */ + "pushl 0x10(%ecx)\n\t" /* SegDs */ + "movl 0x20(%ecx),%ecx\n\t" /* Ecx */ "popl %ds\n\t" "iret" ) +/*********************************************************************** + * signal_restore_full_cpu_context + * + * Restore full context from syscall frame + */ +void signal_restore_full_cpu_context(void) +{ + set_full_cpu_context(); +} + + /*********************************************************************** * get_server_context_flags * @@ -1215,6 +1216,7 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from ) NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) { NTSTATUS ret = STATUS_SUCCESS; + struct syscall_frame *frame = x86_thread_data()->syscall_frame; DWORD flags = context->ContextFlags & ~CONTEXT_i386; BOOL self = (handle == GetCurrentThread()); @@ -1244,28 +1246,39 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) } } + if (flags & CONTEXT_INTEGER) + { + frame->eax = context->Eax; + frame->ebx = context->Ebx; + frame->ecx = context->Ecx; + frame->edx = context->Edx; + frame->esi = context->Esi; + frame->edi = context->Edi; + } + if (flags & CONTEXT_CONTROL) + { + frame->esp = context->Esp; + frame->ebp = context->Ebp; + frame->eip = context->Eip; + frame->eflags = context->EFlags; + frame->cs = context->SegCs; + frame->ss = context->SegSs; + } + if (flags & CONTEXT_SEGMENTS) + { + frame->ds = context->SegDs; + frame->es = context->SegEs; + frame->fs = context->SegFs; + frame->gs = context->SegGs; + } if (flags & CONTEXT_EXTENDED_REGISTERS) restore_fpux( context ); else if (flags & CONTEXT_FLOATING_POINT) restore_fpu( context ); restore_xstate( context ); - if (flags & CONTEXT_FULL) - { - if (!(flags & CONTEXT_CONTROL)) - FIXME( "setting partial context (%x) not supported\n", flags ); - else if (flags & CONTEXT_SEGMENTS) - set_full_cpu_context( context ); - else - { - CONTEXT newcontext = *context; - newcontext.SegDs = get_ds(); - newcontext.SegEs = get_ds(); - newcontext.SegFs = get_fs(); - newcontext.SegGs = get_gs(); - set_full_cpu_context( &newcontext ); - } - } - return ret; + if (!(flags & CONTEXT_INTEGER)) frame->eax = STATUS_SUCCESS; + signal_restore_full_cpu_context(); + return STATUS_SUCCESS; }
1
0
0
0
Jacek Caban : ntdll: Store all non-volatile i386 registers in syscall dispatcher.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: b04f2689a2b87c657781c0b6ddad16c73348ddb1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b04f2689a2b87c657781c0b6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Feb 25 18:53:56 2021 +0100 ntdll: Store all non-volatile i386 registers in syscall dispatcher. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/signal_i386.c | 29 ++++++++++++++--------------- tools/winebuild/import.c | 13 ++++++++++++- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 6c46c615f56..be3f1060e4a 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -479,10 +479,10 @@ struct syscall_frame DWORD edi; /* 28 */ DWORD esi; /* 2c */ DWORD ebp; /* 30 */ - DWORD thunk_addr; - DWORD ret_addr; }; +C_ASSERT( sizeof(struct syscall_frame) == 0x34 ); + struct x86_thread_data { DWORD fs; /* 1d4 TEB selector */ @@ -1314,20 +1314,20 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) } if (needed_flags & CONTEXT_CONTROL) { - context->Esp = (DWORD)&frame->ret_addr; + context->Esp = frame->esp; context->Ebp = frame->ebp; - context->Eip = frame->thunk_addr; - context->EFlags = 0x202; - context->SegCs = get_cs(); - context->SegSs = get_ds(); + context->Eip = frame->eip; + context->EFlags = frame->eflags; + context->SegCs = frame->cs; + context->SegSs = frame->ds; context->ContextFlags |= CONTEXT_CONTROL; } if (needed_flags & CONTEXT_SEGMENTS) { - context->SegDs = get_ds(); - context->SegEs = get_ds(); - context->SegFs = get_fs(); - context->SegGs = get_gs(); + context->SegDs = frame->ds; + context->SegEs = frame->es; + context->SegFs = frame->fs; + context->SegGs = frame->gs; context->ContextFlags |= CONTEXT_SEGMENTS; } if (needed_flags & CONTEXT_FLOATING_POINT) save_fpu( context ); @@ -1732,7 +1732,6 @@ struct apc_stack_layout * WINAPI setup_user_apc_dispatcher_stack( CONTEXT *conte } C_ASSERT( sizeof(struct apc_stack_layout) == 0x2e0 ); -C_ASSERT( offsetof(struct syscall_frame, ret_addr) == 0x38 ); C_ASSERT( offsetof(struct apc_stack_layout, context) == 20 ); /*********************************************************************** @@ -1916,14 +1915,14 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, void *stack_ptr, } else { - TRACE( "returning to user mode ip=%08x ret=%08x\n", frame->ret_addr, rec->ExceptionCode ); + TRACE( "returning to user mode ip=%08x ret=%08x\n", frame->eip, rec->ExceptionCode ); EAX_sig(sigcontext) = rec->ExceptionCode; EBX_sig(sigcontext) = frame->ebx; ESI_sig(sigcontext) = frame->esi; EDI_sig(sigcontext) = frame->edi; EBP_sig(sigcontext) = frame->ebp; - ESP_sig(sigcontext) = (DWORD)&frame->ret_addr; - EIP_sig(sigcontext) = frame->thunk_addr; + ESP_sig(sigcontext) = frame->esp; + EIP_sig(sigcontext) = frame->eip; x86_thread_data()->syscall_frame = NULL; } return TRUE; diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 8620e9be479..720cf0589fd 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1438,13 +1438,24 @@ static void output_syscall_dispatcher( int count, const char *variant ) output_cfi( ".cfi_rel_offset %%ebp,0\n" ); output( "\tmovl %%esp,%%ebp\n" ); output_cfi( ".cfi_def_cfa_register %%ebp\n" ); - output( "\tsubl $0x30,%%esp\n" ); + output( "\tleal -0x2c(%%esp),%%esp\n" ); output( "\tmovl %%ebx,-0x14(%%ebp)\n" ); output_cfi( ".cfi_rel_offset %%ebx,-0x14\n" ); output( "\tmovl %%edi,-0x08(%%ebp)\n" ); output_cfi( ".cfi_rel_offset %%edi,-0x08\n" ); output( "\tmovl %%esi,-0x04(%%ebp)\n" ); output_cfi( ".cfi_rel_offset %%esi,-0x04\n" ); + output( "\tpushfl\n" ); + output( "\tmovw %%gs,-0x1a(%%ebp)\n" ); + output( "\tmovw %%fs,-0x1c(%%ebp)\n" ); + output( "\tmovw %%es,-0x1e(%%ebp)\n" ); + output( "\tmovw %%ds,-0x20(%%ebp)\n" ); + output( "\tmovw %%ss,-0x22(%%ebp)\n" ); + output( "\tmovw %%cs,-0x24(%%ebp)\n" ); + output( "\tleal 8(%%ebp),%%ecx\n" ); + output( "\tmovl %%ecx,-0x28(%%ebp)\n" ); /* frame->esp */ + output( "\tmovl 4(%%ebp),%%ecx\n" ); + output( "\tmovl %%ecx,-0x2c(%%ebp)\n" ); /* frame->eip */ output( "\tmovl %%esp,%%fs:0x1f8\n" ); /* x86_thread_data()->syscall_frame */ output( "\tcmpl $%u,%%eax\n", count ); output( "\tjae 3f\n" );
1
0
0
0
Jacek Caban : ntdll: Reserve space for full i386 context in syscall frame.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: c6d303ca233e45f891ea14234c58e1d1809d4600 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c6d303ca233e45f891ea1423…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Feb 25 18:53:36 2021 +0100 ntdll: Reserve space for full i386 context in syscall frame. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/signal_i386.c | 62 ++++++++++++++++++++++++++----------------- tools/winebuild/import.c | 26 +++++++++--------- 2 files changed, 51 insertions(+), 37 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 6cc80809316..6c46c615f56 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -463,12 +463,24 @@ enum i386_trap_code struct syscall_frame { - DWORD edi; - DWORD esi; - DWORD ebx; - DWORD ebp; - DWORD thunk_addr; - DWORD ret_addr; + DWORD eflags; /* 00 */ + DWORD eip; /* 04 */ + DWORD esp; /* 08 */ + WORD cs; /* 0c */ + WORD ss; /* 0e */ + WORD ds; /* 10 */ + WORD es; /* 12 */ + WORD fs; /* 14 */ + WORD gs; /* 16 */ + DWORD eax; /* 18 */ + DWORD ebx; /* 1c */ + DWORD ecx; /* 20 */ + DWORD edx; /* 24 */ + DWORD edi; /* 28 */ + DWORD esi; /* 2c */ + DWORD ebp; /* 30 */ + DWORD thunk_addr; + DWORD ret_addr; }; struct x86_thread_data @@ -1292,10 +1304,10 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) { if (needed_flags & CONTEXT_INTEGER) { - context->Eax = 0; + context->Eax = frame->eax; context->Ebx = frame->ebx; - context->Ecx = 0; - context->Edx = 0; + context->Ecx = frame->ecx; + context->Edx = frame->edx; context->Esi = frame->esi; context->Edi = frame->edi; context->ContextFlags |= CONTEXT_INTEGER; @@ -1720,7 +1732,7 @@ struct apc_stack_layout * WINAPI setup_user_apc_dispatcher_stack( CONTEXT *conte } C_ASSERT( sizeof(struct apc_stack_layout) == 0x2e0 ); -C_ASSERT( offsetof(struct syscall_frame, ret_addr) == 0x14 ); +C_ASSERT( offsetof(struct syscall_frame, ret_addr) == 0x38 ); C_ASSERT( offsetof(struct apc_stack_layout, context) == 20 ); /*********************************************************************** @@ -1735,7 +1747,7 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher, "movl 0xc4(%esi),%eax\n\t" /* context_ptr->Esp */ "jmp 2f\n\t" "1:\tmovl %fs:0x1f8,%eax\n\t" /* x86_thread_data()->syscall_frame */ - "leal 0x14(%eax),%eax\n\t" /* &x86_thread_data()->syscall_frame->ret_addr */ + "leal 0x38(%eax),%eax\n\t" /* &x86_thread_data()->syscall_frame->ret_addr */ "2:\tsubl $0x2e0,%eax\n\t" /* sizeof(struct apc_stack_layout) */ "movl %ebp,%esp\n\t" /* pop return address */ "cmpl %esp,%eax\n\t" @@ -1759,14 +1771,14 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher, * call_raise_user_exception_dispatcher */ __ASM_GLOBAL_FUNC( call_raise_user_exception_dispatcher, - "movl %fs:0x1f8,%eax\n\t" /* x86_thread_data()->syscall_frame */ - "movl 0(%eax),%edi\n\t" /* frame->edi */ - "movl 4(%eax),%esi\n\t" /* frame->esi */ - "movl 8(%eax),%ebx\n\t" /* frame->ebx */ - "movl 12(%eax),%ebp\n\t" /* frame->ebp */ - "movl 4(%esp),%edx\n\t" /* dispatcher */ + "movl %fs:0x1f8,%eax\n\t" /* x86_thread_data()->syscall_frame */ + "movl 0x1c(%eax),%ebx\n\t" /* frame->ebx */ + "movl 0x28(%eax),%edi\n\t" /* frame->edi */ + "movl 0x2c(%eax),%esi\n\t" /* frame->esi */ + "movl 0x30(%eax),%ebp\n\t" /* frame->ebp */ + "movl 4(%esp),%edx\n\t" /* dispatcher */ "movl $0,%fs:0x1f8\n\t" - "leal 20(%eax),%esp\n\t" + "leal 0x38(%eax),%esp\n\t" "jmp *%edx" ) @@ -1780,15 +1792,15 @@ __ASM_GLOBAL_FUNC( call_user_exception_dispatcher, "jne 1f\n\t" "decl 0xb8(%ecx)\n" /* context->Eip */ "1:\tmovl %fs:0x1f8,%eax\n\t" /* x86_thread_data()->syscall_frame */ - "movl 0(%eax),%edi\n\t" /* frame->edi */ - "movl 4(%eax),%esi\n\t" /* frame->esi */ - "movl 8(%eax),%ebx\n\t" /* frame->ebx */ - "movl 12(%eax),%ebp\n\t" /* frame->ebp */ - "movl %edx,12(%eax)\n\t" - "movl %ecx,16(%eax)\n\t" + "movl 0x1c(%eax),%ebx\n\t" /* frame->ebx */ + "movl 0x28(%eax),%edi\n\t" /* frame->edi */ + "movl 0x2c(%eax),%esi\n\t" /* frame->esi */ + "movl 0x30(%eax),%ebp\n\t" /* frame->ebp */ + "movl %edx,0x30(%eax)\n\t" + "movl %ecx,0x34(%eax)\n\t" "movl 12(%esp),%edx\n\t" /* dispatcher */ "movl $0,%fs:0x1f8\n\t" - "leal 12(%eax),%esp\n\t" + "leal 0x30(%eax),%esp\n\t" "jmp *%edx" ) /********************************************************************** diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 57b79ff187d..8620e9be479 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1438,12 +1438,13 @@ static void output_syscall_dispatcher( int count, const char *variant ) output_cfi( ".cfi_rel_offset %%ebp,0\n" ); output( "\tmovl %%esp,%%ebp\n" ); output_cfi( ".cfi_def_cfa_register %%ebp\n" ); - output( "\tpushl %%ebx\n" ); - output_cfi( ".cfi_rel_offset %%ebx,-4\n" ); - output( "\tpushl %%esi\n" ); - output_cfi( ".cfi_rel_offset %%esi,-8\n" ); - output( "\tpushl %%edi\n" ); - output_cfi( ".cfi_rel_offset %%edi,-12\n" ); + output( "\tsubl $0x30,%%esp\n" ); + output( "\tmovl %%ebx,-0x14(%%ebp)\n" ); + output_cfi( ".cfi_rel_offset %%ebx,-0x14\n" ); + output( "\tmovl %%edi,-0x08(%%ebp)\n" ); + output_cfi( ".cfi_rel_offset %%edi,-0x08\n" ); + output( "\tmovl %%esi,-0x04(%%ebp)\n" ); + output_cfi( ".cfi_rel_offset %%esi,-0x04\n" ); output( "\tmovl %%esp,%%fs:0x1f8\n" ); /* x86_thread_data()->syscall_frame */ output( "\tcmpl $%u,%%eax\n", count ); output( "\tjae 3f\n" ); @@ -1466,16 +1467,17 @@ static void output_syscall_dispatcher( int count, const char *variant ) output( "\tcall *.Lsyscall_table-1b(%%eax,%%edx,4)\n" ); else output( "\tcall *.Lsyscall_table(,%%eax,4)\n" ); - output( "\tleal -12(%%ebp),%%esp\n" ); output( "2:\tmovl $0,%%fs:0x1f8\n" ); - output( "\tpopl %%edi\n" ); + output( "\tmovl -0x14(%%ebp),%%ebx\n" ); + output_cfi( ".cfi_same_value %%ebx\n" ); + output( "\tmovl -0x08(%%ebp),%%edi\n" ); output_cfi( ".cfi_same_value %%edi\n" ); - output( "\tpopl %%esi\n" ); + output( "\tmovl -0x04(%%ebp),%%esi\n" ); output_cfi( ".cfi_same_value %%esi\n" ); - output( "\tpopl %%ebx\n" ); - output_cfi( ".cfi_same_value %%ebx\n" ); + output( "\tmovl %%ebp,%%esp\n" ); + output_cfi( ".cfi_def_cfa %%esp,8\n" ); output( "\tpopl %%ebp\n" ); - output_cfi( ".cfi_def_cfa %%esp,4\n" ); + output_cfi( ".cfi_adjust_cfa_offset -4\n" ); output_cfi( ".cfi_same_value %%ebp\n" ); output( "\tret\n" ); output( "3:\tmovl $0x%x,%%eax\n", invalid_param );
1
0
0
0
Piotr Caban : msvcrt: Improve acosf compatibility with native ucrtbase.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: 9c8f8e715f4fd3a35924e4e9d32eb42fa8b56a18 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9c8f8e715f4fd3a35924e4e9…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Feb 25 15:39:23 2021 +0100 msvcrt: Improve acosf compatibility with native ucrtbase. It reduces number of different acosf results from 5678739 to 240905. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 57 ++++++++++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 6abc1893a52..d6b0d9422e7 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -287,28 +287,29 @@ int CDECL _isnanf( float num ) return (u.i & 0x7fffffff) > 0x7f800000; } -/********************************************************************* - * acosf (MSVCRT.@) - * - * Copied from musl: src/math/acosf.c - */ -static float acosf_R(float z) +static float asinf_R(float z) { - static const float pS0 = 1.6666586697e-01, - pS1 = -4.2743422091e-02, - pS2 = -8.6563630030e-03, - qS1 = -7.0662963390e-01; + /* coefficients for R(x^2) */ + static const float p1 = 1.66666672e-01, + p2 = -5.11644611e-02, + p3 = -1.21124933e-02, + p4 = -3.58742251e-03, + q1 = -7.56982703e-01; float p, q; - p = z * (pS0 + z * (pS1 + z * pS2)); - q = 1.0f + z * qS1; + p = z * (p1 + z * (p2 + z * (p3 + z * p4))); + q = 1.0f + z * q1; return p / q; } +/********************************************************************* + * acosf (MSVCRT.@) + * + * Copied from musl: src/math/acosf.c + */ float CDECL acosf( float x ) { - static const float pio2_hi = 1.5707962513e+00, - pio2_lo = 7.5497894159e-08; + static const double pio2_lo = 6.12323399573676603587e-17; float z, w, s, c, df; unsigned int hx, ix; @@ -319,7 +320,7 @@ float CDECL acosf( float x ) if (ix >= 0x3f800000) { if (ix == 0x3f800000) { if (hx >> 31) - return 2 * pio2_lo + 2 * pio2_hi + 7.5231638453e-37; + return M_PI; return 0; } if (isnan(x)) return x; @@ -328,23 +329,22 @@ float CDECL acosf( float x ) /* |x| < 0.5 */ if (ix < 0x3f000000) { if (ix <= 0x32800000) /* |x| < 2**-26 */ - return pio2_lo + pio2_hi + 7.5231638453e-37; - return pio2_hi - (x - (pio2_lo - x * acosf_R(x * x))); + return M_PI_2; + return M_PI_2 - (x - (pio2_lo - x * asinf_R(x * x))); } /* x < -0.5 */ if (hx >> 31) { z = (1 + x) * 0.5f; s = sqrtf(z); - w = acosf_R(z) * s - pio2_lo; - return 2 * (pio2_hi - (s + w)); + return M_PI - 2 * (s + ((double)s * asinf_R(z))); } /* x > 0.5 */ z = (1 - x) * 0.5f; s = sqrtf(z); - hx = *(unsigned int*)&s & 0xfffff000; + hx = *(unsigned int*)&s & 0xffff0000; df = *(float*)&hx; c = (z - df * df) / (s + df); - w = acosf_R(z) * s + c; + w = asinf_R(z) * s + c; return 2 * (df + w); } @@ -353,21 +353,6 @@ float CDECL acosf( float x ) * * Copied from musl: src/math/asinf.c */ -static float asinf_R(float z) -{ - /* coefficients for R(x^2) */ - static const float p1 = 1.66666672e-01, - p2 = -5.11644611e-02, - p3 = -1.21124933e-02, - p4 = -3.58742251e-03, - q1 = -7.56982703e-01; - - float p, q; - p = z * (p1 + z * (p2 + z * (p3 + z * p4))); - q = 1.0f + z * q1; - return p / q; -} - float CDECL asinf( float x ) { static const double pio2 = 1.570796326794896558e+00;
1
0
0
0
Rémi Bernon : widl: Use C++ template implementation for parameterized types.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: 41a3087394b9a367c484b0be7675a42c627082e1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=41a3087394b9a367c484b0be…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Feb 25 14:16:10 2021 +0100 widl: Use C++ template implementation for parameterized types. Based on a patch from Steve Lhomme. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/header.c | 21 ++++++++++++++------- tools/widl/typetree.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- tools/widl/typetree.h | 6 ++++++ tools/widl/widltypes.h | 1 + 4 files changed, 67 insertions(+), 11 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index d81c66a3558..a472af49066 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -1588,10 +1588,12 @@ static void write_forward(FILE *header, type_t *iface) fprintf(header, "#ifdef __cplusplus\n"); if (iface->namespace && !is_global_namespace(iface->namespace)) fprintf(header, "#define %s %s\n", iface->c_name, iface->qualified_name); - write_namespace_start(header, iface->namespace); - if (strchr(iface->name, '<')) write_line(header, 0, "template<> struct %s;", iface->name); - else write_line(header, 0, "interface %s;", iface->name); - write_namespace_end(header, iface->namespace); + if (!iface->impl_name) + { + write_namespace_start(header, iface->namespace); + write_line(header, 0, "interface %s;", iface->name); + write_namespace_end(header, iface->namespace); + } fprintf(header, "#endif /* __cplusplus */\n"); fprintf(header, "#endif\n\n" ); } @@ -1667,7 +1669,12 @@ static void write_com_interface_end(FILE *header, type_t *iface) if (strchr(iface->name, '<')) fprintf(header, "template<> struct "); else fprintf(header, "interface "); } - if (type_iface_get_inherit(iface)) + if (iface->impl_name) + { + fprintf(header, "%s : %s\n", iface->name, iface->impl_name); + write_line(header, 1, "{"); + } + else if (type_iface_get_inherit(iface)) { fprintf(header, "%s : public %s\n", iface->name, type_iface_get_inherit(iface)->name); @@ -1681,9 +1688,9 @@ static void write_com_interface_end(FILE *header, type_t *iface) } /* dispinterfaces don't have real functions, so don't write C++ functions for * them */ - if (!dispinterface) + if (!dispinterface && !iface->impl_name) write_cpp_method_def(header, iface); - if (!type_iface_get_inherit(iface)) + if (!type_iface_get_inherit(iface) && !iface->impl_name) write_line(header, 0, "END_INTERFACE\n"); write_line(header, -1, "};"); if (!is_global_namespace(iface->namespace)) { diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 4a10dd6c4a4..eec98e5c23c 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -52,6 +52,7 @@ type_t *make_type(enum type_type type) t->c_name = NULL; t->signature = NULL; t->qualified_name = NULL; + t->impl_name = NULL; memset(&t->details, 0, sizeof(t->details)); t->typestring_offset = 0; t->ptrdesc = 0; @@ -127,6 +128,13 @@ static size_t append_namespaces(char **buf, size_t *len, size_t pos, struct name return n; } +static size_t append_pointer_stars(char **buf, size_t *len, size_t pos, type_t *type) +{ + size_t n = 0; + for (; type && type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) n += strappend(buf, len, pos + n, "*"); + return n; +} + static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t *type); static size_t append_var_list_signature(char **buf, size_t *len, size_t pos, var_list_t *var_list) @@ -266,9 +274,9 @@ char *format_parameterized_type_name(type_t *type, typeref_list_t *params) pos += strappend(&buf, &len, pos, "%s<", type->name); if (params) LIST_FOR_EACH_ENTRY(ref, params, typeref_t, entry) { - for (type = ref->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {} - pos += append_namespaces(&buf, &len, pos, type->namespace, "", "::", type->name, use_abi_namespace ? "ABI" : NULL); - for (type = ref->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) pos += strappend(&buf, &len, pos, "*"); + type = type_pointer_get_root_type(ref->type); + pos += strappend(&buf, &len, pos, "%s", type->qualified_name); + pos += append_pointer_stars(&buf, &len, pos, ref->type); if (list_next(params, &ref->entry)) pos += strappend(&buf, &len, pos, ","); } pos += strappend(&buf, &len, pos, ">"); @@ -292,7 +300,7 @@ static char *format_parameterized_type_c_name(type_t *type, typeref_list_t *para pos += strappend(&buf, &len, pos, "%s%s_%d", prefix, type->name, count); if (params) LIST_FOR_EACH_ENTRY(ref, params, typeref_t, entry) { - for (type = ref->type; type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {} + type = type_pointer_get_root_type(ref->type); pos += append_namespaces(&buf, &len, pos, type->namespace, "_", "__C", type->name, NULL); } @@ -334,6 +342,38 @@ static char *format_parameterized_type_signature(type_t *type, typeref_list_t *p return buf; } +static char *format_parameterized_type_impl_name(type_t *type, typeref_list_t *params, const char *prefix) +{ + size_t len = 0, pos = 0; + char *buf = NULL; + typeref_t *ref; + type_t *iface; + + pos += strappend(&buf, &len, pos, "%s%s_impl<", prefix, type->name); + if (params) LIST_FOR_EACH_ENTRY(ref, params, typeref_t, entry) + { + type = type_pointer_get_root_type(ref->type); + if (type->type_type == TYPE_RUNTIMECLASS) + { + pos += strappend(&buf, &len, pos, "ABI::Windows::Foundation::Internal::AggregateType<%s", type->qualified_name); + pos += append_pointer_stars(&buf, &len, pos, ref->type); + iface = type_runtimeclass_get_default_iface(type); + pos += strappend(&buf, &len, pos, ", %s", iface->qualified_name); + pos += append_pointer_stars(&buf, &len, pos, ref->type); + pos += strappend(&buf, &len, pos, ">"); + } + else + { + pos += strappend(&buf, &len, pos, "%s", type->qualified_name); + pos += append_pointer_stars(&buf, &len, pos, ref->type); + } + if (list_next(params, &ref->entry)) pos += strappend(&buf, &len, pos, ", "); + } + pos += strappend(&buf, &len, pos, ">"); + + return buf; +} + type_t *type_new_function(var_list_t *args) { var_t *arg; @@ -1226,11 +1266,13 @@ type_t *type_parameterized_type_specialize_define(type_t *type) error_loc("pinterface/pdelegate %s previously not declared a pinterface/pdelegate at %s:%d\n", iface->name, iface->loc_info.input_name, iface->loc_info.line_number); + iface->impl_name = format_parameterized_type_impl_name(type, repl, ""); iface->signature = format_parameterized_type_signature(type, repl); iface->defined = TRUE; if (iface->type_type == TYPE_DELEGATE) { iface = iface->details.delegate.iface; + iface->impl_name = format_parameterized_type_impl_name(type, repl, "I"); iface->signature = format_parameterized_type_signature(type, repl); iface->defined = TRUE; } diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 0b7cd385cc2..b9833dc4e8f 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -411,6 +411,12 @@ static inline type_t *type_pointer_get_ref_type(const type_t *type) return type_pointer_get_ref(type)->type; } +static inline type_t *type_pointer_get_root_type(type_t *type) +{ + for (; type && type->type_type == TYPE_POINTER; type = type_pointer_get_ref_type(type)) {} + return type; +} + static inline type_t *type_bitfield_get_field(const type_t *type) { type = type_get_real_type(type); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 81646cae1d1..d37d732744b 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -504,6 +504,7 @@ struct _type_t { const char *c_name; const char *signature; const char *qualified_name; + const char *impl_name; unsigned int typestring_offset; unsigned int ptrdesc; /* used for complex structs */ int typelib_idx;
1
0
0
0
Rémi Bernon : widl: Write C++ template implementations for parameterized types.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: 3556ecd5d7db97984f340d59769bca0f23232f2f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3556ecd5d7db97984f340d59…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Feb 25 14:16:02 2021 +0100 widl: Write C++ template implementations for parameterized types. Based on a patch from Steve Lhomme. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/header.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++--- tools/widl/typetree.h | 8 ++++++ 2 files changed, 80 insertions(+), 3 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index 8f8c66b2443..d81c66a3558 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -341,6 +341,7 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i { type_t *t = ds->type; const char *name; + char *args; if (!h) return; @@ -507,9 +508,19 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i else write_type_left(h, ds, name_type, declonly, write_callconv); break; } - case TYPE_APICONTRACT: case TYPE_PARAMETERIZED_TYPE: + { + type_t *iface = type_parameterized_type_get_real_type(t); + if (type_get_type(iface) == TYPE_DELEGATE) iface = type_delegate_get_iface(iface); + args = format_parameterized_type_args(t, "", "_logical"); + fprintf(h, "%s<%s>", iface->name, args); + free(args); + break; + } case TYPE_PARAMETER: + fprintf(h, "%s_abi", t->name); + break; + case TYPE_APICONTRACT: /* shouldn't be here */ assert(0); break; @@ -576,10 +587,10 @@ void write_type_right(FILE *h, type_t *t, int is_field) case TYPE_INTERFACE: case TYPE_RUNTIMECLASS: case TYPE_DELEGATE: - break; - case TYPE_APICONTRACT: case TYPE_PARAMETERIZED_TYPE: case TYPE_PARAMETER: + break; + case TYPE_APICONTRACT: /* not supposed to be here */ assert(0); break; @@ -1517,6 +1528,58 @@ static void write_parameterized_type_forward(FILE *header, type_t *type) fprintf(header, "#endif\n\n" ); } +static void write_parameterized_implementation(FILE *header, type_t *type, int declonly) +{ + const statement_t *stmt; + typeref_list_t *params = params = type->details.parameterized.params; + typeref_t *ref; + type_t *iface = type->details.parameterized.type, *base; + char *args = NULL; + + fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n"); + write_line(header, 0, "} /* extern \"C\" */"); + write_namespace_start(header, type->namespace); + + if (type_get_type(iface) == TYPE_DELEGATE) iface = type_delegate_get_iface(iface); + base = type_iface_get_inherit(iface); + + args = format_parameterized_type_args(type, "class ", ""); + write_line(header, 0, "template <%s>", args); + free(args); + write_line(header, 0, "struct %s_impl%s", iface->name, base ? strmake(" : %s", base->name) : ""); + write_line(header, 0, "{"); + + write_line(header, 1, "private:"); + if (params) LIST_FOR_EACH_ENTRY(ref, params, typeref_t, entry) + { + write_line(header, 0, "typedef typename Windows::Foundation::Internal::GetAbiType<%s>::type %s_abi;", ref->type->name, ref->type->name); + write_line(header, 0, "typedef typename Windows::Foundation::Internal::GetLogicalType<%s>::type %s_logical;", ref->type->name, ref->type->name); + } + indentation -= 1; + + write_line(header, 1, "public:"); + if (params) LIST_FOR_EACH_ENTRY(ref, params, typeref_t, entry) + write_line(header, 0, "typedef %s %s_complex;", ref->type->name, ref->type->name); + + STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) + { + const var_t *func = stmt->u.var; + if (is_callas(func->attrs)) continue; + indent(header, 1); + fprintf(header, "virtual "); + write_type_decl_left(header, &func->declspec); + fprintf(header, "%s(", get_name(func)); + write_args(header, type_function_get_args(func->declspec.type), NULL, 0, 0, NAME_DEFAULT); + fprintf(header, ") = 0;\n"); + indentation -= 1; + } + write_line(header, -1, "};"); + + write_namespace_end(header, type->namespace); + write_line(header, 0, "extern \"C\" {"); + write_line(header, 0, "#endif\n"); +} + static void write_forward(FILE *header, type_t *iface) { fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->c_name); @@ -1924,6 +1987,12 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons write_runtimeclass(header, stmt->u.type); else if (type_get_type(stmt->u.type) != TYPE_PARAMETERIZED_TYPE) write_type_definition(header, stmt->u.type, stmt->declonly); + else + { + is_object_interface++; + write_parameterized_implementation(header, stmt->u.type, stmt->declonly); + is_object_interface--; + } break; case STMT_TYPEREF: /* FIXME: shouldn't write out forward declarations for undefined diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 805e96a9305..0b7cd385cc2 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -96,6 +96,14 @@ static inline type_t *type_get_real_type(const type_t *type) return (type_t *)type; } +static inline type_t *type_parameterized_type_get_real_type(const type_t *type) +{ + if (type->type_type == TYPE_PARAMETERIZED_TYPE) + return type_parameterized_type_get_real_type(type->details.parameterized.type); + else + return (type_t *)type; +} + static inline enum type_type type_get_type(const type_t *type) { return type_get_type_detect_alias(type_get_real_type(type));
1
0
0
0
Rémi Bernon : widl: Write C++ template declarations for parameterized types.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: ea9d98082aab5f50bf0203e36d0541da738bfdd4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ea9d98082aab5f50bf0203e3…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Feb 25 14:15:09 2021 +0100 widl: Write C++ template declarations for parameterized types. Based on a patch from Steve Lhomme. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/header.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ tools/widl/typetree.c | 5 +++++ 2 files changed, 50 insertions(+) diff --git a/tools/widl/header.c b/tools/widl/header.c index 82aad0f11ca..8f8c66b2443 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -123,6 +123,25 @@ unsigned int get_attrv(const attr_list_t *list, enum attr_type t) return 0; } +static char *format_parameterized_type_args(const type_t *type, const char *prefix, const char *suffix) +{ + typeref_list_t *params; + typeref_t *ref; + size_t len = 0, pos = 0; + char *buf = NULL; + + params = type->details.parameterized.params; + if (params) LIST_FOR_EACH_ENTRY(ref, params, typeref_t, entry) + { + assert(ref->type->type_type != TYPE_POINTER); + pos += strappend(&buf, &len, pos, "%s%s%s", prefix, ref->type->name, suffix); + if (list_next(params, &ref->entry)) pos += strappend(&buf, &len, pos, ", "); + } + + if (!buf) return xstrdup(""); + return buf; +} + static void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid) { if (!uuid) return; @@ -1474,6 +1493,30 @@ static void write_function_proto(FILE *header, const type_t *iface, const var_t fprintf(header, ");\n\n"); } +static void write_parameterized_type_forward(FILE *header, type_t *type) +{ + type_t *iface = type->details.parameterized.type; + char *args; + + if (type_get_type(iface) == TYPE_DELEGATE) iface = type_delegate_get_iface(iface); + + fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n"); + write_namespace_start(header, type->namespace); + + args = format_parameterized_type_args(type, "class ", ""); + write_line(header, 0, "template <%s>", args); + write_line(header, 0, "struct %s_impl;\n", iface->name); + + write_line(header, 0, "template <%s>", args); + free(args); + args = format_parameterized_type_args(type, "", ""); + write_line(header, 0, "struct %s : %s_impl<%s> {};", iface->name, iface->name, args); + free(args); + + write_namespace_end(header, type->namespace); + fprintf(header, "#endif\n\n" ); +} + static void write_forward(FILE *header, type_t *iface) { fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->c_name); @@ -1818,6 +1861,8 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts) write_coclass_forward(header, stmt->u.type); else if (type_get_type(stmt->u.type) == TYPE_RUNTIMECLASS) write_runtimeclass_forward(header, stmt->u.type); + else if (type_get_type(stmt->u.type) == TYPE_PARAMETERIZED_TYPE) + write_parameterized_type_forward(header, stmt->u.type); break; case STMT_TYPEREF: case STMT_IMPORTLIB: diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 319dd4ae65a..4a10dd6c4a4 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -912,6 +912,8 @@ type_t *type_parameterized_interface_define(type_t *type, attr_list_t *attrs, ty iface->details.iface->async_iface = NULL; iface->details.iface->requires = requires; + iface->name = type->name; + type->defined = TRUE; return type; } @@ -952,6 +954,9 @@ type_t *type_parameterized_delegate_define(type_t *type, attr_list_t *attrs, sta iface->details.iface->async_iface = NULL; iface->details.iface->requires = NULL; + delegate->name = type->name; + compute_delegate_iface_names(delegate, type, type->details.parameterized.params); + type->defined = TRUE; return type; }
1
0
0
0
Rémi Bernon : include: Add AggregateType / GetAbiType / GetLogicalType WinRT templates.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: 2e262c59dfbd379232f9af93d5b1e79f3cf16b05 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2e262c59dfbd379232f9af93…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Feb 25 14:14:23 2021 +0100 include: Add AggregateType / GetAbiType / GetLogicalType WinRT templates. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/windows.foundation.collections.idl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/windows.foundation.collections.idl b/include/windows.foundation.collections.idl index 9f7a59ab907..cf47adfa7e4 100644 --- a/include/windows.foundation.collections.idl +++ b/include/windows.foundation.collections.idl @@ -27,6 +27,19 @@ import "windowscontracts.idl"; namespace Windows { namespace Foundation { + +cpp_quote("#ifdef __cplusplus") +cpp_quote("} /* extern \"C\" */") +cpp_quote("namespace ABI { namespace Windows { namespace Foundation { namespace Internal {") +cpp_quote("template <class T> struct GetAbiType { typedef T type; };") +cpp_quote("template <class T> struct GetLogicalType { typedef T type; };") +cpp_quote("template <class L, class A> struct AggregateType {};") +cpp_quote("template <class L, class A> struct GetAbiType<AggregateType<L, A>> { typedef A type; };") +cpp_quote("template <class L, class A> struct GetLogicalType<AggregateType<L, A>> { typedef L type; };") +cpp_quote("}}}}") +cpp_quote("extern \"C\" {") +cpp_quote("#endif") + #ifdef __WIDL__ [ contract(Windows.Foundation.FoundationContract, 1.0),
1
0
0
0
Rémi Bernon : include: Split Windows.Foundation.Collections parameterized types.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: e680cc53e004627cd4e0df6dc10b9ee226112e32 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e680cc53e004627cd4e0df6d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Feb 25 14:14:18 2021 +0100 include: Split Windows.Foundation.Collections parameterized types. To windows.foundation.collections.idl. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/Makefile.in | 1 + include/windows.foundation.collections.idl | 74 ++++++++++++++++++++++++++++++ include/windows.foundation.idl | 45 +----------------- 3 files changed, 76 insertions(+), 44 deletions(-) diff --git a/include/Makefile.in b/include/Makefile.in index c1efee700fa..6c16e01a271 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -746,6 +746,7 @@ SOURCES = \ wincrypt.h \ windef.h \ windns.h \ + windows.foundation.collections.idl \ windows.foundation.idl \ windows.h \ windows.media.speechsynthesis.idl \ diff --git a/include/windows.foundation.collections.idl b/include/windows.foundation.collections.idl new file mode 100644 index 00000000000..9f7a59ab907 --- /dev/null +++ b/include/windows.foundation.collections.idl @@ -0,0 +1,74 @@ +/* + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * 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 + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +/* import "asyncinfo.idl"; */ +import "windowscontracts.idl"; +/* import "eventtoken.idl"; */ + +namespace Windows { + namespace Foundation { +#ifdef __WIDL__ + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(9de1c535-6ae1-11e0-84e1-18a905bcc53f) + ] + delegate HRESULT EventHandler<T>([in] IInspectable *sender, [in] T args); + + namespace Collections + { + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(6a79e863-4300-459a-9966-cbb660963ee1) + ] + interface IIterator<T> : IInspectable + { + [propget] HRESULT Current([out, retval] T *value); + [propget] HRESULT HasCurrent([out, retval] BOOL *value); + HRESULT MoveNext([out, retval] BOOL *value); + HRESULT GetMany([in] UINT32 count, [out] T *items, [out, retval] UINT32 *value); + } + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(faa585ea-6214-4217-afda-7f46de5869b3) + ] + interface IIterable<T> : IInspectable + { + HRESULT First([out, retval] Windows.Foundation.Collections.IIterator<T> **value); + } + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(bbe1fa4c-b0e3-4583-baef-1f1b2e483e56) + ] + interface IVectorView<T> : IInspectable + { + HRESULT GetAt([in] ULONG index, [out, retval] T *value); + [propget] HRESULT Size([out, retval] ULONG *value); + HRESULT IndexOf([in, optional] T element, [out] ULONG *index, [out, retval] BOOLEAN *value); + HRESULT GetMany([in] ULONG start_index, [out] T *items, [out, retval] ULONG *value); + } + } +#endif + } +} diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl index bb0fafcab77..3c60278cf05 100644 --- a/include/windows.foundation.idl +++ b/include/windows.foundation.idl @@ -25,6 +25,7 @@ import "inspectable.idl"; import "windowscontracts.idl"; /* import "eventtoken.idl"; */ /* import "ivectorchangedeventargs.idl"; */ +import "windows.foundation.collections.idl"; namespace Windows { namespace Foundation { @@ -111,49 +112,5 @@ namespace Windows { { HRESULT ToString([out, retval] HSTRING *value); } - -#ifdef __WIDL__ - [ - contract(Windows.Foundation.FoundationContract, 1.0), - uuid(9de1c535-6ae1-11e0-84e1-18a905bcc53f) - ] - delegate HRESULT EventHandler<T>([in] IInspectable *sender, [in] T args); - - namespace Collections - { - [ - contract(Windows.Foundation.FoundationContract, 1.0), - uuid(6a79e863-4300-459a-9966-cbb660963ee1) - ] - interface IIterator<T> : IInspectable - { - [propget] HRESULT Current([out, retval] T *value); - [propget] HRESULT HasCurrent([out, retval] BOOL *value); - HRESULT MoveNext([out, retval] BOOL *value); - HRESULT GetMany([in] UINT32 count, [out] T *items, [out, retval] UINT32 *value); - } - - [ - contract(Windows.Foundation.FoundationContract, 1.0), - uuid(faa585ea-6214-4217-afda-7f46de5869b3) - ] - interface IIterable<T> : IInspectable - { - HRESULT First([out, retval] Windows.Foundation.Collections.IIterator<T> **value); - } - - [ - contract(Windows.Foundation.FoundationContract, 1.0), - uuid(bbe1fa4c-b0e3-4583-baef-1f1b2e483e56) - ] - interface IVectorView<T> : IInspectable - { - HRESULT GetAt([in] ULONG index, [out, retval] T *value); - [propget] HRESULT Size([out, retval] ULONG *value); - HRESULT IndexOf([in, optional] T element, [out] ULONG *index, [out, retval] BOOLEAN *value); - HRESULT GetMany([in] ULONG start_index, [out] T *items, [out, retval] ULONG *value); - } - } -#endif } }
1
0
0
0
Alexandre Julliard : ntdll: Fix rounding the length of the runtime info parameter.
by Alexandre Julliard
25 Feb '21
25 Feb '21
Module: wine Branch: master Commit: 4dad4315d52d6125991bdd14d0a6c0ad71e7c24d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4dad4315d52d6125991bdd14…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Feb 25 22:38:44 2021 +0100 ntdll: Fix rounding the length of the runtime info parameter. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50723
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/env.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index c7870c6bb4e..c6037afafbc 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1622,8 +1622,14 @@ void init_startup_info(void) copy_unicode_string( &src, &dst, ¶ms->WindowTitle, info->title_len ); copy_unicode_string( &src, &dst, ¶ms->Desktop, info->desktop_len ); copy_unicode_string( &src, &dst, ¶ms->ShellInfo, info->shellinfo_len ); - copy_unicode_string( &src, &dst, ¶ms->RuntimeInfo, info->runtime_len ); - params->RuntimeInfo.MaximumLength = params->RuntimeInfo.Length; /* runtime info isn't a real string */ + /* runtime info isn't a real string */ + params->RuntimeInfo.MaximumLength = params->RuntimeInfo.Length = info->runtime_len; + params->RuntimeInfo.Buffer = dst; + memcpy( dst, src, info->runtime_len ); + src += (info->runtime_len + 1) / sizeof(WCHAR); + dst += (info->runtime_len + 1) / sizeof(WCHAR); + assert( (char *)src == (char *)info + info_size ); + params->Environment = dst; dst += copy_environment( dst, src ); memcpy( dst, dyn_env, dyn_size );
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
92
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
Results per page:
10
25
50
100
200