Commit graph

771 commits

Author SHA1 Message Date
bunnie
8b7912fb34 add some targeted debug; handle advisories before swapper registered
for now, we just count how mayn pages we missed an advisory on,
those all effectively are "wired". If we're fast enough on registering,
it turns out we actually miss nothing.
2024-03-23 11:59:31 +08:00
bunnie
233bb63878 add debug-swap targeted debug config 2024-03-23 11:59:31 +08:00
bunnie
803ce1a847 move allocadvice to new home 2024-03-23 11:59:31 +08:00
bunnie
af856124a0 pass kernel dependency to xous-rs 2024-03-23 11:59:31 +08:00
bunnie
025e39913b implement retrieval from swap and allocation advisories 2024-03-23 11:59:31 +08:00
bunnie
4eefbd88bc cleanup warning that crept into the code 2024-03-23 11:59:31 +08:00
bunnie
168e3454f6 handle free advisories 2024-03-23 11:59:31 +08:00
bunnie
28b415cb27 handle swapped pages and allocation advisories 2024-03-23 11:59:31 +08:00
bunnie
14364e09c6 ensure compliance with unsafe conditions on exit_blocking_call() 2024-03-23 11:59:31 +08:00
bunnie
167cd04f06 remove arg page list, replace with set of 8 usize
this makes calls more efficient and avoids the double-shared page
2024-03-23 11:59:31 +08:00
bunnie
d6cfb13e4f upgrade irq path to handle the new API 2024-03-23 11:59:31 +08:00
bunnie
5234127b7b support multiple irq-like contexts with an enum 2024-03-23 11:59:31 +08:00
bunnie
70639214e1 specify the swap return address for swaps 2024-03-23 11:59:31 +08:00
bunnie
500a641848 specify the irq return address for irqs 2024-03-23 11:59:31 +08:00
bunnie
474e8f0822 make return address of callback configurable 2024-03-23 11:59:31 +08:00
bunnie
f2e44d364a implement blocking callback
a roughed-out nonblocking callback version also staged
2024-03-23 11:59:31 +08:00
bunnie
9008452a36 add arguments to register syscall for handler and state 2024-03-23 11:59:31 +08:00
bunnie
6806403da8 make the release page mechanism visible externally for swap config 2024-03-23 11:59:31 +08:00
bunnie
47a16b6ce4 add RETURN_FROM_ISR magic address
this is picked to not conflict with other addresses used by
the ARM implementation. I think it should be OK?
2024-03-23 11:59:31 +08:00
bunnie
26047bf956 add the routine to evict a page 2024-03-23 11:59:31 +08:00
bunnie
6f18a0ed21 add trampoline to return from swapper 2024-03-23 11:59:31 +08:00
bunnie
daf4d9a93e make valid bit mapping symbolic instead of hard coded constant 2024-03-23 11:59:31 +08:00
bunnie
bc91055307 add template for EvictPage
actual function is still a todo
2024-03-23 11:59:31 +08:00
bunnie
b0665c3412 implement RegisterSwapper syscall 2024-03-23 11:59:31 +08:00
bunnie
9fb1acb705 swap module, with some initial functionality for registration 2024-03-23 11:59:31 +08:00
bunnie
4f15af3fee add swap module to the kernel, and initialize it from args 2024-03-23 11:59:31 +08:00
bunnie
a1cffed9cd un-use the P bit in the page table
prep for re-allocating it to swap
2024-03-23 11:59:31 +08:00
Sean Cross
b4d6884cc4 kernel: use addr_of!() and addr_of_mut!()
DUe to https://github.com/rust-lang/rust/issues/114447 direct access to
static mut variables causes a warning which will be turned into an
error in the 2024 edition.

The workaround is to use `addr_of!()` and `addr_of_mut!()` macros and
then dereference that.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-03-22 15:53:11 +08:00
bunnie
717abf4af8 work around dependency conflict on atsma5d27
the dependency is pinned to an old version of utralib that
causes a build conflict...
2024-02-08 00:33:14 +08:00
bunnie
699004e7b0 bump xous pins 2024-02-06 14:49:10 +08:00
Sean Cross
bf61ce5071 kernel: remove dead code
This code is commented-out and dead. It gets adjusted with `cargo fmt`,
so just remove it.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-02-06 10:33:33 +08:00
Sean Cross
ed4ec01017 kernel: support riscv32imac-unknown-none-elf
With Rust 1.76.0, we no longer support building with `#![no_std]` or
`panic = "abort"`, both of which are required within the kernel. As a
workaround, go back to building the kernel under
`riscv32imac-unknown-none-elf`.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-02-06 10:28:33 +08:00
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