Commit b2d9887
committed
Update HAL documentation for dual-mode support
The hardware abstraction layer now supports both cooperative and preemptive
scheduling modes with distinct context management approaches. The documentation
has been updated to reflect these architectural differences and their
implications for task initialization and privilege management.
The interrupt frame structure preserves complete trap context with 33 words for
register state and control registers, plus 12 bytes of padding to maintain
16-byte alignment, totaling 144 bytes. This frame supports both interrupt
handling and initial task setup for preemptive scheduling, where tasks launch
through trap return rather than standard function calls.
Task initialization varies between modes. Cooperative mode uses lightweight
context structures containing only callee-saved registers for voluntary
yielding. Preemptive mode builds complete interrupt frames with all registers
initialized to zero, global and thread pointers configured, and processor state
set for proper privilege transitions. The frame is positioned with a 256-byte
initial stack reserve below the stack top to accommodate startup requirements.
The dispatcher initialization process differs for each scheduling mode.
Cooperative tasks transfer control through standard calling conventions with
global interrupts enabled before execution. Preemptive tasks restore interrupt
frames and execute trap return instructions, allowing hardware to transition to
the configured privilege level and enable interrupts based on the saved
processor state.
The system call interface operates through the RISC-V trap mechanism for
privilege boundary crossing. User mode tasks invoke kernel services using
environment call instructions that trigger synchronous exceptions. The trap
handler preserves all registers except the return value, maintaining standard
calling convention semantics across the privilege boundary while the kernel
validates parameters and mediates access to protected resources.1 parent d2b0fd8 commit b2d9887
File tree
2 files changed
+93
-18
lines changed- Documentation
2 files changed
+93
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
154 | 165 | | |
155 | 166 | | |
156 | 167 | | |
| |||
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
180 | 191 | | |
181 | 192 | | |
182 | 193 | | |
| |||
251 | 262 | | |
252 | 263 | | |
253 | 264 | | |
254 | | - | |
255 | | - | |
| 265 | + | |
| 266 | + | |
256 | 267 | | |
257 | 268 | | |
258 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
| |||
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
112 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
113 | 168 | | |
114 | 169 | | |
115 | 170 | | |
| |||
168 | 223 | | |
169 | 224 | | |
170 | 225 | | |
171 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
172 | 229 | | |
173 | | - | |
174 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
175 | 239 | | |
176 | 240 | | |
177 | 241 | | |
| |||
0 commit comments