Skip to content

Commit

Permalink
first pass at syscall interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Jun 27, 2018
1 parent f9d097d commit ea39ca7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions kernel/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,25 @@ pub enum Syscall {
/// Various memory operations.
MEMOP = 4,
}

/// This trait must be implemented by the architecture of the chip Tock is
/// running on. It allows the kernel to manage processes in an
/// architecture-agnostic manner.
pub trait SyscallInterface {
/// Allows the kernel to query the architecture to see if a syscall occurred
/// for the currently running process.
fn get_syscall_fired(&self) -> bool;

/// Get the syscall that the process called.
fn get_syscall_number(&self, stack_pointer: *const u8) -> Option<Syscall>;

/// Get the four u32 values that the process can pass with the syscall.
fn get_syscall_data(&self, stack_pointer: *const u8) -> (u32, u32, u32, u32);

/// Replace the last stack frame with the new function call. This function
/// is what should be executed when the process is resumed.
fn replace_function_call(&self, stack_pointer: *const u8, callback: FunctionCall);

/// Context switch to a specific process.
fn switch_to_process(&self, stack_pointer: *const u8) -> *mut u8;
}

0 comments on commit ea39ca7

Please sign in to comment.