Commit graph

364 commits

Author SHA1 Message Date
bunnie
260b154741 clean up some boot process holdovers 2021-04-30 23:28:31 +08:00
bunnie
640ddb48e8 suspend/resume now works to hardware 2021-04-30 19:29:36 +08:00
bunnie
0e2d57c9fb retrofit the kernel and loader to handle resume
and now the even harder debuggening begins...zomg o_O
2021-04-30 01:55:38 +08:00
bunnie
85211bb57d add susres server skeleton 2021-04-27 00:38:51 +08:00
bunnie
308cda1af4 remove unused sie use 2021-04-25 21:44:21 +08:00
bunnie
77c44ccb76 depracate use of SIE by storing SIM to RAM-based backing 2021-04-25 18:49:57 +08:00
bunnie
aed2325f68 fix some minor bugs in hosted mode
memory is not page-aligned so `if !cfg()`-out the alignment
checks in hosted mode
2021-04-09 17:31:36 +08:00
Sean Cross
e2996935cf 0.8.0: tag release
This bumps version numbers to 0.8.0, indicating we're nearing final
release.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-07 16:34:16 +08:00
Sean Cross
21a8ddd458 kernel: services: don't remap memory on intra-process lends
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>
2021-04-06 09:08:03 +08:00
Sean Cross
4830f3eb2c kernel: server: implement DestroyServer(sid)
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>
2021-04-05 18:18:48 +08:00
Sean Cross
49c1eacf8c kernel: remove split queues file
This file shouldn't have been checked in.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-05 18:17:09 +08:00
Sean Cross
85f0adbb2d kernel: implement Disconnect() syscall
Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-02 18:37:09 +08:00
Sean Cross
fdce58d06e ipc: convert project to use xous-ipc
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>
2021-03-26 20:22:33 +08:00
Sean Cross
5ae39de7da kernel: riscv: run rustfmt on mem.rs
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-26 17:14:26 +08:00
Sean Cross
af5598d2dc kernel: move memory owner when a Move occurs
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>
2021-03-26 17:14:26 +08:00
Sean Cross
078f6ba625 kernel: services: be more proactive about updating current_thread
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>
2021-03-25 16:15:19 +08:00
Sean Cross
a5993f0445 kernel: fix hosted representation of ReturnMemory
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 14:56:40 +08:00
Sean Cross
c7b2b2cab0 xous: add offset and valid to returned memory
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>
2021-03-25 13:16:15 +08:00
Sean Cross
2b97ea25ab xous: add create_thread_n functions
These are used to create threads with between 0 and 4 arguments.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 10:42:49 +08:00
Sean Cross
568d1263a3 kernel: syscall: remove variables that never change
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>
2021-03-25 09:14:43 +08:00
Sean Cross
eb2014bc80 kernel: hosted: fix kernel tests
We don't need to re-create the PID1 process, since it is done
immediately now.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-25 09:13:27 +08:00
Sean Cross
455bd4ccfb kernel: services: add more debug print crumbs
These could be useful in finding out what's gone wrong.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 22:12:29 +08:00
Sean Cross
cc0c395e1e kernel: server: rework queue with generation counter
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>
2021-03-24 22:10:11 +08:00
Sean Cross
f8309dc580 kernel: riscv: add klog messages to mem.rs
These are useful in tracking down certain violations.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 22:07:06 +08:00
Sean Cross
090354c882 kernel: services: remove syscall_stack
This field is unused, so remove it.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-24 20:21:30 +08:00
Sean Cross
b967712e5f kernel: use correct thread ID when server queue is full
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>
2021-03-24 17:23:39 +08:00
Sean Cross
861565054e kernel: don't activate target thread on hosted mode
This operation is unneeded on hosted, and causes an error.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:35:52 +08:00
Sean Cross
bf3a3879d2 kernel: hosted: create thread id 1
This ensures that PID1 has a thread ID created as well.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:35:20 +08:00
Sean Cross
2a6de6ed67 kernel: hosted: remove unused interrupt calls
These were removed from riscv, and have no place in hosted mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 21:34:37 +08:00
Sean Cross
ff05fff4d6 kernel: syscall: run cargo fmt on syscall.rs
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:53:22 +08:00
Sean Cross
93fc8a0b99 kernel: cargo: add wrap-print feature
This is used to force kernel messages to be wrapped to 80 columns.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:52:53 +08:00
Sean Cross
0d77f704a9 kernel: services: run cargo fmt on this file
Minor text reformatting.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:51:33 +08:00
Sean Cross
00e7f07187 kernel: services: remember new thread if specified
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>
2021-03-23 19:50:12 +08:00
Sean Cross
9ab5b4880f kernel: server: allow taking multiple messages from queue
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>
2021-03-23 19:45:32 +08:00
Sean Cross
ccc7264b79 kernel: main: use iterator when printing processes
This avoids a C-style for() loop.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-23 19:42:33 +08:00
Sean Cross
6987df997d kernel: irq: don't disable interrupts when claiming irq
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>
2021-03-23 19:40:56 +08:00
Sean Cross
6e290500db kernel: riscv: fix wfi handling for interrupts
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>
2021-03-23 19:38:48 +08:00
Sean Cross
eb4ab4ca35 kernel: main: ignore interrupts in main loop
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>
2021-03-23 19:34:53 +08:00
Sean Cross
06a5997a45 kernel: debug: add wrap-print feature
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>
2021-03-22 22:27:53 +08:00
bunnie
ea8b208a15 finalize rkyv 0.4.1 refactor 2021-03-18 03:54:48 +08:00
bunnie
8fbd900a4c Merge branch 'hardware-no-cb' into rkyv-refactor
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
2021-03-17 16:06:06 +08:00
bunnie
eda33b5de7 factor out the shellchat callback, which mysterious breaks things 2021-03-16 18:03:12 +08:00
bunnie
5ba5dc0340 Merge branch 'hardware' of github.com:betrusted-io/xous-core into hardware 2021-03-16 17:03:37 +08:00
bunnie
2fb6ae5ee7 debugging i2c 2021-03-16 17:03:10 +08:00
bunnie
d68e3e8cf4 an attempt to refactor to rkyv 0.4.1
unfortunately, it looks like deserialize requires an alloc??
2021-03-16 02:02:53 +08:00
Sean Cross
80c41f1dfc kernel: fix build in hosted mode for rand
The `rand` module exists now, which conflicts with the `rand` crate.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-15 11:21:29 +08:00
Sean Cross
55a09990f0 hosted: pre-allocate buffers for performace boost
Buffers have a known size. We can avoid reallocations by preallocating
buffers to this known size.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-14 18:29:45 +08:00
Sean Cross
9c8b562711 hosted: set tcp_nodelay
This might have a performance impact, but it's unclear.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-13 18:05:11 +08:00
Sean Cross
cf1e2435bc kernel: implement GetThreadID and GetProcessID
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-11 11:20:35 +08:00
Sean Cross
e00b958308 hosted: transmit PID to clients
Prior to this patch, all clients assumed they were PID 1.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-10 17:35:57 +08:00