From bb50c095387f9c7fa74282e1215a15274181086b Mon Sep 17 00:00:00 2001 From: Erin Date: Sun, 25 Jun 2023 00:18:31 +0200 Subject: [PATCH] docs --- hbvm/README.md | 0 hbvm/src/lib.rs | 2 ++ hbvm/src/validate.rs | 2 ++ hbvm/src/vm/mem/mod.rs | 5 +++-- hbvm/src/vm/mem/paging.rs | 2 ++ hbvm/src/vm/trap.rs | 2 ++ hbvm/src/vm/value.rs | 2 ++ 7 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 hbvm/README.md diff --git a/hbvm/README.md b/hbvm/README.md new file mode 100644 index 00000000..e69de29b diff --git a/hbvm/src/lib.rs b/hbvm/src/lib.rs index e17bc2e3..82559847 100644 --- a/hbvm/src/lib.rs +++ b/hbvm/src/lib.rs @@ -1,4 +1,6 @@ +#![doc = include_str!("../README.md")] #![no_std] + extern crate alloc; pub mod validate; diff --git a/hbvm/src/validate.rs b/hbvm/src/validate.rs index 215df8ff..e1c6cbdc 100644 --- a/hbvm/src/validate.rs +++ b/hbvm/src/validate.rs @@ -1,3 +1,5 @@ +//! Validate if program is sound to execute + /// Program validation error kind #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ErrorKind { diff --git a/hbvm/src/vm/mem/mod.rs b/hbvm/src/vm/mem/mod.rs index 5de0db80..f4e4d198 100644 --- a/hbvm/src/vm/mem/mod.rs +++ b/hbvm/src/vm/mem/mod.rs @@ -1,10 +1,11 @@ -mod paging; +//! Program memory implementation -use core::mem::MaybeUninit; +pub mod paging; use self::paging::{PageTable, Permission, PtEntry}; use super::{trap::HandleTrap, VmRunError}; use alloc::boxed::Box; +use core::mem::MaybeUninit; use derive_more::Display; /// HoleyBytes virtual memory diff --git a/hbvm/src/vm/mem/paging.rs b/hbvm/src/vm/mem/paging.rs index 80dfdcf6..d7ea52bc 100644 --- a/hbvm/src/vm/mem/paging.rs +++ b/hbvm/src/vm/mem/paging.rs @@ -1,3 +1,5 @@ +//! Page table and associated structures implementation + use core::{ fmt::Debug, mem::MaybeUninit, diff --git a/hbvm/src/vm/trap.rs b/hbvm/src/vm/trap.rs index f297ab87..94d93e90 100644 --- a/hbvm/src/vm/trap.rs +++ b/hbvm/src/vm/trap.rs @@ -1,3 +1,5 @@ +//! Program trap handling interfaces + use super::{ mem::{Memory, MemoryAccessReason, PageSize}, value::Value, diff --git a/hbvm/src/vm/value.rs b/hbvm/src/vm/value.rs index d5738257..ffc069c1 100644 --- a/hbvm/src/vm/value.rs +++ b/hbvm/src/vm/value.rs @@ -1,3 +1,5 @@ +//! HoleyBytes register value definition + use core::fmt::Debug; /// Define [`Value`] union