1
0
Fork 0
forked from suyu/suyu

kernel: prefer std::addressof

This commit is contained in:
Liam 2023-03-07 12:01:07 -05:00
parent 641783df8f
commit ac6cbb7134
21 changed files with 139 additions and 134 deletions

View file

@ -141,7 +141,7 @@ Result KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 cou
// Check the userspace value.
s32 user_value{};
R_UNLESS(UpdateIfEqual(m_system, &user_value, addr, value, value + 1),
R_UNLESS(UpdateIfEqual(m_system, std::addressof(user_value), addr, value, value + 1),
ResultInvalidCurrentMemory);
R_UNLESS(user_value == value, ResultInvalidState);
@ -201,9 +201,9 @@ Result KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 val
s32 user_value{};
bool succeeded{};
if (value != new_value) {
succeeded = UpdateIfEqual(m_system, &user_value, addr, value, new_value);
succeeded = UpdateIfEqual(m_system, std::addressof(user_value), addr, value, new_value);
} else {
succeeded = ReadFromUser(m_system, &user_value, addr);
succeeded = ReadFromUser(m_system, std::addressof(user_value), addr);
}
R_UNLESS(succeeded, ResultInvalidCurrentMemory);
@ -244,9 +244,9 @@ Result KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s6
s32 user_value{};
bool succeeded{};
if (decrement) {
succeeded = DecrementIfLessThan(m_system, &user_value, addr, value);
succeeded = DecrementIfLessThan(m_system, std::addressof(user_value), addr, value);
} else {
succeeded = ReadFromUser(m_system, &user_value, addr);
succeeded = ReadFromUser(m_system, std::addressof(user_value), addr);
}
if (!succeeded) {
@ -297,7 +297,7 @@ Result KAddressArbiter::WaitIfEqual(VAddr addr, s32 value, s64 timeout) {
// Read the value from userspace.
s32 user_value{};
if (!ReadFromUser(m_system, &user_value, addr)) {
if (!ReadFromUser(m_system, std::addressof(user_value), addr)) {
slp.CancelSleep();
R_THROW(ResultInvalidCurrentMemory);
}

View file

@ -195,7 +195,7 @@ public:
}
friend bool operator<(const KAutoObjectWithList& left, const KAutoObjectWithList& right) {
return &left < &right;
return KAutoObjectWithList::Compare(left, right) < 0;
}
public:

View file

@ -484,7 +484,7 @@ private:
}
PageLinkedList* GetPageList() {
return &m_ll;
return std::addressof(m_ll);
}
};

View file

@ -44,12 +44,13 @@ void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority
SCOPE_EXIT({ thread->Close(); });
ASSERT(KThread::InitializeUserThread(system, thread, entry_point, 0, stack_top, priority,
owner_process.GetIdealCoreId(), &owner_process)
owner_process.GetIdealCoreId(),
std::addressof(owner_process))
.IsSuccess());
// Register 1 must be a handle to the main thread
Handle thread_handle{};
owner_process.GetHandleTable().Add(&thread_handle, thread);
owner_process.GetHandleTable().Add(std::addressof(thread_handle), thread);
thread->SetName("main");
thread->GetContext32().cpu_registers[0] = 0;
@ -366,7 +367,7 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std:
// Initialize process address space
if (const Result result{page_table.InitializeForProcess(
metadata.GetAddressSpaceType(), false, false, false, KMemoryManager::Pool::Application,
0x8000000, code_size, &m_kernel.GetAppSystemResource(), resource_limit)};
0x8000000, code_size, std::addressof(m_kernel.GetAppSystemResource()), resource_limit)};
result.IsError()) {
R_RETURN(result);
}

View file

