Remove useless libc, elf and ucontext, add comments to exceptions
improve propagation of errors in raise_exception
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user