diff options
| author | 2023-03-23 19:58:48 -0400 | |
|---|---|---|
| committer | 2023-03-23 20:28:47 -0400 | |
| commit | 41d99aa89db7ee483112e49baa6c86e14adbd168 (patch) | |
| tree | 085ba1f2eb6a75c2b93d70834cc20d4b14f4d10f /src/core/hle/kernel/svc | |
| parent | Merge pull request #9971 from Morph1984/q (diff) | |
| download | yuzu-41d99aa89db7ee483112e49baa6c86e14adbd168.tar.gz yuzu-41d99aa89db7ee483112e49baa6c86e14adbd168.tar.xz yuzu-41d99aa89db7ee483112e49baa6c86e14adbd168.zip | |
memory: rename global memory references to application memory
Diffstat (limited to 'src/core/hle/kernel/svc')
| -rw-r--r-- | src/core/hle/kernel/svc/svc_cache.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_debug_string.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_exception.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_ipc.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_port.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_process.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_query_memory.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_synchronization.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_thread.cpp | 4 |
9 files changed, 17 insertions, 13 deletions
diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp index 1779832d3..082942dab 100644 --- a/src/core/hle/kernel/svc/svc_cache.cpp +++ b/src/core/hle/kernel/svc/svc_cache.cpp | |||
| @@ -46,7 +46,7 @@ Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 ad | |||
| 46 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); | 46 | R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); |
| 47 | 47 | ||
| 48 | // Perform the operation. | 48 | // Perform the operation. |
| 49 | R_RETURN(system.Memory().FlushDataCache(*process, address, size)); | 49 | R_RETURN(GetCurrentMemory(system.Kernel()).FlushDataCache(address, size)); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | void FlushEntireDataCache64(Core::System& system) { | 52 | void FlushEntireDataCache64(Core::System& system) { |
diff --git a/src/core/hle/kernel/svc/svc_debug_string.cpp b/src/core/hle/kernel/svc/svc_debug_string.cpp index 8771d2b01..4c14ce668 100644 --- a/src/core/hle/kernel/svc/svc_debug_string.cpp +++ b/src/core/hle/kernel/svc/svc_debug_string.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/core.h" | 4 | #include "core/core.h" |
| 5 | #include "core/hle/kernel/k_thread.h" | ||
| 5 | #include "core/hle/kernel/svc.h" | 6 | #include "core/hle/kernel/svc.h" |
| 6 | #include "core/memory.h" | 7 | #include "core/memory.h" |
| 7 | 8 | ||
| @@ -12,7 +13,7 @@ Result OutputDebugString(Core::System& system, u64 address, u64 len) { | |||
| 12 | R_SUCCEED_IF(len == 0); | 13 | R_SUCCEED_IF(len == 0); |
| 13 | 14 | ||
| 14 | std::string str(len, '\0'); | 15 | std::string str(len, '\0'); |
| 15 | system.Memory().ReadBlock(address, str.data(), str.size()); | 16 | GetCurrentMemory(system.Kernel()).ReadBlock(address, str.data(), str.size()); |
| 16 | LOG_DEBUG(Debug_Emulated, "{}", str); | 17 | LOG_DEBUG(Debug_Emulated, "{}", str); |
| 17 | 18 | ||
| 18 | R_SUCCEED(); | 19 | R_SUCCEED(); |
diff --git a/src/core/hle/kernel/svc/svc_exception.cpp b/src/core/hle/kernel/svc/svc_exception.cpp index 4ab5f471f..580cf2f75 100644 --- a/src/core/hle/kernel/svc/svc_exception.cpp +++ b/src/core/hle/kernel/svc/svc_exception.cpp | |||
| @@ -25,7 +25,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) { | |||
| 25 | return; | 25 | return; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | auto& memory = system.Memory(); | 28 | auto& memory = GetCurrentMemory(system.Kernel()); |
| 29 | 29 | ||
| 30 | // This typically is an error code so we're going to assume this is the case | 30 | // This typically is an error code so we're going to assume this is the case |
| 31 | if (sz == sizeof(u32)) { | 31 | if (sz == sizeof(u32)) { |
diff --git a/src/core/hle/kernel/svc/svc_ipc.cpp b/src/core/hle/kernel/svc/svc_ipc.cpp index 2a8c09a79..ea03068aa 100644 --- a/src/core/hle/kernel/svc/svc_ipc.cpp +++ b/src/core/hle/kernel/svc/svc_ipc.cpp | |||
| @@ -41,12 +41,12 @@ Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_ad | |||
| 41 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); | 41 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); |
| 42 | 42 | ||
| 43 | R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange); | 43 | R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange); |
| 44 | R_UNLESS(system.Memory().IsValidVirtualAddressRange( | 44 | R_UNLESS(GetCurrentMemory(kernel).IsValidVirtualAddressRange( |
| 45 | handles_addr, static_cast<u64>(sizeof(Handle) * num_handles)), | 45 | handles_addr, static_cast<u64>(sizeof(Handle) * num_handles)), |
| 46 | ResultInvalidPointer); | 46 | ResultInvalidPointer); |
| 47 | 47 | ||
| 48 | std::vector<Handle> handles(num_handles); | 48 | std::vector<Handle> handles(num_handles); |
| 49 | system.Memory().ReadBlock(handles_addr, handles.data(), sizeof(Handle) * num_handles); | 49 | GetCurrentMemory(kernel).ReadBlock(handles_addr, handles.data(), sizeof(Handle) * num_handles); |
| 50 | 50 | ||
| 51 | // Convert handle list to object table. | 51 | // Convert handle list to object table. |
| 52 | std::vector<KSynchronizationObject*> objs(num_handles); | 52 | std::vector<KSynchronizationObject*> objs(num_handles); |
diff --git a/src/core/hle/kernel/svc/svc_port.cpp b/src/core/hle/kernel/svc/svc_port.cpp index c6eb70422..abba757c7 100644 --- a/src/core/hle/kernel/svc/svc_port.cpp +++ b/src/core/hle/kernel/svc/svc_port.cpp | |||
| @@ -14,7 +14,8 @@ namespace Kernel::Svc { | |||
| 14 | 14 | ||
| 15 | Result ConnectToNamedPort(Core::System& system, Handle* out, u64 user_name) { | 15 | Result ConnectToNamedPort(Core::System& system, Handle* out, u64 user_name) { |
| 16 | // Copy the provided name from user memory to kernel memory. | 16 | // Copy the provided name from user memory to kernel memory. |
| 17 | auto string_name = system.Memory().ReadCString(user_name, KObjectName::NameLengthMax); | 17 | auto string_name = |
| 18 | GetCurrentMemory(system.Kernel()).ReadCString(user_name, KObjectName::NameLengthMax); | ||
| 18 | 19 | ||
| 19 | std::array<char, KObjectName::NameLengthMax> name{}; | 20 | std::array<char, KObjectName::NameLengthMax> name{}; |
| 20 | std::strncpy(name.data(), string_name.c_str(), KObjectName::NameLengthMax - 1); | 21 | std::strncpy(name.data(), string_name.c_str(), KObjectName::NameLengthMax - 1); |
| @@ -62,7 +63,8 @@ Result ConnectToPort(Core::System& system, Handle* out_handle, Handle port) { | |||
| 62 | Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t user_name, | 63 | Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t user_name, |
| 63 | int32_t max_sessions) { | 64 | int32_t max_sessions) { |
| 64 | // Copy the provided name from user memory to kernel memory. | 65 | // Copy the provided name from user memory to kernel memory. |
| 65 | auto string_name = system.Memory().ReadCString(user_name, KObjectName::NameLengthMax); | 66 | auto string_name = |
| 67 | GetCurrentMemory(system.Kernel()).ReadCString(user_name, KObjectName::NameLengthMax); | ||
| 66 | 68 | ||
| 67 | // Copy the provided name from user memory to kernel memory. | 69 | // Copy the provided name from user memory to kernel memory. |
| 68 | std::array<char, KObjectName::NameLengthMax> name{}; | 70 | std::array<char, KObjectName::NameLengthMax> name{}; |
diff --git a/src/core/hle/kernel/svc/svc_process.cpp b/src/core/hle/kernel/svc/svc_process.cpp index 3c3579947..619ed16a3 100644 --- a/src/core/hle/kernel/svc/svc_process.cpp +++ b/src/core/hle/kernel/svc/svc_process.cpp | |||
| @@ -73,7 +73,7 @@ Result GetProcessList(Core::System& system, s32* out_num_processes, u64 out_proc | |||
| 73 | R_THROW(ResultInvalidCurrentMemory); | 73 | R_THROW(ResultInvalidCurrentMemory); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | auto& memory = system.Memory(); | 76 | auto& memory = GetCurrentMemory(kernel); |
| 77 | const auto& process_list = kernel.GetProcessList(); | 77 | const auto& process_list = kernel.GetProcessList(); |
| 78 | const auto num_processes = process_list.size(); | 78 | const auto num_processes = process_list.size(); |
| 79 | const auto copy_amount = | 79 | const auto copy_amount = |
diff --git a/src/core/hle/kernel/svc/svc_query_memory.cpp b/src/core/hle/kernel/svc/svc_query_memory.cpp index 5db5611f0..4d9fcd25f 100644 --- a/src/core/hle/kernel/svc/svc_query_memory.cpp +++ b/src/core/hle/kernel/svc/svc_query_memory.cpp | |||
| @@ -30,10 +30,10 @@ Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageIn | |||
| 30 | R_THROW(ResultInvalidHandle); | 30 | R_THROW(ResultInvalidHandle); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | auto& memory{system.Memory()}; | 33 | auto& current_memory{GetCurrentMemory(system.Kernel())}; |
| 34 | const auto memory_info{process->PageTable().QueryInfo(address).GetSvcMemoryInfo()}; | 34 | const auto memory_info{process->PageTable().QueryInfo(address).GetSvcMemoryInfo()}; |
| 35 | 35 | ||
| 36 | memory.WriteBlock(out_memory_info, std::addressof(memory_info), sizeof(memory_info)); | 36 | current_memory.WriteBlock(out_memory_info, std::addressof(memory_info), sizeof(memory_info)); |
| 37 | 37 | ||
| 38 | //! This is supposed to be part of the QueryInfo call. | 38 | //! This is supposed to be part of the QueryInfo call. |
| 39 | *out_page_info = {}; | 39 | *out_page_info = {}; |
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp index e490a13ae..04d65f0bd 100644 --- a/src/core/hle/kernel/svc/svc_synchronization.cpp +++ b/src/core/hle/kernel/svc/svc_synchronization.cpp | |||
| @@ -90,7 +90,8 @@ Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_ha | |||
| 90 | 90 | ||
| 91 | std::vector<Handle> handles(num_handles); | 91 | std::vector<Handle> handles(num_handles); |
| 92 | if (num_handles > 0) { | 92 | if (num_handles > 0) { |
| 93 | system.Memory().ReadBlock(user_handles, handles.data(), num_handles * sizeof(Handle)); | 93 | GetCurrentMemory(system.Kernel()) |
| 94 | .ReadBlock(user_handles, handles.data(), num_handles * sizeof(Handle)); | ||
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | R_RETURN(WaitSynchronization(system, out_index, handles.data(), num_handles, timeout_ns)); | 97 | R_RETURN(WaitSynchronization(system, out_index, handles.data(), num_handles, timeout_ns)); |
diff --git a/src/core/hle/kernel/svc/svc_thread.cpp b/src/core/hle/kernel/svc/svc_thread.cpp index 0be4858a2..37b54079c 100644 --- a/src/core/hle/kernel/svc/svc_thread.cpp +++ b/src/core/hle/kernel/svc/svc_thread.cpp | |||
| @@ -178,7 +178,7 @@ Result GetThreadContext3(Core::System& system, u64 out_context, Handle thread_ha | |||
| 178 | R_TRY(thread->GetThreadContext3(context)); | 178 | R_TRY(thread->GetThreadContext3(context)); |
| 179 | 179 | ||
| 180 | // Copy the thread context to user space. | 180 | // Copy the thread context to user space. |
| 181 | system.Memory().WriteBlock(out_context, context.data(), context.size()); | 181 | GetCurrentMemory(kernel).WriteBlock(out_context, context.data(), context.size()); |
| 182 | 182 | ||
| 183 | R_SUCCEED(); | 183 | R_SUCCEED(); |
| 184 | } | 184 | } |
| @@ -242,7 +242,7 @@ Result GetThreadList(Core::System& system, s32* out_num_threads, u64 out_thread_ | |||
| 242 | R_THROW(ResultInvalidCurrentMemory); | 242 | R_THROW(ResultInvalidCurrentMemory); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | auto& memory = system.Memory(); | 245 | auto& memory = GetCurrentMemory(system.Kernel()); |
| 246 | const auto& thread_list = current_process->GetThreadList(); | 246 | const auto& thread_list = current_process->GetThreadList(); |
| 247 | const auto num_threads = thread_list.size(); | 247 | const auto num_threads = thread_list.size(); |
| 248 | const auto copy_amount = std::min(static_cast<std::size_t>(out_thread_ids_size), num_threads); | 248 | const auto copy_amount = std::min(static_cast<std::size_t>(out_thread_ids_size), num_threads); |