Project now builds
This commit is contained in:
parent
b96808b55f
commit
2756477e67
@ -44,7 +44,7 @@ pub const SC_DEBUG: u8 = 34;
|
|||||||
pub const CONSOLE_OUTPUT: u8 = 1;
|
pub const CONSOLE_OUTPUT: u8 = 1;
|
||||||
|
|
||||||
// todo : returns new types, not just machine errors and machine ok
|
// todo : returns new types, not just machine errors and machine ok
|
||||||
pub fn call(exception: ExceptionType, machine: &mut Machine, system: &mut System) -> Result<MachineOk, MachineError> {
|
pub fn call(exception: &ExceptionType, machine: &mut Machine, system: &mut System) -> Result<MachineOk, MachineError> {
|
||||||
|
|
||||||
match exception {
|
match exception {
|
||||||
ExceptionType::NoException => todo!(),
|
ExceptionType::NoException => todo!(),
|
||||||
@ -66,10 +66,10 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
|
|||||||
SC_SHUTDOWN => Ok(MachineOk::Shutdown),
|
SC_SHUTDOWN => Ok(MachineOk::Shutdown),
|
||||||
SC_EXIT => {
|
SC_EXIT => {
|
||||||
let th = match &system.get_thread_manager().g_current_thread {
|
let th = match &system.get_thread_manager().g_current_thread {
|
||||||
Some(th) => th,
|
Some(th) => th.clone(),
|
||||||
None => Err("Current thread is None")?
|
None => Err("Current thread is None")?
|
||||||
};
|
};
|
||||||
system.get_thread_manager().thread_finish(machine, *th);
|
system.get_thread_manager().thread_finish(machine, th);
|
||||||
Ok(MachineOk::Ok)
|
Ok(MachineOk::Ok)
|
||||||
},
|
},
|
||||||
SC_EXEC => todo!(),
|
SC_EXEC => todo!(),
|
||||||
|
@ -34,6 +34,7 @@ use super::error::MachineOk;
|
|||||||
/// Textual names of the exceptions that can be generated by user program
|
/// Textual names of the exceptions that can be generated by user program
|
||||||
/// execution, for debugging purpose.
|
/// execution, for debugging purpose.
|
||||||
/// todo: is this really supposed to stand in machine.rs?
|
/// todo: is this really supposed to stand in machine.rs?
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum ExceptionType {
|
pub enum ExceptionType {
|
||||||
/// Everything ok
|
/// Everything ok
|
||||||
NoException,
|
NoException,
|
||||||
@ -229,7 +230,7 @@ impl Machine {
|
|||||||
pub fn raise_exception(&mut self, exception: ExceptionType, address : u64, system: &mut System) -> Result<MachineOk, MachineError>{
|
pub fn raise_exception(&mut self, exception: ExceptionType, address : u64, system: &mut System) -> Result<MachineOk, MachineError>{
|
||||||
self.set_status(MachineStatus::SystemMode);
|
self.set_status(MachineStatus::SystemMode);
|
||||||
// Handle the interruption
|
// Handle the interruption
|
||||||
match exception::call(exception, self, system) {
|
match exception::call(&exception, self, system) {
|
||||||
Ok(MachineOk::Shutdown) => {
|
Ok(MachineOk::Shutdown) => {
|
||||||
self.set_status(MachineStatus::UserMode);
|
self.set_status(MachineStatus::UserMode);
|
||||||
return Ok(MachineOk::Shutdown);
|
return Ok(MachineOk::Shutdown);
|
||||||
|
Loading…
Reference in New Issue
Block a user