Correct usage of a scratch array in X11DRV_PolyBezier.
[wine.git] / msdos / interrupts.c
blobabfe861614d2e690b723ef3858ab2e4cecfe0308
1 /*
2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
5 */
7 #include <sys/types.h>
8 #include "windef.h"
9 #include "miscemu.h"
10 #include "msdos.h"
11 #include "debugtools.h"
13 DEFAULT_DEBUG_CHANNEL(int)
15 static FARPROC16 INT_Vectors[256];
18 /**********************************************************************
19 * INT_GetPMHandler
21 * Return the protected mode interrupt vector for a given interrupt.
23 FARPROC16 INT_GetPMHandler( BYTE intnum )
25 return INT_Vectors[intnum];
29 /**********************************************************************
30 * INT_SetPMHandler
32 * Set the protected mode interrupt handler for a given interrupt.
34 void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
36 TRACE("Set protected mode interrupt vector %02x <- %04x:%04x\n",
37 intnum, HIWORD(handler), LOWORD(handler) );
38 INT_Vectors[intnum] = handler;
42 /**********************************************************************
43 * INT_GetRMHandler
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 /**********************************************************************
54 * INT_SetRMHandler
56 * Set the real mode interrupt handler for a given interrupt.
58 void INT_SetRMHandler( BYTE intnum, FARPROC16 handler )
60 TRACE("Set real mode interrupt vector %02x <- %04x:%04x\n",
61 intnum, HIWORD(handler), LOWORD(handler) );
62 ((FARPROC16*)DOSMEM_MemoryBase(0))[intnum] = handler;
66 /**********************************************************************
67 * INT_CtxGetHandler
69 * Return the interrupt vector for a given interrupt.
71 FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum )
73 if (ISV86(context))
74 return ((FARPROC16*)V86BASE(context))[intnum];
75 else
76 return INT_GetPMHandler(intnum);
80 /**********************************************************************
81 * INT_CtxSetHandler
83 * Set the interrupt handler for a given interrupt.
85 void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler )
87 if (ISV86(context)) {
88 TRACE("Set real mode interrupt vector %02x <- %04x:%04x\n",
89 intnum, HIWORD(handler), LOWORD(handler) );
90 ((FARPROC16*)V86BASE(context))[intnum] = handler;
91 } else
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 */
105 switch (intnum) {
106 case 0x09:
107 INT_Int09Handler(context);
108 break;
109 case 0x10:
110 INT_Int10Handler(context);
111 break;
112 case 0x11:
113 INT_Int11Handler(context);
114 break;
115 case 0x12:
116 INT_Int12Handler(context);
117 break;
118 case 0x13:
119 INT_Int13Handler(context);
120 break;
121 case 0x15:
122 INT_Int15Handler(context);
123 break;
124 case 0x16:
125 INT_Int16Handler(context);
126 break;
127 case 0x17:
128 INT_Int17Handler(context);
129 break;
130 case 0x1a:
131 INT_Int1aHandler(context);
132 break;
133 case 0x20:
134 INT_Int20Handler(context);
135 break;
136 case 0x21:
137 DOS3Call(context);
138 break;
139 case 0x25:
140 INT_Int25Handler(context);
141 break;
142 case 0x29:
143 INT_Int29Handler(context);
144 break;
145 case 0x2f:
146 INT_Int2fHandler(context);
147 break;
148 case 0x31:
149 INT_Int31Handler(context);
150 break;
151 case 0x33:
152 INT_Int33Handler(context);
153 break;
154 default:
155 FIXME("Unknown Interrupt in DOS mode: 0x%x\n", intnum);
156 return 1;
158 return 0;