d62a7f8a834885eb03848681cf9bedf842804e79
[reactos.git] / reactos / include / reactos / arm / armddk.h
1 #ifndef _ARMDDK_
2 #define _ARMDDK_
3
4 //
5 // IRQLs
6 //
7 #define PASSIVE_LEVEL 0
8 #define LOW_LEVEL 0
9 #define APC_LEVEL 1
10 #define DISPATCH_LEVEL 2
11 #define SYNCH_LEVEL DISPATCH_LEVEL
12 #define PROFILE_LEVEL 27
13 #define CLOCK1_LEVEL 28
14 #define CLOCK2_LEVEL 28
15 #define IPI_LEVEL 29
16 #define POWER_LEVEL 30
17 #define HIGH_LEVEL 31
18
19 //
20 // FIXME: mmtypes.h?
21 //
22 #define KIPCR 0xFFFFF000
23 #define KI_USER_SHARED_DATA 0xFFFFE000
24 #define USPCR 0x7FFF0000
25 #define PCR ((volatile KPCR * const)KIPCR)
26 #define USERPCR ((volatile KPCR * const)USPCR)
27
28 //
29 // Maximum IRQs
30 //
31 #define MAXIMUM_VECTOR 16
32
33 //
34 // Just read it from the PCR
35 //
36 #define KeGetCurrentProcessorNumber() (int)PCR->Number
37 #define KeGetCurrentIrql() PCR->CurrentIrql
38 #define _KeGetCurrentThread() PCR->CurrentThread
39 #define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
40 #define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
41 #define KeGetCurrentThread() _KeGetCurrentThread()
42 #define KeGetPreviousMode() _KeGetPreviousMode()
43 #define KeGetDcacheFillSize() PCR->DcacheFillSize
44
45
46 //
47 // Types to use to contain PFNs and their counts.
48 //
49 typedef ULONG PFN_COUNT;
50 typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
51 typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
52
53 //
54 // Stub
55 //
56 typedef struct _KFLOATING_SAVE
57 {
58 ULONG Reserved;
59 } KFLOATING_SAVE, *PKFLOATING_SAVE;
60
61 //
62 // Processor Control Region
63 // On ARM, it's actually readable from user-mode, much like KUSER_SHARED_DATA
64 //
65 #ifdef _WINNT_H
66 typedef
67 VOID
68 (*PKINTERRUPT_ROUTINE)(VOID);
69 #endif
70 typedef struct _KPCR
71 {
72 ULONG MinorVersion;
73 ULONG MajorVersion;
74 PKINTERRUPT_ROUTINE InterruptRoutine[MAXIMUM_VECTOR];
75 PVOID XcodeDispatch;
76 ULONG FirstLevelDcacheSize;
77 ULONG FirstLevelDcacheFillSize;
78 ULONG FirstLevelIcacheSize;
79 ULONG FirstLevelIcacheFillSize;
80 ULONG SecondLevelDcacheSize;
81 ULONG SecondLevelDcacheFillSize;
82 ULONG SecondLevelIcacheSize;
83 ULONG SecondLevelIcacheFillSize;
84 struct _KPRCB *Prcb;
85 struct _TEB *Teb;
86 PVOID TlsArray;
87 ULONG DcacheFillSize;
88 ULONG IcacheAlignment;
89 ULONG IcacheFillSize;
90 ULONG ProcessorId;
91 ULONG ProfileInterval;
92 ULONG ProfileCount;
93 ULONG StallExecutionCount;
94 ULONG StallScaleFactor;
95 CCHAR Number;
96 PVOID DataBusError;
97 PVOID InstructionBusError;
98 ULONG CachePolicy;
99 ULONG AlignedCachePolicy;
100 UCHAR IrqlMask[HIGH_LEVEL + 1];
101 ULONG IrqlTable[HIGH_LEVEL + 1];
102 UCHAR CurrentIrql;
103 KAFFINITY SetMember;
104 struct _KTHREAD *CurrentThread;
105 ULONG ReservedVectors;
106 KAFFINITY NotMember;
107 ULONG SystemReserved[6];
108 ULONG DcacheAlignment;
109 ULONG HalReserved[64];
110 BOOLEAN FirstLevelActive;
111 BOOLEAN DpcRoutineActive;
112 ULONG CurrentPid;
113 BOOLEAN OnInterruptStack;
114 PVOID SavedInitialStack;
115 PVOID SavedStackLimit;
116 PVOID SystemServiceDispatchStart;
117 PVOID SystemServiceDispatchEnd;
118 PVOID InterruptStack;
119 PVOID PanicStack;
120 PVOID BadVaddr;
121 PVOID InitialStack;
122 PVOID StackLimit;
123 ULONG QuantumEnd;
124 PVOID PerfGlobalGroupMask;
125 ULONG ContextSwitches;
126 } KPCR, *PKPCR;
127
128 //
129 // Get the current TEB
130 //
131 FORCEINLINE
132 struct _TEB* NtCurrentTeb(VOID)
133 {
134 return (struct _TEB*)USERPCR->Teb;
135 }
136
137 //
138 // IRQL Support on ARM is similar to MIPS/ALPHA
139 //
140 KIRQL
141 KfRaiseIrql(
142 IN KIRQL NewIrql
143 );
144
145 VOID
146 KfLowerIrql(
147 IN KIRQL NewIrql
148 );
149
150 KIRQL
151 KeRaiseIrqlToSynchLevel(
152 VOID
153 );
154
155 KIRQL
156 KeRaiseIrqlToDpcLevel(
157 VOID
158 );
159
160 #define KeLowerIrql(NewIrql) KfLowerIrql(NewIrql)
161 #define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KfRaiseIrql(NewIrql)
162
163 //
164 // Cache clean and flush
165 //
166 VOID
167 HalSweepDcache(
168 VOID
169 );
170
171 VOID
172 HalSweepIcache(
173 VOID
174 );
175
176 #endif