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
bba76eed
Commit
bba76eed
authored
Jun 06, 1999
by
Ulrich Weigand
Committed by
Alexandre Julliard
Jun 06, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch stacks in CALL32_Init().
parent
ed490031
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
12 deletions
+26
-12
main.h
include/main.h
+1
-1
main.c
miscemu/main.c
+8
-7
build.c
tools/build.c
+17
-4
No files found.
include/main.h
View file @
bba76eed
...
...
@@ -17,7 +17,7 @@ extern void MAIN_ParseModeOption( char *arg );
extern
BOOL
RELAY_Init
(
void
);
extern
int
RELAY_ShowDebugmsgRelay
(
const
char
*
func
);
extern
void
*
CALL32_Init
(
void
);
extern
void
CALL32_Init
(
void
*
func
,
void
*
target
,
void
*
stack
);
extern
BOOL
THUNK_Init
(
void
);
...
...
miscemu/main.c
View file @
bba76eed
...
...
@@ -158,13 +158,14 @@ int main( int argc, char *argv[] )
if
(
!
(
pModule
=
NE_GetPtr
(
GetModuleHandle16
(
"KERNEL"
)
))
)
return
1
;
if
(
!
TASK_Create
(
THREAD_Current
(),
pModule
,
0
,
0
,
FALSE
)
)
return
1
;
/* Initialize CALL32 routines */
/* This needs to be done just before switching stacks */
IF1632_CallLargeStack
=
(
int
(
*
)(
int
(
*
func
)(),
void
*
arg
))
CALL32_Init
();
/* Switch to initial task */
CURRENT_STACK16
->
frame32
->
retaddr
=
(
DWORD
)
MAIN_EmulatorRun
;
TASK_StartTask
(
PROCESS_Current
()
->
task
);
MSG
(
"main: Should never happen: returned from TASK_StartTask()
\n
"
);
PostEvent16
(
PROCESS_Current
()
->
task
);
TASK_Reschedule
();
/* Switch stacks and jump to MAIN_EmulatorRun */
CALL32_Init
(
&
IF1632_CallLargeStack
,
MAIN_EmulatorRun
,
THREAD_Current
()
->
teb
.
stack_top
);
MSG
(
"main: Should never happen: returned from CALL32_Init()
\n
"
);
return
0
;
}
tools/build.c
View file @
bba76eed
...
...
@@ -2488,11 +2488,20 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
*
* The pointer to the function can be retrieved by calling CALL32_Init,
* which also takes care of saving the current 32-bit stack pointer.
* Furthermore, CALL32_Init switches to a new stack and jumps to the
* specified target address.
*
* NOTE: The CALL32_LargeStack routine may be recursively entered by the
* same thread, but not concurrently entered by several threads.
*
* Stack layout:
* Stack layout of CALL32_Init:
*
* (esp+12) new stack address
* (esp+8) target address
* (esp+4) pointer to variable to receive CALL32_LargeStack address
* (esp) ret addr
*
* Stack layout of CALL32_LargeStack:
* ... ...
* (ebp+12) arg
* (ebp+8) func
...
...
@@ -2510,9 +2519,13 @@ static void BuildCallTo32LargeStack( FILE *outfile )
fprintf
(
outfile
,
"
\t
.globl "
PREFIX
"CALL32_Init
\n
"
);
fprintf
(
outfile
,
"
\t
.type "
PREFIX
"CALL32_Init,@function
\n
"
);
fprintf
(
outfile
,
PREFIX
"CALL32_Init:
\n
"
);
fprintf
(
outfile
,
"
\t
leal -256(%%esp),%%eax
\n
"
);
fprintf
(
outfile
,
"
\t
movl %%eax,CALL32_Original32_esp
\n
"
);
fprintf
(
outfile
,
"
\t
movl $CALL32_LargeStack,%%eax
\n
"
);
fprintf
(
outfile
,
"
\t
movl %%esp,CALL32_Original32_esp
\n
"
);
fprintf
(
outfile
,
"
\t
popl %%eax
\n
"
);
fprintf
(
outfile
,
"
\t
popl %%eax
\n
"
);
fprintf
(
outfile
,
"
\t
movl $CALL32_LargeStack,(%%eax)
\n
"
);
fprintf
(
outfile
,
"
\t
popl %%eax
\n
"
);
fprintf
(
outfile
,
"
\t
popl %%esp
\n
"
);
fprintf
(
outfile
,
"
\t
pushl %%eax
\n
"
);
fprintf
(
outfile
,
"
\t
ret
\n
"
);
/* Function header */
...
...
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