Added sc_p call
This commit is contained in:
parent
729eba656c
commit
355071a2f1
@ -203,7 +203,7 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
|
||||
},
|
||||
SC_YIELD => todo!(),
|
||||
SC_PERROR => todo!(),
|
||||
SC_P => todo!(),
|
||||
SC_P => sc_p(machine, system),
|
||||
SC_V => sc_v(machine, system),
|
||||
SC_SEM_CREATE => {
|
||||
let addr_name = machine.read_int_register(10) as usize;
|
||||
@ -240,6 +240,14 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
|
||||
}
|
||||
}
|
||||
|
||||
fn sc_p(machine: &mut Machine, system: &mut System) -> Result<(), Error> {
|
||||
let id_sema = machine.int_reg.get_reg(10);
|
||||
match system.get_obj_addrs().search_semaphore(id_sema) {
|
||||
Some(sema) => { sema.p(machine, system.get_thread_manager()); Ok(()) }
|
||||
None => Err(format!("Coudn't find semaphore {}", id_sema))
|
||||
}
|
||||
}
|
||||
|
||||
fn sc_v(machine: &mut Machine, system: &mut System) -> Result<(), Error> {
|
||||
let id_sema = machine.int_reg.get_reg(10);
|
||||
match system.get_obj_addrs().search_semaphore(id_sema) {
|
||||
|
Loading…
Reference in New Issue
Block a user