Commit graph

367 commits

Author SHA1 Message Date
bunnie
76fb67dbe6 add global SFR setup for TRNG proper operation inside loader 2024-06-13 15:43:18 +08:00
bunnie
cf99fd99eb trng baseline test code 2024-06-13 00:35:02 +08:00
bunnie
ac7b58b702 trying to back-trace to a working bootloader state 2024-06-10 18:45:44 +08:00
bunnie
99be442d16 working demo of first couple packets in loader 2024-06-09 23:51:30 +08:00
bunnie
971bfea83d more telemetry on boot
also, it seems that some amount of boot setup is necessary
for stability? unsure, this has to be chased out, but later.
2024-06-08 00:52:11 +08:00
bunnie
9f43e1df0a fix edgecase in nocopy section
do not try to decrypt data for sections that are nocopy,
this can lead to spurious decryption errors
2024-06-06 22:19:42 +08:00
bunnie
519ae31485 loader mods to harmonize with driver bounds 2024-06-06 17:55:10 +08:00
bunnie
8ef46fd081 move usb driver to a common location 2024-06-06 03:58:35 +08:00
bunnie
4261e70d3f update usb test 2024-06-05 22:54:27 +08:00
bunnie
65df5b3066 remove uccr structure
the ram-mapped uccr structure does not guarantee synchronization
well enough. go back to UTRA functions. This gets us to the point
of setup packets!
2024-06-05 22:50:48 +08:00
bunnie
545b51e8d3 rote port of C driver into Rust
lots of terrible stuff going on, nothing tested, but we have
a baseline of whatever they put in C directly forced into Rust.

A lot of really naughty things going on with raw pointers in this
driver -- it's going to be a challenge to oxidize.
2024-06-05 02:24:12 +08:00
bunnie
df6528edcf refactor to use structured usb object 2024-06-03 17:04:47 +08:00
bunnie
9673624a4e add usb register model and basic init structs 2024-06-03 17:04:21 +08:00
bunnie
e415fd44e7 start to lay in foundations for USB integration 2024-06-01 13:35:31 +08:00
bunnie
5f42ee6ecf move PFD into happy zone
apparently we were not running it in its recommended band before.
2024-05-31 22:34:28 +08:00
bunnie
968440ec7e add stand-alone IRQ testing to the loader environment
The loader bringup now has some IRQ testing built into it.
Couldn't actually get an IRQ to trigger, but it has to do something
more with me not getting the RV IRQ machine bits configured right
than anything else. However, the stub is useful for confirming
which IRQ bits actually fire on the UDMA UART implementation,
which is the big point. There's an ambiguity in the wiring
of the UDMA block which isn't explained at all, which is the
fact that there's an RX interrupt and an RX_CHAR interrupt.

I still don't know what RX_CHAR does, but the RX interrupt
does fire when a character is received, so that's the one
we're going to use.
2024-05-31 03:36:08 +08:00
bunnie
8d0a1f2ae6 reminder to self about some tech debt 2024-05-24 23:57:47 +08:00
bunnie
3fd383a7aa approximate cram target better in precursor staging environment 2024-05-23 16:51:20 +08:00
bunnie
aa8d84f007 print a message if memory reads timeout 2024-05-23 14:48:11 +08:00
bunnie
818372a604 report timeouts during the SPIM test in the loader 2024-05-22 18:10:32 +08:00
bunnie
e705dba13f quite down swap debug in loader 2024-05-21 17:57:41 +08:00
bunnie
32a9413f34 cleanup warnings when debug-print is off 2024-05-21 17:57:24 +08:00
bunnie
bae408b466 fix app_uart default memory mapping
was pointing to the wrong uart initially >_<
2024-05-21 16:33:11 +08:00
bunnie
71d7a2a3ae update api in test routine 2024-05-21 16:33:03 +08:00
bunnie
2e1ad6e1a4 remove T:Copy bounds on bzero
not quite sure why it is even there, might just be a thing from
really old code we never removed. Removing this allows us to
specify pointer types to non-copy elements, making Rust do
the hard work of figuring out how big of a block we need to zero.
2024-05-21 16:02:59 +08:00
bunnie
0153b3b96e allow guard memory to be differentiated across platforms 2024-05-21 16:00:56 +08:00
bunnie
8b487361b2 clean up bzero
some errors were made in clearing memory because we weren't
using the Rust type system to our advantage. This cleans up
the phase 1 loader to use the native types of the block plus
the slice length we intend to create to block-zero the correct
region size.

