harden deterministic headless runtime control
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good

This commit is contained in:
2026-09-23 07:09:46 +01:00
parent 2516fae4fc
commit 89101d1b20
14 changed files with 856 additions and 121 deletions
@@ -159,6 +159,15 @@ impl<'a> VmFacade<'a> {
self.os.vm_runtime.debug_step_request = true;
}
pub fn clear_debug_step_request(&mut self) {
if let Some(session) = self.active_session_mut() {
session.runtime.debug_step_request = false;
return;
}
self.os.vm_runtime.debug_step_request = false;
}
pub fn debug_step_requested(&self) -> bool {
self.active_session()
.map(|session| session.runtime.debug_step_request)
@@ -65,7 +65,7 @@ pub struct VirtualMachineRuntime {
impl VirtualMachineRuntime {
pub const CYCLES_PER_LOGICAL_FRAME: u64 = 1_500_000;
pub const SLICE_PER_TICK: u64 = 1_500_000;
pub const SLICE_PER_TICK: u64 = 250_000;
pub const MAX_LOG_LEN: usize = 256;
pub const MAX_LOGS_PER_FRAME: u32 = 10;
@@ -76,6 +76,9 @@ impl VirtualMachineRuntime {
vm: &mut VirtualMachine,
platform: &mut dyn RuntimePlatform,
) -> Option<CrashReport> {
if vm.call_stack_is_empty() {
vm.prepare_boot_call();
}
let step_result = {
let mut ctx = HostContext::new_platform(Some(platform));
let mut fs = VirtualFS::new();
@@ -96,18 +99,28 @@ impl VirtualMachineRuntime {
};
match step_result {
Ok(_) => None,
Err(e) => {
let report = match e {
LogicalFrameEndingReason::Trap(trap) => CrashReport::VmTrap { trap },
LogicalFrameEndingReason::Panic(message) => {
CrashReport::VmPanic { message, pc: Some(vm.pc() as u32) }
}
other => CrashReport::VmPanic {
message: format!("Unexpected fault during step: {:?}", other),
pc: Some(vm.pc() as u32),
},
};
Ok(())
| Err(
LogicalFrameEndingReason::FrameSync
| LogicalFrameEndingReason::BudgetExhausted
| LogicalFrameEndingReason::Halted
| LogicalFrameEndingReason::EndOfRom
| LogicalFrameEndingReason::Breakpoint,
) => None,
Err(LogicalFrameEndingReason::Trap(trap)) => {
let report = CrashReport::VmTrap { trap };
self.log(
log_service,
LogLevel::Error,
LogSource::Vm,
report.log_tag(),
format!("PVM Fault during Step: {}", report),
);
self.last_crash_report = Some(report.clone());
Some(report)
}
Err(LogicalFrameEndingReason::Panic(message)) => {
let report = CrashReport::VmPanic { message, pc: Some(vm.pc() as u32) };
self.log(
log_service,
LogLevel::Error,