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
76ece853
Commit
76ece853
authored
Jan 20, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Moved offset definitions to relay.c since they are only
needed there. Hardcoded a couple of TEB offsets to support cross-compilation.
parent
aaf7a974
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
build.h
tools/winebuild/build.h
+0
-16
relay.c
tools/winebuild/relay.c
+20
-5
No files found.
tools/winebuild/build.h
View file @
76ece853
...
...
@@ -132,22 +132,6 @@ extern enum target_platform target_platform;
#define FLAG_FORWARD 0x80
/* function is a forwarded name */
#define FLAG_EXT_LINK 0x100
/* function links to an external symbol */
/* Offset of a structure field relative to the start of the struct */
#define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
/* Offset of register relative to the start of the CONTEXT struct */
#define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
/* Offset of register relative to the start of the STACK16FRAME struct */
#define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
/* Offset of register relative to the start of the STACK32FRAME struct */
#define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
/* Offset of the stack pointer relative to %fs:(0) */
#define STACKOFFSET (STRUCTOFFSET(TEB,WOW32Reserved))
#define MAX_ORDINALS 65535
/* global functions */
...
...
tools/winebuild/relay.c
View file @
76ece853
...
...
@@ -32,6 +32,21 @@
#include "build.h"
/* offset of a structure field relative to the start of the struct */
#define STRUCTOFFSET(type,field) ((int)FIELD_OFFSET(type,field))
/* offset of register relative to the start of the CONTEXT struct */
#define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
/* offset of register relative to the start of the STACK16FRAME struct */
#define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
/* offset of register relative to the start of the STACK32FRAME struct */
#define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
/* offset of the stack pointer relative to %fs:(0) */
#define STACKOFFSET 0xc0
/* STRUCTOFFSET(TEB,WOW32Reserved) */
/* fix this if the ntdll_thread_regs structure is changed */
#define GS_OFFSET 0x1b0
/* STRUCTOFFSET(TEB,SpareBytes1) + STRUCTOFFSET(ntdll_thread_regs,gs) */
...
...
@@ -182,7 +197,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk )
fprintf
(
outfile
,
"
\t
pushl %%ds
\n
"
);
fprintf
(
outfile
,
"
\t
popl %%ss
\n
"
);
fprintf
(
outfile
,
"
\t
movl %%ebp, %%esp
\n
"
);
fprintf
(
outfile
,
"
\t
addl $%d, %%ebp
\n
"
,
ST
RUCTOFFSET
(
STACK32FRAME
,
ebp
)
);
fprintf
(
outfile
,
"
\t
addl $%d, %%ebp
\n
"
,
ST
ACK32OFFSET
(
ebp
)
);
/* At this point:
...
...
@@ -294,7 +309,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk )
if
(
reg_func
)
{
fprintf
(
outfile
,
"
\t
leal -%d(%%ebp), %%ebx
\n
"
,
sizeof
(
CONTEXT
)
+
ST
RUCTOFFSET
(
STACK32FRAME
,
ebp
)
);
sizeof
(
CONTEXT
)
+
ST
ACK32OFFSET
(
ebp
)
);
/* Switch stack back */
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
movw (%d), %%ss
\n
"
,
STACKOFFSET
+
2
);
...
...
@@ -401,15 +416,15 @@ static void BuildCallTo16Core( FILE *outfile, int reg_func )
/* Setup exception frame */
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
pushl (%d)
\n
"
,
STACKOFFSET
);
fprintf
(
outfile
,
"
\t
pushl 16(%%ebp)
\n
"
);
/* handler */
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
pushl (
%d)
\n
"
,
STRUCTOFFSET
(
TEB
,
Tib
.
ExceptionList
)
);
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
movl %%esp,(
%d)
\n
"
,
STRUCTOFFSET
(
TEB
,
Tib
.
ExceptionList
)
);
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
pushl (
0)
\n
"
);
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
movl %%esp,(
0)
\n
"
);
/* Call the actual CallTo16 routine (simulate a lcall) */
fprintf
(
outfile
,
"
\t
pushl %%cs
\n
"
);
fprintf
(
outfile
,
"
\t
call .L%s
\n
"
,
name
);
/* Remove exception frame */
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
popl (
%d)
\n
"
,
STRUCTOFFSET
(
TEB
,
Tib
.
ExceptionList
)
);
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
popl (
0)
\n
"
);
fprintf
(
outfile
,
"
\t
addl $4, %%esp
\n
"
);
fprintf
(
outfile
,
"
\t
.byte 0x64
\n\t
popl (%d)
\n
"
,
STACKOFFSET
);
...
...
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