ntdll: Move the virtual memory functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7c32b2dd93
commit
c96ef78b6d
|
@ -466,7 +466,7 @@ static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status
|
||||||
{
|
{
|
||||||
req->user_arg = wine_server_client_ptr( async );
|
req->user_arg = wine_server_client_ptr( async );
|
||||||
wine_server_set_reply( req, async->buffer, async->size );
|
wine_server_set_reply( req, async->buffer, async->size );
|
||||||
status = virtual_locked_server_call( req );
|
status = unix_funcs->virtual_locked_server_call( req );
|
||||||
information = reply->size;
|
information = reply->size;
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
SERVER_END_REQ;
|
||||||
|
@ -546,7 +546,7 @@ static NTSTATUS FILE_AsyncReadService( void *user, IO_STATUS_BLOCK *iosb, NTSTAT
|
||||||
&needs_close, NULL, NULL )))
|
&needs_close, NULL, NULL )))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
result = virtual_locked_read(fd, &fileio->buffer[fileio->already], fileio->count-fileio->already);
|
result = unix_funcs->virtual_locked_read(fd, &fileio->buffer[fileio->already], fileio->count-fileio->already);
|
||||||
if (needs_close) close( fd );
|
if (needs_close) close( fd );
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
|
@ -605,7 +605,7 @@ static NTSTATUS server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE a
|
||||||
req->async = server_async( handle, &async->io, event, apc, apc_context, io );
|
req->async = server_async( handle, &async->io, event, apc, apc_context, io );
|
||||||
req->pos = offset ? offset->QuadPart : 0;
|
req->pos = offset ? offset->QuadPart : 0;
|
||||||
wine_server_set_reply( req, buffer, size );
|
wine_server_set_reply( req, buffer, size );
|
||||||
status = virtual_locked_server_call( req );
|
status = unix_funcs->virtual_locked_server_call( req );
|
||||||
wait_handle = wine_server_ptr_handle( reply->wait );
|
wait_handle = wine_server_ptr_handle( reply->wait );
|
||||||
options = reply->options;
|
options = reply->options;
|
||||||
if (wait_handle && status != STATUS_PENDING)
|
if (wait_handle && status != STATUS_PENDING)
|
||||||
|
@ -866,7 +866,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
||||||
&needs_close, &type, &options );
|
&needs_close, &type, &options );
|
||||||
if (status && status != STATUS_BAD_DEVICE_TYPE) return status;
|
if (status && status != STATUS_BAD_DEVICE_TYPE) return status;
|
||||||
|
|
||||||
if (!virtual_check_buffer_for_write( buffer, length )) return STATUS_ACCESS_VIOLATION;
|
if (!unix_funcs->virtual_check_buffer_for_write( buffer, length )) return STATUS_ACCESS_VIOLATION;
|
||||||
|
|
||||||
if (status == STATUS_BAD_DEVICE_TYPE)
|
if (status == STATUS_BAD_DEVICE_TYPE)
|
||||||
return server_read_file( hFile, hEvent, apc, apc_user, io_status, buffer, length, offset, key );
|
return server_read_file( hFile, hEvent, apc, apc_user, io_status, buffer, length, offset, key );
|
||||||
|
@ -884,7 +884,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
||||||
if (offset && offset->QuadPart != FILE_USE_FILE_POINTER_POSITION)
|
if (offset && offset->QuadPart != FILE_USE_FILE_POINTER_POSITION)
|
||||||
{
|
{
|
||||||
/* async I/O doesn't make sense on regular files */
|
/* async I/O doesn't make sense on regular files */
|
||||||
while ((result = virtual_locked_pread( unix_handle, buffer, length, offset->QuadPart )) == -1)
|
while ((result = unix_funcs->virtual_locked_pread( unix_handle, buffer, length, offset->QuadPart )) == -1)
|
||||||
{
|
{
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
{
|
{
|
||||||
|
@ -926,7 +926,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if ((result = virtual_locked_read( unix_handle, (char *)buffer + total, length - total )) >= 0)
|
if ((result = unix_funcs->virtual_locked_read( unix_handle, (char *)buffer + total, length - total )) >= 0)
|
||||||
{
|
{
|
||||||
total += result;
|
total += result;
|
||||||
if (!result || total == length)
|
if (!result || total == length)
|
||||||
|
@ -1243,7 +1243,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
|
||||||
|
|
||||||
async_write = !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT));
|
async_write = !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT));
|
||||||
|
|
||||||
if (!virtual_check_buffer_for_read( buffer, length ))
|
if (!unix_funcs->virtual_check_buffer_for_read( buffer, length ))
|
||||||
{
|
{
|
||||||
status = STATUS_INVALID_USER_BUFFER;
|
status = STATUS_INVALID_USER_BUFFER;
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1553,7 +1553,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
|
||||||
if ((code & 3) != METHOD_BUFFERED)
|
if ((code & 3) != METHOD_BUFFERED)
|
||||||
wine_server_add_data( req, out_buffer, out_size );
|
wine_server_add_data( req, out_buffer, out_size );
|
||||||
wine_server_set_reply( req, out_buffer, out_size );
|
wine_server_set_reply( req, out_buffer, out_size );
|
||||||
status = virtual_locked_server_call( req );
|
status = unix_funcs->virtual_locked_server_call( req );
|
||||||
wait_handle = wine_server_ptr_handle( reply->wait );
|
wait_handle = wine_server_ptr_handle( reply->wait );
|
||||||
options = reply->options;
|
options = reply->options;
|
||||||
if (wait_handle && status != STATUS_PENDING)
|
if (wait_handle && status != STATUS_PENDING)
|
||||||
|
@ -3575,7 +3575,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
|
||||||
enum server_fd_type type;
|
enum server_fd_type type;
|
||||||
int fd, needs_close;
|
int fd, needs_close;
|
||||||
|
|
||||||
if (!io || !virtual_check_buffer_for_write( io, sizeof(*io) )) return STATUS_ACCESS_VIOLATION;
|
if (!io || !unix_funcs->virtual_check_buffer_for_write( io, sizeof(*io) )) return STATUS_ACCESS_VIOLATION;
|
||||||
|
|
||||||
ret = unix_funcs->server_get_unix_fd( hFile, FILE_WRITE_DATA, &fd, &needs_close, &type, NULL );
|
ret = unix_funcs->server_get_unix_fd( hFile, FILE_WRITE_DATA, &fd, &needs_close, &type, NULL );
|
||||||
if (ret == STATUS_ACCESS_DENIED)
|
if (ret == STATUS_ACCESS_DENIED)
|
||||||
|
|
|
@ -1874,7 +1874,7 @@ static NTSTATUS build_so_dll_module( const WCHAR *load_path, const UNICODE_STRIN
|
||||||
|
|
||||||
if (!(wm = alloc_module( module, nt_name, TRUE ))) return STATUS_NO_MEMORY;
|
if (!(wm = alloc_module( module, nt_name, TRUE ))) return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
virtual_create_builtin_view( module );
|
unix_funcs->virtual_create_builtin_view( module );
|
||||||
|
|
||||||
if (!(flags & DONT_RESOLVE_DLL_REFERENCES) &&
|
if (!(flags & DONT_RESOLVE_DLL_REFERENCES) &&
|
||||||
((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) ||
|
((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) ||
|
||||||
|
@ -2368,8 +2368,8 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm,
|
||||||
NtUnmapViewOfSection( NtCurrentProcess(), *module );
|
NtUnmapViewOfSection( NtCurrentProcess(), *module );
|
||||||
*module = NULL;
|
*module = NULL;
|
||||||
}
|
}
|
||||||
status = virtual_map_section( mapping, module, 0, 0, NULL, &len,
|
status = unix_funcs->virtual_map_section( mapping, module, 0, 0, NULL, &len,
|
||||||
0, PAGE_EXECUTE_READ, image_info );
|
0, PAGE_EXECUTE_READ, image_info );
|
||||||
if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS;
|
if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS;
|
||||||
NtClose( mapping );
|
NtClose( mapping );
|
||||||
}
|
}
|
||||||
|
@ -3885,7 +3885,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attach_implicitly_loaded_dlls( context );
|
attach_implicitly_loaded_dlls( context );
|
||||||
virtual_release_address_space();
|
unix_funcs->virtual_release_address_space();
|
||||||
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH );
|
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_PROCESS_ATTACH );
|
||||||
if (wm->so_handle) call_constructors( wm );
|
if (wm->so_handle) call_constructors( wm );
|
||||||
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
|
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
|
||||||
|
@ -4464,7 +4464,7 @@ void __wine_process_init(void)
|
||||||
NtTerminateProcess( GetCurrentProcess(), status );
|
NtTerminateProcess( GetCurrentProcess(), status );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual_set_large_address_space();
|
unix_funcs->virtual_set_large_address_space();
|
||||||
|
|
||||||
/* the main exe needs to be the first in the load order list */
|
/* the main exe needs to be the first in the load order list */
|
||||||
RemoveEntryList( &wm->ldr.InLoadOrderLinks );
|
RemoveEntryList( &wm->ldr.InLoadOrderLinks );
|
||||||
|
@ -4472,7 +4472,7 @@ void __wine_process_init(void)
|
||||||
RemoveEntryList( &wm->ldr.InMemoryOrderLinks );
|
RemoveEntryList( &wm->ldr.InMemoryOrderLinks );
|
||||||
InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderLinks );
|
InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderLinks );
|
||||||
|
|
||||||
virtual_alloc_thread_stack( &stack, 0, 0, NULL );
|
unix_funcs->virtual_alloc_thread_stack( &stack, 0, 0, NULL );
|
||||||
teb->Tib.StackBase = stack.StackBase;
|
teb->Tib.StackBase = stack.StackBase;
|
||||||
teb->Tib.StackLimit = stack.StackLimit;
|
teb->Tib.StackLimit = stack.StackLimit;
|
||||||
teb->DeallocationStack = stack.DeallocationStack;
|
teb->DeallocationStack = stack.DeallocationStack;
|
||||||
|
|
|
@ -2566,7 +2566,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
|
||||||
{
|
{
|
||||||
SYSTEM_BASIC_INFORMATION sbi;
|
SYSTEM_BASIC_INFORMATION sbi;
|
||||||
|
|
||||||
virtual_get_system_info( &sbi );
|
unix_funcs->virtual_get_system_info( &sbi );
|
||||||
len = sizeof(sbi);
|
len = sizeof(sbi);
|
||||||
|
|
||||||
if ( Length == len)
|
if ( Length == len)
|
||||||
|
|
|
@ -359,7 +359,7 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
if (rec->NumberParameters == 2)
|
if (rec->NumberParameters == 2)
|
||||||
{
|
{
|
||||||
if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1],
|
if (!(rec->ExceptionCode = unix_funcs->virtual_handle_fault( (void *)rec->ExceptionInformation[1],
|
||||||
rec->ExceptionInformation[0], FALSE )))
|
rec->ExceptionInformation[0], FALSE )))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
|
||||||
/* check for page fault inside the thread stack */
|
/* check for page fault inside the thread stack */
|
||||||
if (get_trap_code(signal, context) == TRAP_ARM_PAGEFLT)
|
if (get_trap_code(signal, context) == TRAP_ARM_PAGEFLT)
|
||||||
{
|
{
|
||||||
switch (virtual_handle_stack_fault( info->si_addr ))
|
switch (unix_funcs->virtual_handle_stack_fault( info->si_addr ))
|
||||||
{
|
{
|
||||||
case 1: /* handled */
|
case 1: /* handled */
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -898,7 +898,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
|
||||||
/* check for page fault inside the thread stack */
|
/* check for page fault inside the thread stack */
|
||||||
if (signal == SIGSEGV)
|
if (signal == SIGSEGV)
|
||||||
{
|
{
|
||||||
switch (virtual_handle_stack_fault( info->si_addr ))
|
switch (unix_funcs->virtual_handle_stack_fault( info->si_addr ))
|
||||||
{
|
{
|
||||||
case 1: /* handled */
|
case 1: /* handled */
|
||||||
return;
|
return;
|
||||||
|
@ -921,7 +921,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
|
||||||
stack->rec.NumberParameters = 2;
|
stack->rec.NumberParameters = 2;
|
||||||
stack->rec.ExceptionInformation[0] = (get_fault_esr( context ) & 0x40) != 0;
|
stack->rec.ExceptionInformation[0] = (get_fault_esr( context ) & 0x40) != 0;
|
||||||
stack->rec.ExceptionInformation[1] = (ULONG_PTR)info->si_addr;
|
stack->rec.ExceptionInformation[1] = (ULONG_PTR)info->si_addr;
|
||||||
if (!(stack->rec.ExceptionCode = virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1],
|
if (!(stack->rec.ExceptionCode = unix_funcs->virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1],
|
||||||
stack->rec.ExceptionInformation[0], FALSE )))
|
stack->rec.ExceptionInformation[0], FALSE )))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1312,7 +1312,7 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
|
||||||
unsigned int i, len, prefix_count = 0;
|
unsigned int i, len, prefix_count = 0;
|
||||||
|
|
||||||
if (!ldt_is_system( context->SegCs )) return 0;
|
if (!ldt_is_system( context->SegCs )) return 0;
|
||||||
len = virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) );
|
len = unix_funcs->virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) );
|
||||||
|
|
||||||
for (i = 0; i < len; i++) switch (instr[i])
|
for (i = 0; i < len; i++) switch (instr[i])
|
||||||
{
|
{
|
||||||
|
@ -1380,7 +1380,7 @@ static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context )
|
||||||
if (context->SegGs == system_gs) return FALSE;
|
if (context->SegGs == system_gs) return FALSE;
|
||||||
if (!ldt_is_system( context->SegCs )) return FALSE;
|
if (!ldt_is_system( context->SegCs )) return FALSE;
|
||||||
/* only handle faults in system libraries */
|
/* only handle faults in system libraries */
|
||||||
if (virtual_is_valid_code_address( instr, 1 )) return FALSE;
|
if (unix_funcs->virtual_is_valid_code_address( instr, 1 )) return FALSE;
|
||||||
|
|
||||||
for (;;) switch(*instr)
|
for (;;) switch(*instr)
|
||||||
{
|
{
|
||||||
|
@ -1465,13 +1465,13 @@ static BOOL check_atl_thunk( ucontext_t *sigcontext, struct stack_layout *stack
|
||||||
union atl_thunk thunk_copy;
|
union atl_thunk thunk_copy;
|
||||||
SIZE_T thunk_len;
|
SIZE_T thunk_len;
|
||||||
|
|
||||||
thunk_len = virtual_uninterrupted_read_memory( thunk, &thunk_copy, sizeof(*thunk) );
|
thunk_len = unix_funcs->virtual_uninterrupted_read_memory( thunk, &thunk_copy, sizeof(*thunk) );
|
||||||
if (!thunk_len) return FALSE;
|
if (!thunk_len) return FALSE;
|
||||||
|
|
||||||
if (thunk_len >= sizeof(thunk_copy.t1) && thunk_copy.t1.movl == 0x042444c7 &&
|
if (thunk_len >= sizeof(thunk_copy.t1) && thunk_copy.t1.movl == 0x042444c7 &&
|
||||||
thunk_copy.t1.jmp == 0xe9)
|
thunk_copy.t1.jmp == 0xe9)
|
||||||
{
|
{
|
||||||
if (!virtual_uninterrupted_write_memory( (DWORD *)stack->context.Esp + 1,
|
if (!unix_funcs->virtual_uninterrupted_write_memory( (DWORD *)stack->context.Esp + 1,
|
||||||
&thunk_copy.t1.this, sizeof(DWORD) ))
|
&thunk_copy.t1.this, sizeof(DWORD) ))
|
||||||
{
|
{
|
||||||
EIP_sig(sigcontext) = (DWORD_PTR)(&thunk->t1.func + 1) + thunk_copy.t1.func;
|
EIP_sig(sigcontext) = (DWORD_PTR)(&thunk->t1.func + 1) + thunk_copy.t1.func;
|
||||||
|
@ -1515,9 +1515,9 @@ static BOOL check_atl_thunk( ucontext_t *sigcontext, struct stack_layout *stack
|
||||||
thunk_copy.t5.inst2 == 0x0460)
|
thunk_copy.t5.inst2 == 0x0460)
|
||||||
{
|
{
|
||||||
DWORD func, sp[2];
|
DWORD func, sp[2];
|
||||||
if (virtual_uninterrupted_read_memory( (DWORD *)stack->context.Esp, sp, sizeof(sp) ) == sizeof(sp) &&
|
if (unix_funcs->virtual_uninterrupted_read_memory( (DWORD *)stack->context.Esp, sp, sizeof(sp) ) == sizeof(sp) &&
|
||||||
virtual_uninterrupted_read_memory( (DWORD *)sp[1] + 1, &func, sizeof(DWORD) ) == sizeof(DWORD) &&
|
unix_funcs->virtual_uninterrupted_read_memory( (DWORD *)sp[1] + 1, &func, sizeof(DWORD) ) == sizeof(DWORD) &&
|
||||||
!virtual_uninterrupted_write_memory( (DWORD *)stack->context.Esp + 1, &sp[0], sizeof(sp[0]) ))
|
!unix_funcs->virtual_uninterrupted_write_memory( (DWORD *)stack->context.Esp + 1, &sp[0], sizeof(sp[0]) ))
|
||||||
{
|
{
|
||||||
ECX_sig(sigcontext) = sp[0];
|
ECX_sig(sigcontext) = sp[0];
|
||||||
EAX_sig(sigcontext) = sp[1];
|
EAX_sig(sigcontext) = sp[1];
|
||||||
|
@ -1579,7 +1579,7 @@ static struct stack_layout *setup_exception_record( ucontext_t *sigcontext, void
|
||||||
else if ((char *)(stack - 1) < (char *)NtCurrentTeb()->Tib.StackLimit)
|
else if ((char *)(stack - 1) < (char *)NtCurrentTeb()->Tib.StackLimit)
|
||||||
{
|
{
|
||||||
/* stack access below stack limit, may be recoverable */
|
/* stack access below stack limit, may be recoverable */
|
||||||
switch (virtual_handle_stack_fault( stack - 1 ))
|
switch (unix_funcs->virtual_handle_stack_fault( stack - 1 ))
|
||||||
{
|
{
|
||||||
case 0: /* not handled */
|
case 0: /* not handled */
|
||||||
{
|
{
|
||||||
|
@ -1753,7 +1753,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
if (get_trap_code(context) == TRAP_x86_PAGEFLT &&
|
if (get_trap_code(context) == TRAP_x86_PAGEFLT &&
|
||||||
(char *)stack_ptr >= (char *)get_signal_stack() &&
|
(char *)stack_ptr >= (char *)get_signal_stack() &&
|
||||||
(char *)stack_ptr < (char *)get_signal_stack() + signal_stack_size &&
|
(char *)stack_ptr < (char *)get_signal_stack() + signal_stack_size &&
|
||||||
!virtual_handle_fault( siginfo->si_addr, (get_error_code(context) >> 1) & 0x09, TRUE ))
|
!unix_funcs->virtual_handle_fault( siginfo->si_addr, (get_error_code(context) >> 1) & 0x09, TRUE ))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1761,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
/* check for page fault inside the thread stack */
|
/* check for page fault inside the thread stack */
|
||||||
if (get_trap_code(context) == TRAP_x86_PAGEFLT)
|
if (get_trap_code(context) == TRAP_x86_PAGEFLT)
|
||||||
{
|
{
|
||||||
switch (virtual_handle_stack_fault( siginfo->si_addr ))
|
switch (unix_funcs->virtual_handle_stack_fault( siginfo->si_addr ))
|
||||||
{
|
{
|
||||||
case 1: /* handled */
|
case 1: /* handled */
|
||||||
return;
|
return;
|
||||||
|
@ -1813,7 +1813,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
stack->rec.NumberParameters = 2;
|
stack->rec.NumberParameters = 2;
|
||||||
stack->rec.ExceptionInformation[0] = (get_error_code(context) >> 1) & 0x09;
|
stack->rec.ExceptionInformation[0] = (get_error_code(context) >> 1) & 0x09;
|
||||||
stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
||||||
stack->rec.ExceptionCode = virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1],
|
stack->rec.ExceptionCode = unix_funcs->virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1],
|
||||||
stack->rec.ExceptionInformation[0], FALSE );
|
stack->rec.ExceptionInformation[0], FALSE );
|
||||||
if (!stack->rec.ExceptionCode) return;
|
if (!stack->rec.ExceptionCode) return;
|
||||||
if (stack->rec.ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&
|
if (stack->rec.ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&
|
||||||
|
|
|
@ -370,7 +370,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
rec.NumberParameters = 2;
|
rec.NumberParameters = 2;
|
||||||
rec.ExceptionInformation[0] = 0; /* FIXME ? */
|
rec.ExceptionInformation[0] = 0; /* FIXME ? */
|
||||||
rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
||||||
if (!(rec.ExceptionCode = virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0], FALSE)))
|
if (!(rec.ExceptionCode = unix_funcs->virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0], FALSE)))
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -393,7 +393,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
rec.NumberParameters = 2;
|
rec.NumberParameters = 2;
|
||||||
rec.ExceptionInformation[0] = 0; /* FIXME ? */
|
rec.ExceptionInformation[0] = 0; /* FIXME ? */
|
||||||
rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
||||||
if (!(rec.ExceptionCode = virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0], FALSE)))
|
if (!(rec.ExceptionCode = unix_funcs->virtual_handle_fault(siginfo->si_addr, rec.ExceptionInformation[0], FALSE)))
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2375,7 +2375,7 @@ static struct stack_layout *setup_exception( ucontext_t *sigcontext )
|
||||||
else if ((char *)(stack - 1) < (char *)NtCurrentTeb()->Tib.StackLimit)
|
else if ((char *)(stack - 1) < (char *)NtCurrentTeb()->Tib.StackLimit)
|
||||||
{
|
{
|
||||||
/* stack access below stack limit, may be recoverable */
|
/* stack access below stack limit, may be recoverable */
|
||||||
switch (virtual_handle_stack_fault( stack - 1 ))
|
switch (unix_funcs->virtual_handle_stack_fault( stack - 1 ))
|
||||||
{
|
{
|
||||||
case 0: /* not handled */
|
case 0: /* not handled */
|
||||||
{
|
{
|
||||||
|
@ -2466,7 +2466,7 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
|
||||||
{
|
{
|
||||||
BYTE instr[16];
|
BYTE instr[16];
|
||||||
unsigned int i, prefix_count = 0;
|
unsigned int i, prefix_count = 0;
|
||||||
unsigned int len = virtual_uninterrupted_read_memory( (BYTE *)context->Rip, instr, sizeof(instr) );
|
unsigned int len = unix_funcs->virtual_uninterrupted_read_memory( (BYTE *)context->Rip, instr, sizeof(instr) );
|
||||||
|
|
||||||
for (i = 0; i < len; i++) switch (instr[i])
|
for (i = 0; i < len; i++) switch (instr[i])
|
||||||
{
|
{
|
||||||
|
@ -2589,7 +2589,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
|
|
||||||
/* check for exceptions on the signal stack caused by write watches */
|
/* check for exceptions on the signal stack caused by write watches */
|
||||||
if (TRAP_sig(ucontext) == TRAP_x86_PAGEFLT && is_inside_signal_stack( stack ) &&
|
if (TRAP_sig(ucontext) == TRAP_x86_PAGEFLT && is_inside_signal_stack( stack ) &&
|
||||||
!virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, TRUE ))
|
!unix_funcs->virtual_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09, TRUE ))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2597,7 +2597,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
/* check for page fault inside the thread stack */
|
/* check for page fault inside the thread stack */
|
||||||
if (TRAP_sig(ucontext) == TRAP_x86_PAGEFLT)
|
if (TRAP_sig(ucontext) == TRAP_x86_PAGEFLT)
|
||||||
{
|
{
|
||||||
switch (virtual_handle_stack_fault( siginfo->si_addr ))
|
switch (unix_funcs->virtual_handle_stack_fault( siginfo->si_addr ))
|
||||||
{
|
{
|
||||||
case 1: /* handled */
|
case 1: /* handled */
|
||||||
return;
|
return;
|
||||||
|
@ -2642,7 +2642,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
stack->rec.NumberParameters = 2;
|
stack->rec.NumberParameters = 2;
|
||||||
stack->rec.ExceptionInformation[0] = (ERROR_sig(ucontext) >> 1) & 0x09;
|
stack->rec.ExceptionInformation[0] = (ERROR_sig(ucontext) >> 1) & 0x09;
|
||||||
stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
|
||||||
if (!(stack->rec.ExceptionCode = virtual_handle_fault((void *)stack->rec.ExceptionInformation[1],
|
if (!(stack->rec.ExceptionCode = unix_funcs->virtual_handle_fault((void *)stack->rec.ExceptionInformation[1],
|
||||||
stack->rec.ExceptionInformation[0], FALSE )))
|
stack->rec.ExceptionInformation[0], FALSE )))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -244,10 +244,8 @@ TEB *thread_init(void)
|
||||||
|
|
||||||
/* allocate and initialize the PEB and initial TEB */
|
/* allocate and initialize the PEB and initial TEB */
|
||||||
|
|
||||||
teb = virtual_alloc_first_teb();
|
teb = unix_funcs->virtual_alloc_first_teb();
|
||||||
unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy );
|
unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy );
|
||||||
unix_funcs->alloc_thread( teb );
|
|
||||||
unix_funcs->init_thread( teb );
|
|
||||||
|
|
||||||
peb = teb->Peb;
|
peb = teb->Peb;
|
||||||
peb->FastPebLock = &peb_lock;
|
peb->FastPebLock = &peb_lock;
|
||||||
|
@ -329,7 +327,7 @@ void WINAPI RtlExitUserThread( ULONG status )
|
||||||
if (thread_data->pthread_id)
|
if (thread_data->pthread_id)
|
||||||
{
|
{
|
||||||
pthread_join( thread_data->pthread_id, NULL );
|
pthread_join( thread_data->pthread_id, NULL );
|
||||||
virtual_free_teb( teb );
|
unix_funcs->virtual_free_teb( teb );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +462,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
|
||||||
|
|
||||||
pthread_sigmask( SIG_BLOCK, &server_block_set, &sigset );
|
pthread_sigmask( SIG_BLOCK, &server_block_set, &sigset );
|
||||||
|
|
||||||
if ((status = virtual_alloc_teb( &teb ))) goto error;
|
if ((status = unix_funcs->virtual_alloc_teb( &teb ))) goto error;
|
||||||
|
|
||||||
teb->ClientId.UniqueProcess = ULongToHandle(GetCurrentProcessId());
|
teb->ClientId.UniqueProcess = ULongToHandle(GetCurrentProcessId());
|
||||||
teb->ClientId.UniqueThread = ULongToHandle(tid);
|
teb->ClientId.UniqueThread = ULongToHandle(tid);
|
||||||
|
@ -487,7 +485,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
|
||||||
info->entry_point = start;
|
info->entry_point = start;
|
||||||
info->entry_arg = param;
|
info->entry_arg = param;
|
||||||
|
|
||||||
if ((status = virtual_alloc_thread_stack( &stack, stack_reserve, stack_commit, &extra_stack )))
|
if ((status = unix_funcs->virtual_alloc_thread_stack( &stack, stack_reserve, stack_commit, &extra_stack )))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
teb->Tib.StackBase = stack.StackBase;
|
teb->Tib.StackBase = stack.StackBase;
|
||||||
|
@ -524,7 +522,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (teb) virtual_free_teb( teb );
|
if (teb) unix_funcs->virtual_free_teb( teb );
|
||||||
if (handle) NtClose( handle );
|
if (handle) NtClose( handle );
|
||||||
pthread_sigmask( SIG_SETMASK, &sigset, NULL );
|
pthread_sigmask( SIG_SETMASK, &sigset, NULL );
|
||||||
close( request_pipe[1] );
|
close( request_pipe[1] );
|
||||||
|
|
|
@ -983,12 +983,27 @@ static HMODULE load_ntdll(void)
|
||||||
*/
|
*/
|
||||||
static struct unix_funcs unix_funcs =
|
static struct unix_funcs unix_funcs =
|
||||||
{
|
{
|
||||||
|
NtAllocateVirtualMemory,
|
||||||
|
NtAreMappedFilesTheSame,
|
||||||
NtClose,
|
NtClose,
|
||||||
NtCurrentTeb,
|
NtCurrentTeb,
|
||||||
NtDuplicateObject,
|
NtDuplicateObject,
|
||||||
|
NtFlushVirtualMemory,
|
||||||
|
NtFreeVirtualMemory,
|
||||||
NtGetContextThread,
|
NtGetContextThread,
|
||||||
|
NtGetWriteWatch,
|
||||||
|
NtLockVirtualMemory,
|
||||||
|
NtMapViewOfSection,
|
||||||
|
NtProtectVirtualMemory,
|
||||||
|
NtQuerySection,
|
||||||
|
NtQueryVirtualMemory,
|
||||||
|
NtReadVirtualMemory,
|
||||||
|
NtResetWriteWatch,
|
||||||
NtSetContextThread,
|
NtSetContextThread,
|
||||||
NtSetLdtEntries,
|
NtSetLdtEntries,
|
||||||
|
NtUnlockVirtualMemory,
|
||||||
|
NtUnmapViewOfSection,
|
||||||
|
NtWriteVirtualMemory,
|
||||||
get_main_args,
|
get_main_args,
|
||||||
get_paths,
|
get_paths,
|
||||||
get_dll_path,
|
get_dll_path,
|
||||||
|
@ -998,19 +1013,33 @@ static struct unix_funcs unix_funcs =
|
||||||
get_host_version,
|
get_host_version,
|
||||||
exec_wineloader,
|
exec_wineloader,
|
||||||
map_so_dll,
|
map_so_dll,
|
||||||
mmap_add_reserved_area,
|
virtual_map_section,
|
||||||
mmap_remove_reserved_area,
|
virtual_get_system_info,
|
||||||
mmap_is_in_reserved_area,
|
virtual_create_builtin_view,
|
||||||
mmap_enum_reserved_areas,
|
virtual_alloc_first_teb,
|
||||||
|
virtual_alloc_teb,
|
||||||
|
virtual_free_teb,
|
||||||
|
virtual_alloc_thread_stack,
|
||||||
|
virtual_handle_fault,
|
||||||
|
virtual_locked_server_call,
|
||||||
|
virtual_locked_read,
|
||||||
|
virtual_locked_pread,
|
||||||
|
virtual_locked_recvmsg,
|
||||||
|
virtual_is_valid_code_address,
|
||||||
|
virtual_handle_stack_fault,
|
||||||
|
virtual_check_buffer_for_read,
|
||||||
|
virtual_check_buffer_for_write,
|
||||||
|
virtual_uninterrupted_read_memory,
|
||||||
|
virtual_uninterrupted_write_memory,
|
||||||
|
virtual_set_force_exec,
|
||||||
|
virtual_release_address_space,
|
||||||
|
virtual_set_large_address_space,
|
||||||
init_threading,
|
init_threading,
|
||||||
alloc_thread,
|
|
||||||
free_thread,
|
|
||||||
init_thread,
|
init_thread,
|
||||||
abort_thread,
|
abort_thread,
|
||||||
exit_thread,
|
exit_thread,
|
||||||
exit_process,
|
exit_process,
|
||||||
get_thread_ldt_entry,
|
get_thread_ldt_entry,
|
||||||
server_call_unlocked,
|
|
||||||
wine_server_call,
|
wine_server_call,
|
||||||
server_select,
|
server_select,
|
||||||
server_wait,
|
server_wait,
|
||||||
|
|
|
@ -287,7 +287,7 @@ static inline unsigned int wait_reply( struct __server_request_info *req )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* server_call_unlocked
|
* server_call_unlocked
|
||||||
*/
|
*/
|
||||||
unsigned int CDECL server_call_unlocked( void *req_ptr )
|
unsigned int server_call_unlocked( void *req_ptr )
|
||||||
{
|
{
|
||||||
struct __server_request_info * const req = req_ptr;
|
struct __server_request_info * const req = req_ptr;
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
|
|
|
@ -88,25 +88,6 @@ void CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_copy )
|
||||||
*ldt_copy = &__wine_ldt_copy;
|
*ldt_copy = &__wine_ldt_copy;
|
||||||
#endif
|
#endif
|
||||||
nb_threads = nb_threads_ptr;
|
nb_threads = nb_threads_ptr;
|
||||||
signal_init_threading();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* alloc_thread
|
|
||||||
*/
|
|
||||||
NTSTATUS CDECL alloc_thread( TEB *teb )
|
|
||||||
{
|
|
||||||
return signal_alloc_thread( teb );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* free_thread
|
|
||||||
*/
|
|
||||||
void CDECL free_thread( TEB *teb )
|
|
||||||
{
|
|
||||||
signal_free_thread( teb );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,12 +55,34 @@ void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
|
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
|
||||||
int top_down ) DECLSPEC_HIDDEN;
|
int top_down ) DECLSPEC_HIDDEN;
|
||||||
|
extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
|
||||||
|
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
|
||||||
|
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
|
||||||
|
extern void CDECL virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
|
||||||
|
extern NTSTATUS CDECL virtual_create_builtin_view( void *module ) DECLSPEC_HIDDEN;
|
||||||
|
extern TEB * CDECL virtual_alloc_first_teb(void) DECLSPEC_HIDDEN;
|
||||||
|
extern NTSTATUS CDECL virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN;
|
||||||
|
extern void CDECL virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN;
|
||||||
|
extern NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ) DECLSPEC_HIDDEN;
|
||||||
|
extern NTSTATUS CDECL virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) DECLSPEC_HIDDEN;
|
||||||
|
extern unsigned int CDECL virtual_locked_server_call( void *req_ptr ) DECLSPEC_HIDDEN;
|
||||||
|
extern ssize_t CDECL virtual_locked_read( int fd, void *addr, size_t size ) DECLSPEC_HIDDEN;
|
||||||
|
extern ssize_t CDECL virtual_locked_pread( int fd, void *addr, size_t size, off_t offset ) DECLSPEC_HIDDEN;
|
||||||
|
extern ssize_t CDECL virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) DECLSPEC_HIDDEN;
|
||||||
|
extern BOOL CDECL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
|
extern int CDECL virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
|
||||||
|
extern BOOL CDECL virtual_check_buffer_for_read( const void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
|
extern BOOL CDECL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
|
extern SIZE_T CDECL virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
|
extern NTSTATUS CDECL virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
|
||||||
|
extern void CDECL virtual_set_force_exec( BOOL enable ) DECLSPEC_HIDDEN;
|
||||||
|
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
|
||||||
|
extern void CDECL virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern void virtual_init(void) DECLSPEC_HIDDEN;
|
extern void virtual_init(void) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern void CDECL dbg_init(void) DECLSPEC_HIDDEN;
|
extern void CDECL dbg_init(void) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern unsigned int CDECL server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
|
|
||||||
extern unsigned int CDECL server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
extern unsigned int CDECL server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
||||||
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
||||||
user_apc_t *user_apc ) DECLSPEC_HIDDEN;
|
user_apc_t *user_apc ) DECLSPEC_HIDDEN;
|
||||||
|
@ -82,8 +104,6 @@ extern void CDECL server_init_process_done(void) DECLSPEC_HIDDEN;
|
||||||
extern size_t CDECL server_init_thread( void *entry_point, BOOL *suspend, unsigned int *cpus,
|
extern size_t CDECL server_init_thread( void *entry_point, BOOL *suspend, unsigned int *cpus,
|
||||||
BOOL *wow64, timeout_t *start_time ) DECLSPEC_HIDDEN;
|
BOOL *wow64, timeout_t *start_time ) DECLSPEC_HIDDEN;
|
||||||
extern void CDECL init_threading( int *nb_threads, struct ldt_copy **ldt_copy ) DECLSPEC_HIDDEN;
|
extern void CDECL init_threading( int *nb_threads, struct ldt_copy **ldt_copy ) DECLSPEC_HIDDEN;
|
||||||
extern NTSTATUS CDECL alloc_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
|
||||||
extern void CDECL free_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
|
||||||
extern void CDECL init_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
extern void CDECL init_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
||||||
extern void CDECL DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN;
|
extern void CDECL DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN;
|
||||||
extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
|
extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
|
||||||
|
@ -93,10 +113,12 @@ extern NTSTATUS CDECL get_thread_ldt_entry( HANDLE handle, void *data, ULONG len
|
||||||
extern const char *data_dir DECLSPEC_HIDDEN;
|
extern const char *data_dir DECLSPEC_HIDDEN;
|
||||||
extern const char *build_dir DECLSPEC_HIDDEN;
|
extern const char *build_dir DECLSPEC_HIDDEN;
|
||||||
extern const char *config_dir DECLSPEC_HIDDEN;
|
extern const char *config_dir DECLSPEC_HIDDEN;
|
||||||
|
extern BOOL is_wow64 DECLSPEC_HIDDEN;
|
||||||
extern sigset_t server_block_set DECLSPEC_HIDDEN;
|
extern sigset_t server_block_set DECLSPEC_HIDDEN;
|
||||||
extern SIZE_T signal_stack_size DECLSPEC_HIDDEN;
|
extern SIZE_T signal_stack_size DECLSPEC_HIDDEN;
|
||||||
extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN;
|
extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
|
||||||
extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
||||||
extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
||||||
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
|
extern void start_server( BOOL debug ) DECLSPEC_HIDDEN;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,21 +25,51 @@
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
struct ldt_copy;
|
struct ldt_copy;
|
||||||
|
struct msghdr;
|
||||||
|
|
||||||
/* increment this when you change the function table */
|
/* increment this when you change the function table */
|
||||||
#define NTDLL_UNIXLIB_VERSION 15
|
#define NTDLL_UNIXLIB_VERSION 16
|
||||||
|
|
||||||
struct unix_funcs
|
struct unix_funcs
|
||||||
{
|
{
|
||||||
/* Nt* functions */
|
/* Nt* functions */
|
||||||
|
NTSTATUS (WINAPI *NtAllocateVirtualMemory)( HANDLE process, PVOID *ret, ULONG_PTR zero_bits,
|
||||||
|
SIZE_T *size_ptr, ULONG type, ULONG protect );
|
||||||
|
NTSTATUS (WINAPI *NtAreMappedFilesTheSame)(PVOID addr1, PVOID addr2);
|
||||||
NTSTATUS (WINAPI *NtClose)( HANDLE handle );
|
NTSTATUS (WINAPI *NtClose)( HANDLE handle );
|
||||||
TEB * (WINAPI *NtCurrentTeb)(void);
|
TEB * (WINAPI *NtCurrentTeb)(void);
|
||||||
NTSTATUS (WINAPI *NtDuplicateObject)( HANDLE source_process, HANDLE source,
|
NTSTATUS (WINAPI *NtDuplicateObject)( HANDLE source_process, HANDLE source,
|
||||||
HANDLE dest_process, HANDLE *dest,
|
HANDLE dest_process, HANDLE *dest,
|
||||||
ACCESS_MASK access, ULONG attributes, ULONG options );
|
ACCESS_MASK access, ULONG attributes, ULONG options );
|
||||||
|
NTSTATUS (WINAPI *NtFlushVirtualMemory)( HANDLE process, LPCVOID *addr_ptr,
|
||||||
|
SIZE_T *size_ptr, ULONG unknown );
|
||||||
|
NTSTATUS (WINAPI *NtFreeVirtualMemory)( HANDLE process, PVOID *addr_ptr,
|
||||||
|
SIZE_T *size_ptr, ULONG type );
|
||||||
NTSTATUS (WINAPI *NtGetContextThread)( HANDLE handle, CONTEXT *context );
|
NTSTATUS (WINAPI *NtGetContextThread)( HANDLE handle, CONTEXT *context );
|
||||||
|
NTSTATUS (WINAPI *NtGetWriteWatch)( HANDLE process, ULONG flags, PVOID base, SIZE_T size,
|
||||||
|
PVOID *addresses, ULONG_PTR *count, ULONG *granularity );
|
||||||
|
NTSTATUS (WINAPI *NtLockVirtualMemory)( HANDLE process, PVOID *addr, SIZE_T *size, ULONG unknown );
|
||||||
|
NTSTATUS (WINAPI *NtMapViewOfSection)( HANDLE handle, HANDLE process, PVOID *addr_ptr,
|
||||||
|
ULONG_PTR zero_bits, SIZE_T commit_size,
|
||||||
|
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr,
|
||||||
|
SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect );
|
||||||
|
NTSTATUS (WINAPI *NtProtectVirtualMemory)( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr,
|
||||||
|
ULONG new_prot, ULONG *old_prot );
|
||||||
|
NTSTATUS (WINAPI *NtQuerySection)( HANDLE handle, SECTION_INFORMATION_CLASS class,
|
||||||
|
void *ptr, SIZE_T size, SIZE_T *ret_size );
|
||||||
|
NTSTATUS (WINAPI *NtQueryVirtualMemory)( HANDLE process, LPCVOID addr,
|
||||||
|
MEMORY_INFORMATION_CLASS info_class,
|
||||||
|
PVOID buffer, SIZE_T len, SIZE_T *res_len );
|
||||||
|
NTSTATUS (WINAPI *NtReadVirtualMemory)( HANDLE process, const void *addr, void *buffer,
|
||||||
|
SIZE_T size, SIZE_T *bytes_read );
|
||||||
|
NTSTATUS (WINAPI *NtResetWriteWatch)( HANDLE process, PVOID base, SIZE_T size );
|
||||||
NTSTATUS (WINAPI *NtSetContextThread)( HANDLE handle, const CONTEXT *context );
|
NTSTATUS (WINAPI *NtSetContextThread)( HANDLE handle, const CONTEXT *context );
|
||||||
NTSTATUS (WINAPI *NtSetLdtEntries)( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_ENTRY entry2 );
|
NTSTATUS (WINAPI *NtSetLdtEntries)( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_ENTRY entry2 );
|
||||||
|
NTSTATUS (WINAPI *NtUnlockVirtualMemory)( HANDLE process, PVOID *addr,
|
||||||
|
SIZE_T *size, ULONG unknown );
|
||||||
|
NTSTATUS (WINAPI *NtUnmapViewOfSection)( HANDLE process, PVOID addr );
|
||||||
|
NTSTATUS (WINAPI *NtWriteVirtualMemory)( HANDLE process, void *addr, const void *buffer,
|
||||||
|
SIZE_T size, SIZE_T *bytes_written );
|
||||||
|
|
||||||
/* environment functions */
|
/* environment functions */
|
||||||
void (CDECL *get_main_args)( int *argc, char **argv[], char **envp[] );
|
void (CDECL *get_main_args)( int *argc, char **argv[], char **envp[] );
|
||||||
|
@ -56,16 +86,32 @@ struct unix_funcs
|
||||||
|
|
||||||
/* virtual memory functions */
|
/* virtual memory functions */
|
||||||
NTSTATUS (CDECL *map_so_dll)( const IMAGE_NT_HEADERS *nt_descr, HMODULE module );
|
NTSTATUS (CDECL *map_so_dll)( const IMAGE_NT_HEADERS *nt_descr, HMODULE module );
|
||||||
void (CDECL *mmap_add_reserved_area)( void *addr, SIZE_T size );
|
NTSTATUS (CDECL *virtual_map_section)( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
|
||||||
void (CDECL *mmap_remove_reserved_area)( void *addr, SIZE_T size );
|
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
|
||||||
int (CDECL *mmap_is_in_reserved_area)( void *addr, SIZE_T size );
|
ULONG protect, pe_image_info_t *image_info );
|
||||||
int (CDECL *mmap_enum_reserved_areas)( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg),
|
void (CDECL *virtual_get_system_info)( SYSTEM_BASIC_INFORMATION *info );
|
||||||
void *arg, int top_down );
|
NTSTATUS (CDECL *virtual_create_builtin_view)( void *module );
|
||||||
|
TEB * (CDECL *virtual_alloc_first_teb)(void);
|
||||||
|
NTSTATUS (CDECL *virtual_alloc_teb)( TEB **ret_teb );
|
||||||
|
void (CDECL *virtual_free_teb)( TEB *teb );
|
||||||
|
NTSTATUS (CDECL *virtual_alloc_thread_stack)( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size );
|
||||||
|
NTSTATUS (CDECL *virtual_handle_fault)( LPCVOID addr, DWORD err, BOOL on_signal_stack );
|
||||||
|
unsigned int (CDECL *virtual_locked_server_call)( void *req_ptr );
|
||||||
|
ssize_t (CDECL *virtual_locked_read)( int fd, void *addr, size_t size );
|
||||||
|
ssize_t (CDECL *virtual_locked_pread)( int fd, void *addr, size_t size, off_t offset );
|
||||||
|
ssize_t (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags );
|
||||||
|
BOOL (CDECL *virtual_is_valid_code_address)( const void *addr, SIZE_T size );
|
||||||
|
int (CDECL *virtual_handle_stack_fault)( void *addr );
|
||||||
|
BOOL (CDECL *virtual_check_buffer_for_read)( const void *ptr, SIZE_T size );
|
||||||
|
BOOL (CDECL *virtual_check_buffer_for_write)( void *ptr, SIZE_T size );
|
||||||
|
SIZE_T (CDECL *virtual_uninterrupted_read_memory)( const void *addr, void *buffer, SIZE_T size );
|
||||||
|
NTSTATUS (CDECL *virtual_uninterrupted_write_memory)( void *addr, const void *buffer, SIZE_T size );
|
||||||
|
void (CDECL *virtual_set_force_exec)( BOOL enable );
|
||||||
|
void (CDECL *virtual_release_address_space)(void);
|
||||||
|
void (CDECL *virtual_set_large_address_space)(void);
|
||||||
|
|
||||||
/* thread/process functions */
|
/* thread/process functions */
|
||||||
void (CDECL *init_threading)( int *nb_threads, struct ldt_copy **ldt_copy );
|
void (CDECL *init_threading)( int *nb_threads, struct ldt_copy **ldt_copy );
|
||||||
NTSTATUS (CDECL *alloc_thread)( TEB *teb );
|
|
||||||
void (CDECL *free_thread)( TEB *teb );
|
|
||||||
void (CDECL *init_thread)( TEB *teb );
|
void (CDECL *init_thread)( TEB *teb );
|
||||||
void (CDECL *abort_thread)( int status );
|
void (CDECL *abort_thread)( int status );
|
||||||
void (CDECL *exit_thread)( int status );
|
void (CDECL *exit_thread)( int status );
|
||||||
|
@ -73,7 +119,6 @@ struct unix_funcs
|
||||||
NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len );
|
NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len );
|
||||||
|
|
||||||
/* server functions */
|
/* server functions */
|
||||||
unsigned int (CDECL *server_call_unlocked)( void *req_ptr );
|
|
||||||
unsigned int (CDECL *server_call)( void *req_ptr );
|
unsigned int (CDECL *server_call)( void *req_ptr );
|
||||||
unsigned int (CDECL *server_select)( const select_op_t *select_op, data_size_t size, UINT flags,
|
unsigned int (CDECL *server_select)( const select_op_t *select_op, data_size_t size, UINT flags,
|
||||||
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
||||||
|
|
3667
dlls/ntdll/virtual.c
3667
dlls/ntdll/virtual.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue