2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
13 DEFAULT_DEBUG_CHANNEL(int)
15 static FARPROC16 INT_Vectors[256];
18 /**********************************************************************
21 * Return the protected mode interrupt vector for a given interrupt.
23 FARPROC16 INT_GetPMHandler( BYTE intnum )
25 return INT_Vectors[intnum];
29 /**********************************************************************
32 * Set the protected mode interrupt handler for a given interrupt.
34 void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
36 TRACE(int, "Set protected mode interrupt vector %02x <- %04x:%04x\n",
37 intnum, HIWORD(handler), LOWORD(handler) );
38 INT_Vectors[intnum] = handler;
42 /**********************************************************************
45 * Return the real mode interrupt vector for a given interrupt.
47 FARPROC16 INT_GetRMHandler( BYTE intnum )
49 return ((FARPROC16*)DOSMEM_MemoryBase(0))[intnum];
53 /**********************************************************************
56 * Set the real mode interrupt handler for a given interrupt.
58 void INT_SetRMHandler( BYTE intnum, FARPROC16 handler )
60 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
61 intnum, HIWORD(handler), LOWORD(handler) );
62 ((FARPROC16*)DOSMEM_MemoryBase(0))[intnum] = handler;
66 /**********************************************************************
69 * Return the interrupt vector for a given interrupt.
71 FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum )
74 return ((FARPROC16*)V86BASE(context))[intnum];
76 return INT_GetPMHandler(intnum);
80 /**********************************************************************
83 * Set the interrupt handler for a given interrupt.
85 void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler )
88 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
89 intnum, HIWORD(handler), LOWORD(handler) );
90 ((FARPROC16*)V86BASE(context))[intnum] = handler;
92 INT_SetPMHandler(intnum, handler);
96 /**********************************************************************
97 * INT_RealModeInterrupt
99 * Handle real mode interrupts
101 int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context )
103 /* we should really map to if1632/wprocs.spec, but not all
104 * interrupt handlers are adapted to support real mode yet */
107 INT_Int09Handler(context);
110 INT_Int10Handler(context);
113 INT_Int11Handler(context);
116 INT_Int12Handler(context);
119 INT_Int13Handler(context);
122 INT_Int15Handler(context);
125 INT_Int16Handler(context);
128 INT_Int17Handler(context);
131 INT_Int1aHandler(context);
134 INT_Int20Handler(context);
140 INT_Int25Handler(context);
143 INT_Int29Handler(context);
146 INT_Int2fHandler(context);
149 INT_Int31Handler(context);
152 INT_Int33Handler(context);
155 FIXME(int, "Unknown Interrupt in DOS mode: 0x%x\n", intnum);