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.
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.
- 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...
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.
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.
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.