winebuild: Store the syscall frame in the thread data on i386.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-28 13:00:50 +02:00
parent 3ba24075f2
commit 8e3b5183cc
2 changed files with 24 additions and 5 deletions

View File

@ -473,6 +473,17 @@ enum i386_trap_code
#endif
};
struct syscall_frame
{
struct syscall_frame *prev_frame;
DWORD edi;
DWORD esi;
DWORD ebx;
DWORD ebp;
DWORD thunk_addr;
DWORD ret_addr;
};
struct x86_thread_data
{
DWORD fs; /* 1d4 TEB selector */
@ -484,12 +495,13 @@ struct x86_thread_data
DWORD dr6; /* 1ec */
DWORD dr7; /* 1f0 */
void *exit_frame; /* 1f4 exit frame pointer */
/* the ntdll_thread_data structure follows here */
struct syscall_frame *syscall_frame; /* 1f8 frame pointer on syscall entry */
};
C_ASSERT( sizeof(struct x86_thread_data) <= sizeof(((struct ntdll_thread_data *)0)->cpu_data) );
C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, gs ) == 0x1d8 );
C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, exit_frame ) == 0x1f4 );
C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, syscall_frame ) == 0x1f8 );
static inline struct x86_thread_data *x86_thread_data(void)
{

View File

@ -1446,10 +1446,14 @@ void output_syscalls( DLLSPEC *spec )
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,-4\n" );
output_cfi( ".cfi_rel_offset %%esi,-8\n" );
output( "\tpushl %%edi\n" );
output_cfi( ".cfi_rel_offset %%edi,-8\n" );
output_cfi( ".cfi_rel_offset %%edi,-12\n" );
output( "\tpushl %%fs:0x1f8\n" ); /* x86_thread_data()->syscall_frame */
output( "\tmovl %%esp,%%fs:0x1f8\n" );
output( "\tcmpl $%u,%%eax\n", count );
output( "\tjae 3f\n" );
if (UsePIC)
@ -1471,11 +1475,14 @@ void output_syscalls( DLLSPEC *spec )
output( "\tcall *.Lsyscall_table-1b(%%eax,%%edx,4)\n" );
else
output( "\tcall *.Lsyscall_table(,%%eax,4)\n" );
output( "\tleal -8(%%ebp),%%esp\n" );
output( "2:\tpopl %%edi\n" );
output( "\tleal -16(%%ebp),%%esp\n" );
output( "2:\tpopl %%fs:0x1f8\n" );
output( "\tpopl %%edi\n" );
output_cfi( ".cfi_same_value %%edi\n" );
output( "\tpopl %%esi\n" );
output_cfi( ".cfi_same_value %%esi\n" );
output( "\tpopl %%ebx\n" );
output_cfi( ".cfi_same_value %%ebx\n" );
output( "\tpopl %%ebp\n" );
output_cfi( ".cfi_def_cfa %%esp,4\n" );
output_cfi( ".cfi_same_value %%ebp\n" );