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
This fixes the case where there is only one process active and it tries
to send messages to itself, or it yields to itself.
This closes issue #42.
Signed-off-by: Sean Cross <sean@xobs.io>
This allows us to use println early on even before it's initialized,
which will allow us to ignore prints to an uninitialized port.
Signed-off-by: Sean Cross <sean@xobs.io>
Memory that was marked as reserved-but-not-in-use could get reallocated.
Practically speaking, this caused threads to share stack, which makes
things spooky.
Signed-off-by: Sean Cross <sean@xobs.io>
the code originally would pick the same thread over and over again
this fix starts the thread search at one plus the current thread
wrapping around to one plus the current thread, so we always try
to pick a new thread compared to the current one, instead of
generally picking the same thread most of the time.