aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/arm/dynarmic/arm_dynarmic.h
blob: 53dd188151d3c6257054b42ebcba6c544c3a610e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include <dynarmic/interface/halt_reason.h>

#include "core/arm/arm_interface.h"

namespace Core {

constexpr Dynarmic::HaltReason StepThread = Dynarmic::HaltReason::Step;
constexpr Dynarmic::HaltReason DataAbort = Dynarmic::HaltReason::MemoryAbort;
constexpr Dynarmic::HaltReason BreakLoop = Dynarmic::HaltReason::UserDefined2;
constexpr Dynarmic::HaltReason SupervisorCall = Dynarmic::HaltReason::UserDefined3;
constexpr Dynarmic::HaltReason InstructionBreakpoint = Dynarmic::HaltReason::UserDefined4;
constexpr Dynarmic::HaltReason PrefetchAbort = Dynarmic::HaltReason::UserDefined6;

constexpr HaltReason TranslateHaltReason(Dynarmic::HaltReason hr) {
    static_assert(static_cast<u64>(HaltReason::StepThread) == static_cast<u64>(StepThread));
    static_assert(static_cast<u64>(HaltReason::DataAbort) == static_cast<u64>(DataAbort));
    static_assert(static_cast<u64>(HaltReason::BreakLoop) == static_cast<u64>(BreakLoop));
    static_assert(static_cast<u64>(HaltReason::SupervisorCall) == static_cast<u64>(SupervisorCall));
    static_assert(static_cast<u64>(HaltReason::InstructionBreakpoint) ==
                  static_cast<u64>(InstructionBreakpoint));
    static_assert(static_cast<u64>(HaltReason::PrefetchAbort) == static_cast<u64>(PrefetchAbort));

    return static_cast<HaltReason>(hr);
}

#ifdef __linux__

class ScopedJitExecution {
public:
    explicit ScopedJitExecution(Kernel::KProcess* process);
    ~ScopedJitExecution();
    static void RegisterHandler();
};

#else

class ScopedJitExecution {
public:
    explicit ScopedJitExecution(Kernel::KProcess* process) {}
    ~ScopedJitExecution() {}
    static void RegisterHandler() {}
};

#endif

} // namespace Core