Commit graph

103 commits

Author SHA1 Message Date
Sean Cross
ad154e998e xous: add NewServerID return value
This is used when creating a new Server. In addition to the ServerID, it
also returns the ConnectionID. This is the ID that can be expected when
receiving messages.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-23 10:51:27 +08:00
Sean Cross
d8edcb8b9e xous: implement ReturnScalar and ReturnScalar2
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 23:36:11 +08:00
Sean Cross
446fe17273 xous: add syscall for BlockingScalar
This enables this to be passed to the kernel.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 22:21:21 +08:00
Sean Cross
673577a10e xous: syscall: add BlockingScalar to syscall handling
Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 21:33:09 +08:00
Sean Cross
81a927e31f xous: definitions: Message: add has_memory()
This function can be used to determine if a function has any memory
attached to the message.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 21:25:28 +08:00
Sean Cross
6c941855be xous: definitions: add is_blocking() to Message
This function can be used to determine if a Message will block when sent
to the host.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 21:23:18 +08:00
Sean Cross
799c1c3822 xous: definitions: add Scalar1 and Scalar2 return values
These return values can be used to return something other than "Success"
from a blocking call.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-09-22 21:19:37 +08:00
Sean
f1353e8ff0 xous: hosted: free MemoryMessage::Move after send
This ensures that these messages aren't leaked. In a native system, this
memory would be "freed" by the kernel as it is attached to the new
memory space.

Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:22:13 +08:00
Sean
5b45382489 xous: make SysCallNumber pub
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:21:52 +08:00
Sean
eb725ec57f xous: carton: leak memory when converting into_message()
When converting into a message, the associated memory should be leaked
and not freed when the Carton is dropped. This is because the Message
can outlive the MemoryMessage, and the Carton is then immediately
dropped.

Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-09-03 13:20:36 +08:00
Sean Cross
d057cba0fb xous: add "logging" feature
This will connect to a logging server to allow for log messages.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 17:39:58 +08:00
Sean Cross
1a0bb99890 xous: hosted: read back memory for TrySendMessage
Like SendMessage, the TrySendMessage requires us to read back memory.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 17:38:24 +08:00
Sean Cross
7a2e5fbde8 xous: add try_ variants for connect/send_message
These will return if the server is full. Note that the previous variants
are now unimplemented.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 17:37:39 +08:00
Sean Cross
98854d8e2f xous: rename message body from "message" to "body"
This makes more sense since we already have a "header" field.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:37:21 +08:00
Sean Cross
eaf2b038c1 xous: be more generous in specifying bitflags crate
Presumably it won't change much.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:36:57 +08:00
Sean Cross
776fd72483 xous: syscall: work around clippy warnings on Result::Ok
clippy warns that "Result::Ok" is redundant. Work around clippy by using
the fully-qualified path.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-30 00:05:02 +08:00
Sean Cross
87c7335afc xous: don't panic when non-Ok is returned by send_message
Sometimes the queue is full, in which case something other than Ok is
returned. Don't panic when this happens.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-18 17:01:28 +08:00
Sean Cross
dfd11f846d hosted: fix hosted builds
We can now run `cargo xtask run` and it will do the right thing.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-18 13:52:43 +08:00
Sean Cross
f469bfcffc xous-rs: remove baremetal cfg
We now check if `target_os = "none"`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-14 19:53:33 +08:00
Sean Cross
3ed964507d xous: add #[xous::xous_main] proc-macro
This is used to annotate a main function that is compatible with both
hosted and baremetal environments.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-14 16:44:08 +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
10ecacd136 kernel: native: create process for initial processes
These all need to bootstrap themselves.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 23:08:54 +08:00
Sean Cross
ba30b4919d kernel: remove more warnings
Still haven't run it on real hardware, but this removes more warnings
from the system.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 21:52:28 +08:00
Sean Cross
8925964754 kernel: on to lifetime issues now!
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 19:38:15 +08:00
Sean Cross
6a098a222b xous: Add missing mem functions
Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-07 18:58:36 +08:00
Sean Cross
49083081c3 xous: replace processes-as-threads with baremetal check
This gets it working on baremetal, and keeps processes-as-threads
available for running in hosted mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-06 23:25:28 +08:00
Sean Cross
4643155318 cross-platform: fix building on native and hosted
This makes some minor changes to get builds working on both platforms.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-03 18:25:46 +08:00
Sean Cross
285b92401e mem: get tests working again on hosted
This fixes all tests so they now work (and pass!) when running in a
hosted environment.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-03 18:15:56 +08:00
Sean Cross
6ab4133165 xous: begin using hooks for memory allocation
This moves memory allocation into hooks, and allows for a common syscall
regardless of platform.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-03 17:58:22 +08:00
Sean Cross
ea3a473c9f reworking memory allocation
The kernel should run in a `no_std` environment, which means it must
currently run without `alloc`. We have our own allocation methods when
running on baremetal hardware.

Begin the work to break out the allocation method so that it will work
on both desktop and baremetal environments.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-03 17:40:57 +08:00
Sean Cross
21aa67b748 workspace: remove workspace
The kernel and userspace both need to use `xous`, but have different
requirements. If we use a workspace, then all instances of `xous-rs`
must have the same feature set.

This breaks them apart so the kernel can have one set of features and
programs can have another set.

As part of this change, tests are now integrated into the kernel, and a
new `create_process_as_thread()` and `wait_process_as_thread()` function
pair have been added.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-02 16:11:12 +08:00
Sean Cross
cbbc6613c6 xous: hosted: remove Option<> from ProcessArgs
There is no reason to make this an Option, since it will always exist.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-30 14:55:02 +08:00
Sean Cross
ef0ef924c8 fix more clippy warnings
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 22:48:48 +08:00
Sean Cross
869ebcff8b kernel: get tests and running working
This fixes process creation so that it works for both tests and running
it as a program.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 22:37:03 +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
cece761ff1 xous: SID: convert to using newtype
Rather than simply casting a tuple as a type, create a new struct SID.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 20:03:21 +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
fbcbc8dfa1 kernel: fix deadlock in threaded messages
Due to an ordering issue, it was possible for thread message responses
to become deadlocked, wherein a message would get stored in the shared
table in between checking the table value and locking the network
connection.

This change makes a second check of the table after the network
connection is locked, in order to prevent this condition.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 18:12:52 +08:00
Sean Cross
9af0fec049 kernel: convert multi-thread test (it's broken right now)
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:54:11 +08:00
Sean Cross
1512d2138e kernel: tests: remove excess prints
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:35:15 +08:00
Sean Cross
19222c34a9 kernel: get shutdown and multi-clients working
THis now has proper authentication for tests.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:28:14 +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
ab7a56937c create_process: rename from spawn_process
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-27 09:30:43 +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
cb576c19d5 xous: support taking server addr from environment
This allows for setting an environment variable -- `XOUS_SERVER` -- to
indicate which server to connect to.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 19:07:13 +08:00
Sean Cross
8242f1b53f kernel: make server IDs 128 bits
This makes server IDs a full 128 bits, and changes the argument to
CreateServer from 32-bits to 128-bits.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 17:28:18 +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
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