refactor(userspace): split syscall/fat16/ext4 by concern; trim comments

This commit is contained in:
2026-10-27 13:21:53 +01:00
parent 99273db6d3
commit b4390b7b6d
25 changed files with 1283 additions and 1229 deletions

View File

@@ -1,7 +1,5 @@
//! The spinner half of init's SMP self-test (see init's `selftest`):
//! maps the counter page it was given in slot 0 and runs one thread per
//! hart, each incrementing its own counter for ever. Init watches the
//! counters through its own mapping of the same page.
//! Spinner half of init's SMP self-test: one thread per hart, each
//! incrementing its own counter in the page given in slot 0.
#![no_std]
#![no_main]
@@ -14,8 +12,7 @@ use types::address::{EntryPoint, StackPointer, VirtualAddress};
use types::bounded::{CapSlot, PageCount};
use types::mapping::PagePerms;
/// Where the counter page is mapped. Layout (words): 0 the next free
/// counter index, 1..=THREADS the counters.
/// Counter page layout (words): 0 next free counter index, 1..=THREADS counters.
const COUNTERS_VA: usize = 0x0100_0000;
const THREADS: usize = 4;
@@ -41,8 +38,7 @@ extern "C" fn spin() -> ! {
let word = |i: usize| unsafe { &*((COUNTERS_VA + i * 8) as *const AtomicUsize) };
let mine = 1 + word(0).fetch_add(1, Ordering::Relaxed) % THREADS;
loop {
// Yield now and then: a spinner sharing init's hart would
// otherwise starve it until the next (1 s) timer tick.
// Yield so a spinner sharing init's hart cannot starve it.
for _ in 0..1024 {
word(mine).fetch_add(1, Ordering::Relaxed);
}