Commit graph

320 commits

Author SHA1 Message Date
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
bunnie
05844c7646 reflect API changes in code 2024-05-06 02:28:11 +08:00
bunnie
f6dd848ef4 this wasn't supposed to be checked in 2024-05-06 02:25:49 +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
0a3375722b add an experimental routine to try and print the exception vector
this is in the loader and only valid for the cramium-soc target.
2024-05-05 16:30:45 +08:00
bunnie
bb4b01b04b facilitate access for debug access to CSR by adding riscv package 2024-05-05 03:28:13 +08:00
bunnie
64f5531ae6 fix dummy cycle bug on SPIM flash read
bus is running at 50MHz (or less!), so we can use the shortest
dummy cycling
2024-05-05 03:27:01 +08:00
bunnie
82be129df1 fix typo 2024-05-05 03:26:21 +08:00
bunnie
5fa955f507 fix typo, enforce alignment on the RawPage structure
I think i recall somewhere that an alignment of 16 is required
for certain structures in Rust for the RV32 target; since anything
could be put in there, let's enforce that.
2024-05-05 03:25:08 +08:00
bunnie
7ebfdf3ecd shorten boot wait 2024-05-05 03:24:50 +08:00
bunnie
62d16bb77f fix minor bugs 2024-05-04 22:07:16 +08:00
bunnie
dbd33ad220 don't commit the redacted fonts section
this is just for very early bringup to reduce blob size
and improve cycle time for experimentation.
2024-05-04 21:45:03 +08:00
bunnie
829ac28072 fixes for cramium target 2024-05-04 21:41:38 +08:00
bunnie
a6a3d29836 more warning cleanup, moving around app_uart visbility part 2 2024-05-04 01:46:05 +08:00
bunnie
721129781a cleanup some warnings 2024-05-04 01:45:36 +08:00
bunnie
0b63979614 fix visibility of app uart for cramium config 2024-05-04 01:45:10 +08:00
bunnie
8f0634845e add more userspace maps for loader-managed swap maps 2024-05-03 18:46:11 +08:00
bunnie
228558a722 add platform specific hw inits & key retrieval
- swap session key has to be stored so we can pass it on to
the kernel to access swap

- setup all PT maps necessary for swapper to be functional
before the swapper is started.

This is to break circular dependencies mapping pages inside the
swapper, especially during boot.

We might also need to statically map the LRU swap count structure,
not sure. We'll burn that bridge when we get there, right now,
let's just get a non count-managed swap even working...
2024-05-03 18:43:57 +08:00
bunnie
ef6a73d329 use the correct session key for swap ram
and also call platform-specific swap init
2024-05-03 18:43:19 +08:00
bunnie
d434e70075 move the IFRAM specifiers to a more public location
The IFRAM allocation used by the loader is now exposed so
we can pick it up and use it in the actual HAL implementation
in usermode.
2024-05-03 16:04:37 +08:00
bunnie
c8d4123ed7 fix the debug printout to walk the virtual addresses in swap PT
The check of mapping sanity happens after the VA mapping, so this
undoes that. I think this is a good idea, because we're also
checking the PA->VA mapping of the PTEs as well now.
2024-05-03 16:03:14 +08:00
bunnie
be98a88a75 patch PTEs mapped to swapper with virtual addresses
The addresses put into the swapper's page table are physical
addresses, which are unusable by the swapper itself. This
patches the PTEs with the repsective virtual address, so we
don't have to do a PT walk inside the swapper when handling
a swap event.

Also fix an off-by-one on the processes count. This is sort of
an old architectural bug in the loader that would be nice to fix
someday.
2024-05-03 16:01:25 +08:00
bunnie
b4d1b4e5bb add swap lib interface to loader
for use by the swapper
2024-05-02 22:15:32 +08:00
bunnie
67685db741 create the SwapSpec structure and mappings 2024-05-02 22:14:58 +08:00
bunnie
cd43157d1e refactor loader mac accessor interfaces
traits are kind of awful in Rust...it's true, they don't
know how big they are at compile time, so they have to be dyn,
reference, lifetimes, etc...

lot of baggage for a static structure. I guess there's probably
some idk bounds I could put on the traits to make it less poopy
but also just as easy to make it a static structure and not deal
with traits.
2024-05-02 22:13:11 +08:00
bunnie
51dd3b897b map arguments and rpt into loader memory space
this allows us to avoid the dance of getting args/values back
on boot through a syscall
2024-05-02 22:12:07 +08:00
bunnie
e201574eb8 put the verification in the right area 2024-04-30 17:47:57 +08:00
bunnie
c68e351bcc incorporate latest changes into the swap init routine 2024-04-30 17:47:36 +08:00
bunnie
7ae34ed717 add features for alt spi channel on bringup 2024-04-30 17:14:22 +08:00
bunnie
1810880723 add SPIM loader bringup code 2024-04-30 17:13:42 +08:00
bunnie
fd9f85ef58 adjust speeds to reflect actual spec 2024-04-30 17:13:21 +08:00
bunnie
4499097c74 add remainder of test code for spim 2024-04-29 04:13:01 +08:00
bunnie
c1b6f479d4 add some test code for SPIM interface 2024-04-29 04:10:54 +08:00
bunnie
31c51a2a7f add spim-test flag for loader 2024-04-29 04:09:53 +08:00
bunnie
506bcdc7b9 add pio tester feature flag 2024-04-29 03:44:46 +08:00
bunnie
0adb20b3d8 add a test stub for the quantum timer in the loader
a little easier to do low level peripheral testing here than in
the kernel
2024-04-29 03:42:34 +08:00
bunnie
4926e61fec cleanup mut warning 2024-04-28 02:57:44 +08:00
bunnie
07c9890919 fix location of kernel; attempt to debug loader 2024-04-28 02:43:11 +08:00
bunnie
c491c63e42 add PLL computation code 2024-04-27 22:24:27 +08:00
bunnie
2702b94c93 include signature block in kernel offset constant 2024-04-26 18:20:14 +08:00
bunnie
d85ff12ca2 rework the kernel offset 2024-04-26 18:19:59 +08:00
bunnie
6c2cb85a44 make sram-margin and boot delay feature flags 2024-04-26 18:16:56 +08:00
bunnie
a781b2e15d start to lay in code rework for booting on real chips 2024-04-26 18:16:12 +08:00
bunnie
05d2f3d6a9 configure boot addresses 2024-04-26 18:15:05 +08:00
bunnie
c407db877e change DUART ports to accommodate jtag breakout 2024-04-22 11:00:06 +08:00
bunnie
73c834d067 start debugging of swap in kernel
switching contexts to bringing up hardware.
2024-04-22 10:58:37 +08:00