@ -119,7 +119,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) {
if (m_current_hints[index] + value <= m_limit_values[index] &&
(timeout < 0 || m_core_timing->GetGlobalTimeNs().count() < timeout)) {
m_waiter_count++;
m_cond_var.Wait(&m_lock, timeout, false);
m_cond_var.Wait(std::addressof(m_lock), timeout, false);
m_waiter_count--;
} else {
break;
@ -154,7 +154,7 @@ void KResourceLimit::Release(LimitableResource which, s64 value, s64 hint) {
KResourceLimit* CreateResourceLimitForProcess(Core::System& system, s64 physical_memory_size) {
auto* resource_limit = KResourceLimit::Create(system.Kernel());
resource_limit->Initialize(&system.CoreTiming());
resource_limit->Initialize(std::addressof(system.CoreTiming()));
// Initialize default resource limit values.
// TODO(bunnei): These values are the system defaults, the limits for service processes are

View file

@ -149,7 +149,7 @@ void KScheduler::Initialize(KThread* main_thread, KThread* idle_thread, s32 core
m_core_id = core_id;
m_idle_thread = idle_thread;
// m_state.idle_thread_stack = m_idle_thread->GetStackTop();
// m_state.interrupt_task_manager = &kernel.GetInterruptTaskManager();
// m_state.interrupt_task_manager = std::addressof(kernel.GetInterruptTaskManager());
// Insert the main thread into the priority queue.
// {

View file

@ -177,7 +177,7 @@ Result KServerSession::OnRequest(KSessionRequest* request) {
// This is a synchronous request, so we should wait for our request to complete.
GetCurrentThread(m_kernel).SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::IPC);
GetCurrentThread(m_kernel).BeginWait(&wait_queue);
GetCurrentThread(m_kernel).BeginWait(std::addressof(wait_queue));
}
return GetCurrentThread(m_kernel).GetWaitResult();
@ -248,7 +248,7 @@ Result KServerSession::SendReply(bool is_hle) {
if (event != nullptr) {
// // Get the client process/page table.
// KProcess *client_process = client_thread->GetOwnerProcess();
// KPageTable *client_page_table = &client_process->PageTable();
// KPageTable *client_page_table = std::addressof(client_process->PageTable());
// // If we need to, reply with an async error.
// if (R_FAILED(client_result)) {
@ -297,7 +297,7 @@ Result KServerSession::ReceiveRequest(std::shared_ptr<Service::HLERequestContext
R_UNLESS(!m_request_list.empty(), ResultNotFound);
// Pop the first request from the list.
request = &m_request_list.front();
request = std::addressof(m_request_list.front());
m_request_list.pop_front();
// Get the thread for the request.
@ -358,7 +358,7 @@ void KServerSession::CleanupRequests() {
m_current_request = nullptr;
} else if (!m_request_list.empty()) {
// Pop the request from the front of the list.
request = &m_request_list.front();
request = std::addressof(m_request_list.front());
m_request_list.pop_front();
}
}
@ -381,7 +381,8 @@ void KServerSession::CleanupRequests() {
// KProcess *client_process = (client_thread != nullptr) ?
// client_thread->GetOwnerProcess() : nullptr;
// KProcessPageTable *client_page_table = (client_process != nullptr) ?
// &client_process->GetPageTable() : nullptr;
// std::addressof(client_process->GetPageTable())
// : nullptr;
// Cleanup the mappings.
// Result result = CleanupMap(request, server_process, client_page_table);

View file

@ -44,7 +44,8 @@ Result KSharedMemory::Initialize(Core::DeviceMemory& device_memory, KProcess* ow
R_UNLESS(m_physical_address != 0, ResultOutOfMemory);
//! Insert the result into our page group.
m_page_group.emplace(m_kernel, &m_kernel.GetSystemSystemResource().GetBlockInfoManager());
m_page_group.emplace(m_kernel,
std::addressof(m_kernel.GetSystemSystemResource().GetBlockInfoManager()));
m_page_group->AddBlock(m_physical_address, num_pages);
// Commit our reservation.

View file

@ -89,7 +89,8 @@ private:
if (alloc_peak <= cur_peak) {
break;
}
} while (!Common::AtomicCompareAndSwap(&m_peak, alloc_peak, cur_peak, cur_peak));
} while (
!Common::AtomicCompareAndSwap(std::addressof(m_peak), alloc_peak, cur_peak, cur_peak));
}
public:

View file

@ -930,14 +930,14 @@ Result KThread::GetThreadContext3(std::vector<u8>& out) {
context.pstate &= 0xFF0FFE20;
out.resize(sizeof(context));
std::memcpy(out.data(), &context, sizeof(context));
std::memcpy(out.data(), std::addressof(context), sizeof(context));
} else {
// Mask away mode bits, interrupt bits, IL bit, and other reserved bits.
auto context = GetContext32();
context.cpsr &= 0xFF0FFE20;
out.resize(sizeof(context));
std::memcpy(out.data(), &context, sizeof(context));
std::memcpy(out.data(), std::addressof(context), sizeof(context));
}
}
}

View file

@ -16,7 +16,7 @@ namespace Kernel {
Result KThreadLocalPage::Initialize(KernelCore& kernel, KProcess* process) {
// Set that this process owns us.
m_owner = process;
m_kernel = &kernel;
m_kernel = std::addressof(kernel);
// Allocate a new page.
KPageBuffer* page_buf = KPageBuffer::Allocate(kernel);

View file

@ -36,9 +36,9 @@ static To Convert(const From& from) {
To to{};
if constexpr (sizeof(To) >= sizeof(From)) {
std::memcpy(&to, &from, sizeof(From));
std::memcpy(std::addressof(to), std::addressof(from), sizeof(From));
} else {
std::memcpy(&to, &from, sizeof(To));
std::memcpy(std::addressof(to), std::addressof(from), sizeof(To));
}
return to;
@ -87,7 +87,7 @@ static void SvcWrap_SetHeapSize64From32(Core::System& system) {
size = Convert<uint32_t>(GetReg32(system, 1));
ret = SetHeapSize64From32(system, &out_address, size);
ret = SetHeapSize64From32(system, std::addressof(out_address), size);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_address));
@ -169,7 +169,7 @@ static void SvcWrap_QueryMemory64From32(Core::System& system) {
out_memory_info = Convert<uint32_t>(GetReg32(system, 0));
address = Convert<uint32_t>(GetReg32(system, 2));
ret = QueryMemory64From32(system, out_memory_info, &out_page_info, address);
ret = QueryMemory64From32(system, out_memory_info, std::addressof(out_page_info), address);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_page_info));
@ -195,7 +195,7 @@ static void SvcWrap_CreateThread64From32(Core::System& system) {
priority = Convert<int32_t>(GetReg32(system, 0));
core_id = Convert<int32_t>(GetReg32(system, 4));
ret = CreateThread64From32(system, &out_handle, func, arg, stack_bottom, priority, core_id);
ret = CreateThread64From32(system, std::addressof(out_handle), func, arg, stack_bottom, priority, core_id);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -236,7 +236,7 @@ static void SvcWrap_GetThreadPriority64From32(Core::System& system) {
thread_handle = Convert<Handle>(GetReg32(system, 1));
ret = GetThreadPriority64From32(system, &out_priority, thread_handle);
ret = GetThreadPriority64From32(system, std::addressof(out_priority), thread_handle);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_priority));
@ -265,7 +265,7 @@ static void SvcWrap_GetThreadCoreMask64From32(Core::System& system) {
thread_handle = Convert<Handle>(GetReg32(system, 2));
ret = GetThreadCoreMask64From32(system, &out_core_id, &out_affinity_mask, thread_handle);
ret = GetThreadCoreMask64From32(system, std::addressof(out_core_id), std::addressof(out_affinity_mask), thread_handle);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_core_id));
@ -371,7 +371,7 @@ static void SvcWrap_CreateTransferMemory64From32(Core::System& system) {
size = Convert<uint32_t>(GetReg32(system, 2));
map_perm = Convert<MemoryPermission>(GetReg32(system, 3));
ret = CreateTransferMemory64From32(system, &out_handle, address, size, map_perm);
ret = CreateTransferMemory64From32(system, std::addressof(out_handle), address, size, map_perm);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -416,7 +416,7 @@ static void SvcWrap_WaitSynchronization64From32(Core::System& system) {
timeout_ns_gather[1] = GetReg32(system, 3);
timeout_ns = Convert<int64_t>(timeout_ns_gather);
ret = WaitSynchronization64From32(system, &out_index, handles, num_handles, timeout_ns);
ret = WaitSynchronization64From32(system, std::addressof(out_index), handles, num_handles, timeout_ns);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_index));
@ -511,7 +511,7 @@ static void SvcWrap_ConnectToNamedPort64From32(Core::System& system) {
name = Convert<uint32_t>(GetReg32(system, 1));
ret = ConnectToNamedPort64From32(system, &out_handle, name);
ret = ConnectToNamedPort64From32(system, std::addressof(out_handle), name);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -557,7 +557,7 @@ static void SvcWrap_SendAsyncRequestWithUserBuffer64From32(Core::System& system)
message_buffer_size = Convert<uint32_t>(GetReg32(system, 2));
session_handle = Convert<Handle>(GetReg32(system, 3));
ret = SendAsyncRequestWithUserBuffer64From32(system, &out_event_handle, message_buffer, message_buffer_size, session_handle);
ret = SendAsyncRequestWithUserBuffer64From32(system, std::addressof(out_event_handle), message_buffer, message_buffer_size, session_handle);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_event_handle));
@ -571,7 +571,7 @@ static void SvcWrap_GetProcessId64From32(Core::System& system) {
process_handle = Convert<Handle>(GetReg32(system, 1));
ret = GetProcessId64From32(system, &out_process_id, process_handle);
ret = GetProcessId64From32(system, std::addressof(out_process_id), process_handle);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_process_id_scatter = Convert<std::array<uint32_t, 2>>(out_process_id);
@ -587,7 +587,7 @@ static void SvcWrap_GetThreadId64From32(Core::System& system) {
thread_handle = Convert<Handle>(GetReg32(system, 1));
ret = GetThreadId64From32(system, &out_thread_id, thread_handle);
ret = GetThreadId64From32(system, std::addressof(out_thread_id), thread_handle);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_thread_id_scatter = Convert<std::array<uint32_t, 2>>(out_thread_id);
@ -644,7 +644,7 @@ static void SvcWrap_GetInfo64From32(Core::System& system) {
info_subtype_gather[1] = GetReg32(system, 3);
info_subtype = Convert<uint64_t>(info_subtype_gather);
ret = GetInfo64From32(system, &out, info_type, handle, info_subtype);
ret = GetInfo64From32(system, std::addressof(out), info_type, handle, info_subtype);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_scatter = Convert<std::array<uint32_t, 2>>(out);
@ -712,7 +712,7 @@ static void SvcWrap_GetDebugFutureThreadInfo64From32(Core::System& system) {
ns_gather[1] = GetReg32(system, 1);
ns = Convert<int64_t>(ns_gather);
ret = GetDebugFutureThreadInfo64From32(system, &out_context, &out_thread_id, debug_handle, ns);
ret = GetDebugFutureThreadInfo64From32(system, std::addressof(out_context), std::addressof(out_thread_id), debug_handle, ns);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_context_scatter = Convert<std::array<uint32_t, 4>>(out_context);
@ -732,7 +732,7 @@ static void SvcWrap_GetLastThreadInfo64From32(Core::System& system) {
uint64_t out_tls_address{};
uint32_t out_flags{};
ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags);
ret = GetLastThreadInfo64From32(system, std::addressof(out_context), std::addressof(out_tls_address), std::addressof(out_flags));
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_context_scatter = Convert<std::array<uint32_t, 4>>(out_context);
@ -754,7 +754,7 @@ static void SvcWrap_GetResourceLimitLimitValue64From32(Core::System& system) {
resource_limit_handle = Convert<Handle>(GetReg32(system, 1));
which = Convert<LimitableResource>(GetReg32(system, 2));
ret = GetResourceLimitLimitValue64From32(system, &out_limit_value, resource_limit_handle, which);
ret = GetResourceLimitLimitValue64From32(system, std::addressof(out_limit_value), resource_limit_handle, which);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_limit_value_scatter = Convert<std::array<uint32_t, 2>>(out_limit_value);
@ -772,7 +772,7 @@ static void SvcWrap_GetResourceLimitCurrentValue64From32(Core::System& system) {
resource_limit_handle = Convert<Handle>(GetReg32(system, 1));
which = Convert<LimitableResource>(GetReg32(system, 2));
ret = GetResourceLimitCurrentValue64From32(system, &out_current_value, resource_limit_handle, which);
ret = GetResourceLimitCurrentValue64From32(system, std::addressof(out_current_value), resource_limit_handle, which);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_current_value_scatter = Convert<std::array<uint32_t, 2>>(out_current_value);
@ -861,7 +861,7 @@ static void SvcWrap_GetResourceLimitPeakValue64From32(Core::System& system) {
resource_limit_handle = Convert<Handle>(GetReg32(system, 1));
which = Convert<LimitableResource>(GetReg32(system, 2));
ret = GetResourceLimitPeakValue64From32(system, &out_peak_value, resource_limit_handle, which);
ret = GetResourceLimitPeakValue64From32(system, std::addressof(out_peak_value), resource_limit_handle, which);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_peak_value_scatter = Convert<std::array<uint32_t, 2>>(out_peak_value);
@ -877,7 +877,7 @@ static void SvcWrap_CreateIoPool64From32(Core::System& system) {
which = Convert<IoPoolType>(GetReg32(system, 1));
ret = CreateIoPool64From32(system, &out_handle, which);
ret = CreateIoPool64From32(system, std::addressof(out_handle), which);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -902,7 +902,7 @@ static void SvcWrap_CreateIoRegion64From32(Core::System& system) {
mapping = Convert<MemoryMapping>(GetReg32(system, 4));
perm = Convert<MemoryPermission>(GetReg32(system, 5));
ret = CreateIoRegion64From32(system, &out_handle, io_pool, physical_address, size, mapping, perm);
ret = CreateIoRegion64From32(system, std::addressof(out_handle), io_pool, physical_address, size, mapping, perm);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -950,7 +950,7 @@ static void SvcWrap_CreateSession64From32(Core::System& system) {
is_light = Convert<bool>(GetReg32(system, 2));
name = Convert<uint32_t>(GetReg32(system, 3));
ret = CreateSession64From32(system, &out_server_session_handle, &out_client_session_handle, is_light, name);
ret = CreateSession64From32(system, std::addressof(out_server_session_handle), std::addressof(out_client_session_handle), is_light, name);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_server_session_handle));
@ -965,7 +965,7 @@ static void SvcWrap_AcceptSession64From32(Core::System& system) {
port = Convert<Handle>(GetReg32(system, 1));
ret = AcceptSession64From32(system, &out_handle, port);
ret = AcceptSession64From32(system, std::addressof(out_handle), port);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -988,7 +988,7 @@ static void SvcWrap_ReplyAndReceive64From32(Core::System& system) {
timeout_ns_gather[1] = GetReg32(system, 4);
timeout_ns = Convert<int64_t>(timeout_ns_gather);
ret = ReplyAndReceive64From32(system, &out_index, handles, num_handles, reply_target, timeout_ns);
ret = ReplyAndReceive64From32(system, std::addressof(out_index), handles, num_handles, reply_target, timeout_ns);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_index));
@ -1015,7 +1015,7 @@ static void SvcWrap_ReplyAndReceiveWithUserBuffer64From32(Core::System& system)
timeout_ns_gather[1] = GetReg32(system, 6);
timeout_ns = Convert<int64_t>(timeout_ns_gather);
ret = ReplyAndReceiveWithUserBuffer64From32(system, &out_index, message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns);
ret = ReplyAndReceiveWithUserBuffer64From32(system, std::addressof(out_index), message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_index));
@ -1027,7 +1027,7 @@ static void SvcWrap_CreateEvent64From32(Core::System& system) {
Handle out_write_handle{};
Handle out_read_handle{};
ret = CreateEvent64From32(system, &out_write_handle, &out_read_handle);
ret = CreateEvent64From32(system, std::addressof(out_write_handle), std::addressof(out_read_handle));
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_write_handle));
@ -1118,7 +1118,7 @@ static void SvcWrap_CreateCodeMemory64From32(Core::System& system) {
address = Convert<uint32_t>(GetReg32(system, 1));
size = Convert<uint32_t>(GetReg32(system, 2));
ret = CreateCodeMemory64From32(system, &out_handle, address, size);
ret = CreateCodeMemory64From32(system, std::addressof(out_handle), address, size);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -1169,7 +1169,7 @@ static void SvcWrap_ReadWriteRegister64From32(Core::System& system) {
mask = Convert<uint32_t>(GetReg32(system, 0));
value = Convert<uint32_t>(GetReg32(system, 1));
ret = ReadWriteRegister64From32(system, &out_value, address, mask, value);
ret = ReadWriteRegister64From32(system, std::addressof(out_value), address, mask, value);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_value));
@ -1201,7 +1201,7 @@ static void SvcWrap_CreateSharedMemory64From32(Core::System& system) {
owner_perm = Convert<MemoryPermission>(GetReg32(system, 2));
remote_perm = Convert<MemoryPermission>(GetReg32(system, 3));
ret = CreateSharedMemory64From32(system, &out_handle, size, owner_perm, remote_perm);
ret = CreateSharedMemory64From32(system, std::addressof(out_handle), size, owner_perm, remote_perm);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -1251,7 +1251,7 @@ static void SvcWrap_CreateInterruptEvent64From32(Core::System& system) {
interrupt_id = Convert<int32_t>(GetReg32(system, 1));
interrupt_type = Convert<InterruptType>(GetReg32(system, 2));
ret = CreateInterruptEvent64From32(system, &out_read_handle, interrupt_id, interrupt_type);
ret = CreateInterruptEvent64From32(system, std::addressof(out_read_handle), interrupt_id, interrupt_type);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_read_handle));
@ -1265,7 +1265,7 @@ static void SvcWrap_QueryPhysicalAddress64From32(Core::System& system) {
address = Convert<uint32_t>(GetReg32(system, 1));
ret = QueryPhysicalAddress64From32(system, &out_info, address);
ret = QueryPhysicalAddress64From32(system, std::addressof(out_info), address);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_info_scatter = Convert<std::array<uint32_t, 4>>(out_info);
@ -1289,7 +1289,7 @@ static void SvcWrap_QueryIoMapping64From32(Core::System& system) {
physical_address = Convert<uint64_t>(physical_address_gather);
size = Convert<uint32_t>(GetReg32(system, 0));
ret = QueryIoMapping64From32(system, &out_address, &out_size, physical_address, size);
ret = QueryIoMapping64From32(system, std::addressof(out_address), std::addressof(out_size), physical_address, size);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_address));
@ -1312,7 +1312,7 @@ static void SvcWrap_CreateDeviceAddressSpace64From32(Core::System& system) {
das_size_gather[1] = GetReg32(system, 1);
das_size = Convert<uint64_t>(das_size_gather);
ret = CreateDeviceAddressSpace64From32(system, &out_handle, das_address, das_size);
ret = CreateDeviceAddressSpace64From32(system, std::addressof(out_handle), das_address, das_size);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -1505,7 +1505,7 @@ static void SvcWrap_DebugActiveProcess64From32(Core::System& system) {
process_id_gather[1] = GetReg32(system, 3);
process_id = Convert<uint64_t>(process_id_gather);
ret = DebugActiveProcess64From32(system, &out_handle, process_id);
ret = DebugActiveProcess64From32(system, std::addressof(out_handle), process_id);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -1577,7 +1577,7 @@ static void SvcWrap_GetProcessList64From32(Core::System& system) {
out_process_ids = Convert<uint32_t>(GetReg32(system, 1));
max_out_count = Convert<int32_t>(GetReg32(system, 2));
ret = GetProcessList64From32(system, &out_num_processes, out_process_ids, max_out_count);
ret = GetProcessList64From32(system, std::addressof(out_num_processes), out_process_ids, max_out_count);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_num_processes));
@ -1595,7 +1595,7 @@ static void SvcWrap_GetThreadList64From32(Core::System& system) {
max_out_count = Convert<int32_t>(GetReg32(system, 2));
debug_handle = Convert<Handle>(GetReg32(system, 3));
ret = GetThreadList64From32(system, &out_num_threads, out_thread_ids, max_out_count, debug_handle);
ret = GetThreadList64From32(system, std::addressof(out_num_threads), out_thread_ids, max_out_count, debug_handle);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_num_threads));
@ -1655,7 +1655,7 @@ static void SvcWrap_QueryDebugProcessMemory64From32(Core::System& system) {
process_handle = Convert<Handle>(GetReg32(system, 2));
address = Convert<uint32_t>(GetReg32(system, 3));
ret = QueryDebugProcessMemory64From32(system, out_memory_info, &out_page_info, process_handle, address);
ret = QueryDebugProcessMemory64From32(system, out_memory_info, std::addressof(out_page_info), process_handle, address);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_page_info));
@ -1735,7 +1735,7 @@ static void SvcWrap_GetDebugThreadParam64From32(Core::System& system) {
thread_id = Convert<uint64_t>(thread_id_gather);
param = Convert<DebugThreadParam>(GetReg32(system, 3));
ret = GetDebugThreadParam64From32(system, &out_64, &out_32, debug_handle, thread_id, param);
ret = GetDebugThreadParam64From32(system, std::addressof(out_64), std::addressof(out_32), debug_handle, thread_id, param);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_64_scatter = Convert<std::array<uint32_t, 2>>(out_64);
@ -1759,7 +1759,7 @@ static void SvcWrap_GetSystemInfo64From32(Core::System& system) {
info_subtype_gather[1] = GetReg32(system, 3);
info_subtype = Convert<uint64_t>(info_subtype_gather);
ret = GetSystemInfo64From32(system, &out, info_type, handle, info_subtype);
ret = GetSystemInfo64From32(system, std::addressof(out), info_type, handle, info_subtype);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_scatter = Convert<std::array<uint32_t, 2>>(out);
@ -1780,7 +1780,7 @@ static void SvcWrap_CreatePort64From32(Core::System& system) {
is_light = Convert<bool>(GetReg32(system, 3));
name = Convert<uint32_t>(GetReg32(system, 0));
ret = CreatePort64From32(system, &out_server_handle, &out_client_handle, max_sessions, is_light, name);
ret = CreatePort64From32(system, std::addressof(out_server_handle), std::addressof(out_client_handle), max_sessions, is_light, name);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_server_handle));
@ -1797,7 +1797,7 @@ static void SvcWrap_ManageNamedPort64From32(Core::System& system) {
name = Convert<uint32_t>(GetReg32(system, 1));
max_sessions = Convert<int32_t>(GetReg32(system, 2));
ret = ManageNamedPort64From32(system, &out_server_handle, name, max_sessions);
ret = ManageNamedPort64From32(system, std::addressof(out_server_handle), name, max_sessions);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_server_handle));
@ -1811,7 +1811,7 @@ static void SvcWrap_ConnectToPort64From32(Core::System& system) {
port = Convert<Handle>(GetReg32(system, 1));
ret = ConnectToPort64From32(system, &out_handle, port);
ret = ConnectToPort64From32(system, std::addressof(out_handle), port);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -1898,7 +1898,7 @@ static void SvcWrap_QueryProcessMemory64From32(Core::System& system) {
address_gather[1] = GetReg32(system, 3);
address = Convert<uint64_t>(address_gather);
ret = QueryProcessMemory64From32(system, out_memory_info, &out_page_info, process_handle, address);
ret = QueryProcessMemory64From32(system, out_memory_info, std::addressof(out_page_info), process_handle, address);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_page_info));
@ -1970,7 +1970,7 @@ static void SvcWrap_CreateProcess64From32(Core::System& system) {
caps = Convert<uint32_t>(GetReg32(system, 2));
num_caps = Convert<int32_t>(GetReg32(system, 3));
ret = CreateProcess64From32(system, &out_handle, parameters, caps, num_caps);
ret = CreateProcess64From32(system, std::addressof(out_handle), parameters, caps, num_caps);
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -2019,7 +2019,7 @@ static void SvcWrap_GetProcessInfo64From32(Core::System& system) {
process_handle = Convert<Handle>(GetReg32(system, 1));
info_type = Convert<ProcessInfoType>(GetReg32(system, 2));
ret = GetProcessInfo64From32(system, &out_info, process_handle, info_type);
ret = GetProcessInfo64From32(system, std::addressof(out_info), process_handle, info_type);
SetReg32(system, 0, Convert<uint32_t>(ret));
auto out_info_scatter = Convert<std::array<uint32_t, 2>>(out_info);
@ -2032,7 +2032,7 @@ static void SvcWrap_CreateResourceLimit64From32(Core::System& system) {
Handle out_handle{};
ret = CreateResourceLimit64From32(system, &out_handle);
ret = CreateResourceLimit64From32(system, std::addressof(out_handle));
SetReg32(system, 0, Convert<uint32_t>(ret));
SetReg32(system, 1, Convert<uint32_t>(out_handle));
@ -2093,7 +2093,7 @@ static void SvcWrap_SetHeapSize64(Core::System& system) {
size = Convert<uint64_t>(GetReg64(system, 1));
ret = SetHeapSize64(system, &out_address, size);
ret = SetHeapSize64(system, std::addressof(out_address), size);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_address));
@ -2175,7 +2175,7 @@ static void SvcWrap_QueryMemory64(Core::System& system) {
out_memory_info = Convert<uint64_t>(GetReg64(system, 0));
address = Convert<uint64_t>(GetReg64(system, 2));
ret = QueryMemory64(system, out_memory_info, &out_page_info, address);
ret = QueryMemory64(system, out_memory_info, std::addressof(out_page_info), address);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_page_info));
@ -2201,7 +2201,7 @@ static void SvcWrap_CreateThread64(Core::System& system) {
priority = Convert<int32_t>(GetReg64(system, 4));
core_id = Convert<int32_t>(GetReg64(system, 5));
ret = CreateThread64(system, &out_handle, func, arg, stack_bottom, priority, core_id);
ret = CreateThread64(system, std::addressof(out_handle), func, arg, stack_bottom, priority, core_id);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -2239,7 +2239,7 @@ static void SvcWrap_GetThreadPriority64(Core::System& system) {
thread_handle = Convert<Handle>(GetReg64(system, 1));
ret = GetThreadPriority64(system, &out_priority, thread_handle);
ret = GetThreadPriority64(system, std::addressof(out_priority), thread_handle);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_priority));
@ -2268,7 +2268,7 @@ static void SvcWrap_GetThreadCoreMask64(Core::System& system) {
thread_handle = Convert<Handle>(GetReg64(system, 2));
ret = GetThreadCoreMask64(system, &out_core_id, &out_affinity_mask, thread_handle);
ret = GetThreadCoreMask64(system, std::addressof(out_core_id), std::addressof(out_affinity_mask), thread_handle);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_core_id));
@ -2369,7 +2369,7 @@ static void SvcWrap_CreateTransferMemory64(Core::System& system) {
size = Convert<uint64_t>(GetReg64(system, 2));
map_perm = Convert<MemoryPermission>(GetReg64(system, 3));
ret = CreateTransferMemory64(system, &out_handle, address, size, map_perm);
ret = CreateTransferMemory64(system, std::addressof(out_handle), address, size, map_perm);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -2411,7 +2411,7 @@ static void SvcWrap_WaitSynchronization64(Core::System& system) {
num_handles = Convert<int32_t>(GetReg64(system, 2));
timeout_ns = Convert<int64_t>(GetReg64(system, 3));
ret = WaitSynchronization64(system, &out_index, handles, num_handles, timeout_ns);
ret = WaitSynchronization64(system, std::addressof(out_index), handles, num_handles, timeout_ns);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_index));
@ -2501,7 +2501,7 @@ static void SvcWrap_ConnectToNamedPort64(Core::System& system) {
name = Convert<uint64_t>(GetReg64(system, 1));
ret = ConnectToNamedPort64(system, &out_handle, name);
ret = ConnectToNamedPort64(system, std::addressof(out_handle), name);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -2547,7 +2547,7 @@ static void SvcWrap_SendAsyncRequestWithUserBuffer64(Core::System& system) {
message_buffer_size = Convert<uint64_t>(GetReg64(system, 2));
session_handle = Convert<Handle>(GetReg64(system, 3));
ret = SendAsyncRequestWithUserBuffer64(system, &out_event_handle, message_buffer, message_buffer_size, session_handle);
ret = SendAsyncRequestWithUserBuffer64(system, std::addressof(out_event_handle), message_buffer, message_buffer_size, session_handle);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_event_handle));
@ -2561,7 +2561,7 @@ static void SvcWrap_GetProcessId64(Core::System& system) {
process_handle = Convert<Handle>(GetReg64(system, 1));
ret = GetProcessId64(system, &out_process_id, process_handle);
ret = GetProcessId64(system, std::addressof(out_process_id), process_handle);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_process_id));
@ -2575,7 +2575,7 @@ static void SvcWrap_GetThreadId64(Core::System& system) {
thread_handle = Convert<Handle>(GetReg64(system, 1));
ret = GetThreadId64(system, &out_thread_id, thread_handle);
ret = GetThreadId64(system, std::addressof(out_thread_id), thread_handle);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_thread_id));
@ -2627,7 +2627,7 @@ static void SvcWrap_GetInfo64(Core::System& system) {
handle = Convert<Handle>(GetReg64(system, 2));
info_subtype = Convert<uint64_t>(GetReg64(system, 3));
ret = GetInfo64(system, &out, info_type, handle, info_subtype);
ret = GetInfo64(system, std::addressof(out), info_type, handle, info_subtype);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out));
@ -2690,7 +2690,7 @@ static void SvcWrap_GetDebugFutureThreadInfo64(Core::System& system) {
debug_handle = Convert<Handle>(GetReg64(system, 2));
ns = Convert<int64_t>(GetReg64(system, 3));
ret = GetDebugFutureThreadInfo64(system, &out_context, &out_thread_id, debug_handle, ns);
ret = GetDebugFutureThreadInfo64(system, std::addressof(out_context), std::addressof(out_thread_id), debug_handle, ns);
SetReg64(system, 0, Convert<uint64_t>(ret));
auto out_context_scatter = Convert<std::array<uint64_t, 4>>(out_context);
@ -2708,7 +2708,7 @@ static void SvcWrap_GetLastThreadInfo64(Core::System& system) {
uint64_t out_tls_address{};
uint32_t out_flags{};
ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags);
ret = GetLastThreadInfo64(system, std::addressof(out_context), std::addressof(out_tls_address), std::addressof(out_flags));
SetReg64(system, 0, Convert<uint64_t>(ret));
auto out_context_scatter = Convert<std::array<uint64_t, 4>>(out_context);
@ -2730,7 +2730,7 @@ static void SvcWrap_GetResourceLimitLimitValue64(Core::System& system) {
resource_limit_handle = Convert<Handle>(GetReg64(system, 1));
which = Convert<LimitableResource>(GetReg64(system, 2));
ret = GetResourceLimitLimitValue64(system, &out_limit_value, resource_limit_handle, which);
ret = GetResourceLimitLimitValue64(system, std::addressof(out_limit_value), resource_limit_handle, which);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_limit_value));
@ -2746,7 +2746,7 @@ static void SvcWrap_GetResourceLimitCurrentValue64(Core::System& system) {
resource_limit_handle = Convert<Handle>(GetReg64(system, 1));
which = Convert<LimitableResource>(GetReg64(system, 2));
ret = GetResourceLimitCurrentValue64(system, &out_current_value, resource_limit_handle, which);
ret = GetResourceLimitCurrentValue64(system, std::addressof(out_current_value), resource_limit_handle, which);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_current_value));
@ -2830,7 +2830,7 @@ static void SvcWrap_GetResourceLimitPeakValue64(Core::System& system) {
resource_limit_handle = Convert<Handle>(GetReg64(system, 1));
which = Convert<LimitableResource>(GetReg64(system, 2));
ret = GetResourceLimitPeakValue64(system, &out_peak_value, resource_limit_handle, which);
ret = GetResourceLimitPeakValue64(system, std::addressof(out_peak_value), resource_limit_handle, which);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_peak_value));
@ -2844,7 +2844,7 @@ static void SvcWrap_CreateIoPool64(Core::System& system) {
which = Convert<IoPoolType>(GetReg64(system, 1));
ret = CreateIoPool64(system, &out_handle, which);
ret = CreateIoPool64(system, std::addressof(out_handle), which);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -2866,7 +2866,7 @@ static void SvcWrap_CreateIoRegion64(Core::System& system) {
mapping = Convert<MemoryMapping>(GetReg64(system, 4));
perm = Convert<MemoryPermission>(GetReg64(system, 5));
ret = CreateIoRegion64(system, &out_handle, io_pool, physical_address, size, mapping, perm);
ret = CreateIoRegion64(system, std::addressof(out_handle), io_pool, physical_address, size, mapping, perm);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -2905,7 +2905,7 @@ static void SvcWrap_CreateSession64(Core::System& system) {
is_light = Convert<bool>(GetReg64(system, 2));
name = Convert<uint64_t>(GetReg64(system, 3));
ret = CreateSession64(system, &out_server_session_handle, &out_client_session_handle, is_light, name);
ret = CreateSession64(system, std::addressof(out_server_session_handle), std::addressof(out_client_session_handle), is_light, name);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_server_session_handle));
@ -2920,7 +2920,7 @@ static void SvcWrap_AcceptSession64(Core::System& system) {
port = Convert<Handle>(GetReg64(system, 1));
ret = AcceptSession64(system, &out_handle, port);
ret = AcceptSession64(system, std::addressof(out_handle), port);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -2940,7 +2940,7 @@ static void SvcWrap_ReplyAndReceive64(Core::System& system) {
reply_target = Convert<Handle>(GetReg64(system, 3));
timeout_ns = Convert<int64_t>(GetReg64(system, 4));
ret = ReplyAndReceive64(system, &out_index, handles, num_handles, reply_target, timeout_ns);
ret = ReplyAndReceive64(system, std::addressof(out_index), handles, num_handles, reply_target, timeout_ns);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_index));
@ -2964,7 +2964,7 @@ static void SvcWrap_ReplyAndReceiveWithUserBuffer64(Core::System& system) {
reply_target = Convert<Handle>(GetReg64(system, 5));
timeout_ns = Convert<int64_t>(GetReg64(system, 6));
ret = ReplyAndReceiveWithUserBuffer64(system, &out_index, message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns);
ret = ReplyAndReceiveWithUserBuffer64(system, std::addressof(out_index), message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_index));
@ -2976,7 +2976,7 @@ static void SvcWrap_CreateEvent64(Core::System& system) {
Handle out_write_handle{};
Handle out_read_handle{};
ret = CreateEvent64(system, &out_write_handle, &out_read_handle);
ret = CreateEvent64(system, std::addressof(out_write_handle), std::addressof(out_read_handle));
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_write_handle));
@ -3067,7 +3067,7 @@ static void SvcWrap_CreateCodeMemory64(Core::System& system) {
address = Convert<uint64_t>(GetReg64(system, 1));
size = Convert<uint64_t>(GetReg64(system, 2));
ret = CreateCodeMemory64(system, &out_handle, address, size);
ret = CreateCodeMemory64(system, std::addressof(out_handle), address, size);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -3109,7 +3109,7 @@ static void SvcWrap_ReadWriteRegister64(Core::System& system) {
mask = Convert<uint32_t>(GetReg64(system, 2));
value = Convert<uint32_t>(GetReg64(system, 3));
ret = ReadWriteRegister64(system, &out_value, address, mask, value);
ret = ReadWriteRegister64(system, std::addressof(out_value), address, mask, value);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_value));
@ -3141,7 +3141,7 @@ static void SvcWrap_CreateSharedMemory64(Core::System& system) {
owner_perm = Convert<MemoryPermission>(GetReg64(system, 2));
remote_perm = Convert<MemoryPermission>(GetReg64(system, 3));
ret = CreateSharedMemory64(system, &out_handle, size, owner_perm, remote_perm);
ret = CreateSharedMemory64(system, std::addressof(out_handle), size, owner_perm, remote_perm);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -3191,7 +3191,7 @@ static void SvcWrap_CreateInterruptEvent64(Core::System& system) {
interrupt_id = Convert<int32_t>(GetReg64(system, 1));
interrupt_type = Convert<InterruptType>(GetReg64(system, 2));
ret = CreateInterruptEvent64(system, &out_read_handle, interrupt_id, interrupt_type);
ret = CreateInterruptEvent64(system, std::addressof(out_read_handle), interrupt_id, interrupt_type);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_read_handle));
@ -3205,7 +3205,7 @@ static void SvcWrap_QueryPhysicalAddress64(Core::System& system) {
address = Convert<uint64_t>(GetReg64(system, 1));
ret = QueryPhysicalAddress64(system, &out_info, address);
ret = QueryPhysicalAddress64(system, std::addressof(out_info), address);
SetReg64(system, 0, Convert<uint64_t>(ret));
auto out_info_scatter = Convert<std::array<uint64_t, 3>>(out_info);
@ -3225,7 +3225,7 @@ static void SvcWrap_QueryIoMapping64(Core::System& system) {
physical_address = Convert<uint64_t>(GetReg64(system, 2));
size = Convert<uint64_t>(GetReg64(system, 3));
ret = QueryIoMapping64(system, &out_address, &out_size, physical_address, size);
ret = QueryIoMapping64(system, std::addressof(out_address), std::addressof(out_size), physical_address, size);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_address));
@ -3242,7 +3242,7 @@ static void SvcWrap_CreateDeviceAddressSpace64(Core::System& system) {
das_address = Convert<uint64_t>(GetReg64(system, 1));
das_size = Convert<uint64_t>(GetReg64(system, 2));
ret = CreateDeviceAddressSpace64(system, &out_handle, das_address, das_size);
ret = CreateDeviceAddressSpace64(system, std::addressof(out_handle), das_address, das_size);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -3396,7 +3396,7 @@ static void SvcWrap_DebugActiveProcess64(Core::System& system) {
process_id = Convert<uint64_t>(GetReg64(system, 1));
ret = DebugActiveProcess64(system, &out_handle, process_id);
ret = DebugActiveProcess64(system, std::addressof(out_handle), process_id);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -3468,7 +3468,7 @@ static void SvcWrap_GetProcessList64(Core::System& system) {
out_process_ids = Convert<uint64_t>(GetReg64(system, 1));
max_out_count = Convert<int32_t>(GetReg64(system, 2));
ret = GetProcessList64(system, &out_num_processes, out_process_ids, max_out_count);
ret = GetProcessList64(system, std::addressof(out_num_processes), out_process_ids, max_out_count);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_num_processes));
@ -3486,7 +3486,7 @@ static void SvcWrap_GetThreadList64(Core::System& system) {
max_out_count = Convert<int32_t>(GetReg64(system, 2));
debug_handle = Convert<Handle>(GetReg64(system, 3));
ret = GetThreadList64(system, &out_num_threads, out_thread_ids, max_out_count, debug_handle);
ret = GetThreadList64(system, std::addressof(out_num_threads), out_thread_ids, max_out_count, debug_handle);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_num_threads));
@ -3540,7 +3540,7 @@ static void SvcWrap_QueryDebugProcessMemory64(Core::System& system) {
process_handle = Convert<Handle>(GetReg64(system, 2));
address = Convert<uint64_t>(GetReg64(system, 3));
ret = QueryDebugProcessMemory64(system, out_memory_info, &out_page_info, process_handle, address);
ret = QueryDebugProcessMemory64(system, out_memory_info, std::addressof(out_page_info), process_handle, address);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_page_info));
@ -3611,7 +3611,7 @@ static void SvcWrap_GetDebugThreadParam64(Core::System& system) {
thread_id = Convert<uint64_t>(GetReg64(system, 3));
param = Convert<DebugThreadParam>(GetReg64(system, 4));
ret = GetDebugThreadParam64(system, &out_64, &out_32, debug_handle, thread_id, param);
ret = GetDebugThreadParam64(system, std::addressof(out_64), std::addressof(out_32), debug_handle, thread_id, param);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_64));
@ -3630,7 +3630,7 @@ static void SvcWrap_GetSystemInfo64(Core::System& system) {
handle = Convert<Handle>(GetReg64(system, 2));
info_subtype = Convert<uint64_t>(GetReg64(system, 3));
ret = GetSystemInfo64(system, &out, info_type, handle, info_subtype);
ret = GetSystemInfo64(system, std::addressof(out), info_type, handle, info_subtype);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out));
@ -3649,7 +3649,7 @@ static void SvcWrap_CreatePort64(Core::System& system) {
is_light = Convert<bool>(GetReg64(system, 3));
name = Convert<uint64_t>(GetReg64(system, 4));
ret = CreatePort64(system, &out_server_handle, &out_client_handle, max_sessions, is_light, name);
ret = CreatePort64(system, std::addressof(out_server_handle), std::addressof(out_client_handle), max_sessions, is_light, name);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_server_handle));
@ -3666,7 +3666,7 @@ static void SvcWrap_ManageNamedPort64(Core::System& system) {
name = Convert<uint64_t>(GetReg64(system, 1));
max_sessions = Convert<int32_t>(GetReg64(system, 2));
ret = ManageNamedPort64(system, &out_server_handle, name, max_sessions);
ret = ManageNamedPort64(system, std::addressof(out_server_handle), name, max_sessions);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_server_handle));
@ -3680,7 +3680,7 @@ static void SvcWrap_ConnectToPort64(Core::System& system) {
port = Convert<Handle>(GetReg64(system, 1));
ret = ConnectToPort64(system, &out_handle, port);
ret = ConnectToPort64(system, std::addressof(out_handle), port);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -3752,7 +3752,7 @@ static void SvcWrap_QueryProcessMemory64(Core::System& system) {
process_handle = Convert<Handle>(GetReg64(system, 2));
address = Convert<uint64_t>(GetReg64(system, 3));
ret = QueryProcessMemory64(system, out_memory_info, &out_page_info, process_handle, address);
ret = QueryProcessMemory64(system, out_memory_info, std::addressof(out_page_info), process_handle, address);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_page_info));
@ -3806,7 +3806,7 @@ static void SvcWrap_CreateProcess64(Core::System& system) {
caps = Convert<uint64_t>(GetReg64(system, 2));
num_caps = Convert<int32_t>(GetReg64(system, 3));
ret = CreateProcess64(system, &out_handle, parameters, caps, num_caps);
ret = CreateProcess64(system, std::addressof(out_handle), parameters, caps, num_caps);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));
@ -3852,7 +3852,7 @@ static void SvcWrap_GetProcessInfo64(Core::System& system) {
process_handle = Convert<Handle>(GetReg64(system, 1));
info_type = Convert<ProcessInfoType>(GetReg64(system, 2));
ret = GetProcessInfo64(system, &out_info, process_handle, info_type);
ret = GetProcessInfo64(system, std::addressof(out_info), process_handle, info_type);
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_info));
@ -3863,7 +3863,7 @@ static void SvcWrap_CreateResourceLimit64(Core::System& system) {
Handle out_handle{};
ret = CreateResourceLimit64(system, &out_handle);
ret = CreateResourceLimit64(system, std::addressof(out_handle));
SetReg64(system, 0, Convert<uint64_t>(ret));
SetReg64(system, 1, Convert<uint64_t>(out_handle));

View file

@ -153,7 +153,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
}
Handle resource_handle{};
R_TRY(handle_table.Add(&resource_handle, resource_limit));
R_TRY(handle_table.Add(std::addressof(resource_handle), resource_limit));
*result = resource_handle;
R_SUCCEED();
@ -234,7 +234,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
// Get a new handle for the current process.
Handle tmp;
R_TRY(handle_table.Add(&tmp, current_process));
R_TRY(handle_table.Add(std::addressof(tmp), current_process));
// Set the output.
*result = tmp;

