From 6fb2aecd20db5b0b347dcb67b2c16d867c4a34d7 Mon Sep 17 00:00:00 2001 From: Baptiste MOINE Date: Fri, 7 Aug 2026 18:14:23 +0200 Subject: [PATCH] Stop the RTC window from shadowing the PMC block --- t210/memory_map.h | 7 ++++++- t210/mmio.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/t210/memory_map.h b/t210/memory_map.h index 22c2530..bb3468e 100644 --- a/t210/memory_map.h +++ b/t210/memory_map.h @@ -74,7 +74,12 @@ constexpr uint64_t PWM_SIZE = 0x1000; // RTC constexpr uint64_t RTC_BASE = 0x7000E000; -constexpr uint64_t RTC_SIZE = 0x1000; +// 0x400, NOT 0x1000: the PMC block starts at 0x7000E400, immediately after the +// RTC. A 0x1000-long RTC window swallowed the whole PMC range, and because the +// RTC branch is tested first in the MMIO dispatch, every PMC access (reset +// status, scratch registers, and the MAIN_RST reboot write) silently went to +// the RTC handler instead. +constexpr uint64_t RTC_SIZE = 0x400; // PMC (Power Management Controller) constexpr uint64_t PMC_BASE = 0x7000E400; diff --git a/t210/mmio.cpp b/t210/mmio.cpp index 743ea9d..d89b693 100644 --- a/t210/mmio.cpp +++ b/t210/mmio.cpp @@ -2329,7 +2329,7 @@ static void hook_mmio_write(uc_engine *uc, uc_mem_type type, uint64_t address, (address >= I2C1_BASE && address < I2C1_BASE + 0x1000) || (address >= I2C5_BASE && address < I2C5_BASE + 0x1000) || (address >= SE_BASE && address < SE_BASE + SE_SIZE) || - (address >= RTC_BASE && address < RTC_BASE + 0x1000))) { + (address >= RTC_BASE && address < RTC_BASE + RTC_SIZE))) { printf("[mmio] W: 0x%08llX = 0x%08X (PC=0x%08X)\n", (unsigned long long)address, val, pc); fflush(stdout);