Skip to content
Snippets Groups Projects
Commit 038cf5ab authored by Jeremy Soller's avatar Jeremy Soller
Browse files

PCI driver WIP

parent 9371120f
No related branches found
No related tags found
No related merge requests found
......@@ -121,7 +121,7 @@ pub extern fn userspace_init() {
assert_eq!(syscall::open(b"debug:", 0), Ok(1));
assert_eq!(syscall::open(b"debug:", 0), Ok(2));
syscall::exec(b"initfs:bin/init", &[]).expect("failed to execute initfs:init");
syscall::exec(b"initfs:bin/pcid", &[]).expect("failed to execute initfs:init");
panic!("initfs:init returned")
}
......
......@@ -19,6 +19,7 @@ impl InitFsScheme {
let mut files: BTreeMap<&'static [u8], &'static [u8]> = BTreeMap::new();
files.insert(b"bin/init", include_bytes!("../../build/userspace/init"));
files.insert(b"bin/pcid", include_bytes!("../../build/userspace/pcid"));
files.insert(b"etc/init.rc", b"echo testing\n");
InitFsScheme {
......
......@@ -32,6 +32,8 @@ pub enum Call {
GetPid = 20,
/// Set process break
Brk = 45,
/// Set process I/O privilege level
Iopl = 110,
/// Yield to scheduler
SchedYield = 158
}
......@@ -49,6 +51,7 @@ impl Call {
11 => Ok(Call::Exec),
20 => Ok(Call::GetPid),
45 => Ok(Call::Brk),
110 => Ok(Call::Iopl),
158 => Ok(Call::SchedYield),
_ => Err(Error::NoCall)
}
......@@ -106,6 +109,7 @@ pub fn handle(a: usize, b: usize, c: usize, d: usize, e: usize, _f: usize) -> Re
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::Iopl => iopl(b),
Call::SchedYield => sched_yield()
}
}
......
......@@ -105,6 +105,11 @@ pub fn getpid() -> Result<usize> {
Ok(context.id)
}
pub fn iopl(_level: usize) -> Result<usize> {
//TODO
Ok(0)
}
pub fn sched_yield() -> Result<usize> {
unsafe { context::switch(); }
Ok(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment