3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/kd/service.c
6 * PURPOSE: Debug service dispatcher
8 * PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
14 /* FUNCTIONS ***************************************************************/
17 * Note: DON'T CHANGE THIS FUNCTION!!!
18 * DON'T CALL HalDisplayString OR SOMETING ELSE!!!
19 * You'll only break the serial/bochs debugging feature!!!
23 KdpServiceDispatcher (
32 case 1: /* DbgPrint */
33 Result
= KdpPrintString ((PANSI_STRING
)Context1
);
37 HalDisplayString ("Invalid debug service call!\n");
46 #define STR(x) _STR(x)
50 void interrupt_handler2d(void);
51 __asm__("\n\t.global _interrupt_handler2d\n\t"
52 "_interrupt_handler2d:\n\t"
54 /* Save the user context */
55 "pushl %ebp\n\t" /* Ebp */
57 "pushl %eax\n\t" /* Eax */
58 "pushl %ecx\n\t" /* Ecx */
59 "pushl %edx\n\t" /* Edx */
60 "pushl %ebx\n\t" /* Ebx */
61 "pushl %esi\n\t" /* Esi */
62 "pushl %edi\n\t" /* Edi */
64 "pushl %ds\n\t" /* SegDs */
65 "pushl %es\n\t" /* SegEs */
66 "pushl %fs\n\t" /* SegFs */
67 "pushl %gs\n\t" /* SegGs */
69 "subl $112,%esp\n\t" /* FloatSave */
71 "pushl $0\n\t" /* Dr7 */
72 "pushl $0\n\t" /* Dr6 */
73 "pushl $0\n\t" /* Dr3 */
74 "pushl $0\n\t" /* Dr2 */
75 "pushl $0\n\t" /* Dr1 */
76 "pushl $0\n\t" /* Dr0 */
78 "pushl $0\n\t" /* ContextFlags */
80 /* Set ES to kernel segment */
81 "movw $"STR(KERNEL_DS
)",%bx\n\t"
84 /* FIXME: check to see if SS is valid/inrange */
86 /* DS and GS are now also kernel segments */
90 /* Set FS to the PCR */
91 "movw $"STR(PCR_SELECTOR
)",%bx\n\t"
94 /* Call debug service dispatcher */
98 "call _KdpServiceDispatcher\n\t"
99 "addl $12,%esp\n\t" /* restore stack pointer */
101 /* Restore the user context */
102 "addl $4,%esp\n\t" /* UserContext */
103 "addl $24,%esp\n\t" /* Dr[0-3,6-7] */
104 "addl $112,%esp\n\t" /* FloatingSave */
105 "popl %gs\n\t" /* SegGs */
106 "popl %fs\n\t" /* SegFs */
107 "popl %es\n\t" /* SegEs */
108 "popl %ds\n\t" /* SegDs */
110 "popl %edi\n\t" /* Edi */
111 "popl %esi\n\t" /* Esi */
112 "popl %ebx\n\t" /* Ebx */
113 "popl %edx\n\t" /* Edx */
114 "popl %ecx\n\t" /* Ecx */
115 "addl $4,%esp\n\t" /* Eax (Not restored) */
117 "popl %ebp\n\t" /* Ebp */
121 #elif defined(_MSC_VER)
124 void interrupt_handler2d()
128 /* Save the user context */
142 sub esp
, 112 /* FloatSave */
145 mov eax
, dr7 __asm push eax
146 mov eax
, dr6 __asm push eax
147 mov eax
, dr3 __asm push eax
148 mov eax
, dr2 __asm push eax
149 mov eax
, dr1 __asm push eax
150 mov eax
, dr0 __asm push eax
153 push
0 /* ContextFlags */
155 /* Set ES to kernel segment */
159 /* FIXME: check to see if SS is valid/inrange */
161 mov ds
, bx
/* DS is now also kernel segment */
163 /* Call debug service dispatcher */
167 call KdpServiceDispatcher
168 add esp
, 12 /* restore stack pointer */
170 /* Restore the user context */
171 add esp
, 4 /* UserContext */
172 pop eax __asm mov dr0
, eax
173 pop eax __asm mov dr1
, eax
174 pop eax __asm mov dr2
, eax
175 pop eax __asm mov dr3
, eax
176 pop eax __asm mov dr6
, eax
177 pop eax __asm mov dr7
, eax
178 add esp
, 112 /* FloatingSave */
189 add esp
, 4 /* Eax Not restored */
198 #error Unknown compiler for inline assembler