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

Function check_access

core/src/mm.rs:369–377  ·  view source on GitHub ↗

Briefly checks if the given memory region is valid user memory.

(start: usize, len: usize)

Source from the content-addressed store, hash-verified

367
368/// Briefly checks if the given memory region is valid user memory.
369pub fn check_access(start: usize, len: usize) -> VmResult {
370 const USER_SPACE_END: usize = USER_SPACE_BASE + USER_SPACE_SIZE;
371 let ok = (USER_SPACE_BASE..USER_SPACE_END).contains(&start) && (USER_SPACE_END - start) >= len;
372 if unlikely(!ok) {
373 Err(VmError::AccessDenied)
374 } else {
375 Ok(())
376 }
377}
378
379#[extern_trait]
380unsafe impl VmIo for Vm {

Callers 2

readMethod · 0.85
writeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected