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
c367dc4f
Commit
c367dc4f
authored
Nov 28, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce 16-byte stack alignment when returning from 16-bit code and
when calling a register function.
parent
1a1583a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
relay.c
tools/winebuild/relay.c
+18
-7
No files found.
tools/winebuild/relay.c
View file @
c367dc4f
...
...
@@ -270,7 +270,16 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk )
#endif
/* Push address of CONTEXT86 structure -- popped by the relay routine */
fprintf
(
outfile
,
"
\t
pushl %%esp
\n
"
);
fprintf
(
outfile
,
"
\t
movl %%esp,%%eax
\n
"
);
fprintf
(
outfile
,
"
\t
andl $~15,%%esp
\n
"
);
fprintf
(
outfile
,
"
\t
subl $4,%%esp
\n
"
);
fprintf
(
outfile
,
"
\t
pushl %%eax
\n
"
);
}
else
{
fprintf
(
outfile
,
"
\t
subl $8,%%esp
\n
"
);
fprintf
(
outfile
,
"
\t
andl $~15,%%esp
\n
"
);
fprintf
(
outfile
,
"
\t
addl $8,%%esp
\n
"
);
}
/* Call relay routine (which will call the API entry point) */
...
...
@@ -726,7 +735,8 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
* (ebp+0) saved ebp
* (ebp-128) buffer area to allow stack frame manipulation
* (ebp-332) CONTEXT86 struct
* (ebp-336) CONTEXT86 *argument
* (ebp-336) padding for stack alignment
* (ebp-336-n) CONTEXT86 *argument
* .... other arguments copied from (ebp+12)
*
* The entry point routine is called with a CONTEXT* extra argument,
...
...
@@ -747,7 +757,7 @@ static void BuildCallFrom32Regs( FILE *outfile )
fprintf
(
outfile
,
"
\t
pushl %%ebp
\n
"
);
fprintf
(
outfile
,
"
\t
movl %%esp,%%ebp
\n
"
);
fprintf
(
outfile
,
"
\t
leal -%d(%%esp), %%esp
\n
"
,
STACK_SPACE
);
fprintf
(
outfile
,
"
\t
leal -%d(%%esp), %%esp
\n
"
,
STACK_SPACE
+
4
/* for context arg */
);
/* Build the context structure */
...
...
@@ -788,17 +798,18 @@ static void BuildCallFrom32Regs( FILE *outfile )
/* Transfer the arguments */
fprintf
(
outfile
,
"
\t
movl 4(%%ebp),%%ebx
\n
"
);
/* get relay code addr */
fprintf
(
outfile
,
"
\t
pushl %%esp
\n
"
);
/* push ptr to context struct */
fprintf
(
outfile
,
"
\t
movzbl 4(%%ebx),%%ecx
\n
"
);
/* fetch number of args to copy */
fprintf
(
outfile
,
"
\t
jecxz 1f
\n
"
);
fprintf
(
outfile
,
"
\t
subl %%ecx,%%esp
\n
"
);
fprintf
(
outfile
,
"
\t
andl $~15,%%esp
\n
"
);
fprintf
(
outfile
,
"
\t
leal 16(%%ebp),%%esi
\n
"
);
/* get %esp at time of call */
fprintf
(
outfile
,
"
\t
movl %%esp,%%edi
\n
"
);
fprintf
(
outfile
,
"
\t
shrl $2,%%ecx
\n
"
);
fprintf
(
outfile
,
"
\t
jz 1f
\n
"
);
fprintf
(
outfile
,
"
\t
cld
\n
"
);
fprintf
(
outfile
,
"
\t
rep
\n\t
movsl
\n
"
);
/* copy args */
fprintf
(
outfile
,
"1:
\t
movzbl 5(%%ebx),%%eax
\n
"
);
/* fetch number of args to remove */
fprintf
(
outfile
,
"1:
\t
leal %d(%%ebp),%%eax
\n
"
,
-
STACK_SPACE
);
/* get addr of context struct */
fprintf
(
outfile
,
"
\t
movl %%eax,(%%edi)
\n
"
);
/* and pass it as extra arg */
fprintf
(
outfile
,
"
\t
movzbl 5(%%ebx),%%eax
\n
"
);
/* fetch number of args to remove */
fprintf
(
outfile
,
"
\t
leal 16(%%ebp,%%eax),%%eax
\n
"
);
fprintf
(
outfile
,
"
\t
movl %%eax,%d(%%ebp)
\n
"
,
CONTEXTOFFSET
(
Esp
)
-
STACK_SPACE
);
...
...
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