Commit 59008670 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved the selector access functions out of winnt.h into libwine.

parent ff8a62d8
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/library.h"
#include "file.h" #include "file.h"
#include "global.h" #include "global.h"
#include "miscemu.h" #include "miscemu.h"
...@@ -66,8 +67,8 @@ static BOOL process_attach(void) ...@@ -66,8 +67,8 @@ static BOOL process_attach(void)
NE_SetEntryPoint( hModule, 178, GetWinFlags16() ); NE_SetEntryPoint( hModule, 178, GetWinFlags16() );
/* Initialize KERNEL.454/455 (__FLATCS/__FLATDS) */ /* Initialize KERNEL.454/455 (__FLATCS/__FLATDS) */
NE_SetEntryPoint( hModule, 454, __get_cs() ); NE_SetEntryPoint( hModule, 454, wine_get_cs() );
NE_SetEntryPoint( hModule, 455, __get_ds() ); NE_SetEntryPoint( hModule, 455, wine_get_ds() );
/* Initialize KERNEL.THHOOK */ /* Initialize KERNEL.THHOOK */
TASK_InstallTHHook(MapSL((SEGPTR)GetProcAddress16( hModule, (LPCSTR)332 ))); TASK_InstallTHHook(MapSL((SEGPTR)GetProcAddress16( hModule, (LPCSTR)332 )));
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/library.h"
#include "flatthunk.h" #include "flatthunk.h"
#include "heap.h" #include "heap.h"
#include "module.h" #include "module.h"
...@@ -1049,7 +1050,7 @@ FreeSLCallback( ...@@ -1049,7 +1050,7 @@ FreeSLCallback(
*/ */
void WINAPI GetTEBSelectorFS16(void) void WINAPI GetTEBSelectorFS16(void)
{ {
CURRENT_STACK16->fs = __get_fs(); CURRENT_STACK16->fs = wine_get_fs();
} }
/********************************************************************** /**********************************************************************
...@@ -1295,8 +1296,8 @@ UINT WINAPI ThunkConnect16( ...@@ -1295,8 +1296,8 @@ UINT WINAPI ThunkConnect16(
void WINAPI C16ThkSL(CONTEXT86 *context) void WINAPI C16ThkSL(CONTEXT86 *context)
{ {
LPBYTE stub = MapSL(context->Eax), x = stub; LPBYTE stub = MapSL(context->Eax), x = stub;
WORD cs = __get_cs(); WORD cs = wine_get_cs();
WORD ds = __get_ds(); WORD ds = wine_get_ds();
/* We produce the following code: /* We produce the following code:
* *
...@@ -1347,7 +1348,7 @@ void WINAPI C16ThkSL01(CONTEXT86 *context) ...@@ -1347,7 +1348,7 @@ void WINAPI C16ThkSL01(CONTEXT86 *context)
struct ThunkDataSL *td = SL16->fpData; struct ThunkDataSL *td = SL16->fpData;
DWORD procAddress = (DWORD)GetProcAddress16(GetModuleHandle16("KERNEL"), (LPCSTR)631); DWORD procAddress = (DWORD)GetProcAddress16(GetModuleHandle16("KERNEL"), (LPCSTR)631);
WORD cs = __get_cs(); WORD cs = wine_get_cs();
if (!td) if (!td)
{ {
...@@ -1913,7 +1914,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name) ...@@ -1913,7 +1914,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name)
*thunk++ = 0xea; *thunk++ = 0xea;
*(FARPROC *)thunk = GetProcAddress(GetModuleHandleA("KERNEL32"),"QT_Thunk"); *(FARPROC *)thunk = GetProcAddress(GetModuleHandleA("KERNEL32"),"QT_Thunk");
thunk += sizeof(FARPROC16); thunk += sizeof(FARPROC16);
*(WORD *)thunk = __get_cs(); *(WORD *)thunk = wine_get_cs();
return MAKESEGPTR( code_sel32, (char *)thunk - (char *)ThunkletHeap ); return MAKESEGPTR( code_sel32, (char *)thunk - (char *)ThunkletHeap );
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "winerror.h" #include "winerror.h"
#include "ntddk.h" #include "ntddk.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntdll); WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
...@@ -119,12 +120,12 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit ) ...@@ -119,12 +120,12 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
const char *name = (char *)crit->DebugInfo; const char *name = (char *)crit->DebugInfo;
if (!name || IsBadStringPtrA(name,80)) name = "?"; if (!name || IsBadStringPtrA(name,80)) name = "?";
ERR( "section %p %s wait timed out, retrying (60 sec) fs=%04x\n", ERR( "section %p %s wait timed out, retrying (60 sec) fs=%04x\n",
crit, debugstr_a(name), __get_fs() ); crit, debugstr_a(name), wine_get_fs() );
res = WaitForSingleObject( sem, 60000L ); res = WaitForSingleObject( sem, 60000L );
if ( res == WAIT_TIMEOUT && TRACE_ON(relay) ) if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
{ {
ERR( "section %p %s wait timed out, retrying (5 min) fs=%04x\n", ERR( "section %p %s wait timed out, retrying (5 min) fs=%04x\n",
crit, debugstr_a(name), __get_fs() ); crit, debugstr_a(name), wine_get_fs() );
res = WaitForSingleObject( sem, 300000L ); res = WaitForSingleObject( sem, 300000L );
} }
} }
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "ntddk.h" #include "ntddk.h"
#include "winnt.h" #include "winnt.h"
#include "wine/library.h"
#include "selectors.h" #include "selectors.h"
...@@ -491,7 +492,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext ) ...@@ -491,7 +492,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
#ifdef FS_sig #ifdef FS_sig
fs = FS_sig(sigcontext); fs = FS_sig(sigcontext);
#else #else
fs = __get_fs(); fs = wine_get_fs();
#endif #endif
context->SegFs = fs; context->SegFs = fs;
...@@ -507,7 +508,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext ) ...@@ -507,7 +508,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
fs = *(unsigned int *)ESP_sig(sigcontext); fs = *(unsigned int *)ESP_sig(sigcontext);
if (EAX_sig(sigcontext) == VM86_EAX) { if (EAX_sig(sigcontext) == VM86_EAX) {
struct vm86plus_struct *vm86; struct vm86plus_struct *vm86;
__set_fs(fs); wine_set_fs(fs);
/* retrieve pointer to vm86plus struct that was stored in vm86_enter /* retrieve pointer to vm86plus struct that was stored in vm86_enter
* (but we could also get if from teb->vm86_ptr) */ * (but we could also get if from teb->vm86_ptr) */
vm86 = *(struct vm86plus_struct **)(ESP_sig(sigcontext) + sizeof(int)); vm86 = *(struct vm86plus_struct **)(ESP_sig(sigcontext) + sizeof(int));
...@@ -518,7 +519,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext ) ...@@ -518,7 +519,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
} }
#endif /* __HAVE_VM86 */ #endif /* __HAVE_VM86 */
__set_fs(fs); wine_set_fs(fs);
context->Eax = EAX_sig(sigcontext); context->Eax = EAX_sig(sigcontext);
context->Ebx = EBX_sig(sigcontext); context->Ebx = EBX_sig(sigcontext);
...@@ -537,7 +538,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext ) ...@@ -537,7 +538,7 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
#ifdef GS_sig #ifdef GS_sig
context->SegGs = LOWORD(GS_sig(sigcontext)); context->SegGs = LOWORD(GS_sig(sigcontext));
#else #else
context->SegGs = __get_gs(); context->SegGs = wine_get_gs();
#endif #endif
} }
...@@ -580,12 +581,12 @@ static void restore_context( const CONTEXT *context, SIGCONTEXT *sigcontext ) ...@@ -580,12 +581,12 @@ static void restore_context( const CONTEXT *context, SIGCONTEXT *sigcontext )
#ifdef FS_sig #ifdef FS_sig
FS_sig(sigcontext) = context->SegFs; FS_sig(sigcontext) = context->SegFs;
#else #else
__set_fs( context->SegFs ); wine_set_fs( context->SegFs );
#endif #endif
#ifdef GS_sig #ifdef GS_sig
GS_sig(sigcontext) = context->SegGs; GS_sig(sigcontext) = context->SegGs;
#else #else
__set_gs( context->SegGs ); wine_set_gs( context->SegGs );
#endif #endif
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "module.h" #include "module.h"
#include "miscemu.h" #include "miscemu.h"
#include "stackframe.h" #include "stackframe.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "toolhelp.h" #include "toolhelp.h"
...@@ -58,10 +59,10 @@ inline static void patch_code_segment( void *code_segment ) ...@@ -58,10 +59,10 @@ inline static void patch_code_segment( void *code_segment )
{ {
#ifdef __i386__ #ifdef __i386__
CALLFROM16 *call = code_segment; CALLFROM16 *call = code_segment;
if (call->flatcs == __get_cs()) return; /* nothing to patch */ if (call->flatcs == wine_get_cs()) return; /* nothing to patch */
while (call->pushl == 0x68) while (call->pushl == 0x68)
{ {
call->flatcs = __get_cs(); call->flatcs = wine_get_cs();
call++; call++;
} }
#endif #endif
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "selectors.h" #include "selectors.h"
#include "builtin16.h" #include "builtin16.h"
#include "syslevel.h" #include "syslevel.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(relay); WINE_DEFAULT_DEBUG_CHANNEL(relay);
...@@ -59,7 +60,7 @@ BOOL RELAY_Init(void) ...@@ -59,7 +60,7 @@ BOOL RELAY_Init(void)
/* Patch the return addresses for CallTo16 routines */ /* Patch the return addresses for CallTo16 routines */
CallTo16_DataSelector = __get_ds(); CallTo16_DataSelector = wine_get_ds();
CallTo16_RetAddr = CallTo16_RetAddr =
MAKESEGPTR( codesel, (char*)CallTo16_Ret - (char*)Call16_Ret_Start ); MAKESEGPTR( codesel, (char*)CallTo16_Ret - (char*)Call16_Ret_Start );
CALL32_CBClient_RetAddr = CALL32_CBClient_RetAddr =
......
...@@ -113,7 +113,7 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) { ...@@ -113,7 +113,7 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
snr[0].realfun = (DWORD)SNOOP16_Entry; snr[0].realfun = (DWORD)SNOOP16_Entry;
snr[0].lcall = 0x9a; snr[0].lcall = 0x9a;
snr[0].callfromregs = (DWORD)__wine_call_from_16_regs; snr[0].callfromregs = (DWORD)__wine_call_from_16_regs;
snr[0].seg = __get_cs(); snr[0].seg = wine_get_cs();
snr[0].lret = 0xcb66; snr[0].lret = 0xcb66;
snr[1].pushbp = 0x5566; snr[1].pushbp = 0x5566;
...@@ -123,7 +123,7 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) { ...@@ -123,7 +123,7 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
snr[1].realfun = (DWORD)SNOOP16_Return; snr[1].realfun = (DWORD)SNOOP16_Return;
snr[1].lcall = 0x9a; snr[1].lcall = 0x9a;
snr[1].callfromregs = (DWORD)__wine_call_from_16_regs; snr[1].callfromregs = (DWORD)__wine_call_from_16_regs;
snr[1].seg = __get_cs(); snr[1].seg = wine_get_cs();
snr[1].lret = 0xcb66; snr[1].lret = 0xcb66;
} }
while (*dll) { while (*dll) {
......
...@@ -110,4 +110,39 @@ inline static unsigned char wine_ldt_get_flags( const LDT_ENTRY *ent ) ...@@ -110,4 +110,39 @@ inline static unsigned char wine_ldt_get_flags( const LDT_ENTRY *ent )
return ret; return ret;
} }
/* segment register access */
#ifdef __i386__
# ifdef __GNUC__
# define __DEFINE_GET_SEG(seg) \
extern inline unsigned short wine_get_##seg(void) \
{ unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
# define __DEFINE_SET_SEG(seg) \
extern inline void wine_set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }
# elif defined(_MSC_VER)
# define __DEFINE_GET_SEG(seg) \
extern inline unsigned short wine_get_##seg(void) \
{ unsigned short res; __asm { mov res, seg } return res; }
# define __DEFINE_SET_SEG(seg) \
extern inline void wine_set_##seg(unsigned short val) { __asm { mov seg, val } }
# else /* __GNUC__ || _MSC_VER */
# define __DEFINE_GET_SEG(seg) extern unsigned short wine_get_##seg(void);
# define __DEFINE_SET_SEG(seg) extern void wine_set_##seg(unsigned int);
# endif /* __GNUC__ || _MSC_VER */
#else /* __i386__ */
# define __DEFINE_GET_SEG(seg) inline static unsigned short wine_get_##seg(void) { return 0; }
# define __DEFINE_SET_SEG(seg) inline static void wine_set_##seg(int val) { /* nothing */ }
#endif /* __i386__ */
__DEFINE_GET_SEG(cs)
__DEFINE_GET_SEG(ds)
__DEFINE_GET_SEG(es)
__DEFINE_GET_SEG(fs)
__DEFINE_GET_SEG(gs)
__DEFINE_GET_SEG(ss)
__DEFINE_SET_SEG(fs)
__DEFINE_SET_SEG(gs)
#undef __DEFINE_GET_SEG
#undef __DEFINE_SET_SEG
#endif /* __WINE_WINE_LIBRARY_H */ #endif /* __WINE_WINE_LIBRARY_H */
...@@ -1233,40 +1233,6 @@ typedef CONTEXT *PCONTEXT; ...@@ -1233,40 +1233,6 @@ typedef CONTEXT *PCONTEXT;
# endif # endif
#endif /* __GNUC__ */ #endif /* __GNUC__ */
/* Segment register access */
#ifdef __i386__
# ifdef __GNUC__
# define __DEFINE_GET_SEG(seg) \
extern inline unsigned short __get_##seg(void) \
{ unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
# define __DEFINE_SET_SEG(seg) \
extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }
# elif defined(_MSC_VER)
# define __DEFINE_GET_SEG(seg) \
extern inline unsigned short __get_##seg(void) { unsigned short res; __asm { mov res, seg } return res; }
# define __DEFINE_SET_SEG(seg) \
extern inline void __set_##seg(unsigned short val) { __asm { mov seg, val } }
# else /* __GNUC__ || _MSC_VER */
# define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void);
# define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int);
# endif /* __GNUC__ || _MSC_VER */
#else /* __i386__ */
# define __DEFINE_GET_SEG(seg) inline static unsigned short __get_##seg(void) { return 0; }
# define __DEFINE_SET_SEG(seg) /* nothing */
#endif /* __i386__ */
__DEFINE_GET_SEG(cs)
__DEFINE_GET_SEG(ds)
__DEFINE_GET_SEG(es)
__DEFINE_GET_SEG(fs)
__DEFINE_GET_SEG(gs)
__DEFINE_GET_SEG(ss)
__DEFINE_SET_SEG(fs)
__DEFINE_SET_SEG(gs)
#undef __DEFINE_GET_SEG
#undef __DEFINE_SET_SEG
#endif /* __WINE__ */ #endif /* __WINE__ */
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
...@@ -186,3 +187,21 @@ int wine_ldt_set_entry( unsigned short sel, const LDT_ENTRY *entry ) ...@@ -186,3 +187,21 @@ int wine_ldt_set_entry( unsigned short sel, const LDT_ENTRY *entry )
} }
return ret; return ret;
} }
/***********************************************************************
* selector access functions
*/
#ifdef __i386__
# ifndef _MSC_VER
/* Nothing needs to be done for MS C, it will do with inline versions from the winnt.h */
__ASM_GLOBAL_FUNC( wine_get_cs, "movw %cs,%ax\n\tret" )
__ASM_GLOBAL_FUNC( wine_get_ds, "movw %ds,%ax\n\tret" )
__ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" )
__ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" )
__ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" )
__ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" )
__ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
__ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )
# endif /* defined(_MSC_VER) */
#endif /* defined(__i386__) */
...@@ -119,12 +119,12 @@ WORD WINAPI FreeSelector16( WORD sel ) ...@@ -119,12 +119,12 @@ WORD WINAPI FreeSelector16( WORD sel )
#ifdef __i386__ #ifdef __i386__
/* Check if we are freeing current %fs or %gs selector */ /* Check if we are freeing current %fs or %gs selector */
if (!((__get_fs() ^ sel) & ~7)) if (!((wine_get_fs() ^ sel) & ~7))
{ {
WARN("Freeing %%fs selector (%04x), not good.\n", __get_fs() ); WARN("Freeing %%fs selector (%04x), not good.\n", wine_get_fs() );
__set_fs( 0 ); wine_set_fs( 0 );
} }
if (!((__get_gs() ^ sel) & ~7)) __set_gs( 0 ); if (!((wine_get_gs() ^ sel) & ~7)) wine_set_gs( 0 );
#endif /* __i386__ */ #endif /* __i386__ */
wine_ldt_set_entry( sel, &null_entry ); wine_ldt_set_entry( sel, &null_entry );
...@@ -140,11 +140,11 @@ WORD WINAPI FreeSelector16( WORD sel ) ...@@ -140,11 +140,11 @@ WORD WINAPI FreeSelector16( WORD sel )
*/ */
void SELECTOR_FreeFs(void) void SELECTOR_FreeFs(void)
{ {
WORD fs = __get_fs(); WORD fs = wine_get_fs();
if (fs) if (fs)
{ {
wine_ldt_copy.flags[fs >> __AHSHIFT] &= ~WINE_LDT_FLAGS_ALLOCATED; wine_ldt_copy.flags[fs >> __AHSHIFT] &= ~WINE_LDT_FLAGS_ALLOCATED;
__set_fs(0); wine_set_fs(0);
wine_ldt_set_entry( fs, &null_entry ); wine_ldt_set_entry( fs, &null_entry );
} }
} }
...@@ -688,9 +688,9 @@ BOOL WINAPI GetThreadSelectorEntry( HANDLE hthread, DWORD sel, LPLDT_ENTRY ldten ...@@ -688,9 +688,9 @@ BOOL WINAPI GetThreadSelectorEntry( HANDLE hthread, DWORD sel, LPLDT_ENTRY ldten
ldtent->HighWord.Bits.Default_Big = 1; ldtent->HighWord.Bits.Default_Big = 1;
ldtent->HighWord.Bits.Type = 0x12; ldtent->HighWord.Bits.Type = 0x12;
/* it has to be one of the system GDT selectors */ /* it has to be one of the system GDT selectors */
if (sel == (__get_ds() & ~3)) return TRUE; if (sel == (wine_get_ds() & ~3)) return TRUE;
if (sel == (__get_ss() & ~3)) return TRUE; if (sel == (wine_get_ss() & ~3)) return TRUE;
if (sel == (__get_cs() & ~3)) if (sel == (wine_get_cs() & ~3))
{ {
ldtent->HighWord.Bits.Type |= 8; /* code segment */ ldtent->HighWord.Bits.Type |= 8; /* code segment */
return TRUE; return TRUE;
...@@ -936,28 +936,3 @@ void WINAPI FreeMappedBuffer( CONTEXT86 *context ) ...@@ -936,28 +936,3 @@ void WINAPI FreeMappedBuffer( CONTEXT86 *context )
GlobalFree(buffer[0]); GlobalFree(buffer[0]);
} }
} }
#ifdef __i386__
#ifdef _MSC_VER
/* Nothing needs to be done. MS C make do with inline versions from the winnt.h */
#else /* defined(_MSC_VER) */
#define __DEFINE_GET_SEG(seg) \
__ASM_GLOBAL_FUNC( __get_##seg, "movw %" #seg ",%ax\n\tret" )
#define __DEFINE_SET_SEG(seg) \
__ASM_GLOBAL_FUNC( __set_##seg, "movl 4(%esp),%eax\n\tmovw %ax,%" #seg "\n\tret" )
__DEFINE_GET_SEG(cs)
__DEFINE_GET_SEG(ds)
__DEFINE_GET_SEG(es)
__DEFINE_GET_SEG(fs)
__DEFINE_GET_SEG(gs)
__DEFINE_GET_SEG(ss)
__DEFINE_SET_SEG(fs)
__DEFINE_SET_SEG(gs)
#undef __DEFINE_GET_SEG
#undef __DEFINE_SET_SEG
#endif /* defined(_MSC_VER) */
#endif /* defined(__i386__) */
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(thread); WINE_DEFAULT_DEBUG_CHANNEL(thread);
...@@ -84,7 +85,7 @@ void SYSDEPS_SetCurThread( TEB *teb ) ...@@ -84,7 +85,7 @@ void SYSDEPS_SetCurThread( TEB *teb )
{ {
#if defined(__i386__) #if defined(__i386__)
/* On the i386, the current thread is in the %fs register */ /* On the i386, the current thread is in the %fs register */
__set_fs( teb->teb_sel ); wine_set_fs( teb->teb_sel );
#elif defined(HAVE__LWP_CREATE) #elif defined(HAVE__LWP_CREATE)
/* On non-i386 Solaris, we use the LWP private pointer */ /* On non-i386 Solaris, we use the LWP private pointer */
_lwp_setprivate( teb ); _lwp_setprivate( teb );
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "ntddk.h" #include "ntddk.h"
#include "syslevel.h" #include "syslevel.h"
#include "stackframe.h" #include "stackframe.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win32); WINE_DEFAULT_DEBUG_CHANNEL(win32);
...@@ -99,7 +100,7 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock) ...@@ -99,7 +100,7 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock)
teb->sys_count[lock->level] ); teb->sys_count[lock->level] );
if (lock == &Win16Mutex) if (lock == &Win16Mutex)
SYSLEVEL_Win16CurrentTeb = __get_fs(); SYSLEVEL_Win16CurrentTeb = wine_get_fs();
} }
/************************************************************************ /************************************************************************
......
...@@ -29,21 +29,13 @@ ...@@ -29,21 +29,13 @@
#include <ctype.h> #include <ctype.h>
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/library.h"
#include "builtin16.h" #include "builtin16.h"
#include "module.h" #include "module.h"
#include "stackframe.h" #include "stackframe.h"
#include "build.h" #include "build.h"
#ifdef __i386__
#ifdef _MSC_VER
extern unsigned short __get_cs(void) { unsigned short res; __asm { mov res, cs } return res; }
#else
extern unsigned short __get_cs(void);
__ASM_GLOBAL_FUNC( __get_cs, "movw %cs,%ax\n\tret" );
#endif /* defined(_MSC_VER) */
#endif /* defined(__i386__) */
/******************************************************************* /*******************************************************************
* output_file_header * output_file_header
...@@ -631,7 +623,7 @@ void BuildSpec16File( FILE *outfile ) ...@@ -631,7 +623,7 @@ void BuildSpec16File( FILE *outfile )
int code_offset, data_offset, module_size, res_size; int code_offset, data_offset, module_size, res_size;
unsigned char *data; unsigned char *data;
#ifdef __i386__ #ifdef __i386__
unsigned short code_selector = __get_cs(); unsigned short code_selector = wine_get_cs();
#endif #endif
/* File header */ /* File header */
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/library.h"
#include "thread.h" #include "thread.h"
#include "stackframe.h" #include "stackframe.h"
#include "wine/server.h" #include "wine/server.h"
...@@ -148,7 +149,7 @@ static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, in ...@@ -148,7 +149,7 @@ static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, in
if ((len<0) || (len>=size)) if ((len<0) || (len>=size))
return -1; return -1;
#ifdef __i386__ #ifdef __i386__
if (ptr->ContextRecord->SegCs != __get_cs()) if (ptr->ContextRecord->SegCs != wine_get_cs())
len2 = snprintf(buffer+len, size-len, len2 = snprintf(buffer+len, size-len,
" at address 0x%04lx:0x%08lx.\nDo you wish to debug it ?", " at address 0x%04lx:0x%08lx.\nDo you wish to debug it ?",
ptr->ContextRecord->SegCs, ptr->ContextRecord->SegCs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment