diff options
| author | 2020-03-31 15:10:44 -0400 | |
|---|---|---|
| committer | 2020-04-17 00:59:28 -0400 | |
| commit | 4caff51710a793c6c2c1069ddd6e92185aa731fe (patch) | |
| tree | 9770a5cdbfc40f6bddab093d5010f80ddad5bd26 /src | |
| parent | common: alignment: Add a helper function for generic alignment checking. (diff) | |
| download | yuzu-4caff51710a793c6c2c1069ddd6e92185aa731fe.tar.gz yuzu-4caff51710a793c6c2c1069ddd6e92185aa731fe.tar.xz yuzu-4caff51710a793c6c2c1069ddd6e92185aa731fe.zip | |
core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
Diffstat (limited to 'src')
37 files changed, 100 insertions, 98 deletions
diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp index c187d8ac5..7a9dc61d4 100644 --- a/src/audio_core/audio_renderer.cpp +++ b/src/audio_core/audio_renderer.cpp | |||
| @@ -36,9 +36,9 @@ public: | |||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | void SetWaveIndex(std::size_t index); | 38 | void SetWaveIndex(std::size_t index); |
| 39 | std::vector<s16> DequeueSamples(std::size_t sample_count, Memory::Memory& memory); | 39 | std::vector<s16> DequeueSamples(std::size_t sample_count, Core::Memory::Memory& memory); |
| 40 | void UpdateState(); | 40 | void UpdateState(); |
| 41 | void RefreshBuffer(Memory::Memory& memory); | 41 | void RefreshBuffer(Core::Memory::Memory& memory); |
| 42 | 42 | ||
| 43 | private: | 43 | private: |
| 44 | bool is_in_use{}; | 44 | bool is_in_use{}; |
| @@ -66,13 +66,14 @@ public: | |||
| 66 | return info; | 66 | return info; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | void UpdateState(Memory::Memory& memory); | 69 | void UpdateState(Core::Memory::Memory& memory); |
| 70 | 70 | ||
| 71 | private: | 71 | private: |
| 72 | EffectOutStatus out_status{}; | 72 | EffectOutStatus out_status{}; |
| 73 | EffectInStatus info{}; | 73 | EffectInStatus info{}; |
| 74 | }; | 74 | }; |
| 75 | AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Memory::Memory& memory_, | 75 | |
| 76 | AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_, | ||
| 76 | AudioRendererParameter params, | 77 | AudioRendererParameter params, |
| 77 | std::shared_ptr<Kernel::WritableEvent> buffer_event, | 78 | std::shared_ptr<Kernel::WritableEvent> buffer_event, |
| 78 | std::size_t instance_number) | 79 | std::size_t instance_number) |
| @@ -208,7 +209,7 @@ void AudioRenderer::VoiceState::SetWaveIndex(std::size_t index) { | |||
| 208 | } | 209 | } |
| 209 | 210 | ||
| 210 | std::vector<s16> AudioRenderer::VoiceState::DequeueSamples(std::size_t sample_count, | 211 | std::vector<s16> AudioRenderer::VoiceState::DequeueSamples(std::size_t sample_count, |
| 211 | Memory::Memory& memory) { | 212 | Core::Memory::Memory& memory) { |
| 212 | if (!IsPlaying()) { | 213 | if (!IsPlaying()) { |
| 213 | return {}; | 214 | return {}; |
| 214 | } | 215 | } |
| @@ -258,7 +259,7 @@ void AudioRenderer::VoiceState::UpdateState() { | |||
| 258 | is_in_use = info.is_in_use; | 259 | is_in_use = info.is_in_use; |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) { | 262 | void AudioRenderer::VoiceState::RefreshBuffer(Core::Memory::Memory& memory) { |
| 262 | const auto wave_buffer_address = info.wave_buffer[wave_index].buffer_addr; | 263 | const auto wave_buffer_address = info.wave_buffer[wave_index].buffer_addr; |
| 263 | const auto wave_buffer_size = info.wave_buffer[wave_index].buffer_sz; | 264 | const auto wave_buffer_size = info.wave_buffer[wave_index].buffer_sz; |
| 264 | std::vector<s16> new_samples(wave_buffer_size / sizeof(s16)); | 265 | std::vector<s16> new_samples(wave_buffer_size / sizeof(s16)); |
| @@ -310,7 +311,7 @@ void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) { | |||
| 310 | is_refresh_pending = false; | 311 | is_refresh_pending = false; |
| 311 | } | 312 | } |
| 312 | 313 | ||
| 313 | void AudioRenderer::EffectState::UpdateState(Memory::Memory& memory) { | 314 | void AudioRenderer::EffectState::UpdateState(Core::Memory::Memory& memory) { |
| 314 | if (info.is_new) { | 315 | if (info.is_new) { |
| 315 | out_status.state = EffectStatus::New; | 316 | out_status.state = EffectStatus::New; |
| 316 | } else { | 317 | } else { |
diff --git a/src/audio_core/audio_renderer.h b/src/audio_core/audio_renderer.h index c0fae669e..62faf9f19 100644 --- a/src/audio_core/audio_renderer.h +++ b/src/audio_core/audio_renderer.h | |||
| @@ -22,7 +22,7 @@ namespace Kernel { | |||
| 22 | class WritableEvent; | 22 | class WritableEvent; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | namespace Memory { | 25 | namespace Core::Memory { |
| 26 | class Memory; | 26 | class Memory; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| @@ -221,7 +221,7 @@ static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size | |||
| 221 | 221 | ||
| 222 | class AudioRenderer { | 222 | class AudioRenderer { |
| 223 | public: | 223 | public: |
| 224 | AudioRenderer(Core::Timing::CoreTiming& core_timing, Memory::Memory& memory_, | 224 | AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_, |
| 225 | AudioRendererParameter params, | 225 | AudioRendererParameter params, |
| 226 | std::shared_ptr<Kernel::WritableEvent> buffer_event, std::size_t instance_number); | 226 | std::shared_ptr<Kernel::WritableEvent> buffer_event, std::size_t instance_number); |
| 227 | ~AudioRenderer(); | 227 | ~AudioRenderer(); |
| @@ -244,7 +244,7 @@ private: | |||
| 244 | std::vector<EffectState> effects; | 244 | std::vector<EffectState> effects; |
| 245 | std::unique_ptr<AudioOut> audio_out; | 245 | std::unique_ptr<AudioOut> audio_out; |
| 246 | StreamPtr stream; | 246 | StreamPtr stream; |
| 247 | Memory::Memory& memory; | 247 | Core::Memory::Memory& memory; |
| 248 | }; | 248 | }; |
| 249 | 249 | ||
| 250 | } // namespace AudioCore | 250 | } // namespace AudioCore |
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index fb9e616b9..d079a1bc8 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp | |||
| @@ -60,7 +60,7 @@ static_assert(sizeof(ELFSymbol) == 0x18, "ELFSymbol has incorrect size."); | |||
| 60 | 60 | ||
| 61 | using Symbols = std::vector<std::pair<ELFSymbol, std::string>>; | 61 | using Symbols = std::vector<std::pair<ELFSymbol, std::string>>; |
| 62 | 62 | ||
| 63 | Symbols GetSymbols(VAddr text_offset, Memory::Memory& memory) { | 63 | Symbols GetSymbols(VAddr text_offset, Core::Memory::Memory& memory) { |
| 64 | const auto mod_offset = text_offset + memory.Read32(text_offset + 4); | 64 | const auto mod_offset = text_offset + memory.Read32(text_offset + 4); |
| 65 | 65 | ||
| 66 | if (mod_offset < text_offset || (mod_offset & 0b11) != 0 || | 66 | if (mod_offset < text_offset || (mod_offset & 0b11) != 0 || |
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h index 143e46e4d..8ba9cea8f 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.h +++ b/src/core/arm/dynarmic/arm_dynarmic_32.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include "core/arm/arm_interface.h" | 15 | #include "core/arm/arm_interface.h" |
| 16 | #include "core/arm/exclusive_monitor.h" | 16 | #include "core/arm/exclusive_monitor.h" |
| 17 | 17 | ||
| 18 | namespace Memory { | 18 | namespace Core::Memory { |
| 19 | class Memory; | 19 | class Memory; |
| 20 | } | 20 | } |
| 21 | 21 | ||
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.h b/src/core/arm/dynarmic/arm_dynarmic_64.h index e71240a96..647cecaf0 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.h +++ b/src/core/arm/dynarmic/arm_dynarmic_64.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include "core/arm/exclusive_monitor.h" | 15 | #include "core/arm/exclusive_monitor.h" |
| 16 | #include "core/arm/unicorn/arm_unicorn.h" | 16 | #include "core/arm/unicorn/arm_unicorn.h" |
| 17 | 17 | ||
| 18 | namespace Memory { | 18 | namespace Core::Memory { |
| 19 | class Memory; | 19 | class Memory; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| @@ -92,7 +92,7 @@ public: | |||
| 92 | private: | 92 | private: |
| 93 | friend class ARM_Dynarmic_64; | 93 | friend class ARM_Dynarmic_64; |
| 94 | Dynarmic::A64::ExclusiveMonitor monitor; | 94 | Dynarmic::A64::ExclusiveMonitor monitor; |
| 95 | Memory::Memory& memory; | 95 | Core::Memory::Memory& memory; |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | } // namespace Core | 98 | } // namespace Core |
diff --git a/src/core/arm/exclusive_monitor.h b/src/core/arm/exclusive_monitor.h index 4ef418b90..ccd73b80f 100644 --- a/src/core/arm/exclusive_monitor.h +++ b/src/core/arm/exclusive_monitor.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace Memory { | 11 | namespace Core::Memory { |
| 12 | class Memory; | 12 | class Memory; |
| 13 | } | 13 | } |
| 14 | 14 | ||
diff --git a/src/core/core.cpp b/src/core/core.cpp index 3bd90d79f..87b147f63 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -346,7 +346,7 @@ struct System::Impl { | |||
| 346 | std::unique_ptr<Loader::AppLoader> app_loader; | 346 | std::unique_ptr<Loader::AppLoader> app_loader; |
| 347 | std::unique_ptr<Tegra::GPU> gpu_core; | 347 | std::unique_ptr<Tegra::GPU> gpu_core; |
| 348 | std::unique_ptr<Hardware::InterruptManager> interrupt_manager; | 348 | std::unique_ptr<Hardware::InterruptManager> interrupt_manager; |
| 349 | Memory::Memory memory; | 349 | Core::Memory::Memory memory; |
| 350 | CpuManager cpu_manager; | 350 | CpuManager cpu_manager; |
| 351 | bool is_powered_on = false; | 351 | bool is_powered_on = false; |
| 352 | bool exit_lock = false; | 352 | bool exit_lock = false; |
| @@ -505,7 +505,7 @@ Memory::Memory& System::Memory() { | |||
| 505 | return impl->memory; | 505 | return impl->memory; |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | const Memory::Memory& System::Memory() const { | 508 | const Core::Memory::Memory& System::Memory() const { |
| 509 | return impl->memory; | 509 | return impl->memory; |
| 510 | } | 510 | } |
| 511 | 511 | ||
diff --git a/src/core/core.h b/src/core/core.h index 8d862a8e6..c2bdef07e 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -36,9 +36,10 @@ class AppLoader; | |||
| 36 | enum class ResultStatus : u16; | 36 | enum class ResultStatus : u16; |
| 37 | } // namespace Loader | 37 | } // namespace Loader |
| 38 | 38 | ||
| 39 | namespace Memory { | 39 | namespace Core::Memory { |
| 40 | struct CheatEntry; | 40 | struct CheatEntry; |
| 41 | } // namespace Memory | 41 | class Memory; |
| 42 | } // namespace Core::Memory | ||
| 42 | 43 | ||
| 43 | namespace Service { | 44 | namespace Service { |
| 44 | 45 | ||
| @@ -86,10 +87,6 @@ namespace Core::Hardware { | |||
| 86 | class InterruptManager; | 87 | class InterruptManager; |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | namespace Memory { | ||
| 90 | class Memory; | ||
| 91 | } | ||
| 92 | |||
| 93 | namespace Core { | 90 | namespace Core { |
| 94 | 91 | ||
| 95 | class ARM_Interface; | 92 | class ARM_Interface; |
| @@ -230,10 +227,10 @@ public: | |||
| 230 | const ExclusiveMonitor& Monitor() const; | 227 | const ExclusiveMonitor& Monitor() const; |
| 231 | 228 | ||
| 232 | /// Gets a mutable reference to the system memory instance. | 229 | /// Gets a mutable reference to the system memory instance. |
| 233 | Memory::Memory& Memory(); | 230 | Core::Memory::Memory& Memory(); |
| 234 | 231 | ||
| 235 | /// Gets a constant reference to the system memory instance. | 232 | /// Gets a constant reference to the system memory instance. |
| 236 | const Memory::Memory& Memory() const; | 233 | const Core::Memory::Memory& Memory() const; |
| 237 | 234 | ||
| 238 | /// Gets a mutable reference to the GPU interface | 235 | /// Gets a mutable reference to the GPU interface |
| 239 | Tegra::GPU& GPU(); | 236 | Tegra::GPU& GPU(); |
diff --git a/src/core/core_manager.h b/src/core/core_manager.h index b14e723d7..d525de00a 100644 --- a/src/core/core_manager.h +++ b/src/core/core_manager.h | |||
| @@ -22,7 +22,7 @@ namespace Core::Timing { | |||
| 22 | class CoreTiming; | 22 | class CoreTiming; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | namespace Memory { | 25 | namespace Core::Memory { |
| 26 | class Memory; | 26 | class Memory; |
| 27 | } | 27 | } |
| 28 | 28 | ||
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 81ec06cd4..b93aa6935 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -249,7 +249,7 @@ bool PatchManager::HasNSOPatch(const std::array<u8, 32>& build_id_) const { | |||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | namespace { | 251 | namespace { |
| 252 | std::optional<std::vector<Memory::CheatEntry>> ReadCheatFileFromFolder( | 252 | std::optional<std::vector<Core::Memory::CheatEntry>> ReadCheatFileFromFolder( |
| 253 | const Core::System& system, u64 title_id, const std::array<u8, 0x20>& build_id_, | 253 | const Core::System& system, u64 title_id, const std::array<u8, 0x20>& build_id_, |
| 254 | const VirtualDir& base_path, bool upper) { | 254 | const VirtualDir& base_path, bool upper) { |
| 255 | const auto build_id_raw = Common::HexToString(build_id_, upper); | 255 | const auto build_id_raw = Common::HexToString(build_id_, upper); |
| @@ -269,14 +269,14 @@ std::optional<std::vector<Memory::CheatEntry>> ReadCheatFileFromFolder( | |||
| 269 | return std::nullopt; | 269 | return std::nullopt; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | Memory::TextCheatParser parser; | 272 | Core::Memory::TextCheatParser parser; |
| 273 | return parser.Parse( | 273 | return parser.Parse( |
| 274 | system, std::string_view(reinterpret_cast<const char* const>(data.data()), data.size())); | 274 | system, std::string_view(reinterpret_cast<const char* const>(data.data()), data.size())); |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | } // Anonymous namespace | 277 | } // Anonymous namespace |
| 278 | 278 | ||
| 279 | std::vector<Memory::CheatEntry> PatchManager::CreateCheatList( | 279 | std::vector<Core::Memory::CheatEntry> PatchManager::CreateCheatList( |
| 280 | const Core::System& system, const std::array<u8, 32>& build_id_) const { | 280 | const Core::System& system, const std::array<u8, 32>& build_id_) const { |
| 281 | const auto load_dir = system.GetFileSystemController().GetModificationLoadRoot(title_id); | 281 | const auto load_dir = system.GetFileSystemController().GetModificationLoadRoot(title_id); |
| 282 | if (load_dir == nullptr) { | 282 | if (load_dir == nullptr) { |
| @@ -289,7 +289,7 @@ std::vector<Memory::CheatEntry> PatchManager::CreateCheatList( | |||
| 289 | std::sort(patch_dirs.begin(), patch_dirs.end(), | 289 | std::sort(patch_dirs.begin(), patch_dirs.end(), |
| 290 | [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); | 290 | [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); |
| 291 | 291 | ||
| 292 | std::vector<Memory::CheatEntry> out; | 292 | std::vector<Core::Memory::CheatEntry> out; |
| 293 | for (const auto& subdir : patch_dirs) { | 293 | for (const auto& subdir : patch_dirs) { |
| 294 | if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) != disabled.cend()) { | 294 | if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) != disabled.cend()) { |
| 295 | continue; | 295 | continue; |
diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index e857e6e82..ec6db524d 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h | |||
| @@ -51,8 +51,8 @@ public: | |||
| 51 | bool HasNSOPatch(const std::array<u8, 0x20>& build_id) const; | 51 | bool HasNSOPatch(const std::array<u8, 0x20>& build_id) const; |
| 52 | 52 | ||
| 53 | // Creates a CheatList object with all | 53 | // Creates a CheatList object with all |
| 54 | std::vector<Memory::CheatEntry> CreateCheatList(const Core::System& system, | 54 | std::vector<Core::Memory::CheatEntry> CreateCheatList( |
| 55 | const std::array<u8, 0x20>& build_id) const; | 55 | const Core::System& system, const std::array<u8, 0x20>& build_id) const; |
| 56 | 56 | ||
| 57 | // Currently tracked RomFS patches: | 57 | // Currently tracked RomFS patches: |
| 58 | // - Game Updates | 58 | // - Game Updates |
diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp index 6d66276bc..5ab204b9b 100644 --- a/src/core/hle/kernel/client_session.cpp +++ b/src/core/hle/kernel/client_session.cpp | |||
| @@ -47,7 +47,8 @@ ResultVal<std::shared_ptr<ClientSession>> ClientSession::Create(KernelCore& kern | |||
| 47 | return MakeResult(std::move(client_session)); | 47 | return MakeResult(std::move(client_session)); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory) { | 50 | ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread, |
| 51 | Core::Memory::Memory& memory) { | ||
| 51 | // Keep ServerSession alive until we're done working with it. | 52 | // Keep ServerSession alive until we're done working with it. |
| 52 | if (!parent->Server()) { | 53 | if (!parent->Server()) { |
| 53 | return ERR_SESSION_CLOSED_BY_REMOTE; | 54 | return ERR_SESSION_CLOSED_BY_REMOTE; |
diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h index d15b09554..c5f760d7d 100644 --- a/src/core/hle/kernel/client_session.h +++ b/src/core/hle/kernel/client_session.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | union ResultCode; | 13 | union ResultCode; |
| 14 | 14 | ||
| 15 | namespace Memory { | 15 | namespace Core::Memory { |
| 16 | class Memory; | 16 | class Memory; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| @@ -42,7 +42,7 @@ public: | |||
| 42 | return HANDLE_TYPE; | 42 | return HANDLE_TYPE; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory); | 45 | ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory); |
| 46 | 46 | ||
| 47 | bool ShouldWait(const Thread* thread) const override; | 47 | bool ShouldWait(const Thread* thread) const override; |
| 48 | 48 | ||
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index ddbd75b8d..bf727901d 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -59,7 +59,8 @@ void SetupMainThread(Process& owner_process, KernelCore& kernel, u32 priority) { | |||
| 59 | // (whichever page happens to have an available slot). | 59 | // (whichever page happens to have an available slot). |
| 60 | class TLSPage { | 60 | class TLSPage { |
| 61 | public: | 61 | public: |
| 62 | static constexpr std::size_t num_slot_entries = Memory::PAGE_SIZE / Memory::TLS_ENTRY_SIZE; | 62 | static constexpr std::size_t num_slot_entries = |
| 63 | Core::Memory::PAGE_SIZE / Core::Memory::TLS_ENTRY_SIZE; | ||
| 63 | 64 | ||
| 64 | explicit TLSPage(VAddr address) : base_address{address} {} | 65 | explicit TLSPage(VAddr address) : base_address{address} {} |
| 65 | 66 | ||
| @@ -78,7 +79,7 @@ public: | |||
| 78 | } | 79 | } |
| 79 | 80 | ||
| 80 | is_slot_used[i] = true; | 81 | is_slot_used[i] = true; |
| 81 | return base_address + (i * Memory::TLS_ENTRY_SIZE); | 82 | return base_address + (i * Core::Memory::TLS_ENTRY_SIZE); |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | return std::nullopt; | 85 | return std::nullopt; |
| @@ -88,15 +89,15 @@ public: | |||
| 88 | // Ensure that all given addresses are consistent with how TLS pages | 89 | // Ensure that all given addresses are consistent with how TLS pages |
| 89 | // are intended to be used when releasing slots. | 90 | // are intended to be used when releasing slots. |
| 90 | ASSERT(IsWithinPage(address)); | 91 | ASSERT(IsWithinPage(address)); |
| 91 | ASSERT((address % Memory::TLS_ENTRY_SIZE) == 0); | 92 | ASSERT((address % Core::Memory::TLS_ENTRY_SIZE) == 0); |
| 92 | 93 | ||
| 93 | const std::size_t index = (address - base_address) / Memory::TLS_ENTRY_SIZE; | 94 | const std::size_t index = (address - base_address) / Core::Memory::TLS_ENTRY_SIZE; |
| 94 | is_slot_used[index] = false; | 95 | is_slot_used[index] = false; |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | private: | 98 | private: |
| 98 | bool IsWithinPage(VAddr address) const { | 99 | bool IsWithinPage(VAddr address) const { |
| 99 | return base_address <= address && address < base_address + Memory::PAGE_SIZE; | 100 | return base_address <= address && address < base_address + Core::Memory::PAGE_SIZE; |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | VAddr base_address; | 103 | VAddr base_address; |
| @@ -306,7 +307,7 @@ VAddr Process::CreateTLSRegion() { | |||
| 306 | } | 307 | } |
| 307 | 308 | ||
| 308 | void Process::FreeTLSRegion(VAddr tls_address) { | 309 | void Process::FreeTLSRegion(VAddr tls_address) { |
| 309 | const VAddr aligned_address = Common::AlignDown(tls_address, Memory::PAGE_SIZE); | 310 | const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE); |
| 310 | auto iter = | 311 | auto iter = |
| 311 | std::find_if(tls_pages.begin(), tls_pages.end(), [aligned_address](const auto& page) { | 312 | std::find_if(tls_pages.begin(), tls_pages.end(), [aligned_address](const auto& page) { |
| 312 | return page.GetBaseAddress() == aligned_address; | 313 | return page.GetBaseAddress() == aligned_address; |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 4604e35c5..0f102ca44 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -134,7 +134,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | |||
| 134 | return RESULT_SUCCESS; | 134 | return RESULT_SUCCESS; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory) { | 137 | ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, |
| 138 | Core::Memory::Memory& memory) { | ||
| 138 | u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; | 139 | u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; |
| 139 | std::shared_ptr<Kernel::HLERequestContext> context{ | 140 | std::shared_ptr<Kernel::HLERequestContext> context{ |
| 140 | std::make_shared<Kernel::HLERequestContext>(SharedFrom(this), std::move(thread))}; | 141 | std::make_shared<Kernel::HLERequestContext>(SharedFrom(this), std::move(thread))}; |
| @@ -178,7 +179,7 @@ ResultCode ServerSession::CompleteSyncRequest() { | |||
| 178 | } | 179 | } |
| 179 | 180 | ||
| 180 | ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread, | 181 | ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread, |
| 181 | Memory::Memory& memory) { | 182 | Core::Memory::Memory& memory) { |
| 182 | Core::System::GetInstance().CoreTiming().ScheduleEvent(20000, request_event, {}); | 183 | Core::System::GetInstance().CoreTiming().ScheduleEvent(20000, request_event, {}); |
| 183 | return QueueSyncRequest(std::move(thread), memory); | 184 | return QueueSyncRequest(std::move(thread), memory); |
| 184 | } | 185 | } |
diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h index 77e4f6721..403aaf10b 100644 --- a/src/core/hle/kernel/server_session.h +++ b/src/core/hle/kernel/server_session.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "core/hle/kernel/synchronization_object.h" | 13 | #include "core/hle/kernel/synchronization_object.h" |
| 14 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 15 | 15 | ||
| 16 | namespace Memory { | 16 | namespace Core::Memory { |
| 17 | class Memory; | 17 | class Memory; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| @@ -92,7 +92,7 @@ public: | |||
| 92 | * | 92 | * |
| 93 | * @returns ResultCode from the operation. | 93 | * @returns ResultCode from the operation. |
| 94 | */ | 94 | */ |
| 95 | ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory); | 95 | ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory); |
| 96 | 96 | ||
| 97 | bool ShouldWait(const Thread* thread) const override; | 97 | bool ShouldWait(const Thread* thread) const override; |
| 98 | 98 | ||
| @@ -126,7 +126,7 @@ public: | |||
| 126 | 126 | ||
| 127 | private: | 127 | private: |
| 128 | /// Queues a sync request from the emulated application. | 128 | /// Queues a sync request from the emulated application. |
| 129 | ResultCode QueueSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory); | 129 | ResultCode QueueSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory); |
| 130 | 130 | ||
| 131 | /// Completes a sync request from the emulated application. | 131 | /// Completes a sync request from the emulated application. |
| 132 | ResultCode CompleteSyncRequest(); | 132 | ResultCode CompleteSyncRequest(); |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index abd579097..bde81fab5 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -539,7 +539,7 @@ static ResultCode ArbitrateLock(Core::System& system, Handle holding_thread_hand | |||
| 539 | "requesting_current_thread_handle=0x{:08X}", | 539 | "requesting_current_thread_handle=0x{:08X}", |
| 540 | holding_thread_handle, mutex_addr, requesting_thread_handle); | 540 | holding_thread_handle, mutex_addr, requesting_thread_handle); |
| 541 | 541 | ||
| 542 | if (Memory::IsKernelVirtualAddress(mutex_addr)) { | 542 | if (Core::Memory::IsKernelVirtualAddress(mutex_addr)) { |
| 543 | LOG_ERROR(Kernel_SVC, "Mutex Address is a kernel virtual address, mutex_addr={:016X}", | 543 | LOG_ERROR(Kernel_SVC, "Mutex Address is a kernel virtual address, mutex_addr={:016X}", |
| 544 | mutex_addr); | 544 | mutex_addr); |
| 545 | return ERR_INVALID_ADDRESS_STATE; | 545 | return ERR_INVALID_ADDRESS_STATE; |
| @@ -559,7 +559,7 @@ static ResultCode ArbitrateLock(Core::System& system, Handle holding_thread_hand | |||
| 559 | static ResultCode ArbitrateUnlock(Core::System& system, VAddr mutex_addr) { | 559 | static ResultCode ArbitrateUnlock(Core::System& system, VAddr mutex_addr) { |
| 560 | LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); | 560 | LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); |
| 561 | 561 | ||
| 562 | if (Memory::IsKernelVirtualAddress(mutex_addr)) { | 562 | if (Core::Memory::IsKernelVirtualAddress(mutex_addr)) { |
| 563 | LOG_ERROR(Kernel_SVC, "Mutex Address is a kernel virtual address, mutex_addr={:016X}", | 563 | LOG_ERROR(Kernel_SVC, "Mutex Address is a kernel virtual address, mutex_addr={:016X}", |
| 564 | mutex_addr); | 564 | mutex_addr); |
| 565 | return ERR_INVALID_ADDRESS_STATE; | 565 | return ERR_INVALID_ADDRESS_STATE; |
| @@ -1611,7 +1611,7 @@ static ResultCode WaitProcessWideKeyAtomic(Core::System& system, VAddr mutex_add | |||
| 1611 | "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", | 1611 | "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", |
| 1612 | mutex_addr, condition_variable_addr, thread_handle, nano_seconds); | 1612 | mutex_addr, condition_variable_addr, thread_handle, nano_seconds); |
| 1613 | 1613 | ||
| 1614 | if (Memory::IsKernelVirtualAddress(mutex_addr)) { | 1614 | if (Core::Memory::IsKernelVirtualAddress(mutex_addr)) { |
| 1615 | LOG_ERROR( | 1615 | LOG_ERROR( |
| 1616 | Kernel_SVC, | 1616 | Kernel_SVC, |
| 1617 | "Given mutex address must not be within the kernel address space. address=0x{:016X}", | 1617 | "Given mutex address must not be within the kernel address space. address=0x{:016X}", |
| @@ -1742,7 +1742,7 @@ static ResultCode WaitForAddress(Core::System& system, VAddr address, u32 type, | |||
| 1742 | type, value, timeout); | 1742 | type, value, timeout); |
| 1743 | 1743 | ||
| 1744 | // If the passed address is a kernel virtual address, return invalid memory state. | 1744 | // If the passed address is a kernel virtual address, return invalid memory state. |
| 1745 | if (Memory::IsKernelVirtualAddress(address)) { | 1745 | if (Core::Memory::IsKernelVirtualAddress(address)) { |
| 1746 | LOG_ERROR(Kernel_SVC, "Address is a kernel virtual address, address={:016X}", address); | 1746 | LOG_ERROR(Kernel_SVC, "Address is a kernel virtual address, address={:016X}", address); |
| 1747 | return ERR_INVALID_ADDRESS_STATE; | 1747 | return ERR_INVALID_ADDRESS_STATE; |
| 1748 | } | 1748 | } |
| @@ -1770,7 +1770,7 @@ static ResultCode SignalToAddress(Core::System& system, VAddr address, u32 type, | |||
| 1770 | address, type, value, num_to_wake); | 1770 | address, type, value, num_to_wake); |
| 1771 | 1771 | ||
| 1772 | // If the passed address is a kernel virtual address, return invalid memory state. | 1772 | // If the passed address is a kernel virtual address, return invalid memory state. |
| 1773 | if (Memory::IsKernelVirtualAddress(address)) { | 1773 | if (Core::Memory::IsKernelVirtualAddress(address)) { |
| 1774 | LOG_ERROR(Kernel_SVC, "Address is a kernel virtual address, address={:016X}", address); | 1774 | LOG_ERROR(Kernel_SVC, "Address is a kernel virtual address, address={:016X}", address); |
| 1775 | return ERR_INVALID_ADDRESS_STATE; | 1775 | return ERR_INVALID_ADDRESS_STATE; |
| 1776 | } | 1776 | } |
diff --git a/src/core/hle/kernel/transfer_memory.cpp b/src/core/hle/kernel/transfer_memory.cpp index f2d3f8b49..74514068e 100644 --- a/src/core/hle/kernel/transfer_memory.cpp +++ b/src/core/hle/kernel/transfer_memory.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | namespace Kernel { | 13 | namespace Kernel { |
| 14 | 14 | ||
| 15 | TransferMemory::TransferMemory(KernelCore& kernel, Memory::Memory& memory) | 15 | TransferMemory::TransferMemory(KernelCore& kernel, Core::Memory::Memory& memory) |
| 16 | : Object{kernel}, memory{memory} {} | 16 | : Object{kernel}, memory{memory} {} |
| 17 | 17 | ||
| 18 | TransferMemory::~TransferMemory() { | 18 | TransferMemory::~TransferMemory() { |
| @@ -20,7 +20,8 @@ TransferMemory::~TransferMemory() { | |||
| 20 | Reset(); | 20 | Reset(); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | std::shared_ptr<TransferMemory> TransferMemory::Create(KernelCore& kernel, Memory::Memory& memory, | 23 | std::shared_ptr<TransferMemory> TransferMemory::Create(KernelCore& kernel, |
| 24 | Core::Memory::Memory& memory, | ||
| 24 | VAddr base_address, u64 size, | 25 | VAddr base_address, u64 size, |
| 25 | MemoryPermission permissions) { | 26 | MemoryPermission permissions) { |
| 26 | std::shared_ptr<TransferMemory> transfer_memory{ | 27 | std::shared_ptr<TransferMemory> transfer_memory{ |
diff --git a/src/core/hle/kernel/transfer_memory.h b/src/core/hle/kernel/transfer_memory.h index 6e388536a..a47f57714 100644 --- a/src/core/hle/kernel/transfer_memory.h +++ b/src/core/hle/kernel/transfer_memory.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | union ResultCode; | 12 | union ResultCode; |
| 13 | 13 | ||
| 14 | namespace Memory { | 14 | namespace Core::Memory { |
| 15 | class Memory; | 15 | class Memory; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| @@ -30,12 +30,12 @@ enum class MemoryPermission : u32; | |||
| 30 | /// | 30 | /// |
| 31 | class TransferMemory final : public Object { | 31 | class TransferMemory final : public Object { |
| 32 | public: | 32 | public: |
| 33 | explicit TransferMemory(KernelCore& kernel, Memory::Memory& memory); | 33 | explicit TransferMemory(KernelCore& kernel, Core::Memory::Memory& memory); |
| 34 | ~TransferMemory() override; | 34 | ~TransferMemory() override; |
| 35 | 35 | ||
| 36 | static constexpr HandleType HANDLE_TYPE = HandleType::TransferMemory; | 36 | static constexpr HandleType HANDLE_TYPE = HandleType::TransferMemory; |
| 37 | 37 | ||
| 38 | static std::shared_ptr<TransferMemory> Create(KernelCore& kernel, Memory::Memory& memory, | 38 | static std::shared_ptr<TransferMemory> Create(KernelCore& kernel, Core::Memory::Memory& memory, |
| 39 | VAddr base_address, u64 size, | 39 | VAddr base_address, u64 size, |
| 40 | MemoryPermission permissions); | 40 | MemoryPermission permissions); |
| 41 | 41 | ||
| @@ -112,7 +112,7 @@ private: | |||
| 112 | /// Whether or not this transfer memory instance has mapped memory. | 112 | /// Whether or not this transfer memory instance has mapped memory. |
| 113 | bool is_mapped = false; | 113 | bool is_mapped = false; |
| 114 | 114 | ||
| 115 | Memory::Memory& memory; | 115 | Core::Memory::Memory& memory; |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | } // namespace Kernel | 118 | } // namespace Kernel |
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 4fb2cbc4b..106e89743 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp | |||
| @@ -210,7 +210,7 @@ private: | |||
| 210 | 210 | ||
| 211 | /// This is the event handle used to check if the audio buffer was released | 211 | /// This is the event handle used to check if the audio buffer was released |
| 212 | Kernel::EventPair buffer_event; | 212 | Kernel::EventPair buffer_event; |
| 213 | Memory::Memory& main_memory; | 213 | Core::Memory::Memory& main_memory; |
| 214 | }; | 214 | }; |
| 215 | 215 | ||
| 216 | AudOutU::AudOutU(Core::System& system_) : ServiceFramework("audout:u"), system{system_} { | 216 | AudOutU::AudOutU(Core::System& system_) : ServiceFramework("audout:u"), system{system_} { |
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 346c8f899..dec96b771 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -17,7 +17,7 @@ namespace Service::LM { | |||
| 17 | 17 | ||
| 18 | class ILogger final : public ServiceFramework<ILogger> { | 18 | class ILogger final : public ServiceFramework<ILogger> { |
| 19 | public: | 19 | public: |
| 20 | explicit ILogger(Manager& manager_, Memory::Memory& memory_) | 20 | explicit ILogger(Manager& manager_, Core::Memory::Memory& memory_) |
| 21 | : ServiceFramework("ILogger"), manager{manager_}, memory{memory_} { | 21 | : ServiceFramework("ILogger"), manager{manager_}, memory{memory_} { |
| 22 | static const FunctionInfo functions[] = { | 22 | static const FunctionInfo functions[] = { |
| 23 | {0, &ILogger::Log, "Log"}, | 23 | {0, &ILogger::Log, "Log"}, |
| @@ -75,12 +75,12 @@ private: | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | Manager& manager; | 77 | Manager& manager; |
| 78 | Memory::Memory& memory; | 78 | Core::Memory::Memory& memory; |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | class LM final : public ServiceFramework<LM> { | 81 | class LM final : public ServiceFramework<LM> { |
| 82 | public: | 82 | public: |
| 83 | explicit LM(Manager& manager_, Memory::Memory& memory_) | 83 | explicit LM(Manager& manager_, Core::Memory::Memory& memory_) |
| 84 | : ServiceFramework{"lm"}, manager{manager_}, memory{memory_} { | 84 | : ServiceFramework{"lm"}, manager{manager_}, memory{memory_} { |
| 85 | // clang-format off | 85 | // clang-format off |
| 86 | static const FunctionInfo functions[] = { | 86 | static const FunctionInfo functions[] = { |
| @@ -101,7 +101,7 @@ private: | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | Manager& manager; | 103 | Manager& manager; |
| 104 | Memory::Memory& memory; | 104 | Core::Memory::Memory& memory; |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | void InstallInterfaces(Core::System& system) { | 107 | void InstallInterfaces(Core::System& system) { |
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 8908e5328..b01400325 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -401,7 +401,7 @@ AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::Process& process) { | |||
| 401 | process.LoadModule(std::move(codeset), entry_point); | 401 | process.LoadModule(std::move(codeset), entry_point); |
| 402 | 402 | ||
| 403 | is_loaded = true; | 403 | is_loaded = true; |
| 404 | return {ResultStatus::Success, LoadParameters{48, Memory::DEFAULT_STACK_SIZE}}; | 404 | return {ResultStatus::Success, LoadParameters{48, Core::Memory::DEFAULT_STACK_SIZE}}; |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | } // namespace Loader | 407 | } // namespace Loader |
diff --git a/src/core/loader/kip.cpp b/src/core/loader/kip.cpp index 092103abe..dce342ce2 100644 --- a/src/core/loader/kip.cpp +++ b/src/core/loader/kip.cpp | |||
| @@ -14,7 +14,7 @@ namespace Loader { | |||
| 14 | 14 | ||
| 15 | namespace { | 15 | namespace { |
| 16 | constexpr u32 PageAlignSize(u32 size) { | 16 | constexpr u32 PageAlignSize(u32 size) { |
| 17 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | 17 | return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; |
| 18 | } | 18 | } |
| 19 | } // Anonymous namespace | 19 | } // Anonymous namespace |
| 20 | 20 | ||
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 175898b91..bc41fe161 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -127,7 +127,7 @@ FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { | |||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | static constexpr u32 PageAlignSize(u32 size) { | 129 | static constexpr u32 PageAlignSize(u32 size) { |
| 130 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | 130 | return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, | 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, |
| @@ -221,7 +221,7 @@ AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process) { | |||
| 221 | 221 | ||
| 222 | is_loaded = true; | 222 | is_loaded = true; |
| 223 | return {ResultStatus::Success, | 223 | return {ResultStatus::Success, |
| 224 | LoadParameters{Kernel::THREADPRIO_DEFAULT, Memory::DEFAULT_STACK_SIZE}}; | 224 | LoadParameters{Kernel::THREADPRIO_DEFAULT, Core::Memory::DEFAULT_STACK_SIZE}}; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | ResultStatus AppLoader_NRO::ReadIcon(std::vector<u8>& buffer) { | 227 | ResultStatus AppLoader_NRO::ReadIcon(std::vector<u8>& buffer) { |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 5fe798bf0..ce9d52309 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -47,7 +47,7 @@ std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | constexpr u32 PageAlignSize(u32 size) { | 49 | constexpr u32 PageAlignSize(u32 size) { |
| 50 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | 50 | return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; |
| 51 | } | 51 | } |
| 52 | } // Anonymous namespace | 52 | } // Anonymous namespace |
| 53 | 53 | ||
| @@ -182,7 +182,7 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process) { | |||
| 182 | 182 | ||
| 183 | is_loaded = true; | 183 | is_loaded = true; |
| 184 | return {ResultStatus::Success, | 184 | return {ResultStatus::Success, |
| 185 | LoadParameters{Kernel::THREADPRIO_DEFAULT, Memory::DEFAULT_STACK_SIZE}}; | 185 | LoadParameters{Kernel::THREADPRIO_DEFAULT, Core::Memory::DEFAULT_STACK_SIZE}}; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) { | 188 | ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) { |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 6061d37ae..72d1caf73 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include "core/memory.h" | 20 | #include "core/memory.h" |
| 21 | #include "video_core/gpu.h" | 21 | #include "video_core/gpu.h" |
| 22 | 22 | ||
| 23 | namespace Memory { | 23 | namespace Core::Memory { |
| 24 | 24 | ||
| 25 | // Implementation class used to keep the specifics of the memory subsystem hidden | 25 | // Implementation class used to keep the specifics of the memory subsystem hidden |
| 26 | // from outside classes. This also allows modification to the internals of the memory | 26 | // from outside classes. This also allows modification to the internals of the memory |
| @@ -845,4 +845,4 @@ bool IsKernelVirtualAddress(const VAddr vaddr) { | |||
| 845 | return KERNEL_REGION_VADDR <= vaddr && vaddr < KERNEL_REGION_END; | 845 | return KERNEL_REGION_VADDR <= vaddr && vaddr < KERNEL_REGION_END; |
| 846 | } | 846 | } |
| 847 | 847 | ||
| 848 | } // namespace Memory | 848 | } // namespace Core::Memory |
diff --git a/src/core/memory.h b/src/core/memory.h index b92d678a4..f6d9e8e8c 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -23,7 +23,7 @@ class PhysicalMemory; | |||
| 23 | class Process; | 23 | class Process; |
| 24 | } // namespace Kernel | 24 | } // namespace Kernel |
| 25 | 25 | ||
| 26 | namespace Memory { | 26 | namespace Core::Memory { |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * Page size used by the ARM architecture. This is the smallest granularity with which memory can | 29 | * Page size used by the ARM architecture. This is the smallest granularity with which memory can |
| @@ -503,4 +503,4 @@ private: | |||
| 503 | /// Determines if the given VAddr is a kernel address | 503 | /// Determines if the given VAddr is a kernel address |
| 504 | bool IsKernelVirtualAddress(VAddr vaddr); | 504 | bool IsKernelVirtualAddress(VAddr vaddr); |
| 505 | 505 | ||
| 506 | } // namespace Memory | 506 | } // namespace Core::Memory |
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 4472500d2..ab459221d 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include "core/hle/service/sm/sm.h" | 16 | #include "core/hle/service/sm/sm.h" |
| 17 | #include "core/memory/cheat_engine.h" | 17 | #include "core/memory/cheat_engine.h" |
| 18 | 18 | ||
| 19 | namespace Memory { | 19 | namespace Core::Memory { |
| 20 | 20 | ||
| 21 | constexpr s64 CHEAT_ENGINE_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 12); | 21 | constexpr s64 CHEAT_ENGINE_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 12); |
| 22 | constexpr u32 KEYPAD_BITMASK = 0x3FFFFFF; | 22 | constexpr u32 KEYPAD_BITMASK = 0x3FFFFFF; |
| @@ -230,4 +230,4 @@ void CheatEngine::FrameCallback(u64 userdata, s64 cycles_late) { | |||
| 230 | core_timing.ScheduleEvent(CHEAT_ENGINE_TICKS - cycles_late, event); | 230 | core_timing.ScheduleEvent(CHEAT_ENGINE_TICKS - cycles_late, event); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | } // namespace Memory | 233 | } // 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 |
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 85ac81ef7..c1592256d 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp | |||
| @@ -147,7 +147,7 @@ json GetFullDataAuto(const std::string& timestamp, u64 title_id, Core::System& s | |||
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | template <bool read_value, typename DescriptorType> | 149 | template <bool read_value, typename DescriptorType> |
| 150 | json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer, Memory::Memory& memory) { | 150 | json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer, Core::Memory::Memory& memory) { |
| 151 | auto buffer_out = json::array(); | 151 | auto buffer_out = json::array(); |
| 152 | for (const auto& desc : buffer) { | 152 | for (const auto& desc : buffer) { |
| 153 | auto entry = json{ | 153 | auto entry = json{ |
| @@ -167,7 +167,7 @@ json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer, Memor | |||
| 167 | return buffer_out; | 167 | return buffer_out; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Memory::Memory& memory) { | 170 | json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Core::Memory::Memory& memory) { |
| 171 | json out; | 171 | json out; |
| 172 | 172 | ||
| 173 | auto cmd_buf = json::array(); | 173 | auto cmd_buf = json::array(); |
diff --git a/src/core/tools/freezer.cpp b/src/core/tools/freezer.cpp index 1e060f009..b2c6c537e 100644 --- a/src/core/tools/freezer.cpp +++ b/src/core/tools/freezer.cpp | |||
| @@ -16,7 +16,7 @@ namespace { | |||
| 16 | 16 | ||
| 17 | constexpr s64 MEMORY_FREEZER_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 60); | 17 | constexpr s64 MEMORY_FREEZER_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 60); |
| 18 | 18 | ||
| 19 | u64 MemoryReadWidth(Memory::Memory& memory, u32 width, VAddr addr) { | 19 | u64 MemoryReadWidth(Core::Memory::Memory& memory, u32 width, VAddr addr) { |
| 20 | switch (width) { | 20 | switch (width) { |
| 21 | case 1: | 21 | case 1: |
| 22 | return memory.Read8(addr); | 22 | return memory.Read8(addr); |
| @@ -32,7 +32,7 @@ u64 MemoryReadWidth(Memory::Memory& memory, u32 width, VAddr addr) { | |||
| 32 | } | 32 | } |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void MemoryWriteWidth(Memory::Memory& memory, u32 width, VAddr addr, u64 value) { | 35 | void MemoryWriteWidth(Core::Memory::Memory& memory, u32 width, VAddr addr, u64 value) { |
| 36 | switch (width) { | 36 | switch (width) { |
| 37 | case 1: | 37 | case 1: |
| 38 | memory.Write8(addr, static_cast<u8>(value)); | 38 | memory.Write8(addr, static_cast<u8>(value)); |
| @@ -53,7 +53,7 @@ void MemoryWriteWidth(Memory::Memory& memory, u32 width, VAddr addr, u64 value) | |||
| 53 | 53 | ||
| 54 | } // Anonymous namespace | 54 | } // Anonymous namespace |
| 55 | 55 | ||
| 56 | Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Memory::Memory& memory_) | 56 | Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_) |
| 57 | : core_timing{core_timing_}, memory{memory_} { | 57 | : core_timing{core_timing_}, memory{memory_} { |
| 58 | event = Core::Timing::CreateEvent( | 58 | event = Core::Timing::CreateEvent( |
| 59 | "MemoryFreezer::FrameCallback", | 59 | "MemoryFreezer::FrameCallback", |
diff --git a/src/core/tools/freezer.h b/src/core/tools/freezer.h index 916339c6c..62fc6aa6c 100644 --- a/src/core/tools/freezer.h +++ b/src/core/tools/freezer.h | |||
| @@ -16,7 +16,7 @@ class CoreTiming; | |||
| 16 | struct EventType; | 16 | struct EventType; |
| 17 | } // namespace Core::Timing | 17 | } // namespace Core::Timing |
| 18 | 18 | ||
| 19 | namespace Memory { | 19 | namespace Core::Memory { |
| 20 | class Memory; | 20 | class Memory; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| @@ -38,7 +38,7 @@ public: | |||
| 38 | u64 value; | 38 | u64 value; |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | explicit Freezer(Core::Timing::CoreTiming& core_timing_, Memory::Memory& memory_); | 41 | explicit Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_); |
| 42 | ~Freezer(); | 42 | ~Freezer(); |
| 43 | 43 | ||
| 44 | // Enables or disables the entire memory freezer. | 44 | // Enables or disables the entire memory freezer. |
| @@ -82,7 +82,7 @@ private: | |||
| 82 | 82 | ||
| 83 | std::shared_ptr<Core::Timing::EventType> event; | 83 | std::shared_ptr<Core::Timing::EventType> event; |
| 84 | Core::Timing::CoreTiming& core_timing; | 84 | Core::Timing::CoreTiming& core_timing; |
| 85 | Memory::Memory& memory; | 85 | Core::Memory::Memory& memory; |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | } // namespace Tools | 88 | } // namespace Tools |
diff --git a/src/video_core/rasterizer_accelerated.cpp b/src/video_core/rasterizer_accelerated.cpp index d01db97da..53622ca05 100644 --- a/src/video_core/rasterizer_accelerated.cpp +++ b/src/video_core/rasterizer_accelerated.cpp | |||
| @@ -23,15 +23,15 @@ constexpr auto RangeFromInterval(Map& map, const Interval& interval) { | |||
| 23 | 23 | ||
| 24 | } // Anonymous namespace | 24 | } // Anonymous namespace |
| 25 | 25 | ||
| 26 | RasterizerAccelerated::RasterizerAccelerated(Memory::Memory& cpu_memory_) | 26 | RasterizerAccelerated::RasterizerAccelerated(Core::Memory::Memory& cpu_memory_) |
| 27 | : cpu_memory{cpu_memory_} {} | 27 | : cpu_memory{cpu_memory_} {} |
| 28 | 28 | ||
| 29 | RasterizerAccelerated::~RasterizerAccelerated() = default; | 29 | RasterizerAccelerated::~RasterizerAccelerated() = default; |
| 30 | 30 | ||
| 31 | void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) { | 31 | void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) { |
| 32 | std::lock_guard lock{pages_mutex}; | 32 | std::lock_guard lock{pages_mutex}; |
| 33 | const u64 page_start{addr >> Memory::PAGE_BITS}; | 33 | const u64 page_start{addr >> Core::Memory::PAGE_BITS}; |
| 34 | const u64 page_end{(addr + size + Memory::PAGE_SIZE - 1) >> Memory::PAGE_BITS}; | 34 | const u64 page_end{(addr + size + Core::Memory::PAGE_SIZE - 1) >> Core::Memory::PAGE_BITS}; |
| 35 | 35 | ||
| 36 | // Interval maps will erase segments if count reaches 0, so if delta is negative we have to | 36 | // Interval maps will erase segments if count reaches 0, so if delta is negative we have to |
| 37 | // subtract after iterating | 37 | // subtract after iterating |
| @@ -44,8 +44,8 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del | |||
| 44 | const auto interval = pair.first & pages_interval; | 44 | const auto interval = pair.first & pages_interval; |
| 45 | const int count = pair.second; | 45 | const int count = pair.second; |
| 46 | 46 | ||
| 47 | const VAddr interval_start_addr = boost::icl::first(interval) << Memory::PAGE_BITS; | 47 | const VAddr interval_start_addr = boost::icl::first(interval) << Core::Memory::PAGE_BITS; |
| 48 | const VAddr interval_end_addr = boost::icl::last_next(interval) << Memory::PAGE_BITS; | 48 | const VAddr interval_end_addr = boost::icl::last_next(interval) << Core::Memory::PAGE_BITS; |
| 49 | const u64 interval_size = interval_end_addr - interval_start_addr; | 49 | const u64 interval_size = interval_end_addr - interval_start_addr; |
| 50 | 50 | ||
| 51 | if (delta > 0 && count == delta) { | 51 | if (delta > 0 && count == delta) { |
diff --git a/src/video_core/rasterizer_accelerated.h b/src/video_core/rasterizer_accelerated.h index 315798e7c..91866d7dd 100644 --- a/src/video_core/rasterizer_accelerated.h +++ b/src/video_core/rasterizer_accelerated.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "video_core/rasterizer_interface.h" | 12 | #include "video_core/rasterizer_interface.h" |
| 13 | 13 | ||
| 14 | namespace Memory { | 14 | namespace Core::Memory { |
| 15 | class Memory; | 15 | class Memory; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| @@ -20,7 +20,7 @@ namespace VideoCore { | |||
| 20 | /// Implements the shared part in GPU accelerated rasterizers in RasterizerInterface. | 20 | /// Implements the shared part in GPU accelerated rasterizers in RasterizerInterface. |
| 21 | class RasterizerAccelerated : public RasterizerInterface { | 21 | class RasterizerAccelerated : public RasterizerInterface { |
| 22 | public: | 22 | public: |
| 23 | explicit RasterizerAccelerated(Memory::Memory& cpu_memory_); | 23 | explicit RasterizerAccelerated(Core::Memory::Memory& cpu_memory_); |
| 24 | ~RasterizerAccelerated() override; | 24 | ~RasterizerAccelerated() override; |
| 25 | 25 | ||
| 26 | void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override; | 26 | void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override; |
| @@ -30,7 +30,7 @@ private: | |||
| 30 | CachedPageMap cached_pages; | 30 | CachedPageMap cached_pages; |
| 31 | std::mutex pages_mutex; | 31 | std::mutex pages_mutex; |
| 32 | 32 | ||
| 33 | Memory::Memory& cpu_memory; | 33 | Core::Memory::Memory& cpu_memory; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | } // namespace VideoCore | 36 | } // namespace VideoCore |