kernel: remove old code at top of syscall::handle

This was pseudocode from back before we had a better idea of how
everything would be laid out.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-04-06 10:44:41 +08:00
parent 1f478925ce
commit a1c88b4ffd

View file

@ -7,133 +7,6 @@ use crate::services::SystemServicesHandle;
use core::mem;
use xous::*;
// extern "Rust" {
// /// Allocates kernel structures for a new process, and returns the new PID.
// /// This removes `page_count` page tables from the calling process at `origin_address`
// /// and places them at `target_address`.
// ///
// /// If the process was created successfully, then the new PID is returned to
// /// the calling process. The child is not automatically scheduled for running.
// ///
// /// # Errors
// ///
// /// * **BadAlignment**: `origin_address` or `target_address` were not page-aligned,
// /// or `address_size` was not a multiple of the page address size.
// /// * **OutOfMemory**: The kernel couldn't allocate memory for the new process.
// #[allow(dead_code)]
// pub fn sys_process_spawn(
// origin_address: MemoryAddress,
// target_address: MemoryAddress,
// address_size: MemorySize,
// ) -> Result<PID, xous::Error>;
// /// Interrupts the current process and returns control to the parent process.
// ///
// /// # Errors
// ///
// /// * **ProcessNotFound**: The provided PID doesn't exist, or is not running on the given CPU.
// #[allow(dead_code)]
// pub fn sysi_process_suspend(pid: PID, cpu_id: XousCpuId) -> Result<(), xous::Error>;
// #[allow(dead_code)]
// pub fn sys_process_resume(
// process_id: PID,
// stack_pointer: Option<usize>,
// additional_contexts: &Option<&[XousContext]>,
// ) -> Result<
// (
// Option<XousContext>,
// Option<XousContext>,
// Option<XousContext>,
// ),
// xous::Error,
// >;
// /// Causes a process to terminate immediately.
// ///
// /// It is recommended that this function only be called on processes that
// /// have cleaned up after themselves, e.g. shut down any servers and
// /// flushed any file descriptors.
// ///
// /// # Errors
// ///
// /// * **ProcessNotFound**: The requested process does not exist
// /// * **ProcessNotChild**: The requested process is not our child process
// #[allow(dead_code)]
// pub fn sys_process_terminate(process_id: PID) -> Result<(), xous::Error>;
// /// Equivalent to the Unix `sbrk` call. Adjusts the
// /// heap size to be equal to the specified value. Heap
// /// sizes start out at 0 bytes in new processes.
// ///
// /// # Errors
// ///
// /// * **OutOfMemory**: The region couldn't be extended.
// #[allow(dead_code)]
// pub fn sys_heap_resize(size: MemorySize) -> Result<(), xous::Error>;
// ///! Message Passing Functions
// /// Create a new server with the given name. This enables other processes to
// /// connect to this server to send messages. Only one server name may exist
// /// on a system at a time.
// ///
// /// # Errors
// ///
// /// * **ServerExists**: A server has already registered with that name
// /// * **InvalidString**: The name was not a valid UTF-8 string
// #[allow(dead_code)]
// pub fn sys_server_create(server_name: usize) -> Result<XousSid, xous::Error>;
// /// Suspend the current process until a message is received. This thread will
// /// block until a message is received.
// ///
// /// # Errors
// ///
// #[allow(dead_code)]
// pub fn sys_server_receive(server_id: XousSid) -> Result<XousMessageReceived, xous::Error>;
// /// Reply to a message received. The thread will be unblocked, and will be
// /// scheduled to run sometime in the future.
// ///
// /// If the message that we're responding to is a Memory message, then it should be
// /// passed back directly to the destination without modification -- the actual contents
// /// will be passed in the `out` address pointed to by the structure.
// ///
// /// # Errors
// ///
// /// * **ProcessTerminated**: The process we're replying to doesn't exist any more.
// /// * **BadAddress**: The message didn't pass back all the memory it should have.
// #[allow(dead_code)]
// pub fn sys_server_reply(
// destination: XousMessageSender,
// message: XousMessage,
// ) -> Result<(), xous::Error>;
// /// Look up a server name and connect to it.
// ///
// /// # Errors
// ///
// /// * **ServerNotFound**: No server is registered with that name.
// #[allow(dead_code)]
// pub fn sys_client_connect(server_name: usize) -> Result<XousConnection, xous::Error>;
// /// Send a message to a server. This thread will block until the message is responded to.
// /// If the message type is `Memory`, then the memory addresses pointed to will be
// /// unavailable to this process until this function returns.
// ///
// /// # Errors
// ///
// /// * **ServerNotFound**: The server does not exist so the connection is now invalid
// /// * **BadAddress**: The client tried to pass a Memory message using an address it doesn't own
// /// * **Timeout**: The timeout limit has been reached
// #[allow(dead_code)]
// pub fn sys_client_send(
// server: XousConnection,
// message: XousMessage,
// ) -> Result<XousMessage, xous::Error>;
// }
pub fn handle(call: SysCall) -> core::result::Result<xous::Result, xous::Error> {
let pid = arch::current_pid();
@ -476,8 +349,7 @@ pub fn handle(call: SysCall) -> core::result::Result<xous::Result, xous::Error>
})?;
let envelope = MessageEnvelope { sender, message };
ss.ready_context(server_pid, ctx_number)
.or_else(|e| {
ss.ready_context(server_pid, ctx_number).or_else(|e| {
ss.server_from_sidx(sidx)
.expect("server couldn't be located")
.return_available_context(context_nr);