Removed obsolete header files
[reactos.git] / reactos / ntoskrnl / ke / i386 / usercall.c
1 /* $Id: usercall.c,v 1.20 2001/03/16 18:11:23 dwelch Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/hal/x86/usercall.c
6 * PURPOSE: 2E interrupt handler
7 * PROGRAMMER: David Welch (david.welch@seh.ox.ac.uk)
8 * UPDATE HISTORY:
9 * ???
10 */
11
12 /* INCLUDES ******************************************************************/
13
14 #include <ddk/ntddk.h>
15 #include <internal/ntoskrnl.h>
16 #include <internal/ke.h>
17 #include <internal/ps.h>
18 #include <internal/i386/segment.h>
19 #include <internal/i386/mm.h>
20
21 #define NDEBUG
22 #include <internal/debug.h>
23 #include <ddk/service.h>
24
25 #include <ddk/defines.h>
26 #include <internal/ps.h>
27
28 /* FUNCTIONS *****************************************************************/
29
30 VOID KiSystemCallHook(ULONG Nr, ...)
31 {
32 #if 0
33 va_list ap;
34 ULONG i;
35
36 va_start(ap, Nr);
37
38 DbgPrint("%x/%d ", KeServiceDescriptorTable[0].SSDT[Nr].SysCallPtr, Nr);
39 DbgPrint("%x (", KeServiceDescriptorTable[0].SSPT[Nr].ParamBytes);
40 for (i = 0; i < KeServiceDescriptorTable[0].SSPT[Nr].ParamBytes / 4; i++)
41 {
42 DbgPrint("%x, ", va_arg(ap, ULONG));
43 }
44 DbgPrint(")\n");
45 assert_irql(PASSIVE_LEVEL);
46 va_end(ap);
47 #endif
48 }
49
50 ULONG KiAfterSystemCallHook(ULONG NtStatus, PKTRAP_FRAME TrapFrame)
51 {
52 if (KeGetCurrentThread()->Alerted[1] != 0 && TrapFrame->Cs != KERNEL_CS)
53 {
54 KiDeliverNormalApc();
55 }
56 if (KeGetCurrentThread()->Alerted[0] != 0 && TrapFrame->Cs != KERNEL_CS)
57 {
58 KiDeliverUserApc(TrapFrame);
59 }
60 return(NtStatus);
61 }
62
63 // This function should be used by win32k.sys to add its own user32/gdi32 services
64 // TableIndex is 0 based
65 // ServiceCountTable its not used at the moment
66 BOOLEAN STDCALL
67 KeAddSystemServiceTable (
68 PSSDT SSDT,
69 PULONG ServiceCounterTable,
70 ULONG NumberOfServices,
71 PSSPT SSPT,
72 ULONG TableIndex
73 )
74 {
75 if (TableIndex > SSDT_MAX_ENTRIES - 1)
76 return FALSE;
77
78 /* check if descriptor table entry is free */
79 if ((KeServiceDescriptorTable[TableIndex].SSDT != NULL) ||
80 (KeServiceDescriptorTableShadow[TableIndex].SSDT != NULL))
81 return FALSE;
82
83 /* initialize the shadow service descriptor table */
84 KeServiceDescriptorTableShadow[TableIndex].SSDT = SSDT;
85 KeServiceDescriptorTableShadow[TableIndex].SSPT = SSPT;
86 KeServiceDescriptorTableShadow[TableIndex].NumberOfServices = NumberOfServices;
87 KeServiceDescriptorTableShadow[TableIndex].ServiceCounterTable = ServiceCounterTable;
88
89 /* initialize the service descriptor table (not for win32k services) */
90 if (TableIndex != 1)
91 {
92 KeServiceDescriptorTable[TableIndex].SSDT = SSDT;
93 KeServiceDescriptorTable[TableIndex].SSPT = SSPT;
94 KeServiceDescriptorTable[TableIndex].NumberOfServices = NumberOfServices;
95 KeServiceDescriptorTable[TableIndex].ServiceCounterTable = ServiceCounterTable;
96 }
97
98 return TRUE;
99 }
100
101 /* EOF */