53c3ee2422fb3d62fda9c7e9022a85b0e5da0ca3
[reactos.git] / reactos / include / reactos / 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 IPI_LEVEL 7
12 #define POWER_LEVEL 7
13 #define PROFILE_LEVEL 8
14 #define HIGH_LEVEL 8
15 #define SYNCH_LEVEL (IPI_LEVEL - 1)
16
17 //
18 // FIXME: mmtypes.h?
19 //
20 #define KIPCR 0xFFFFF000
21 #define USPCR 0x7FFF0000
22 #define PCR ((volatile KPCR * const)USPCR)
23 #define USERPCR ((volatile KPCR * const)KIPCR)
24
25 //
26 // Stub
27 //
28 typedef struct _KFLOATING_SAVE
29 {
30 ULONG Reserved;
31 } KFLOATING_SAVE, *PKFLOATING_SAVE;
32
33 //
34 // Processor Control Region
35 // On ARM, it's actually readable from user-mode, much like KUSER_SHARED_DATA
36 //
37 #ifdef _WINNT_H
38 #define PKINTERRUPT_ROUTINE PVOID // Hack!
39 #endif
40 typedef struct _KPCR
41 {
42 ULONG MinorVersion;
43 ULONG MajorVersion;
44 PKINTERRUPT_ROUTINE InterruptRoutine[64];
45 PVOID XcodeDispatch;
46 ULONG FirstLevelDcacheSize;
47 ULONG FirstLevelDcacheFillSize;
48 ULONG FirstLevelIcacheSize;
49 ULONG FirstLevelIcacheFillSize;
50 ULONG SecondLevelDcacheSize;
51 ULONG SecondLevelDcacheFillSize;
52 ULONG SecondLevelIcacheSize;
53 ULONG SecondLevelIcacheFillSize;
54 struct _KPRCB *Prcb;
55 struct _TEB *Teb;
56 PVOID TlsArray;
57 ULONG DcacheFillSize;
58 ULONG IcacheAlignment;
59 ULONG IcacheFillSize;
60 ULONG ProcessorId;
61 ULONG ProfileInterval;
62 ULONG ProfileCount;
63 ULONG StallExecutionCount;
64 ULONG StallScaleFactor;
65 CCHAR Number;
66 PVOID DataBusError;
67 PVOID InstructionBusError;
68 ULONG CachePolicy;
69 UCHAR IrqlMask[64];
70 UCHAR IrqlTable[64];
71 UCHAR CurrentIrql;
72 KAFFINITY SetMember;
73 struct _KTHREAD *CurrentThread;
74 KAFFINITY NotMember;
75 ULONG SystemReserved[6];
76 ULONG DcacheAlignment;
77 ULONG HalReserved[64];
78 BOOLEAN FirstLevelActive;
79 BOOLEAN DpcRoutineActive;
80 ULONG CurrentPid;
81 BOOLEAN OnInterruptStack;
82 PVOID SavedInitialStack;
83 PVOID SavedStackLimit;
84 PVOID SystemServiceDispatchStart;
85 PVOID SystemServiceDispatchEnd;
86 PVOID InterruptStack;
87 PVOID PanicStack;
88 PVOID BadVaddr;
89 PVOID InitialStack;
90 PVOID StackLimit;
91 ULONG QuantumEnd;
92 } KPCR, *PKPCR;
93
94 //
95 // Get the current TEB
96 //
97 FORCEINLINE
98 struct _TEB* NtCurrentTeb(VOID)
99 {
100 return (struct _TEB*)USERPCR->Teb;
101 }
102
103 //
104 // IRQL Support on ARM is similar to MIPS/ALPHA
105 //
106 KIRQL
107 KeSwapIrql(
108 IN KIRQL NewIrql
109 );
110
111 KIRQL
112 KeRaiseIrqlToSynchLevel(
113 VOID
114 );
115
116 KIRQL
117 KeRaiseIrqlToDpcLevel(
118 VOID
119 );
120
121 #define KeLowerIrql(NewIrql) KeSwapIrql(NewIrql)
122 #define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KeSwapIrql(NewIrql)
123
124 #endif