Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8fb98a41
Commit
8fb98a41
authored
Nov 17, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added wine_ldt_is_system() to replace the IS_SELECTOR_SYSTEM macro,
and stop exporting the WINE_LDT_FIRST_ENTRY constant.
parent
ef2d04d4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
21 deletions
+31
-21
instr.c
dlls/kernel/instr.c
+4
-4
wowthunk.c
dlls/kernel/wowthunk.c
+3
-2
signal_i386.c
dlls/ntdll/signal_i386.c
+4
-5
int31.c
dlls/winedos/int31.c
+2
-1
selectors.h
include/selectors.h
+1
-4
library.h
include/wine/library.h
+1
-2
ldt.c
libs/wine/ldt.c
+15
-3
wine.def
libs/wine/wine.def
+1
-0
No files found.
dlls/kernel/instr.c
View file @
8fb98a41
...
...
@@ -54,7 +54,7 @@ inline static void add_stack( CONTEXT86 *context, int offset )
inline
static
void
*
make_ptr
(
CONTEXT86
*
context
,
DWORD
seg
,
DWORD
off
,
int
long_addr
)
{
if
(
ISV86
(
context
))
return
(
void
*
)((
seg
<<
4
)
+
LOWORD
(
off
));
if
(
IS_SELECTOR_SYSTEM
(
seg
))
return
(
void
*
)
off
;
if
(
wine_ldt_is_system
(
seg
))
return
(
void
*
)
off
;
if
(
!
long_addr
)
off
=
LOWORD
(
off
);
return
(
char
*
)
MapSL
(
MAKESEGPTR
(
seg
,
0
)
)
+
off
;
}
...
...
@@ -268,7 +268,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT86 *context, BYTE *instr,
if
(
segprefix
!=
-
1
)
seg
=
segprefix
;
/* Make sure the segment and offset are valid */
if
(
IS_SELECTOR_SYSTEM
(
seg
))
return
(
BYTE
*
)(
base
+
(
index
<<
ss
));
if
(
wine_ldt_is_system
(
seg
))
return
(
BYTE
*
)(
base
+
(
index
<<
ss
));
if
((
seg
&
7
)
!=
7
)
return
NULL
;
wine_ldt_get_entry
(
seg
,
&
entry
);
if
(
wine_ldt_is_empty
(
&
entry
))
return
NULL
;
...
...
@@ -716,7 +716,7 @@ DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
break
;
/* Unable to emulate it */
case
0xcd
:
/* int <XX> */
if
(
IS_SELECTOR_SYSTEM
(
context
->
SegCs
))
break
;
/* don't emulate it in 32-bit code */
if
(
wine_ldt_is_system
(
context
->
SegCs
))
break
;
/* don't emulate it in 32-bit code */
if
(
!
DOS_EmulateInterruptPM
)
init_winedos
();
if
(
DOS_EmulateInterruptPM
)
{
...
...
@@ -727,7 +727,7 @@ DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context )
break
;
/* Unable to emulate it */
case
0xcf
:
/* iret */
if
(
IS_SELECTOR_SYSTEM
(
context
->
SegCs
))
break
;
/* don't emulate it in 32-bit code */
if
(
wine_ldt_is_system
(
context
->
SegCs
))
break
;
/* don't emulate it in 32-bit code */
if
(
long_op
)
{
DWORD
*
stack
=
get_stack
(
context
);
...
...
dlls/kernel/wowthunk.c
View file @
8fb98a41
...
...
@@ -35,6 +35,7 @@
#include "file.h"
#include "task.h"
#include "miscemu.h"
#include "selectors.h"
#include "stackframe.h"
#include "kernel_private.h"
#include "wine/exception.h"
...
...
@@ -182,7 +183,7 @@ static DWORD call16_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RE
else
if
(
record
->
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
||
record
->
ExceptionCode
==
EXCEPTION_PRIV_INSTRUCTION
)
{
if
(
IS_SELECTOR_SYSTEM
(
context
->
SegCs
))
if
(
wine_ldt_is_system
(
context
->
SegCs
))
{
if
(
fix_selector
(
context
))
return
ExceptionContinueExecution
;
}
...
...
@@ -248,7 +249,7 @@ static LONG CALLBACK vectored_handler( EXCEPTION_POINTERS *ptrs )
EXCEPTION_RECORD
*
record
=
ptrs
->
ExceptionRecord
;
CONTEXT
*
context
=
ptrs
->
ContextRecord
;
if
(
IS_SELECTOR_SYSTEM
(
context
->
SegCs
)
&&
if
(
wine_ldt_is_system
(
context
->
SegCs
)
&&
(
record
->
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
||
record
->
ExceptionCode
==
EXCEPTION_PRIV_INSTRUCTION
))
{
...
...
dlls/ntdll/signal_i386.c
View file @
8fb98a41
...
...
@@ -57,7 +57,6 @@
#include "winternl.h"
#include "wine/library.h"
#include "ntdll_misc.h"
#include "selectors.h"
/***********************************************************************
* signal context platform-specific definitions
...
...
@@ -616,8 +615,8 @@ static void *init_handler( const SIGCONTEXT *sigcontext )
wine_set_fs
(
teb
->
teb_sel
);
/* now restore a proper %gs for the fault handler */
if
(
!
IS_SELECTOR_SYSTEM
(
CS_sig
(
sigcontext
))
||
!
IS_SELECTOR_SYSTEM
(
SS_sig
(
sigcontext
)))
/* 16-bit mode */
if
(
!
wine_ldt_is_system
(
CS_sig
(
sigcontext
))
||
!
wine_ldt_is_system
(
SS_sig
(
sigcontext
)))
/* 16-bit mode */
{
/*
* Win16 or DOS protected mode. Note that during switch
...
...
@@ -927,8 +926,8 @@ static void WINAPI raise_vm86_sti_exception( EXCEPTION_RECORD *rec, CONTEXT *con
merge_vm86_pending_flags
(
rec
);
}
else
if
(
NtCurrentTeb
()
->
dpmi_vif
&&
!
IS_SELECTOR_SYSTEM
(
context
->
SegCs
)
&&
!
IS_SELECTOR_SYSTEM
(
context
->
SegSs
))
!
wine_ldt_is_system
(
context
->
SegCs
)
&&
!
wine_ldt_is_system
(
context
->
SegSs
))
{
/* Executing DPMI code and virtual interrupts are enabled. */
NtCurrentTeb
()
->
vm86_pending
=
0
;
...
...
dlls/winedos/int31.c
View file @
8fb98a41
...
...
@@ -29,6 +29,7 @@
#include "wownt32.h"
#include "task.h"
#include "dosexe.h"
#include "selectors.h"
#include "excpt.h"
#include "wine/debug.h"
...
...
@@ -339,7 +340,7 @@ static void DPMI_CallRMCBProc( CONTEXT86 *context, RMCB *rmcb, WORD flag )
/* Disable virtual interrupts. */
NtCurrentTeb
()
->
dpmi_vif
=
0
;
if
(
IS_SELECTOR_SYSTEM
(
rmcb
->
proc_sel
))
{
if
(
wine_ldt_is_system
(
rmcb
->
proc_sel
))
{
/* Wine-internal RMCB, call directly */
((
RMCBPROC
)
rmcb
->
proc_ofs
)(
context
);
}
else
__TRY
{
...
...
include/selectors.h
View file @
8fb98a41
...
...
@@ -28,10 +28,7 @@ extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char fla
extern
WORD
SELECTOR_ReallocBlock
(
WORD
sel
,
const
void
*
base
,
DWORD
size
);
extern
void
SELECTOR_FreeBlock
(
WORD
sel
);
/* Determine if sel is a system selector (i.e. not managed by Wine) */
#define IS_SELECTOR_SYSTEM(sel) \
(!((sel) & 4) || ((LOWORD(sel) >> 3) < WINE_LDT_FIRST_ENTRY))
#define IS_SELECTOR_32BIT(sel) \
(
IS_SELECTOR_SYSTEM
(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT))
(
wine_ldt_is_system
(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT))
#endif
/* __WINE_SELECTORS_H */
include/wine/library.h
View file @
8fb98a41
...
...
@@ -75,6 +75,7 @@ extern void *wine_anon_mmap( void *start, size_t size, int prot, int flags );
extern
void
wine_ldt_init_locking
(
void
(
*
lock_func
)(
void
),
void
(
*
unlock_func
)(
void
)
);
extern
void
wine_ldt_get_entry
(
unsigned
short
sel
,
LDT_ENTRY
*
entry
);
extern
int
wine_ldt_set_entry
(
unsigned
short
sel
,
const
LDT_ENTRY
*
entry
);
extern
int
wine_ldt_is_system
(
unsigned
short
sel
);
extern
void
*
wine_ldt_get_ptr
(
unsigned
short
sel
,
unsigned
int
offset
);
extern
unsigned
short
wine_ldt_alloc_entries
(
int
count
);
extern
unsigned
short
wine_ldt_realloc_entries
(
unsigned
short
sel
,
int
oldcount
,
int
newcount
);
...
...
@@ -115,8 +116,6 @@ WINE_LDT_EXTERN struct __wine_ldt_copy
#define WINE_LDT_FLAGS_32BIT 0x40
/* Segment is 32-bit (code or stack) */
#define WINE_LDT_FLAGS_ALLOCATED 0x80
/* Segment is allocated (no longer free) */
#define WINE_LDT_FIRST_ENTRY 512
/* helper functions to manipulate the LDT_ENTRY structure */
inline
static
void
wine_ldt_set_base
(
LDT_ENTRY
*
ent
,
const
void
*
base
)
{
...
...
libs/wine/ldt.c
View file @
8fb98a41
...
...
@@ -124,6 +124,7 @@ struct __wine_ldt_copy wine_ldt_copy;
static
const
LDT_ENTRY
null_entry
;
/* all-zeros, used to clear LDT entries */
#define LDT_FIRST_ENTRY 512
#define LDT_SIZE 8192
/* empty function for default locks */
...
...
@@ -182,7 +183,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry )
{
int
ret
=
0
,
index
=
sel
>>
3
;
if
(
index
<
WINE_
LDT_FIRST_ENTRY
)
return
0
;
/* cannot modify reserved entries */
if
(
index
<
LDT_FIRST_ENTRY
)
return
0
;
/* cannot modify reserved entries */
#ifdef __i386__
...
...
@@ -257,6 +258,17 @@ int wine_ldt_set_entry( unsigned short sel, const LDT_ENTRY *entry )
/***********************************************************************
* wine_ldt_is_system
*
* Check if the selector is a system selector (i.e. not managed by Wine).
*/
int
wine_ldt_is_system
(
unsigned
short
sel
)
{
return
is_gdt_sel
(
sel
)
||
((
sel
>>
3
)
<
LDT_FIRST_ENTRY
);
}
/***********************************************************************
* wine_ldt_get_ptr
*
* Convert a segment:offset pair to a linear pointer.
...
...
@@ -268,7 +280,7 @@ void *wine_ldt_get_ptr( unsigned short sel, unsigned int offset )
if
(
is_gdt_sel
(
sel
))
/* GDT selector */
return
(
void
*
)
offset
;
if
((
index
=
(
sel
>>
3
))
<
WINE_
LDT_FIRST_ENTRY
)
/* system selector */
if
((
index
=
(
sel
>>
3
))
<
LDT_FIRST_ENTRY
)
/* system selector */
return
(
void
*
)
offset
;
if
(
!
(
wine_ldt_copy
.
flags
[
index
]
&
WINE_LDT_FLAGS_32BIT
))
offset
&=
0xffff
;
return
(
char
*
)
wine_ldt_copy
.
base
[
index
]
+
offset
;
...
...
@@ -287,7 +299,7 @@ unsigned short wine_ldt_alloc_entries( int count )
if
(
count
<=
0
)
return
0
;
lock_ldt
();
for
(
i
=
WINE_
LDT_FIRST_ENTRY
;
i
<
LDT_SIZE
;
i
++
)
for
(
i
=
LDT_FIRST_ENTRY
;
i
<
LDT_SIZE
;
i
++
)
{
if
(
wine_ldt_copy
.
flags
[
i
]
&
WINE_LDT_FLAGS_ALLOCATED
)
size
=
0
;
else
if
(
++
size
>=
count
)
/* found a large enough block */
...
...
libs/wine/wine.def
View file @
8fb98a41
...
...
@@ -51,6 +51,7 @@ EXPORTS
wine_ldt_get_ptr
wine_ldt_init_fs
wine_ldt_init_locking
wine_ldt_is_system
wine_ldt_realloc_entries
wine_ldt_set_entry
wine_set_fs
...
...
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