ReactOS 0.4.16-dev-336-gb667d82
pic.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for pic.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID HalpInitializeInterrupts (VOID)
 
ULONG HalGetInterruptSource (VOID)
 
KIRQL NTAPI KeGetCurrentIrql (VOID)
 
KIRQL NTAPI KeRaiseIrqlToDpcLevel (VOID)
 
KIRQL NTAPI KeRaiseIrqlToSynchLevel (VOID)
 
KIRQL FASTCALL KfRaiseIrql (IN KIRQL NewIrql)
 
VOID FASTCALL KfLowerIrql (IN KIRQL NewIrql)
 
VOID FASTCALL HalRequestSoftwareInterrupt (IN KIRQL Irql)
 
VOID FASTCALL HalClearSoftwareInterrupt (IN KIRQL Irql)
 
BOOLEAN NTAPI HalEnableSystemInterrupt (IN ULONG Vector, IN KIRQL Irql, IN KINTERRUPT_MODE InterruptMode)
 
VOID NTAPI HalDisableSystemInterrupt (IN ULONG Vector, IN KIRQL Irql)
 
BOOLEAN NTAPI HalBeginSystemInterrupt (IN KIRQL Irql, IN ULONG Vector, OUT PKIRQL OldIrql)
 
VOID NTAPI HalEndSystemInterrupt (IN KIRQL OldIrql, IN PKTRAP_FRAME TrapFrame)
 

Variables

ULONG HalpIrqlTable [HIGH_LEVEL+1]
 
UCHAR HalpMaskTable [HIGH_LEVEL+1]
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file pic.c.

Function Documentation

◆ HalBeginSystemInterrupt()

BOOLEAN NTAPI HalBeginSystemInterrupt ( IN KIRQL  Irql,
IN ULONG  Vector,
OUT PKIRQL  OldIrql 
)

Definition at line 321 of file pic.c.

324{
326 while (TRUE);
327 return FALSE;
328}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by HalpClockInterruptHandler(), HalpClockIpiHandler(), KiChainedDispatch(), KiInterruptDispatch(), and KiUnexpectedInterruptTailHandler().

◆ HalClearSoftwareInterrupt()

VOID FASTCALL HalClearSoftwareInterrupt ( IN KIRQL  Irql)

Definition at line 282 of file pic.c.

283{
284 /* Clear software interrupt */
286}
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
_Out_ PKIRQL Irql
Definition: csq.h:179
#define VIC_SOFT_INT_CLEAR
Definition: pl190.h:20

Referenced by KiApcInterrupt(), KiIdleLoop(), and KiInterruptHandler().

◆ HalDisableSystemInterrupt()

VOID NTAPI HalDisableSystemInterrupt ( IN ULONG  Vector,
IN KIRQL  Irql 
)

Definition at line 309 of file pic.c.

311{
313 while (TRUE);
314}

Referenced by HalpInitializeTsc(), KeDisconnectInterrupt(), and VideoPortDisableInterrupt().

◆ HalEnableSystemInterrupt()

BOOLEAN NTAPI HalEnableSystemInterrupt ( IN ULONG  Vector,
IN KIRQL  Irql,
IN KINTERRUPT_MODE  InterruptMode 
)

Definition at line 295 of file pic.c.

298{
300 while (TRUE);
301 return FALSE;
302}

Referenced by HalpEnableInterruptHandler(), HalpInitializeClock(), HalpInitializeTsc(), KeConnectInterrupt(), and VideoPortEnableInterrupt().

◆ HalEndSystemInterrupt()

VOID NTAPI HalEndSystemInterrupt ( IN KIRQL  OldIrql,
IN PKTRAP_FRAME  TrapFrame 
)

Definition at line 335 of file pic.c.

337{
339 while (TRUE);
340}

Referenced by KiEndInterrupt(), and KiExitInterrupt().

◆ HalGetInterruptSource()

ULONG HalGetInterruptSource ( VOID  )

Definition at line 108 of file pic.c.

