Commit graph

791 commits

Author SHA1 Message Date
bunnie
cc75520bc2 fix missing commands in non-swap path 2024-04-01 18:11:35 +08:00
bunnie
d9a27ea3d7 remove unnecessary print 2024-04-01 18:11:22 +08:00
bunnie
7d38d1761e add missing config flags 2024-04-01 15:58:16 +08:00
bunnie
b3f695dbc2 fix missing config flag 2024-04-01 15:57:50 +08:00
bunnie
d6b33159a5 stage version pin bump 2024-04-01 15:46:26 +08:00
bunnie
95a10e93ca cleanup warning when swap is not used / hosted mode 2024-04-01 15:38:51 +08:00
bunnie
a37b2c06e1
Merge pull request #512 from betrusted-io/swap
WIP: Encrypted Swap
2024-04-01 00:23:43 -07:00
bunnie
376eff8790 cleanup warning that has crept up in hosted mode 2024-04-01 14:28:02 +08:00
bunnie
ec439a38d4 handle both cases in the irq return handler
differentiate between the case that we got here via
a page fault, or a syscall, and handle appropriately
2024-04-01 14:08:15 +08:00
bunnie
2f23225b9d update API for advise alloc 2024-04-01 14:07:43 +08:00
bunnie
fa23a6f829 remove swap-specific patches now that we're patched at the syscall entry point 2024-04-01 14:07:14 +08:00
bunnie
5645a645e5 add handler for the syscall return case and unmap loop
There's two ways we can enter the swapper:

1. via an interrupt due to a page fault
2. via a syscall that generated a memory event (e.g. unmap)

This patch handles case (2) better and clarifies variable names
around that to make the code read better.

It also has logic to handle divergent looping through a large
unmap request.
2024-04-01 14:05:26 +08:00
bunnie
46525eff04 add separate handling for unmap syscall
The unmap syscall is a little bit tricky, because it can de-allocate
several pages at once, which can trigger an advisory de-allocate
message to the swapper in the middle of the loop. The entire structure
has to be re-written to handle this case, so we patch this right at
the top level syscall point and handle it entirely with custom
logic in the swapper.
2024-04-01 14:03:43 +08:00
bunnie
30bdecc2a0 fix return type of register swap syscall 2024-03-31 17:48:32 +08:00
bunnie
0e756003a1 debugging around the swapper protected context calls 2024-03-31 17:25:47 +08:00
bunnie
504253a033 more tid recording 2024-03-31 17:25:05 +08:00
bunnie
03388b1413 add tid reporting 2024-03-31 17:23:54 +08:00
bunnie
ecbce84385 add some debug & add state visibility
@xobs made the `state` element of a process publicly read-only visible
through a function call. I don't think this is a security issue but
please lmk if that's a problem.
2024-03-31 17:21:54 +08:00
bunnie
1af43fba7b track current tid in swap manager 2024-03-31 17:20:50 +08:00
bunnie
cc49867403 fix warnings from rust 1.77.0 upgrade 2024-03-29 09:45:49 +08:00
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