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