Optimized include/*.h: (recursively) include all headers needed by
[wine/testsucceed.git] / msdos / interrupts.c
blobe1bf56b520488794a5352f96cd882ec37f8ca332
1 /*
2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
5 */
7 #include <sys/types.h>
9 #include "windows.h"
10 #include "drive.h"
11 #include "miscemu.h"
12 #include "msdos.h"
13 #include "module.h"
14 #include "stackframe.h"
15 #include "debug.h"
17 static FARPROC16 INT_Vectors[256];
20 /**********************************************************************
21 * INT_GetPMHandler
23 * Return the protected mode interrupt vector for a given interrupt.
25 FARPROC16 INT_GetPMHandler( BYTE intnum )
27 return INT_Vectors[intnum];
31 /**********************************************************************
32 * INT_SetPMHandler
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 /**********************************************************************
45 * INT_GetRMHandler
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 /**********************************************************************
56 * INT_SetRMHandler
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 /**********************************************************************
69 * INT_CtxGetHandler
71 * Return the interrupt vector for a given interrupt.
73 FARPROC16 INT_CtxGetHandler( CONTEXT *context, BYTE intnum )
75 if (ISV86(context))
76 return ((FARPROC16*)V86BASE(context))[intnum];
77 else
78 return INT_GetPMHandler(intnum);
82 /**********************************************************************
83 * INT_CtxSetHandler
85 * Set the interrupt handler for a given interrupt.
87 void INT_CtxSetHandler( CONTEXT *context, BYTE intnum, FARPROC16 handler )
89 if (ISV86(context)) {
90 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
91 intnum, HIWORD(handler), LOWORD(handler) );
92 ((FARPROC16*)V86BASE(context))[intnum] = handler;
93 } else
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 */
107 switch (intnum) {
108 case 0x10:
109 INT_Int10Handler(context);
110 break;
111 case 0x11:
112 INT_Int11Handler(context);
113 break;
114 case 0x12:
115 INT_Int12Handler(context);
116 break;
117 case 0x13:
118 INT_Int13Handler(context);
119 break;
120 case 0x15:
121 INT_Int15Handler(context);
122 break;
123 case 0x16:
124 INT_Int16Handler(context);
125 break;
126 case 0x17:
127 INT_Int17Handler(context);
128 break;
129 case 0x1a:
130 INT_Int1aHandler(context);
131 break;
132 case 0x20:
133 INT_Int20Handler(context);
134 break;
135 case 0x21:
136 DOS3Call(context);
137 break;
138 case 0x25:
139 INT_Int25Handler(context);
140 break;
141 case 0x2f:
142 INT_Int2fHandler(context);
143 break;
144 case 0x31:
145 INT_Int31Handler(context);
146 break;
147 case 0x29:
148 INT_Int29Handler(context);
149 break;
150 default:
151 FIXME(int, "Unknown Interrupt in DOS mode: 0x%x\n", intnum);
152 return 1;
154 return 0;