Commit graph

10340 commits

Author SHA1 Message Date
bunnie
1f12a97b64 cleanup debug 2024-05-08 07:22:43 +08:00
bunnie
1112ef5df6 remove unused function (forgot this arg was already available) 2024-05-08 07:22:21 +08:00
bunnie
a58a8dc438 cleanup some debug 2024-05-08 07:21:06 +08:00
bunnie
ee0b1a042c optimize kernel-side alloc advisories; cleanup some APIs 2024-05-08 07:20:33 +08:00
bunnie
a031eeba4e add the skeleton of LRU tracking data
1. add a method to aggregate and export advisories into userspace
2. add an LRU cache to absorb the advisories

LRU cache still needs init'ing

aggregation method for advisories could be mirrored into the
kernel (sans heapless dependency) for even better efficiency...
2024-05-08 02:06:27 +08:00
bunnie
4f471544bd add nesting depth = 2 for swapper ops
I think that structurally we might never exceed a nesting depth
of 2, but there are some specific cases where an alloc can call
an alloc in the kernel (e.g., having to create a new superpage
in the midst of a routine alloc), therefore, we have to handle
some nesting.

There's also chance that maybe nesting could be due to race
conditions or self-circular behavior in the swapper, but ideally
we avoid that entirely because we can't handle non-structural,
unbounded nesting of re-entry to the swapper routine.
2024-05-08 00:57:10 +08:00
bunnie
80f783416e remove the EC from the swap test config
this saves a little bit of startup time and CPU cycles
2024-05-07 23:41:33 +08:00
bunnie
8901e4ace8 Merge branch 'swap-opt' of github.com:betrusted-io/xous-core into swap-opt 2024-05-07 17:12:01 +08:00
bunnie
eb9124b9c7 test the get free memory call 2024-05-07 02:11:09 -07:00
bunnie
fd4a8cf7e2 add a call to get the free memory status from the kernel
this will be helpful for debugging our page tracker
2024-05-07 02:11:09 -07:00
bunnie
fe7ee9554c
Merge pull request #537 from betrusted-io/rust-1.38
Rust 1.38
2024-05-07 02:10:08 -07:00
bunnie
1523fb6b83 cleanup warning from rust 1.38 2024-05-07 17:07:36 +08:00
bunnie
44658adb47 deal with deprecation notice in rust 1.38
annoying. is this actually necessary?
2024-05-07 17:02:15 +08:00
bunnie
64bc1aa074 test the get free memory call 2024-05-07 04:13:11 +08:00
bunnie
43c452bf97 add a call to get the free memory status from the kernel
this will be helpful for debugging our page tracker
2024-05-07 04:12:46 +08:00
bunnie
e10975ef51
Merge pull request #535 from betrusted-io/verifier
add the verifier version bumps
2024-05-06 10:22:39 -07:00
bunnie
403822277a add the verifier version bumps 2024-05-07 01:19:49 +08:00
bunnie
fda8e79105
Merge pull request #534 from betrusted-io/swap-abi
Swap abi
2024-05-06 10:14:16 -07:00
bunnie
990dfe0e07 add ABI update lock 2024-05-07 01:12:14 +08:00
bunnie
9e66c1bee2 commit the version bump 2024-05-07 01:03:05 +08:00
bunnie
114a2c40bd add a flag for changing targets gracefully
at the moment an SVD pointer hangs out that messes builds up
when changing targets (sometimes) -- this is the pointer that
includes extra files in the build for targets that have disjoint
RTL sources. add a flag for cleaning this up.
2024-05-07 00:57:24 +08:00
bunnie
b1cc676345 absorb ABI changes 2024-05-07 00:56:35 +08:00
bunnie
73414ff9d5 some ABI changes
- make the swapper API fully generic, so we don't have to change
the application ABI as the swapper requirements evolve
- assign the invalid opcode to a fixed number, so it doesn't move
between dissimilar versions.
2024-05-07 00:55:45 +08:00
bunnie
3a7799c9b8
Merge pull request #533 from betrusted-io/swap-kernel
Debug swap implementation in kernel
2024-05-06 04:01:56 -07:00
bunnie
5ab014e715 cleanup the offsets for decrypt_src_page_at()
We had a "coincidence" before that allowed things to work,
where we had some data line up that we happened to think
was some other header data, so we "fixed" it by
subtracting the offset of the header data.

