ReactOS 0.4.16-dev-109-gf4cb10f
irql.c
Go to the documentation of this file.
1/*
2 * PROJECT: NEC PC-98 series HAL
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: IRQL mapping
5 * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include <hal.h>
11
12/* GLOBALS ********************************************************************/
13
14/* This table contains the static x86 PIC mapping between IRQLs and IRQs */
16{
17 /*
18 * See comments of the PC/AT version.
19 */
20 0b00000000000000000000000000000000, /* IRQL 0 */
21 0b00000000000000000000000000000000, /* IRQL 1 */
22 0b00000000000000000000000000000000, /* IRQL 2 */
23 0b00000000000000000000000000000000, /* IRQL 3 */
24 0b11111111100000000000000000000000, /* IRQL 4 */
25 0b11111111110000000000000000000000, /* IRQL 5 */
26 0b11111111111000000000000000000000, /* IRQL 6 */
27 0b11111111111100000000000000000000, /* IRQL 7 */
28 0b11111111111110000000000000000000, /* IRQL 8 */
29 0b11111111111111000000000000000000, /* IRQL 9 */
30 0b11111111111111100000000000000000, /* IRQL 10 */
31 0b11111111111111110000000000000000, /* IRQL 11 */
32
33 /*
34 * Okay, now we're finally starting to mask off IRQs on the slave PIC, from
35 * IRQ15 to IRQ8. Note that the output of INT of RTC is connected to the IR7.
36 * We need to keep this IRQ unmasked, so we can ensure profiling the whole system.
37 */
38 0b11111111111111110000000000000000, /* IRQL 12 */
39 0b11111111111111110100000000000000, /* IRQL 13 */
40 0b11111111111111110110000000000000, /* IRQL 14 */
41 0b11111111111111110111000000000000, /* IRQL 15 */
42 0b11111111111111110111100000000000, /* IRQL 16 */
43 0b11111111111111110111110000000000, /* IRQL 17 */
44 0b11111111111111110111111000000000, /* IRQL 18 */
45 0b11111111111111110111111000000000, /* IRQL 19 */
46
47 /*
48 * Now we mask off the IRQs on the master. Since IRQL 19 we have 0 "droplet".
49 * It's the cascade IRQ that we use to bridge the slave PIC with the master PIC.
50 */
51 0b11111111111111110111111100000000, /* IRQL 20 */
52 0b11111111111111110111111101000000, /* IRQL 21 */
53 0b11111111111111110111111101100000, /* IRQL 22 */
54 0b11111111111111110111111101110000, /* IRQL 23 */
55 0b11111111111111110111111101111000, /* IRQL 24 */
56 0b11111111111111110111111101111100, /* IRQL 25 */
57 0b11111111111111110111111101111110, /* IRQL 26 */
58 0b11111111111111111111111101111110, /* IRQL 27 */
59
60 /*
61 * See comments of the PC/AT version.
62 */
63 0b11111111111111111111111101111111, /* IRQL 28 */
64 0b11111111111111111111111101111111, /* IRQL 29 */
65 0b11111111111111111111111101111111, /* IRQL 30 */
66 0b11111111111111111111111101111111 /* IRQL 31 */
67};
68
69/* This table indicates which IRQs, if pending, can preempt a given IRQL level */
71{
72 /*
73 * See comments of the PC/AT version.
74 */
75 0b11111111111111111111111111111110, /* IRQL 0 */
76 0b11111111111111111111111111111100, /* IRQL 1 */
77 0b11111111111111111111111111111000, /* IRQL 2 */
78 0b11111111111111111111111111110000, /* IRQL 3 */
79 0b00000111111111111111111111110000, /* IRQL 4 */
80 0b00000011111111111111111111110000, /* IRQL 5 */
81 0b00000001111111111111111111110000, /* IRQL 6 */
82 0b00000000111111111111111111110000, /* IRQL 7 */
83 0b00000000011111111111111111110000, /* IRQL 8 */
84 0b00000000001111111111111111110000, /* IRQL 9 */
85 0b00000000000111111111111111110000, /* IRQL 10 */
86
87 /*
88 * Now we start progressivly limiting which slave PIC interrupts have the
89 * right to preempt us at each level. The RTC timer used for profiling,
90 * so it will always preempt until we reach PROFILE_LEVEL.
91 */
92 0b00000000000011111111111111110000, /* IRQL 11 */
93 0b00000000000011111111111111110000, /* IRQL 12 */
94 0b00000000000010111111111111110000, /* IRQL 13 */
95 0b00000000000010011111111111110000, /* IRQL 14 */
96 0b00000000000010001111111111110000, /* IRQL 15 */
97 0b00000000000010000111111111110000, /* IRQL 16 */
98 0b00000000000010000011111111110000, /* IRQL 17 */
99 0b00000000000010000001111111110000, /* IRQL 18 */
100 0b00000000000010000001111111110000, /* IRQL 19 */
101
102 /*
103 * Now with IRQs on the master PIC.
104 */
105 0b00000000000010000000011111110000, /* IRQL 20 */
106 0b00000000000010000000001111110000, /* IRQL 21 */
107 0b00000000000010000000000111110000, /* IRQL 22 */
108 0b00000000000010000000000011110000, /* IRQL 23 */
109 0b00000000000010000000000001110000, /* IRQL 24 */
110 0b00000000000010000000000000110000, /* IRQL 25 */
111 0b00000000000010000000000000010000, /* IRQL 26 */
112
113 /*
114 * See comments of the PC/AT version.
115 */
116 0b00000000000000000000000000010000, /* IRQL 27 */
117 0b00000000000000000000000000000000, /* IRQL 28 */
118 0b00000000000000000000000000000000, /* IRQL 29 */
119 0b00000000000000000000000000000000, /* IRQL 30 */
120 0b00000000000000000000000000000000 /* IRQL 31 */
121};
ULONG KiI8259MaskTable[32]
Definition: irql.c:15
ULONG FindHigherIrqlMask[32]
Definition: irql.c:70
uint32_t ULONG
Definition: typedefs.h:59