Documentation for mem_cmp.rs and mmu.rs modules
This commit is contained in:
parent
d35314bead
commit
692c3bfa03
@ -1,14 +1,31 @@
|
|||||||
///! FILE.TXT FORMAT Representing machine memory memory
|
//! # mem_cmp
|
||||||
/// - PC
|
//!
|
||||||
/// - SP
|
//! This module contains a MemChecker.
|
||||||
/// - Section_1
|
//!
|
||||||
/// - Section_2
|
//! It's used to compare state memory obtained after a dump memory from NachOS and BurritOS.
|
||||||
/// - ...
|
//!
|
||||||
/// - Section_n
|
//! This module is used exclusively for testing the instruction simulator.
|
||||||
///
|
//!
|
||||||
/// Each section is divided in 3 parts, on two lines of text
|
//! Basic usage:
|
||||||
/// addr SPACE len
|
//!
|
||||||
/// content
|
//! ```
|
||||||
|
//! let mut m = Machine::new(true, get_debug_configuration());
|
||||||
|
//! let mut MemChecker = mem_cmp::MemChecker::from(get_full_path!("memory", expr));
|
||||||
|
//! mem_cmp::MemChecker::fill_memory_from_mem_checker(&MemChecker, &mut m);
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//!
|
||||||
|
//! ! FILE.TXT FORMAT Representing machine memory memory
|
||||||
|
//! - PC
|
||||||
|
//! - SP
|
||||||
|
//! - Section_1
|
||||||
|
//! - Section_2
|
||||||
|
//! - ...
|
||||||
|
//! - Section_n
|
||||||
|
//!
|
||||||
|
//! Each section is divided in 3 parts, on two lines of text
|
||||||
|
//! addr SPACE len
|
||||||
|
//! content
|
||||||
|
|
||||||
use std::{fs, io::{BufRead, BufReader, Lines, Error}};
|
use std::{fs, io::{BufRead, BufReader, Lines, Error}};
|
||||||
use crate::Machine;
|
use crate::Machine;
|
||||||
@ -94,7 +111,7 @@ impl MemChecker{
|
|||||||
/// Extract the values of pc, sp and sections
|
/// Extract the values of pc, sp and sections
|
||||||
///
|
///
|
||||||
/// ### Parameter
|
/// ### Parameter
|
||||||
/// -**path** addr to the file
|
/// - **path** addr to the file
|
||||||
///
|
///
|
||||||
/// ### Return
|
/// ### Return
|
||||||
/// Mem-checker filled
|
/// Mem-checker filled
|
||||||
|
@ -1,18 +1,38 @@
|
|||||||
|
//! # mmu
|
||||||
|
//!
|
||||||
|
//! This module contains a MMU implementation
|
||||||
|
//!
|
||||||
|
//! This part isn't tested and integrated to BurritOS because of the lack of pagination implementation
|
||||||
|
//!
|
||||||
|
//!
|
||||||
|
|
||||||
use crate::simulator::translationtable::*;
|
use crate::simulator::translationtable::*;
|
||||||
use crate::simulator::machine::*;
|
use crate::simulator::machine::*;
|
||||||
|
|
||||||
|
//! # Memory Management Unit
|
||||||
|
//! An MMU possesses a single reference to a translation table
|
||||||
|
//! This table is associated to the current process
|
||||||
pub struct MMU <'a>{
|
pub struct MMU <'a>{
|
||||||
/* Un MMU possède une seule référence vers une table des pages à un instant donné
|
/// Reference to a page table
|
||||||
* Cette table est associée au processus courant
|
|
||||||
* Cette référence peut etre mise a jour par exemple lors d'un switchTo
|
|
||||||
*/
|
|
||||||
translationTable : Option<&'a mut TranslationTable>,
|
translationTable : Option<&'a mut TranslationTable>,
|
||||||
|
/// The number of physique pages
|
||||||
numPhyPages : u64,
|
numPhyPages : u64,
|
||||||
|
/// Size of each page
|
||||||
pageSize : u64
|
pageSize : u64
|
||||||
}
|
}
|
||||||
|
|
||||||
impl <'a>MMU <'_>{
|
impl <'a>MMU <'_>{
|
||||||
|
|
||||||
|
/// Create a MMU with a None reference for the translation table
|
||||||
|
///
|
||||||
|
/// ### Parameters
|
||||||
|
///
|
||||||
|
/// - **numPhyPages** the number of physique pages
|
||||||
|
/// - **pageSize** the size of a page
|
||||||
|
///
|
||||||
|
/// ### Return
|
||||||
|
///
|
||||||
|
/// MMU with None reference and the value for the number of physical pages and pae size associated
|
||||||
fn create(numPhyPages: u64, pageSize: u64) -> MMU <'a>{
|
fn create(numPhyPages: u64, pageSize: u64) -> MMU <'a>{
|
||||||
MMU {
|
MMU {
|
||||||
translationTable : None,
|
translationTable : None,
|
||||||
|
Loading…
Reference in New Issue
Block a user