diff options
| author | 2020-04-17 16:33:08 -0400 | |
|---|---|---|
| committer | 2020-04-17 16:33:08 -0400 | |
| commit | b8f5c71f2d7f819821acf036175cce65ab1ae12c (patch) | |
| tree | 151d7ed4e47536dc0e149a7117387b6a502d7da6 /src/core/memory | |
| parent | Merge pull request #3682 from lioncash/uam (diff) | |
| parent | core: hle: Address various feedback & code cleanup. (diff) | |
| download | yuzu-b8f5c71f2d7f819821acf036175cce65ab1ae12c.tar.gz yuzu-b8f5c71f2d7f819821acf036175cce65ab1ae12c.tar.xz yuzu-b8f5c71f2d7f819821acf036175cce65ab1ae12c.zip | |
Merge pull request #3666 from bunnei/new-vmm
Implement a new virtual memory manager
Diffstat (limited to 'src/core/memory')
| -rw-r--r-- | src/core/memory/cheat_engine.cpp | 17 | ||||
| -rw-r--r-- | src/core/memory/cheat_engine.h | 4 | ||||
| -rw-r--r-- | src/core/memory/dmnt_cheat_types.h | 4 | ||||
| -rw-r--r-- | src/core/memory/dmnt_cheat_vm.cpp | 4 | ||||
| -rw-r--r-- | src/core/memory/dmnt_cheat_vm.h | 4 |
5 files changed, 18 insertions, 15 deletions
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 4472500d2..b139e8465 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -10,13 +10,15 @@ | |||
| 10 | #include "core/core_timing.h" | 10 | #include "core/core_timing.h" |
| 11 | #include "core/core_timing_util.h" | 11 | #include "core/core_timing_util.h" |
| 12 | #include "core/hardware_properties.h" | 12 | #include "core/hardware_properties.h" |
| 13 | #include "core/hle/kernel/memory/page_table.h" | ||
| 13 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/process.h" |
| 14 | #include "core/hle/service/hid/controllers/npad.h" | 15 | #include "core/hle/service/hid/controllers/npad.h" |
| 15 | #include "core/hle/service/hid/hid.h" | 16 | #include "core/hle/service/hid/hid.h" |
| 16 | #include "core/hle/service/sm/sm.h" | 17 | #include "core/hle/service/sm/sm.h" |
| 18 | #include "core/memory.h" | ||
| 17 | #include "core/memory/cheat_engine.h" | 19 | #include "core/memory/cheat_engine.h" |
| 18 | 20 | ||
| 19 | namespace Memory { | 21 | namespace Core::Memory { |
| 20 | 22 | ||
| 21 | constexpr s64 CHEAT_ENGINE_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 12); | 23 | constexpr s64 CHEAT_ENGINE_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 12); |
| 22 | constexpr u32 KEYPAD_BITMASK = 0x3FFFFFF; | 24 | constexpr u32 KEYPAD_BITMASK = 0x3FFFFFF; |
| @@ -194,11 +196,12 @@ void CheatEngine::Initialize() { | |||
| 194 | metadata.process_id = system.CurrentProcess()->GetProcessID(); | 196 | metadata.process_id = system.CurrentProcess()->GetProcessID(); |
| 195 | metadata.title_id = system.CurrentProcess()->GetTitleID(); | 197 | metadata.title_id = system.CurrentProcess()->GetTitleID(); |
| 196 | 198 | ||
| 197 | const auto& vm_manager = system.CurrentProcess()->VMManager(); | 199 | const auto& page_table = system.CurrentProcess()->PageTable(); |
| 198 | metadata.heap_extents = {vm_manager.GetHeapRegionBaseAddress(), vm_manager.GetHeapRegionSize()}; | 200 | metadata.heap_extents = {page_table.GetHeapRegionStart(), page_table.GetHeapRegionSize()}; |
| 199 | metadata.address_space_extents = {vm_manager.GetAddressSpaceBaseAddress(), | 201 | metadata.address_space_extents = {page_table.GetAddressSpaceStart(), |
| 200 | vm_manager.GetAddressSpaceSize()}; | 202 | page_table.GetAddressSpaceSize()}; |
| 201 | metadata.alias_extents = {vm_manager.GetMapRegionBaseAddress(), vm_manager.GetMapRegionSize()}; | 203 | metadata.alias_extents = {page_table.GetAliasCodeRegionStart(), |
| 204 | page_table.GetAliasCodeRegionSize()}; | ||
| 202 | 205 | ||
| 203 | is_pending_reload.exchange(true); | 206 | is_pending_reload.exchange(true); |
| 204 | } | 207 | } |
| @@ -230,4 +233,4 @@ void CheatEngine::FrameCallback(u64 userdata, s64 cycles_late) { | |||
| 230 | core_timing.ScheduleEvent(CHEAT_ENGINE_TICKS - cycles_late, event); | 233 | core_timing.ScheduleEvent(CHEAT_ENGINE_TICKS - cycles_late, event); |
| 231 | } | 234 | } |
| 232 | 235 | ||
| 233 | } // namespace Memory | 236 | } // namespace Core::Memory |
diff --git a/src/core/memory/cheat_engine.h b/src/core/memory/cheat_engine.h index 3d6b2298a..2649423f8 100644 --- a/src/core/memory/cheat_engine.h +++ b/src/core/memory/cheat_engine.h | |||
| @@ -20,7 +20,7 @@ class CoreTiming; | |||
| 20 | struct EventType; | 20 | struct EventType; |
| 21 | } // namespace Core::Timing | 21 | } // namespace Core::Timing |
| 22 | 22 | ||
| 23 | namespace Memory { | 23 | namespace Core::Memory { |
| 24 | 24 | ||
| 25 | class StandardVmCallbacks : public DmntCheatVm::Callbacks { | 25 | class StandardVmCallbacks : public DmntCheatVm::Callbacks { |
| 26 | public: | 26 | public: |
| @@ -84,4 +84,4 @@ private: | |||
| 84 | Core::System& system; | 84 | Core::System& system; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | } // namespace Memory | 87 | } // namespace Core::Memory |
diff --git a/src/core/memory/dmnt_cheat_types.h b/src/core/memory/dmnt_cheat_types.h index bf68fa0fe..5e60733dc 100644 --- a/src/core/memory/dmnt_cheat_types.h +++ b/src/core/memory/dmnt_cheat_types.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include "common/common_types.h" | 27 | #include "common/common_types.h" |
| 28 | 28 | ||
| 29 | namespace Memory { | 29 | namespace Core::Memory { |
| 30 | 30 | ||
| 31 | struct MemoryRegionExtents { | 31 | struct MemoryRegionExtents { |
| 32 | u64 base{}; | 32 | u64 base{}; |
| @@ -55,4 +55,4 @@ struct CheatEntry { | |||
| 55 | CheatDefinition definition{}; | 55 | CheatDefinition definition{}; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | } // namespace Memory | 58 | } // namespace Core::Memory |
diff --git a/src/core/memory/dmnt_cheat_vm.cpp b/src/core/memory/dmnt_cheat_vm.cpp index 5bb26a36f..fb9f36bfd 100644 --- a/src/core/memory/dmnt_cheat_vm.cpp +++ b/src/core/memory/dmnt_cheat_vm.cpp | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #include "core/memory/dmnt_cheat_types.h" | 27 | #include "core/memory/dmnt_cheat_types.h" |
| 28 | #include "core/memory/dmnt_cheat_vm.h" | 28 | #include "core/memory/dmnt_cheat_vm.h" |
| 29 | 29 | ||
| 30 | namespace Memory { | 30 | namespace Core::Memory { |
| 31 | 31 | ||
| 32 | DmntCheatVm::DmntCheatVm(std::unique_ptr<Callbacks> callbacks) : callbacks(std::move(callbacks)) {} | 32 | DmntCheatVm::DmntCheatVm(std::unique_ptr<Callbacks> callbacks) : callbacks(std::move(callbacks)) {} |
| 33 | 33 | ||
| @@ -1210,4 +1210,4 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) { | |||
| 1210 | } | 1210 | } |
| 1211 | } | 1211 | } |
| 1212 | 1212 | ||
| 1213 | } // namespace Memory | 1213 | } // namespace Core::Memory |
diff --git a/src/core/memory/dmnt_cheat_vm.h b/src/core/memory/dmnt_cheat_vm.h index c36212cf1..8351fd798 100644 --- a/src/core/memory/dmnt_cheat_vm.h +++ b/src/core/memory/dmnt_cheat_vm.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include "common/common_types.h" | 30 | #include "common/common_types.h" |
| 31 | #include "core/memory/dmnt_cheat_types.h" | 31 | #include "core/memory/dmnt_cheat_types.h" |
| 32 | 32 | ||
| 33 | namespace Memory { | 33 | namespace Core::Memory { |
| 34 | 34 | ||
| 35 | enum class CheatVmOpcodeType : u32 { | 35 | enum class CheatVmOpcodeType : u32 { |
| 36 | StoreStatic = 0, | 36 | StoreStatic = 0, |
| @@ -318,4 +318,4 @@ private: | |||
| 318 | MemoryAccessType mem_type, u64 rel_address); | 318 | MemoryAccessType mem_type, u64 rel_address); |
| 319 | }; | 319 | }; |
| 320 | 320 | ||
| 321 | }; // namespace Memory | 321 | }; // namespace Core::Memory |