mirror of
https://github.com/Creased/RCM-Emulator.git
synced 2026-12-06 02:48:11 +01:00
Stop planting hekate's watchdog cookie in IRAM
The emulator wrote hekate's "watchdog fired" magic (0x544457 at 0x4003FF18) before every boot. hekate then took its post-watchdog path and skipped LP0 and Minerva, because the EMC could not support DRAM training. It can now, so the cookie only made the boot differ from hardware, and it never covered Nyx, which trains the DRAM itself when it finds Minerva uninitialised. With the cookie gone, hekate's IPL saves the LP0 SDRAM config and trains 204, 800 and 1600 MHz itself, and Nyx takes over the trained context. An SD image without bootloader/sys now gets hekate's real "Missing LP0/Minerva lib" screen, which waits for a key press. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YYewwDPujjo5B2xRyC5Grb
This commit is contained in:
3 files changed
+22
-39
No files matched your search
@@ -151,20 +151,6 @@ static uc_engine *setup_emulation(EmuState *state, uint8_t *payload, size_t payl
|
||||
(unsigned long long)(IRAM_BASE + IRAM_SIZE),
|
||||
(unsigned)(IRAM_SIZE / 1024));
|
||||
|
||||
// Pre-set Hekate's "watchdog fired" magic at IRAM 0x4003FF18 (cookie "WDT")
|
||||
// so its early boot does `goto skip_lp0_minerva_config`, skipping both
|
||||
// libsys_lp0.bso and the IPL's Minerva DRAM training - the same path
|
||||
// Hekate takes on hardware after a WDT reset. The matching EXCP_EN_ADDR
|
||||
// (0x4003FF1C) is intentionally left zeroed so ERR_EXCEPTION is *not* set
|
||||
// and the user doesn't see a "hang detected" warning screen. The EMC
|
||||
// model runs Minerva fine (Nyx trains the DRAM itself when it starts);
|
||||
// this only spares a minimal SD image the IPL's "missing lib" errors and
|
||||
// shortens the boot.
|
||||
{
|
||||
uint32_t wdt_magic = 0x544457; // "WDT"
|
||||
uc_mem_write(uc, 0x4003FF18, &wdt_magic, sizeof(wdt_magic));
|
||||
}
|
||||
|
||||
// ---- Map DRAM as one contiguous region ----
|
||||
// 0x80000000 .. 0x100000000, i.e. the whole 32-bit-addressable DRAM window
|
||||
// the BPMP can reach. This used to be two islands (256 MB at 0x80000000
|
||||
@@ -495,8 +481,7 @@ int main(int argc, char *argv[]) {
|
||||
if (!sdl_display_poll_events(&state, uc)) break;
|
||||
|
||||
// Soft reboot: re-write the payload to IRAM, wipe DRAM (so Nyx and
|
||||
// the bootloader's file-static caches reset), reset PC/SP/clock and
|
||||
// re-prime the WDT cookie so Hekate's IPL skips LP0/Minerva again.
|
||||
// the bootloader's file-static caches reset) and reset PC/SP/clock.
|
||||
if (state.reboot_requested.exchange(false)) {
|
||||
uc_emu_stop(uc);
|
||||
bool cold = state.reboot_cold.exchange(false);
|
||||
@@ -513,8 +498,6 @@ int main(int argc, char *argv[]) {
|
||||
if (reload > IRAM_SIZE - (IPL_LOAD_ADDR - IRAM_BASE))
|
||||
reload = IRAM_SIZE - (IPL_LOAD_ADDR - IRAM_BASE);
|
||||
uc_mem_write(uc, IPL_LOAD_ADDR, state.payload_ptr, reload);
|
||||
uint32_t wdt_magic = 0x544457;
|
||||
uc_mem_write(uc, 0x4003FF18, &wdt_magic, sizeof(wdt_magic));
|
||||
// Neither the zeroed DRAM nor uc_mem_write() reaches the engine's
|
||||
// code cache, so what the last run translated - a payload it
|
||||
// chainloaded over this one's load address, Nyx in DRAM - would
|
||||
|
||||
Reference in new issue
Block a user