Changed CONTEXT into CONTEXT86 everywhere we really want an i386
context.
Added #ifdef __i386__ around accesses to 386 registers in the generic
CONTEXT structure.
diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c
index 155c0ee..f18f06e 100644
--- a/loader/dos/dosvm.c
+++ b/loader/dos/dosvm.c
@@ -50,7 +50,7 @@
#undef TRY_PICRETURN
-static void do_exception( int signal, CONTEXT *context )
+static void do_exception( int signal, CONTEXT86 *context )
{
EXCEPTION_RECORD rec;
extern void WINAPI REGS_FUNC(RtlRaiseException)( EXCEPTION_RECORD *rec,
@@ -108,7 +108,7 @@
printf("\n");
}
-static int DOSVM_Int( int vect, PCONTEXT context, LPDOSTASK lpDosTask )
+static int DOSVM_Int( int vect, CONTEXT86 *context, LPDOSTASK lpDosTask )
{
extern UINT16 DPMI_wrap_seg;
@@ -123,7 +123,7 @@
return 0;
}
-static void DOSVM_SimulateInt( int vect, PCONTEXT context, LPDOSTASK lpDosTask )
+static void DOSVM_SimulateInt( int vect, CONTEXT86 *context, LPDOSTASK lpDosTask )
{
FARPROC16 handler=INT_GetRMHandler(vect);
@@ -150,7 +150,7 @@
#define SHOULD_PEND(x) \
(x && ((!lpDosTask->current) || (x->priority < lpDosTask->current->priority)))
-static void DOSVM_SendQueuedEvent(PCONTEXT context, LPDOSTASK lpDosTask)
+static void DOSVM_SendQueuedEvent(CONTEXT86 *context, LPDOSTASK lpDosTask)
{
LPDOSEVENT event = lpDosTask->pending;
@@ -179,7 +179,7 @@
}
}
-static void DOSVM_SendQueuedEvents(PCONTEXT context, LPDOSTASK lpDosTask)
+static void DOSVM_SendQueuedEvents(CONTEXT86 *context, LPDOSTASK lpDosTask)
{
/* we will send all queued events as long as interrupts are enabled,
* but IRQ events will disable interrupts again */
@@ -187,7 +187,7 @@
DOSVM_SendQueuedEvent(context,lpDosTask);
}
-void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,PCONTEXT,void*), void *data)
+void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,CONTEXT86*,void*), void *data)
{
LPDOSTASK lpDosTask = MZ_Current();
LPDOSEVENT event, cur, prev;
@@ -233,7 +233,7 @@
struct vm86plus_struct*VM86 )
{
SIGCONTEXT sigcontext;
- CONTEXT context;
+ CONTEXT86 context;
int ret=0;
if (VM86_TYPE(fn)==VM86_UNKNOWN) {
@@ -391,7 +391,7 @@
} while (TRUE);
}
-int DOSVM_Enter( PCONTEXT context )
+int DOSVM_Enter( CONTEXT86 *context )
{
LPDOSTASK lpDosTask = MZ_Current();
struct vm86plus_struct VM86;
@@ -606,7 +606,7 @@
#else /* !MZ_SUPPORTED */
-int DOSVM_Enter( PCONTEXT context )
+int DOSVM_Enter( CONTEXT86 *context )
{
ERR_(module)("DOS realmode not supported on this architecture!\n");
return -1;
@@ -618,6 +618,6 @@
unsigned DOSVM_GetTimer( void ) { return 0; }
void DOSVM_SetSystemData( int id, void *data ) { free(data); }
void* DOSVM_GetSystemData( int id ) { return NULL; }
-void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,PCONTEXT,void*), void *data) {}
+void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,CONTEXT86*,void*), void *data) {}
#endif
diff --git a/loader/ne/module.c b/loader/ne/module.c
index 04c7d19..827251a 100644
--- a/loader/ne/module.c
+++ b/loader/ne/module.c
@@ -1568,7 +1568,9 @@
*/
void WINAPI REGS_FUNC(MapHInstLS)( CONTEXT *context )
{
+#ifdef __i386__
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
+#endif
}
/***************************************************************************
@@ -1576,7 +1578,9 @@
*/
void WINAPI REGS_FUNC(MapHInstSL)( CONTEXT *context )
{
+#ifdef __i386__
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
+#endif
}
/***************************************************************************
@@ -1584,8 +1588,10 @@
*/
void WINAPI REGS_FUNC(MapHInstLS_PN)( CONTEXT *context )
{
+#ifdef __i386__
if (EAX_reg(context))
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
+#endif
}
/***************************************************************************
@@ -1593,20 +1599,24 @@
*/
void WINAPI REGS_FUNC(MapHInstSL_PN)( CONTEXT *context )
{
+#ifdef __i386__
if (EAX_reg(context))
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
+#endif
}
/***************************************************************************
* WIN16_MapHInstLS (KERNEL.472)
*/
-VOID WINAPI WIN16_MapHInstLS( CONTEXT *context ) {
+VOID WINAPI WIN16_MapHInstLS( CONTEXT86 *context )
+{
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
}
/***************************************************************************
* WIN16_MapHInstSL (KERNEL.473)
*/
-VOID WINAPI WIN16_MapHInstSL( CONTEXT *context ) {
+VOID WINAPI WIN16_MapHInstSL( CONTEXT86 *context )
+{
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
}
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index c6e5d72..9d57323 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -623,7 +623,7 @@
{
SEGTABLEENTRY *pSegTable;
WORD hInst, ds, heap;
- CONTEXT context;
+ CONTEXT86 context;
pSegTable = NE_SEG_TABLE( pModule );
@@ -678,7 +678,7 @@
WORD hInst, ds, heap;
FARPROC16 entryPoint;
WORD ordinal;
- CONTEXT context;
+ CONTEXT86 context;
LPBYTE stack = (LPBYTE)CURRENT_STACK16;
if (!(pModule->flags & NE_FFLAGS_BUILTIN) && pModule->expected_version < 0x0400) return;
diff --git a/loader/task.c b/loader/task.c
index 0cfc833..9ff7fed 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -231,7 +231,7 @@
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
NE_MODULE *pModule = NE_GetPtr( pTask->hModule );
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
- CONTEXT context;
+ CONTEXT86 context;
/* Add task to 16-bit scheduler pool */
TASK_Reschedule();
@@ -717,7 +717,7 @@
*
* Called by the application startup code.
*/
-void WINAPI InitTask16( CONTEXT *context )
+void WINAPI InitTask16( CONTEXT86 *context )
{
TDB *pTask;
NE_MODULE *pModule;
@@ -1210,7 +1210,7 @@
/***********************************************************************
* SwitchStackBack (KERNEL.109)
*/
-void WINAPI SwitchStackBack16( CONTEXT *context )
+void WINAPI SwitchStackBack16( CONTEXT86 *context )
{
STACK16FRAME *oldFrame, *newFrame;
INSTANCEDATA *pData;
@@ -1254,7 +1254,7 @@
/***********************************************************************
* GetTaskQueueDS (KERNEL.118)
*/
-void WINAPI GetTaskQueueDS16( CONTEXT *context )
+void WINAPI GetTaskQueueDS16( CONTEXT86 *context )
{
DS_reg(context) = GlobalHandleToSel16( GetTaskQueue16(0) );
}
@@ -1263,7 +1263,7 @@
/***********************************************************************
* GetTaskQueueES (KERNEL.119)
*/
-void WINAPI GetTaskQueueES16( CONTEXT *context )
+void WINAPI GetTaskQueueES16( CONTEXT86 *context )
{
ES_reg(context) = GlobalHandleToSel16( GetTaskQueue16(0) );
}
@@ -1374,7 +1374,7 @@
/***********************************************************************
* GetDummyModuleHandleDS (KERNEL.602)
*/
-VOID WINAPI GetDummyModuleHandleDS16( CONTEXT *context )
+VOID WINAPI GetDummyModuleHandleDS16( CONTEXT86 *context )
{
TDB *pTask;
WORD selector;
@@ -1513,7 +1513,7 @@
return GetExePtrHelper( handle, &dummy );
}
-void WINAPI WIN16_GetExePtr( CONTEXT *context )
+void WINAPI WIN16_GetExePtr( CONTEXT86 *context )
{
WORD *stack = PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context));
HANDLE16 handle = (HANDLE16)stack[2];