diff options
| author | 2020-04-24 00:07:38 -0400 | |
|---|---|---|
| committer | 2020-04-24 00:20:58 -0400 | |
| commit | cc84b48ce5b981bbdc737931c1030f8d3ff3f32b (patch) | |
| tree | 975d5ac2e30ba6031a59d562b31698782f3cfcad | |
| parent | Merge pull request #3768 from H27CK/cmd-title-fmt (diff) | |
| download | yuzu-cc84b48ce5b981bbdc737931c1030f8d3ff3f32b.tar.gz yuzu-cc84b48ce5b981bbdc737931c1030f8d3ff3f32b.tar.xz yuzu-cc84b48ce5b981bbdc737931c1030f8d3ff3f32b.zip | |
physical_core: Make use of std::make_unique instead of std::make_shared in ctor
We can also allow unicorn to be constructed in 32-bit mode or 64-bit
mode to satisfy the need for both interpreter instances.
Allows this code to compile successfully of non x86-64 architectures.
Diffstat (limited to '')
| -rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.cpp | 7 | ||||
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 5 | ||||
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.h | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/physical_core.cpp | 4 |
4 files changed, 15 insertions, 8 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 65cbfe5e6..337b97be9 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp | |||
| @@ -185,10 +185,9 @@ void ARM_Dynarmic_64::Step() { | |||
| 185 | 185 | ||
| 186 | ARM_Dynarmic_64::ARM_Dynarmic_64(System& system, ExclusiveMonitor& exclusive_monitor, | 186 | ARM_Dynarmic_64::ARM_Dynarmic_64(System& system, ExclusiveMonitor& exclusive_monitor, |
| 187 | std::size_t core_index) | 187 | std::size_t core_index) |
| 188 | : ARM_Interface{system}, | 188 | : ARM_Interface{system}, cb(std::make_unique<DynarmicCallbacks64>(*this)), |
| 189 | cb(std::make_unique<DynarmicCallbacks64>(*this)), inner_unicorn{system}, | 189 | inner_unicorn{system, ARM_Unicorn::Arch::AArch64}, core_index{core_index}, |
| 190 | core_index{core_index}, exclusive_monitor{ | 190 | exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} |
| 191 | dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} | ||
| 192 | 191 | ||
| 193 | ARM_Dynarmic_64::~ARM_Dynarmic_64() = default; | 192 | ARM_Dynarmic_64::~ARM_Dynarmic_64() = default; |
| 194 | 193 | ||
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index b96583123..e40e9626a 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp | |||
| @@ -62,8 +62,9 @@ static bool UnmappedMemoryHook(uc_engine* uc, uc_mem_type type, u64 addr, int si | |||
| 62 | return false; | 62 | return false; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | ARM_Unicorn::ARM_Unicorn(System& system) : ARM_Interface{system} { | 65 | ARM_Unicorn::ARM_Unicorn(System& system, Arch architecture) : ARM_Interface{system} { |
| 66 | CHECKED(uc_open(UC_ARCH_ARM64, UC_MODE_ARM, &uc)); | 66 | const auto arch = architecture == Arch::AArch32 ? UC_ARCH_ARM : UC_ARCH_ARM64; |
| 67 | CHECKED(uc_open(arch, UC_MODE_ARM, &uc)); | ||
| 67 | 68 | ||
| 68 | auto fpv = 3 << 20; | 69 | auto fpv = 3 << 20; |
| 69 | CHECKED(uc_reg_write(uc, UC_ARM64_REG_CPACR_EL1, &fpv)); | 70 | CHECKED(uc_reg_write(uc, UC_ARM64_REG_CPACR_EL1, &fpv)); |
diff --git a/src/core/arm/unicorn/arm_unicorn.h b/src/core/arm/unicorn/arm_unicorn.h index f30d13cb6..725c65085 100644 --- a/src/core/arm/unicorn/arm_unicorn.h +++ b/src/core/arm/unicorn/arm_unicorn.h | |||
| @@ -15,7 +15,12 @@ class System; | |||
| 15 | 15 | ||
| 16 | class ARM_Unicorn final : public ARM_Interface { | 16 | class ARM_Unicorn final : public ARM_Interface { |
| 17 | public: | 17 | public: |
| 18 | explicit ARM_Unicorn(System& system); | 18 | enum class Arch { |
| 19 | AArch32, // 32-bit ARM | ||
| 20 | AArch64, // 64-bit ARM | ||
| 21 | }; | ||
| 22 | |||
| 23 | explicit ARM_Unicorn(System& system, Arch architecture); | ||
| 19 | ~ARM_Unicorn() override; | 24 | ~ARM_Unicorn() override; |
| 20 | 25 | ||
| 21 | void SetPC(u64 pc) override; | 26 | void SetPC(u64 pc) override; |
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp index aa2787467..a15011076 100644 --- a/src/core/hle/kernel/physical_core.cpp +++ b/src/core/hle/kernel/physical_core.cpp | |||
| @@ -27,7 +27,9 @@ PhysicalCore::PhysicalCore(Core::System& system, std::size_t id, | |||
| 27 | std::make_unique<Core::ARM_Dynarmic_64>(system, exclusive_monitor, core_index); | 27 | std::make_unique<Core::ARM_Dynarmic_64>(system, exclusive_monitor, core_index); |
| 28 | 28 | ||
| 29 | #else | 29 | #else |
| 30 | arm_interface = std::make_shared<Core::ARM_Unicorn>(system); | 30 | using Core::ARM_Unicorn; |
| 31 | arm_interface_32 = std::make_unique<ARM_Unicorn>(system, ARM_Unicorn::Arch::AArch32); | ||
| 32 | arm_interface_64 = std::make_unique<ARM_Unicorn>(system, ARM_Unicorn::Arch::AArch64); | ||
| 31 | LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); | 33 | LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); |
| 32 | #endif | 34 | #endif |
| 33 | 35 | ||