Removed some no longer needed definitions from stackframe.h.

This commit is contained in:
Alexandre Julliard 2003-08-27 03:16:56 +00:00
parent f7d71bf158
commit 01634c5686
4 changed files with 35 additions and 46 deletions

View File

@ -1400,7 +1400,7 @@ DWORD NE_StartTask(void)
sp = pSegTable[pModule->ss-1].minsize + pModule->stack_size;
sp &= ~1;
sp -= sizeof(STACK16FRAME);
pTask->teb->cur_stack = MAKESEGPTR( GlobalHandleToSel16(hInstance), sp );
NtCurrentTeb()->cur_stack = MAKESEGPTR( GlobalHandleToSel16(hInstance), sp );
/* Registers at initialization must be:
* ax zero
@ -1428,8 +1428,8 @@ DWORD NE_StartTask(void)
TRACE("Starting main program: cs:ip=%04lx:%04lx ds=%04lx ss:sp=%04x:%04x\n",
context.SegCs, context.Eip, context.SegDs,
SELECTOROF(pTask->teb->cur_stack),
OFFSETOF(pTask->teb->cur_stack) );
SELECTOROF(NtCurrentTeb()->cur_stack),
OFFSETOF(NtCurrentTeb()->cur_stack) );
WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)&context );
ExitThread( LOWORD(context.Eax) );

View File

@ -564,7 +564,7 @@ void WINAPI InitTask16( CONTEXT86 *context )
/* Initialize the INSTANCEDATA structure */
pinstance = MapSL( MAKESEGPTR(CURRENT_DS, 0) );
pinstance->stackmin = OFFSETOF( pTask->teb->cur_stack ) + sizeof( STACK16FRAME );
pinstance->stackmin = OFFSETOF( NtCurrentTeb()->cur_stack ) + sizeof( STACK16FRAME );
pinstance->stackbottom = pinstance->stackmin; /* yup, that's right. Confused me too. */
pinstance->stacktop = ( pinstance->stackmin > LOWORD(context->Ebx) ?
pinstance->stackmin - LOWORD(context->Ebx) : 0 ) + 150;
@ -620,7 +620,7 @@ BOOL16 WINAPI WaitEvent16( HTASK16 hTask )
if (pTask->flags & TDBF_WIN32)
{
FIXME("called for Win32 thread (%04x)!\n", NtCurrentTeb()->teb_sel);
FIXME("called for Win32 thread (%04lx)!\n", NtCurrentTeb()->tid);
return TRUE;
}
@ -659,7 +659,7 @@ void WINAPI PostEvent16( HTASK16 hTask )
if (pTask->flags & TDBF_WIN32)
{
FIXME("called for Win32 thread (%04x)!\n", pTask->teb->teb_sel );
FIXME("called for Win32 thread (%04lx)!\n", pTask->teb->tid );
return;
}
@ -1057,22 +1057,20 @@ HQUEUE16 WINAPI GetFastQueue16( void )
*/
void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
{
TDB *pTask;
STACK16FRAME *oldFrame, *newFrame;
INSTANCEDATA *pData;
UINT16 copySize;
if (!(pTask = TASK_GetCurrent())) return;
if (!(pData = (INSTANCEDATA *)GlobalLock16( seg ))) return;
TRACE("old=%04x:%04x new=%04x:%04x\n",
SELECTOROF( pTask->teb->cur_stack ),
OFFSETOF( pTask->teb->cur_stack ), seg, ptr );
SELECTOROF( NtCurrentTeb()->cur_stack ),
OFFSETOF( NtCurrentTeb()->cur_stack ), seg, ptr );
/* Save the old stack */
oldFrame = THREAD_STACK16( pTask->teb );
oldFrame = CURRENT_STACK16;
/* pop frame + args and push bp */
pData->old_ss_sp = pTask->teb->cur_stack + sizeof(STACK16FRAME)
pData->old_ss_sp = NtCurrentTeb()->cur_stack + sizeof(STACK16FRAME)
+ 2 * sizeof(WORD);
*(WORD *)MapSL(pData->old_ss_sp) = oldFrame->bp;
pData->stacktop = top;
@ -1086,8 +1084,8 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
*/
copySize = oldFrame->bp - OFFSETOF(pData->old_ss_sp);
copySize += 3 * sizeof(WORD) + sizeof(STACK16FRAME);
pTask->teb->cur_stack = MAKESEGPTR( seg, ptr - copySize );
newFrame = THREAD_STACK16( pTask->teb );
NtCurrentTeb()->cur_stack = MAKESEGPTR( seg, ptr - copySize );
newFrame = CURRENT_STACK16;
/* Copy the stack frame and the local variables to the new stack */

