Commit graph

29 commits

Author SHA1 Message Date
Sean Cross
61fdd5be15 kernel: hosted: add current_tid() to Process
This allows us to mock the current TID for debugging purposes on hosted
environments.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:54:19 +08:00
Sean Cross
585e55e8b7 kernel: implement retry_instruction()
This function is used to decrement the program counter to re-run a given
instruction. This can be used as a cheap way to implement blocking
calls.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:04:36 +08:00
Sean
1b59719a74 kernel: hosted: support per-thread memory messages
Previously, each process could return one chunk of memory. With this
change, processes can now return one chunk of memory per thread. This
enables multiple threads to lend memory to a server.

Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:20:16 +08:00
Sean Cross
bb17038bfe kernel: rename "xous" to "xous-kernel" in import
Cargo appears to cache packages in the workspace when multiple packages
use the same crate. Unfortunately, Xous uses different features
depending on whether it's running in the kernel or in userspace.

Pull the kernel version of "xous" in under a different namespace in
order to force it to use a different build.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-17 18:37:40 +08:00
Sean Cross
1d23bc5aae kernel: first multiple threads working
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 21:17:48 +08:00
Sean Cross
a467d6fcc7 kernel: baremetal: 2nd process starts to run and crashes
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-10 16:06:38 +08:00
Sean Cross
ebf568dadd baremetal: slowly whittling down the number of errors
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 16:14:34 +08:00
Sean Cross
039975323e tests: add tests package
This package serves only to build tests for the kernel, because the
kernel wants to use a different mechanism for spawning processes.

Cargo doesn't support having `#[cfg(test)]` attributes on modules in
order to allow conditional compilation depending on whether we're
running a test or not. To work around this, `main.rs` is included in
another dummy crate.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 21:18:30 +08:00
Sean Cross
e7e8a2b748 kernel: get initial hosted non-test processes working
This now has the ability to fork off processes.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 17:52:01 +08:00
Sean Cross
f925011ea2 kernel: fix multiple contexts test
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 14:03:44 +08:00
Sean Cross
7258fc83b7 kernel: rework process creation
This now uses a system of access keys to associate processes with the
kernel.

This currently does not pass tests.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-27 21:44:50 +08:00
Sean Cross
b9d211af3b xous: begin adding a create_process() call
This will mimic the `create_thread()` call and will obviate our own
process-creation code.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-26 10:54:54 +08:00
Sean Cross
cf992e9b09 kernel: hosted: properly shut down process
This ensures a process with a server can be reused.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:57:35 +08:00
Sean Cross
4130ce7bd1 kernel: fix threading and multiplexing issues
Connections weren't getting multiplexed correctly. As a result, they
would respond with the wrong message to a given thread.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 15:51:51 +08:00
Sean Cross
cf571ad1ee kernel: more renaming context -> thread
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:13:24 +08:00
Sean Cross
549866bcd5 kernel: remove printlns, needless context queries
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:52:18 +08:00
Sean Cross
1a6b1160a3 syscall: move send_message into its own function
This breaks up the giant `handle()` function.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:44:16 +08:00
Sean Cross
42f95e6488 threading: get basic threading tests working
With this, we can now run two "threads" within one process.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 12:23:09 +08:00
Sean Cross
e2296fceac ThreadID: rename from CtxID
Contexts are now renamed to Threads, which better reflects what they
actually are.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 11:04:31 +08:00
Sean Cross
e652150c6e kernel: get multiple message passing working
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 16:09:42 +08:00
Sean Cross
0ffbaa369a kernel: fix remaining warnings
This just silences them, which isn't great in the long run.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 15:16:51 +08:00
Sean Cross
b93abcc926 kernel: test: implement mutable borrow
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 15:10:25 +08:00
Sean Cross
e1a92e929c kernel: replace more unimplemented!() with UnhandledSyscall
This should prevent pacnics when calling unhandled functions.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-04 11:58:18 +08:00
Sean Cross
acfe8e5076 kernel: fix pid termination
Previously, we were recycling PIDs when devices disconnected, however we
weren't cleaning up PIDs within the system-level table.

This now cleans up these entries.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-25 18:15:36 +08:00
Sean Cross
9f1b1e7ec8 kernel: tests: get both tests working
We now have two tests. These tests may be run either in parallel or in series.

If they are run in parallel, then they will each have their own thread
local storage, and each will initialize things from scratch.

If they are run in series, then the thread local storage will be reused
between the two processes.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-25 17:41:17 +08:00
Sean Cross
9361055aec kernel: work-in-progress for process termination
Processes can go away. This is initial work to support process
termination.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-18 11:39:46 +08:00
Sean Cross
2786ad697b kernel: get scalar message passing working again
This gets basic scalar message passing working again. With this, the
following operations may be performed:

    * Starting a server
    * Connecting to a server
    * Sending a scalar message

Care must be taken to not overflow a server's queue, particularly if
writers are faster than readers.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-16 16:34:49 +08:00
Sean Cross
723529ba20 wip: working on getting message passing working
The goal is to get a basic message passing engine working that will also
function as a device that works on real hardware.

This is still reworking it to function correctly on a desktop system.
Once that is working, it will be reworked to function once again on
hardware.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-15 18:13:10 +08:00
Sean Cross
17ae34a1c1 kernel: begin actor refactor
This refactors the kernel so that it *can* run on baremetal, but it can
also run as part of a full system.

This will aid in developing, and ensure that a minimum amount of unsafe
code is present within the kernel.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-03 15:34:55 +08:00