2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
14 #include "stackframe.h"
17 static FARPROC16 INT_Vectors
[256];
20 /**********************************************************************
23 * Return the protected mode interrupt vector for a given interrupt.
25 FARPROC16
INT_GetPMHandler( BYTE intnum
)
27 return INT_Vectors
[intnum
];
31 /**********************************************************************
34 * Set the protected mode interrupt handler for a given interrupt.
36 void INT_SetPMHandler( BYTE intnum
, FARPROC16 handler
)
38 TRACE(int, "Set protected mode interrupt vector %02x <- %04x:%04x\n",
39 intnum
, HIWORD(handler
), LOWORD(handler
) );
40 INT_Vectors
[intnum
] = handler
;
44 /**********************************************************************
47 * Return the real mode interrupt vector for a given interrupt.
49 FARPROC16
INT_GetRMHandler( BYTE intnum
)
51 return ((FARPROC16
*)DOSMEM_MemoryBase(0))[intnum
];
55 /**********************************************************************
58 * Set the real mode interrupt handler for a given interrupt.
60 void INT_SetRMHandler( BYTE intnum
, FARPROC16 handler
)
62 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
63 intnum
, HIWORD(handler
), LOWORD(handler
) );
64 ((FARPROC16
*)DOSMEM_MemoryBase(0))[intnum
] = handler
;
68 /**********************************************************************
71 * Return the interrupt vector for a given interrupt.
73 FARPROC16
INT_CtxGetHandler( CONTEXT
*context
, BYTE intnum
)
76 return ((FARPROC16
*)V86BASE(context
))[intnum
];
78 return INT_GetPMHandler(intnum
);
82 /**********************************************************************
85 * Set the interrupt handler for a given interrupt.
87 void INT_CtxSetHandler( CONTEXT
*context
, BYTE intnum
, FARPROC16 handler
)
90 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
91 intnum
, HIWORD(handler
), LOWORD(handler
) );
92 ((FARPROC16
*)V86BASE(context
))[intnum
] = handler
;
94 INT_SetPMHandler(intnum
, handler
);
98 /**********************************************************************
99 * INT_RealModeInterrupt
101 * Handle real mode interrupts
103 int INT_RealModeInterrupt( BYTE intnum
, PCONTEXT context
)
105 /* we should really map to if1632/wprocs.spec, but not all
106 * interrupt handlers are adapted to support real mode yet */
109 INT_Int10Handler(context
);
112 INT_Int11Handler(context
);
115 INT_Int13Handler(context
);
118 INT_Int16Handler(context
);
121 INT_Int17Handler(context
);
124 INT_Int1aHandler(context
);
127 INT_Int20Handler(context
);
133 INT_Int25Handler(context
);
136 INT_Int2fHandler(context
);
139 INT_Int31Handler(context
);
142 INT_Int29Handler(context
);
145 FIXME(int, "Unknown Interrupt in DOS mode: 0x%x\n", intnum
);