Move the NextLevel AT into the TableMapper (descriptor-level) trait.
This allows us to provide a blanket implementation of TableMapperTable
for all tables where, Table::Descriptor : TableMapper.
Since the architectural details of descriptor implementation is hidden
behind traits, the code for walking page tables is arch-agnostic.
Therefore, promote it to shared code for use by other architectures.
Bit 7 on various descriptors in x86_64 can take on varying values
depending upon the descriptor type. Refelect that in the implementation
and fix a bug whereby the PAT bit would have been set when creating a
PTE.
The test harness code is useful across architectures. Therefore, move it
out of the arm64 directory so it can be used by other architectures
implementing paging unit-tests.
We currently define the MAP_SHIFT for a page-table level in two places,
`TableMapper` and `PgTable`. Store only one shift trait constant value
in the `PageTableEntry` trait.
Any traits which are architecture agnostic should be available to be
implemented by other architectures. Move them out from the arm64 module
into a non-architecure specific location.
Move PtePermissions to paging module which is feature-gated behind
`paging`.
Also move all AddressSpace related functionality behind the `proc_vm`
feature gate.
Add a virtio-rng entropy source driver that registers with the kernel
RNG subsystem. Introduce `ProbeError::NoMatch` so virtio drivers can
silently reject empty or wrong-type MMIO slots without spamming the boot
log with fatal errors or leaving devices stuck in the deferred queue.
Miri is failing the smalloc tests due to poorly written tests, mainly
due to the fact that raw pointers were derived from mutable refs. Fixup
the tests to use the global allocator funcitons directly.
Fix several issues in the slab allocator identified by the heap stress
tests (intermittent) and running the tests under Miri.
1. Fix Undefined Behavior. Previously, the allocator created temporary
`&mut Frame` references while raw pointers to that frame existed in the
intrusive `partial` or `free` lists. Under Miri's strict aliasing rules,
creating a unique reference to the whole struct invalidated the list
pointers.
The fix implements "split borrowing": we now maintain raw pointers to
the frame and only create mutable references to the `.state` field
when needed, ensuring the `.link` field remains valid for the
intrusive list.
2. Fix `free_list_sz` accounting. In `try_alloc`, the `free_list_sz`
counter was not being decremented when a slab was successfully popped
from the free list. This caused the allocator to believe it had free
slabs when the list was actually empty, leading to panics during
batch-free operations.
3. Increase heap stress tests. The test suite now runs the stress test
in a loop to catch state persistence bugs and ensures the allocator is
fully torn down and reset between iterations.
Fixes: #220