also simplify mem::size_of to size_of
2024-05-21 15:58:10 +08:00
bunnie
a57945e2c0 add helper to extract vaddr prefixes (used by swapper to fliter candidates) 2024-05-21 03:46:29 +08:00
bunnie
b7becf27e7 quiet down warnings when debug-print is off
because the print! macro becomes a dummy when debug printing is
off, we get a bunch of warnings about unused variables because
the print! arguments aren't used. Add _ before variable names
to quiet these warnings.
2024-05-21 01:52:30 +08:00
bunnie
75e938680d fix page table explanation to match reality better 2024-05-21 01:03:19 +08:00
bunnie
37109b19a8 fix ordering of the SwapAlloc for BinaryHeap impl 2024-05-16 03:52:22 +08:00
bunnie
e75f6d80db tone down some debug output 2024-05-16 03:51:59 +08:00
bunnie
03515934df clarify function of the thread context area 2024-05-16 03:51:38 +08:00
bunnie
6d01e69faf fix debug formatting 2024-05-16 03:51:03 +08:00
bunnie
ef5388a30e ensure that process descriptors aren't swapped out 2024-05-15 02:38:24 +08:00
bunnie
f66debdd01 make susres page ownership not hard coded; mark PTs as wired
also marks the ProcessImpl page as wired too
2024-05-15 02:31:40 +08:00
bunnie
b138f63f93 fix swapalloc ordering
we want a max-heap, because pops are cheaper on the sorted vec.
2024-05-13 19:19:15 +08:00
bunnie
a94dce11f7 add loader support for rpt tracking/mapping
trying to condense most of the RPT API into the loader so
that the userspace can use a single dependency for this.

We can't condense the kernel API into the loader unfortunately,
because the kernel actually uses a different type for representing
a process. This is probably a mistake, and is something that
may be fixed later so we can merge the representations.
2024-05-13 14:03:00 +08:00
bunnie
8606d0ae83 add some more tracking to the loader
this will give us some more pages to swap out beyond the initial
set of free pages.
2024-05-12 22:29:50 +08:00
bunnie
6bef111bf2 fix RPT/XPT alloc in swap; make swap resume-compatible 2024-05-12 21:50:53 +08:00
bunnie
903c903b2f split memory allocs into RAM and peripheral tables
RAM allocs can be augmented with more tracking data in the case of
swap.
2024-05-12 20:22:51 +08:00
bunnie
f657caa176 changes to atsama5d27 target for new kernel boot args
@eupn this could use a review, I have no way to test this
2024-05-12 20:22:07 +08:00
bunnie
6080bc45d8 attempt to re-type the runtime page tracker to something we can use for swap
This is too expensive to use generically - we're going to have
to split the RPT, but checking in this change as a checkpoint
2024-05-12 16:27:30 +08:00
bunnie
f6bfddcf20 add swap usage tracking via offset flags and fix bugs in RPT init
also optimize amount of memory used in RPT copy by just tracking
the data that is swappable,i.e. main RAM
2024-05-10 13:32:58 +08:00
bunnie
64071661a5 clarify variable roles 2024-05-10 13:32:19 +08:00
bunnie
95c27c765e refactor loader to use a single function to swap MAC offset in swap
also pre-map some pages to handle offset increment in swapper
2024-05-09 02:08:51 +08:00
bunnie
1523fb6b83 cleanup warning from rust 1.38 2024-05-07 17:07:36 +08: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
cbcd27c7eb add missing clock commit 2024-05-06 03:59:04 +08:00
bunnie
0f79056ac7 refactor spim divider equation to reflect reality 2024-05-06 03:32:41 +08:00