1
0
forked from Rativel/BurritOS

Renamed exceptions to follow CamlCase convention

This commit is contained in:
François Autin
2023-03-23 20:54:05 +01:00
parent 43de76bd72
commit 21159d3d98
2 changed files with 20 additions and 22 deletions

View File

@@ -29,7 +29,7 @@ impl <'a>MMU <'_>{
MMU::translate(mmu, virt_addr, &mut phy_addr_double_check, false);
match exc {
ExceptionType::NO_EXCEPTION => {
ExceptionType::NoException => {
if phy_addr != phy_addr_double_check {
//Besoin ici d'une impl pour gestion d'exeption
//dans nachos : g-machine->RaiseException(exc, virt_addr);
@@ -44,7 +44,7 @@ impl <'a>MMU <'_>{
_ => {
//Besoin ici d'une impl pour gestion d'exeption
//dans nachos : g-machine->RaiseException(exc, virt_addr);
println!("Error from mmu_read_mem :: Exception different from NO_EXCEPTION");
println!("Error from mmu_read_mem :: Exception different from NoException");
return false;
}
}
@@ -63,7 +63,7 @@ impl <'a>MMU <'_>{
MMU::translate(mmu, virt_addr, &mut phy_addr_double_check, true);
match exc {
ExceptionType::NO_EXCEPTION => {
ExceptionType::NoException => {
if phy_addr != phy_addr_double_check {
//Besoin ici d'une impl pour gestion d'exeption
//dans nachos : g-machine->RaiseException(exc, virt_addr);
@@ -78,7 +78,7 @@ impl <'a>MMU <'_>{
_ => {
//Besoin ici d'une impl pour gestion d'exeption
//dans nachos : g-machine->RaiseException(exc, virt_addr);
println!("Error from mmu_write_mem :: Exception different from NO_EXCEPTION");
println!("Error from mmu_write_mem :: Exception different from NoException");
return false;
}
}
@@ -96,7 +96,7 @@ impl <'a>MMU <'_>{
match &mut mmu.translationTable {
None => {
println!("Error from translate : MMU refers to None (No page Table)");
return ExceptionType::ADDRESSERROR_EXCEPTION;
return ExceptionType::AddressErrorException;
}
Some(table_ref) => {
@@ -104,7 +104,7 @@ impl <'a>MMU <'_>{
//On verifie que notre index est valide
if vpn >= table_ref.get_max_num_pages(){
println!("Error from translate :: index is out of bound");
return ExceptionType::ADDRESSERROR_EXCEPTION;
return ExceptionType::AddressErrorException;
}
/*Doc nachos dit que ce test sert a savoir si la page est mappée
@@ -113,13 +113,13 @@ impl <'a>MMU <'_>{
*/
if !table_ref.get_bit_read(vpn) && !table_ref.get_bit_write(vpn) {
println!("Error from translate :: virtual page # {} not mapped",vpn);
return ExceptionType::ADDRESSERROR_EXCEPTION;
return ExceptionType::AddressErrorException;
}
//si on souhaite effectuer un acces lecture, on verifie que l'on dispose du droit d'acces sur cette page
if writing && !table_ref.get_bit_write(vpn) {
println!("Error from translate :: write access on a read only virtual page # {}",vpn);
return ExceptionType::READONLY_EXCEPTION;
return ExceptionType::AddressErrorException;
}
//if the page is not yet in main memory, run the page fault manager
@@ -129,13 +129,13 @@ impl <'a>MMU <'_>{
println!("We need to update the page table by raising an exception -> not implemented");
//Ici il faudra reverifier le bit valid apres intervention du page fault manager
return ExceptionType::ADDRESSERROR_EXCEPTION;
return ExceptionType::AddressErrorException;
}
//Make sure that the physical adress is correct
if table_ref.get_physical_page(vpn) < 0 || table_ref.get_physical_page(vpn) >= (NUM_PHY_PAGE as i32) {
println!("Error from translate :: no valid correspondance");
return ExceptionType::BUSERROR_EXCEPTION;
return ExceptionType::BusErrorException;
}
//Set U/M bits to 1
@@ -151,6 +151,6 @@ impl <'a>MMU <'_>{
}
}
ExceptionType::NO_EXCEPTION
ExceptionType::NoException
}
}