mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
kernel: riscv: use page base addr when allocating pages
When allocating a page, it is only assigned a physical address once it is actually needed. This on-demand paging works well, however we were assuming that the first address of a page was accessed first. This fixes an issue where a Message is allocated but the first byte isn't accessed first. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
dcdd33e594
commit
b884c8ed4f
1 changed files with 2 additions and 2 deletions
|
|
@ -126,7 +126,8 @@ pub extern "C" fn trap_handler(
|
|||
"KERNEL({}): RISC-V fault: {} @ {:08x}, addr {:08x}",
|
||||
pid, ex, pc, addr
|
||||
);
|
||||
let entry = crate::arch::mem::pagetable_entry(addr).unwrap_or_else(|x| {
|
||||
let virt = addr & !0xfff;
|
||||
let entry = crate::arch::mem::pagetable_entry(virt).unwrap_or_else(|x| {
|
||||
// MemoryManagerHandle::get().print_ownership();
|
||||
MemoryMapping::current().print_map();
|
||||
panic!(
|
||||
|
|
@ -153,7 +154,6 @@ pub extern "C" fn trap_handler(
|
|||
flush_mmu();
|
||||
|
||||
// Zero-out the page
|
||||
let virt = addr & !0xfff;
|
||||
(virt as *mut usize)
|
||||
.write_bytes(0, PAGE_SIZE / core::mem::size_of::<usize>());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue