diff options
author | fearlessTobi <thm.frey@gmail.com> | 2018-09-15 15:21:06 +0200 |
---|---|---|
committer | fearlessTobi <thm.frey@gmail.com> | 2018-09-15 15:21:06 +0200 |
commit | 63c2e32e207d31ecadd9022e1d7cd705c9febac8 (patch) | |
tree | 8a90e8ef2804f147dff7225a543a8740ecf7160c /src/core/arm | |
parent | Merge pull request #1310 from lioncash/kernel-ns (diff) | |
download | yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.gz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.bz2 yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.lz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.xz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.zst yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.zip |
Diffstat (limited to 'src/core/arm')
-rw-r--r-- | src/core/arm/arm_interface.h | 4 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.cpp | 27 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.h | 22 | ||||
-rw-r--r-- | src/core/arm/exclusive_monitor.h | 12 | ||||
-rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 4 | ||||
-rw-r--r-- | src/core/arm/unicorn/arm_unicorn.h | 4 |
6 files changed, 37 insertions, 36 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index c368745b1..0b2af2a9b 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -31,11 +31,11 @@ public: virtual void Step() = 0; /// Maps a backing memory region for the CPU - virtual void MapBackingMemory(VAddr address, size_t size, u8* memory, + virtual void MapBackingMemory(VAddr address, std::size_t size, u8* memory, Kernel::VMAPermission perms) = 0; /// Unmaps a region of memory that was previously mapped using MapBackingMemory - virtual void UnmapMemory(VAddr address, size_t size) = 0; + virtual void UnmapMemory(VAddr address, std::size_t size) = 0; /// Clear all instruction cache virtual void ClearInstructionCache() = 0; diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index b47f04988..0c175d872 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -58,7 +58,7 @@ public: Memory::Write64(vaddr + 8, value[1]); } - void InterpreterFallback(u64 pc, size_t num_instructions) override { + void InterpreterFallback(u64 pc, std::size_t num_instructions) override { LOG_INFO(Core_ARM, "Unicorn fallback @ 0x{:X} for {} instructions (instr = {:08X})", pc, num_instructions, MemoryReadCode(pc)); @@ -81,7 +81,7 @@ public: return; default: ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:X})", - static_cast<size_t>(exception), pc); + static_cast<std::size_t>(exception), pc); } } @@ -110,7 +110,7 @@ public: } ARM_Dynarmic& parent; - size_t num_interpreted_instructions = 0; + std::size_t num_interpreted_instructions = 0; u64 tpidrro_el0 = 0; u64 tpidr_el0 = 0; }; @@ -157,7 +157,8 @@ void ARM_Dynarmic::Step() { cb->InterpreterFallback(jit->GetPC(), 1); } -ARM_Dynarmic::ARM_Dynarmic(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, size_t core_index) +ARM_Dynarmic::ARM_Dynarmic(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, + std::size_t core_index) : cb(std::make_unique<ARM_Dynarmic_Callbacks>(*this)), core_index{core_index}, exclusive_monitor{std::dynamic_pointer_cast<DynarmicExclusiveMonitor>(exclusive_monitor)} { ThreadContext ctx; @@ -168,12 +169,12 @@ ARM_Dynarmic::ARM_Dynarmic(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, ARM_Dynarmic::~ARM_Dynarmic() = default; -void ARM_Dynarmic::MapBackingMemory(u64 address, size_t size, u8* memory, +void ARM_Dynarmic::MapBackingMemory(u64 address, std::size_t size, u8* memory, Kernel::VMAPermission perms) { inner_unicorn.MapBackingMemory(address, size, memory, perms); } -void ARM_Dynarmic::UnmapMemory(u64 address, size_t size) { +void ARM_Dynarmic::UnmapMemory(u64 address, std::size_t size) { inner_unicorn.UnmapMemory(address, size); } @@ -269,10 +270,10 @@ void ARM_Dynarmic::PageTableChanged() { current_page_table = Memory::GetCurrentPageTable(); } -DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(size_t core_count) : monitor(core_count) {} +DynarmicExclusiveMonitor::DynarmicExclusiveMonitor(std::size_t core_count) : monitor(core_count) {} DynarmicExclusiveMonitor::~DynarmicExclusiveMonitor() = default; -void DynarmicExclusiveMonitor::SetExclusive(size_t core_index, VAddr addr) { +void DynarmicExclusiveMonitor::SetExclusive(std::size_t core_index, VAddr addr) { // Size doesn't actually matter. monitor.Mark(core_index, addr, 16); } @@ -281,27 +282,27 @@ void DynarmicExclusiveMonitor::ClearExclusive() { monitor.Clear(); } -bool DynarmicExclusiveMonitor::ExclusiveWrite8(size_t core_index, VAddr vaddr, u8 value) { +bool DynarmicExclusiveMonitor::ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) { return monitor.DoExclusiveOperation(core_index, vaddr, 1, [&] { Memory::Write8(vaddr, value); }); } -bool DynarmicExclusiveMonitor::ExclusiveWrite16(size_t core_index, VAddr vaddr, u16 value) { +bool DynarmicExclusiveMonitor::ExclusiveWrite16(std::size_t core_index, VAddr vaddr, u16 value) { return monitor.DoExclusiveOperation(core_index, vaddr, 2, [&] { Memory::Write16(vaddr, value); }); } -bool DynarmicExclusiveMonitor::ExclusiveWrite32(size_t core_index, VAddr vaddr, u32 value) { +bool DynarmicExclusiveMonitor::ExclusiveWrite32(std::size_t core_index, VAddr vaddr, u32 value) { return monitor.DoExclusiveOperation(core_index, vaddr, 4, [&] { Memory::Write32(vaddr, value); }); } -bool DynarmicExclusiveMonitor::ExclusiveWrite64(size_t core_index, VAddr vaddr, u64 value) { +bool DynarmicExclusiveMonitor::ExclusiveWrite64(std::size_t core_index, VAddr vaddr, u64 value) { return monitor.DoExclusiveOperation(core_index, vaddr, 8, [&] { Memory::Write64(vaddr, value); }); } -bool DynarmicExclusiveMonitor::ExclusiveWrite128(size_t core_index, VAddr vaddr, u128 value) { +bool DynarmicExclusiveMonitor::ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) { return monitor.DoExclusiveOperation(core_index, vaddr, 16, [&] { Memory::Write64(vaddr, value[0]); Memory::Write64(vaddr, value[1]); diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h index 3bdfd8cd9..56c60c853 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.h +++ b/src/core/arm/dynarmic/arm_dynarmic.h @@ -19,12 +19,12 @@ class DynarmicExclusiveMonitor; class ARM_Dynarmic final : public ARM_Interface { public: - ARM_Dynarmic(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, size_t core_index); + ARM_Dynarmic(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, std::size_t core_index); ~ARM_Dynarmic(); - void MapBackingMemory(VAddr address, size_t size, u8* memory, + void MapBackingMemory(VAddr address, std::size_t size, u8* memory, Kernel::VMAPermission perms) override; - void UnmapMemory(u64 address, size_t size) override; + void UnmapMemory(u64 address, std::size_t size) override; void SetPC(u64 pc) override; u64 GetPC() const override; u64 GetReg(int index) const override; @@ -59,7 +59,7 @@ private: std::unique_ptr<Dynarmic::A64::Jit> jit; ARM_Unicorn inner_unicorn; - size_t core_index; + std::size_t core_index; std::shared_ptr<DynarmicExclusiveMonitor> exclusive_monitor; Memory::PageTable* current_page_table = nullptr; @@ -67,17 +67,17 @@ private: class DynarmicExclusiveMonitor final : public ExclusiveMonitor { public: - explicit DynarmicExclusiveMonitor(size_t core_count); + explicit DynarmicExclusiveMonitor(std::size_t core_count); ~DynarmicExclusiveMonitor(); - void SetExclusive(size_t core_index, VAddr addr) override; + void SetExclusive(std::size_t core_index, VAddr addr) override; void ClearExclusive() override; - bool ExclusiveWrite8(size_t core_index, VAddr vaddr, u8 value) override; - bool ExclusiveWrite16(size_t core_index, VAddr vaddr, u16 value) override; - bool ExclusiveWrite32(size_t core_index, VAddr vaddr, u32 value) override; - bool ExclusiveWrite64(size_t core_index, VAddr vaddr, u64 value) override; - bool ExclusiveWrite128(size_t core_index, VAddr vaddr, u128 value) override; + bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) override; + bool ExclusiveWrite16(std::size_t core_index, VAddr vaddr, u16 value) override; + bool ExclusiveWrite32(std::size_t core_index, VAddr vaddr, u32 value) override; + bool ExclusiveWrite64(std::size_t core_index, VAddr vaddr, u64 value) override; + bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) override; private: friend class ARM_Dynarmic; diff --git a/src/core/arm/exclusive_monitor.h b/src/core/arm/exclusive_monitor.h index 6f9b51573..f59aca667 100644 --- a/src/core/arm/exclusive_monitor.h +++ b/src/core/arm/exclusive_monitor.h @@ -12,14 +12,14 @@ class ExclusiveMonitor { public: virtual ~ExclusiveMonitor(); - virtual void SetExclusive(size_t core_index, VAddr addr) = 0; + virtual void SetExclusive(std::size_t core_index, VAddr addr) = 0; virtual void ClearExclusive() = 0; - virtual bool ExclusiveWrite8(size_t core_index, VAddr vaddr, u8 value) = 0; - virtual bool ExclusiveWrite16(size_t core_index, VAddr vaddr, u16 value) = 0; - virtual bool ExclusiveWrite32(size_t core_index, VAddr vaddr, u32 value) = 0; - virtual bool ExclusiveWrite64(size_t core_index, VAddr vaddr, u64 value) = 0; - virtual bool ExclusiveWrite128(size_t core_index, VAddr vaddr, u128 value) = 0; + virtual bool ExclusiveWrite8(std::size_t core_index, VAddr vaddr, u8 value) = 0; + virtual bool ExclusiveWrite16(std::size_t core_index, VAddr vaddr, u16 value) = 0; + virtual bool ExclusiveWrite32(std::size_t core_index, VAddr vaddr, u32 value) = 0; + virtual bool ExclusiveWrite64(std::size_t core_index, VAddr vaddr, u64 value) = 0; + virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0; }; } // namespace Core diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index 4c4de2623..4e02b7cd4 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp @@ -90,12 +90,12 @@ ARM_Unicorn::~ARM_Unicorn() { CHECKED(uc_close(uc)); } -void ARM_Unicorn::MapBackingMemory(VAddr address, size_t size, u8* memory, +void ARM_Unicorn::MapBackingMemory(VAddr address, std::size_t size, u8* memory, Kernel::VMAPermission perms) { CHECKED(uc_mem_map_ptr(uc, address, size, static_cast<u32>(perms), memory)); } -void ARM_Unicorn::UnmapMemory(VAddr address, size_t size) { +void ARM_Unicorn::UnmapMemory(VAddr address, std::size_t size) { CHECKED(uc_mem_unmap(uc, address, size)); } diff --git a/src/core/arm/unicorn/arm_unicorn.h b/src/core/arm/unicorn/arm_unicorn.h index bd6b2f723..d6f7cf4ab 100644 --- a/src/core/arm/unicorn/arm_unicorn.h +++ b/src/core/arm/unicorn/arm_unicorn.h @@ -15,9 +15,9 @@ class ARM_Unicorn final : public ARM_Interface { public: ARM_Unicorn(); ~ARM_Unicorn(); - void MapBackingMemory(VAddr address, size_t size, u8* memory, + void MapBackingMemory(VAddr address, std::size_t size, u8* memory, Kernel::VMAPermission perms) override; - void UnmapMemory(VAddr address, size_t size) override; + void UnmapMemory(VAddr address, std::size_t size) override; void SetPC(u64 pc) override; u64 GetPC() const override; u64 GetReg(int index) const override; |