StarletBootstrapProbe: report StarOS's panic words

StarOS's panic path (ADR-0014 R6) writes no trace line: it sets the guard
word __panic_state, stores __panic_code and halts. LoadBootstrapELF now
returns both symbols when an image has them (optional, but both or
neither, as words of the data segment), and the probe stops a run whose
guard is set: it prints the trace published so far and
"Starlet panic state <n> code <n>", and passes --expect-panic when the
state is 1. Images without these symbols (StarletOS) load and run as
before; a REV:PANIC trace line still satisfies --expect-panic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Yaya48andClaude Opus 5.5 committed 2026-10-13 21:21:58 +02:00
1 parent cdec826bb8
commit 612cab7b30
4 files changed
+84

No files matched your search

@@ -1,6 +1,7 @@
// Copyright 2026 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iostream>
@@ -92,6 +93,22 @@ bool Run(const std::string& path, bool jit, bool mmu_faults, ExpectedOutcome exp
return expected == ExpectedOutcome::UndefinedFault && fault_code == 1 &&
memory.Read32(info.fault_lr) != 0 && memory.Read32(info.fault_spsr) != 0;
}
// StarOS's panic path writes no trace line: it sets its guard word, then its code, and halts.
// The trace published so far is printed for the scenario's ordered checks.
if (info.panic_state != 0 && memory.Read32(info.panic_state) != 0)
{
const u32 panic_state = memory.Read32(info.panic_state);
const u32 panic_code = memory.Read32(info.panic_code);
const u32 length = memory.Read32(info.trace) == TRACE_MAGIC ?
std::min(memory.Read32(info.trace + 4), TRACE_CAPACITY) :
0;
for (u32 index = 0; index < length; ++index)
std::cout << static_cast<char>(memory.Read8(info.trace + 8 + index));
std::cout << "PC=0x" << std::hex << core.GetRegister(15) << std::dec
<< " instructions=" << core.GetExecutedInstructions() << '\n';
std::cerr << "Starlet panic state " << panic_state << " code " << panic_code << '\n';
return expected == ExpectedOutcome::Panic && panic_state == 1;
}
if (memory.Read32(info.trace) != TRACE_MAGIC)
continue;
const u32 length = memory.Read32(info.trace + 4);