Commit graph

136 commits

Author SHA1 Message Date
bunnie
cce89395f6 test framework for xous-names 2021-01-04 23:34:18 +08:00
Sean Cross
f6c3d955ea xous: add ipc module
This module is a stopgap to allow for transferring structs and enums
between modules.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-03 18:57:46 +08:00
Sean Cross
7b50d00eb8 repo: run cargo fmt
This reformats line endings to be consistent, and reinforces the
contents of `.gitattributes`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-03 18:31:51 +08:00
Sean Cross
1875126dba xous: connect_for_process: add wrapper function
This provides a functional call around the raw syscall.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 22:50:49 +08:00
Sean Cross
06daa06921 xous: add syscall definition for ConnectForProcess
This call allows one process to establish a connection on behalf of
another process.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 22:47:01 +08:00
Sean Cross
b094f1147b xous: implement sender.pid()
This is mostly an implementation detail, but appears to work.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 22:38:35 +08:00
Sean Cross
1fa83d1d94 xous: make MessageSender a struct
This is now an object instead of an alias for `usize`, in preparation
for adding a `.pid()` function.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 22:16:24 +08:00
Sean Cross
f165130931 xous: add CreateServer syscall
This syscall has not yet been wired up.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 20:44:45 +08:00
Sean Cross
25e4d16de3 xous-os: rename CreateServer to CreateServerWithAddress
Servers will, by default, get randomly-assigned SIDs. Certain servers
will want to have well-known SIDs, such as the log server or the
nameserver. These will use a separate call in order to perform this
priveledged operation.

A subsequent patch will add `CreateServer`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 20:33:33 +08:00
Sean Cross
322051e8c1 xous-rs: log panics to log-server
When a process panics, log the contents of the panic to the log server.

This removes the dependency on a `println!()` implementation needing to
be defined in a project.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-27 13:55:36 +08:00
Sean Cross
6604bfcdb0 xous-rs: add TryReceiveMessage
This non-blocking function call will retrieve a message if one exists,
or will immediately return None if the queue is empty.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-25 20:20:59 +08:00
Sean Cross
b3b57f5eb5 xous: temporarily remove debug-here
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-24 22:04:26 +08:00
Sean Cross
222bde8db7 xous: remove extra prints from network
This was useful when tracking down network issues.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 20:05:10 +08:00
Sean Cross
693800ac9d xous: hosted: retry when we get WouldBlock
When this is returned, we need to stop and retry the whole packet rather
than merely waiting as we do when we receive a Blocking message.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 20:03:00 +08:00
Sean Cross
b24719a0fc xous: fix blocking return values
These values weren't being properly returned when Yielding or when
calling operations that would block, or that actually blocked.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:20:20 +08:00
Sean Cross
5f52acfa9b xous: document WouldBlock and BlockedProcess
These results have similar names but are very different in terms of what
they do.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:19:37 +08:00
Sean Cross
98fb7f739d xous: hosted: remove excess debug from network packets
These packets were always printed, which is excessive.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 16:15:19 +08:00
Sean Cross
4f0d53e9a6 xous: fix hosted process response
This uses a slightly different approach to looking at a process
response.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 17:33:08 +08:00
Sean Cross
b497ad113e xous: terminate process on panic
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 12:52:12 +08:00
Sean Cross
6b1dc7f853 xous: hosted: fix sync error with mis-ordered replies
Replies would get mis-ordered, which became bad when data had memory
attached.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 12:51:41 +08:00
Sean Cross
08fb5e0a0b xous: add send() to String
This call can be used to send a string to a Server.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:28:47 +08:00
Sean Cross
bb304d412a xous: add can_call_from_interrupt() to SysCall
This function can be used to determine if a particular syscall may be
called from an interrupt context.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:26:33 +08:00
Sean Cross
719549a2cb xous: rename ReturnToParentI -> ReturnToParent
This syscall isn't the only one that can be called from an interrupt
context.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:26:19 +08:00
Sean Cross
4650e865fb xous: String: add from_message() as an initializer
Allow creating a `String` from a `MemoryMessage`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:51:29 +08:00
Sean Cross
f149c086ef xous: add String
This is a basic String that can be passed as a Message.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 11:18:48 +08:00
Sean Cross
39c9ef30b7 xous: definitions: add memory() call to Result
This is used to get attached Memory from a Result, if any.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:13:09 +08:00
Sean Cross
8115c2e7cf xous: hosted: remove print!() monitoring network traffic
This was useful when tracking down network traffic issues. It is no
longer useful.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:12:32 +08:00
Sean Cross
a35a75b1f2 xous: carton: use send_message()
This function now works as expected.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:11:35 +08:00
Sean Cross
7aab01c95d xous: fix memory messages in hosted environment
This fixes passing memory between clients and servers when running
n a hosted environment.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-29 19:40:41 +08:00
Sean Cross
67adccf16a xous: hosted: attach to debugger on panic
When a `panic!()` is hit and we're running in a hosted environment,
attach a debugger using `debug-here`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-29 19:38:27 +08:00
Sean Cross
4ca97125ad xous: hosted: retry when WouldBlock is received
Retry a message when we receive a WouldBlock response.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 19:26:33 +08:00
Sean Cross
2b66378556 xous: definitions: add WouldBlock
This opcode indicates a command would block and should be retried.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 19:26:13 +08:00
bunnie
5cf8e9e3bc Merge remote-tracking branch 'origin/master' into ticktimer 2020-10-14 15:30:47 +08:00
Sean Cross
ac321be7e9 xous: implement send_message()
This fixes `send_message()` so it works as expected.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 11:18:02 +08:00
bunnie
4d21f2d868 intermediate progress on debugging return messages 2020-10-14 01:28:10 +08:00
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
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
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