Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
59008670
Commit
59008670
authored
May 16, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the selector access functions out of winnt.h into libwine.
parent
ff8a62d8
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
97 additions
and
101 deletions
+97
-101
kernel_main.c
dlls/kernel/kernel_main.c
+3
-2
thunk.c
dlls/kernel/thunk.c
+6
-5
critsection.c
dlls/ntdll/critsection.c
+3
-2
signal_i386.c
dlls/ntdll/signal_i386.c
+7
-6
builtin.c
if1632/builtin.c
+3
-2
relay.c
if1632/relay.c
+2
-1
snoop.c
if1632/snoop.c
+2
-2
library.h
include/wine/library.h
+35
-0
winnt.h
include/winnt.h
+0
-34
ldt.c
library/ldt.c
+19
-0
selector.c
memory/selector.c
+9
-34
sysdeps.c
scheduler/sysdeps.c
+2
-1
syslevel.c
scheduler/syslevel.c
+2
-1
spec16.c
tools/winebuild/spec16.c
+2
-10
except.c
win32/except.c
+2
-1
No files found.
dlls/kernel/kernel_main.c
View file @
59008670
...
@@ -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
)));
...
...
dlls/kernel/thunk.c
View file @
59008670
...
@@ -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
);
}
}
...
...
dlls/ntdll/critsection.c
View file @
59008670
...
@@ -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
);
}
}
}
}
...
...
dlls/ntdll/signal_i386.c
View file @
59008670
...
@@ -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
}
}
...
...
if1632/builtin.c
View file @
59008670
...
@@ -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
...
...
if1632/relay.c
View file @
59008670
...
@@ -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
=
...
...
if1632/snoop.c
View file @
59008670
...
@@ -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
)
{
...
...
include/wine/library.h
View file @
59008670
...
@@ -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 */
include/winnt.h
View file @
59008670
...
@@ -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__ */
...
...
library/ldt.c
View file @
59008670
...
@@ -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\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_get_ds
,
"movw %ds,%ax
\n\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_get_es
,
"movw %es,%ax
\n\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_get_fs
,
"movw %fs,%ax
\n\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_get_gs
,
"movw %gs,%ax
\n\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_get_ss
,
"movw %ss,%ax
\n\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_set_fs
,
"movl 4(%esp),%eax
\n\t
movw %ax,%fs
\n\t
ret"
)
__ASM_GLOBAL_FUNC
(
wine_set_gs
,
"movl 4(%esp),%eax
\n\t
movw %ax,%gs
\n\t
ret"
)
# endif
/* defined(_MSC_VER) */
#endif
/* defined(__i386__) */
memory/selector.c
View file @
59008670
...
@@ -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__) */
scheduler/sysdeps.c
View file @
59008670
...
@@ -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
);
...
...
scheduler/syslevel.c
View file @
59008670
...
@@ -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
();
}
}
/************************************************************************
/************************************************************************
...
...
tools/winebuild/spec16.c
View file @
59008670
...
@@ -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\t
ret"
);
#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 */
...
...
win32/except.c
View file @
59008670
...
@@ -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.
\n
Do you wish to debug it ?"
,
" at address 0x%04lx:0x%08lx.
\n
Do you wish to debug it ?"
,
ptr
->
ContextRecord
->
SegCs
,
ptr
->
ContextRecord
->
SegCs
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment