From 88d3f9d3ec050a90d80e2977f0a3e5cb7de90cec Mon Sep 17 00:00:00 2001 From: fleroviux Date: Sun, 28 Apr 2024 03:13:51 +0200 Subject: [PATCH] Add GetExceptionBase() to the CPU interface --- include/lunatic/cpu.hpp | 1 + src/jit.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/lunatic/cpu.hpp b/include/lunatic/cpu.hpp index 9fe6b06..7aa86ec 100644 --- a/include/lunatic/cpu.hpp +++ b/include/lunatic/cpu.hpp @@ -75,6 +75,7 @@ struct CPU { virtual void Reset() = 0; virtual auto IRQLine() -> bool& = 0; virtual auto WaitForIRQ() -> bool& = 0; + virtual auto GetExceptionBase() const -> u32 = 0; virtual void SetExceptionBase(u32 exception_base) = 0; virtual void ClearICache() = 0; virtual void ClearICacheRange(u32 address_lo, u32 address_hi) = 0; diff --git a/src/jit.cpp b/src/jit.cpp index f9369ba..d1325e9 100644 --- a/src/jit.cpp +++ b/src/jit.cpp @@ -49,6 +49,10 @@ struct JIT final : CPU { return wait_for_irq; } + auto GetExceptionBase() const -> u32 { + return exception_base; + } + void SetExceptionBase(u32 new_exception_base) override { if (new_exception_base != this->exception_base) { // this is expected to happen rarely, so we just invalidate all blocks that may cause an exception.