View file

@ -79,7 +79,7 @@ Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_ad
while (true) {
// Wait for an object.
s32 index;
Result result = KSynchronizationObject::Wait(kernel, &index, objs.data(),
Result result = KSynchronizationObject::Wait(kernel, std::addressof(index), objs.data(),
static_cast<s32>(objs.size()), timeout_ns);
if (result == ResultTimedOut) {
R_RETURN(result);

View file

@ -33,7 +33,7 @@ Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageIn
auto& memory{system.Memory()};
const auto memory_info{process->PageTable().QueryInfo(address).GetSvcMemoryInfo()};
memory.WriteBlock(out_memory_info, &memory_info, sizeof(memory_info));
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 = {};

View file

@ -21,7 +21,7 @@ Result CreateResourceLimit(Core::System& system, Handle* out_handle) {
SCOPE_EXIT({ resource_limit->Close(); });
// Initialize the resource limit.
resource_limit->Initialize(&system.CoreTiming());
resource_limit->Initialize(std::addressof(system.CoreTiming()));
// Register the limit.
KResourceLimit::Register(kernel, resource_limit);

View file

@ -29,7 +29,7 @@ void SvcWrap_CallSecureMonitor64(Core::System& system) {
args.r[i] = core.GetReg(i);
}
CallSecureMonitor64(system, &args);
CallSecureMonitor64(system, std::addressof(args));
for (int i = 0; i < 8; i++) {
core.SetReg(i, args.r[i]);
@ -43,7 +43,7 @@ void SvcWrap_CallSecureMonitor64From32(Core::System& system) {
args.r[i] = static_cast<u32>(core.GetReg(i));
}
CallSecureMonitor64From32(system, &args);
CallSecureMonitor64From32(system, std::addressof(args));
for (int i = 0; i < 8; i++) {
core.SetReg(i, args.r[i]);

View file

@ -21,7 +21,8 @@ Result CreateSession(Core::System& system, Handle* out_server, Handle* out_clien
// Reserve a new session from the process resource limit.
// FIXME: LimitableResource_SessionCountMax
KScopedResourceReservation session_reservation(&process, LimitableResource::SessionCountMax);
KScopedResourceReservation session_reservation(std::addressof(process),
LimitableResource::SessionCountMax);
if (session_reservation.Succeeded()) {
session = T::Create(system.Kernel());
} else {
@ -30,7 +31,7 @@ Result CreateSession(Core::System& system, Handle* out_server, Handle* out_clien
// // We couldn't reserve a session. Check that we support dynamically expanding the
// // resource limit.
// R_UNLESS(process.GetResourceLimit() ==
// &system.Kernel().GetSystemResourceLimit(), ResultLimitReached);
// std::addressof(system.Kernel().GetSystemResourceLimit()), ResultLimitReached);
// R_UNLESS(KTargetSystem::IsDynamicResourceLimitsEnabled(), ResultLimitReached());
// // Try to allocate a session from unused slab memory.
@ -75,7 +76,7 @@ Result CreateSession(Core::System& system, Handle* out_server, Handle* out_clien
T::Register(system.Kernel(), session);
// Add the server session to the handle table.
R_TRY(handle_table.Add(out_server, &session->GetServerSession()));
R_TRY(handle_table.Add(out_server, std::addressof(session->GetServerSession())));
// Ensure that we maintain a clean handle state on exit.
ON_RESULT_FAILURE {
@ -83,7 +84,7 @@ Result CreateSession(Core::System& system, Handle* out_server, Handle* out_clien
};
// Add the client session to the handle table.
R_RETURN(handle_table.Add(out_client, &session->GetClientSession()));
R_RETURN(handle_table.Add(out_client, std::addressof(session->GetClientSession())));
}
} // namespace

View file

@ -42,9 +42,9 @@ Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point,
R_UNLESS(process.CheckThreadPriority(priority), ResultInvalidPriority);
// Reserve a new thread from the process resource limit (waiting up to 100ms).
KScopedResourceReservation thread_reservation(&process, LimitableResource::ThreadCountMax, 1,
system.CoreTiming().GetGlobalTimeNs().count() +
100000000);
KScopedResourceReservation thread_reservation(
std::addressof(process), LimitableResource::ThreadCountMax, 1,
system.CoreTiming().GetGlobalTimeNs().count() + 100000000);
R_UNLESS(thread_reservation.Succeeded(), ResultLimitReached);
// Create the thread.
@ -56,7 +56,7 @@ Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point,
{
KScopedLightLock lk{process.GetStateLock()};
R_TRY(KThread::InitializeUserThread(system, thread, entry_point, arg, stack_bottom,
priority, core_id, &process));
priority, core_id, std::addressof(process)));
}
// Set the thread name for debugging purposes.

View file

@ -43,7 +43,7 @@ Result CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u6
auto& handle_table = process.GetHandleTable();
// Reserve a new transfer memory from the process resource limit.
KScopedResourceReservation trmem_reservation(&process,
KScopedResourceReservation trmem_reservation(std::addressof(process),
LimitableResource::TransferMemoryCountMax);
R_UNLESS(trmem_reservation.Succeeded(), ResultLimitReached);

View file

@ -460,7 +460,7 @@ def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size):
call_arguments = ["system"]
for arg in arguments:
if arg.is_output and not arg.is_outptr:
call_arguments.append(f"&{arg.var_name}")
call_arguments.append(f"std::addressof({arg.var_name})")
else:
call_arguments.append(arg.var_name)
@ -574,9 +574,9 @@ static To Convert(const From& from) {
To to{};
if constexpr (sizeof(To) >= sizeof(From)) {
std::memcpy(&to, &from, sizeof(From));
std::memcpy(std::addressof(to), std::addressof(from), sizeof(From));
} else {
std::memcpy(&to, &from, sizeof(To));
std::memcpy(std::addressof(to), std::addressof(from), sizeof(To));
}
return to;