core: hle: kernel: Handle exceptions outside of dynarmic.

This commit is contained in:
bunnei
2022-08-12 21:59:18 -07:00
parent 3d9542c41f
commit 4d74bd9010
4 changed files with 14 additions and 6 deletions
+7
View File
@@ -134,6 +134,13 @@ void ARM_Interface::Run() {
}
system.ExitDynarmicProfile();
// Exception occurred, pass on to kernel to handle it.
if (exception_context != std::nullopt) {
const auto exception_context_ = *exception_context;
exception_context.reset();
Kernel::Arch::Arm64::HandleException(system.Kernel(), exception_context_);
}
// Notify the debugger and go to sleep if a breakpoint was hit,
// or if the thread is unable to continue for any reason.
if (Has(hr, breakpoint) || Has(hr, no_execute)) {
+3
View File
@@ -6,12 +6,14 @@
#include <array>
#include <span>
#include <vector>
#include <optional>
#include <dynarmic/interface/halt_reason.h>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "core/hardware_properties.h"
#include "core/hle/kernel/arch/arm64/exception_handlers.h"
namespace Common {
struct PageTable;
@@ -210,6 +212,7 @@ protected:
System& system;
const WatchpointArray* watchpoints;
bool uses_wall_clock;
std::optional<Kernel::Arch::Arm64::KExceptionContext> exception_context;
static void SymbolicateBacktrace(Core::System& system, std::vector<BacktraceEntry>& out);
const Kernel::DebugWatchpoint* MatchingWatchpoint(
+2 -3
View File
@@ -17,7 +17,6 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/debugger/debugger.h"
#include "core/hle/kernel/arch/arm64/exception_handlers.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/svc.h"
#include "core/memory.h"
@@ -130,8 +129,8 @@ public:
exception_context.psr = thread_context.cpsr;
exception_context.tpidr = thread_context.tpidr;
// Kernel to handle exception
Kernel::Arch::Arm64::HandleException(parent.system.Kernel(), exception_context);
// Kernel to handle exception on exit
parent.exception_context = exception_context;
}
void CallSVC(u32 swi) override {
+2 -3
View File
@@ -16,7 +16,6 @@
#include "core/core_timing.h"
#include "core/debugger/debugger.h"
#include "core/hardware_properties.h"
#include "core/hle/kernel/arch/arm64/exception_handlers.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/svc.h"
#include "core/memory.h"
@@ -171,8 +170,8 @@ public:
exception_context.psr = thread_context.pstate;
exception_context.tpidr = thread_context.tpidr;
// Kernel to handle exception
Kernel::Arch::Arm64::HandleException(parent.system.Kernel(), exception_context);
// Kernel to handle exception on exit
parent.exception_context = exception_context;
}
void CallSVC(u32 swi) override {