mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:39:34 +00:00
ntdll: Use a proper Unix syscall for RtlGetSystemTimePrecise().
This commit is contained in:
parent
1fe7b8dd6d
commit
4b65a7027f
|
@ -4600,28 +4600,3 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
|
|||
if (reason == DLL_PROCESS_ATTACH) LdrDisableThreadCalloutsForDll( inst );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static LONGLONG WINAPI RtlGetSystemTimePrecise_fallback(void)
|
||||
{
|
||||
LARGE_INTEGER now;
|
||||
NtQuerySystemTime( &now );
|
||||
return now.QuadPart;
|
||||
}
|
||||
|
||||
static const struct unix_funcs unix_fallbacks =
|
||||
{
|
||||
RtlGetSystemTimePrecise_fallback,
|
||||
};
|
||||
|
||||
const struct unix_funcs *unix_funcs = &unix_fallbacks;
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_set_unix_funcs
|
||||
*/
|
||||
NTSTATUS CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs )
|
||||
{
|
||||
if (version != NTDLL_UNIXLIB_VERSION) return STATUS_REVISION_MISMATCH;
|
||||
unix_funcs = funcs;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1692,7 +1692,6 @@
|
|||
# Unix interface
|
||||
@ stdcall -syscall __wine_unix_call(int64 long ptr)
|
||||
@ stdcall -syscall __wine_unix_spawnvp(long ptr)
|
||||
@ cdecl __wine_set_unix_funcs(long ptr)
|
||||
@ stdcall __wine_ctrl_routine(ptr)
|
||||
@ extern __wine_syscall_dispatcher
|
||||
@ extern -arch=i386 __wine_ldt_copy
|
||||
|
|
|
@ -85,7 +85,6 @@ extern const WCHAR windows_dir[] DECLSPEC_HIDDEN;
|
|||
extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
|
||||
|
||||
extern void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) DECLSPEC_HIDDEN;
|
||||
extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
|
||||
|
||||
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -372,7 +372,10 @@ void WINAPI RtlTimeToElapsedTimeFields( const LARGE_INTEGER *Time, PTIME_FIELDS
|
|||
*/
|
||||
LONGLONG WINAPI RtlGetSystemTimePrecise( void )
|
||||
{
|
||||
return unix_funcs->RtlGetSystemTimePrecise();
|
||||
LONGLONG ret;
|
||||
|
||||
NTDLL_UNIX_CALL( system_time_precise, &ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -116,7 +116,6 @@ void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *a
|
|||
void (WINAPI *p__wine_ctrl_routine)(void*);
|
||||
SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock = NULL;
|
||||
|
||||
static NTSTATUS (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_funcs *funcs );
|
||||
static void *p__wine_syscall_dispatcher;
|
||||
|
||||
static void * const syscalls[] =
|
||||
|
@ -1062,7 +1061,6 @@ static void load_ntdll_functions( HMODULE module )
|
|||
GET_FUNC( LdrSystemDllInitBlock );
|
||||
GET_FUNC( RtlUserThreadStart );
|
||||
GET_FUNC( __wine_ctrl_routine );
|
||||
GET_FUNC( __wine_set_unix_funcs );
|
||||
GET_FUNC( __wine_syscall_dispatcher );
|
||||
#ifdef __i386__
|
||||
{
|
||||
|
@ -2150,15 +2148,6 @@ static ULONG_PTR get_image_address(void)
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* unix_funcs
|
||||
*/
|
||||
static struct unix_funcs unix_funcs =
|
||||
{
|
||||
RtlGetSystemTimePrecise,
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_unix_call_funcs
|
||||
*/
|
||||
|
@ -2167,6 +2156,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
load_so_dll,
|
||||
init_builtin_dll,
|
||||
unwind_builtin_dll,
|
||||
system_time_precise,
|
||||
};
|
||||
|
||||
|
||||
|
@ -2182,6 +2172,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
|
|||
wow64_load_so_dll,
|
||||
wow64_init_builtin_dll,
|
||||
wow64_unwind_builtin_dll,
|
||||
system_time_precise,
|
||||
};
|
||||
|
||||
|
||||
|
@ -2191,7 +2182,6 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
|
|||
static void start_main_thread(void)
|
||||
{
|
||||
SYSTEM_SERVICE_TABLE syscall_table = { (ULONG_PTR *)syscalls, NULL, ARRAY_SIZE(syscalls), syscall_args };
|
||||
NTSTATUS status;
|
||||
TEB *teb = virtual_alloc_first_teb();
|
||||
|
||||
signal_init_threading();
|
||||
|
@ -2214,12 +2204,6 @@ static void start_main_thread(void)
|
|||
if (main_image_info.Machine != current_machine) load_wow64_ntdll( main_image_info.Machine );
|
||||
load_apiset_dll();
|
||||
ntdll_init_syscalls( 0, &syscall_table, p__wine_syscall_dispatcher );
|
||||
status = p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
|
||||
if (status == STATUS_REVISION_MISMATCH)
|
||||
{
|
||||
ERR( "ntdll library version mismatch\n" );
|
||||
NtTerminateProcess( GetCurrentProcess(), status );
|
||||
}
|
||||
server_init_process_done();
|
||||
}
|
||||
|
||||
|
|
|
@ -1642,17 +1642,22 @@ ULONG WINAPI NtGetTickCount(void)
|
|||
/******************************************************************************
|
||||
* RtlGetSystemTimePrecise (NTDLL.@)
|
||||
*/
|
||||
LONGLONG WINAPI RtlGetSystemTimePrecise(void)
|
||||
NTSTATUS system_time_precise( void *args )
|
||||
{
|
||||
LONGLONG *ret = args;
|
||||
struct timeval now;
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
struct timespec ts;
|
||||
|
||||
if (!clock_gettime( CLOCK_REALTIME, &ts ))
|
||||
return ticks_from_time_t( ts.tv_sec ) + (ts.tv_nsec + 50) / 100;
|
||||
{
|
||||
*ret = ticks_from_time_t( ts.tv_sec ) + (ts.tv_nsec + 50) / 100;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
gettimeofday( &now, 0 );
|
||||
return ticks_from_time_t( now.tv_sec ) + now.tv_usec * 10;
|
||||
*ret = ticks_from_time_t( now.tv_sec ) + now.tv_usec * 10;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ extern NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *se
|
|||
extern NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT machine ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
|
||||
data_size_t *ret_len ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS system_time_precise( void *args ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ) DECLSPEC_HIDDEN;
|
||||
extern void *anon_mmap_alloc( size_t size, int prot ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -43,18 +43,11 @@ enum ntdll_unix_funcs
|
|||
unix_load_so_dll,
|
||||
unix_init_builtin_dll,
|
||||
unix_unwind_builtin_dll,
|
||||
unix_system_time_precise,
|
||||
};
|
||||
|
||||
extern unixlib_handle_t ntdll_unix_handle;
|
||||
|
||||
#define NTDLL_UNIX_CALL( func, params ) __wine_unix_call( ntdll_unix_handle, unix_ ## func, params )
|
||||
|
||||
/* increment this when you change the function table */
|
||||
#define NTDLL_UNIXLIB_VERSION 138
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void);
|
||||
};
|
||||
|
||||
#endif /* __NTDLL_UNIXLIB_H */
|
||||
|
|
Loading…
Reference in a new issue