2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/kd/service.c
5 * PURPOSE: Debug service dispatcher
7 * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
13 /* FUNCTIONS ***************************************************************/
16 #define STR(x) _STR(x)
20 void interrupt_handler2d(void);
21 __asm__("\n\t.global _interrupt_handler2d\n\t"
22 "_interrupt_handler2d:\n\t"
24 /* Save the user context */
25 "pushl %ebp\n\t" /* Ebp */
27 "pushl %eax\n\t" /* Eax */
28 "pushl %ecx\n\t" /* Ecx */
29 "pushl %edx\n\t" /* Edx */
30 "pushl %ebx\n\t" /* Ebx */
31 "pushl %esi\n\t" /* Esi */
32 "pushl %edi\n\t" /* Edi */
34 "pushl %ds\n\t" /* SegDs */
35 "pushl %es\n\t" /* SegEs */
36 "pushl %fs\n\t" /* SegFs */
37 "pushl %gs\n\t" /* SegGs */
39 "subl $112,%esp\n\t" /* FloatSave */
41 "pushl $0\n\t" /* Dr7 */
42 "pushl $0\n\t" /* Dr6 */
43 "pushl $0\n\t" /* Dr3 */
44 "pushl $0\n\t" /* Dr2 */
45 "pushl $0\n\t" /* Dr1 */
46 "pushl $0\n\t" /* Dr0 */
48 "pushl $0\n\t" /* ContextFlags */
50 /* Set ES to kernel segment */
51 "movw $"STR(KERNEL_DS
)",%bx\n\t"
54 /* FIXME: check to see if SS is valid/inrange */
56 /* DS and GS are now also kernel segments */
60 /* Set FS to the PCR */
61 "movw $"STR(PCR_SELECTOR
)",%bx\n\t"
64 /* Call debug service dispatcher */
68 "call _KdpServiceDispatcher@12\n\t"
70 /* Restore the user context */
71 "addl $4,%esp\n\t" /* UserContext */
72 "addl $24,%esp\n\t" /* Dr[0-3,6-7] */
73 "addl $112,%esp\n\t" /* FloatingSave */
74 "popl %gs\n\t" /* SegGs */
75 "popl %fs\n\t" /* SegFs */
76 "popl %es\n\t" /* SegEs */
77 "popl %ds\n\t" /* SegDs */
79 "popl %edi\n\t" /* Edi */
80 "popl %esi\n\t" /* Esi */
81 "popl %ebx\n\t" /* Ebx */
82 "popl %edx\n\t" /* Edx */
83 "popl %ecx\n\t" /* Ecx */
84 "addl $4,%esp\n\t" /* Eax (Not restored) */
86 "popl %ebp\n\t" /* Ebp */
90 #elif defined(_MSC_VER)
93 void interrupt_handler2d()
97 /* Save the user context */
111 sub esp
, 112 /* FloatSave */
114 mov eax
, dr7 __asm push eax
115 mov eax
, dr6 __asm push eax
116 mov eax
, dr3 __asm push eax
117 mov eax
, dr2 __asm push eax
118 mov eax
, dr1 __asm push eax
119 mov eax
, dr0 __asm push eax
122 push
0 /* ContextFlags */
124 /* Set ES to kernel segment */
128 /* FIXME: check to see if SS is valid/inrange */
130 mov ds
, bx
/* DS is now also kernel segment */
132 /* Call debug service dispatcher */
136 call KdpServiceDispatcher
137 add esp
, 12 /* restore stack pointer */
139 /* Restore the user context */
140 add esp
, 4 /* UserContext */
141 pop eax __asm mov dr0
, eax
142 pop eax __asm mov dr1
, eax
143 pop eax __asm mov dr2
, eax
144 pop eax __asm mov dr3
, eax
145 pop eax __asm mov dr6
, eax
146 pop eax __asm mov dr7
, eax
147 add esp
, 112 /* FloatingSave */
158 add esp
, 4 /* Eax Not restored */
167 #error Unknown compiler for inline assembler