mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
Removed global variable pCurrentTeb.
This commit is contained in:
parent
73bd8d2b1c
commit
cebd60b33c
@ -739,15 +739,29 @@ WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
|
||||
#define DBG_EXCEPTION_NOT_HANDLED 0x80010001
|
||||
|
||||
struct _TEB;
|
||||
#if defined(__i386__) && defined(__WINE__)
|
||||
|
||||
#ifdef __WINE__
|
||||
|
||||
#if defined(__i386__)
|
||||
static inline struct _TEB * WINE_UNUSED __get_teb(void)
|
||||
{
|
||||
struct _TEB *teb;
|
||||
__asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
|
||||
return teb;
|
||||
}
|
||||
#define NtCurrentTeb() __get_teb()
|
||||
#elif defined(HAVE__LWP_CREATE)
|
||||
extern void *_lwp_getprivate(void);
|
||||
static inline struct _TEB * WINE_UNUSED __get_teb(void)
|
||||
{
|
||||
return (struct _TEB *)_lwp_getprivate();
|
||||
}
|
||||
#else
|
||||
#error NtCurrentTeb() not defined for this architecture!
|
||||
#endif
|
||||
|
||||
#define NtCurrentTeb() __get_teb()
|
||||
|
||||
#else /* __WINE__ */
|
||||
extern struct _TEB * WINAPI NtCurrentTeb(void);
|
||||
#endif
|
||||
|
||||
|
@ -56,11 +56,6 @@ extern int clone( int (*fn)(void *arg), void *stack, int flags, void *arg );
|
||||
|
||||
static int init_done;
|
||||
|
||||
#ifndef __i386__
|
||||
static TEB *pCurrentTeb;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_REENTRANT_LIBC
|
||||
|
||||
/***********************************************************************
|
||||
@ -112,13 +107,14 @@ int *__h_errno_location()
|
||||
*/
|
||||
void SYSDEPS_SetCurThread( TEB *teb )
|
||||
{
|
||||
#ifdef __i386__
|
||||
#if defined(__i386__)
|
||||
/* On the i386, the current thread is in the %fs register */
|
||||
SET_FS( teb->teb_sel );
|
||||
#else
|
||||
/* FIXME: only works if there is no preemptive task-switching going on... */
|
||||
pCurrentTeb = teb;
|
||||
#endif /* __i386__ */
|
||||
#elif defined(HAVE__LWP_CREATE)
|
||||
/* On non-i386 Solaris, we use the LWP private pointer */
|
||||
_lwp_setprivate( teb );
|
||||
#endif
|
||||
|
||||
init_done = 1; /* now we can use threading routines */
|
||||
}
|
||||
|
||||
@ -216,20 +212,13 @@ void SYSDEPS_ExitThread(void)
|
||||
* This will crash and burn if called before threading is initialized
|
||||
*/
|
||||
|
||||
#ifdef NtCurrentTeb
|
||||
|
||||
/* if it was defined as a macro, we need to do some magic */
|
||||
#ifdef NtCurrentTeb
|
||||
#undef NtCurrentTeb
|
||||
#endif
|
||||
|
||||
struct _TEB * WINAPI NtCurrentTeb(void)
|
||||
{
|
||||
return __get_teb();
|
||||
}
|
||||
|
||||
#else /* NtCurrentTeb */
|
||||
|
||||
struct _TEB * WINAPI NtCurrentTeb(void)
|
||||
{
|
||||
return pCurrentTeb;
|
||||
}
|
||||
|
||||
#endif /* NtCurrentTeb */
|
||||
|
Loading…
Reference in New Issue
Block a user