Enables scoped access into user memory, allowing page faults to occur inside kernel.
(f: impl FnOnce() -> R)
| 351 | /// Enables scoped access into user memory, allowing page faults to occur inside |
| 352 | /// kernel. |
| 353 | pub fn access_user_memory<R>(f: impl FnOnce() -> R) -> R { |
| 354 | let curr = current(); |
| 355 | let Some(thr) = curr.try_as_thread() else { |
| 356 | panic!("access_user_memory called outside of thread context"); |
| 357 | }; |
| 358 | |
| 359 | thr.set_accessing_user_memory(true); |
| 360 | let result = f(); |
| 361 | thr.set_accessing_user_memory(false); |
| 362 | result |
| 363 | } |
| 364 | |
| 365 | #[allow(dead_code)] |
| 366 | struct Vm(IrqSave); |
no test coverage detected