From 29084d7e553d50fa73e64f0da5b6ab331d395cd0 Mon Sep 17 00:00:00 2001 From: Erin Date: Sat, 22 Jul 2023 01:06:41 +0200 Subject: [PATCH] Removed pagetable hack --- hbvm/src/vm/mem/mod.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/hbvm/src/vm/mem/mod.rs b/hbvm/src/vm/mem/mod.rs index ea94238..55af7f2 100644 --- a/hbvm/src/vm/mem/mod.rs +++ b/hbvm/src/vm/mem/mod.rs @@ -36,34 +36,6 @@ impl Drop for Memory { } impl Memory { - // HACK: Just for allocation testing, will be removed when proper memory interfaces - // implemented. - pub fn insert_test_page(&mut self) { - unsafe { - let mut entry = PtEntry::new( - { - let layout = alloc::alloc::Layout::from_size_align_unchecked(4096, 4096); - let ptr = alloc::alloc::alloc_zeroed(layout); - if ptr.is_null() { - alloc::alloc::handle_alloc_error(layout); - } - - core::ptr::write_bytes(ptr, 69, 10); - ptr.cast() - }, - Permission::Write, - ); - - for _ in 0..4 { - let mut pt = Box::::default(); - pt.table[0] = entry; - entry = PtEntry::new(Box::into_raw(pt) as _, Permission::Node); - } - - (*self.root_pt).table[0] = entry; - } - } - /// Maps host's memory into VM's memory /// /// # Safety