109{
110 ULONG InterruptStatus;
111
112 /* Get the interrupt status, and return the highest bit set */
113 InterruptStatus = READ_REGISTER_ULONG(VIC_INT_STATUS);
114 return 31 - _clz(InterruptStatus);
115}
#define READ_REGISTER_ULONG(r)
Definition: arm.h:26
#define _clz(a)
Definition: intrin_arm.h:398
#define VIC_INT_STATUS
Definition: pl190.h:16
uint32_t ULONG
Definition: typedefs.h:59

Referenced by KiInterruptHandler().

◆ HalpInitializeInterrupts()

VOID HalpInitializeInterrupts ( VOID  )

Definition at line 93 of file pic.c.

94{
95 PKPCR Pcr = KeGetPcr();
96
97 /* Fill out the IRQL mappings */
98 RtlCopyMemory(Pcr->IrqlTable, HalpIrqlTable, sizeof(Pcr->IrqlTable));
99 RtlCopyMemory(Pcr->IrqlMask, HalpMaskTable, sizeof(Pcr->IrqlMask));
100}
ULONG HalpIrqlTable[HIGH_LEVEL+1]
Definition: pic.c:19
UCHAR HalpMaskTable[HIGH_LEVEL+1]
Definition: pic.c:55
#define KeGetPcr()
Definition: ketypes.h:81
Definition: ke.h:294
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by HalInitSystem().

◆ HalRequestSoftwareInterrupt()

◆ KeGetCurrentIrql()

KIRQL NTAPI KeGetCurrentIrql ( VOID  )

Definition at line 122 of file pic.c.

123{
124 /* Return the IRQL */
125 return KeGetPcr()->Irql;
126}

◆ KeRaiseIrqlToDpcLevel()

KIRQL NTAPI KeRaiseIrqlToDpcLevel ( VOID  )

Definition at line 133 of file pic.c.

134{
135 PKPCR Pcr = KeGetPcr();
136 KIRQL CurrentIrql;
137
138 /* Save and update IRQL */
139 CurrentIrql = Pcr->Irql;
140 Pcr->Irql = DISPATCH_LEVEL;
141
142#ifdef IRQL_DEBUG
143 /* Validate correct raise */
144 if (CurrentIrql > DISPATCH_LEVEL) KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL);
145#endif
146
147 /* Return the previous value */
148 return CurrentIrql;
149}
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1430
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
KIRQL Irql
Definition: ke.h:311

◆ KeRaiseIrqlToSynchLevel()

KIRQL NTAPI KeRaiseIrqlToSynchLevel ( VOID  )

Definition at line 156 of file pic.c.

157{
158 PKPCR Pcr = KeGetPcr();
159 KIRQL CurrentIrql;
160
161 /* Save and update IRQL */
162 CurrentIrql = Pcr->Irql;
163 Pcr->Irql = SYNCH_LEVEL;
164
165#ifdef IRQL_DEBUG
166 /* Validate correct raise */
167 if (CurrentIrql > SYNCH_LEVEL)
168 {
169 /* Crash system */
170 KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
171 CurrentIrql,
173 0,
174 1);
175 }
176#endif
177
178 /* Return the previous value */
179 return CurrentIrql;
180}
#define SYNCH_LEVEL
Definition: env_spec_w32.h:704
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108

Referenced by _Requires_lock_not_held_(), KeDelayExecutionThread(), KeFlushEntireTb(), KeQueryBasePriorityThread(), KeRemoveQueue(), KeSignalGateBoostPriority(), KeWaitForMultipleObjects(), KeWaitForSingleObject(), KiRetireDpcList(), and NtYieldExecution().

◆ KfLowerIrql()

VOID FASTCALL KfLowerIrql ( IN KIRQL  NewIrql)

Definition at line 232 of file pic.c.

233{
235 PKPCR Pcr = KeGetPcr();
236 ULONG InterruptMask;
237
238 /* Disableinterrupts */
240 _disable();
241
242#ifdef IRQL_DEBUG
243 /* Validate correct lower */
244 if (OldIrql > Pcr->Irql)
245 {
246 /* Crash system */
247 Pcr->Irql = HIGH_LEVEL;
248 KeBugCheck(IRQL_NOT_LESS_OR_EQUAL);
249 }
250#endif
251
252 /* Clear interrupts associated to the old IRQL */
254
255 /* Set the new interrupt mask */
256 InterruptMask = Pcr->IrqlTable[NewIrql];
257 WRITE_REGISTER_ULONG(VIC_INT_ENABLE, InterruptMask);
258
259 /* Save the new IRQL and restore interrupt state */
260 Pcr->Irql = NewIrql;
261 if (!Flags.IrqDisable) _enable();
262}
FORCEINLINE ARM_STATUS_REGISTER KeArmStatusRegisterGet(VOID)
Definition: intrin_i.h:122
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
void __cdecl _disable(void)
Definition: intrin_arm.h:365
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#define VIC_INT_ENABLE
Definition: pl190.h:17
#define VIC_INT_CLEAR
Definition: pl190.h:18
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by HalpGrowMapBufferWorker(), KeLowerIrql(), KeQueryPerformanceCounter(), KeReleaseInStackQueuedSpinLock(), KeReleaseQueuedSpinLock(), KiChainedDispatch(), KiCheckForApcDelivery(), KiExitV86Trap(), KiInitializeSystem(), and KiThreadStartup().

◆ KfRaiseIrql()

KIRQL FASTCALL KfRaiseIrql ( IN KIRQL  NewIrql)

Definition at line 187 of file pic.c.

188{
190 PKPCR Pcr = KeGetPcr();
191 KIRQL CurrentIrql;
192 ULONG InterruptMask;
193
194 /* Disable interrupts */
196 _disable();
197
198 /* Read current IRQL */
199 CurrentIrql = Pcr->Irql;
200
201#ifdef IRQL_DEBUG
202 /* Validate correct raise */
203 if (CurrentIrql > NewIrql)
204 {
205 /* Crash system */
206 Pcr->Irql = PASSIVE_LEVEL;
207 KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL);
208 }
209#endif
210 /* Clear interrupts associated to the old IRQL */
212
213 /* Set the new interrupt mask */
214 InterruptMask = Pcr->IrqlTable[NewIrql];
215 WRITE_REGISTER_ULONG(VIC_INT_ENABLE, InterruptMask);
216
217 /* Set new IRQL */
218 Pcr->Irql = NewIrql;
219
220 /* Restore interrupt state */
221 if (!Flags.IrqDisable) _enable();
222
223 /* Return old IRQL */
224 return CurrentIrql;
225}
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

Referenced by _IRQL_requires_max_(), _Requires_lock_not_held_(), HalInitSystem(), HalpGrowMapBufferWorker(), KeAcquireInStackQueuedSpinLock(), KeAcquireInStackQueuedSpinLockRaiseToSynch(), KeAcquireQueuedSpinLock(), KeAcquireQueuedSpinLockRaiseToSynch(), KeAcquireSpinLockRaiseToSynch(), KeQueryPerformanceCounter(), KeRaiseIrql(), KeRaiseIrqlToSynchLevel(), KeSynchronizeExecution(), KfAcquireSpinLock(), KiAcquireDispatcherLock(), KiChainedDispatch(), KiCheckForApcDelivery(), KiExitV86Trap(), KiIdleLoop(), KiInitializeKernel(), KiInitializeSystem(), KiInterruptHandler(), KiSystemStartup(), KiSystemStartupBootStack(), and KxRaiseIrql().

Variable Documentation

◆ HalpIrqlTable

ULONG HalpIrqlTable[HIGH_LEVEL+1]

Definition at line 19 of file pic.c.

Referenced by HalpInitializeInterrupts().

◆ HalpMaskTable

UCHAR HalpMaskTable[HIGH_LEVEL+1]

Definition at line 55 of file pic.c.

Referenced by HalpInitializeInterrupts().