core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
This commit is contained in:
		| @@ -36,9 +36,9 @@ public: | ||||
|     } | ||||
|  | ||||
|     void SetWaveIndex(std::size_t index); | ||||
|     std::vector<s16> DequeueSamples(std::size_t sample_count, Memory::Memory& memory); | ||||
|     std::vector<s16> DequeueSamples(std::size_t sample_count, Core::Memory::Memory& memory); | ||||
|     void UpdateState(); | ||||
|     void RefreshBuffer(Memory::Memory& memory); | ||||
|     void RefreshBuffer(Core::Memory::Memory& memory); | ||||
|  | ||||
| private: | ||||
|     bool is_in_use{}; | ||||
| @@ -66,13 +66,14 @@ public: | ||||
|         return info; | ||||
|     } | ||||
|  | ||||
|     void UpdateState(Memory::Memory& memory); | ||||
|     void UpdateState(Core::Memory::Memory& memory); | ||||
|  | ||||
| private: | ||||
|     EffectOutStatus out_status{}; | ||||
|     EffectInStatus info{}; | ||||
| }; | ||||
| AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Memory::Memory& memory_, | ||||
|  | ||||
| AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_, | ||||
|                              AudioRendererParameter params, | ||||
|                              std::shared_ptr<Kernel::WritableEvent> buffer_event, | ||||
|                              std::size_t instance_number) | ||||
| @@ -208,7 +209,7 @@ void AudioRenderer::VoiceState::SetWaveIndex(std::size_t index) { | ||||
| } | ||||
|  | ||||
| std::vector<s16> AudioRenderer::VoiceState::DequeueSamples(std::size_t sample_count, | ||||
|                                                            Memory::Memory& memory) { | ||||
|                                                            Core::Memory::Memory& memory) { | ||||
|     if (!IsPlaying()) { | ||||
|         return {}; | ||||
|     } | ||||
| @@ -258,7 +259,7 @@ void AudioRenderer::VoiceState::UpdateState() { | ||||
|     is_in_use = info.is_in_use; | ||||
| } | ||||
|  | ||||
| void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) { | ||||
| void AudioRenderer::VoiceState::RefreshBuffer(Core::Memory::Memory& memory) { | ||||
|     const auto wave_buffer_address = info.wave_buffer[wave_index].buffer_addr; | ||||
|     const auto wave_buffer_size = info.wave_buffer[wave_index].buffer_sz; | ||||
|     std::vector<s16> new_samples(wave_buffer_size / sizeof(s16)); | ||||
| @@ -310,7 +311,7 @@ void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) { | ||||
|     is_refresh_pending = false; | ||||
| } | ||||
|  | ||||
| void AudioRenderer::EffectState::UpdateState(Memory::Memory& memory) { | ||||
| void AudioRenderer::EffectState::UpdateState(Core::Memory::Memory& memory) { | ||||
|     if (info.is_new) { | ||||
|         out_status.state = EffectStatus::New; | ||||
|     } else { | ||||
|   | ||||
| @@ -22,7 +22,7 @@ namespace Kernel { | ||||
| class WritableEvent; | ||||
| } | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -221,7 +221,7 @@ static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size | ||||
|  | ||||
| class AudioRenderer { | ||||
| public: | ||||
|     AudioRenderer(Core::Timing::CoreTiming& core_timing, Memory::Memory& memory_, | ||||
|     AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_, | ||||
|                   AudioRendererParameter params, | ||||
|                   std::shared_ptr<Kernel::WritableEvent> buffer_event, std::size_t instance_number); | ||||
|     ~AudioRenderer(); | ||||
| @@ -244,7 +244,7 @@ private: | ||||
|     std::vector<EffectState> effects; | ||||
|     std::unique_ptr<AudioOut> audio_out; | ||||
|     StreamPtr stream; | ||||
|     Memory::Memory& memory; | ||||
|     Core::Memory::Memory& memory; | ||||
| }; | ||||
|  | ||||
| } // namespace AudioCore | ||||
|   | ||||
| @@ -60,7 +60,7 @@ static_assert(sizeof(ELFSymbol) == 0x18, "ELFSymbol has incorrect size."); | ||||
|  | ||||
| using Symbols = std::vector<std::pair<ELFSymbol, std::string>>; | ||||
|  | ||||
| Symbols GetSymbols(VAddr text_offset, Memory::Memory& memory) { | ||||
| Symbols GetSymbols(VAddr text_offset, Core::Memory::Memory& memory) { | ||||
|     const auto mod_offset = text_offset + memory.Read32(text_offset + 4); | ||||
|  | ||||
|     if (mod_offset < text_offset || (mod_offset & 0b11) != 0 || | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
| #include "core/arm/arm_interface.h" | ||||
| #include "core/arm/exclusive_monitor.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
| #include "core/arm/exclusive_monitor.h" | ||||
| #include "core/arm/unicorn/arm_unicorn.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -92,7 +92,7 @@ public: | ||||
| private: | ||||
|     friend class ARM_Dynarmic_64; | ||||
|     Dynarmic::A64::ExclusiveMonitor monitor; | ||||
|     Memory::Memory& memory; | ||||
|     Core::Memory::Memory& memory; | ||||
| }; | ||||
|  | ||||
| } // namespace Core | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|  | ||||
| #include "common/common_types.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -346,7 +346,7 @@ struct System::Impl { | ||||
|     std::unique_ptr<Loader::AppLoader> app_loader; | ||||
|     std::unique_ptr<Tegra::GPU> gpu_core; | ||||
|     std::unique_ptr<Hardware::InterruptManager> interrupt_manager; | ||||
|     Memory::Memory memory; | ||||
|     Core::Memory::Memory memory; | ||||
|     CpuManager cpu_manager; | ||||
|     bool is_powered_on = false; | ||||
|     bool exit_lock = false; | ||||
| @@ -505,7 +505,7 @@ Memory::Memory& System::Memory() { | ||||
|     return impl->memory; | ||||
| } | ||||
|  | ||||
| const Memory::Memory& System::Memory() const { | ||||
| const Core::Memory::Memory& System::Memory() const { | ||||
|     return impl->memory; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -36,9 +36,10 @@ class AppLoader; | ||||
| enum class ResultStatus : u16; | ||||
| } // namespace Loader | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| struct CheatEntry; | ||||
| } // namespace Memory | ||||
| class Memory; | ||||
| } // namespace Core::Memory | ||||
|  | ||||
| namespace Service { | ||||
|  | ||||
| @@ -86,10 +87,6 @@ namespace Core::Hardware { | ||||
| class InterruptManager; | ||||
| } | ||||
|  | ||||
| namespace Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| namespace Core { | ||||
|  | ||||
| class ARM_Interface; | ||||
| @@ -230,10 +227,10 @@ public: | ||||
|     const ExclusiveMonitor& Monitor() const; | ||||
|  | ||||
|     /// Gets a mutable reference to the system memory instance. | ||||
|     Memory::Memory& Memory(); | ||||
|     Core::Memory::Memory& Memory(); | ||||
|  | ||||
|     /// Gets a constant reference to the system memory instance. | ||||
|     const Memory::Memory& Memory() const; | ||||
|     const Core::Memory::Memory& Memory() const; | ||||
|  | ||||
|     /// Gets a mutable reference to the GPU interface | ||||
|     Tegra::GPU& GPU(); | ||||
|   | ||||
| @@ -22,7 +22,7 @@ namespace Core::Timing { | ||||
| class CoreTiming; | ||||
| } | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -249,7 +249,7 @@ bool PatchManager::HasNSOPatch(const std::array<u8, 32>& build_id_) const { | ||||
| } | ||||
|  | ||||
| namespace { | ||||
| std::optional<std::vector<Memory::CheatEntry>> ReadCheatFileFromFolder( | ||||
| std::optional<std::vector<Core::Memory::CheatEntry>> ReadCheatFileFromFolder( | ||||
|     const Core::System& system, u64 title_id, const std::array<u8, 0x20>& build_id_, | ||||
|     const VirtualDir& base_path, bool upper) { | ||||
|     const auto build_id_raw = Common::HexToString(build_id_, upper); | ||||
| @@ -269,14 +269,14 @@ std::optional<std::vector<Memory::CheatEntry>> ReadCheatFileFromFolder( | ||||
|         return std::nullopt; | ||||
|     } | ||||
|  | ||||
|     Memory::TextCheatParser parser; | ||||
|     Core::Memory::TextCheatParser parser; | ||||
|     return parser.Parse( | ||||
|         system, std::string_view(reinterpret_cast<const char* const>(data.data()), data.size())); | ||||
| } | ||||
|  | ||||
| } // Anonymous namespace | ||||
|  | ||||
| std::vector<Memory::CheatEntry> PatchManager::CreateCheatList( | ||||
| std::vector<Core::Memory::CheatEntry> PatchManager::CreateCheatList( | ||||
|     const Core::System& system, const std::array<u8, 32>& build_id_) const { | ||||
|     const auto load_dir = system.GetFileSystemController().GetModificationLoadRoot(title_id); | ||||
|     if (load_dir == nullptr) { | ||||
| @@ -289,7 +289,7 @@ std::vector<Memory::CheatEntry> PatchManager::CreateCheatList( | ||||
|     std::sort(patch_dirs.begin(), patch_dirs.end(), | ||||
|               [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); | ||||
|  | ||||
|     std::vector<Memory::CheatEntry> out; | ||||
|     std::vector<Core::Memory::CheatEntry> out; | ||||
|     for (const auto& subdir : patch_dirs) { | ||||
|         if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) != disabled.cend()) { | ||||
|             continue; | ||||
|   | ||||
| @@ -51,8 +51,8 @@ public: | ||||
|     bool HasNSOPatch(const std::array<u8, 0x20>& build_id) const; | ||||
|  | ||||
|     // Creates a CheatList object with all | ||||
|     std::vector<Memory::CheatEntry> CreateCheatList(const Core::System& system, | ||||
|                                                     const std::array<u8, 0x20>& build_id) const; | ||||
|     std::vector<Core::Memory::CheatEntry> CreateCheatList( | ||||
|         const Core::System& system, const std::array<u8, 0x20>& build_id) const; | ||||
|  | ||||
|     // Currently tracked RomFS patches: | ||||
|     // - Game Updates | ||||
|   | ||||
| @@ -47,7 +47,8 @@ ResultVal<std::shared_ptr<ClientSession>> ClientSession::Create(KernelCore& kern | ||||
|     return MakeResult(std::move(client_session)); | ||||
| } | ||||
|  | ||||
| ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory) { | ||||
| ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread, | ||||
|                                           Core::Memory::Memory& memory) { | ||||
|     // Keep ServerSession alive until we're done working with it. | ||||
|     if (!parent->Server()) { | ||||
|         return ERR_SESSION_CLOSED_BY_REMOTE; | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
|  | ||||
| union ResultCode; | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -42,7 +42,7 @@ public: | ||||
|         return HANDLE_TYPE; | ||||
|     } | ||||
|  | ||||
|     ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory); | ||||
|     ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory); | ||||
|  | ||||
|     bool ShouldWait(const Thread* thread) const override; | ||||
|  | ||||
|   | ||||
| @@ -59,7 +59,8 @@ void SetupMainThread(Process& owner_process, KernelCore& kernel, u32 priority) { | ||||
| // (whichever page happens to have an available slot). | ||||
| class TLSPage { | ||||
| public: | ||||
|     static constexpr std::size_t num_slot_entries = Memory::PAGE_SIZE / Memory::TLS_ENTRY_SIZE; | ||||
|     static constexpr std::size_t num_slot_entries = | ||||
|         Core::Memory::PAGE_SIZE / Core::Memory::TLS_ENTRY_SIZE; | ||||
|  | ||||
|     explicit TLSPage(VAddr address) : base_address{address} {} | ||||
|  | ||||
| @@ -78,7 +79,7 @@ public: | ||||
|             } | ||||
|  | ||||
|             is_slot_used[i] = true; | ||||
|             return base_address + (i * Memory::TLS_ENTRY_SIZE); | ||||
|             return base_address + (i * Core::Memory::TLS_ENTRY_SIZE); | ||||
|         } | ||||
|  | ||||
|         return std::nullopt; | ||||
| @@ -88,15 +89,15 @@ public: | ||||
|         // Ensure that all given addresses are consistent with how TLS pages | ||||
|         // are intended to be used when releasing slots. | ||||
|         ASSERT(IsWithinPage(address)); | ||||
|         ASSERT((address % Memory::TLS_ENTRY_SIZE) == 0); | ||||
|         ASSERT((address % Core::Memory::TLS_ENTRY_SIZE) == 0); | ||||
|  | ||||
|         const std::size_t index = (address - base_address) / Memory::TLS_ENTRY_SIZE; | ||||
|         const std::size_t index = (address - base_address) / Core::Memory::TLS_ENTRY_SIZE; | ||||
|         is_slot_used[index] = false; | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     bool IsWithinPage(VAddr address) const { | ||||
|         return base_address <= address && address < base_address + Memory::PAGE_SIZE; | ||||
|         return base_address <= address && address < base_address + Core::Memory::PAGE_SIZE; | ||||
|     } | ||||
|  | ||||
|     VAddr base_address; | ||||
| @@ -306,7 +307,7 @@ VAddr Process::CreateTLSRegion() { | ||||
| } | ||||
|  | ||||
| void Process::FreeTLSRegion(VAddr tls_address) { | ||||
|     const VAddr aligned_address = Common::AlignDown(tls_address, Memory::PAGE_SIZE); | ||||
|     const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE); | ||||
|     auto iter = | ||||
|         std::find_if(tls_pages.begin(), tls_pages.end(), [aligned_address](const auto& page) { | ||||
|             return page.GetBaseAddress() == aligned_address; | ||||
|   | ||||
| @@ -134,7 +134,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory) { | ||||
| ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, | ||||
|                                            Core::Memory::Memory& memory) { | ||||
|     u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; | ||||
|     std::shared_ptr<Kernel::HLERequestContext> context{ | ||||
|         std::make_shared<Kernel::HLERequestContext>(SharedFrom(this), std::move(thread))}; | ||||
| @@ -178,7 +179,7 @@ ResultCode ServerSession::CompleteSyncRequest() { | ||||
| } | ||||
|  | ||||
| ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread, | ||||
|                                             Memory::Memory& memory) { | ||||
|                                             Core::Memory::Memory& memory) { | ||||
|     Core::System::GetInstance().CoreTiming().ScheduleEvent(20000, request_event, {}); | ||||
|     return QueueSyncRequest(std::move(thread), memory); | ||||
| } | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
| #include "core/hle/kernel/synchronization_object.h" | ||||
| #include "core/hle/result.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -92,7 +92,7 @@ public: | ||||
|      * | ||||
|      * @returns ResultCode from the operation. | ||||
|      */ | ||||
|     ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory); | ||||
|     ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory); | ||||
|  | ||||
|     bool ShouldWait(const Thread* thread) const override; | ||||
|  | ||||
| @@ -126,7 +126,7 @@ public: | ||||
|  | ||||
| private: | ||||
|     /// Queues a sync request from the emulated application. | ||||
|     ResultCode QueueSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory); | ||||
|     ResultCode QueueSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory); | ||||
|  | ||||
|     /// Completes a sync request from the emulated application. | ||||
|     ResultCode CompleteSyncRequest(); | ||||
|   | ||||
| @@ -539,7 +539,7 @@ static ResultCode ArbitrateLock(Core::System& system, Handle holding_thread_hand | ||||
|               "requesting_current_thread_handle=0x{:08X}", | ||||
|               holding_thread_handle, mutex_addr, requesting_thread_handle); | ||||
|  | ||||
|     if (Memory::IsKernelVirtualAddress(mutex_addr)) { | ||||
|     if (Core::Memory::IsKernelVirtualAddress(mutex_addr)) { | ||||
|         LOG_ERROR(Kernel_SVC, "Mutex Address is a kernel virtual address, mutex_addr={:016X}", | ||||
|                   mutex_addr); | ||||
|         return ERR_INVALID_ADDRESS_STATE; | ||||
| @@ -559,7 +559,7 @@ static ResultCode ArbitrateLock(Core::System& system, Handle holding_thread_hand | ||||
| static ResultCode ArbitrateUnlock(Core::System& system, VAddr mutex_addr) { | ||||
|     LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); | ||||
|  | ||||
|     if (Memory::IsKernelVirtualAddress(mutex_addr)) { | ||||
|     if (Core::Memory::IsKernelVirtualAddress(mutex_addr)) { | ||||
|         LOG_ERROR(Kernel_SVC, "Mutex Address is a kernel virtual address, mutex_addr={:016X}", | ||||
|                   mutex_addr); | ||||
|         return ERR_INVALID_ADDRESS_STATE; | ||||
| @@ -1611,7 +1611,7 @@ static ResultCode WaitProcessWideKeyAtomic(Core::System& system, VAddr mutex_add | ||||
|         "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", | ||||
|         mutex_addr, condition_variable_addr, thread_handle, nano_seconds); | ||||
|  | ||||
|     if (Memory::IsKernelVirtualAddress(mutex_addr)) { | ||||
|     if (Core::Memory::IsKernelVirtualAddress(mutex_addr)) { | ||||
|         LOG_ERROR( | ||||
|             Kernel_SVC, | ||||
|             "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, | ||||
|               type, value, timeout); | ||||
|  | ||||
|     // If the passed address is a kernel virtual address, return invalid memory state. | ||||
|     if (Memory::IsKernelVirtualAddress(address)) { | ||||
|     if (Core::Memory::IsKernelVirtualAddress(address)) { | ||||
|         LOG_ERROR(Kernel_SVC, "Address is a kernel virtual address, address={:016X}", address); | ||||
|         return ERR_INVALID_ADDRESS_STATE; | ||||
|     } | ||||
| @@ -1770,7 +1770,7 @@ static ResultCode SignalToAddress(Core::System& system, VAddr address, u32 type, | ||||
|               address, type, value, num_to_wake); | ||||
|  | ||||
|     // If the passed address is a kernel virtual address, return invalid memory state. | ||||
|     if (Memory::IsKernelVirtualAddress(address)) { | ||||
|     if (Core::Memory::IsKernelVirtualAddress(address)) { | ||||
|         LOG_ERROR(Kernel_SVC, "Address is a kernel virtual address, address={:016X}", address); | ||||
|         return ERR_INVALID_ADDRESS_STATE; | ||||
|     } | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
|  | ||||
| namespace Kernel { | ||||
|  | ||||
| TransferMemory::TransferMemory(KernelCore& kernel, Memory::Memory& memory) | ||||
| TransferMemory::TransferMemory(KernelCore& kernel, Core::Memory::Memory& memory) | ||||
|     : Object{kernel}, memory{memory} {} | ||||
|  | ||||
| TransferMemory::~TransferMemory() { | ||||
| @@ -20,7 +20,8 @@ TransferMemory::~TransferMemory() { | ||||
|     Reset(); | ||||
| } | ||||
|  | ||||
| std::shared_ptr<TransferMemory> TransferMemory::Create(KernelCore& kernel, Memory::Memory& memory, | ||||
| std::shared_ptr<TransferMemory> TransferMemory::Create(KernelCore& kernel, | ||||
|                                                        Core::Memory::Memory& memory, | ||||
|                                                        VAddr base_address, u64 size, | ||||
|                                                        MemoryPermission permissions) { | ||||
|     std::shared_ptr<TransferMemory> transfer_memory{ | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
|  | ||||
| union ResultCode; | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -30,12 +30,12 @@ enum class MemoryPermission : u32; | ||||
| /// | ||||
| class TransferMemory final : public Object { | ||||
| public: | ||||
|     explicit TransferMemory(KernelCore& kernel, Memory::Memory& memory); | ||||
|     explicit TransferMemory(KernelCore& kernel, Core::Memory::Memory& memory); | ||||
|     ~TransferMemory() override; | ||||
|  | ||||
|     static constexpr HandleType HANDLE_TYPE = HandleType::TransferMemory; | ||||
|  | ||||
|     static std::shared_ptr<TransferMemory> Create(KernelCore& kernel, Memory::Memory& memory, | ||||
|     static std::shared_ptr<TransferMemory> Create(KernelCore& kernel, Core::Memory::Memory& memory, | ||||
|                                                   VAddr base_address, u64 size, | ||||
|                                                   MemoryPermission permissions); | ||||
|  | ||||
| @@ -112,7 +112,7 @@ private: | ||||
|     /// Whether or not this transfer memory instance has mapped memory. | ||||
|     bool is_mapped = false; | ||||
|  | ||||
|     Memory::Memory& memory; | ||||
|     Core::Memory::Memory& memory; | ||||
| }; | ||||
|  | ||||
| } // namespace Kernel | ||||
|   | ||||
| @@ -210,7 +210,7 @@ private: | ||||
|  | ||||
|     /// This is the event handle used to check if the audio buffer was released | ||||
|     Kernel::EventPair buffer_event; | ||||
|     Memory::Memory& main_memory; | ||||
|     Core::Memory::Memory& main_memory; | ||||
| }; | ||||
|  | ||||
| AudOutU::AudOutU(Core::System& system_) : ServiceFramework("audout:u"), system{system_} { | ||||
|   | ||||
| @@ -17,7 +17,7 @@ namespace Service::LM { | ||||
|  | ||||
| class ILogger final : public ServiceFramework<ILogger> { | ||||
| public: | ||||
|     explicit ILogger(Manager& manager_, Memory::Memory& memory_) | ||||
|     explicit ILogger(Manager& manager_, Core::Memory::Memory& memory_) | ||||
|         : ServiceFramework("ILogger"), manager{manager_}, memory{memory_} { | ||||
|         static const FunctionInfo functions[] = { | ||||
|             {0, &ILogger::Log, "Log"}, | ||||
| @@ -75,12 +75,12 @@ private: | ||||
|     } | ||||
|  | ||||
|     Manager& manager; | ||||
|     Memory::Memory& memory; | ||||
|     Core::Memory::Memory& memory; | ||||
| }; | ||||
|  | ||||
| class LM final : public ServiceFramework<LM> { | ||||
| public: | ||||
|     explicit LM(Manager& manager_, Memory::Memory& memory_) | ||||
|     explicit LM(Manager& manager_, Core::Memory::Memory& memory_) | ||||
|         : ServiceFramework{"lm"}, manager{manager_}, memory{memory_} { | ||||
|         // clang-format off | ||||
|         static const FunctionInfo functions[] = { | ||||
| @@ -101,7 +101,7 @@ private: | ||||
|     } | ||||
|  | ||||
|     Manager& manager; | ||||
|     Memory::Memory& memory; | ||||
|     Core::Memory::Memory& memory; | ||||
| }; | ||||
|  | ||||
| void InstallInterfaces(Core::System& system) { | ||||
|   | ||||
| @@ -401,7 +401,7 @@ AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::Process& process) { | ||||
|     process.LoadModule(std::move(codeset), entry_point); | ||||
|  | ||||
|     is_loaded = true; | ||||
|     return {ResultStatus::Success, LoadParameters{48, Memory::DEFAULT_STACK_SIZE}}; | ||||
|     return {ResultStatus::Success, LoadParameters{48, Core::Memory::DEFAULT_STACK_SIZE}}; | ||||
| } | ||||
|  | ||||
| } // namespace Loader | ||||
|   | ||||
| @@ -14,7 +14,7 @@ namespace Loader { | ||||
|  | ||||
| namespace { | ||||
| constexpr u32 PageAlignSize(u32 size) { | ||||
|     return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | ||||
|     return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; | ||||
| } | ||||
| } // Anonymous namespace | ||||
|  | ||||
|   | ||||
| @@ -127,7 +127,7 @@ FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { | ||||
| } | ||||
|  | ||||
| static constexpr u32 PageAlignSize(u32 size) { | ||||
|     return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | ||||
|     return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; | ||||
| } | ||||
|  | ||||
| static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data, | ||||
| @@ -221,7 +221,7 @@ AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process) { | ||||
|  | ||||
|     is_loaded = true; | ||||
|     return {ResultStatus::Success, | ||||
|             LoadParameters{Kernel::THREADPRIO_DEFAULT, Memory::DEFAULT_STACK_SIZE}}; | ||||
|             LoadParameters{Kernel::THREADPRIO_DEFAULT, Core::Memory::DEFAULT_STACK_SIZE}}; | ||||
| } | ||||
|  | ||||
| ResultStatus AppLoader_NRO::ReadIcon(std::vector<u8>& buffer) { | ||||
|   | ||||
| @@ -47,7 +47,7 @@ std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | ||||
| } | ||||
|  | ||||
| constexpr u32 PageAlignSize(u32 size) { | ||||
|     return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | ||||
|     return (size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK; | ||||
| } | ||||
| } // Anonymous namespace | ||||
|  | ||||
| @@ -182,7 +182,7 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process) { | ||||
|  | ||||
|     is_loaded = true; | ||||
|     return {ResultStatus::Success, | ||||
|             LoadParameters{Kernel::THREADPRIO_DEFAULT, Memory::DEFAULT_STACK_SIZE}}; | ||||
|             LoadParameters{Kernel::THREADPRIO_DEFAULT, Core::Memory::DEFAULT_STACK_SIZE}}; | ||||
| } | ||||
|  | ||||
| ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) { | ||||
|   | ||||
| @@ -20,7 +20,7 @@ | ||||
| #include "core/memory.h" | ||||
| #include "video_core/gpu.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| // Implementation class used to keep the specifics of the memory subsystem hidden | ||||
| // from outside classes. This also allows modification to the internals of the memory | ||||
| @@ -845,4 +845,4 @@ bool IsKernelVirtualAddress(const VAddr vaddr) { | ||||
|     return KERNEL_REGION_VADDR <= vaddr && vaddr < KERNEL_REGION_END; | ||||
| } | ||||
|  | ||||
| } // namespace Memory | ||||
| } // namespace Core::Memory | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class PhysicalMemory; | ||||
| class Process; | ||||
| } // namespace Kernel | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| /** | ||||
|  * Page size used by the ARM architecture. This is the smallest granularity with which memory can | ||||
| @@ -503,4 +503,4 @@ private: | ||||
| /// Determines if the given VAddr is a kernel address | ||||
| bool IsKernelVirtualAddress(VAddr vaddr); | ||||
|  | ||||
| } // namespace Memory | ||||
| } // namespace Core::Memory | ||||
|   | ||||
| @@ -16,7 +16,7 @@ | ||||
| #include "core/hle/service/sm/sm.h" | ||||
| #include "core/memory/cheat_engine.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| constexpr s64 CHEAT_ENGINE_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 12); | ||||
| constexpr u32 KEYPAD_BITMASK = 0x3FFFFFF; | ||||
| @@ -230,4 +230,4 @@ void CheatEngine::FrameCallback(u64 userdata, s64 cycles_late) { | ||||
|     core_timing.ScheduleEvent(CHEAT_ENGINE_TICKS - cycles_late, event); | ||||
| } | ||||
|  | ||||
| } // namespace Memory | ||||
| } // namespace Core::Memory | ||||
|   | ||||
| @@ -20,7 +20,7 @@ class CoreTiming; | ||||
| struct EventType; | ||||
| } // namespace Core::Timing | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| class StandardVmCallbacks : public DmntCheatVm::Callbacks { | ||||
| public: | ||||
| @@ -84,4 +84,4 @@ private: | ||||
|     Core::System& system; | ||||
| }; | ||||
|  | ||||
| } // namespace Memory | ||||
| } // namespace Core::Memory | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
|  | ||||
| #include "common/common_types.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| struct MemoryRegionExtents { | ||||
|     u64 base{}; | ||||
| @@ -55,4 +55,4 @@ struct CheatEntry { | ||||
|     CheatDefinition definition{}; | ||||
| }; | ||||
|  | ||||
| } // namespace Memory | ||||
| } // namespace Core::Memory | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
| #include "core/memory/dmnt_cheat_types.h" | ||||
| #include "core/memory/dmnt_cheat_vm.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| DmntCheatVm::DmntCheatVm(std::unique_ptr<Callbacks> callbacks) : callbacks(std::move(callbacks)) {} | ||||
|  | ||||
| @@ -1210,4 +1210,4 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) { | ||||
|     } | ||||
| } | ||||
|  | ||||
| } // namespace Memory | ||||
| } // namespace Core::Memory | ||||
|   | ||||
| @@ -30,7 +30,7 @@ | ||||
| #include "common/common_types.h" | ||||
| #include "core/memory/dmnt_cheat_types.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
|  | ||||
| enum class CheatVmOpcodeType : u32 { | ||||
|     StoreStatic = 0, | ||||
| @@ -318,4 +318,4 @@ private: | ||||
|                                       MemoryAccessType mem_type, u64 rel_address); | ||||
| }; | ||||
|  | ||||
| }; // namespace Memory | ||||
| }; // namespace Core::Memory | ||||
|   | ||||
| @@ -147,7 +147,7 @@ json GetFullDataAuto(const std::string& timestamp, u64 title_id, Core::System& s | ||||
| } | ||||
|  | ||||
| template <bool read_value, typename DescriptorType> | ||||
| json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer, Memory::Memory& memory) { | ||||
| json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer, Core::Memory::Memory& memory) { | ||||
|     auto buffer_out = json::array(); | ||||
|     for (const auto& desc : buffer) { | ||||
|         auto entry = json{ | ||||
| @@ -167,7 +167,7 @@ json GetHLEBufferDescriptorData(const std::vector<DescriptorType>& buffer, Memor | ||||
|     return buffer_out; | ||||
| } | ||||
|  | ||||
| json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Memory::Memory& memory) { | ||||
| json GetHLERequestContextData(Kernel::HLERequestContext& ctx, Core::Memory::Memory& memory) { | ||||
|     json out; | ||||
|  | ||||
|     auto cmd_buf = json::array(); | ||||
|   | ||||
| @@ -16,7 +16,7 @@ namespace { | ||||
|  | ||||
| constexpr s64 MEMORY_FREEZER_TICKS = static_cast<s64>(Core::Hardware::BASE_CLOCK_RATE / 60); | ||||
|  | ||||
| u64 MemoryReadWidth(Memory::Memory& memory, u32 width, VAddr addr) { | ||||
| u64 MemoryReadWidth(Core::Memory::Memory& memory, u32 width, VAddr addr) { | ||||
|     switch (width) { | ||||
|     case 1: | ||||
|         return memory.Read8(addr); | ||||
| @@ -32,7 +32,7 @@ u64 MemoryReadWidth(Memory::Memory& memory, u32 width, VAddr addr) { | ||||
|     } | ||||
| } | ||||
|  | ||||
| void MemoryWriteWidth(Memory::Memory& memory, u32 width, VAddr addr, u64 value) { | ||||
| void MemoryWriteWidth(Core::Memory::Memory& memory, u32 width, VAddr addr, u64 value) { | ||||
|     switch (width) { | ||||
|     case 1: | ||||
|         memory.Write8(addr, static_cast<u8>(value)); | ||||
| @@ -53,7 +53,7 @@ void MemoryWriteWidth(Memory::Memory& memory, u32 width, VAddr addr, u64 value) | ||||
|  | ||||
| } // Anonymous namespace | ||||
|  | ||||
| Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Memory::Memory& memory_) | ||||
| Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_) | ||||
|     : core_timing{core_timing_}, memory{memory_} { | ||||
|     event = Core::Timing::CreateEvent( | ||||
|         "MemoryFreezer::FrameCallback", | ||||
|   | ||||
| @@ -16,7 +16,7 @@ class CoreTiming; | ||||
| struct EventType; | ||||
| } // namespace Core::Timing | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -38,7 +38,7 @@ public: | ||||
|         u64 value; | ||||
|     }; | ||||
|  | ||||
|     explicit Freezer(Core::Timing::CoreTiming& core_timing_, Memory::Memory& memory_); | ||||
|     explicit Freezer(Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_); | ||||
|     ~Freezer(); | ||||
|  | ||||
|     // Enables or disables the entire memory freezer. | ||||
| @@ -82,7 +82,7 @@ private: | ||||
|  | ||||
|     std::shared_ptr<Core::Timing::EventType> event; | ||||
|     Core::Timing::CoreTiming& core_timing; | ||||
|     Memory::Memory& memory; | ||||
|     Core::Memory::Memory& memory; | ||||
| }; | ||||
|  | ||||
| } // namespace Tools | ||||
|   | ||||
| @@ -23,15 +23,15 @@ constexpr auto RangeFromInterval(Map& map, const Interval& interval) { | ||||
|  | ||||
| } // Anonymous namespace | ||||
|  | ||||
| RasterizerAccelerated::RasterizerAccelerated(Memory::Memory& cpu_memory_) | ||||
| RasterizerAccelerated::RasterizerAccelerated(Core::Memory::Memory& cpu_memory_) | ||||
|     : cpu_memory{cpu_memory_} {} | ||||
|  | ||||
| RasterizerAccelerated::~RasterizerAccelerated() = default; | ||||
|  | ||||
| void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) { | ||||
|     std::lock_guard lock{pages_mutex}; | ||||
|     const u64 page_start{addr >> Memory::PAGE_BITS}; | ||||
|     const u64 page_end{(addr + size + Memory::PAGE_SIZE - 1) >> Memory::PAGE_BITS}; | ||||
|     const u64 page_start{addr >> Core::Memory::PAGE_BITS}; | ||||
|     const u64 page_end{(addr + size + Core::Memory::PAGE_SIZE - 1) >> Core::Memory::PAGE_BITS}; | ||||
|  | ||||
|     // Interval maps will erase segments if count reaches 0, so if delta is negative we have to | ||||
|     // subtract after iterating | ||||
| @@ -44,8 +44,8 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del | ||||
|         const auto interval = pair.first & pages_interval; | ||||
|         const int count = pair.second; | ||||
|  | ||||
|         const VAddr interval_start_addr = boost::icl::first(interval) << Memory::PAGE_BITS; | ||||
|         const VAddr interval_end_addr = boost::icl::last_next(interval) << Memory::PAGE_BITS; | ||||
|         const VAddr interval_start_addr = boost::icl::first(interval) << Core::Memory::PAGE_BITS; | ||||
|         const VAddr interval_end_addr = boost::icl::last_next(interval) << Core::Memory::PAGE_BITS; | ||||
|         const u64 interval_size = interval_end_addr - interval_start_addr; | ||||
|  | ||||
|         if (delta > 0 && count == delta) { | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include "common/common_types.h" | ||||
| #include "video_core/rasterizer_interface.h" | ||||
|  | ||||
| namespace Memory { | ||||
| namespace Core::Memory { | ||||
| class Memory; | ||||
| } | ||||
|  | ||||
| @@ -20,7 +20,7 @@ namespace VideoCore { | ||||
| /// Implements the shared part in GPU accelerated rasterizers in RasterizerInterface. | ||||
| class RasterizerAccelerated : public RasterizerInterface { | ||||
| public: | ||||
|     explicit RasterizerAccelerated(Memory::Memory& cpu_memory_); | ||||
|     explicit RasterizerAccelerated(Core::Memory::Memory& cpu_memory_); | ||||
|     ~RasterizerAccelerated() override; | ||||
|  | ||||
|     void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override; | ||||
| @@ -30,7 +30,7 @@ private: | ||||
|     CachedPageMap cached_pages; | ||||
|     std::mutex pages_mutex; | ||||
|  | ||||
|     Memory::Memory& cpu_memory; | ||||
|     Core::Memory::Memory& cpu_memory; | ||||
| }; | ||||
|  | ||||
| } // namespace VideoCore | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 bunnei
					bunnei