2016-08-14 23:58:35 +02:00
|
|
|
///! Process syscalls
|
|
|
|
|
|
|
|
use arch::interrupt::halt;
|
|
|
|
|
2016-08-15 00:07:41 +02:00
|
|
|
use super::{convert_slice, Result};
|
|
|
|
|
2016-08-14 23:58:35 +02:00
|
|
|
pub fn exit(status: usize) -> ! {
|
|
|
|
println!("Exit {}", status);
|
|
|
|
loop {
|
|
|
|
unsafe { halt() };
|
|
|
|
}
|
|
|
|
}
|
2016-08-15 00:07:41 +02:00
|
|
|
|
|
|
|
pub fn exec(path: &[u8], args: &[[usize; 2]]) -> Result<usize> {
|
|
|
|
print!("Exec {:?}", ::core::str::from_utf8(path));
|
|
|
|
for arg in args {
|
|
|
|
print!(" {:?}", ::core::str::from_utf8(convert_slice(arg[0] as *const u8, arg[1])?));
|
|
|
|
}
|
|
|
|
println!("");
|
|
|
|
Ok(0)
|
|
|
|
}
|