Implement exec

Implement brk
This commit is contained in:
Jeremy Soller 2016-09-10 22:06:09 -06:00
parent f2ca411cd6
commit 44e8b99b46
11 changed files with 122 additions and 59 deletions

View file

@ -30,6 +30,8 @@ pub enum Call {
Exec = 11,
/// Get process ID
GetPid = 20,
/// Set process break
Brk = 45,
/// Yield to scheduler
SchedYield = 158
}
@ -46,6 +48,7 @@ impl Call {
6 => Ok(Call::Close),
11 => Ok(Call::Exec),
20 => Ok(Call::GetPid),
45 => Ok(Call::Brk),
158 => Ok(Call::SchedYield),
_ => Err(Error::NoCall)
}
@ -63,6 +66,8 @@ pub enum Error {
NoEntry = 2,
/// No such process
NoProcess = 3,
/// Invalid executable format
NoExec = 8,
/// Bad file number
BadFile = 9,
/// Try again
@ -100,6 +105,7 @@ pub fn handle(a: usize, b: usize, c: usize, d: usize, e: usize, _f: usize) -> Re
Call::Close => close(b),
Call::Exec => exec(convert_slice(b as *const u8, c)?, convert_slice(d as *const [usize; 2], e)?),
Call::GetPid => getpid(),
Call::Brk => brk(b),
Call::SchedYield => sched_yield()
}
}