Actually, it wasn't.

Clarify that decrypt_src_page_at() offsets are relative
to the beginning of encrypted data, and not relative
to the absolute beginning of the disk.

Image creation is now fixed so that stuff lines up to what
this routine expects, and some asserts added to try and
save ourselves in the future as we try to fix other bugs
we discover over time.

loaders are hard.
2024-05-06 18:55:11 +08:00
bunnie
63c316f32a fix image creation
1. nonce should be generated from the LSB of the commit hash.
security doesn't come from the nonce, and having the commit hash
in the nonce is helpful for version control of the swap image
(although it doesn't capture "dirty" builds, e.g. builds
made with uncommitted changes).

2. fix IniS regions to not require special alignment. Since the
data is copied (similar to IniE), we don't have to waste space
page-aligning things so that offsets map perfectly between
the image on disk and in RAM.

3. add checks that the loading position of data inside the
swap image matches our expectations. We should have 0x1000
bytes of unencrypted header, then 0x1000 bytes of XArgs + padding,
and then image data should start.

There is a "just so" coincidence in that the image data by
the MiniElf program always lines up at an address > 0x1000, making
space for the XArgs. I actually don't know why this padding is
there, but the "section" doesn't decode to anything we
can parse. Maybe it's some reserved space for OS-specific
loader shenanigans?
2024-05-06 18:49:18 +08:00
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
e8e6b9acfa turn off WDT in swap debug config
would be nice not to have to race the WDT to read the
panic logs.
2024-05-06 13:19:37 +08:00
bunnie
cbcd27c7eb add missing clock commit 2024-05-06 03:59:04 +08:00
bunnie
b8a088dc78 commit latest test config
- swap works on hardware (at least reading in the encrypted
images works)
- renode version is deliberately configured to trigger an edge
case in the swapper, and is broken -- to be debugged
2024-05-06 03:33:06 +08:00
bunnie
0f79056ac7 refactor spim divider equation to reflect reality 2024-05-06 03:32:41 +08:00
bunnie
12327ab255 adjust ticktimer to reflect real time 2024-05-06 02:43:30 +08:00
bunnie
e76c1d9172 adjust delay 2024-05-06 02:43:18 +08:00
bunnie
bd3dbd6772 absorb API changes 2024-05-06 02:30:25 +08:00
bunnie
9052d05657 cleanup debug 2024-05-06 02:30:11 +08:00
bunnie
d5b9036531 allow for alternate pin mapping on graphics server
use the SPIM port that is broken for QSPI for the display...
2024-05-06 02:29:34 +08:00
bunnie
a7e38f1fb9 turn off default feature flags on hal dependency 2024-05-06 02:29:09 +08:00
bunnie
05844c7646 reflect API changes in code 2024-05-06 02:28:11 +08:00
bunnie
6723b9d67c cleanup missing APIs
- need to be able to specify the mode that a SPIM could be in
that was set up by the bootloader
- make yield() optional - it could be useful if the API is used
in userland contexts, but in an interrupt context (e.g. swapper)
it should not be used.
2024-05-06 02:26:55 +08:00
bunnie
f6dd848ef4 this wasn't supposed to be checked in 2024-05-06 02:25:49 +08:00
bunnie
58308656a0 fix feature flags for xous deployment 2024-05-06 02:25:09 +08:00
bunnie
f635917658 fix typo 2024-05-06 02:06:15 +08:00
bunnie
7006f92e6f clean up an error with a gratuitous print 2024-05-05 21:52:28 +08:00
bunnie
10d613b95d add some tests for the SPIM memory interface 2024-05-05 21:51:48 +08:00
bunnie
8ceaa1afe4 fix page tracking bug on physical swap addresses 2024-05-05 21:51:17 +08:00
bunnie
fe0db3e29a more stack space is needed due to the increased size of the RPT 2024-05-05 21:50:09 +08:00
bunnie
be2e450686 fix address ordering error on RAM 2024-05-05 21:48:04 +08:00
bunnie
fbb5bb3e90 make monkeypatching more automated 2024-05-05 20:58:43 +08:00
bunnie
914acb9c12 apply the optimization to writes as well 2024-05-05 16:41:00 +08:00
bunnie
6d7d3b244d slight optimization to SPIM read 2024-05-05 16:39:59 +08:00