forked from koniifer/ableos
Now finally, leaving Hardvard!
This commit is contained in:
parent
430ccd170d
commit
06d66289bc
|
@ -22,7 +22,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
program: &prog,
|
program: &prog,
|
||||||
root_pt: Box::into_raw(Default::default()),
|
root_pt: Box::into_raw(Default::default()),
|
||||||
},
|
},
|
||||||
0,
|
4,
|
||||||
);
|
);
|
||||||
let data = {
|
let data = {
|
||||||
let ptr = std::alloc::alloc_zeroed(std::alloc::Layout::from_size_align_unchecked(
|
let ptr = std::alloc::alloc_zeroed(std::alloc::Layout::from_size_align_unchecked(
|
||||||
|
|
|
@ -97,6 +97,26 @@ impl<'p, PfH: HandlePageFault> SoftPagedMem<'p, PfH> {
|
||||||
permission_check: fn(Permission) -> bool,
|
permission_check: fn(Permission) -> bool,
|
||||||
action: fn(*mut u8, *mut u8, usize),
|
action: fn(*mut u8, *mut u8, usize),
|
||||||
) -> Result<(), u64> {
|
) -> Result<(), u64> {
|
||||||
|
let (src, len) = if src < self.program.len() as _ {
|
||||||
|
let to_copy = len.clamp(0, self.program.len().saturating_sub(src as _));
|
||||||
|
action(
|
||||||
|
unsafe { self.program.as_ptr().add(src as _).cast_mut() },
|
||||||
|
dst,
|
||||||
|
to_copy,
|
||||||
|
);
|
||||||
|
|
||||||
|
(
|
||||||
|
src.saturating_add(to_copy as _),
|
||||||
|
len.saturating_sub(to_copy),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(src, len)
|
||||||
|
};
|
||||||
|
|
||||||
|
if len == 0 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
// Create new splitter
|
// Create new splitter
|
||||||
let mut pspl = AddrPageLookuper::new(src, len, self.root_pt);
|
let mut pspl = AddrPageLookuper::new(src, len, self.root_pt);
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Reference in a new issue