aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-03-29 13:57:49 +0200
committercrueter <crueter@eden-emu.dev>2026-03-29 13:57:49 +0200
commit59254cd1e7ef3bd02c6f680de5f8cbcfe99f21a4 (patch)
tree64ea5d11f5bc54ab51a0404f79bc4442dce69458 /src
parent9a3af3a6a3bc76140a6d36c642a22f103c90b989 (diff)
[dynarmic] restore proper backtraces for A64 (#3794)
trivial changes, fixes hard crashes Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3794 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/nce/interpreter_visitor.cpp6
-rw-r--r--src/dynarmic/src/dynarmic/frontend/A64/decoder/a64.h7
-rw-r--r--src/dynarmic/src/dynarmic/frontend/A64/translate/a64_translate.cpp14
3 files changed, 19 insertions, 8 deletions
diff --git a/src/core/arm/nce/interpreter_visitor.cpp b/src/core/arm/nce/interpreter_visitor.cpp
index be6fee8613..077a696cc8 100644
--- a/src/core/arm/nce/interpreter_visitor.cpp
+++ b/src/core/arm/nce/interpreter_visitor.cpp
@@ -773,7 +773,11 @@ std::optional<u64> MatchAndExecuteOneInstruction(Core::Memory::Memory& memory, m
bool was_executed = false;
auto decoder = Dynarmic::A64::Decode<VisitorBase>(instruction);
- was_executed = decoder.get().call(visitor, instruction);
+ if (decoder) {
+ was_executed = decoder->get().call(visitor, instruction);
+ } else {
+ was_executed = false;
+ }
return was_executed ? std::optional<u64>(pc + 4) : std::nullopt;
}
diff --git a/src/dynarmic/src/dynarmic/frontend/A64/decoder/a64.h b/src/dynarmic/src/dynarmic/frontend/A64/decoder/a64.h
index 4ac04731ea..eba9d73942 100644
--- a/src/dynarmic/src/dynarmic/frontend/A64/decoder/a64.h
+++ b/src/dynarmic/src/dynarmic/frontend/A64/decoder/a64.h
@@ -70,14 +70,15 @@ constexpr DecodeTable<V> GetDecodeTable() {
/// In practice it must always suceed, otherwise something else unrelated would have gone awry
template<typename V>
-std::reference_wrapper<const Matcher<V>> Decode(u32 instruction) {
+std::optional<std::reference_wrapper<const Matcher<V>>> Decode(u32 instruction) {
alignas(64) static const auto table = GetDecodeTable<V>();
const auto& subtable = table[detail::ToFastLookupIndex(instruction)];
auto iter = std::find_if(subtable.begin(), subtable.end(), [instruction](const auto& matcher) {
return matcher.Matches(instruction);
});
- DEBUG_ASSERT(iter != subtable.end());
- return std::reference_wrapper<const Matcher<V>>(*iter);
+ return iter != subtable.end()
+ ? std::optional{ std::reference_wrapper<const Matcher<V>>(*iter) }
+ : std::nullopt;
}
template<typename V>
diff --git a/src/dynarmic/src/dynarmic/frontend/A64/translate/a64_translate.cpp b/src/dynarmic/src/dynarmic/frontend/A64/translate/a64_translate.cpp
index 6778d13890..4afce6bd29 100644
--- a/src/dynarmic/src/dynarmic/frontend/A64/translate/a64_translate.cpp
+++ b/src/dynarmic/src/dynarmic/frontend/A64/translate/a64_translate.cpp
@@ -25,7 +25,11 @@ void Translate(IR::Block& block, LocationDescriptor descriptor, MemoryReadCodeFu
const u64 pc = visitor.ir.current_location->PC();
if (const auto instruction = memory_read_code(pc)) {
auto decoder = Decode<TranslatorVisitor>(*instruction);
- should_continue = decoder.get().call(visitor, *instruction);
+ if (decoder) {
+ should_continue = decoder->get().call(visitor, *instruction);
+ } else {
+ should_continue = visitor.RaiseException(Exception::UnallocatedEncoding);
+ }
} else {
should_continue = visitor.RaiseException(Exception::NoExecuteFault);
}
@@ -45,13 +49,15 @@ bool TranslateSingleInstruction(IR::Block& block, LocationDescriptor descriptor,
bool should_continue = true;
auto const decoder = Decode<TranslatorVisitor>(instruction);
- should_continue = decoder.get().call(visitor, instruction);
+ if (decoder) {
+ should_continue = decoder->get().call(visitor, instruction);
+ } else {
+ should_continue = false;
+ }
visitor.ir.current_location = visitor.ir.current_location->AdvancePC(4);
block.CycleCount()++;
-
block.SetEndLocation(*visitor.ir.current_location);
-
return should_continue;
}