Sean Cross
714aff830c
kernel: implement JoinThread(tid)
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-21 16:32:38 +08:00
Sean Cross
e616a4bf4f
kernel: fix hosted build/warnings
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:52:03 +08:00
Sean Cross
09b8242bb2
kernel: get process termination "working" on risc-v
...
This successfully allows a process to call `terminate_process(val)`.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:42:31 +08:00
Sean Cross
eb7895d601
xous: add a return code to TerminateProcess
...
As part of this refactor, make `terminate_process()` a divergent call.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:01:00 +08:00
Sean Cross
30b82b25b1
kernel: run cargo fmt
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-19 14:12:01 +08:00
Sean Cross
1b85d8a4de
kernel: format syscalls as hex
...
This improves readability, particuarly when addresses are involved.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-10 14:37:33 +08:00
Sean Cross
23e759ffd8
kernel: fix multi-page lending
...
Due to several errors, multi-page lending did not work properly.
To begin with, if a page was not allocated then it would not be able to
be sent. That is, if you allocated 8192 bytes but only ever accessed the
first 4096 bytes, then an error would be encountered when lending the
unaccessed upper page.
Furthermore, due to a striding error in accessing pointers, half-pages
were treated as full pages.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-05 10:58:12 +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
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
85f0adbb2d
kernel: implement Disconnect() syscall
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-02 18:37:09 +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
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
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
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
cf1e2435bc
kernel: implement GetThreadID and GetProcessID
...
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-11 11:20:35 +08:00
Sean Cross
83da8c4e7d
syscall: remove commented-out pid code
...
This isn't used.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-03 21:20:21 +08:00
bunnie
0889e83401
Merge remote-tracking branch 'betrusted/hardware'
2021-03-02 21:51:41 +08:00
bunnie
96a19baa8d
state before refactor of status to own process
2021-03-02 19:25:41 +08:00
Lina Ceballos
d18500f4d6
adding license and copyright headers
2021-01-25 14:54:00 +01:00
Sean Cross
8d99ee06cf
kernel: fix extra-parens warning in syscall
...
Remove an extra set of parenthesis.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-13 21:09:14 +08:00
bunnie
4ef581a266
riddled with race conditions, but...sort of works
2021-01-08 05:20:53 +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
f49518f7d5
kernel: add connect_for_process()
...
This allows one process to establish a connection to a server on behalf
of another process.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 23:25:41 +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
85b6357d26
kernel: implement CreateServer
...
This implements CreateServer, which creates a server with a random name.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 20:58:14 +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
8927ef00a2
kernel: add TryReceiveMessage support
...
This is a nonblocking form of ReceiveMessage.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-25 20:26:21 +08:00
Sean Cross
e3cb05baf5
kernel: syscall: send WouldBlock to retry messages
...
This is handled by the client library to re-send the request.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 20:04:37 +08:00
Sean Cross
65c8c6eef5
kernel: implement and use klog!() macro
...
This replaces the majority of println!() and print!() calls, and works
on baremetal and hosted modes.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:24:28 +08:00
Sean Cross
eecd9c2367
kernel: syscall: return Ok for yield() on hosted
...
When running in Hosted mode, a yield shouldn't do anything.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:23:53 +08:00
Sean Cross
8a3f6a2b43
kernel: fix mutableborrow message returning
...
We weren't properly updating the packet when a mutableborrow was getting
returned.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 15:19:02 +08:00
Sean Cross
4e6a189e4e
kernel: fix returning scalars in interrupt context
...
This is now allowed.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:06:08 +08:00
Sean Cross
2698333382
kernel: allow making syscalls from an interrupt
...
This enables calling some syscalls from within an interrupt context.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 17:59:26 +08:00
Sean Cross
7ab2338ff3
kernel: add in_irq parameter to syscall::handle()
...
This parameter will determine whether a syscall is being handled from
within an interrupt context. This is because certain calls cannot be
called from such a context.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:27:39 +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
49d3ce8a6f
kernel: syscall: unify print!() messages
...
Use `print!()` instead of `println!()` in order to make error messages
easier to read in the debug console.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:19:28 +08:00
Sean Cross
b3d918358e
kernel: syscall: don't error on unaligned memory when Hosted
...
When running in a Hosted environment, unaligned memory is not an error,
so don't return `BadAlignment`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:18:50 +08:00
Sean Cross
fa9a3e0954
kernel: rework hosted network protocol
...
This fixes issues regarding passing memory between processes.
We now properly catch `ReturnMemory` and give the memory back.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-29 19:46:17 +08:00
bunnie
9a8c402cc2
add hosted mode bits back in
2020-10-14 23:04:54 +08:00
bunnie
6ff8c8518c
Merge branch 'master' of github.com:betrusted-io/xous-core
2020-10-14 23:02:14 +08:00
bunnie
ac4d79ea68
logging server bringup
2020-10-14 23:01:57 +08:00
Sean Cross
80a003c839
kernel: syscall: implement connect()
...
This implements the `connect()` syscall as a blocking version of
`try_connect()`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 19:18:16 +08:00
bunnie
5cf8e9e3bc
Merge remote-tracking branch 'origin/master' into ticktimer
2020-10-14 15:30:47 +08:00
Sean Cross
54a8de2776
kernel: fix return_scalar and return_scalar2
...
These didn't correctly set the thread status in the server when
returning a value. Instead of marking a server as runnable, it remained
in an idle state.
This correctly sets the thread status in the server, and resumes the
client.
This has been tested in Renode as well as using `cargo test`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 11:16:21 +08:00
Sean Cross
ecd2d00f47
kernel: fix return_scalar2
...
This call did not work, because it wasn't properly returning control to
the parent process.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:54:23 +08:00
Sean Cross
e5100bcb33
kernel: syscall: implement SendMessage
...
SendMessage is a blocking version of TrySendMessage, except this call
will block if the server queue is full.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:14:43 +08:00
Sean Cross
0c344efb60
kernel: syscall: move do_yield() to its own function
...
This will allow us to call `Yield` for other operations that need to be
blocking.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 10:14:43 +08:00
bunnie
4d21f2d868
intermediate progress on debugging return messages
2020-10-14 01:28:10 +08:00
bunnie
154384e3bb
output hex for kernel debug
...
makes it much easier to read memory allocation requests
2020-10-13 16:15:15 +08:00