Implement bidirectional SYS_CALL support

This commit is contained in:
Jacob Lorentzon
2025-03-03 23:21:56 +00:00
committed by Jeremy Soller
parent 8f24d894eb
commit 4607576006
7 changed files with 118 additions and 49 deletions
+6
View File
@@ -17,6 +17,7 @@ pub struct UserSlice<const READ: bool, const WRITE: bool> {
}
pub type UserSliceRo = UserSlice<true, false>;
pub type UserSliceWo = UserSlice<false, true>;
pub type UserSliceRw = UserSlice<true, true>;
impl<const READ: bool, const WRITE: bool> UserSlice<READ, WRITE> {
pub fn empty() -> Self {
@@ -207,6 +208,11 @@ impl UserSliceWo {
Self::new(base, size)
}
}
impl UserSliceRw {
pub fn rw(base: usize, size: usize) -> Result<Self> {
Self::new(base, size)
}
}
fn is_kernel_mem(slice: &[u8]) -> bool {
(slice.as_ptr() as usize) >= crate::USER_END_OFFSET