MCPcopy Create free account
hub / github.com/Starry-OS/StarryOS / access_user_memory

Function access_user_memory

core/src/mm.rs:353–363  ·  view source on GitHub ↗

Enables scoped access into user memory, allowing page faults to occur inside kernel.

(f: impl FnOnce() -> R)

Source from the content-addressed store, hash-verified

351/// Enables scoped access into user memory, allowing page faults to occur inside
352/// kernel.
353pub 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)]
366struct Vm(IrqSave);

Callers 3

readMethod · 0.85
writeMethod · 0.85
check_null_terminatedFunction · 0.85

Calls 2

try_as_threadMethod · 0.80

Tested by

no test coverage detected