From bcb0ec41e25db57e45a8ec700baeac86e27a6cfd Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 15 Aug 2023 16:32:59 +0200 Subject: [PATCH] Move stuff, deprecate softpage --- hbvm/fuzz/fuzz_targets/vm.rs | 2 +- hbvm/src/lib.rs | 2 +- hbvm/src/main.rs | 4 ++-- hbvm/src/mem/mod.rs | 3 +++ hbvm/src/{ => mem}/softpaging/lookup.rs | 0 hbvm/src/{ => mem}/softpaging/mapping.rs | 0 hbvm/src/{ => mem}/softpaging/mod.rs | 6 +++--- hbvm/src/{ => mem}/softpaging/paging.rs | 0 8 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 hbvm/src/mem/mod.rs rename hbvm/src/{ => mem}/softpaging/lookup.rs (100%) rename hbvm/src/{ => mem}/softpaging/mapping.rs (100%) rename hbvm/src/{ => mem}/softpaging/mod.rs (97%) rename hbvm/src/{ => mem}/softpaging/paging.rs (100%) diff --git a/hbvm/fuzz/fuzz_targets/vm.rs b/hbvm/fuzz/fuzz_targets/vm.rs index b10c6d96..e79679fa 100644 --- a/hbvm/fuzz/fuzz_targets/vm.rs +++ b/hbvm/fuzz/fuzz_targets/vm.rs @@ -3,7 +3,7 @@ use { hbbytecode::valider::validate, hbvm::{ - softpaging::{ + mem::softpaging::{ paging::{PageTable, Permission}, HandlePageFault, PageSize, SoftPagedMem, }, diff --git a/hbvm/src/lib.rs b/hbvm/src/lib.rs index 752bf515..3594a1d4 100644 --- a/hbvm/src/lib.rs +++ b/hbvm/src/lib.rs @@ -17,7 +17,7 @@ #[cfg(feature = "alloc")] extern crate alloc; -pub mod softpaging; +pub mod mem; pub mod value; mod bmc; diff --git a/hbvm/src/main.rs b/hbvm/src/main.rs index 74202713..d61d329f 100644 --- a/hbvm/src/main.rs +++ b/hbvm/src/main.rs @@ -1,7 +1,7 @@ use { hbbytecode::valider::validate, hbvm::{ - softpaging::{paging::PageTable, HandlePageFault, PageSize, SoftPagedMem}, + mem::softpaging::{paging::PageTable, HandlePageFault, PageSize, SoftPagedMem}, MemoryAccessReason, Vm, }, std::io::{stdin, Read}, @@ -38,7 +38,7 @@ fn main() -> Result<(), Box> { .map( data, 8192, - hbvm::softpaging::paging::Permission::Write, + hbvm::mem::softpaging::paging::Permission::Write, PageSize::Size4K, ) .unwrap(); diff --git a/hbvm/src/mem/mod.rs b/hbvm/src/mem/mod.rs new file mode 100644 index 00000000..f6cea2a2 --- /dev/null +++ b/hbvm/src/mem/mod.rs @@ -0,0 +1,3 @@ +//! Memory implementations + +pub mod softpaging; diff --git a/hbvm/src/softpaging/lookup.rs b/hbvm/src/mem/softpaging/lookup.rs similarity index 100% rename from hbvm/src/softpaging/lookup.rs rename to hbvm/src/mem/softpaging/lookup.rs diff --git a/hbvm/src/softpaging/mapping.rs b/hbvm/src/mem/softpaging/mapping.rs similarity index 100% rename from hbvm/src/softpaging/mapping.rs rename to hbvm/src/mem/softpaging/mapping.rs diff --git a/hbvm/src/softpaging/mod.rs b/hbvm/src/mem/softpaging/mod.rs similarity index 97% rename from hbvm/src/softpaging/mod.rs rename to hbvm/src/mem/softpaging/mod.rs index 67c030cf..6a111bbd 100644 --- a/hbvm/src/softpaging/mod.rs +++ b/hbvm/src/mem/softpaging/mod.rs @@ -1,7 +1,5 @@ //! Platform independent, software paged memory implementation -use self::lookup::{AddrPageLookupError, AddrPageLookupOk, AddrPageLookuper}; - pub mod lookup; pub mod paging; @@ -9,12 +7,14 @@ pub mod paging; pub mod mapping; use { - super::{LoadError, Memory, MemoryAccessReason, StoreError}, + crate::{LoadError, Memory, MemoryAccessReason, StoreError}, core::slice::SliceIndex, + lookup::{AddrPageLookupError, AddrPageLookupOk, AddrPageLookuper}, paging::{PageTable, Permission}, }; /// HoleyBytes software paged memory +#[deprecated] #[derive(Clone, Debug)] pub struct SoftPagedMem<'p, PfH> { /// Root page table diff --git a/hbvm/src/softpaging/paging.rs b/hbvm/src/mem/softpaging/paging.rs similarity index 100% rename from hbvm/src/softpaging/paging.rs rename to hbvm/src/mem/softpaging/paging.rs