Commit graph

739 commits

Author SHA1 Message Date
bunnie
64f8285239 cleanup warning 2024-01-29 03:49:33 +08:00
bunnie
1e93171575 turn of rkyv derives in kernel and loader, as these are no-std 2024-01-23 03:59:49 +08:00
bunnie
5df2e27447 add production TRNG to cramium target for kernel 2024-01-20 16:16:07 +08:00
bunnie
a79b134d14 add placeholder for v2p/PID mapping
We need the V2P feature, but don't need the ability to swap
PID spaces yet. Leave the alternate API as a todo!() item
in the kernel for riscv targets.
2024-01-19 23:23:28 +08:00
bunnie
0267a56989 format Cargo.tomls
because apparently cargo fmt doesn't format Cargo.toml files???
2024-01-15 00:14:39 +08:00
bunnie
607db9c573 remove trailing space in kernel 2024-01-14 23:40:30 +08:00
bunnie
f9fc3d0d4b ok, format the kernel now that all in-line assembly has been checked 2024-01-14 19:27:14 +08:00
bunnie
710c45969f Revert "format the kernel"
This reverts commit 1f69e6aa39.

this has in-line assembly, let's fix that before we format
2024-01-14 19:24:33 +08:00
bunnie
1f69e6aa39 format the kernel 2024-01-14 19:11:19 +08:00
bunnie
0750644e45
Merge pull request #479 from betrusted-io/process-arguments
Support process arguments
2024-01-07 23:39:45 +08:00
Sean Cross
60f2a17649 kernel: support receiving process arguments
Support passing process arguments in register 2 as part of arguments to
a process.

This requires updating the `InitialProcess` struct that is received from
the loader, and so requires modeifications to be made in tandem.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-07 23:02:58 +08:00
bunnie
d44ab2f2aa add the .a artifacts to the tree for the asm.S
these are just sync'd to the asm.S and checked in.

Eventually, we should migrate that .S file into using
in-line assembly macros, but now that I look at it, I remember
why it hasn't been done yet -- there are some fancy conditionals
used to enable compatibility with different architectures that
I don't know off the top of my head how to translate into
in-line assembly syntax.
2024-01-06 16:41:40 +08:00
bunnie
c3f3ef91b2 fix #474
dbf28fbd61 from 9 months ago
actually broke the resume path, but we didn't see it until now
because the .a files are checked into the tree.
2024-01-06 16:41:31 +08:00
bunnie
8ec08c9c76 fix rust v1.75.0 warnings that are probably benign
a lot of re-import warnings have cropped up. While I appreciate
their studiousness on this, the problem is that removing some
of these exports in the API crate could mean that future users
who want access to some API features that aren't used in this
configuration are now unaccessible.

I think it's not a huge problem at the moment, just spam-cleaning
the warnings because there are too many to deal with carefully
at the moment.
2024-01-04 19:15:28 +08:00
bunnie
c9407a2d47 harmonize hosted mode to latest kernel API for get_pid() 2024-01-04 18:30:48 +08:00
Sean Cross
6b5b4a5d21 kernel: services: don't crash when a process quits
When enumerating processes, the `find_process()` process didn't consult
whether a process was actually free. This resulted in a crash,
particularly when attaching a debugger to a crashed process.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:42:16 +08:00
Sean Cross
b95d442e20 kernel: debug: add "check memory" command
This command ensures memory is all owned by the correct process and is
unique in its ownership.

It takes a long time to run, so ensure the watchdog timer is disabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:42:16 +08:00
Sean Cross
e44d009b84 kernel: mem: add function for verifying mappings
Add a function to ensure mappings are unique across the whole system.
This takes a very long time and can crash if the watchdog timer isn't
paused.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:42:16 +08:00
Sean Cross
d5816b667a kernel: riscv: remove unsafe code from process
Remove transmutes from process.rs and replace them with ordinary casts.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:24:31 +08:00
Sean Cross
d4893c1c83 kernel: riscv: add phys_to_virt function
The phys_to_virt function can be used to determine what physical address
page is mapped to a virtual address page.

This throws an error when a page is mapped twice, which shouldn't
happen.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:23:19 +08:00
Sean Cross
124040bbb3 kernel: asm: align kernel stack to 16 bytes
The kernel stack offset should be aligned to 16 bytes. Previously it was
aligned to 8 bytes. It's unclear if this was the cause of any issues,
but it is best practice to keep things aligned to 16 bytes.

