Remove useless libc, elf and ucontext, add comments to exceptions

improve propagation of errors in raise_exception
This commit is contained in:
Quentin Legot
2023-04-05 16:02:54 +02:00
parent 41611b54e8
commit 44cfb828fb
7 changed files with 95 additions and 258 deletions

View File

@ -231,14 +231,12 @@ impl Machine {
self.set_status(MachineStatus::SystemMode);
// Handle the interruption
match exception::call(&exception, self, system) {
Ok(MachineOk::Shutdown) => {
Ok(r) => {
self.set_status(MachineStatus::UserMode);
return Ok(MachineOk::Shutdown);
}
_ => Err(format!("Syscall {:?} invalid or not implemented", exception))?
} // todo: return error if the syscall code is invalid
self.set_status(MachineStatus::UserMode);
Ok(MachineOk::Ok)
Ok(r)
},
Err(e) => Err(format!("Syscall {:?} invalid or not implemented", e))?
}
}
/// Execute the instructions table of a machine putted in param
@ -249,7 +247,7 @@ impl Machine {
pub fn run(&mut self, system: &mut System) {
loop {
match self.one_instruction(system) {
Ok(MachineOk::Ok) => println!("hello"),
Ok(MachineOk::Ok) => {},
Ok(MachineOk::Shutdown) => break,
Err(e) => panic!("FATAL at pc {} -> {}", self.pc, e)
}