bunnie
5cdf597a5b
fixup tests
2021-02-18 02:35:11 +08:00
bunnie
cb77dde6d8
Merge pull request #39 from betrusted-io/hardware
...
Synchronize in the rkyv changes
2021-02-18 02:07:13 +08:00
bunnie
0af72ffb6d
clean up Sendable references and warnings
2021-02-17 23:29:20 +08:00
Sean Cross
6119c78bc7
kernel: riscv: really fix sharing logic
...
We're comparing numbers and not MMUFlags, so invalid values crept in.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-17 17:35:13 +08:00
Sean Cross
b6a28a85fc
kernel: riscv: invert shared logic
...
This logic was backwards.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-17 17:28:49 +08:00
Sean Cross
e9a1da25b0
kernel: riscv: mark address_available() as false when shared
...
When a page is shared, only report an address as being available when
we receive a `BadAddress` error when doing the translation. Otherwise,
assume it is in use.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-17 17:23:05 +08:00
Sean Cross
3b85392877
kernel: riscv: return ShareViolation when memory is shared
...
When memory has been shared, it is no longer valid. However, it is still
"in use".
Return a `ShareViolation` error in this case so we can check for it
elsewhere.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-17 17:23:05 +08:00
Sean Cross
fbad2e4391
kernel: riscv: don't allow multi-sharing of lends
...
Initially, we wanted to be able to immutably lend data in a one-to-many
fashion. However, this has proven challenging, and doesn't have any
immediately obvious useful benefits.
For now, only allow one-to-one immutable lends.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-16 20:26:27 +08:00
Sean Cross
b9a4e11a64
kernel: riscv: use bit flags for irq handler
...
Instead of hardcoding bit values, use the symbolic names. This will
ensure we don't make mistakes by using magic numbers.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-16 20:25:42 +08:00
bunnie
b803d7d4e9
commit that captures the multiple lend bug
2021-02-16 12:42:11 +08:00
bunnie
2a46f541f2
add PID identification facility to help with debugging
2021-02-15 19:15:58 +08:00
Sean Cross
715e76bee0
kernel: allow connection IDs to be u32
...
In an effort to homogonize platforms, we are moving away from `usize` in
favour of `u32`. Allow the `CID` type to be a `u32` in the kernel by
casting it to a `usize` as necessary.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-04 10:29:12 +08:00
Lina Ceballos
d18500f4d6
adding license and copyright headers
2021-01-25 14:54:00 +01:00
Sean Cross
6cf140f2da
kernel: riscv: don't print valid page faults
...
Some page faults are valid, and shouldn't be printed unless they fail.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-13 21:09:40 +08: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
Sean Cross
e87eb112ae
kernel: debug: fix const warnings
...
This makes debug a const, which prevents it from getting copied all over
the place.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-13 21:09:05 +08:00
bunnie
4ef581a266
riddled with race conditions, but...sort of works
2021-01-08 05:20:53 +08:00
Sean Cross
b16ad82e56
kernel: riscv: print out allocated address
...
This will aid in debugging.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-07 18:50:48 +08:00
Sean Cross
6cbec94953
kernel: riscv: use page base addr when allocating pages
...
When allocating a page, it is only assigned a physical address once it
is actually needed. This on-demand paging works well, however we were
assuming that the first address of a page was accessed first.
This fixes an issue where a Message is allocated but the first byte
isn't accessed first.
Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-07 13:34:42 +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
a36ceb00c2
kernel: use crossbeam for tests
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-30 16:51:21 +08:00
bunnie
ed5624635b
Merge branch 'master' of https://github.com/betrusted-io/xous-core into hardware
2020-12-14 17:58:39 +08:00
bunnie
c9a18125df
add hardware TRNG support to kernel (issue #16 )
2020-12-14 17:57:29 +08:00
Sean Cross
ddd57c30bd
kernel: fix compile error when debug-print enabled
...
This tracks a variable that has been renamed, and was preventing the
kernel from compiling when debug printing is enabled.
This fixes #19 .
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-14 17:02:58 +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
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
1f1a535801
kernel: fix pid generation for non-test case
...
When compiling under non-test scenarios, the `rand` create conflicts
with the new `rand` module.
Disambiguate this field.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 21:12:18 +08:00
Sean Cross
168ffe004e
kernel: use create_server() for some tests
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-04 20:59:21 +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
f2e2505d4b
kernel: server: remove bounds checks from take_waiting_message
...
This function has been rewritten to no longer have a bounds check.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-01 13:27:30 +08:00
Sean Cross
e4f7c7286d
kernel: fix commented code in server
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-01 13:20:34 +08:00
Sean Cross
d5f82b7972
kernel: test: fix message ordering test
...
It turns out that it was working fine, the test was just broken.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-01 13:18:49 +08:00
Sean Cross
e7744b25ec
kernel: services: format document
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-01 11:54:23 +08:00
Sean Cross
8c994e0397
kernel: add test for message ordering
...
Messages are arriving out-of-order, which is considered a bug.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-12-01 10:29:46 +08:00
Sean Cross
f0db281c7d
kernel: add test for try_receive_message()
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-25 20:52:13 +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
bunnie
db25b05a14
Merge branch 'master' of github.com:betrusted-io/xous-core
2020-11-24 22:46:24 +08:00
bunnie
772bceeb2d
fix interrupt pending clear issue in debug module
...
during conversion to documented interrupts from Litex a case was
missed.
2020-11-24 22:46:10 +08:00
Sean Cross
f3a2c31067
kernel: add test for out-of-order blockingscalars
...
This already works, we just want to make sure it works.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-24 15:35:54 +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
bunnie
1aa01fdf5d
confirm sleep works, some minor fixup to UTRA style usage
2020-11-23 19:02:02 +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
dfa20cc1b1
kernel: test: rename send_repeat_mutableborrow_message
...
This function would previously clash with the other name.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:22:59 +08:00
Sean Cross
657604a199
kernel: test: use as_ptr() for memory messages
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:22:37 +08:00
Sean Cross
1291a2b3aa
kernel: hosted: fix unused variable warnings
...
These only appear when not printing messages.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-23 17:21:57 +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
be1687ffdd
Merge branch 'master' of github.com:betrusted-io/xous-core
2020-11-23 14:20:27 +08:00
bunnie
710abce418
fixup to latest soc.svd register documentation standard
2020-11-22 03:45:44 +08:00
Sean Cross
5186594f17
kernel: remove excess debug output from hosted mode
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:22:29 +08:00
Sean Cross
b8d9d1e1b3
Revert "kernel: hosted: don't send responses twice"
...
This causes problems, and fixes an issue that doesn't actually exist.
Revert it.
This reverts commit fc9f597092 .
2020-11-11 16:18:39 +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
4b83edc43b
kernel: server: replace ctx with tid
...
Threads haven't been called contexts for a very long time.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:04:35 +08:00
Sean Cross
7156ab5e79
kernel: mem: match riscv printf with rest of formatting
...
We don't use `println` anymore, we use `print`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:03:52 +08:00
Sean Cross
aee42bf264
kernel: print message when idling
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 16:03:29 +08:00
Sean Cross
fc9f597092
kernel: hosted: don't send responses twice
...
If we've already sent a response, don't send a second response.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-11 12:55:58 +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
c6e12a5ecd
kernel: remove dead code from hosted/irq.rs
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-11-01 16:29:36 +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
d76832dada
kernel: services: return ServerNotFound when server isn't found
...
This is more intuitive than `OutOfMemory`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:43:59 +08:00
Sean Cross
2244a78f16
kernel: allow syscall processing when printing is disabled
...
Due to a missing comment, syscalls wouldn't work at all when printing
was disabled. Fix this.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:43:22 +08:00
Sean Cross
6e312ffc8a
kernel: process: only print process inits when printing is enabled
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:42:57 +08:00
Sean Cross
e5003eee6d
kernel: only print RISC-V exceptions when printing is enabled
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 20:42:25 +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
95ab9d3c02
kernel: server: unify print messages
...
Don't use `println!()`, and instead prefer to use `print!()` when in the
kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:17:27 +08:00
Sean Cross
20a65b88f2
kernel: server: don't Forget Borrow and MutableBorrow messages
...
These should be returned to the client process after the message is
done, not forgotten straightaway.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:16:52 +08:00
Sean Cross
cb2d810b38
kernel: irq: prefix pagefault message with KERNEL(pid)
...
This unifies this message with other kernel messages.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:16:14 +08:00
Sean Cross
04a3493550
kernel: hosted: print status adding memory to return val
...
When returning memory to a thread, attach memory if present.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:15:32 +08:00
Sean Cross
74b3fde198
kernel: add memory from Results to network packets
...
If a Result contains attached memory, add that memory on to the network
packet that gets sent by the kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:14:43 +08:00
Sean Cross
702676031e
kernel: hosted: run rustfmt
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:14:33 +08:00
Sean Cross
5f6b42d534
kernel: hosted: print pid of a process that exited
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-30 10:14:02 +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
797d622cc7
kernel: use connect() for some kernel tests
...
Now that `connect()` works, use that for some tests rather than
exclusively using `try_connect()`.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-14 19:19:01 +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
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
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
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
bunnie
62b625ec60
convert kernel debug to utra
2020-10-14 03:04:33 +08:00
bunnie
67c49ddbce
clean up a warning
2020-10-14 03:04:25 +08:00
bunnie
4d21f2d868
intermediate progress on debugging return messages
2020-10-14 01:28:10 +08:00
Sean Cross
84b39c931a
kernel: services: switch address space prior to passing messages
...
Switch address spaces to pass messages to the new process, and switch
backafterwards.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-13 22:56:04 +08:00
Sean Cross
39c7dced01
kernel: services: switch address space prior to passing messages
...
Switch address spaces to pass messages to the new process, and switch
backafterwards.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-13 22:54:43 +08:00
Sean Cross
53f1b3c416
kernel: main: make utralib incusion conditional
...
Only include utralib when running on baremetal.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-13 22:54:12 +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
bunnie
cab4c7d4a9
fix more UTRA issues; migrate to dual-UART for kernel/console messages
2020-10-13 05:22:19 +08:00
bunnie
9a50de8b4e
refactor: utra -> utralib naming
...
this cleans up some namespace issues when including
the utra crate which also refers to utra::generated::utra,
and there are CONST at the crate-level, and also functions
at the module-level which need disambiguation. By naming
the crate utra-lib this saves a bit of syntatic wrangling
at the top of every file.
2020-10-12 03:56:10 +08:00
Sean Cross
d0d687a239
utra: fix build on non-hardware release
...
This adds svd2utra, which enables building for non-embedded harware.
It also fixes some build issues, and paves the way for generating UTRA
at compile-time.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-05 10:13:51 +08:00
Sean Cross
d4f0496371
kernel: remove unused debug data
...
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 19:08:29 +08:00
Sean Cross
8759f552f7
kernel: syscall: allow returning to the kernel
...
If nothing is running, don't crash when the timer hits.
Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-04 18:28:58 +08:00