- Implement support for reading and writing physical memory for KD. The implementatio...
[reactos.git] / reactos / ntoskrnl / include / internal / i386 / ke.h
1 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_KE_H
2 #define __NTOSKRNL_INCLUDE_INTERNAL_I386_KE_H
3
4 #ifndef __ASM__
5
6 #include "intrin_i.h"
7 #include "v86m.h"
8
9 extern ULONG Ke386CacheAlignment;
10
11 #define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_I386
12
13 //
14 // INT3 is 1 byte long
15 //
16 #define KD_BREAKPOINT_TYPE UCHAR
17 #define KD_BREAKPOINT_SIZE sizeof(UCHAR)
18 #define KD_BREAKPOINT_VALUE 0xCC
19
20 //
21 // Macros for getting and setting special purpose registers in portable code
22 //
23 #define KeGetContextPc(Context) \
24 ((Context)->Eip)
25
26 #define KeSetContextPc(Context, ProgramCounter) \
27 ((Context)->Eip = (ProgramCounter))
28
29 #define KeGetTrapFramePc(TrapFrame) \
30 ((TrapFrame)->Eip)
31
32 #define KeGetContextReturnRegister(Context) \
33 ((Context)->Eax)
34
35 #define KeSetContextReturnRegister(Context, ReturnValue) \
36 ((Context)->Eax = (ReturnValue))
37
38 //
39 // Returns the Interrupt State from a Trap Frame.
40 // ON = TRUE, OFF = FALSE
41 //
42 #define KeGetTrapFrameInterruptState(TrapFrame) \
43 BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK)
44
45 //
46 // Invalidates the TLB entry for a specified address
47 //
48 FORCEINLINE
49 VOID
50 KeInvalidateTlbEntry(IN PVOID Address)
51 {
52 /* Invalidate the TLB entry for this address */
53 __invlpg(Address);
54 }
55
56 VOID
57 FASTCALL
58 Ki386InitializeTss(
59 IN PKTSS Tss,
60 IN PKIDTENTRY Idt,
61 IN PKGDTENTRY Gdt
62 );
63
64 VOID
65 NTAPI
66 KiSetCR0Bits(VOID);
67
68 VOID
69 NTAPI
70 KiGetCacheInformation(VOID);
71
72 BOOLEAN
73 NTAPI
74 KiIsNpxPresent(
75 VOID
76 );
77
78 BOOLEAN
79 NTAPI
80 KiIsNpxErrataPresent(
81 VOID
82 );
83
84 VOID
85 NTAPI
86 KiSetProcessorType(VOID);
87
88 ULONG
89 NTAPI
90 KiGetFeatureBits(VOID);
91
92 #ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
93 VOID
94 NTAPI
95 KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine,
96 PKSTART_ROUTINE StartRoutine,
97 PVOID StartContext,
98 BOOLEAN UserThread,
99 KTRAP_FRAME TrapFrame);
100 #endif
101
102 NTSTATUS
103 NTAPI
104 Ke386GetGdtEntryThread(
105 IN PKTHREAD Thread,
106 IN ULONG Offset,
107 IN PKGDTENTRY Descriptor
108 );
109
110 #endif
111 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_KE_H */
112
113 /* EOF */