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/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
index 147b6a4..b250efc 100644
--- a/dlls/ntdll/exception.c
+++ b/dlls/ntdll/exception.c
@@ -223,7 +223,9 @@
     EXCEPTION_RECORD record, newrec;
     PEXCEPTION_FRAME frame, dispatch;
 
+#ifdef __i386__
     EAX_reg(context) = returnEax;
+#endif
 
     /* build an exception record, if we do not have one */
     if (!pRecord)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 8e9ec99..f31d046 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -376,11 +376,15 @@
  */
 void WINAPI REGS_FUNC(NTDLL_chkstk)( CONTEXT *context )
 {
+#ifdef __i386__
     ESP_reg(context) -= EAX_reg(context);
+#endif
 }
 void WINAPI REGS_FUNC(NTDLL_alloca_probe)( CONTEXT *context )
 {
+#ifdef __i386__
     ESP_reg(context) -= EAX_reg(context);
+#endif
 }
 
 /******************************************************************************
diff --git a/dlls/winaspi/winaspi16.c b/dlls/winaspi/winaspi16.c
index 09fa06b..0553a93 100644
--- a/dlls/winaspi/winaspi16.c
+++ b/dlls/winaspi/winaspi16.c
@@ -511,7 +511,7 @@
 }
 
 
-void WINAPI ASPI_DOS_func(CONTEXT *context)
+void WINAPI ASPI_DOS_func(CONTEXT86 *context)
 {
 	WORD *stack = CTX_SEG_OFF_TO_LIN(context, SS_reg(context), ESP_reg(context));
 	DWORD ptrSRB = *(DWORD *)&stack[2];
@@ -526,7 +526,7 @@
 
 
 /* returns the address of a real mode callback to ASPI_DOS_func() */
-void ASPI_DOS_HandleInt(CONTEXT *context)
+void ASPI_DOS_HandleInt(CONTEXT86 *context)
 {
 #ifdef linux
 	FARPROC16 *p = (FARPROC16 *)CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context));
diff --git a/if1632/builtin.c b/if1632/builtin.c
index 67fac62..4818aaf 100644
--- a/if1632/builtin.c
+++ b/if1632/builtin.c
@@ -321,7 +321,7 @@
  *
  * Default interrupt handler.
  */
