Sync with trunk head (part 1 of x)
[reactos.git] / include / xdk / ppc / ke.h
1 $if (_WDMDDK_)
2
3 /* Interrupt request levels */
4 #define PASSIVE_LEVEL 0
5 #define LOW_LEVEL 0
6 #define APC_LEVEL 1
7 #define DISPATCH_LEVEL 2
8 #define PROFILE_LEVEL 27
9 #define CLOCK1_LEVEL 28
10 #define CLOCK2_LEVEL 28
11 #define IPI_LEVEL 29
12 #define POWER_LEVEL 30
13 #define HIGH_LEVEL 31
14
15 //
16 // Used to contain PFNs and PFN counts
17 //
18 typedef ULONG PFN_COUNT;
19 typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
20 typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
21
22
23 typedef struct _KFLOATING_SAVE {
24 ULONG Dummy;
25 } KFLOATING_SAVE, *PKFLOATING_SAVE;
26
27 typedef struct _KPCR_TIB {
28 PVOID ExceptionList; /* 00 */
29 PVOID StackBase; /* 04 */
30 PVOID StackLimit; /* 08 */
31 PVOID SubSystemTib; /* 0C */
32 _ANONYMOUS_UNION union {
33 PVOID FiberData; /* 10 */
34 ULONG Version; /* 10 */
35 } DUMMYUNIONNAME;
36 PVOID ArbitraryUserPointer; /* 14 */
37 struct _KPCR_TIB *Self; /* 18 */
38 } KPCR_TIB, *PKPCR_TIB; /* 1C */
39
40 #define PCR_MINOR_VERSION 1
41 #define PCR_MAJOR_VERSION 1
42
43 typedef struct _KPCR {
44 KPCR_TIB Tib; /* 00 */
45 struct _KPCR *Self; /* 1C */
46 struct _KPRCB *Prcb; /* 20 */
47 KIRQL Irql; /* 24 */
48 ULONG IRR; /* 28 */
49 ULONG IrrActive; /* 2C */
50 ULONG IDR; /* 30 */
51 PVOID KdVersionBlock; /* 34 */
52 PUSHORT IDT; /* 38 */
53 PUSHORT GDT; /* 3C */
54 struct _KTSS *TSS; /* 40 */
55 USHORT MajorVersion; /* 44 */
56 USHORT MinorVersion; /* 46 */
57 KAFFINITY SetMember; /* 48 */
58 ULONG StallScaleFactor; /* 4C */
59 UCHAR SpareUnused; /* 50 */
60 UCHAR Number; /* 51 */
61 } KPCR, *PKPCR; /* 54 */
62
63 #define KeGetPcr() PCR
64
65 #define YieldProcessor() __asm__ __volatile__("nop");
66
67 FORCEINLINE
68 ULONG
69 NTAPI
70 KeGetCurrentProcessorNumber(VOID)
71 {
72 ULONG Number;
73 __asm__ __volatile__ (
74 "lwz %0, %c1(12)\n"
75 : "=r" (Number)
76 : "i" (FIELD_OFFSET(KPCR, Number))
77 );
78 return Number;
79 }
80
81 NTHALAPI
82 VOID
83 FASTCALL
84 KfLowerIrql(
85 IN KIRQL NewIrql);
86 #define KeLowerIrql(a) KfLowerIrql(a)
87
88 NTHALAPI
89 KIRQL
90 FASTCALL
91 KfRaiseIrql(
92 IN KIRQL NewIrql);
93 #define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
94
95 NTHALAPI
96 KIRQL
97 NTAPI
98 KeRaiseIrqlToDpcLevel(VOID);
99
100 NTHALAPI
101 KIRQL
102 NTAPI
103 KeRaiseIrqlToSynchLevel(VOID);
104
105 $endif
106
107