Sync with trunk head
[reactos.git] / include / reactos / arm / armddk.h
1 #ifndef _ARMDDK_
2 #define _ARMDDK_
3
4 //
5 // Page size
6 //
7 #ifndef PAGE_SIZE
8 #define PAGE_SIZE 0x1000
9 #endif
10
11 #ifndef _WINNT_H
12 //
13 // IRQLs
14 //
15 #define PASSIVE_LEVEL 0
16 #define LOW_LEVEL 0
17 #define APC_LEVEL 1
18 #define DISPATCH_LEVEL 2
19 #define SYNCH_LEVEL DISPATCH_LEVEL
20 #define PROFILE_LEVEL 27
21 #define CLOCK1_LEVEL 28
22 #define CLOCK2_LEVEL 28
23 #define IPI_LEVEL 29
24 #define POWER_LEVEL 30
25 #define HIGH_LEVEL 31
26 #endif
27
28 //
29 // FIXME: mmtypes.h?
30 //
31 #define KIP0PCRADDRESS 0xFFDFF000
32 #define KI_USER_SHARED_DATA 0xFFDF0000
33 #define USPCR 0x7FFF0000
34 #define PCR ((KPCR * const)KIP0PCRADDRESS)
35 #define USERPCR ((volatile KPCR * const)USPCR)
36 #define KeGetPcr() PCR
37 #ifndef _WINNT_H
38 #define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
39
40 //
41 // Address space layout
42 //
43 extern PVOID MmHighestUserAddress;
44 extern PVOID MmSystemRangeStart;
45 extern ULONG_PTR MmUserProbeAddress;
46 #define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
47 #define MM_SYSTEM_RANGE_START MmSystemRangeStart
48 #define MM_USER_PROBE_ADDRESS MmUserProbeAddress
49 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
50 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
51
52 //
53 // Maximum IRQs
54 //
55 #define MAXIMUM_VECTOR 16
56
57
58 //
59 // Used to contain PFNs and PFN counts
60 //
61 typedef ULONG PFN_COUNT;
62 typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
63 typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
64
65 //
66 // Stub
67 //
68 typedef struct _KFLOATING_SAVE
69 {
70 ULONG Reserved;
71 } KFLOATING_SAVE, *PKFLOATING_SAVE;
72
73 /* The following flags control the contents of the CONTEXT structure. */
74 #define CONTEXT_ARM 0x0000040
75 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
76 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
77 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
78
79 typedef struct _CONTEXT {
80 /* The flags values within this flag control the contents of
81 a CONTEXT record.
82
83 If the context record is used as an input parameter, then
84 for each portion of the context record controlled by a flag
85 whose value is set, it is assumed that that portion of the
86 context record contains valid context. If the context record
87 is being used to modify a thread's context, then only that
88 portion of the threads context will be modified.
89
90 If the context record is used as an IN OUT parameter to capture
91 the context of a thread, then only those portions of the thread's
92 context corresponding to set flags will be returned.
93
94 The context record is never used as an OUT only parameter. */
95
96 ULONG ContextFlags;
97
98 /* This section is specified/returned if the ContextFlags word contains
99 the flag CONTEXT_INTEGER. */
100 ULONG R0;
101 ULONG R1;
102 ULONG R2;
103 ULONG R3;
104 ULONG R4;
105 ULONG R5;
106 ULONG R6;
107 ULONG R7;
108 ULONG R8;
109 ULONG R9;
110 ULONG R10;
111 ULONG R11;
112 ULONG R12;
113
114 ULONG Sp;
115 ULONG Lr;
116 ULONG Pc;
117 ULONG Psr;
118 } CONTEXT;
119 #endif
120
121 //
122 // Processor Control Region
123 //
124 #ifdef _WINNT_H
125 #define KIRQL ULONG
126 #endif
127 typedef struct _KPCR
128 {
129 union
130 {
131 NT_TIB NtTib;
132 struct
133 {
134 struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList; // Unused
135 PVOID Used_StackBase; // Unused
136 PVOID PerfGlobalGroupMask;
137 PVOID TssCopy; // Unused
138 ULONG ContextSwitches;
139 KAFFINITY SetMemberCopy; // Unused
140 PVOID Used_Self;
141 };
142 };
143 struct _KPCR *Self;
144 struct _KPRCB *Prcb;
145 KIRQL Irql;
146 ULONG IRR; // Unused
147 ULONG IrrActive; // Unused
148 ULONG IDR; // Unused
149 PVOID KdVersionBlock;
150 PVOID IDT; // Unused
151 PVOID GDT; // Unused
152 PVOID TSS; // Unused
153 USHORT MajorVersion;
154 USHORT MinorVersion;
155 KAFFINITY SetMember;
156 ULONG StallScaleFactor;
157 UCHAR SpareUnused;
158 UCHAR Number;
159 } KPCR, *PKPCR;
160
161 //
162 // Get the current TEB
163 //
164 FORCEINLINE
165 struct _TEB* NtCurrentTeb(VOID)
166 {
167 return (struct _TEB*)USERPCR->Used_Self;
168 }
169
170 #ifndef _WINNT_H
171 //
172 // IRQL Support on ARM is similar to MIPS/ALPHA
173 //
174 KIRQL
175 KfRaiseIrql(
176 IN KIRQL NewIrql
177 );
178
179 VOID
180 KfLowerIrql(
181 IN KIRQL NewIrql
182 );
183
184 KIRQL
185 KeRaiseIrqlToSynchLevel(
186 VOID
187 );
188
189 KIRQL
190 KeRaiseIrqlToDpcLevel(
191 VOID
192 );
193
194 #define KeLowerIrql(NewIrql) KfLowerIrql(NewIrql)
195 #define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KfRaiseIrql(NewIrql)
196
197 //
198 // Cache clean and flush
199 //
200 VOID
201 HalSweepDcache(
202 VOID
203 );
204
205 VOID
206 HalSweepIcache(
207 VOID
208 );
209 #endif
210
211 //
212 // Intrinsics
213 //
214 #define InterlockedDecrement _InterlockedDecrement
215 #define InterlockedIncrement _InterlockedIncrement
216 #define InterlockedExchange _InterlockedExchange
217 #endif