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
1acb481d
Commit
1acb481d
authored
Apr 02, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
krnl386: Avoid using the selector functions from libwine.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9d588819
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
21 deletions
+23
-21
kernel.c
dlls/krnl386.exe16/kernel.c
+2
-2
kernel16_private.h
dlls/krnl386.exe16/kernel16_private.h
+5
-0
ne_module.c
dlls/krnl386.exe16/ne_module.c
+1
-1
relay.c
dlls/krnl386.exe16/relay.c
+1
-1
selector.c
dlls/krnl386.exe16/selector.c
+2
-2
snoop.c
dlls/krnl386.exe16/snoop.c
+2
-2
syslevel.c
dlls/krnl386.exe16/syslevel.c
+1
-1
thunk.c
dlls/krnl386.exe16/thunk.c
+8
-11
wowthunk.c
dlls/krnl386.exe16/wowthunk.c
+1
-1
No files found.
dlls/krnl386.exe16/kernel.c
View file @
1acb481d
...
...
@@ -113,8 +113,8 @@ BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds,
NE_SetEntryPoint
(
inst
,
178
,
GetWinFlags16
()
);
NE_SetEntryPoint
(
inst
,
454
,
wine_
get_cs
()
);
NE_SetEntryPoint
(
inst
,
455
,
wine_
get_ds
()
);
NE_SetEntryPoint
(
inst
,
454
,
get_cs
()
);
NE_SetEntryPoint
(
inst
,
455
,
get_ds
()
);
NE_SetEntryPoint
(
inst
,
183
,
DOSMEM_0000H
);
/* KERNEL.183: __0000H */
NE_SetEntryPoint
(
inst
,
173
,
DOSMEM_BiosSysSeg
);
/* KERNEL.173: __ROMBIOS */
...
...
dlls/krnl386.exe16/kernel16_private.h
View file @
1acb481d
...
...
@@ -261,6 +261,11 @@ extern void SELECTOR_FreeBlock( WORD sel ) DECLSPEC_HIDDEN;
#define IS_SELECTOR_32BIT(sel) \
(ldt_is_system(sel) || (ldt_copy->flags[LOWORD(sel) >> 3] & LDT_FLAGS_32BIT))
static
inline
WORD
get_cs
(
void
)
{
WORD
res
;
__asm__
(
"movw %%cs,%0"
:
"=r"
(
res
)
);
return
res
;
}
static
inline
WORD
get_ds
(
void
)
{
WORD
res
;
__asm__
(
"movw %%ds,%0"
:
"=r"
(
res
)
);
return
res
;
}
static
inline
WORD
get_fs
(
void
)
{
WORD
res
;
__asm__
(
"movw %%fs,%0"
:
"=r"
(
res
)
);
return
res
;
}
static
inline
WORD
get_gs
(
void
)
{
WORD
res
;
__asm__
(
"movw %%gs,%0"
:
"=r"
(
res
)
);
return
res
;
}
/* relay16.c */
extern
int
relay_call_from_16
(
void
*
entry_point
,
unsigned
char
*
args16
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
void
RELAY16_InitDebugLists
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/krnl386.exe16/ne_module.c
View file @
1acb481d
...
...
@@ -95,7 +95,7 @@ static inline void patch_code_segment( NE_MODULE *pModule )
call
[
i
].
glue
=
__wine_call_from_16_regs
;
else
call
[
i
].
glue
=
__wine_call_from_16
;
call
[
i
].
flatcs
=
wine_
get_cs
();
call
[
i
].
flatcs
=
get_cs
();
}
if
(
TRACE_ON
(
relay
))
/* patch relay functions to all point to relay_call_from_16 */
...
...
dlls/krnl386.exe16/relay.c
View file @
1acb481d
...
...
@@ -725,6 +725,6 @@ void DOSVM_BuildCallFrame( CONTEXT *context, DOSRELAY relay, LPVOID data )
/*
* Adjust code pointer.
*/
context
->
SegCs
=
wine_
get_cs
();
context
->
SegCs
=
get_cs
();
context
->
Eip
=
(
DWORD
)
__wine_call_from_16_regs
;
}
dlls/krnl386.exe16/selector.c
View file @
1acb481d
...
...
@@ -72,8 +72,8 @@ static LDT_ENTRY ldt_make_entry( const void *base, unsigned int limit, unsigned
*/
void
init_selectors
(
void
)
{
if
(
!
is_gdt_sel
(
wine_
get_gs
()
))
first_ldt_entry
+=
512
;
if
(
!
is_gdt_sel
(
wine_
get_fs
()
))
first_ldt_entry
+=
512
;
if
(
!
is_gdt_sel
(
get_gs
()
))
first_ldt_entry
+=
512
;
if
(
!
is_gdt_sel
(
get_fs
()
))
first_ldt_entry
+=
512
;
RtlSetBits
(
&
ldt_bitmap
,
0
,
first_ldt_entry
);
ldt_copy
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"ntdll.dll"
),
"__wine_ldt_copy"
);
}
...
...
dlls/krnl386.exe16/snoop.c
View file @
1acb481d
...
...
@@ -116,7 +116,7 @@ SNOOP16_RegisterDLL(HMODULE16 hModule,LPCSTR name) {
snr
[
0
].
realfun
=
(
DWORD
)
SNOOP16_Entry
;
snr
[
0
].
lcall
=
0x9a
;
snr
[
0
].
callfromregs
=
(
DWORD
)
__wine_call_from_16_regs
;
snr
[
0
].
seg
=
wine_
get_cs
();
snr
[
0
].
seg
=
get_cs
();
snr
[
0
].
lret
=
0xcb66
;
snr
[
1
].
pushbp
=
0x5566
;
...
...
@@ -126,7 +126,7 @@ SNOOP16_RegisterDLL(HMODULE16 hModule,LPCSTR name) {
snr
[
1
].
realfun
=
(
DWORD
)
SNOOP16_Return
;
snr
[
1
].
lcall
=
0x9a
;
snr
[
1
].
callfromregs
=
(
DWORD
)
__wine_call_from_16_regs
;
snr
[
1
].
seg
=
wine_
get_cs
();
snr
[
1
].
seg
=
get_cs
();
snr
[
1
].
lret
=
0xcb66
;
}
while
(
*
dll
)
{
...
...
dlls/krnl386.exe16/syslevel.c
View file @
1acb481d
...
...
@@ -108,7 +108,7 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock)
TRACE
(
"(%p, level %d): thread %x count after %d
\n
"
,
lock
,
lock
->
level
,
GetCurrentThreadId
(),
thread_data
->
sys_count
[
lock
->
level
]
);
if
(
lock
==
&
Win16Mutex
)
CallTo16_TebSelector
=
wine_
get_fs
();
if
(
lock
==
&
Win16Mutex
)
CallTo16_TebSelector
=
get_fs
();
}
/************************************************************************
...
...
dlls/krnl386.exe16/thunk.c
View file @
1acb481d
...
...
@@ -1168,7 +1168,7 @@ DEFINE_REGS_ENTRYPOINT( FreeMappedBuffer )
*/
void
WINAPI
GetTEBSelectorFS16
(
void
)
{
CURRENT_STACK16
->
fs
=
wine_
get_fs
();
CURRENT_STACK16
->
fs
=
get_fs
();
}
/**********************************************************************
...
...
@@ -1421,8 +1421,6 @@ UINT WINAPI ThunkConnect16(
void
WINAPI
C16ThkSL
(
CONTEXT
*
context
)
{
LPBYTE
stub
=
MapSL
(
context
->
Eax
),
x
=
stub
;
WORD
cs
=
wine_get_cs
();
WORD
ds
=
wine_get_ds
();
/* We produce the following code:
*
...
...
@@ -1437,7 +1435,7 @@ void WINAPI C16ThkSL(CONTEXT *context)
* call __FLATCS:__wine_call_from_16_thunk
*/
*
x
++
=
0xB8
;
*
(
WORD
*
)
x
=
ds
;
x
+=
sizeof
(
WORD
);
*
x
++
=
0xB8
;
*
(
WORD
*
)
x
=
get_ds
()
;
x
+=
sizeof
(
WORD
);
*
x
++
=
0x8E
;
*
x
++
=
0xC0
;
*
x
++
=
0x66
;
*
x
++
=
0x0F
;
*
x
++
=
0xB7
;
*
x
++
=
0xC9
;
*
x
++
=
0x67
;
*
x
++
=
0x66
;
*
x
++
=
0x26
;
*
x
++
=
0x8B
;
...
...
@@ -1449,7 +1447,7 @@ void WINAPI C16ThkSL(CONTEXT *context)
*
x
++
=
0x66
;
*
x
++
=
0x52
;
*
x
++
=
0x66
;
*
x
++
=
0x9A
;
*
(
void
**
)
x
=
__wine_call_from_16_thunk
;
x
+=
sizeof
(
void
*
);
*
(
WORD
*
)
x
=
cs
;
x
+=
sizeof
(
WORD
);
*
(
WORD
*
)
x
=
get_cs
()
;
x
+=
sizeof
(
WORD
);
/* Jump to the stub code just created */
context
->
Eip
=
LOWORD
(
context
->
Eax
);
...
...
@@ -1474,7 +1472,6 @@ void WINAPI C16ThkSL01(CONTEXT *context)
struct
ThunkDataSL
*
td
=
SL16
->
fpData
;
DWORD
procAddress
=
(
DWORD
)
GetProcAddress16
(
GetModuleHandle16
(
"KERNEL"
),
(
LPCSTR
)
631
);
WORD
cs
=
wine_get_cs
();
if
(
!
td
)
{
...
...
@@ -1507,7 +1504,7 @@ void WINAPI C16ThkSL01(CONTEXT *context)
*
x
++
=
0x66
;
*
x
++
=
0x52
;
*
x
++
=
0x66
;
*
x
++
=
0x9A
;
*
(
void
**
)
x
=
__wine_call_from_16_thunk
;
x
+=
sizeof
(
void
*
);
*
(
WORD
*
)
x
=
cs
;
x
+=
sizeof
(
WORD
);
*
(
WORD
*
)
x
=
get_cs
()
;
x
+=
sizeof
(
WORD
);
/* Jump to the stub code just created */
context
->
Eip
=
LOWORD
(
context
->
Eax
);
...
...
@@ -1979,7 +1976,7 @@ void WINAPI CBClientThunkSL( CONTEXT *context )
SEGPTR
stack
=
stack16_push
(
12
);
LPWORD
stackLin
=
MapSL
(
stack
);
/* stackLin[0] and stackLin[1] reserved for the 32-bit stack ptr */
stackLin
[
2
]
=
wine_get_s
s
();
stackLin
[
2
]
=
get_d
s
();
stackLin
[
3
]
=
0
;
stackLin
[
4
]
=
OFFSETOF
(
stack
)
+
12
;
stackLin
[
5
]
=
SELECTOROF
(
stack
);
...
...
@@ -2007,10 +2004,10 @@ void WINAPI CBClientThunkSLEx( CONTEXT *context )
stackLin
=
MapSL
(
stack
);
stackLin
[
0
]
=
OFFSETOF
(
stack
)
+
4
;
stackLin
[
1
]
=
SELECTOROF
(
stack
);
stackLin
[
2
]
=
wine_
get_ds
();
stackLin
[
2
]
=
get_ds
();
stackLin
[
5
]
=
OFFSETOF
(
stack
)
+
24
;
/* stackLin[6] and stackLin[7] reserved for the 32-bit stack ptr */
stackLin
[
8
]
=
wine_get_s
s
();
stackLin
[
8
]
=
get_d
s
();
stackLin
[
9
]
=
0
;
stackLin
[
10
]
=
OFFSETOF
(
CALL32_CBClientEx_RetAddr
);
stackLin
[
11
]
=
SELECTOROF
(
CALL32_CBClientEx_RetAddr
);
...
...
@@ -2065,7 +2062,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE16 handle, LPSTR func_name)
*
thunk
++
=
0xea
;
*
(
void
**
)
thunk
=
QT_Thunk
;
thunk
+=
sizeof
(
FARPROC16
);
*
(
WORD
*
)
thunk
=
wine_
get_cs
();
*
(
WORD
*
)
thunk
=
get_cs
();
return
MAKESEGPTR
(
code_sel32
,
(
char
*
)
thunk
-
(
char
*
)
ThunkletHeap
);
}
...
...
dlls/krnl386.exe16/wowthunk.c
View file @
1acb481d
...
...
@@ -64,7 +64,7 @@ BOOL WOWTHUNK_Init(void)
/* Patch the return addresses for CallTo16 routines */
CallTo16_DataSelector
=
wine_
get_ds
();
CallTo16_DataSelector
=
get_ds
();
call16_ret_addr
=
MAKESEGPTR
(
codesel
,
(
BYTE
*
)
__wine_call_to_16_ret
-
__wine_call16_start
);
CALL32_CBClient_RetAddr
=
MAKESEGPTR
(
codesel
,
(
BYTE
*
)
CALL32_CBClient_Ret
-
__wine_call16_start
);
...
...
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