Removed some no longer needed definitions from stackframe.h.
diff --git a/dlls/kernel/ne_module.c b/dlls/kernel/ne_module.c
index 0023284..a972b3e 100644
--- a/dlls/kernel/ne_module.c
+++ b/dlls/kernel/ne_module.c
@@ -1400,7 +1400,7 @@
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 @@
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) );
diff --git a/dlls/kernel/task.c b/dlls/kernel/task.c
index 44b4ebc..b2f0ec8 100644
--- a/dlls/kernel/task.c
+++ b/dlls/kernel/task.c
@@ -564,7 +564,7 @@
/* 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 @@
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 @@
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 @@
*/
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 @@
*/
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 */
diff --git a/dlls/kernel/thunk.c b/dlls/kernel/thunk.c
index 6eb451d..47b923d 100644
--- a/dlls/kernel/thunk.c
+++ b/dlls/kernel/thunk.c
@@ -53,6 +53,21 @@
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 @@
{
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])
{
diff --git a/include/stackframe.h b/include/stackframe.h
index a54c9e2..c880adb 100644
--- a/include/stackframe.h
+++ b/include/stackframe.h
@@ -68,49 +68,26 @@
#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 */