mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-25 00:37:51 -05:00
memory: rename global memory references to application memory
This commit is contained in:
@ -46,7 +46,7 @@ Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 ad
|
||||
R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Perform the operation.
|
||||
R_RETURN(system.Memory().FlushDataCache(*process, address, size));
|
||||
R_RETURN(GetCurrentMemory(system.Kernel()).FlushDataCache(address, size));
|
||||
}
|
||||
|
||||
void FlushEntireDataCache64(Core::System& system) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
@ -12,7 +13,7 @@ Result OutputDebugString(Core::System& system, u64 address, u64 len) {
|
||||
R_SUCCEED_IF(len == 0);
|
||||
|
||||
std::string str(len, '\0');
|
||||
system.Memory().ReadBlock(address, str.data(), str.size());
|
||||
GetCurrentMemory(system.Kernel()).ReadBlock(address, str.data(), str.size());
|
||||
LOG_DEBUG(Debug_Emulated, "{}", str);
|
||||
|
||||
R_SUCCEED();
|
||||
|
@ -25,7 +25,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& memory = system.Memory();
|
||||
auto& memory = GetCurrentMemory(system.Kernel());
|
||||
|
||||
// This typically is an error code so we're going to assume this is the case
|
||||
if (sz == sizeof(u32)) {
|
||||
|
@ -41,12 +41,12 @@ Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_ad
|
||||
auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
|
||||
|
||||
R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange);
|
||||
R_UNLESS(system.Memory().IsValidVirtualAddressRange(
|
||||
R_UNLESS(GetCurrentMemory(kernel).IsValidVirtualAddressRange(
|
||||
handles_addr, static_cast<u64>(sizeof(Handle) * num_handles)),
|
||||
ResultInvalidPointer);
|
||||
|
||||
std::vector<Handle> handles(num_handles);
|
||||
system.Memory().ReadBlock(handles_addr, handles.data(), sizeof(Handle) * num_handles);
|
||||
GetCurrentMemory(kernel).ReadBlock(handles_addr, handles.data(), sizeof(Handle) * num_handles);
|
||||
|
||||
// Convert handle list to object table.
|
||||
std::vector<KSynchronizationObject*> objs(num_handles);
|
||||
|
@ -14,7 +14,8 @@ namespace Kernel::Svc {
|
||||
|
||||
Result ConnectToNamedPort(Core::System& system, Handle* out, u64 user_name) {
|
||||
// Copy the provided name from user memory to kernel memory.
|
||||
auto string_name = system.Memory().ReadCString(user_name, KObjectName::NameLengthMax);
|
||||
auto string_name =
|
||||
GetCurrentMemory(system.Kernel()).ReadCString(user_name, KObjectName::NameLengthMax);
|
||||
|
||||
std::array<char, KObjectName::NameLengthMax> name{};
|
||||
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) {
|
||||
Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t user_name,
|
||||
int32_t max_sessions) {
|
||||
// Copy the provided name from user memory to kernel memory.
|
||||
auto string_name = system.Memory().ReadCString(user_name, KObjectName::NameLengthMax);
|
||||
auto string_name =
|
||||
GetCurrentMemory(system.Kernel()).ReadCString(user_name, KObjectName::NameLengthMax);
|
||||
|
||||
// Copy the provided name from user memory to kernel memory.
|
||||
std::array<char, KObjectName::NameLengthMax> name{};
|
||||
|
@ -73,7 +73,7 @@ Result GetProcessList(Core::System& system, s32* out_num_processes, u64 out_proc
|
||||
R_THROW(ResultInvalidCurrentMemory);
|
||||
}
|
||||
|
||||
auto& memory = system.Memory();
|
||||
auto& memory = GetCurrentMemory(kernel);
|
||||
const auto& process_list = kernel.GetProcessList();
|
||||
const auto num_processes = process_list.size();
|
||||
const auto copy_amount =
|
||||
|
@ -30,10 +30,10 @@ Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageIn
|
||||
R_THROW(ResultInvalidHandle);
|
||||
}
|
||||
|
||||
auto& memory{system.Memory()};
|
||||
auto& current_memory{GetCurrentMemory(system.Kernel())};
|
||||
const auto memory_info{process->PageTable().QueryInfo(address).GetSvcMemoryInfo()};
|
||||
|
||||
memory.WriteBlock(out_memory_info, std::addressof(memory_info), sizeof(memory_info));
|
||||
current_memory.WriteBlock(out_memory_info, std::addressof(memory_info), sizeof(memory_info));
|
||||
|
||||
//! This is supposed to be part of the QueryInfo call.
|
||||
*out_page_info = {};
|
||||
|
@ -90,7 +90,8 @@ Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_ha
|
||||
|
||||
std::vector<Handle> handles(num_handles);
|
||||
if (num_handles > 0) {
|
||||
system.Memory().ReadBlock(user_handles, handles.data(), num_handles * sizeof(Handle));
|
||||
GetCurrentMemory(system.Kernel())
|
||||
.ReadBlock(user_handles, handles.data(), num_handles * sizeof(Handle));
|
||||
}
|
||||
|
||||
R_RETURN(WaitSynchronization(system, out_index, handles.data(), num_handles, timeout_ns));
|
||||
|
@ -178,7 +178,7 @@ Result GetThreadContext3(Core::System& system, u64 out_context, Handle thread_ha
|
||||
R_TRY(thread->GetThreadContext3(context));
|
||||
|
||||
// Copy the thread context to user space.
|
||||
system.Memory().WriteBlock(out_context, context.data(), context.size());
|
||||
GetCurrentMemory(kernel).WriteBlock(out_context, context.data(), context.size());
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
@ -242,7 +242,7 @@ Result GetThreadList(Core::System& system, s32* out_num_threads, u64 out_thread_
|
||||
R_THROW(ResultInvalidCurrentMemory);
|
||||
}
|
||||
|
||||
auto& memory = system.Memory();
|
||||
auto& memory = GetCurrentMemory(system.Kernel());
|
||||
const auto& thread_list = current_process->GetThreadList();
|
||||
const auto num_threads = thread_list.size();
|
||||
const auto copy_amount = std::min(static_cast<std::size_t>(out_thread_ids_size), num_threads);
|
||||
|
Reference in New Issue
Block a user