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
aa5a1162
Commit
aa5a1162
authored
Oct 29, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch flat cs of 16-bit entry points if current %cs is different from
compiled value, and retrieve flat ds from a global variable. This should avoid problems with win4lin kernels.
parent
44f84b55
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
33 deletions
+45
-33
builtin.c
if1632/builtin.c
+17
-0
relay.c
if1632/relay.c
+2
-0
builtin16.h
include/builtin16.h
+2
-2
build.h
tools/winebuild/build.h
+0
-3
main.c
tools/winebuild/main.c
+0
-21
relay.c
tools/winebuild/relay.c
+14
-4
spec16.c
tools/winebuild/spec16.c
+10
-3
No files found.
if1632/builtin.c
View file @
aa5a1162
...
...
@@ -17,6 +17,7 @@
#include "module.h"
#include "miscemu.h"
#include "stackframe.h"
#include "selectors.h"
#include "task.h"
#include "debugtools.h"
#include "toolhelp.h"
...
...
@@ -31,6 +32,21 @@ static const BUILTIN16_DESCRIPTOR *builtin_dlls[MAX_DLLS];
static
int
nb_dlls
;
/* patch all the flat cs references of the code segment if necessary */
inline
static
void
patch_code_segment
(
void
*
code_segment
)
{
#ifdef __i386__
CALLFROM16
*
call
=
code_segment
;
if
(
call
->
flatcs
==
__get_cs
())
return
;
/* nothing to patch */
while
(
call
->
pushl
==
0x68
)
{
call
->
flatcs
=
__get_cs
();
call
++
;
}
#endif
}
/***********************************************************************
* BUILTIN_DoLoadModule16
*
...
...
@@ -62,6 +78,7 @@ static HMODULE16 BUILTIN_DoLoadModule16( const BUILTIN16_DESCRIPTOR *descr )
pSegTable
->
hSeg
=
GLOBAL_CreateBlock
(
GMEM_FIXED
,
descr
->
code_start
,
pSegTable
->
minsize
,
hModule
,
TRUE
,
TRUE
,
FALSE
);
if
(
!
pSegTable
->
hSeg
)
return
0
;
patch_code_segment
(
descr
->
code_start
);
pSegTable
++
;
/* Allocate the data segment */
...
...
if1632/relay.c
View file @
aa5a1162
...
...
@@ -36,6 +36,7 @@ BOOL RELAY_Init(void)
extern
void
CALL32_CBClient_Ret
();
extern
void
CALL32_CBClientEx_Ret
();
extern
SEGPTR
CallTo16_RetAddr
;
extern
DWORD
CallTo16_DataSelector
;
extern
SEGPTR
CALL32_CBClient_RetAddr
;
extern
SEGPTR
CALL32_CBClientEx_RetAddr
;
...
...
@@ -46,6 +47,7 @@ BOOL RELAY_Init(void)
/* Patch the return addresses for CallTo16 routines */
CallTo16_DataSelector
=
__get_ds
();
CallTo16_RetAddr
=
PTR_SEG_OFF_TO_SEGPTR
(
codesel
,
(
char
*
)
CallTo16_Ret
-
(
char
*
)
Call16_Ret_Start
);
CALL32_CBClient_RetAddr
=
...
...
include/builtin16.h
View file @
aa5a1162
...
...
@@ -55,8 +55,8 @@ typedef struct
const
char
*
name
;
/* DLL name */
void
*
module_start
;
/* 32-bit address of the module data */
int
module_size
;
/* Size of the module data */
const
BYTE
*
code_start
;
/* 32-bit address of DLL code */
const
BYTE
*
data_start
;
/* 32-bit address of DLL data */
void
*
code_start
;
/* 32-bit address of DLL code */
void
*
data_start
;
/* 32-bit address of DLL data */
const
char
*
owner
;
/* 32-bit dll that contains this dll */
const
void
*
rsrc
;
/* resources data */
}
BUILTIN16_DESCRIPTOR
;
...
...
tools/winebuild/build.h
View file @
aa5a1162
...
...
@@ -167,9 +167,6 @@ extern int DLLHeapSize;
extern
int
UsePIC
;
extern
int
debugging
;
extern
unsigned
short
code_selector
;
extern
unsigned
short
data_selector
;
extern
char
DLLName
[
80
];
extern
char
DLLFileName
[
80
];
extern
char
DLLInitFunc
[
80
];
...
...
tools/winebuild/main.c
View file @
aa5a1162
...
...
@@ -17,17 +17,6 @@
#include "winnt.h"
#include "build.h"
#ifdef __i386__
extern
WORD
__get_cs
(
void
);
extern
WORD
__get_ds
(
void
);
__ASM_GLOBAL_FUNC
(
__get_cs
,
"movw %cs,%ax
\n\t
ret"
);
__ASM_GLOBAL_FUNC
(
__get_ds
,
"movw %ds,%ax
\n\t
ret"
);
#else
static
inline
WORD
__get_cs
(
void
)
{
return
0
;
}
static
inline
WORD
__get_ds
(
void
)
{
return
0
;
}
#endif
ORDDEF
EntryPoints
[
MAX_ORDINALS
];
ORDDEF
*
Ordinals
[
MAX_ORDINALS
];
ORDDEF
*
Names
[
MAX_ORDINALS
];
...
...
@@ -49,9 +38,6 @@ char owner_name[80];
const
char
*
input_file_name
;
const
char
*
output_file_name
;
unsigned
short
code_selector
;
unsigned
short
data_selector
;
static
FILE
*
input_file
;
static
FILE
*
output_file
;
...
...
@@ -189,13 +175,6 @@ int main(int argc, char **argv)
output_file
=
stdout
;
parse_options
(
argv
);
/* Retrieve the selector values; this assumes that we are building
* the asm files on the platform that will also run them. Probably
* a safe assumption to make.
*/
code_selector
=
__get_cs
();
data_selector
=
__get_ds
();
switch
(
exec_mode
)
{
case
MODE_SPEC
:
...
...
tools/winebuild/relay.c
View file @
aa5a1162
...
...
@@ -120,8 +120,15 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho
fprintf
(
outfile
,
"
\t
addl $_GLOBAL_OFFSET_TABLE_+[.-.LCallFrom16%s.getgot1], %%ecx
\n
"
,
name
);
}
if
(
UsePIC
)
{
fprintf
(
outfile
,
"
\t
.byte 0x2e
\n\t
movl "
PREFIX
"CallTo16_DataSelector@GOT(%%ecx), %%edx
\n
"
);
fprintf
(
outfile
,
"
\t
.byte 0x2e
\n\t
movl (%%edx), %%edx
\n
"
);
}
else
fprintf
(
outfile
,
"
\t
.byte 0x2e
\n\t
movl "
PREFIX
"CallTo16_DataSelector,%%edx
\n
"
);
/* Load 32-bit segment registers */
fprintf
(
outfile
,
"
\t
movw $0x%04x, %%dx
\n
"
,
data_selector
);
#ifdef __svr4__
fprintf
(
outfile
,
"
\t
data16
\n
"
);
#endif
...
...
@@ -690,7 +697,7 @@ static void BuildRet16Func( FILE *outfile )
/* Restore 32-bit segment registers */
fprintf
(
outfile
,
"
\t
movw $0x%04x,%%di
\n
"
,
data_selector
);
fprintf
(
outfile
,
"
\t
.byte 0x2e
\n\t
movl "
PREFIX
"CallTo16_DataSelector-"
PREFIX
"Call16_Ret_Start,%%edi
\n
"
);
#ifdef __svr4__
fprintf
(
outfile
,
"
\t
data16
\n
"
);
#endif
...
...
@@ -715,9 +722,12 @@ static void BuildRet16Func( FILE *outfile )
fprintf
(
outfile
,
"
\t
lret
\n
"
);
/* Declare the return address
variable
*/
/* Declare the return address
and data selector variables
*/
fprintf
(
outfile
,
"
\n\t
.globl "
PREFIX
"CallTo16_RetAddr
\n
"
);
fprintf
(
outfile
,
"
\n\t
.align 4
\n
"
);
fprintf
(
outfile
,
"
\t
.globl "
PREFIX
"CallTo16_DataSelector
\n
"
);
fprintf
(
outfile
,
PREFIX
"CallTo16_DataSelector:
\t
.long 0
\n
"
);
fprintf
(
outfile
,
"
\t
.globl "
PREFIX
"CallTo16_RetAddr
\n
"
);
fprintf
(
outfile
,
PREFIX
"CallTo16_RetAddr:
\t
.long 0
\n
"
);
}
...
...
tools/winebuild/spec16.c
View file @
aa5a1162
...
...
@@ -18,6 +18,13 @@
#include "build.h"
#ifdef __i386__
extern
unsigned
short
__get_cs
(
void
);
__ASM_GLOBAL_FUNC
(
__get_cs
,
"movw %cs,%ax
\n\t
ret"
);
#else
static
inline
unsigned
short
__get_cs
(
void
)
{
return
0
;
}
#endif
/* __i386__ */
/*******************************************************************
* StoreVariableCode
...
...
@@ -497,12 +504,12 @@ void BuildSpec16File( FILE *outfile )
int
i
,
nFuncs
,
nTypes
;
int
code_offset
,
data_offset
,
module_size
,
res_size
;
unsigned
char
*
data
;
unsigned
short
code_selector
=
__get_cs
();
/* File header */
fprintf
(
outfile
,
"/* File generated automatically from %s; do not edit! */
\n\n
"
,
input_file_name
);
fprintf
(
outfile
,
"#define __FLATCS__ 0x%04x
\n
"
,
code_selector
);
fprintf
(
outfile
,
"#include
\"
builtin16.h
\"\n\n
"
);
fprintf
(
outfile
,
"extern void RELAY_Unimplemented16(void);
\n\n
"
);
...
...
@@ -709,8 +716,8 @@ void BuildSpec16File( FILE *outfile )
fprintf
(
outfile
,
"
\"
%s
\"
,
\n
"
,
DLLName
);
fprintf
(
outfile
,
" Module,
\n
"
);
fprintf
(
outfile
,
" sizeof(Module),
\n
"
);
fprintf
(
outfile
,
"
(BYTE *)
&Code_Segment,
\n
"
);
fprintf
(
outfile
,
"
(BYTE *)
Data_Segment,
\n
"
);
fprintf
(
outfile
,
" &Code_Segment,
\n
"
);
fprintf
(
outfile
,
" Data_Segment,
\n
"
);
fprintf
(
outfile
,
"
\"
%s
\"
,
\n
"
,
owner_name
);
fprintf
(
outfile
,
" %s
\n
"
,
res_size
?
"resource_data"
:
"0"
);
fprintf
(
outfile
,
"};
\n
"
);
...
...
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