View File

@ -53,6 +53,21 @@ extern void __wine_call_from_16_thunk();
static void __wine_call_from_16_thunk() { }
#endif
/* Push a DWORD on the 32-bit stack */
static inline void stack32_push( CONTEXT86 *context, DWORD val )
{
context->Esp -= sizeof(DWORD);
*(DWORD *)context->Esp = val;
}
/* Pop a DWORD from the 32-bit stack */
static inline DWORD stack32_pop( CONTEXT86 *context )
{
DWORD ret = *(DWORD *)context->Esp;
context->Esp += sizeof(DWORD);
return ret;
}
/***********************************************************************
* *
* Win95 internal thunks *
@ -2079,16 +2094,15 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT86 *context )
{
STACK16FRAME *pFrame;
STACK32FRAME *frame32;
TEB *teb = NtCurrentTeb();
SET_AX( context, retval );
/* Find the frame32 corresponding to the frame16 we are jumping to */
pFrame = THREAD_STACK16(teb);
pFrame = CURRENT_STACK16;
frame32 = pFrame->frame32;
while (frame32 && frame32->frame16)
{
if (OFFSETOF(frame32->frame16) < OFFSETOF(teb->cur_stack))
if (OFFSETOF(frame32->frame16) < OFFSETOF(NtCurrentTeb()->cur_stack))
break; /* Something strange is going on */
if (OFFSETOF(frame32->frame16) > lpbuf[2])
{

View File

@ -68,49 +68,26 @@ typedef struct _STACK16FRAME
#include "poppack.h"
#define THREAD_STACK16(teb) ((STACK16FRAME*)MapSL((teb)->cur_stack))
#define CURRENT_STACK16 (THREAD_STACK16(NtCurrentTeb()))
#define CURRENT_STACK16 ((STACK16FRAME*)MapSL(NtCurrentTeb()->cur_stack))
#define CURRENT_DS (CURRENT_STACK16->ds)
/* varargs lists on the 16-bit stack */
#define VA_START16(list) ((list) = (VA_LIST16)(CURRENT_STACK16 + 1))
#define VA_END16(list) ((void)0)
/* Push bytes on the 16-bit stack of a thread;
* return a segptr to the first pushed byte
*/
static inline SEGPTR WINE_UNUSED stack16_push( int size )
{
TEB *teb = NtCurrentTeb();
STACK16FRAME *frame = THREAD_STACK16(teb);
STACK16FRAME *frame = CURRENT_STACK16;
memmove( (char*)frame - size, frame, sizeof(*frame) );
teb->cur_stack -= size;
return (SEGPTR)(teb->cur_stack + sizeof(*frame));
NtCurrentTeb()->cur_stack -= size;
return (SEGPTR)(NtCurrentTeb()->cur_stack + sizeof(*frame));
}
/* Pop bytes from the 16-bit stack of a thread */
static inline void WINE_UNUSED stack16_pop( int size )
{
TEB *teb = NtCurrentTeb();
STACK16FRAME *frame = THREAD_STACK16(teb);
STACK16FRAME *frame = CURRENT_STACK16;
memmove( (char*)frame + size, frame, sizeof(*frame) );
teb->cur_stack += size;
}
/* Push a DWORD on the 32-bit stack */
static inline void WINE_UNUSED stack32_push( CONTEXT86 *context, DWORD val )
{
context->Esp -= sizeof(DWORD);
*(DWORD *)context->Esp = val;
}
/* Pop a DWORD from the 32-bit stack */
static inline DWORD WINE_UNUSED stack32_pop( CONTEXT86 *context )
{
DWORD ret = *(DWORD *)context->Esp;
context->Esp += sizeof(DWORD);
return ret;
NtCurrentTeb()->cur_stack += size;
}
#endif /* __WINE_STACKFRAME_H */