Initial revision
[reactos.git] / msvc6 / ntoskrnl / ke_i386_irqhand.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2000 David Welch <welch@cwcom.net>
4 *
5 * Moved to MSVC-compatible inline assembler by Mike Nordell, 2003-12-26
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 /*
22 * FILE: ntoskrnl/ke/i386/vm86_sup.S
23 * PURPOSE: V86 mode support
24 * PROGRAMMER: David Welch (welch@cwcom.net)
25 * UPDATE HISTORY:
26 * Created 09/10/00
27 */
28
29 /* INCLUDES ******************************************************************/
30
31 #pragma hdrstop
32
33 #include <ddk/ntddk.h>
34 #include <ddk/status.h>
35 #include <internal/i386/segment.h>
36 #include <internal/i386/fpu.h>
37 #include <internal/ps.h>
38 #include <ddk/defines.h>
39 #include <internal/v86m.h>
40 #include <ntos/tss.h>
41 #include <internal/trap.h>
42 #include <internal/ps.h>
43
44 #include <roscfg.h>
45 #include <internal/ntoskrnl.h>
46 #include <internal/i386/segment.h>
47
48 // no arg-list, but asm doesn't care anyway
49 void KiInterruptDispatch();
50
51
52 #define DEFINE_INT_HANDLER(N) \
53 __declspec(naked) \
54 void irq_handler_##N() \
55 { \
56 __asm pushad \
57 __asm push ds \
58 __asm push es \
59 __asm push fs \
60 __asm mov eax, 0xceafbeef \
61 __asm push eax \
62 __asm mov ax, KERNEL_DS \
63 __asm mov ds, ax \
64 __asm mov es, ax \
65 __asm mov ax, PCR_SELECTOR \
66 __asm mov fs, ax \
67 __asm push esp \
68 __asm push N \
69 __asm call KiInterruptDispatch \
70 __asm pop eax \
71 __asm pop eax \
72 __asm pop eax \
73 __asm pop fs \
74 __asm pop es \
75 __asm pop ds \
76 __asm popad \
77 __asm iretd
78 // NOTE: The inline assembler can't deal with having the final brace,
79 // ending the function, on the same line as an __asm, why there is
80 // none here and it MUST be added when using the macro!
81
82 DEFINE_INT_HANDLER(0)
83 }
84 DEFINE_INT_HANDLER(1)
85 }
86 DEFINE_INT_HANDLER(2)
87 }
88 DEFINE_INT_HANDLER(3)
89 }
90 DEFINE_INT_HANDLER(4)
91 }
92 DEFINE_INT_HANDLER(5)
93 }
94 DEFINE_INT_HANDLER(6)
95 }
96 DEFINE_INT_HANDLER(7)
97 }
98 DEFINE_INT_HANDLER(8)
99 }
100 DEFINE_INT_HANDLER(9)
101 }
102 DEFINE_INT_HANDLER(10)
103 }
104 DEFINE_INT_HANDLER(11)
105 }
106 DEFINE_INT_HANDLER(12)
107 }
108 DEFINE_INT_HANDLER(13)
109 }
110 DEFINE_INT_HANDLER(14)
111 }
112 DEFINE_INT_HANDLER(15)
113 }
114