test: on-hardware SMP self-test (revoke/kill must stop every hart) + make test-qemu
This commit is contained in:
@@ -49,11 +49,24 @@ fn virtio_id(region: CapSlot) -> u32 {
|
||||
id
|
||||
}
|
||||
|
||||
fn boot_info() -> &'static BootInfo {
|
||||
// SAFETY: boot maps the BootInfo page read-only at BOOT_INFO_VA before
|
||||
// init runs; readers check its magic.
|
||||
unsafe { &*(BOOT_INFO_VA as *const BootInfo) }
|
||||
}
|
||||
|
||||
/// The capability that halts the machine, if boot said where it is.
|
||||
pub fn system_control() -> Option<CapSlot> {
|
||||
let info = boot_info();
|
||||
if info.magic != types::bootinfo::MAGIC {
|
||||
return None;
|
||||
}
|
||||
slot(info.system_control_slot)
|
||||
}
|
||||
|
||||
/// Sorts the board's devices out.
|
||||
pub fn discover() -> Devices {
|
||||
// SAFETY: boot maps the BootInfo page read-only at BOOT_INFO_VA before
|
||||
// init runs; `devices()` checks its magic.
|
||||
let info = unsafe { &*(BOOT_INFO_VA as *const BootInfo) };
|
||||
let info = boot_info();
|
||||
let mut found = Devices { disk: Device::NONE, gpu: Device::NONE, input: Device::NONE };
|
||||
let mut uart = Device::NONE;
|
||||
for d in info.devices() {
|
||||
|
||||
Reference in New Issue
Block a user