As part of this, key the atomic instructions off of the CPP macro
presence of atomic instructions.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-29 18:15:48 +08:00
bunnie
488d976f23 move original copy to new location, trying to preserve commit history 2023-12-27 15:04:27 +08:00
bunnie
336da86915 remove duplicate asm.S 2023-12-27 15:03:58 +08:00
bunnie
c2c56f9d3f fix typo in kernel feature specifier 2023-12-26 00:20:56 +08:00
bunnie
fda782663a bump version pins for xous change 2023-12-26 00:13:10 +08:00
Sean Cross
3658940260 kernel: add big-heap flag for running tests
When running Rust tests, a larger heap is needed. Add a kernel flag to
support this by default.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:35:37 +08:00
Sean Cross
006a50d206 kernel: mem: fix memory zeroing
Fix memory zeroing when requesting a physical pointer. Previously, only
the first 25% of a page was zeroed due to a bug when casting between
*mut u8 and *mut usize.

This now uses `write_volatile` to ensure the memory clear isn't
optimized out, and uses `usize` pointers everywhere.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:30:26 +08:00
Sean Cross
f2e9d2b76c kernel: riscv: threads: ensure registers are zeroed
The register set should be cleared already, however it is possible
(though remote) that register values are not cleared when a thread is
created.

Ordinarily threads are zeroed when destroyed, but this makes sure
they're zeroed upon creation as well.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:29:20 +08:00
Sean Cross
d798962151 kernel: format some files
Format some files prior to patching them.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-25 23:28:52 +08:00
Sean Cross
a19b1b4f51 kernel: use wfi() on Renode
While it would be nice if we stopped the PLLs as we do on hardware,
Renode does not yet have the ability to issue the `wfi` instruction from
a peripheral write.

As such, directly call `wfi()` on Renode similar to how Cramium
operates.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-24 15:20:11 +08:00
Sean Cross
0673ad912c kernel: gdb: don't panic when accessing kernel memory
Instead, just return 0x00000000.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-22 23:24:39 +08:00
bunnie
fa3f349a0a bump pins as xous-rs has changed 2023-12-01 21:20:01 +08:00
bunnie
6ab88117f6 bump xous-api-log version & fix version pins 2023-10-31 20:07:28 +08:00
Vihaan Jim
0a7a4fcfc1 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-10-14 14:45:50 -04:00
bunnie
d63b5912b1 absorb new xous-rs version 2023-10-10 16:50:00 +08:00
Vihaan Jim
e7445e1b62 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-10-05 17:17:26 -04:00
bunnie
83256257e1 bump xous-rs crate to absorb Send derives on Messages
this is necessary for the smoltcp port
2023-10-03 20:54:14 +08:00
Vihaan Jim
5dda363157 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-09-30 18:07:58 -04:00
bunnie
661b832d7e Merge branch 'cram-udma-uart' into main 2023-09-15 16:34:56 +08:00
bunnie
82c7b6ebed bring the versions up to date with main for a cleaner merge 2023-09-15 16:32:04 +08:00
bunnie
5116d51de5 move kernel UART to DUART port
using the DUART means we don't get console input on the kernel
(because the DUART is incapable of this) but it's a decent compromise
I think because the DUART is fast and efficient, and mostly we want
it to capture kps?

Eventually we'll need an input mode but for now, this will get us
moving.
2023-09-15 15:21:18 +08:00
bunnie
478a612c02 commit version bump 2023-09-12 16:25:10 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
Vihaan Jim
41126ec57b Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-08-29 11:29:39 -04:00
bunnie
53469a68d0 publish package updates, sync to release tag 2023-08-08 14:35:49 +08:00
bunnie
b127cd093f bump version pins for change to xous-rs 2023-08-03 13:29:39 +08:00
Vihaan Jim
218e783053 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-07-26 15:13:59 -04:00
bunnie
51278451a0 update version pins to pull in cramium target 2023-07-19 21:07:56 +08:00
bunnie
ca14ed78d2 fix renode build 2023-07-18 13:58:14 +08:00
bunnie
3c13516d57 kernel integrations for cramium 2023-07-17 18:49:21 +08:00