Commit graph

805 commits

Author SHA1 Message Date
bunnie
77cfc34f59 make panic outputs in hex
everything else is in hex, why should these be in decimal...
2024-05-06 18:47:11 +08:00
bunnie
f635917658 fix typo 2024-05-06 02:06:15 +08:00
bunnie
4db82e01d8 retrieve tid as well as pid when invoking swapper 2024-05-04 02:01:56 +08:00
bunnie
feefb57791 cleanup some debug output 2024-05-04 02:01:38 +08:00
bunnie
09b2b29074 remember tid for swap-read; do PID dance for resume abstraction
We want to use the finish_callback_and_resume() function because
it's well-tested and sets up everything just right, but it expects
that we're coming from another process. Unfortunately, in the
middle of all of this, we need to map a page back into the
destination process' memory space, so we end up starting from
the swapper's memory space, changing into the destination process'
memory space, then mapping the page, then changing back into
the swapper's memory space, then using the finish_callback_and_resume()
call.

I think the impact might not be *that* bad, mainly it's a TLB
miss and the PTW isn't super bad, and this comes after a disastrously
expensive decrypt-from-RAM operation -- so probably not worth it
to angonize over optimizing this bit at this point, and stick
with well-tested primitives.
2024-05-04 01:54:23 +08:00
bunnie
dc0244ca35 cleanup init stuff now that args are mapped into memory 2024-05-02 22:08:48 +08:00
bunnie
61128cb25f remove swap init call, as it is no longer needed 2024-05-02 22:08:08 +08:00
bunnie
39a427e1b0 improve debug output 2024-05-01 14:27:31 +08:00
bunnie
5f425ebc56 expand flags scope and fix swap test 2024-05-01 14:27:06 +08:00
bunnie
88a9854e54 add swap flags to debug output 2024-04-30 18:35:54 +08:00
bunnie
863f17652d broaded scope of conditional compilation 2024-04-28 02:57:04 +08:00
bunnie
ecf2396d0c put debug prints behind debug flags 2024-04-28 02:41:29 +08:00
bunnie
73c834d067 start debugging of swap in kernel
switching contexts to bringing up hardware.
2024-04-22 10:58:37 +08:00
bunnie
a732eed679 make kernel aware of the IniS type
this should now introduce a crash in the kernel when an IniS
process is in the image set; previously we didn't try to
schedule and run them.
2024-04-06 07:47:18 -07:00
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