summaryrefslogtreecommitdiffstats
path: root/src/core/arm
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2016-12-31 15:01:30 +0100
committerMerryMage <MerryMage@users.noreply.github.com>2017-02-03 18:32:47 +0100
commit2b36d4c9d773381b91c2251b0e8f890d6f6f090a (patch)
tree414c9fbd44d8d1835b1af3fd5c20ca2b2f69aa75 /src/core/arm
parentSupport looping HLE audio (#2422) (diff)
downloadyuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.tar
yuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.tar.gz
yuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.tar.bz2
yuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.tar.lz
yuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.tar.xz
yuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.tar.zst
yuzu-2b36d4c9d773381b91c2251b0e8f890d6f6f090a.zip
Diffstat (limited to 'src/core/arm')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp11
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.h2
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_cp15.cpp88
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_cp15.h32
4 files changed, 128 insertions, 5 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index 9f25e3b00..99f4d4ab4 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -7,6 +7,7 @@
#include "common/assert.h"
#include "common/microprofile.h"
#include "core/arm/dynarmic/arm_dynarmic.h"
+#include "core/arm/dynarmic/arm_dynarmic_cp15.h"
#include "core/arm/dyncom/arm_dyncom_interpreter.h"
#include "core/core.h"
#include "core/core_timing.h"
@@ -39,10 +40,11 @@ static bool IsReadOnlyMemory(u32 vaddr) {
return false;
}
-static Dynarmic::UserCallbacks GetUserCallbacks(ARMul_State* interpeter_state) {
+static Dynarmic::UserCallbacks GetUserCallbacks(
+ const std::shared_ptr<ARMul_State>& interpeter_state) {
Dynarmic::UserCallbacks user_callbacks{};
user_callbacks.InterpreterFallback = &InterpreterFallback;
- user_callbacks.user_arg = static_cast<void*>(interpeter_state);
+ user_callbacks.user_arg = static_cast<void*>(interpeter_state.get());
user_callbacks.CallSVC = &SVC::CallSVC;
user_callbacks.IsReadOnlyMemory = &IsReadOnlyMemory;
user_callbacks.MemoryReadCode = &Memory::Read32;
@@ -55,12 +57,13 @@ static Dynarmic::UserCallbacks GetUserCallbacks(ARMul_State* interpeter_state) {
user_callbacks.MemoryWrite32 = &Memory::Write32;
user_callbacks.MemoryWrite64 = &Memory::Write64;
user_callbacks.page_table = Memory::GetCurrentPageTablePointers();
+ user_callbacks.coprocessors[15] = std::make_shared<DynarmicCP15>(interpeter_state);
return user_callbacks;
}
ARM_Dynarmic::ARM_Dynarmic(PrivilegeMode initial_mode) {
- interpreter_state = std::make_unique<ARMul_State>(initial_mode);
- jit = std::make_unique<Dynarmic::Jit>(GetUserCallbacks(interpreter_state.get()));
+ interpreter_state = std::make_shared<ARMul_State>(initial_mode);
+ jit = std::make_unique<Dynarmic::Jit>(GetUserCallbacks(interpreter_state));
}
void ARM_Dynarmic::SetPC(u32 pc) {
diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h
index 87ab53d81..834dc989e 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.h
+++ b/src/core/arm/dynarmic/arm_dynarmic.h
@@ -39,5 +39,5 @@ public:
private:
std::unique_ptr<Dynarmic::Jit> jit;
- std::unique_ptr<ARMul_State> interpreter_state;
+ std::shared_ptr<ARMul_State> interpreter_state;
};
diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp
new file mode 100644
index 000000000..b1fdce096
--- /dev/null
+++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp
@@ -0,0 +1,88 @@
+// Copyright 2017 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "core/arm/dynarmic/arm_dynarmic_cp15.h"
+#include "core/arm/skyeye_common/arm_regformat.h"
+#include "core/arm/skyeye_common/armstate.h"
+
+using Callback = Dynarmic::Coprocessor::Callback;
+using CallbackOrAccessOneWord = Dynarmic::Coprocessor::CallbackOrAccessOneWord;
+using CallbackOrAccessTwoWords = Dynarmic::Coprocessor::CallbackOrAccessTwoWords;
+
+DynarmicCP15::DynarmicCP15(const std::shared_ptr<ARMul_State>& state) : interpreter_state(state) {}
+
+DynarmicCP15::~DynarmicCP15() = default;
+
+boost::optional<Callback> DynarmicCP15::CompileInternalOperation(bool two, unsigned opc1,
+ CoprocReg CRd, CoprocReg CRn,
+ CoprocReg CRm, unsigned opc2) {
+ return boost::none;
+}
+
+CallbackOrAccessOneWord DynarmicCP15::CompileSendOneWord(bool two, unsigned opc1, CoprocReg CRn,
+ CoprocReg CRm, unsigned opc2) {
+ // TODO(merry): Privileged CP15 registers
+
+ if (!two && CRn == CoprocReg::C7 && opc1 == 0 && CRm == CoprocReg::C5 && opc2 == 4) {
+ // This is a dummy write, we ignore the value written here.
+ return &interpreter_state->CP15[CP15_FLUSH_PREFETCH_BUFFER];
+ }
+
+ if (!two && CRn == CoprocReg::C7 && opc1 == 0 && CRm == CoprocReg::C10) {
+ switch (opc2) {
+ case 4:
+ // This is a dummy write, we ignore the value written here.
+ return &interpreter_state->CP15[CP15_DATA_SYNC_BARRIER];
+ case 5:
+ // This is a dummy write, we ignore the value written here.
+ return &interpreter_state->CP15[CP15_DATA_MEMORY_BARRIER];
+ default:
+ return boost::blank{};
+ }
+ }
+
+ if (!two && CRn == CoprocReg::C13 && opc1 == 0 && CRm == CoprocReg::C0 && opc2 == 2) {
+ return &interpreter_state->CP15[CP15_THREAD_UPRW];
+ }
+
+ return boost::blank{};
+}
+
+CallbackOrAccessTwoWords DynarmicCP15::CompileSendTwoWords(bool two, unsigned opc, CoprocReg CRm) {
+ return boost::blank{};
+}
+
+CallbackOrAccessOneWord DynarmicCP15::CompileGetOneWord(bool two, unsigned opc1, CoprocReg CRn,
+ CoprocReg CRm, unsigned opc2) {
+ // TODO(merry): Privileged CP15 registers
+
+ if (!two && CRn == CoprocReg::C13 && opc1 == 0 && CRm == CoprocReg::C0) {
+ switch (opc2) {
+ case 2:
+ return &interpreter_state->CP15[CP15_THREAD_UPRW];
+ case 3:
+ return &interpreter_state->CP15[CP15_THREAD_URO];
+ default:
+ return boost::blank{};
+ }
+ }
+
+ return boost::blank{};
+}
+
+CallbackOrAccessTwoWords DynarmicCP15::CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) {
+ return boost::blank{};
+}
+
+boost::optional<Callback> DynarmicCP15::CompileLoadWords(bool two, bool long_transfer,
+ CoprocReg CRd,
+ boost::optional<u8> option) {
+ return boost::none;
+}
+
+boost::optional<Callback> DynarmicCP15::CompileStoreWords(bool two, bool long_transfer,
+ CoprocReg CRd,
+ boost::optional<u8> option) {
+ return boost::none;
+}
diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.h b/src/core/arm/dynarmic/arm_dynarmic_cp15.h
new file mode 100644
index 000000000..7fa54e14c
--- /dev/null
+++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.h
@@ -0,0 +1,32 @@
+// Copyright 2017 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <memory>
+#include <dynarmic/coprocessor.h>
+#include "common/common_types.h"
+
+struct ARMul_State;
+
+class DynarmicCP15 final : public Dynarmic::Coprocessor {
+public:
+ explicit DynarmicCP15(const std::shared_ptr<ARMul_State>&);
+ ~DynarmicCP15() override;
+
+ boost::optional<Callback> CompileInternalOperation(bool two, unsigned opc1, CoprocReg CRd,
+ CoprocReg CRn, CoprocReg CRm,
+ unsigned opc2) override;
+ CallbackOrAccessOneWord CompileSendOneWord(bool two, unsigned opc1, CoprocReg CRn,
+ CoprocReg CRm, unsigned opc2) override;
+ CallbackOrAccessTwoWords CompileSendTwoWords(bool two, unsigned opc, CoprocReg CRm) override;
+ CallbackOrAccessOneWord CompileGetOneWord(bool two, unsigned opc1, CoprocReg CRn, CoprocReg CRm,
+ unsigned opc2) override;
+ CallbackOrAccessTwoWords CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) override;
+ boost::optional<Callback> CompileLoadWords(bool two, bool long_transfer, CoprocReg CRd,
+ boost::optional<u8> option) override;
+ boost::optional<Callback> CompileStoreWords(bool two, bool long_transfer, CoprocReg CRd,
+ boost::optional<u8> option) override;
+
+private:
+ std::shared_ptr<ARMul_State> interpreter_state;
+};