-void BUILTIN_DefaultIntHandler( CONTEXT *context )
+void BUILTIN_DefaultIntHandler( CONTEXT86 *context )
 {
     WORD ordinal;
     STACK16FRAME *frame = CURRENT_STACK16;
diff --git a/if1632/relay.c b/if1632/relay.c
index 65f0a74..94f079b 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -73,7 +73,7 @@
  *           RELAY_DebugCallFrom16
  */
 void RELAY_DebugCallFrom16( int func_type, char *args,
-                            void *entry_point, CONTEXT *context )
+                            void *entry_point, CONTEXT86 *context )
 {
     STACK16FRAME *frame;
     WORD ordinal;
@@ -197,7 +197,7 @@
 /***********************************************************************
  *           RELAY_DebugCallFrom16Ret
  */
-void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, CONTEXT *context)
+void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, CONTEXT86 *context)
 {
     STACK16FRAME *frame;
     WORD ordinal;
@@ -269,7 +269,7 @@
 
     if (nb_args == -1)  /* Register function */
     {
-        CONTEXT *context = (CONTEXT *)stack[0];
+        CONTEXT86 *context = (CONTEXT86 *)stack[0];
         WORD *stack16 = (WORD *)THREAD_STACK16(teb);
         DPRINTF("CallTo16(func=%04lx:%04x,ds=%04lx",
                 CS_reg(context), IP_reg(context), DS_reg(context) );
@@ -323,7 +323,7 @@
  * Real prototype is:
  *   INT16 WINAPI Catch( LPCATCHBUF lpbuf );
  */
-void WINAPI Catch16( CONTEXT *context )
+void WINAPI Catch16( CONTEXT86 *context )
 {
     VA_LIST16 valist;
     SEGPTR buf;
@@ -370,7 +370,7 @@
  * Real prototype is:
  *   INT16 WINAPI Throw( LPCATCHBUF lpbuf, INT16 retval );
  */
-void WINAPI Throw16( CONTEXT *context )
+void WINAPI Throw16( CONTEXT86 *context )
 {
     VA_LIST16 valist;
     SEGPTR buf;
diff --git a/if1632/snoop.c b/if1632/snoop.c
index e2be0bc..52e3bce 100644
--- a/if1632/snoop.c
+++ b/if1632/snoop.c
@@ -22,8 +22,8 @@
 
 #include "pshpack1.h"
 
-void WINAPI SNOOP16_Entry(CONTEXT *context);
-void WINAPI SNOOP16_Return(CONTEXT *context);
+void WINAPI SNOOP16_Entry(CONTEXT86 *context);
+void WINAPI SNOOP16_Return(CONTEXT86 *context);
 extern void CallFrom16_p_regs_();
 
 /* Generic callfrom16_p_regs function entry.
@@ -209,7 +209,7 @@
 }
 
 #define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context)+4)))
-void WINAPI SNOOP16_Entry(CONTEXT *context) {
+void WINAPI SNOOP16_Entry(CONTEXT86 *context) {
 	DWORD		ordinal=0;
 	DWORD		entry=(DWORD)PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5;
 	WORD		xcs = CS_reg(context);
@@ -276,7 +276,7 @@
 	DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
 }
 
-void WINAPI SNOOP16_Return(CONTEXT *context) {
+void WINAPI SNOOP16_Return(CONTEXT86 *context) {
 	SNOOP16_RETURNENTRY	*ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5);
 
 	/* We haven't found out the nrofargs yet. If we called a cdecl
diff --git a/if1632/thunk.c b/if1632/thunk.c
index 30fe33b..032e4de 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -30,8 +30,8 @@
 /* by the build program to generate the file if1632/callto16.S */
 
 /* ### start build ### */
-extern LONG CALLBACK CallTo16_sreg_(const CONTEXT *context, INT offset);
-extern LONG CALLBACK CallTo16_lreg_(const CONTEXT *context, INT offset);
+extern LONG CALLBACK CallTo16_sreg_(const CONTEXT86 *context, INT offset);
+extern LONG CALLBACK CallTo16_lreg_(const CONTEXT86 *context, INT offset);
 extern WORD CALLBACK CallTo16_word_     (FARPROC16);
 extern LONG CALLBACK CallTo16_long_     (FARPROC16);
 extern WORD CALLBACK CallTo16_word_w    (FARPROC16,WORD);
@@ -251,7 +251,7 @@
                                            UINT16 msg, WPARAM16 wParam,
                                            LPARAM lParam )
 {
-    CONTEXT context;
+    CONTEXT86 context;
     LRESULT ret;
     WORD *args;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
@@ -700,7 +700,7 @@
                                              DWORD dwFlags, DWORD dx, DWORD dy,
                                              DWORD cButtons, DWORD dwExtraInfo )
 {
-    CONTEXT context;
+    CONTEXT86 context;
 
     memset( &context, 0, sizeof(context) );
     CS_reg(&context)  = SELECTOROF( proc );
@@ -748,7 +748,7 @@
 /***********************************************************************
  *           WIN16_mouse_event   (USER.299)
  */
-void WINAPI WIN16_mouse_event( CONTEXT *context )
+void WINAPI WIN16_mouse_event( CONTEXT86 *context )
 {
     mouse_event( AX_reg(context), BX_reg(context), CX_reg(context),
                  DX_reg(context), MAKELONG(SI_reg(context), DI_reg(context)) );
@@ -762,7 +762,7 @@
                                              BYTE bVk, BYTE bScan,
                                              DWORD dwFlags, DWORD dwExtraInfo )
 {
-    CONTEXT context;
+    CONTEXT86 context;
 
     memset( &context, 0, sizeof(context) );
     CS_reg(&context)  = SELECTOROF( proc );
@@ -800,7 +800,7 @@
 /***********************************************************************
  *           WIN16_keybd_event   (USER.289)
  */
-void WINAPI WIN16_keybd_event( CONTEXT *context )
+void WINAPI WIN16_keybd_event( CONTEXT86 *context )
 {
     DWORD dwFlags = 0;
     
@@ -817,7 +817,7 @@
  */
 static void THUNK_CallSystemTimerProc( FARPROC16 proc, WORD timer )
 {
-    CONTEXT context;
+    CONTEXT86 context;
     memset( &context, '\0', sizeof(context) );
 
     CS_reg( &context ) = SELECTOROF( proc );
@@ -1004,7 +1004,7 @@
  *           C16ThkSL                           (KERNEL.630)
  */
 
-void WINAPI C16ThkSL(CONTEXT *context)
+void WINAPI C16ThkSL(CONTEXT86 *context)
 {
     extern void CallFrom16_t_long_(void);
     LPBYTE stub = PTR_SEG_TO_LIN(EAX_reg(context)), x = stub;
@@ -1047,7 +1047,7 @@
  *           C16ThkSL01                         (KERNEL.631)
  */
 
-void WINAPI C16ThkSL01(CONTEXT *context)
+void WINAPI C16ThkSL01(CONTEXT86 *context)
 {
     LPBYTE stub = PTR_SEG_TO_LIN(EAX_reg(context)), x = stub;
 
@@ -1508,7 +1508,7 @@
 /***********************************************************************
  *     CBClientGlueSL                      (KERNEL.604)
  */
-void WINAPI CBClientGlueSL( CONTEXT *context )
+void WINAPI CBClientGlueSL( CONTEXT86 *context )
 {
     /* Create stack frame */
     SEGPTR stackSeg = STACK16_PUSH( NtCurrentTeb(), 12 );
@@ -1533,7 +1533,7 @@
 /***********************************************************************
  *     CBClientThunkSL                      (KERNEL.620)
  */
-void WINAPI CBClientThunkSL( CONTEXT *context )
+void WINAPI CBClientThunkSL( CONTEXT86 *context )
 {
     /* Call 32-bit relay code */
     extern DWORD WINAPI CALL32_CBClient( FARPROC proc, LPWORD args, DWORD *esi );
@@ -1547,7 +1547,7 @@
 /***********************************************************************
  *     CBClientThunkSLEx                    (KERNEL.621)
  */
-void WINAPI CBClientThunkSLEx( CONTEXT *context )
+void WINAPI CBClientThunkSLEx( CONTEXT86 *context )
 {
     /* Call 32-bit relay code */
     extern DWORD WINAPI CALL32_CBClientEx( FARPROC proc, LPWORD args, 
diff --git a/include/callback.h b/include/callback.h
index 059b573..bb3dae3 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -20,8 +20,8 @@
 
 typedef struct
 {
-    LONG (CALLBACK *CallRegisterShortProc)( CONTEXT *, INT );
-    LONG (CALLBACK *CallRegisterLongProc)( CONTEXT *, INT );
+    LONG (CALLBACK *CallRegisterShortProc)( CONTEXT86 *, INT );
+    LONG (CALLBACK *CallRegisterLongProc)( CONTEXT86 *, INT );
     VOID (CALLBACK *CallFrom16WndProc)(void);
     LRESULT (CALLBACK *CallWndProc)( WNDPROC16, HWND16, UINT16,
                                      WPARAM16, LPARAM );
diff --git a/include/dosexe.h b/include/dosexe.h
index 666c500..9c27003 100644
--- a/include/dosexe.h
+++ b/include/dosexe.h
@@ -40,7 +40,7 @@
 
 typedef struct _DOSEVENT {
   int irq,priority;
-  void (*relay)(LPDOSTASK,PCONTEXT,void*);
+  void (*relay)(LPDOSTASK,CONTEXT86*,void*);
   void *data;
   struct _DOSEVENT *next;
 } DOSEVENT, *LPDOSEVENT;
@@ -68,9 +68,9 @@
                               BOOL inherit, DWORD flags, LPSTARTUPINFOA startup, 
                               LPPROCESS_INFORMATION info );
 extern LPDOSTASK MZ_Current( void );
-extern int DOSVM_Enter( PCONTEXT context );
+extern int DOSVM_Enter( CONTEXT86 *context );
 extern void DOSVM_Wait( int read_pipe, HANDLE hObject );
-extern void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,PCONTEXT,void*), void *data );
+extern void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,CONTEXT86*,void*), void *data );
 extern void DOSVM_PIC_ioport_out( WORD port, BYTE val );
 extern void DOSVM_SetTimer( unsigned ticks );
 extern unsigned DOSVM_GetTimer( void );
diff --git a/include/miscemu.h b/include/miscemu.h
index 969ed40..b27c070 100644
--- a/include/miscemu.h
+++ b/include/miscemu.h
@@ -109,9 +109,9 @@
 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
-extern FARPROC16 INT_CtxGetHandler( CONTEXT *context, BYTE intnum );
-extern void INT_CtxSetHandler( CONTEXT *context, BYTE intnum, FARPROC16 handler );
-extern int INT_RealModeInterrupt( BYTE intnum, PCONTEXT context );
+extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
+extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
+extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
 
 /* msdos/ioports.c */
 extern void IO_port_init (void);
@@ -119,67 +119,67 @@
 extern void IO_outport( int port, int count, DWORD value );
 
 /* msdos/int09.c */
-extern void WINAPI INT_Int09Handler(CONTEXT*);
+extern void WINAPI INT_Int09Handler(CONTEXT86*);
 extern void WINAPI INT_Int09SendScan(BYTE);
 extern BYTE WINAPI INT_Int09ReadScan(void);
 
 /* msdos/int10.c */
-extern void WINAPI INT_Int10Handler(CONTEXT*);
+extern void WINAPI INT_Int10Handler(CONTEXT86*);
 
 /* msdos/int11.c */
-extern void WINAPI INT_Int11Handler(CONTEXT*);
+extern void WINAPI INT_Int11Handler(CONTEXT86*);
 
 /* msdos/int12.c */
-extern void WINAPI INT_Int12Handler(CONTEXT*);
+extern void WINAPI INT_Int12Handler(CONTEXT86*);
 
 /* msdos/int13.c */
-extern void WINAPI INT_Int13Handler(CONTEXT*);
+extern void WINAPI INT_Int13Handler(CONTEXT86*);
 
 /* msdos/int15.c */
-extern void WINAPI INT_Int15Handler(CONTEXT*);
+extern void WINAPI INT_Int15Handler(CONTEXT86*);
 
 /* msdos/int16.c */
-extern void WINAPI INT_Int16Handler(CONTEXT*);
+extern void WINAPI INT_Int16Handler(CONTEXT86*);
 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
 
 /* msdos/int17.c */
-extern void WINAPI INT_Int17Handler(CONTEXT*);
+extern void WINAPI INT_Int17Handler(CONTEXT86*);
 
 /* msdos/int19.c */
-extern void WINAPI INT_Int19Handler(CONTEXT*);
+extern void WINAPI INT_Int19Handler(CONTEXT86*);
 
 /* msdos/int1a.c */
 extern DWORD INT1A_GetTicksSinceMidnight(void);
-extern void WINAPI INT_Int1aHandler(CONTEXT*);
+extern void WINAPI INT_Int1aHandler(CONTEXT86*);
 
 /* msdos/int20.c */
-extern void WINAPI INT_Int20Handler(CONTEXT*);
+extern void WINAPI INT_Int20Handler(CONTEXT86*);
 
 /* msdos/int25.c */
-extern void WINAPI INT_Int25Handler(CONTEXT*);
+extern void WINAPI INT_Int25Handler(CONTEXT86*);
 
 /* msdos/int26.c */
-extern void WINAPI INT_Int26Handler(CONTEXT*);
+extern void WINAPI INT_Int26Handler(CONTEXT86*);
 
 /* msdos/int29.c */
-extern void WINAPI INT_Int29Handler(CONTEXT*);
+extern void WINAPI INT_Int29Handler(CONTEXT86*);
 
 /* msdos/int2f.c */
-extern void WINAPI INT_Int2fHandler(CONTEXT*);
+extern void WINAPI INT_Int2fHandler(CONTEXT86*);
 
 /* msdos/int33.c */
-extern void WINAPI INT_Int33Handler(CONTEXT*);
+extern void WINAPI INT_Int33Handler(CONTEXT86*);
 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
 
 /* msdos/dpmi.c */
-typedef void WINAPI (*RMCBPROC)(CONTEXT*);
-extern void WINAPI INT_Int31Handler(CONTEXT*);
+typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
+extern void WINAPI INT_Int31Handler(CONTEXT86*);
 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
-extern int DPMI_CallRMProc(CONTEXT*,LPWORD,int,int);
+extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
 
 /* msdos/xms.c */
-extern void WINAPI XMS_Handler(CONTEXT*);
+extern void WINAPI XMS_Handler(CONTEXT86*);
 
 /* loader/signal.c */
 extern BOOL SIGNAL_Init(void);
@@ -187,7 +187,7 @@
 extern void SIGNAL_MaskAsyncEvents( BOOL flag );
 
 /* misc/aspi.c */
-extern void ASPI_DOS_HandleInt(CONTEXT *context);
+extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
 
 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and 
  *        (via DeviceIoControl) 32-bit. For automatic conversion of pointer 
diff --git a/include/msdos.h b/include/msdos.h
index 050870e..0a9d3c6 100644
--- a/include/msdos.h
+++ b/include/msdos.h
@@ -189,7 +189,7 @@
 #define EL_Serial            0x04
 #define EL_Memory            0x05
 
-void WINAPI DOS3Call( CONTEXT *context );
+void WINAPI DOS3Call( CONTEXT86 *context );
 
 #define DOSCONF_MEM_HIGH        0x0001
 #define DOSCONF_MEM_UMB         0x0002
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];
diff --git a/memory/global.c b/memory/global.c
index ecd908a..a9510d4 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -547,7 +547,7 @@
  * *all* registers, even AX/DX !
  *
  */
-void WINAPI GlobalChangeLockCount16( CONTEXT *context )
+void WINAPI GlobalChangeLockCount16( CONTEXT86 *context )
 {
     LPWORD args = PTR_SEG_OFF_TO_LIN( SS_reg( context ), SP_reg( context ) );
     HGLOBAL16 handle = (HGLOBAL16)args[3];
diff --git a/memory/local.c b/memory/local.c
index 10c46fc..b2ece29 100644
--- a/memory/local.c
+++ b/memory/local.c
@@ -1527,7 +1527,7 @@
 /***********************************************************************
  *           WIN16_LocalAlloc
  */
-void WINAPI WIN16_LocalAlloc( CONTEXT *context )
+void WINAPI WIN16_LocalAlloc( CONTEXT86 *context )
 {
     WORD *stack = PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context));
     UINT16 flags = (UINT16)stack[3];
diff --git a/memory/selector.c b/memory/selector.c
index 1a2891c..6a7ed4f 100644
--- a/memory/selector.c
+++ b/memory/selector.c
@@ -628,6 +628,7 @@
  */
 static void
 x_SMapLS_IP_EBP_x(CONTEXT *context,int argoff) {
+#ifdef __i386__
     DWORD	val,ptr; 
 
     val =*(DWORD*)(EBP_reg(context)+argoff);
@@ -639,6 +640,7 @@
 	*(DWORD*)(EBP_reg(context)+argoff) = ptr;
     }
     EAX_reg(context) = ptr;
+#endif
 }
 
 void WINAPI REGS_FUNC(SMapLS_IP_EBP_8)(CONTEXT *context)  {x_SMapLS_IP_EBP_x(context,8);}
@@ -653,25 +655,31 @@
 
 void WINAPI REGS_FUNC(SMapLS)( CONTEXT *context )
 {
+#ifdef __i386__
     if (EAX_reg(context)>=0x10000) {
 	EAX_reg(context) = MapLS((LPVOID)EAX_reg(context));
 	EDX_reg(context) = EAX_reg(context);
     } else {
 	EDX_reg(context) = 0;
     }
+#endif
 }
 
 void WINAPI REGS_FUNC(SUnMapLS)( CONTEXT *context )
 {
+#ifdef __i386__
     if (EAX_reg(context)>=0x10000)
 	UnMapLS((SEGPTR)EAX_reg(context));
+#endif
 }
 
 static void
 x_SUnMapLS_IP_EBP_x(CONTEXT *context,int argoff) {
+#ifdef __i386__
 	if (*(DWORD*)(EBP_reg(context)+argoff))
 		UnMapLS(*(DWORD*)(EBP_reg(context)+argoff));
 	*(DWORD*)(EBP_reg(context)+argoff)=0;
+#endif
 }
 void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_8)(CONTEXT *context)  { x_SUnMapLS_IP_EBP_x(context,8); }
 void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_12)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,12); }
@@ -704,6 +712,7 @@
 
 void WINAPI REGS_FUNC(AllocMappedBuffer)( CONTEXT *context )
 {
+#ifdef __i386__
     HGLOBAL handle = GlobalAlloc(0, EDI_reg(context) + 8);
     DWORD *buffer = (DWORD *)GlobalLock(handle);
     SEGPTR ptr = 0;
@@ -725,6 +734,7 @@
         EAX_reg(context) = (DWORD) ptr;
         EDI_reg(context) = (DWORD)(buffer + 2);
     }
+#endif
 }
 
 /**********************************************************************
@@ -737,6 +747,7 @@
 
 void WINAPI REGS_FUNC(FreeMappedBuffer)( CONTEXT *context )
 {
+#ifdef __i386__
     if (EDI_reg(context))
     {
         DWORD *buffer = (DWORD *)EDI_reg(context) - 2;
@@ -746,6 +757,7 @@
         GlobalUnlock(buffer[0]);
         GlobalFree(buffer[0]);
     }
+#endif
 }
 
 /**********************************************************************
diff --git a/misc/callback.c b/misc/callback.c
index 567653a..e7d48fb 100644
--- a/misc/callback.c
+++ b/misc/callback.c
@@ -40,7 +40,7 @@
 /**********************************************************************
  *	     CALLBACK_CallRegisterProc
  */
-static LONG WINAPI CALLBACK_CallRegisterProc( CONTEXT *context, INT offset)
+static LONG WINAPI CALLBACK_CallRegisterProc( CONTEXT86 *context, INT offset)
 {
     ERR(relay, "Cannot call a register proc in Winelib\n" );
     assert( FALSE );
diff --git a/misc/error.c b/misc/error.c
index 9fed9d0..52be9f7 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -158,7 +158,7 @@
 /***********************************************************************
 *	HandleParamError (KERNEL.327)
 */
-void WINAPI HandleParamError( CONTEXT *context )
+void WINAPI HandleParamError( CONTEXT86 *context )
 {
 	UINT16 uErr = BX_reg( context );
         FARPROC16 lpfn = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( CS_reg(context),
diff --git a/misc/windebug.c b/misc/windebug.c
index 0e4a01e..e1509fa 100644
--- a/misc/windebug.c
+++ b/misc/windebug.c
@@ -16,7 +16,7 @@
  *           WinNotify       (WINDEBUG.3)
  *  written without _any_ docu
  */
-void WINAPI WinNotify16(CONTEXT *context)
+void WINAPI WinNotify16(CONTEXT86 *context)
 {
 	FIXME(dll, "(AX=%04x):stub.\n", AX_reg(context));
 	switch (AX_reg(context))
diff --git a/miscemu/emulate.c b/miscemu/emulate.c
index 511f0b7..58e3718 100644
--- a/miscemu/emulate.c
+++ b/miscemu/emulate.c
@@ -27,7 +27,7 @@
  */
 /* FIXME: Only skeletal implementation for now */
 
-void WINAPI WIN87_fpmath( CONTEXT *context )
+void WINAPI WIN87_fpmath( CONTEXT86 *context )
 {
     TRACE(int, "(cs:eip=%x:%lx es=%x bx=%04x ax=%04x dx==%04x)\n",
                  (WORD)CS_reg(context), EIP_reg(context),
diff --git a/msdos/devices.c b/msdos/devices.c
index d99c21e..4ae228f 100644
--- a/msdos/devices.c
+++ b/msdos/devices.c
@@ -100,10 +100,10 @@
 #define ALL_OFS (ALLDEV_OFS + REQ_SCRATCH)
 
 /* prototypes */
-static void WINAPI nul_strategy(CONTEXT*ctx);
-static void WINAPI nul_interrupt(CONTEXT*ctx);
-static void WINAPI con_strategy(CONTEXT*ctx);
-static void WINAPI con_interrupt(CONTEXT*ctx);
+static void WINAPI nul_strategy(CONTEXT86*ctx);
+static void WINAPI nul_interrupt(CONTEXT86*ctx);
+static void WINAPI con_strategy(CONTEXT86*ctx);
+static void WINAPI con_interrupt(CONTEXT86*ctx);
 
 /* the device headers */
 #define STRATEGY_OFS sizeof(DOS_DEVICE_HEADER)
@@ -128,7 +128,7 @@
 #define nr_devs (sizeof(devs)/sizeof(WINEDEV))
 
 /* the device implementations */
-static void do_lret(CONTEXT*ctx)
+static void do_lret(CONTEXT86*ctx)
 {
   WORD *stack = CTX_SEG_OFF_TO_LIN(ctx, SS_reg(ctx), ESP_reg(ctx));
 
@@ -137,7 +137,7 @@
   SP_reg(ctx) += 2*sizeof(WORD);
 }
 
-static void do_strategy(CONTEXT*ctx, int id, int extra)
+static void do_strategy(CONTEXT86*ctx, int id, int extra)
 {
   REQUEST_HEADER *hdr = CTX_SEG_OFF_TO_LIN(ctx, ES_reg(ctx), EBX_reg(ctx));
   void **hdr_ptr = DOSVM_GetSystemData(id);
@@ -159,12 +159,12 @@
   return hdr_ptr ? *hdr_ptr : (void *)NULL;
 }
 
-static void WINAPI nul_strategy(CONTEXT*ctx)
+static void WINAPI nul_strategy(CONTEXT86*ctx)
 {
   do_strategy(ctx, SYSTEM_STRATEGY_NUL, 0);
 }
 
-static void WINAPI nul_interrupt(CONTEXT*ctx)
+static void WINAPI nul_interrupt(CONTEXT86*ctx)
 {
   REQUEST_HEADER *hdr = get_hdr(SYSTEM_STRATEGY_NUL, NULL);
   /* eat everything and recycle nothing */
@@ -184,12 +184,12 @@
 
 #define CON_BUFFER 128
 
-static void WINAPI con_strategy(CONTEXT*ctx)
+static void WINAPI con_strategy(CONTEXT86*ctx)
 {
   do_strategy(ctx, SYSTEM_STRATEGY_CON, sizeof(int));
 }
 
-static void WINAPI con_interrupt(CONTEXT*ctx)
+static void WINAPI con_interrupt(CONTEXT86*ctx)
 {
   int *scan;
   REQUEST_HEADER *hdr = get_hdr(SYSTEM_STRATEGY_CON,(void **)&scan);
@@ -509,7 +509,7 @@
 {
   REQUEST_HEADER *hdr = (REQUEST_HEADER *)req;
   DOS_DEVICE_HEADER *dhdr;
-  CONTEXT ctx;
+  CONTEXT86 ctx;
   char *phdr;
 
   dhdr = DOSMEM_MapRealToLinear(dev);
diff --git a/msdos/dpmi.c b/msdos/dpmi.c
index 83eea74..2636c60 100644
--- a/msdos/dpmi.c
+++ b/msdos/dpmi.c
@@ -139,7 +139,7 @@
 /**********************************************************************
  *	    INT_GetRealModeContext
  */
-static void INT_GetRealModeContext( REALMODECALL *call, CONTEXT *context )
+static void INT_GetRealModeContext( REALMODECALL *call, CONTEXT86 *context )
 {
     EAX_reg(context) = call->eax;
     EBX_reg(context) = call->ebx;
@@ -164,7 +164,7 @@
 /**********************************************************************
  *	    INT_SetRealModeContext
  */
-static void INT_SetRealModeContext( REALMODECALL *call, CONTEXT *context )
+static void INT_SetRealModeContext( REALMODECALL *call, CONTEXT86 *context )
 {
     call->eax = EAX_reg(context);
     call->ebx = EBX_reg(context);
@@ -190,7 +190,7 @@
  *
  * This routine does the hard work of calling a callback procedure.
  */
-static void DPMI_CallRMCBProc( CONTEXT *context, RMCB *rmcb, WORD flag )
+static void DPMI_CallRMCBProc( CONTEXT86 *context, RMCB *rmcb, WORD flag )
 {
     if (IS_SELECTOR_SYSTEM( rmcb->proc_sel )) {
         /* Wine-internal RMCB, call directly */
@@ -232,7 +232,7 @@
              : "ecx", "edx", "ebp" );
         } else {
             /* 16-bit DPMI client */
-            CONTEXT ctx = *context;
+            CONTEXT86 ctx = *context;
             CS_reg(&ctx) = rmcb->proc_sel;
             EIP_reg(&ctx) = rmcb->proc_ofs;
             DS_reg(&ctx) = ss;
@@ -257,7 +257,7 @@
  *
  * This routine does the hard work of calling a real mode procedure.
  */
-int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret )
+int DPMI_CallRMProc( CONTEXT86 *context, LPWORD stack, int args, int iret )
 {
     LPWORD stack16;
 #ifndef MZ_SUPPORTED
@@ -401,9 +401,9 @@
 /**********************************************************************
  *	    CallRMInt
  */
-static void CallRMInt( CONTEXT *context )
+static void CallRMInt( CONTEXT86 *context )
 {
-    CONTEXT realmode_ctx;
+    CONTEXT86 realmode_ctx;
     FARPROC16 rm_int = INT_GetRMHandler( BL_reg(context) );
     REALMODECALL *call = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( ES_reg(context),
                                                           DI_reg(context) );
@@ -435,10 +435,10 @@
 }
 
 
-static void CallRMProc( CONTEXT *context, int iret )
+static void CallRMProc( CONTEXT86 *context, int iret )
 {
     REALMODECALL *p = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( ES_reg(context), DI_reg(context) );
-    CONTEXT context16;
+    CONTEXT86 context16;
 
     TRACE(int31, "RealModeCall: EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n",
 	p->eax, p->ebx, p->ecx, p->edx);
@@ -506,7 +506,7 @@
 }
 
 
-static void AllocRMCB( CONTEXT *context )
+static void AllocRMCB( CONTEXT86 *context )
 {
     RMCB *NewRMCB = DPMI_AllocRMCB();
 
@@ -569,7 +569,7 @@
 }
 
 
-static void FreeRMCB( CONTEXT *context )
+static void FreeRMCB( CONTEXT86 *context )
 {
     FIXME(int31, "callback address: %04x:%04x\n",
           CX_reg(context), DX_reg(context));
@@ -590,11 +590,11 @@
 #ifdef MZ_SUPPORTED
 /* (see loader/dos/module.c, function MZ_InitDPMI) */
 
-static void StartPM( CONTEXT *context, LPDOSTASK lpDosTask )
+static void StartPM( CONTEXT86 *context, LPDOSTASK lpDosTask )
 {
     char *base = DOSMEM_MemoryBase(0);
     UINT16 cs, ss, ds, es;
-    CONTEXT pm_ctx;
+    CONTEXT86 pm_ctx;
     DWORD psp_ofs = (DWORD)(lpDosTask->psp_seg<<4);
     PDB16 *psp = (PDB16 *)(base + psp_ofs);
     HANDLE16 env_seg = psp->environment;
@@ -647,7 +647,7 @@
 void WINAPI DPMI_RawModeSwitch( SIGCONTEXT *context )
 {
   LPDOSTASK lpDosTask = MZ_Current();
-  CONTEXT rm_ctx;
+  CONTEXT86 rm_ctx;
   int ret;
 
   if (!lpDosTask) {
@@ -722,7 +722,7 @@
  * Handler for int 31h (DPMI).
  */
 
-void WINAPI INT_Int31Handler( CONTEXT *context )
+void WINAPI INT_Int31Handler( CONTEXT86 *context )
 {
     /*
      * Note: For Win32s processes, the whole linear address space is
diff --git a/msdos/int09.c b/msdos/int09.c
index d112451..2e02554 100644
--- a/msdos/int09.c
+++ b/msdos/int09.c
@@ -21,7 +21,7 @@
  *
  * Handler for int 09h.
  */
-void WINAPI INT_Int09Handler( CONTEXT *context )
+void WINAPI INT_Int09Handler( CONTEXT86 *context )
 {
   BYTE scan = INT_Int09ReadScan();
   UINT vkey = MapVirtualKeyA(scan&0x7f, 1);
@@ -38,7 +38,7 @@
   DOSVM_PIC_ioport_out(0x20, 0x20); /* send EOI */
 }
 
-static void KbdRelay( LPDOSTASK lpDosTask, PCONTEXT context, void *data )
+static void KbdRelay( LPDOSTASK lpDosTask, CONTEXT86 *context, void *data )
 {
   KBDSYSTEM *sys = (KBDSYSTEM *)DOSVM_GetSystemData(0x09);
 
diff --git a/msdos/int10.c b/msdos/int10.c
index d9fd019..69138a7 100644
--- a/msdos/int10.c
+++ b/msdos/int10.c
@@ -56,7 +56,7 @@
  *      Added additional vga graphic support - 3/99
  */
 
-void WINAPI INT_Int10Handler( CONTEXT *context )
+void WINAPI INT_Int10Handler( CONTEXT86 *context )
 {
     static int registered_colors = FALSE;
 
diff --git a/msdos/int11.c b/msdos/int11.c
index 08ce32d..ebc5e1b 100644
--- a/msdos/int11.c
+++ b/msdos/int11.c
@@ -13,7 +13,7 @@
  *
  * Handler for int 11h (get equipment list).
  */
-void WINAPI INT_Int11Handler( CONTEXT *context )
+void WINAPI INT_Int11Handler( CONTEXT86 *context )
 {
     int diskdrives = 0;
     int parallelports = 0;
diff --git a/msdos/int12.c b/msdos/int12.c
index 79429bd..2fd7e1c 100644
--- a/msdos/int12.c
+++ b/msdos/int12.c
@@ -9,7 +9,7 @@
  *
  * Handler for int 12h (get memory size).
  */
-void WINAPI INT_Int12Handler( CONTEXT *context )
+void WINAPI INT_Int12Handler( CONTEXT86 *context )
 {
     AX_reg(context) = 640;
 }
diff --git a/msdos/int13.c b/msdos/int13.c
index c577fa4..7fff05e 100644
--- a/msdos/int13.c
+++ b/msdos/int13.c
@@ -23,7 +23,7 @@
  *
  * Handler for int 13h (disk I/O).
  */
-void WINAPI INT_Int13Handler( CONTEXT *context )
+void WINAPI INT_Int13Handler( CONTEXT86 *context )
 {
     switch(AH_reg(context))
     {
diff --git a/msdos/int15.c b/msdos/int15.c
index 472735f..17be10d 100644
--- a/msdos/int15.c
+++ b/msdos/int15.c
@@ -14,7 +14,7 @@
  *
  * Handler for int 15h (old cassette interrupt).
  */
-void WINAPI INT_Int15Handler( CONTEXT *context )
+void WINAPI INT_Int15Handler( CONTEXT86 *context )
 {
     switch(AH_reg(context))
     {
diff --git a/msdos/int16.c b/msdos/int16.c
index 34fa4fa..9a78a96 100644
--- a/msdos/int16.c
+++ b/msdos/int16.c
@@ -27,7 +27,7 @@
  *    not currently listed here.
  */
 
-void WINAPI INT_Int16Handler( CONTEXT *context )
+void WINAPI INT_Int16Handler( CONTEXT86 *context )
 {
    switch AH_reg(context) {
 
diff --git a/msdos/int17.c b/msdos/int17.c
index a366b7b..5fb337a 100644
--- a/msdos/int17.c
+++ b/msdos/int17.c
@@ -17,7 +17,7 @@
  *
  * Handler for int 17h (printer - output character).
  */
-void WINAPI INT_Int17Handler( CONTEXT *context )
+void WINAPI INT_Int17Handler( CONTEXT86 *context )
 {
     switch( AH_reg(context) )
     {
diff --git a/msdos/int19.c b/msdos/int19.c
index 9cc4a2a..f745e35 100644
--- a/msdos/int19.c
+++ b/msdos/int19.c
@@ -14,7 +14,7 @@
  *
  * Handler for int 19h (Reboot).
  */
-void WINAPI INT_Int19Handler( CONTEXT *context )
+void WINAPI INT_Int19Handler( CONTEXT86 *context )
 {
     WARN(int19, "Attempted Reboot\n");
 }
diff --git a/msdos/int1a.c b/msdos/int1a.c
index 21daa6e..170d2b9 100644
--- a/msdos/int1a.c
+++ b/msdos/int1a.c
@@ -45,7 +45,7 @@
  *     0x00 - 0x07 - date and time
  *     0x?? - 0x?? - Microsoft Real Time Compression Interface
  */ 
-void WINAPI INT_Int1aHandler( CONTEXT *context )
+void WINAPI INT_Int1aHandler( CONTEXT86 *context )
 {
     time_t ltime;
     DWORD ticks;
diff --git a/msdos/int20.c b/msdos/int20.c
index 4743b74..1ad5b42 100644
--- a/msdos/int20.c
+++ b/msdos/int20.c
@@ -14,7 +14,7 @@
  *
  * Handler for int 20h.
  */
-void WINAPI INT_Int20Handler( CONTEXT *context )
+void WINAPI INT_Int20Handler( CONTEXT86 *context )
 {
         ExitProcess( 0 );
 }
diff --git a/msdos/int21.c b/msdos/int21.c
index fbddade..c2ec5a3 100644
--- a/msdos/int21.c
+++ b/msdos/int21.c
@@ -102,7 +102,7 @@
     return TRUE;
 }
 
-static BYTE *GetCurrentDTA( CONTEXT *context )
+static BYTE *GetCurrentDTA( CONTEXT86 *context )
 {
     TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
 
@@ -152,7 +152,7 @@
 	}	
 }
 
-static int INT21_GetFreeDiskSpace( CONTEXT *context )
+static int INT21_GetFreeDiskSpace( CONTEXT86 *context )
 {
     DWORD cluster_sectors, sector_bytes, free_clusters, total_clusters;
     char root[] = "A:\\";
@@ -167,7 +167,7 @@
     return 1;
 }
 
-static int INT21_GetDriveAllocInfo( CONTEXT *context )
+static int INT21_GetDriveAllocInfo( CONTEXT86 *context )
 {
     if (!INT21_GetFreeDiskSpace( context )) return 0;
     if (!heap && !INT21_CreateHeap()) return 0;
@@ -177,7 +177,7 @@
     return 1;
 }
 
-static void GetDrivePB( CONTEXT *context, int drive )
+static void GetDrivePB( CONTEXT86 *context, int drive )
 {
         if(!DRIVE_IsValid(drive))
         {
@@ -220,7 +220,7 @@
 }
 
 
-static void ioctlGetDeviceInfo( CONTEXT *context )
+static void ioctlGetDeviceInfo( CONTEXT86 *context )
 {
     int curr_drive;
     const DOS_DEVICE *dev;
@@ -249,7 +249,7 @@
      */
 }
 
-static BOOL ioctlGenericBlkDevReq( CONTEXT *context )
+static BOOL ioctlGenericBlkDevReq( CONTEXT86 *context )
 {
 	BYTE *dataptr = CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context));
 	int drive = DOS_GET_DRIVE( BL_reg(context) );
@@ -356,7 +356,7 @@
 	return FALSE;
 }
 
-static void INT21_ParseFileNameIntoFCB( CONTEXT *context )
+static void INT21_ParseFileNameIntoFCB( CONTEXT86 *context )
 {
     char *filename =
         CTX_SEG_OFF_TO_LIN(context, DS_reg(context), ESI_reg(context) );
@@ -394,7 +394,7 @@
     SI_reg(context) += (int)s - (int)filename;
 }
 
-static void INT21_GetSystemDate( CONTEXT *context )
+static void INT21_GetSystemDate( CONTEXT86 *context )
 {
     SYSTEMTIME systime;
     GetLocalTime( &systime );
@@ -403,7 +403,7 @@
     AX_reg(context) = systime.wDayOfWeek;
 }
 
-static void INT21_GetSystemTime( CONTEXT *context )
+static void INT21_GetSystemTime( CONTEXT86 *context )
 {
     SYSTEMTIME systime;
     GetLocalTime( &systime );
@@ -427,7 +427,7 @@
       }
     return drivestring;
 }
-static BOOL INT21_CreateFile( CONTEXT *context )
+static BOOL INT21_CreateFile( CONTEXT86 *context )
 {
     AX_reg(context) = _lcreat16( CTX_SEG_OFF_TO_LIN(context, DS_reg(context),
                                           EDX_reg(context) ), CX_reg(context) );
@@ -443,7 +443,7 @@
                                              CREATE_NEW, attr, -1 ));
 }
 
-static void OpenExistingFile( CONTEXT *context )
+static void OpenExistingFile( CONTEXT86 *context )
 {
     AX_reg(context) = _lopen16( CTX_SEG_OFF_TO_LIN(context, DS_reg(context),EDX_reg(context)),
                                AL_reg(context) );
@@ -454,7 +454,7 @@
     }
 }
 
-static BOOL INT21_ExtendedOpenCreateFile(CONTEXT *context )
+static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
 {
   BOOL bExtendedError = FALSE;
   BYTE action = DL_reg(context);
@@ -548,7 +548,7 @@
 }
 
 
-static BOOL INT21_ChangeDir( CONTEXT *context )
+static BOOL INT21_ChangeDir( CONTEXT86 *context )
 {
     int drive;
     char *dirname = CTX_SEG_OFF_TO_LIN(context, DS_reg(context),EDX_reg(context));
@@ -564,7 +564,7 @@
 }
 
 
-static int INT21_FindFirst( CONTEXT *context )
+static int INT21_FindFirst( CONTEXT86 *context )
 {
     char *p;
     const char *path;
@@ -603,7 +603,7 @@
 }
 
 
-static int INT21_FindNext( CONTEXT *context )
+static int INT21_FindNext( CONTEXT86 *context )
 {
     FINDFILE_DTA *dta = (FINDFILE_DTA *)GetCurrentDTA(context);
     WIN32_FIND_DATAA entry;
@@ -641,7 +641,7 @@
 }
 
 
-static BOOL INT21_CreateTempFile( CONTEXT *context )
+static BOOL INT21_CreateTempFile( CONTEXT86 *context )
 {
     static int counter = 0;
     char *name = CTX_SEG_OFF_TO_LIN(context,  DS_reg(context), EDX_reg(context) );
@@ -666,7 +666,7 @@
 }
 
 
-static BOOL INT21_GetCurrentDirectory( CONTEXT *context ) 
+static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context ) 
 {
     int drive = DOS_GET_DRIVE( DL_reg(context) );
     char *ptr = (char *)CTX_SEG_OFF_TO_LIN(context,  DS_reg(context), ESI_reg(context) );
@@ -682,7 +682,7 @@
 }
 
 
-static void INT21_GetDBCSLeadTable( CONTEXT *context )
+static void INT21_GetDBCSLeadTable( CONTEXT86 *context )
 {
     if (heap || INT21_CreateHeap())
     { /* return an empty table just as DOS 4.0+ does */
@@ -697,7 +697,7 @@
 }
 
 
-static int INT21_GetDiskSerialNumber( CONTEXT *context )
+static int INT21_GetDiskSerialNumber( CONTEXT86 *context )
 {
     BYTE *dataptr = CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context));
     int drive = DOS_GET_DRIVE( BL_reg(context) );
@@ -716,7 +716,7 @@
 }
 
 
-static int INT21_SetDiskSerialNumber( CONTEXT *context )
+static int INT21_SetDiskSerialNumber( CONTEXT86 *context )
 {
     BYTE *dataptr = CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context));
     int drive = DOS_GET_DRIVE( BL_reg(context) );
@@ -735,7 +735,7 @@
 /* microsoft's programmers should be shot for using CP/M style int21
    calls in Windows for Workgroup's winfile.exe */
 
-static int INT21_FindFirstFCB( CONTEXT *context )
+static int INT21_FindFirstFCB( CONTEXT86 *context )
 {
     BYTE *fcb = (BYTE *)CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context));
     FINDFILE_FCB *pFCB;
@@ -759,7 +759,7 @@
 }
 
 
-static int INT21_FindNextFCB( CONTEXT *context )
+static int INT21_FindNextFCB( CONTEXT86 *context )
 {
     BYTE *fcb = (BYTE *)CTX_SEG_OFF_TO_LIN(context, DS_reg(context), EDX_reg(context));
     FINDFILE_FCB *pFCB;
@@ -828,19 +828,19 @@
 }
 
 
-static void DeleteFileFCB( CONTEXT *context )
+static void DeleteFileFCB( CONTEXT86 *context )
 {
     FIXME(int21, "(%p): stub\n", context);
 }
 
-static void RenameFileFCB( CONTEXT *context )
+static void RenameFileFCB( CONTEXT86 *context )
 {
     FIXME(int21, "(%p): stub\n", context);
 }
 
 
 
-static void fLock( CONTEXT * context )
+static void fLock( CONTEXT86 * context )
 {
 
     switch ( AX_reg(context) & 0xff )
@@ -878,7 +878,7 @@
 } 
 
 static BOOL
-INT21_networkfunc (CONTEXT *context)
+INT21_networkfunc (CONTEXT86 *context)
 {
      switch (AL_reg(context)) {
      case 0x00: /* Get machine name. */
@@ -940,7 +940,7 @@
 /***********************************************************************
  *           INT21_GetExtendedError
  */
-static void INT21_GetExtendedError( CONTEXT *context )
+static void INT21_GetExtendedError( CONTEXT86 *context )
 {
     BYTE class, action, locus;
     WORD error = GetLastError();
@@ -1055,7 +1055,7 @@
 /***********************************************************************
  *           DOS3Call  (KERNEL.102)
  */
-void WINAPI DOS3Call( CONTEXT *context )
+void WINAPI DOS3Call( CONTEXT86 *context )
 {
     BOOL	bSetDOSExtendedError = FALSE;
 
diff --git a/msdos/int25.c b/msdos/int25.c
index c967334..84b221c 100644
--- a/msdos/int25.c
+++ b/msdos/int25.c
@@ -20,7 +20,7 @@
  *
  * Handler for int 25h (absolute disk read).
  */
-void WINAPI INT_Int25Handler( CONTEXT *context )
+void WINAPI INT_Int25Handler( CONTEXT86 *context )
 {
     BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EBX_reg(context) );
     DWORD begin, length;
diff --git a/msdos/int26.c b/msdos/int26.c
index a38d355..bf76c64 100644
--- a/msdos/int26.c
+++ b/msdos/int26.c
@@ -18,7 +18,7 @@
  *
  * Handler for int 26h (absolute disk read).
  */
-void WINAPI INT_Int26Handler( CONTEXT *context )
+void WINAPI INT_Int26Handler( CONTEXT86 *context )
 {
     BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EBX_reg(context) );
     DWORD begin, length;
diff --git a/msdos/int29.c b/msdos/int29.c
index 688b646..cf50a0b 100644
--- a/msdos/int29.c
+++ b/msdos/int29.c
@@ -12,7 +12,7 @@
  *
  * Handler for int 29h (fast console output)
  */
-void WINAPI INT_Int29Handler( CONTEXT *context )
+void WINAPI INT_Int29Handler( CONTEXT86 *context )
 {
    /* Yes, it seems that this is really all this interrupt does. */
    CONSOLE_Write(AL_reg(context), 0, 0, 0);
diff --git a/msdos/int2a.c b/msdos/int2a.c
index 8f3d6ad..efcf0c2 100644
--- a/msdos/int2a.c
+++ b/msdos/int2a.c
@@ -12,7 +12,7 @@
  *
  * Handler for int 2ah (network).
  */
-void WINAPI INT_Int2aHandler( CONTEXT *context )
+void WINAPI INT_Int2aHandler( CONTEXT86 *context )
 {
     switch(AH_reg(context))
     {
diff --git a/msdos/int2f.c b/msdos/int2f.c
index add9ced..52ec327 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -29,15 +29,15 @@
 /* base WPROCS.DLL ordinal number for VxDs */
 #define VXD_BASE 400
 
-static void do_int2f_16( CONTEXT *context );
-static void MSCDEX_Handler( CONTEXT *context );
+static void do_int2f_16( CONTEXT86 *context );
+static void MSCDEX_Handler( CONTEXT86 *context );
 
 /**********************************************************************
  *	    INT_Int2fHandler
  *
  * Handler for int 2fh (multiplex).
  */
-void WINAPI INT_Int2fHandler( CONTEXT *context )
+void WINAPI INT_Int2fHandler( CONTEXT86 *context )
 {
     TRACE(int,"Subfunction 0x%X\n", AX_reg(context));
 
@@ -291,7 +291,7 @@
 /**********************************************************************
  *	    do_int2f_16
  */
-static void do_int2f_16( CONTEXT *context )
+static void do_int2f_16( CONTEXT86 *context )
 {
     DWORD addr;
 
@@ -451,7 +451,7 @@
     val[0] = frame - CDFRAMES_PERMIN * val[2] - CDFRAMES_PERSEC * val[1]; /* frames */
 }
 
-static void MSCDEX_Handler(CONTEXT* context)
+static void MSCDEX_Handler(CONTEXT86* context)
 {
     int 	drive, count;
     char*	p;
diff --git a/msdos/int33.c b/msdos/int33.c
index 7a65186..23069fc 100644
--- a/msdos/int33.c
+++ b/msdos/int33.c
@@ -21,7 +21,7 @@
  *
  * Handler for int 33h (MS MOUSE).
  */
-void WINAPI INT_Int33Handler( CONTEXT *context )
+void WINAPI INT_Int33Handler( CONTEXT86 *context )
 {
   MOUSESYSTEM *sys = (MOUSESYSTEM *)DOSVM_GetSystemData(0x33);
 
@@ -54,10 +54,10 @@
   WORD mask,but,x,y,mx,my;
 } MCALLDATA;
 
-static void MouseRelay(LPDOSTASK lpDosTask,PCONTEXT context,void *mdata)
+static void MouseRelay(LPDOSTASK lpDosTask,CONTEXT86 *context,void *mdata)
 {
   MCALLDATA *data = (MCALLDATA *)mdata;
-  CONTEXT ctx = *context;
+  CONTEXT86 ctx = *context;
 
   AX_reg(&ctx) = data->mask;
   BX_reg(&ctx) = data->but;
diff --git a/msdos/int3d.c b/msdos/int3d.c
index 1319036..30fabe5 100644
--- a/msdos/int3d.c
+++ b/msdos/int3d.c
@@ -14,7 +14,7 @@
  *
  * Handler for int 3d (FLOATING POINT EMULATION - STANDALONE FWAIT).
  */
-void WINAPI INT_Int3dHandler(CONTEXT *context)
+void WINAPI INT_Int3dHandler(CONTEXT86 *context)
 {
     switch(AH_reg(context))
     {
diff --git a/msdos/int41.c b/msdos/int41.c
index 85c4e26..76f3554 100644
--- a/msdos/int41.c
+++ b/msdos/int41.c
@@ -11,7 +11,7 @@
  *           INT_Int41Handler
  *
  */
-void WINAPI INT_Int41Handler( CONTEXT *context )
+void WINAPI INT_Int41Handler( CONTEXT86 *context )
 {
     if ( ISV86(context) )
     {
diff --git a/msdos/int4b.c b/msdos/int4b.c
index 34e2085..6103b95 100644
--- a/msdos/int4b.c
+++ b/msdos/int4b.c
@@ -9,7 +9,7 @@
  *           INT_Int4bHandler
  *
  */
-void WINAPI INT_Int4bHandler( CONTEXT *context )
+void WINAPI INT_Int4bHandler( CONTEXT86 *context )
 {
     switch(AH_reg(context))
     {
diff --git a/msdos/int5c.c b/msdos/int5c.c
index 60b2b7e..79440b7 100644
--- a/msdos/int5c.c
+++ b/msdos/int5c.c
@@ -16,7 +16,7 @@
  *
  * Also handler for interrupt 5c. 
  */
-void WINAPI NetBIOSCall16( CONTEXT *context )
+void WINAPI NetBIOSCall16( CONTEXT86 *context )
 {
     BYTE* ptr;
     ptr = (BYTE*) PTR_SEG_OFF_TO_LIN(ES_reg(context),BX_reg(context));
diff --git a/msdos/interrupts.c b/msdos/interrupts.c
index 38810cf..36282a0 100644
--- a/msdos/interrupts.c
+++ b/msdos/interrupts.c
@@ -68,7 +68,7 @@
  *
  * Return the interrupt vector for a given interrupt.
  */
-FARPROC16 INT_CtxGetHandler( CONTEXT *context, BYTE intnum )
+FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum )
 {
     if (ISV86(context))
         return ((FARPROC16*)V86BASE(context))[intnum];
@@ -82,7 +82,7 @@
  *
  * Set the interrupt handler for a given interrupt.
  */
-void INT_CtxSetHandler( CONTEXT *context, BYTE intnum, FARPROC16 handler )
+void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler )
 {
     if (ISV86(context)) {
         TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
@@ -98,7 +98,7 @@
  *
  * Handle real mode interrupts
  */
-int INT_RealModeInterrupt( BYTE intnum, PCONTEXT context )
+int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context )
 {
     /* we should really map to if1632/wprocs.spec, but not all
      * interrupt handlers are adapted to support real mode yet */
diff --git a/msdos/vxd.c b/msdos/vxd.c
index be478c1..3281c7a 100644
--- a/msdos/vxd.c
+++ b/msdos/vxd.c
@@ -40,7 +40,7 @@
 /***********************************************************************
  *           VXD_VMM
  */
-void VXD_VMM ( CONTEXT *context )
+void VXD_VMM ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -67,7 +67,7 @@
 /***********************************************************************
  *           VXD_PageFile
  */
-void WINAPI VXD_PageFile( CONTEXT *context )
+void WINAPI VXD_PageFile( CONTEXT86 *context )
 {
     unsigned	service = AX_reg(context);
 
@@ -113,7 +113,7 @@
 /***********************************************************************
  *           VXD_Reboot
  */
-void VXD_Reboot ( CONTEXT *context )
+void VXD_Reboot ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -134,7 +134,7 @@
 /***********************************************************************
  *           VXD_VDD
  */
-void VXD_VDD ( CONTEXT *context )
+void VXD_VDD ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -155,7 +155,7 @@
 /***********************************************************************
  *           VXD_VMD
  */
-void VXD_VMD ( CONTEXT *context )
+void VXD_VMD ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -176,7 +176,7 @@
 /***********************************************************************
  *           VXD_Shell
  */
-void WINAPI VXD_Shell( CONTEXT *context )
+void WINAPI VXD_Shell( CONTEXT86 *context )
 {
     unsigned	service = DX_reg(context);
 
@@ -270,7 +270,7 @@
 /***********************************************************************
  *           VXD_Comm
  */
-void WINAPI VXD_Comm( CONTEXT *context )
+void WINAPI VXD_Comm( CONTEXT86 *context )
 {
     unsigned	service = AX_reg(context);
 
@@ -295,7 +295,7 @@
 /***********************************************************************
  *           VXD_Timer
  */
-void VXD_Timer( CONTEXT *context )
+void VXD_Timer( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -331,7 +331,7 @@
 static DWORD System_Time = 0;
 static WORD  System_Time_Selector = 0;
 static void  System_Time_Tick( WORD timer ) { System_Time += 55; }
-void VXD_TimerAPI ( CONTEXT *context )
+void VXD_TimerAPI ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -364,7 +364,7 @@
 /***********************************************************************
  *           VXD_ConfigMG
  */
-void VXD_ConfigMG ( CONTEXT *context )
+void VXD_ConfigMG ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -385,7 +385,7 @@
 /***********************************************************************
  *           VXD_Enable
  */
-void VXD_Enable ( CONTEXT *context )
+void VXD_Enable ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -406,7 +406,7 @@
 /***********************************************************************
  *           VXD_APM
  */
-void VXD_APM ( CONTEXT *context )
+void VXD_APM ( CONTEXT86 *context )
 {
     unsigned service = AX_reg(context);
 
@@ -479,7 +479,7 @@
  * 
  */
 
-void VXD_Win32s( CONTEXT *context )
+void VXD_Win32s( CONTEXT86 *context )
 {
     switch (AX_reg(context))
     {
diff --git a/msdos/xms.c b/msdos/xms.c
index 389c0a4..0653d52 100644
--- a/msdos/xms.c
+++ b/msdos/xms.c
@@ -39,7 +39,7 @@
  *	    XMS_Handler
  */
 
-void WINAPI XMS_Handler( CONTEXT *context )
+void WINAPI XMS_Handler( CONTEXT86 *context )
 {
     switch(AH_reg(context))
     {
diff --git a/scheduler/thread.c b/scheduler/thread.c
index 62e4dc7..60b51f7 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -289,7 +289,7 @@
 {
     int handle = -1;
     TEB *teb = THREAD_Create( PROCESS_Current(), flags, stack, TRUE, sa, &handle );
-    if (!teb) return INVALID_HANDLE_VALUE;
+    if (!teb) return 0;
     teb->flags      |= TEBF_WIN32;
     teb->entry_point = start;
     teb->entry_arg   = param;
@@ -297,7 +297,7 @@
     if (SYSDEPS_SpawnThread( teb ) == -1)
     {
         CloseHandle( handle );
-        return INVALID_HANDLE_VALUE;
+        return 0;
     }
     if (id) *id = (DWORD)teb->tid;
     return handle;
@@ -504,6 +504,7 @@
     HANDLE handle,  /* [in]  Handle to thread with context */
     CONTEXT *context) /* [out] Address of context structure */
 {
+#ifdef __i386__
     WORD cs, ds;
 
     FIXME("returning dummy info\n" );
@@ -517,6 +518,7 @@
     context->SegGs   = ds;
     context->SegSs   = ds;
     context->SegFs   = ds;
+#endif
     return TRUE;
 }
 
diff --git a/tools/build.c b/tools/build.c
index 9a92b88..20f6ff0 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -174,7 +174,7 @@
 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
 
   /* Offset of register relative to the start of the CONTEXT struct */
-#define CONTEXTOFFSET(reg)  STRUCTOFFSET(CONTEXT,reg)
+#define CONTEXTOFFSET(reg)  STRUCTOFFSET(CONTEXT86,reg)
 
   /* Offset of the stack pointer relative to %fs:(0) */
 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
@@ -1502,52 +1502,52 @@
     /* Store the registers */
 
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(Eax) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Eax) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %%ecx,%d(%%ebx)\n",
-             CONTEXTOFFSET(Ecx) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Ecx) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %%edx,%d(%%ebx)\n",
-             CONTEXTOFFSET(Edx) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Edx) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %%esi,%d(%%ebx)\n",
-             CONTEXTOFFSET(Esi) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Esi) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %%edi,%d(%%ebx)\n",
-             CONTEXTOFFSET(Edi) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Edi) - sizeof(CONTEXT86) );
 
     fprintf( outfile, "\tmovl -24(%%ebp),%%eax\n" ); /* Get %ebx from stack*/
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(Ebx) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Ebx) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovzwl -10(%%ebp),%%eax\n" ); /* Get %ds from stack*/
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(SegDs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegDs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovzwl -6(%%ebp),%%eax\n" ); /* Get %es from stack*/
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(SegEs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegEs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushfl\n" );
     fprintf( outfile, "\tpopl %d(%%ebx)\n",
-             CONTEXTOFFSET(EFlags) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(EFlags) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl -20(%%ebp),%%eax\n" ); /* Get %ebp from stack */
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(Ebp) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Ebp) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovzwl 2(%%ebp),%%eax\n" ); /* Get %ip from stack */
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(Eip) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Eip) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tleal 2(%%ebp),%%eax\n" );  /* Get initial %sp */
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(Esp) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Esp) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovzwl 4(%%ebp),%%eax\n" ); /* Get %cs from stack */
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(SegCs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegCs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovzwl -14(%%ebp),%%eax\n" ); /* Get %fs from stack */
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(SegFs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegFs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovw %%gs,%%ax\n" );
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(SegGs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegGs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovw %%ss,%%ax\n" );
     fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
-             CONTEXTOFFSET(SegSs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegSs) - sizeof(CONTEXT86) );
 #if 0
     fprintf( outfile, "\tfsave %d(%%ebx)\n",
-             CONTEXTOFFSET(FloatSave) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(FloatSave) - sizeof(CONTEXT86) );
 #endif
 }
 
@@ -1568,41 +1568,41 @@
      * from the 16-bit stack */
 
     fprintf( outfile, "\tmovl %d(%%ebx),%%eax\n",
-             CONTEXTOFFSET(SegSs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegSs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovw %%ax,%%ss\n" );
     fprintf( outfile, "\tmovl %d(%%ebx),%%esp\n",
-             CONTEXTOFFSET(Esp) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Esp) - sizeof(CONTEXT86) );
     fprintf( outfile, "\taddl $4,%%esp\n" );  /* Remove return address */
 
     /* Restore the registers */
 
     fprintf( outfile, "\tmovl %d(%%ebx),%%ecx\n",
-             CONTEXTOFFSET(Ecx) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Ecx) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %d(%%ebx),%%edx\n",
-             CONTEXTOFFSET(Edx) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Edx) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %d(%%ebx),%%esi\n",
-             CONTEXTOFFSET(Esi) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Esi) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %d(%%ebx),%%edi\n",
-             CONTEXTOFFSET(Edi) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Edi) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %d(%%ebx),%%ebp\n",
-             CONTEXTOFFSET(Ebp) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Ebp) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushw %d(%%ebx)\n",  /* Push new cs */
-             CONTEXTOFFSET(SegCs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegCs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushw %d(%%ebx)\n",  /* Push new ip */
-             CONTEXTOFFSET(Eip) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Eip) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushl %d(%%ebx)\n",  /* Push new ds */
-             CONTEXTOFFSET(SegDs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegDs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushl %d(%%ebx)\n",  /* Push new es */
-             CONTEXTOFFSET(SegEs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegEs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushl %d(%%ebx)\n",  /* Push new fs */
-             CONTEXTOFFSET(SegFs) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(SegFs) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpushl %d(%%ebx)\n",
-             CONTEXTOFFSET(EFlags) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(EFlags) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpopfl\n" );
     fprintf( outfile, "\tmovl %d(%%ebx),%%eax\n",
-             CONTEXTOFFSET(Eax) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Eax) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tmovl %d(%%ebx),%%ebx\n",
-             CONTEXTOFFSET(Ebx) - sizeof(CONTEXT) );
+             CONTEXTOFFSET(Ebx) - sizeof(CONTEXT86) );
     fprintf( outfile, "\tpopl %%fs\n" );  /* Set fs */
     fprintf( outfile, "\tpopl %%es\n" );  /* Set es */
     fprintf( outfile, "\tpopl %%ds\n" );  /* Set ds */
@@ -1771,7 +1771,7 @@
     fprintf( outfile, "\tpushl %%ds\n" );
     fprintf( outfile, "\tpopl %%ss\n" );
     fprintf( outfile, "\tleal -%d(%%ebp),%%esp\n",
-             reg_func ? sizeof(CONTEXT) : 4 * strlen(args) );
+             reg_func ? sizeof(CONTEXT86) : 4 * strlen(args) );
     if (reg_func)  /* Push the address of the context struct */
         fprintf( outfile, "\tpushl %%esp\n" );
 
@@ -1820,7 +1820,7 @@
             /* Push again the address of the context struct in case */
             /* it has been removed by an stdcall function */
             fprintf( outfile, "\tleal -%d(%%ebp),%%esp\n",
-                     sizeof(CONTEXT) + STRUCTOFFSET(STACK32FRAME,ebp) );
+                     sizeof(CONTEXT86) + STRUCTOFFSET(STACK32FRAME,ebp) );
             fprintf( outfile, "\tpushl %%esp\n" );
         }
         fprintf( outfile, "\tpushl %%eax\n" );
@@ -1933,8 +1933,8 @@
  * Prototypes for the CallTo16 functions:
  *   extern WINAPI WORD CallTo16_word_xxx( FARPROC16 func, args... );
  *   extern WINAPI LONG CallTo16_long_xxx( FARPROC16 func, args... );
- *   extern WINAPI void CallTo16_sreg_( const CONTEXT *context, int nb_args );
- *   extern WINAPI void CallTo16_lreg_( const CONTEXT *context, int nb_args );
+ *   extern WINAPI void CallTo16_sreg_( const CONTEXT86 *context, int nb_args );
+ *   extern WINAPI void CallTo16_lreg_( const CONTEXT86 *context, int nb_args );
  */
 static void BuildCallTo16Func( FILE *outfile, char *profile )
 {
@@ -2585,8 +2585,8 @@
  * (ebp+4)   ret addr to relay code
  * (ebp+0)   saved ebp
  * (ebp-128) buffer area to allow stack frame manipulation
- * (ebp-332) CONTEXT struct
- * (ebp-336) CONTEXT *argument
+ * (ebp-332) CONTEXT86 struct
+ * (ebp-336) CONTEXT86 *argument
  *  ....     other arguments copied from (ebp+12)
  *
  * The entry point routine is called with a CONTEXT* extra argument,
@@ -2597,7 +2597,7 @@
  */
 static void BuildCallFrom32Regs( FILE *outfile )
 {
-    static const int STACK_SPACE = 128 + sizeof(CONTEXT);
+    static const int STACK_SPACE = 128 + sizeof(CONTEXT86);
 
     /* Function header */
 
diff --git a/win32/device.c b/win32/device.c
index 8c6f178..02c8660 100644
--- a/win32/device.c
+++ b/win32/device.c
@@ -717,9 +717,9 @@
 	unsigned short  ar_pad;
 };
 
-static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT *pCxt)
+static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT86 *pCxt)
 {
-	memset(pCxt,0,sizeof(CONTEXT));
+	memset(pCxt,0,sizeof(*pCxt));
 
 	pCxt->ContextFlags=CONTEXT_INTEGER|CONTEXT_CONTROL;
 	pCxt->Eax = pIn->ar_eax;
@@ -737,7 +737,7 @@
 	/* FIXME: pIn->ar_pad ignored */
 }
 
-static void CONTEXT_2_win32apieq(CONTEXT *pCxt,struct win32apireq *pOut)
+static void CONTEXT_2_win32apieq(CONTEXT86 *pCxt,struct win32apireq *pOut)
 {
 	memset(pOut,0,sizeof(struct win32apireq));
 
@@ -773,7 +773,7 @@
     {
 	case IFS_IOCTL_21:
 	case IFS_IOCTL_2F:{
-		CONTEXT cxt;
+		CONTEXT86 cxt;
 		struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer;
 		struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer;
 
@@ -822,9 +822,9 @@
  *           DeviceIo_VWin32
  */
 
-static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT *pCxt )
+static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
 {
-    memset( pCxt, 0, sizeof(CONTEXT) );
+    memset( pCxt, 0, sizeof(*pCxt) );
     /* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
              will interpret 32-bit register contents as linear pointers */
 
@@ -840,7 +840,7 @@
     pCxt->EFlags = pIn->reg_Flags;
 }
 
-static void CONTEXT_2_DIOCRegs( CONTEXT *pCxt, DIOC_REGISTERS *pOut )
+static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
 {
     memset( pOut, 0, sizeof(DIOC_REGISTERS) );
 
@@ -871,7 +871,7 @@
     case VWIN32_DIOC_DOS_INT25:
     case VWIN32_DIOC_DOS_INT26:
     {
-        CONTEXT cxt;
+        CONTEXT86 cxt;
         DIOC_REGISTERS *pIn  = (DIOC_REGISTERS *)lpvInBuffer;
         DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
 
diff --git a/win32/kernel32.c b/win32/kernel32.c
index f015c92..68adedd 100644
--- a/win32/kernel32.c
+++ b/win32/kernel32.c
@@ -292,7 +292,8 @@
  */
 void WINAPI REGS_FUNC(QT_Thunk)( CONTEXT *context )
 {
-    CONTEXT context16;
+#ifdef __i386__
+    CONTEXT86 context16;
     DWORD argsize;
 
     memcpy(&context16,context,sizeof(context16));
@@ -310,6 +311,7 @@
     EAX_reg(context) = Callbacks->CallRegisterShortProc( &context16, argsize );
     EDX_reg(context) = HIWORD(EAX_reg(context));
     EAX_reg(context) = LOWORD(EAX_reg(context));
+#endif
 }
 
 
@@ -359,6 +361,7 @@
 
 void WINAPI REGS_FUNC(FT_Prolog)( CONTEXT *context )
 {
+#ifdef __i386__
     /* Build stack frame */
     STACK32_PUSH(context, EBP_reg(context));
     EBP_reg(context) = ESP_reg(context);
@@ -376,6 +379,7 @@
 
     *(DWORD *)(EBP_reg(context) - 48) = EAX_reg(context);
     *(DWORD *)(EBP_reg(context) - 52) = EDX_reg(context);
+#endif
 }
 
 /**********************************************************************
@@ -401,10 +405,11 @@
 
 void WINAPI REGS_FUNC(FT_Thunk)( CONTEXT *context )
 {
+#ifdef __i386__
     DWORD mapESPrelative = *(DWORD *)(EBP_reg(context) - 20);
     DWORD callTarget     = *(DWORD *)(EBP_reg(context) - 52);
 
-    CONTEXT context16;
+    CONTEXT86 context16;
     DWORD i, argsize;
     LPBYTE newstack, oldstack;
 
@@ -436,6 +441,7 @@
 
     /* Copy modified buffers back to 32-bit stack */
     memcpy( oldstack, newstack, argsize );
+#endif
 }
 
 /**********************************************************************
@@ -452,6 +458,7 @@
 
 static void FT_Exit(CONTEXT *context, int nPopArgs)
 {
+#ifdef __i386__
     /* Return value is in EBX */
     EAX_reg(context) = EBX_reg(context);
 
@@ -468,6 +475,7 @@
     EIP_reg(context) = STACK32_POP(context);
     /* Remove arguments */
     ESP_reg(context) += nPopArgs;
+#endif
 }
 
 void WINAPI REGS_FUNC(FT_Exit0)(CONTEXT *context)  { FT_Exit(context,  0); }
@@ -593,7 +601,8 @@
  */
 void WINAPI REGS_FUNC(Common32ThkLS)( CONTEXT *context )
 {
-    CONTEXT context16;
+#ifdef __i386__
+    CONTEXT86 context16;
     DWORD argsize;
 
     memcpy(&context16,context,sizeof(context16));
@@ -617,6 +626,7 @@
 
     /* Clean up caller's stack frame */
     ESP_reg(context) += argsize;
+#endif
 }
 
 /***********************************************************************
@@ -648,7 +658,8 @@
  */
 void WINAPI REGS_FUNC(OT_32ThkLSF)( CONTEXT *context )
 {
-    CONTEXT context16;
+#ifdef __i386__
+    CONTEXT86 context16;
     DWORD argsize;
 
     memcpy(&context16,context,sizeof(context16));
@@ -667,6 +678,7 @@
 
     memcpy( (LPBYTE)ESP_reg(context), 
             (LPBYTE)CURRENT_STACK16 - argsize, argsize );
+#endif
 }
 
 /***********************************************************************
@@ -753,6 +765,7 @@
  */
 void WINAPI REGS_FUNC(FT_PrologPrime)( CONTEXT *context )
 {
+#ifdef __i386__
     DWORD  targetTableOffset;
     LPBYTE relayCode;
 
@@ -767,6 +780,7 @@
 
     /* Jump to the call stub just created */
     EIP_reg(context) = (DWORD)relayCode;
+#endif
 }
 
 /***********************************************************************
@@ -782,6 +796,7 @@
  */
 void WINAPI REGS_FUNC(QT_ThunkPrime)( CONTEXT *context )
 {
+#ifdef __i386__
     DWORD  targetTableOffset;
     LPBYTE relayCode;
 
@@ -796,6 +811,7 @@
 
     /* Jump to the call stub just created */
     EIP_reg(context) = (DWORD)relayCode;
+#endif
 }
 
 /***********************************************************************
@@ -852,7 +868,7 @@
  *
  * This must be a register routine as it has to preserve *all* registers.
  */
-void WINAPI SSConfirmSmallStack( CONTEXT *context )
+void WINAPI SSConfirmSmallStack( CONTEXT86 *context )
 {
     /* We are always on the small stack while in 16-bit code ... */
 }
@@ -923,6 +939,7 @@
  */
 void WINAPI REGS_FUNC(W32S_BackTo32)( CONTEXT *context )
 {
+#ifdef __i386__
     LPDWORD stack = (LPDWORD)ESP_reg( context );
     FARPROC proc = (FARPROC)EIP_reg(context);
 
@@ -930,6 +947,7 @@
                                stack[6], stack[7], stack[8], stack[9], stack[10] );
 
     EIP_reg( context ) = STACK32_POP(context);
+#endif
 }
 
 /**********************************************************************
@@ -1000,7 +1018,7 @@
  * 		GetTEBSelectorFS	(KERNEL.475)
  * 	Set the 16-bit %fs to the 32-bit %fs (current TEB selector)
  */
-VOID WINAPI GetTEBSelectorFS16( CONTEXT *context ) 
+VOID WINAPI GetTEBSelectorFS16( CONTEXT86 *context ) 
 {
     GET_FS( FS_reg(context) );
 }
@@ -1067,6 +1085,7 @@
  */
 void WINAPI REGS_FUNC(K32Thk1632Prolog)( CONTEXT *context )
 {
+#ifdef __i386__
    LPBYTE code = (LPBYTE)EIP_reg(context) - 5;
 
    /* Arrrgh! SYSTHUNK.DLL just has to re-implement another method
@@ -1119,6 +1138,7 @@
    }
 
    SYSLEVEL_ReleaseWin16Lock();
+#endif
 }
 
 /***********************************************************************
@@ -1126,6 +1146,7 @@
  */
 void WINAPI REGS_FUNC(K32Thk1632Epilog)( CONTEXT *context )
 {
+#ifdef __i386__
    LPBYTE code = (LPBYTE)EIP_reg(context) - 13;
 
    SYSLEVEL_RestoreWin16Lock();
@@ -1153,6 +1174,7 @@
       TRACE_(thunk)("after  SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
                    EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack);
    }
+#endif
 }
 
 /***********************************************************************
diff --git a/win32/ordinals.c b/win32/ordinals.c
index 0392df7..6b0966f 100644
--- a/win32/ordinals.c
+++ b/win32/ordinals.c
@@ -56,6 +56,7 @@
  */
 void WINAPI REGS_FUNC(CommonUnimpStub)( CONTEXT *context )
 {
+#ifdef __i386__
     if (EAX_reg(context))
         MESSAGE( "*** Unimplemented Win32 API: %s\n", (LPSTR)EAX_reg(context) );
 
@@ -69,6 +70,7 @@
     }
 
     ESP_reg(context) += (ECX_reg(context) & 0x0f) * 4;
+#endif
 }
 
 /**********************************************************************
diff --git a/windows/win.c b/windows/win.c
index 585fd08..edd440c 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -2291,7 +2291,7 @@
     return IsWindow( hwnd );
 }
 
-void WINAPI WIN16_IsWindow16( CONTEXT *context )
+void WINAPI WIN16_IsWindow16( CONTEXT86 *context )
 {
     WORD *stack = PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context));
     HWND16 hwnd = (HWND16)stack[2];