This brings intra-process lending in-line with intra-process sending,
where memory is not remapped the pointer is simply reused.
We may change this at a later point in order to further enforce the
concept of lent-memory-is-inaccessible, so do not rely in this behavior.
Signed-off-by: Sean Cross <sean@xobs.io>
This implements a syscall to shut down a server. Servers may not be shut
down if they have outstanding messages that they have seen but not
responded to.
Signed-off-by: Sean Cross <sean@xobs.io>
This rewrites the entire project so that most runnable projects now use
`xous-ipc` instead of `xous::String` where possible.
This also removes `rkyv` from the list of dependencies in `xous-rs`.
Signed-off-by: Sean Cross <sean@xobs.io>
When moving memory between processes, update the owner of that page to
match the new PID. Otherwise, memory can never be released.
Signed-off-by: Sean Cross <sean@xobs.io>
The `current_thread` variable is used to determine which thread to
switch back to after a context switch occurs. Keep track of the thread
more closely.
Signed-off-by: Sean Cross <sean@xobs.io>
This will enable us to have more information about the result that is
returned when mutable memory is modified by a server.
Signed-off-by: Sean Cross <sean@xobs.io>
The `can_resume` variable doesn't change, and can be made a constant.
This slightly improves reasoning about what the function is doing.
Signed-off-by: Sean Cross <sean@xobs.io>
This reworks the server queue to add a "generation counter". This
counter ensures messages are removed from the queue in the order they
were added, even if they are jumbled up within the queue itself.
Signed-off-by: Sean Cross <sean@xobs.io>
Instead of queueing the client thread number inside the server, queue
the server's thread number inside the server.
This prevents many spooky messages that were occurring when server
queues got full.
Signed-off-by: Sean Cross <sean@xobs.io>
If we switch to a thread and specify a thread ID, remember that as the
current thread ID.
This prevents thread starvation by repeatedly going back to the same
thread ID.
Signed-off-by: Sean Cross <sean@xobs.io>
Previously, we would only look at the top item on the server queue. If
it was not a known message, we would return an error.
This patch changes this behavior to look through the entire queue for
something we can take, and then clean it up as we go along.
This allow for having outstanding requests in the queue an forms the
backbone of the sleep server.
Signed-off-by: Sean Cross <sean@xobs.io>
When claiming an IRQ, we used to disable interrupts.
This is unnecessary, as interrupts are already disabled when running in
kernel mode.
Signed-off-by: Sean Cross <sean@xobs.io>
Keep interrupts nominally disabled in supervisor mode, and only enable
them for a brief period after WFI hits.
If an interrupt occurs, then WFI becomes a NOP. The `idle()` function is
only called when no more processes are running, which happens when all
processes are waiting for an interrupt.
Therefore, enable interrupts for a brief period when WFI returns in
order to drain all pending interrupts and return to the caller to handle
any change in the process table.
Signed-off-by: Sean Cross <sean@xobs.io>
When the kernel is running its main loop, interrupts are disabled as it
is running in supervisor mode.
As a result, we can ignore any interrupt enabling/disabling that may
need to occur.
Signed-off-by: Sean Cross <sean@xobs.io>
This feature works around a bug in Renode where unwrapped lines cause it
to crash. This forces columns to be wrapped at 80 characters.
Signed-off-by: Sean Cross <sean@xobs.io>
Bring the two branches up to date, while also laying the groundwork
for XousServerName to be used as a native index type in xous-names
so we aren't burdening xous::String with a hasher