From 5f798edb94051855db1b7657bc91c4740760d13a Mon Sep 17 00:00:00 2001 From: Moysan Gabriel Date: Mon, 13 Mar 2023 17:49:48 +0100 Subject: [PATCH] enum d'erreurs dans machine, du code pour gerer les erreurs dans le futur --- src/simulator/machine.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/simulator/machine.rs b/src/simulator/machine.rs index 710b11a..462c775 100644 --- a/src/simulator/machine.rs +++ b/src/simulator/machine.rs @@ -6,6 +6,29 @@ use super::{decode::{Instruction, decode}, interrupt::Interrupt}; use super::global::*; use std::fs::File; + +/* +* Decommenter la variant si il est utilisé quelque part + */ +enum ExceptionType { + NO_EXCEPTION,//Everything ok! + //SYSCALL_EXCEPTION,//A program executed a system call. + PAGEFAULT_EXCEPTION,//Page fault exception + READONLY_EXCEPTION,//Write attempted to a page marked "read-only" */ + //BUSERROR_EXCEPTION, + /* translation resulted + in an invalid physical + address (mis-aligned or + out-of-bounds) */ + ADDRESSERROR_EXCEPTION, /* Reference that was + not mapped in the address + space */ + //OVERFLOW_EXCEPTION, //Integer overflow in add or sub. + //ILLEGALINSTR_EXCEPTION, //Unimplemented or reserved instr. + //NUM_EXCEPTION_TYPES +} + + pub const STACK_REG: usize = 2; pub const NUM_INT_REGS: usize = 32;