kernel/svc: switch to generated wrappers
parent
0373000143
commit
2415d37ea2
File diff suppressed because it is too large
Load Diff
@ -1,172 +1,536 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
// This file is automatically generated using svc_generator.py.
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
#include "core/hle/result.h"
|
||||
#pragma once
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
void Call(Core::System& system, u32 immediate);
|
||||
|
||||
Result SetHeapSize(Core::System& system, VAddr* out_address, u64 size);
|
||||
Result SetMemoryPermission(Core::System& system, VAddr address, u64 size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mask, u32 attr);
|
||||
Result MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size);
|
||||
Result UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size);
|
||||
Result QueryMemory(Core::System& system, VAddr memory_info_address, VAddr page_info_address,
|
||||
VAddr query_address);
|
||||
// clang-format off
|
||||
Result SetHeapSize(Core::System& system, uintptr_t* out_address, uint64_t size);
|
||||
Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result UnmapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result QueryMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, uint64_t address);
|
||||
void ExitProcess(Core::System& system);
|
||||
Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point, u64 arg,
|
||||
VAddr stack_bottom, u32 priority, s32 core_id);
|
||||
Result CreateThread(Core::System& system, Handle* out_handle, uint64_t func, uint64_t arg, uint64_t stack_bottom, int32_t priority, int32_t core_id);
|
||||
Result StartThread(Core::System& system, Handle thread_handle);
|
||||
void ExitThread(Core::System& system);
|
||||
void SleepThread(Core::System& system, s64 nanoseconds);
|
||||
Result GetThreadPriority(Core::System& system, u32* out_priority, Handle handle);
|
||||
Result SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority);
|
||||
Result GetThreadCoreMask(Core::System& system, Handle thread_handle, s32* out_core_id,
|
||||
u64* out_affinity_mask);
|
||||
Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id,
|
||||
u64 affinity_mask);
|
||||
u32 GetCurrentProcessorNumber(Core::System& system);
|
||||
void SleepThread(Core::System& system, int64_t ns);
|
||||
Result GetThreadPriority(Core::System& system, int32_t* out_priority, Handle thread_handle);
|
||||
Result SetThreadPriority(Core::System& system, Handle thread_handle, int32_t priority);
|
||||
Result GetThreadCoreMask(Core::System& system, int32_t* out_core_id, uint64_t* out_affinity_mask, Handle thread_handle);
|
||||
Result SetThreadCoreMask(Core::System& system, Handle thread_handle, int32_t core_id, uint64_t affinity_mask);
|
||||
int32_t GetCurrentProcessorNumber(Core::System& system);
|
||||
Result SignalEvent(Core::System& system, Handle event_handle);
|
||||
Result ClearEvent(Core::System& system, Handle event_handle);
|
||||
Result MapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address, u64 size,
|
||||
MemoryPermission map_perm);
|
||||
Result UnmapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address, u64 size);
|
||||
Result CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u64 size,
|
||||
MemoryPermission map_perm);
|
||||
Result MapSharedMemory(Core::System& system, Handle shmem_handle, uint64_t address, uint64_t size, MemoryPermission map_perm);
|
||||
Result UnmapSharedMemory(Core::System& system, Handle shmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateTransferMemory(Core::System& system, Handle* out_handle, uint64_t address, uint64_t size, MemoryPermission map_perm);
|
||||
Result CloseHandle(Core::System& system, Handle handle);
|
||||
Result ResetSignal(Core::System& system, Handle handle);
|
||||
Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_address, s32 num_handles,
|
||||
s64 nano_seconds);
|
||||
Result WaitSynchronization(Core::System& system, int32_t* out_index, uint64_t handles, int32_t num_handles, int64_t timeout_ns);
|
||||
Result CancelSynchronization(Core::System& system, Handle handle);
|
||||
Result ArbitrateLock(Core::System& system, Handle thread_handle, VAddr address, u32 tag);
|
||||
Result ArbitrateUnlock(Core::System& system, VAddr address);
|
||||
Result WaitProcessWideKeyAtomic(Core::System& system, VAddr address, VAddr cv_key, u32 tag,
|
||||
s64 timeout_ns);
|
||||
void SignalProcessWideKey(Core::System& system, VAddr cv_key, s32 count);
|
||||
u64 GetSystemTick(Core::System& system);
|
||||
Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_address);
|
||||
Result SendSyncRequest(Core::System& system, Handle handle);
|
||||
Result GetProcessId(Core::System& system, u64* out_process_id, Handle handle);
|
||||
Result GetThreadId(Core::System& system, u64* out_thread_id, Handle thread_handle);
|
||||
void Break(Core::System& system, u32 reason, u64 info1, u64 info2);
|
||||
void OutputDebugString(Core::System& system, VAddr address, u64 len);
|
||||
Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle, u64 info_sub_id);
|
||||
Result MapPhysicalMemory(Core::System& system, VAddr addr, u64 size);
|
||||
Result UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size);
|
||||
Result GetResourceLimitLimitValue(Core::System& system, u64* out_limit_value,
|
||||
Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue(Core::System& system, u64* out_current_value,
|
||||
Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity(Core::System& system, Handle thread_handle,
|
||||
ThreadActivity thread_activity);
|
||||
Result GetThreadContext(Core::System& system, VAddr out_context, Handle thread_handle);
|
||||
Result WaitForAddress(Core::System& system, VAddr address, ArbitrationType arb_type, s32 value,
|
||||
s64 timeout_ns);
|
||||
Result SignalToAddress(Core::System& system, VAddr address, SignalType signal_type, s32 value,
|
||||
s32 count);
|
||||
Result ArbitrateLock(Core::System& system, Handle thread_handle, uint64_t address, uint32_t tag);
|
||||
Result ArbitrateUnlock(Core::System& system, uint64_t address);
|
||||
Result WaitProcessWideKeyAtomic(Core::System& system, uint64_t address, uint64_t cv_key, uint32_t tag, int64_t timeout_ns);
|
||||
void SignalProcessWideKey(Core::System& system, uint64_t cv_key, int32_t count);
|
||||
int64_t GetSystemTick(Core::System& system);
|
||||
Result ConnectToNamedPort(Core::System& system, Handle* out_handle, uint64_t name);
|
||||
Result SendSyncRequest(Core::System& system, Handle session_handle);
|
||||
Result SendSyncRequestWithUserBuffer(Core::System& system, uint64_t message_buffer, uint64_t message_buffer_size, Handle session_handle);
|
||||
Result SendAsyncRequestWithUserBuffer(Core::System& system, Handle* out_event_handle, uint64_t message_buffer, uint64_t message_buffer_size, Handle session_handle);
|
||||
Result GetProcessId(Core::System& system, uint64_t* out_process_id, Handle process_handle);
|
||||
Result GetThreadId(Core::System& system, uint64_t* out_thread_id, Handle thread_handle);
|
||||
void Break(Core::System& system, BreakReason break_reason, uint64_t arg, uint64_t size);
|
||||
Result OutputDebugString(Core::System& system, uint64_t debug_str, uint64_t len);
|
||||
void ReturnFromException(Core::System& system, Result result);
|
||||
Result GetInfo(Core::System& system, uint64_t* out, InfoType info_type, Handle handle, uint64_t info_subtype);
|
||||
void FlushEntireDataCache(Core::System& system);
|
||||
Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
Result GetThreadContext3(Core::System& system, uint64_t out_context, Handle thread_handle);
|
||||
Result WaitForAddress(Core::System& system, uint64_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns);
|
||||
Result SignalToAddress(Core::System& system, uint64_t address, SignalType signal_type, int32_t value, int32_t count);
|
||||
void SynchronizePreemptionState(Core::System& system);
|
||||
void KernelDebug(Core::System& system, u32 kernel_debug_type, u64 param1, u64 param2, u64 param3);
|
||||
void ChangeKernelTraceState(Core::System& system, u32 trace_state);
|
||||
Result CreateSession(Core::System& system, Handle* out_server, Handle* out_client, u32 is_light,
|
||||
u64 name);
|
||||
Result ReplyAndReceive(Core::System& system, s32* out_index, Handle* handles, s32 num_handles,
|
||||
Handle reply_target, s64 timeout_ns);
|
||||
Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read);
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size);
|
||||
Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, u32 operation,
|
||||
VAddr address, size_t size, MemoryPermission perm);
|
||||
Result GetProcessList(Core::System& system, u32* out_num_processes, VAddr out_process_ids,
|
||||
u32 out_process_ids_size);
|
||||
Result GetThreadList(Core::System& system, u32* out_num_threads, VAddr out_thread_ids,
|
||||
u32 out_thread_ids_size, Handle debug_handle);
|
||||
Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, VAddr address,
|
||||
u64 size, MemoryPermission perm);
|
||||
Result MapProcessMemory(Core::System& system, VAddr dst_address, Handle process_handle,
|
||||
VAddr src_address, u64 size);
|
||||
Result UnmapProcessMemory(Core::System& system, VAddr dst_address, Handle process_handle,
|
||||
VAddr src_address, u64 size);
|
||||
Result QueryProcessMemory(Core::System& system, VAddr memory_info_address, VAddr page_info_address,
|
||||
Handle process_handle, VAddr address);
|
||||
Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address,
|
||||
u64 src_address, u64 size);
|
||||
Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address,
|
||||
u64 src_address, u64 size);
|
||||
Result GetProcessInfo(Core::System& system, u64* out, Handle process_handle, u32 type);
|
||||
Result GetResourceLimitPeakValue(Core::System& system, int64_t* out_peak_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result CreateIoPool(Core::System& system, Handle* out_handle, IoPoolType which);
|
||||
Result CreateIoRegion(Core::System& system, Handle* out_handle, Handle io_pool, uint64_t physical_address, uint64_t size, MemoryMapping mapping, MemoryPermission perm);
|
||||
void KernelDebug(Core::System& system, KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2);
|
||||
void ChangeKernelTraceState(Core::System& system, KernelTraceState kern_trace_state);
|
||||
Result CreateSession(Core::System& system, Handle* out_server_session_handle, Handle* out_client_session_handle, bool is_light, uint64_t name);
|
||||
Result AcceptSession(Core::System& system, Handle* out_handle, Handle port);
|
||||
Result ReplyAndReceive(Core::System& system, int32_t* out_index, uint64_t handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);
|
||||
Result ReplyAndReceiveWithUserBuffer(Core::System& system, int32_t* out_index, uint64_t message_buffer, uint64_t message_buffer_size, uint64_t handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);
|
||||
Result CreateEvent(Core::System& system, Handle* out_write_handle, Handle* out_read_handle);
|
||||
Result MapIoRegion(Core::System& system, Handle io_region, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result UnmapIoRegion(Core::System& system, Handle io_region, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemoryUnsafe(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemoryUnsafe(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result SetUnsafeLimit(Core::System& system, uint64_t limit);
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out_handle, uint64_t address, uint64_t size);
|
||||
Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
void SleepSystem(Core::System& system);
|
||||
Result ReadWriteRegister(Core::System& system, uint32_t* out_value, uint64_t address, uint32_t mask, uint32_t value);
|
||||
Result SetProcessActivity(Core::System& system, Handle process_handle, ProcessActivity process_activity);
|
||||
Result CreateSharedMemory(Core::System& system, Handle* out_handle, uint64_t size, MemoryPermission owner_perm, MemoryPermission remote_perm);
|
||||
Result MapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size, MemoryPermission owner_perm);
|
||||
Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address);
|
||||
Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint64_t size, uint64_t device_address, uint32_t option);
|
||||
Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint64_t size, uint64_t device_address, uint32_t option);
|
||||
Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint64_t size, uint64_t device_address);
|
||||
Result InvalidateProcessDataCache(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result StoreProcessDataCache(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result FlushProcessDataCache(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result DebugActiveProcess(Core::System& system, Handle* out_handle, uint64_t process_id);
|
||||
Result BreakDebugProcess(Core::System& system, Handle debug_handle);
|
||||
Result TerminateDebugProcess(Core::System& system, Handle debug_handle);
|
||||
Result GetDebugEvent(Core::System& system, uint64_t out_info, Handle debug_handle);
|
||||
Result ContinueDebugEvent(Core::System& system, Handle debug_handle, uint32_t flags, uint64_t thread_ids, int32_t num_thread_ids);
|
||||
Result GetProcessList(Core::System& system, int32_t* out_num_processes, uint64_t out_process_ids, int32_t max_out_count);
|
||||
Result GetThreadList(Core::System& system, int32_t* out_num_threads, uint64_t out_thread_ids, int32_t max_out_count, Handle debug_handle);
|
||||
Result GetDebugThreadContext(Core::System& system, uint64_t out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags);
|
||||
Result SetDebugThreadContext(Core::System& system, Handle debug_handle, uint64_t thread_id, uint64_t context, uint32_t context_flags);
|
||||
Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, Handle process_handle, uint64_t address);
|
||||
Result ReadDebugProcessMemory(Core::System& system, uint64_t buffer, Handle debug_handle, uint64_t address, uint64_t size);
|
||||
Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uint64_t buffer, uint64_t address, uint64_t size);
|
||||
Result SetHardwareBreakPoint(Core::System& system, HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value);
|
||||
Result GetDebugThreadParam(Core::System& system, uint64_t* out_64, uint32_t* out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param);
|
||||
Result GetSystemInfo(Core::System& system, uint64_t* out, SystemInfoType info_type, Handle handle, uint64_t info_subtype);
|
||||
Result CreatePort(Core::System& system, Handle* out_server_handle, Handle* out_client_handle, int32_t max_sessions, bool is_light, uint64_t name);
|
||||
Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t name, int32_t max_sessions);
|
||||
Result ConnectToPort(Core::System& system, Handle* out_handle, Handle port);
|
||||
Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result MapProcessMemory(Core::System& system, uint64_t dst_address, Handle process_handle, uint64_t src_address, uint64_t size);
|
||||
Result UnmapProcessMemory(Core::System& system, uint64_t dst_address, Handle process_handle, uint64_t src_address, uint64_t size);
|
||||
Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, Handle process_handle, uint64_t address);
|
||||
Result MapProcessCodeMemory(Core::System& system, Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result CreateProcess(Core::System& system, Handle* out_handle, uint64_t parameters, uint64_t caps, int32_t num_caps);
|
||||
Result StartProcess(Core::System& system, Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size);
|
||||
Result TerminateProcess(Core::System& system, Handle process_handle);
|
||||
Result GetProcessInfo(Core::System& system, int64_t* out_info, Handle process_handle, ProcessInfoType info_type);
|
||||
Result CreateResourceLimit(Core::System& system, Handle* out_handle);
|
||||
Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle,
|
||||
LimitableResource which, u64 limit_value);
|
||||
Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle, LimitableResource which, int64_t limit_value);
|
||||
Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size);
|
||||
|
||||
//
|
||||
Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size);
|
||||
Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size);
|
||||
Result UnmapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size);
|
||||
Result QueryMemory64From32(Core::System& system, uint32_t out_memory_info, PageInfo* out_page_info, uint32_t address);
|
||||
void ExitProcess64From32(Core::System& system);
|
||||
Result CreateThread64From32(Core::System& system, Handle* out_handle, uint32_t func, uint32_t arg, uint32_t stack_bottom, int32_t priority, int32_t core_id);
|
||||
Result StartThread64From32(Core::System& system, Handle thread_handle);
|
||||
void ExitThread64From32(Core::System& system);
|
||||
void SleepThread64From32(Core::System& system, int64_t ns);
|
||||
Result GetThreadPriority64From32(Core::System& system, int32_t* out_priority, Handle thread_handle);
|
||||
Result SetThreadPriority64From32(Core::System& system, Handle thread_handle, int32_t priority);
|
||||
Result GetThreadCoreMask64From32(Core::System& system, int32_t* out_core_id, uint64_t* out_affinity_mask, Handle thread_handle);
|
||||
Result SetThreadCoreMask64From32(Core::System& system, Handle thread_handle, int32_t core_id, uint64_t affinity_mask);
|
||||
int32_t GetCurrentProcessorNumber64From32(Core::System& system);
|
||||
Result SignalEvent64From32(Core::System& system, Handle event_handle);
|
||||
Result ClearEvent64From32(Core::System& system, Handle event_handle);
|
||||
Result MapSharedMemory64From32(Core::System& system, Handle shmem_handle, uint32_t address, uint32_t size, MemoryPermission map_perm);
|
||||
Result UnmapSharedMemory64From32(Core::System& system, Handle shmem_handle, uint32_t address, uint32_t size);
|
||||
Result CreateTransferMemory64From32(Core::System& system, Handle* out_handle, uint32_t address, uint32_t size, MemoryPermission map_perm);
|
||||
Result CloseHandle64From32(Core::System& system, Handle handle);
|
||||
Result ResetSignal64From32(Core::System& system, Handle handle);
|
||||
Result WaitSynchronization64From32(Core::System& system, int32_t* out_index, uint32_t handles, int32_t num_handles, int64_t timeout_ns);
|
||||
Result CancelSynchronization64From32(Core::System& system, Handle handle);
|
||||
Result ArbitrateLock64From32(Core::System& system, Handle thread_handle, uint32_t address, uint32_t tag);
|
||||
Result ArbitrateUnlock64From32(Core::System& system, uint32_t address);
|
||||
Result WaitProcessWideKeyAtomic64From32(Core::System& system, uint32_t address, uint32_t cv_key, uint32_t tag, int64_t timeout_ns);
|
||||
void SignalProcessWideKey64From32(Core::System& system, uint32_t cv_key, int32_t count);
|
||||
int64_t GetSystemTick64From32(Core::System& system);
|
||||
Result ConnectToNamedPort64From32(Core::System& system, Handle* out_handle, uint32_t name);
|
||||
Result SendSyncRequest64From32(Core::System& system, Handle session_handle);
|
||||
Result SendSyncRequestWithUserBuffer64From32(Core::System& system, uint32_t message_buffer, uint32_t message_buffer_size, Handle session_handle);
|
||||
Result SendAsyncRequestWithUserBuffer64From32(Core::System& system, Handle* out_event_handle, uint32_t message_buffer, uint32_t message_buffer_size, Handle session_handle);
|
||||
Result GetProcessId64From32(Core::System& system, uint64_t* out_process_id, Handle process_handle);
|
||||
Result GetThreadId64From32(Core::System& system, uint64_t* out_thread_id, Handle thread_handle);
|
||||
void Break64From32(Core::System& system, BreakReason break_reason, uint32_t arg, uint32_t size);
|
||||
Result OutputDebugString64From32(Core::System& system, uint32_t debug_str, uint32_t len);
|
||||
void ReturnFromException64From32(Core::System& system, Result result);
|
||||
Result GetInfo64From32(Core::System& system, uint64_t* out, InfoType info_type, Handle handle, uint64_t info_subtype);
|
||||
void FlushEntireDataCache64From32(Core::System& system);
|
||||
Result FlushDataCache64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
Result GetThreadContext364From32(Core::System& system, uint32_t out_context, Handle thread_handle);
|
||||
Result WaitForAddress64From32(Core::System& system, uint32_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns);
|
||||
Result SignalToAddress64From32(Core::System& system, uint32_t address, SignalType signal_type, int32_t value, int32_t count);
|
||||
void SynchronizePreemptionState64From32(Core::System& system);
|
||||
Result GetResourceLimitPeakValue64From32(Core::System& system, int64_t* out_peak_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result CreateIoPool64From32(Core::System& system, Handle* out_handle, IoPoolType which);
|
||||
Result CreateIoRegion64From32(Core::System& system, Handle* out_handle, Handle io_pool, uint64_t physical_address, uint32_t size, MemoryMapping mapping, MemoryPermission perm);
|
||||
void KernelDebug64From32(Core::System& system, KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2);
|
||||
void ChangeKernelTraceState64From32(Core::System& system, KernelTraceState kern_trace_state);
|
||||
Result CreateSession64From32(Core::System& system, Handle* out_server_session_handle, Handle* out_client_session_handle, bool is_light, uint32_t name);
|
||||
Result AcceptSession64From32(Core::System& system, Handle* out_handle, Handle port);
|
||||
Result ReplyAndReceive64From32(Core::System& system, int32_t* out_index, uint32_t handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);
|
||||
Result ReplyAndReceiveWithUserBuffer64From32(Core::System& system, int32_t* out_index, uint32_t message_buffer, uint32_t message_buffer_size, uint32_t handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);
|
||||
Result CreateEvent64From32(Core::System& system, Handle* out_write_handle, Handle* out_read_handle);
|
||||
Result MapIoRegion64From32(Core::System& system, Handle io_region, uint32_t address, uint32_t size, MemoryPermission perm);
|
||||
Result UnmapIoRegion64From32(Core::System& system, Handle io_region, uint32_t address, uint32_t size);
|
||||
Result MapPhysicalMemoryUnsafe64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapPhysicalMemoryUnsafe64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result SetUnsafeLimit64From32(Core::System& system, uint32_t limit);
|
||||
Result CreateCodeMemory64From32(Core::System& system, Handle* out_handle, uint32_t address, uint32_t size);
|
||||
Result ControlCodeMemory64From32(Core::System& system, Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
void SleepSystem64From32(Core::System& system);
|
||||
Result ReadWriteRegister64From32(Core::System& system, uint32_t* out_value, uint64_t address, uint32_t mask, uint32_t value);
|
||||
Result SetProcessActivity64From32(Core::System& system, Handle process_handle, ProcessActivity process_activity);
|
||||
Result CreateSharedMemory64From32(Core::System& system, Handle* out_handle, uint32_t size, MemoryPermission owner_perm, MemoryPermission remote_perm);
|
||||
Result MapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size, MemoryPermission owner_perm);
|
||||
Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size);
|
||||
Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address);
|
||||
Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint32_t size);
|
||||
Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result MapDeviceAddressSpaceByForce64From32(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint32_t size, uint64_t device_address, uint32_t option);
|
||||
Result MapDeviceAddressSpaceAligned64From32(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint32_t size, uint64_t device_address, uint32_t option);
|
||||
Result UnmapDeviceAddressSpace64From32(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint32_t size, uint64_t device_address);
|
||||
Result InvalidateProcessDataCache64From32(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result StoreProcessDataCache64From32(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result FlushProcessDataCache64From32(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result DebugActiveProcess64From32(Core::System& system, Handle* out_handle, uint64_t process_id);
|
||||
Result BreakDebugProcess64From32(Core::System& system, Handle debug_handle);
|
||||
Result TerminateDebugProcess64From32(Core::System& system, Handle debug_handle);
|
||||
Result GetDebugEvent64From32(Core::System& system, uint32_t out_info, Handle debug_handle);
|
||||
Result ContinueDebugEvent64From32(Core::System& system, Handle debug_handle, uint32_t flags, uint32_t thread_ids, int32_t num_thread_ids);
|
||||
Result GetProcessList64From32(Core::System& system, int32_t* out_num_processes, uint32_t out_process_ids, int32_t max_out_count);
|
||||
Result GetThreadList64From32(Core::System& system, int32_t* out_num_threads, uint32_t out_thread_ids, int32_t max_out_count, Handle debug_handle);
|
||||
Result GetDebugThreadContext64From32(Core::System& system, uint32_t out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags);
|
||||
Result SetDebugThreadContext64From32(Core::System& system, Handle debug_handle, uint64_t thread_id, uint32_t context, uint32_t context_flags);
|
||||
Result QueryDebugProcessMemory64From32(Core::System& system, uint32_t out_memory_info, PageInfo* out_page_info, Handle process_handle, uint32_t address);
|
||||
Result ReadDebugProcessMemory64From32(Core::System& system, uint32_t buffer, Handle debug_handle, uint32_t address, uint32_t size);
|
||||
Result WriteDebugProcessMemory64From32(Core::System& system, Handle debug_handle, uint32_t buffer, uint32_t address, uint32_t size);
|
||||
Result SetHardwareBreakPoint64From32(Core::System& system, HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value);
|
||||
Result GetDebugThreadParam64From32(Core::System& system, uint64_t* out_64, uint32_t* out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param);
|
||||
Result GetSystemInfo64From32(Core::System& system, uint64_t* out, SystemInfoType info_type, Handle handle, uint64_t info_subtype);
|
||||
Result CreatePort64From32(Core::System& system, Handle* out_server_handle, Handle* out_client_handle, int32_t max_sessions, bool is_light, uint32_t name);
|
||||
Result ManageNamedPort64From32(Core::System& system, Handle* out_server_handle, uint32_t name, int32_t max_sessions);
|
||||
Result ConnectToPort64From32(Core::System& system, Handle* out_handle, Handle port);
|
||||
Result SetProcessMemoryPermission64From32(Core::System& system, Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result MapProcessMemory64From32(Core::System& system, uint32_t dst_address, Handle process_handle, uint64_t src_address, uint32_t size);
|
||||
Result UnmapProcessMemory64From32(Core::System& system, uint32_t dst_address, Handle process_handle, uint64_t src_address, uint32_t size);
|
||||
Result QueryProcessMemory64From32(Core::System& system, uint32_t out_memory_info, PageInfo* out_page_info, Handle process_handle, uint64_t address);
|
||||
Result MapProcessCodeMemory64From32(Core::System& system, Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result UnmapProcessCodeMemory64From32(Core::System& system, Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result CreateProcess64From32(Core::System& system, Handle* out_handle, uint32_t parameters, uint32_t caps, int32_t num_caps);
|
||||
Result StartProcess64From32(Core::System& system, Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size);
|
||||
Result TerminateProcess64From32(Core::System& system, Handle process_handle);
|
||||
Result GetProcessInfo64From32(Core::System& system, int64_t* out_info, Handle process_handle, ProcessInfoType info_type);
|
||||
Result CreateResourceLimit64From32(Core::System& system, Handle* out_handle);
|
||||
Result SetResourceLimitLimitValue64From32(Core::System& system, Handle resource_limit_handle, LimitableResource which, int64_t limit_value);
|
||||
Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size);
|
||||
|
||||
Result SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size);
|
||||
Result SetMemoryAttribute32(Core::System& system, u32 address, u32 size, u32 mask, u32 attr);
|
||||
Result MapMemory32(Core::System& system, u32 dst_addr, u32 src_addr, u32 size);
|
||||
Result UnmapMemory32(Core::System& system, u32 dst_addr, u32 src_addr, u32 size);
|
||||
Result QueryMemory32(Core::System& system, u32 memory_info_address, u32 page_info_address,
|
||||
u32 query_address);
|
||||
void ExitProcess32(Core::System& system);
|
||||
Result CreateThread32(Core::System& system, Handle* out_handle, u32 priority, u32 entry_point,
|
||||
u32 arg, u32 stack_top, s32 processor_id);
|
||||
Result StartThread32(Core::System& system, Handle thread_handle);
|
||||
void ExitThread32(Core::System& system);
|
||||
void SleepThread32(Core::System& system, u32 nanoseconds_low, u32 nanoseconds_high);
|
||||
Result GetThreadPriority32(Core::System& system, u32* out_priority, Handle handle);
|
||||
Result SetThreadPriority32(Core::System& system, Handle thread_handle, u32 priority);
|
||||
Result GetThreadCoreMask32(Core::System& system, Handle thread_handle, s32* out_core_id,
|
||||
u32* out_affinity_mask_low, u32* out_affinity_mask_high);
|
||||
Result SetThreadCoreMask32(Core::System& system, Handle thread_handle, s32 core_id,
|
||||
u32 affinity_mask_low, u32 affinity_mask_high);
|
||||
u32 GetCurrentProcessorNumber32(Core::System& system);
|
||||
Result SignalEvent32(Core::System& system, Handle event_handle);
|
||||
Result ClearEvent32(Core::System& system, Handle event_handle);
|
||||
Result MapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, u32 size,
|
||||
MemoryPermission map_perm);
|
||||
Result UnmapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, u32 size);
|
||||
Result CreateTransferMemory32(Core::System& system, Handle* out, u32 address, u32 size,
|
||||
MemoryPermission map_perm);
|
||||
Result CloseHandle32(Core::System& system, Handle handle);
|
||||
Result ResetSignal32(Core::System& system, Handle handle);
|
||||
Result WaitSynchronization32(Core::System& system, u32 timeout_low, u32 handles_address,
|
||||
s32 num_handles, u32 timeout_high, s32* index);
|
||||
Result CancelSynchronization32(Core::System& system, Handle handle);
|
||||
Result ArbitrateLock32(Core::System& system, Handle thread_handle, u32 address, u32 tag);
|
||||
Result ArbitrateUnlock32(Core::System& system, u32 address);
|
||||
Result WaitProcessWideKeyAtomic32(Core::System& system, u32 address, u32 cv_key, u32 tag,
|
||||
u32 timeout_ns_low, u32 timeout_ns_high);
|
||||
void SignalProcessWideKey32(Core::System& system, u32 cv_key, s32 count);
|
||||
void GetSystemTick32(Core::System& system, u32* time_low, u32* time_high);
|
||||
Result ConnectToNamedPort32(Core::System& system, Handle* out_handle, u32 port_name_address);
|
||||
Result SendSyncRequest32(Core::System& system, Handle handle);
|
||||
Result GetProcessId32(Core::System& system, u32* out_process_id_low, u32* out_process_id_high,
|
||||
Handle handle);
|
||||
Result GetThreadId32(Core::System& system, u32* out_thread_id_low, u32* out_thread_id_high,
|
||||
Handle thread_handle);
|
||||
void Break32(Core::System& system, u32 reason, u32 info1, u32 info2);
|
||||
void OutputDebugString32(Core::System& system, u32 address, u32 len);
|
||||
Result GetInfo32(Core::System& system, u32* result_low, u32* result_high, u32 sub_id_low,
|
||||
u32 info_id, u32 handle, u32 sub_id_high);
|
||||
Result MapPhysicalMemory32(Core::System& system, u32 addr, u32 size);
|
||||
Result UnmapPhysicalMemory32(Core::System& system, u32 addr, u32 size);
|
||||
Result SetThreadActivity32(Core::System& system, Handle thread_handle,
|
||||
ThreadActivity thread_activity);
|
||||
Result GetThreadContext32(Core::System& system, u32 out_context, Handle thread_handle);
|
||||
Result WaitForAddress32(Core::System& system, u32 address, ArbitrationType arb_type, s32 value,
|
||||
u32 timeout_ns_low, u32 timeout_ns_high);
|
||||
Result SignalToAddress32(Core::System& system, u32 address, SignalType signal_type, s32 value,
|
||||
s32 count);
|
||||
Result CreateEvent32(Core::System& system, Handle* out_write, Handle* out_read);
|
||||
Result CreateCodeMemory32(Core::System& system, Handle* out, u32 address, u32 size);
|
||||
Result ControlCodeMemory32(Core::System& system, Handle code_memory_handle, u32 operation,
|
||||
u64 address, u64 size, MemoryPermission perm);
|
||||
Result FlushProcessDataCache32(Core::System& system, Handle process_handle, u64 address, u64 size);
|
||||
Result SetHeapSize64(Core::System& system, uintptr_t* out_address, uint64_t size);
|
||||
Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr);
|
||||
Result MapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result UnmapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result QueryMemory64(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, uint64_t address);
|
||||
void ExitProcess64(Core::System& system);
|
||||
Result CreateThread64(Core::System& system, Handle* out_handle, uint64_t func, uint64_t arg, uint64_t stack_bottom, int32_t priority, int32_t core_id);
|
||||
Result StartThread64(Core::System& system, Handle thread_handle);
|
||||
void ExitThread64(Core::System& system);
|
||||
void SleepThread64(Core::System& system, int64_t ns);
|
||||
Result GetThreadPriority64(Core::System& system, int32_t* out_priority, Handle thread_handle);
|
||||
Result SetThreadPriority64(Core::System& system, Handle thread_handle, int32_t priority);
|
||||
Result GetThreadCoreMask64(Core::System& system, int32_t* out_core_id, uint64_t* out_affinity_mask, Handle thread_handle);
|
||||
Result SetThreadCoreMask64(Core::System& system, Handle thread_handle, int32_t core_id, uint64_t affinity_mask);
|
||||
int32_t GetCurrentProcessorNumber64(Core::System& system);
|
||||
Result SignalEvent64(Core::System& system, Handle event_handle);
|
||||
Result ClearEvent64(Core::System& system, Handle event_handle);
|
||||
Result MapSharedMemory64(Core::System& system, Handle shmem_handle, uint64_t address, uint64_t size, MemoryPermission map_perm);
|
||||
Result UnmapSharedMemory64(Core::System& system, Handle shmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateTransferMemory64(Core::System& system, Handle* out_handle, uint64_t address, uint64_t size, MemoryPermission map_perm);
|
||||
Result CloseHandle64(Core::System& system, Handle handle);
|
||||
Result ResetSignal64(Core::System& system, Handle handle);
|
||||
Result WaitSynchronization64(Core::System& system, int32_t* out_index, uint64_t handles, int32_t num_handles, int64_t timeout_ns);
|
||||
Result CancelSynchronization64(Core::System& system, Handle handle);
|
||||
Result ArbitrateLock64(Core::System& system, Handle thread_handle, uint64_t address, uint32_t tag);
|
||||
Result ArbitrateUnlock64(Core::System& system, uint64_t address);
|
||||
Result WaitProcessWideKeyAtomic64(Core::System& system, uint64_t address, uint64_t cv_key, uint32_t tag, int64_t timeout_ns);
|
||||
void SignalProcessWideKey64(Core::System& system, uint64_t cv_key, int32_t count);
|
||||
int64_t GetSystemTick64(Core::System& system);
|
||||
Result ConnectToNamedPort64(Core::System& system, Handle* out_handle, uint64_t name);
|
||||
Result SendSyncRequest64(Core::System& system, Handle session_handle);
|
||||
Result SendSyncRequestWithUserBuffer64(Core::System& system, uint64_t message_buffer, uint64_t message_buffer_size, Handle session_handle);
|
||||
Result SendAsyncRequestWithUserBuffer64(Core::System& system, Handle* out_event_handle, uint64_t message_buffer, uint64_t message_buffer_size, Handle session_handle);
|
||||
Result GetProcessId64(Core::System& system, uint64_t* out_process_id, Handle process_handle);
|
||||
Result GetThreadId64(Core::System& system, uint64_t* out_thread_id, Handle thread_handle);
|
||||
void Break64(Core::System& system, BreakReason break_reason, uint64_t arg, uint64_t size);
|
||||
Result OutputDebugString64(Core::System& system, uint64_t debug_str, uint64_t len);
|
||||
void ReturnFromException64(Core::System& system, Result result);
|
||||
Result GetInfo64(Core::System& system, uint64_t* out, InfoType info_type, Handle handle, uint64_t info_subtype);
|
||||
void FlushEntireDataCache64(Core::System& system);
|
||||
Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);
|
||||
Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags);
|
||||
Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result SetThreadActivity64(Core::System& system, Handle thread_handle, ThreadActivity thread_activity);
|
||||
Result GetThreadContext364(Core::System& system, uint64_t out_context, Handle thread_handle);
|
||||
Result WaitForAddress64(Core::System& system, uint64_t address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns);
|
||||
Result SignalToAddress64(Core::System& system, uint64_t address, SignalType signal_type, int32_t value, int32_t count);
|
||||
void SynchronizePreemptionState64(Core::System& system);
|
||||
Result GetResourceLimitPeakValue64(Core::System& system, int64_t* out_peak_value, Handle resource_limit_handle, LimitableResource which);
|
||||
Result CreateIoPool64(Core::System& system, Handle* out_handle, IoPoolType which);
|
||||
Result CreateIoRegion64(Core::System& system, Handle* out_handle, Handle io_pool, uint64_t physical_address, uint64_t size, MemoryMapping mapping, MemoryPermission perm);
|
||||
void KernelDebug64(Core::System& system, KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2);
|
||||
void ChangeKernelTraceState64(Core::System& system, KernelTraceState kern_trace_state);
|
||||
Result CreateSession64(Core::System& system, Handle* out_server_session_handle, Handle* out_client_session_handle, bool is_light, uint64_t name);
|
||||
Result AcceptSession64(Core::System& system, Handle* out_handle, Handle port);
|
||||
Result ReplyAndReceive64(Core::System& system, int32_t* out_index, uint64_t handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);
|
||||
Result ReplyAndReceiveWithUserBuffer64(Core::System& system, int32_t* out_index, uint64_t message_buffer, uint64_t message_buffer_size, uint64_t handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);
|
||||
Result CreateEvent64(Core::System& system, Handle* out_write_handle, Handle* out_read_handle);
|
||||
Result MapIoRegion64(Core::System& system, Handle io_region, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result UnmapIoRegion64(Core::System& system, Handle io_region, uint64_t address, uint64_t size);
|
||||
Result MapPhysicalMemoryUnsafe64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapPhysicalMemoryUnsafe64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result SetUnsafeLimit64(Core::System& system, uint64_t limit);
|
||||
Result CreateCodeMemory64(Core::System& system, Handle* out_handle, uint64_t address, uint64_t size);
|
||||
Result ControlCodeMemory64(Core::System& system, Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
void SleepSystem64(Core::System& system);
|
||||
Result ReadWriteRegister64(Core::System& system, uint32_t* out_value, uint64_t address, uint32_t mask, uint32_t value);
|
||||
Result SetProcessActivity64(Core::System& system, Handle process_handle, ProcessActivity process_activity);
|
||||
Result CreateSharedMemory64(Core::System& system, Handle* out_handle, uint64_t size, MemoryPermission owner_perm, MemoryPermission remote_perm);
|
||||
Result MapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size, MemoryPermission owner_perm);
|
||||
Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size);
|
||||
Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);
|
||||
Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address);
|
||||
Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size);
|
||||
Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size);
|
||||
Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle);
|
||||
Result MapDeviceAddressSpaceByForce64(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint64_t size, uint64_t device_address, uint32_t option);
|
||||
Result MapDeviceAddressSpaceAligned64(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint64_t size, uint64_t device_address, uint32_t option);
|
||||
Result UnmapDeviceAddressSpace64(Core::System& system, Handle das_handle, Handle process_handle, uint64_t process_address, uint64_t size, uint64_t device_address);
|
||||
Result InvalidateProcessDataCache64(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result StoreProcessDataCache64(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result FlushProcessDataCache64(Core::System& system, Handle process_handle, uint64_t address, uint64_t size);
|
||||
Result DebugActiveProcess64(Core::System& system, Handle* out_handle, uint64_t process_id);
|
||||
Result BreakDebugProcess64(Core::System& system, Handle debug_handle);
|
||||
Result TerminateDebugProcess64(Core::System& system, Handle debug_handle);
|
||||
Result GetDebugEvent64(Core::System& system, uint64_t out_info, Handle debug_handle);
|
||||
Result ContinueDebugEvent64(Core::System& system, Handle debug_handle, uint32_t flags, uint64_t thread_ids, int32_t num_thread_ids);
|
||||
Result GetProcessList64(Core::System& system, int32_t* out_num_processes, uint64_t out_process_ids, int32_t max_out_count);
|
||||
Result GetThreadList64(Core::System& system, int32_t* out_num_threads, uint64_t out_thread_ids, int32_t max_out_count, Handle debug_handle);
|
||||
Result GetDebugThreadContext64(Core::System& system, uint64_t out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags);
|
||||
Result SetDebugThreadContext64(Core::System& system, Handle debug_handle, uint64_t thread_id, uint64_t context, uint32_t context_flags);
|
||||
Result QueryDebugProcessMemory64(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, Handle process_handle, uint64_t address);
|
||||
Result ReadDebugProcessMemory64(Core::System& system, uint64_t buffer, Handle debug_handle, uint64_t address, uint64_t size);
|
||||
Result WriteDebugProcessMemory64(Core::System& system, Handle debug_handle, uint64_t buffer, uint64_t address, uint64_t size);
|
||||
Result SetHardwareBreakPoint64(Core::System& system, HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value);
|
||||
Result GetDebugThreadParam64(Core::System& system, uint64_t* out_64, uint32_t* out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param);
|
||||
Result GetSystemInfo64(Core::System& system, uint64_t* out, SystemInfoType info_type, Handle handle, uint64_t info_subtype);
|
||||
Result CreatePort64(Core::System& system, Handle* out_server_handle, Handle* out_client_handle, int32_t max_sessions, bool is_light, uint64_t name);
|
||||
Result ManageNamedPort64(Core::System& system, Handle* out_server_handle, uint64_t name, int32_t max_sessions);
|
||||
Result ConnectToPort64(Core::System& system, Handle* out_handle, Handle port);
|
||||
Result SetProcessMemoryPermission64(Core::System& system, Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm);
|
||||
Result MapProcessMemory64(Core::System& system, uint64_t dst_address, Handle process_handle, uint64_t src_address, uint64_t size);
|
||||
Result UnmapProcessMemory64(Core::System& system, uint64_t dst_address, Handle process_handle, uint64_t src_address, uint64_t size);
|
||||
Result QueryProcessMemory64(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, Handle process_handle, uint64_t address);
|
||||
Result MapProcessCodeMemory64(Core::System& system, Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result UnmapProcessCodeMemory64(Core::System& system, Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);
|
||||
Result CreateProcess64(Core::System& system, Handle* out_handle, uint64_t parameters, uint64_t caps, int32_t num_caps);
|
||||
Result StartProcess64(Core::System& system, Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size);
|
||||
Result TerminateProcess64(Core::System& system, Handle process_handle);
|
||||
Result GetProcessInfo64(Core::System& system, int64_t* out_info, Handle process_handle, ProcessInfoType info_type);
|
||||
Result CreateResourceLimit64(Core::System& system, Handle* out_handle);
|
||||
Result SetResourceLimitLimitValue64(Core::System& system, Handle resource_limit_handle, LimitableResource which, int64_t limit_value);
|
||||
Result MapInsecureMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
Result UnmapInsecureMemory64(Core::System& system, uint64_t address, uint64_t size);
|
||||
|
||||
enum class SvcId : u32 {
|
||||
SetHeapSize = 0x1,
|
||||
SetMemoryPermission = 0x2,
|
||||
SetMemoryAttribute = 0x3,
|
||||
MapMemory = 0x4,
|
||||
UnmapMemory = 0x5,
|
||||
QueryMemory = 0x6,
|
||||
ExitProcess = 0x7,
|
||||
CreateThread = 0x8,
|
||||
StartThread = 0x9,
|
||||
ExitThread = 0xa,
|
||||
SleepThread = 0xb,
|
||||
GetThreadPriority = 0xc,
|
||||
SetThreadPriority = 0xd,
|
||||
GetThreadCoreMask = 0xe,
|
||||
SetThreadCoreMask = 0xf,
|
||||
GetCurrentProcessorNumber = 0x10,
|
||||
SignalEvent = 0x11,
|
||||
ClearEvent = 0x12,
|
||||
MapSharedMemory = 0x13,
|
||||
UnmapSharedMemory = 0x14,
|
||||
CreateTransferMemory = 0x15,
|
||||
CloseHandle = 0x16,
|
||||
ResetSignal = 0x17,
|
||||
WaitSynchronization = 0x18,
|
||||
CancelSynchronization = 0x19,
|
||||
ArbitrateLock = 0x1a,
|
||||
ArbitrateUnlock = 0x1b,
|
||||
WaitProcessWideKeyAtomic = 0x1c,
|
||||
SignalProcessWideKey = 0x1d,
|
||||
GetSystemTick = 0x1e,
|
||||
ConnectToNamedPort = 0x1f,
|
||||
SendSyncRequestLight = 0x20,
|
||||
SendSyncRequest = 0x21,
|
||||
SendSyncRequestWithUserBuffer = 0x22,
|
||||
SendAsyncRequestWithUserBuffer = 0x23,
|
||||
GetProcessId = 0x24,
|
||||
GetThreadId = 0x25,
|
||||
Break = 0x26,
|
||||
OutputDebugString = 0x27,
|
||||
ReturnFromException = 0x28,
|
||||
GetInfo = 0x29,
|
||||
FlushEntireDataCache = 0x2a,
|
||||
FlushDataCache = 0x2b,
|
||||
MapPhysicalMemory = 0x2c,
|
||||
UnmapPhysicalMemory = 0x2d,
|
||||
GetDebugFutureThreadInfo = 0x2e,
|
||||
GetLastThreadInfo = 0x2f,
|
||||
GetResourceLimitLimitValue = 0x30,
|
||||
GetResourceLimitCurrentValue = 0x31,
|
||||
SetThreadActivity = 0x32,
|
||||
GetThreadContext3 = 0x33,
|
||||
WaitForAddress = 0x34,
|
||||
SignalToAddress = 0x35,
|
||||
SynchronizePreemptionState = 0x36,
|
||||
GetResourceLimitPeakValue = 0x37,
|
||||
CreateIoPool = 0x39,
|
||||
CreateIoRegion = 0x3a,
|
||||
KernelDebug = 0x3c,
|
||||
ChangeKernelTraceState = 0x3d,
|
||||
CreateSession = 0x40,
|
||||
AcceptSession = 0x41,
|
||||
ReplyAndReceiveLight = 0x42,
|
||||
ReplyAndReceive = 0x43,
|
||||
ReplyAndReceiveWithUserBuffer = 0x44,
|
||||
CreateEvent = 0x45,
|
||||
MapIoRegion = 0x46,
|
||||
UnmapIoRegion = 0x47,
|
||||
MapPhysicalMemoryUnsafe = 0x48,
|
||||
UnmapPhysicalMemoryUnsafe = 0x49,
|
||||
SetUnsafeLimit = 0x4a,
|
||||
CreateCodeMemory = 0x4b,
|
||||
ControlCodeMemory = 0x4c,
|
||||
SleepSystem = 0x4d,
|
||||
ReadWriteRegister = 0x4e,
|
||||
SetProcessActivity = 0x4f,
|
||||
CreateSharedMemory = 0x50,
|
||||
MapTransferMemory = 0x51,
|
||||
UnmapTransferMemory = 0x52,
|
||||
CreateInterruptEvent = 0x53,
|
||||
QueryPhysicalAddress = 0x54,
|
||||
QueryIoMapping = 0x55,
|
||||
CreateDeviceAddressSpace = 0x56,
|
||||
AttachDeviceAddressSpace = 0x57,
|
||||
DetachDeviceAddressSpace = 0x58,
|
||||
MapDeviceAddressSpaceByForce = 0x59,
|
||||
MapDeviceAddressSpaceAligned = 0x5a,
|
||||
UnmapDeviceAddressSpace = 0x5c,
|
||||
InvalidateProcessDataCache = 0x5d,
|
||||
StoreProcessDataCache = 0x5e,
|
||||
FlushProcessDataCache = 0x5f,
|
||||
DebugActiveProcess = 0x60,
|
||||
BreakDebugProcess = 0x61,
|
||||
TerminateDebugProcess = 0x62,
|
||||
GetDebugEvent = 0x63,
|
||||
ContinueDebugEvent = 0x64,
|
||||
GetProcessList = 0x65,
|
||||
GetThreadList = 0x66,
|
||||
GetDebugThreadContext = 0x67,
|
||||
SetDebugThreadContext = 0x68,
|
||||
QueryDebugProcessMemory = 0x69,
|
||||
ReadDebugProcessMemory = 0x6a,
|
||||
WriteDebugProcessMemory = 0x6b,
|
||||
SetHardwareBreakPoint = 0x6c,
|
||||
GetDebugThreadParam = 0x6d,
|
||||
GetSystemInfo = 0x6f,
|
||||
CreatePort = 0x70,
|
||||
ManageNamedPort = 0x71,
|
||||
ConnectToPort = 0x72,
|
||||
SetProcessMemoryPermission = 0x73,
|
||||
MapProcessMemory = 0x74,
|
||||
UnmapProcessMemory = 0x75,
|
||||
QueryProcessMemory = 0x76,
|
||||
MapProcessCodeMemory = 0x77,
|
||||
UnmapProcessCodeMemory = 0x78,
|
||||
CreateProcess = 0x79,
|
||||
StartProcess = 0x7a,
|
||||
TerminateProcess = 0x7b,
|
||||
GetProcessInfo = 0x7c,
|
||||
CreateResourceLimit = 0x7d,
|
||||
SetResourceLimitLimitValue = 0x7e,
|
||||
CallSecureMonitor = 0x7f,
|
||||
MapInsecureMemory = 0x90,
|
||||
UnmapInsecureMemory = 0x91,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// Custom ABI.
|
||||
Result ReplyAndReceiveLight(Core::System& system, Handle handle, uint32_t* args);
|
||||
Result ReplyAndReceiveLight64From32(Core::System& system, Handle handle, uint32_t* args);
|
||||
Result ReplyAndReceiveLight64(Core::System& system, Handle handle, uint32_t* args);
|
||||
|
||||
Result SendSyncRequestLight(Core::System& system, Handle session_handle, uint32_t* args);
|
||||
Result SendSyncRequestLight64From32(Core::System& system, Handle session_handle, uint32_t* args);
|
||||
Result SendSyncRequestLight64(Core::System& system, Handle session_handle, uint32_t* args);
|
||||
|
||||
void CallSecureMonitor(Core::System& system, lp64::SecureMonitorArguments* args);
|
||||
void CallSecureMonitor64From32(Core::System& system, ilp32::SecureMonitorArguments* args);
|
||||
void CallSecureMonitor64(Core::System& system, lp64::SecureMonitorArguments* args);
|
||||
|
||||
// Defined in svc_light_ipc.cpp.
|
||||
void SvcWrap_ReplyAndReceiveLight64From32(Core::System& system);
|
||||
void SvcWrap_ReplyAndReceiveLight64(Core::System& system);
|
||||
|
||||
void SvcWrap_SendSyncRequestLight64From32(Core::System& system);
|
||||
void SvcWrap_SendSyncRequestLight64(Core::System& system);
|
||||
|
||||
// Defined in svc_secure_monitor_call.cpp.
|
||||
void SvcWrap_CallSecureMonitor64From32(Core::System& system);
|
||||
void SvcWrap_CallSecureMonitor64(Core::System& system);
|
||||
|
||||
// Perform a supervisor call by index.
|
||||
void Call(Core::System& system, u32 imm);
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
@ -1,6 +1,253 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/alignment.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_device_address_space.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
|
||||
namespace Kernel::Svc {} // namespace Kernel::Svc
|
||||
namespace Kernel::Svc {
|
||||
|
||||
constexpr inline u64 DeviceAddressSpaceAlignMask = (1ULL << 22) - 1;
|
||||
|
||||
constexpr bool IsProcessAndDeviceAligned(uint64_t process_address, uint64_t device_address) {
|
||||
return (process_address & DeviceAddressSpaceAlignMask) ==
|
||||
(device_address & DeviceAddressSpaceAlignMask);
|
||||
}
|
||||
|
||||
Result CreateDeviceAddressSpace(Core::System& system, Handle* out, uint64_t das_address,
|
||||
uint64_t das_size) {
|
||||
// Validate input.
|
||||
R_UNLESS(Common::IsAligned(das_address, PageSize), ResultInvalidMemoryRegion);
|
||||
R_UNLESS(Common::IsAligned(das_size, PageSize), ResultInvalidMemoryRegion);
|
||||
R_UNLESS(das_size > 0, ResultInvalidMemoryRegion);
|
||||
R_UNLESS((das_address < das_address + das_size), ResultInvalidMemoryRegion);
|
||||
|
||||
// Create the device address space.
|
||||
KDeviceAddressSpace* das = KDeviceAddressSpace::Create(system.Kernel());
|
||||
R_UNLESS(das != nullptr, ResultOutOfResource);
|
||||
SCOPE_EXIT({ das->Close(); });
|
||||
|
||||
// Initialize the device address space.
|
||||
R_TRY(das->Initialize(das_address, das_size));
|
||||
|
||||
// Register the device address space.
|
||||
KDeviceAddressSpace::Register(system.Kernel(), das);
|
||||
|
||||
// Add to the handle table.
|
||||
R_TRY(system.CurrentProcess()->GetHandleTable().Add(out, das));
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) {
|
||||
// Get the device address space.
|
||||
KScopedAutoObject das =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
|
||||
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Attach.
|
||||
R_RETURN(das->Attach(device_name));
|
||||
}
|
||||
|
||||
Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) {
|
||||
// Get the device address space.
|
||||
KScopedAutoObject das =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
|
||||
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Detach.
|
||||
R_RETURN(das->Detach(device_name));
|
||||
}
|
||||
|
||||
constexpr bool IsValidDeviceMemoryPermission(MemoryPermission device_perm) {
|
||||
switch (device_perm) {
|
||||
case MemoryPermission::Read:
|
||||
case MemoryPermission::Write:
|
||||
case MemoryPermission::ReadWrite:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address,
|
||||
u32 option) {
|
||||
// Decode the option.
|
||||
const MapDeviceAddressSpaceOption option_pack{option};
|
||||
const auto device_perm = option_pack.permission;
|
||||
const auto reserved = option_pack.reserved;
|
||||
|
||||
// Validate input.
|
||||
R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize);
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission);
|
||||
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
|
||||
|
||||
// Get the device address space.
|
||||
KScopedAutoObject das =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
|
||||
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Get the process.
|
||||
KScopedAutoObject process =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
|
||||
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Validate that the process address is within range.
|
||||
auto& page_table = process->PageTable();
|
||||
R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Map.
|
||||
R_RETURN(
|
||||
das->MapByForce(std::addressof(page_table), process_address, size, device_address, option));
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address,
|
||||
u32 option) {
|
||||
// Decode the option.
|
||||
const MapDeviceAddressSpaceOption option_pack{option};
|
||||
const auto device_perm = option_pack.permission;
|
||||
const auto reserved = option_pack.reserved;
|
||||
|
||||
// Validate input.
|
||||
R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(IsProcessAndDeviceAligned(process_address, device_address), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize);
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission);
|
||||
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
|
||||
|
||||
// Get the device address space.
|
||||
KScopedAutoObject das =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
|
||||
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Get the process.
|
||||
KScopedAutoObject process =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
|
||||
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Validate that the process address is within range.
|
||||
auto& page_table = process->PageTable();
|
||||
R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Map.
|
||||
R_RETURN(
|
||||
das->MapAligned(std::addressof(page_table), process_address, size, device_address, option));
|
||||
}
|
||||
|
||||
Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, size_t size, uint64_t device_address) {
|
||||
// Validate input.
|
||||
R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress);
|
||||
R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize);
|
||||
R_UNLESS(size > 0, ResultInvalidSize);
|
||||
R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory);
|
||||
R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion);
|
||||
R_UNLESS((process_address == static_cast<uintptr_t>(process_address)),
|
||||
ResultInvalidCurrentMemory);
|
||||
|
||||
// Get the device address space.
|
||||
KScopedAutoObject das =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
|
||||
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Get the process.
|
||||
KScopedAutoObject process =
|
||||
system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
|
||||
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Validate that the process address is within range.
|
||||
auto& page_table = process->PageTable();
|
||||
R_UNLESS(page_table.Contains(process_address, size), ResultInvalidCurrentMemory);
|
||||
|
||||
R_RETURN(das->Unmap(std::addressof(page_table), process_address, size, device_address));
|
||||
}
|
||||
|
||||
Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address,
|
||||
uint64_t das_size) {
|
||||
R_RETURN(CreateDeviceAddressSpace(system, out_handle, das_address, das_size));
|
||||
}
|
||||
|
||||
Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle) {
|
||||
R_RETURN(AttachDeviceAddressSpace(system, device_name, das_handle));
|
||||
}
|
||||
|
||||
Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle) {
|
||||
R_RETURN(DetachDeviceAddressSpace(system, device_name, das_handle));
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceByForce64(Core::System& system, Handle das_handle,
|
||||
Handle process_handle, uint64_t process_address,
|
||||
uint64_t size, uint64_t device_address, u32 option) {
|
||||
R_RETURN(MapDeviceAddressSpaceByForce(system, das_handle, process_handle, process_address, size,
|
||||
device_address, option));
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceAligned64(Core::System& system, Handle das_handle,
|
||||
Handle process_handle, uint64_t process_address,
|
||||
uint64_t size, uint64_t device_address, u32 option) {
|
||||
R_RETURN(MapDeviceAddressSpaceAligned(system, das_handle, process_handle, process_address, size,
|
||||
device_address, option));
|
||||
}
|
||||
|
||||
Result UnmapDeviceAddressSpace64(Core::System& system, Handle das_handle, Handle process_handle,
|
||||
uint64_t process_address, uint64_t size, uint64_t device_address) {
|
||||
R_RETURN(UnmapDeviceAddressSpace(system, das_handle, process_handle, process_address, size,
|
||||
device_address));
|
||||
}
|
||||
|
||||
Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle,
|
||||
uint64_t das_address, uint64_t das_size) {
|
||||
R_RETURN(CreateDeviceAddressSpace(system, out_handle, das_address, das_size));
|
||||
}
|
||||
|
||||
Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name,
|
||||
Handle das_handle) {
|
||||
R_RETURN(AttachDeviceAddressSpace(system, device_name, das_handle));
|
||||
}
|
||||
|
||||
Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name,
|
||||
Handle das_handle) {
|
||||
R_RETURN(DetachDeviceAddressSpace(system, device_name, das_handle));
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceByForce64From32(Core::System& system, Handle das_handle,
|
||||
Handle process_handle, uint64_t process_address,
|
||||
uint32_t size, uint64_t device_address, u32 option) {
|
||||
R_RETURN(MapDeviceAddressSpaceByForce(system, das_handle, process_handle, process_address, size,
|
||||
device_address, option));
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceAligned64From32(Core::System& system, Handle das_handle,
|
||||
Handle process_handle, uint64_t process_address,
|
||||
uint32_t size, uint64_t device_address, u32 option) {
|
||||
R_RETURN(MapDeviceAddressSpaceAligned(system, das_handle, process_handle, process_address, size,
|
||||
device_address, option));
|
||||
}
|
||||
|
||||
Result UnmapDeviceAddressSpace64From32(Core::System& system, Handle das_handle,
|
||||
Handle process_handle, uint64_t process_address,
|
||||
uint32_t size, uint64_t device_address) {
|
||||
R_RETURN(UnmapDeviceAddressSpace(system, das_handle, process_handle, process_address, size,
|
||||
device_address));
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
@ -0,0 +1,35 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
Result MapInsecureMemory(Core::System& system, uintptr_t address, size_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result UnmapInsecureMemory(Core::System& system, uintptr_t address, size_t size) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result MapInsecureMemory64(Core::System& system, uint64_t address, uint64_t size) {
|
||||
R_RETURN(MapInsecureMemory(system, address, size));
|
||||
}
|
||||
|
||||
Result UnmapInsecureMemory64(Core::System& system, uint64_t address, uint64_t size) {
|
||||
R_RETURN(UnmapInsecureMemory(system, address, size));
|
||||
}
|
||||
|
||||
Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size) {
|
||||
R_RETURN(MapInsecureMemory(system, address, size));
|
||||
}
|
||||
|
||||
Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size) {
|
||||
R_RETURN(UnmapInsecureMemory(system, address, size));
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
@ -1,6 +1,73 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
|
||||
namespace Kernel::Svc {} // namespace Kernel::Svc
|
||||
namespace Kernel::Svc {
|
||||
|
||||
Result SendSyncRequestLight(Core::System& system, Handle session_handle, u32* args) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result ReplyAndReceiveLight(Core::System& system, Handle session_handle, u32* args) {
|
||||
UNIMPLEMENTED();
|
||||
R_THROW(ResultNotImplemented);
|
||||
}
|
||||
|
||||
Result SendSyncRequestLight64(Core::System& system, Handle session_handle, u32* args) {
|
||||
R_RETURN(SendSyncRequestLight(system, session_handle, args));
|
||||
}
|
||||
|
||||
Result ReplyAndReceiveLight64(Core::System& system, Handle session_handle, u32* args) {
|
||||
R_RETURN(ReplyAndReceiveLight(system, session_handle, args));
|
||||
}
|
||||
|
||||
Result SendSyncRequestLight64From32(Core::System& system, Handle session_handle, u32* args) {
|
||||
R_RETURN(SendSyncRequestLight(system, session_handle, args));
|
||||
}
|
||||
|
||||
Result ReplyAndReceiveLight64From32(Core::System& system, Handle session_handle, u32* args) {
|
||||
R_RETURN(ReplyAndReceiveLight(system, session_handle, args));
|
||||
}
|
||||
|
||||
// Custom ABI implementation for light IPC.
|
||||
|
||||
template <typename F>
|
||||
static void SvcWrap_LightIpc(Core::System& system, F&& cb) {
|
||||
auto& core = system.CurrentArmInterface();
|
||||
std::array<u32, 7> arguments{};
|
||||
|
||||
Handle session_handle = static_cast<Handle>(core.GetReg(0));
|
||||
for (int i = 0; i < 7; i++) {
|
||||
arguments[i] = static_cast<u32>(core.GetReg(i + 1));
|
||||
}
|
||||
|
||||
Result ret = cb(system, session_handle, arguments.data());
|
||||
|
||||
core.SetReg(0, ret.raw);
|
||||
for (int i = 0; i < 7; i++) {
|
||||
core.SetReg(i + 1, arguments[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void SvcWrap_SendSyncRequestLight64(Core::System& system) {
|
||||
SvcWrap_LightIpc(system, SendSyncRequestLight64);
|
||||
}
|
||||
|
||||
void SvcWrap_ReplyAndReceiveLight64(Core::System& system) {
|
||||
SvcWrap_LightIpc(system, ReplyAndReceiveLight64);
|
||||
}
|
||||
|
||||
void SvcWrap_SendSyncRequestLight64From32(Core::System& system) {
|
||||
SvcWrap_LightIpc(system, SendSyncRequestLight64From32);
|
||||
}
|
||||
|
||||
void SvcWrap_ReplyAndReceiveLight64From32(Core::System& system) {
|
||||
SvcWrap_LightIpc(system, ReplyAndReceiveLight64From32);
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
@ -1,6 +1,53 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/physical_core.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
|
||||
namespace Kernel::Svc {} // namespace Kernel::Svc
|
||||
namespace Kernel::Svc {
|
||||
|
||||
void CallSecureMonitor(Core::System& system, lp64::SecureMonitorArguments* args) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void CallSecureMonitor64(Core::System& system, lp64::SecureMonitorArguments* args) {
|
||||
CallSecureMonitor(system, args);
|
||||
}
|
||||
|
||||
void CallSecureMonitor64From32(Core::System& system, ilp32::SecureMonitorArguments* args) {
|
||||
// CallSecureMonitor64From32 is not supported.
|
||||
UNIMPLEMENTED_MSG("CallSecureMonitor64From32");
|
||||
}
|
||||
|
||||
// Custom ABI for CallSecureMonitor.
|
||||
|
||||
void SvcWrap_CallSecureMonitor64(Core::System& system) {
|
||||
auto& core = system.CurrentPhysicalCore().ArmInterface();
|
||||
lp64::SecureMonitorArguments args{};
|
||||
for (int i = 0; i < 8; i++) {
|
||||
args.r[i] = core.GetReg(i);
|
||||
}
|
||||
|
||||
CallSecureMonitor64(system, &args);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
core.SetReg(i, args.r[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void SvcWrap_CallSecureMonitor64From32(Core::System& system) {
|
||||
auto& core = system.CurrentPhysicalCore().ArmInterface();
|
||||
ilp32::SecureMonitorArguments args{};
|
||||
for (int i = 0; i < 8; i++) {
|
||||
args.r[i] = static_cast<u32>(core.GetReg(i));
|
||||
}
|
||||
|
||||
CallSecureMonitor64From32(system, &args);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
core.SetReg(i, args.r[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
|
@ -0,0 +1,716 @@
|
||||
# SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Raw SVC definitions from the kernel.
|
||||
#
|
||||
# Avoid modifying the prototypes; see below for how to customize generation
|
||||
# for a given typename.
|
||||
SVCS = [
|
||||
[0x01, "Result SetHeapSize(Address* out_address, Size size);"],
|
||||
[0x02, "Result SetMemoryPermission(Address address, Size size, MemoryPermission perm);"],
|
||||
[0x03, "Result SetMemoryAttribute(Address address, Size size, uint32_t mask, uint32_t attr);"],
|
||||
[0x04, "Result MapMemory(Address dst_address, Address src_address, Size size);"],
|
||||
[0x05, "Result UnmapMemory(Address dst_address, Address src_address, Size size);"],
|
||||
[0x06, "Result QueryMemory(Address out_memory_info, PageInfo* out_page_info, Address address);"],
|
||||
[0x07, "void ExitProcess();"],
|
||||
[0x08, "Result CreateThread(Handle* out_handle, ThreadFunc func, Address arg, Address stack_bottom, int32_t priority, int32_t core_id);"],
|
||||
[0x09, "Result StartThread(Handle thread_handle);"],
|
||||
[0x0A, "void ExitThread();"],
|
||||
[0x0B, "void SleepThread(int64_t ns);"],
|
||||
[0x0C, "Result GetThreadPriority(int32_t* out_priority, Handle thread_handle);"],
|
||||
[0x0D, "Result SetThreadPriority(Handle thread_handle, int32_t priority);"],
|
||||
[0x0E, "Result GetThreadCoreMask(int32_t* out_core_id, uint64_t* out_affinity_mask, Handle thread_handle);"],
|
||||
[0x0F, "Result SetThreadCoreMask(Handle thread_handle, int32_t core_id, uint64_t affinity_mask);"],
|
||||
[0x10, "int32_t GetCurrentProcessorNumber();"],
|
||||
[0x11, "Result SignalEvent(Handle event_handle);"],
|
||||
[0x12, "Result ClearEvent(Handle event_handle);"],
|
||||
[0x13, "Result MapSharedMemory(Handle shmem_handle, Address address, Size size, MemoryPermission map_perm);"],
|
||||
[0x14, "Result UnmapSharedMemory(Handle shmem_handle, Address address, Size size);"],
|
||||
[0x15, "Result CreateTransferMemory(Handle* out_handle, Address address, Size size, MemoryPermission map_perm);"],
|
||||
[0x16, "Result CloseHandle(Handle handle);"],
|
||||
[0x17, "Result ResetSignal(Handle handle);"],
|
||||
[0x18, "Result WaitSynchronization(int32_t* out_index, Address handles, int32_t num_handles, int64_t timeout_ns);"],
|
||||
[0x19, "Result CancelSynchronization(Handle handle);"],
|
||||
[0x1A, "Result ArbitrateLock(Handle thread_handle, Address address, uint32_t tag);"],
|
||||
[0x1B, "Result ArbitrateUnlock(Address address);"],
|
||||
[0x1C, "Result WaitProcessWideKeyAtomic(Address address, Address cv_key, uint32_t tag, int64_t timeout_ns);"],
|
||||
[0x1D, "void SignalProcessWideKey(Address cv_key, int32_t count);"],
|
||||
[0x1E, "int64_t GetSystemTick();"],
|
||||
[0x1F, "Result ConnectToNamedPort(Handle* out_handle, Address name);"],
|
||||
[0x20, "Result SendSyncRequestLight(Handle session_handle);"],
|
||||
[0x21, "Result SendSyncRequest(Handle session_handle);"],
|
||||
[0x22, "Result SendSyncRequestWithUserBuffer(Address message_buffer, Size message_buffer_size, Handle session_handle);"],
|
||||
[0x23, "Result SendAsyncRequestWithUserBuffer(Handle* out_event_handle, Address message_buffer, Size message_buffer_size, Handle session_handle);"],
|
||||
[0x24, "Result GetProcessId(uint64_t* out_process_id, Handle process_handle);"],
|
||||
[0x25, "Result GetThreadId(uint64_t* out_thread_id, Handle thread_handle);"],
|
||||
[0x26, "void Break(BreakReason break_reason, Address arg, Size size);"],
|
||||
[0x27, "Result OutputDebugString(Address debug_str, Size len);"],
|
||||
[0x28, "void ReturnFromException(Result result);"],
|
||||
[0x29, "Result GetInfo(uint64_t* out, InfoType info_type, Handle handle, uint64_t info_subtype);"],
|
||||
[0x2A, "void FlushEntireDataCache();"],
|
||||
[0x2B, "Result FlushDataCache(Address address, Size size);"],
|
||||
[0x2C, "Result MapPhysicalMemory(Address address, Size size);"],
|
||||
[0x2D, "Result UnmapPhysicalMemory(Address address, Size size);"],
|
||||
[0x2E, "Result GetDebugFutureThreadInfo(LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns);"],
|
||||
[0x2F, "Result GetLastThreadInfo(LastThreadContext* out_context, Address* out_tls_address, uint32_t* out_flags);"],
|
||||
[0x30, "Result GetResourceLimitLimitValue(int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which);"],
|
||||
[0x31, "Result GetResourceLimitCurrentValue(int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which);"],
|
||||
[0x32, "Result SetThreadActivity(Handle thread_handle, ThreadActivity thread_activity);"],
|
||||
[0x33, "Result GetThreadContext3(Address out_context, Handle thread_handle);"],
|
||||
[0x34, "Result WaitForAddress(Address address, ArbitrationType arb_type, int32_t value, int64_t timeout_ns);"],
|
||||
[0x35, "Result SignalToAddress(Address address, SignalType signal_type, int32_t value, int32_t count);"],
|
||||
[0x36, "void SynchronizePreemptionState();"],
|
||||
[0x37, "Result GetResourceLimitPeakValue(int64_t* out_peak_value, Handle resource_limit_handle, LimitableResource which);"],
|
||||
|
||||
[0x39, "Result CreateIoPool(Handle* out_handle, IoPoolType which);"],
|
||||
[0x3A, "Result CreateIoRegion(Handle* out_handle, Handle io_pool, PhysicalAddress physical_address, Size size, MemoryMapping mapping, MemoryPermission perm);"],
|
||||
|
||||
[0x3C, "void KernelDebug(KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2);"],
|
||||
[0x3D, "void ChangeKernelTraceState(KernelTraceState kern_trace_state);"],
|
||||
|
||||
[0x40, "Result CreateSession(Handle* out_server_session_handle, Handle* out_client_session_handle, bool is_light, Address name);"],
|
||||
[0x41, "Result AcceptSession(Handle* out_handle, Handle port);"],
|
||||
[0x42, "Result ReplyAndReceiveLight(Handle handle);"],
|
||||
[0x43, "Result ReplyAndReceive(int32_t* out_index, Address handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);"],
|
||||
[0x44, "Result ReplyAndReceiveWithUserBuffer(int32_t* out_index, Address message_buffer, Size message_buffer_size, Address handles, int32_t num_handles, Handle reply_target, int64_t timeout_ns);"],
|
||||
[0x45, "Result CreateEvent(Handle* out_write_handle, Handle* out_read_handle);"],
|
||||
[0x46, "Result MapIoRegion(Handle io_region, Address address, Size size, MemoryPermission perm);"],
|
||||
[0x47, "Result UnmapIoRegion(Handle io_region, Address address, Size size);"],
|
||||
[0x48, "Result MapPhysicalMemoryUnsafe(Address address, Size size);"],
|
||||
[0x49, "Result UnmapPhysicalMemoryUnsafe(Address address, Size size);"],
|
||||
[0x4A, "Result SetUnsafeLimit(Size limit);"],
|
||||
[0x4B, "Result CreateCodeMemory(Handle* out_handle, Address address, Size size);"],
|
||||
[0x4C, "Result ControlCodeMemory(Handle code_memory_handle, CodeMemoryOperation operation, uint64_t address, uint64_t size, MemoryPermission perm);"],
|
||||
[0x4D, "void SleepSystem();"],
|
||||
[0x4E, "Result ReadWriteRegister(uint32_t* out_value, PhysicalAddress address, uint32_t mask, uint32_t value);"],
|
||||
[0x4F, "Result SetProcessActivity(Handle process_handle, ProcessActivity process_activity);"],
|
||||
[0x50, "Result CreateSharedMemory(Handle* out_handle, Size size, MemoryPermission owner_perm, MemoryPermission remote_perm);"],
|
||||
[0x51, "Result MapTransferMemory(Handle trmem_handle, Address address, Size size, MemoryPermission owner_perm);"],
|
||||
[0x52, "Result UnmapTransferMemory(Handle trmem_handle, Address address, Size size);"],
|
||||
[0x53, "Result CreateInterruptEvent(Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type);"],
|
||||
[0x54, "Result QueryPhysicalAddress(PhysicalMemoryInfo* out_info, Address address);"],
|
||||
[0x55, "Result QueryIoMapping(Address* out_address, Size* out_size, PhysicalAddress physical_address, Size size);"],
|
||||
[0x56, "Result CreateDeviceAddressSpace(Handle* out_handle, uint64_t das_address, uint64_t das_size);"],
|
||||
[0x57, "Result AttachDeviceAddressSpace(DeviceName device_name, Handle das_handle);"],
|
||||
[0x58, "Result DetachDeviceAddressSpace(DeviceName device_name, Handle das_handle);"],
|
||||
[0x59, "Result MapDeviceAddressSpaceByForce(Handle das_handle, Handle process_handle, uint64_t process_address, Size size, uint64_t device_address, uint32_t option);"],
|
||||
[0x5A, "Result MapDeviceAddressSpaceAligned(Handle das_handle, Handle process_handle, uint64_t process_address, Size size, uint64_t device_address, uint32_t option);"],
|
||||
[0x5C, "Result UnmapDeviceAddressSpace(Handle das_handle, Handle process_handle, uint64_t process_address, Size size, uint64_t device_address);"],
|
||||
[0x5D, "Result InvalidateProcessDataCache(Handle process_handle, uint64_t address, uint64_t size);"],
|
||||
[0x5E, "Result StoreProcessDataCache(Handle process_handle, uint64_t address, uint64_t size);"],
|
||||
[0x5F, "Result FlushProcessDataCache(Handle process_handle, uint64_t address, uint64_t size);"],
|
||||
[0x60, "Result DebugActiveProcess(Handle* out_handle, uint64_t process_id);"],
|
||||
[0x61, "Result BreakDebugProcess(Handle debug_handle);"],
|
||||
[0x62, "Result TerminateDebugProcess(Handle debug_handle);"],
|
||||
[0x63, "Result GetDebugEvent(Address out_info, Handle debug_handle);"],
|
||||
[0x64, "Result ContinueDebugEvent(Handle debug_handle, uint32_t flags, Address thread_ids, int32_t num_thread_ids);"],
|
||||
[0x65, "Result GetProcessList(int32_t* out_num_processes, Address out_process_ids, int32_t max_out_count);"],
|
||||
[0x66, "Result GetThreadList(int32_t* out_num_threads, Address out_thread_ids, int32_t max_out_count, Handle debug_handle);"],
|
||||
[0x67, "Result GetDebugThreadContext(Address out_context, Handle debug_handle, uint64_t thread_id, uint32_t context_flags);"],
|
||||
[0x68, "Result SetDebugThreadContext(Handle debug_handle, uint64_t thread_id, Address context, uint32_t context_flags);"],
|
||||
[0x69, "Result QueryDebugProcessMemory(Address out_memory_info, PageInfo* out_page_info, Handle process_handle, Address address);"],
|
||||
[0x6A, "Result ReadDebugProcessMemory(Address buffer, Handle debug_handle, Address address, Size size);"],
|
||||
[0x6B, "Result WriteDebugProcessMemory(Handle debug_handle, Address buffer, Address address, Size size);"],
|
||||
[0x6C, "Result SetHardwareBreakPoint(HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value);"],
|
||||
[0x6D, "Result GetDebugThreadParam(uint64_t* out_64, uint32_t* out_32, Handle debug_handle, uint64_t thread_id, DebugThreadParam param);"],
|
||||
|
||||
[0x6F, "Result GetSystemInfo(uint64_t* out, SystemInfoType info_type, Handle handle, uint64_t info_subtype);"],
|
||||
[0x70, "Result CreatePort(Handle* out_server_handle, Handle* out_client_handle, int32_t max_sessions, bool is_light, Address name);"],
|
||||
[0x71, "Result ManageNamedPort(Handle* out_server_handle, Address name, int32_t max_sessions);"],
|
||||
[0x72, "Result ConnectToPort(Handle* out_handle, Handle port);"],
|
||||
[0x73, "Result SetProcessMemoryPermission(Handle process_handle, uint64_t address, uint64_t size, MemoryPermission perm);"],
|
||||
[0x74, "Result MapProcessMemory(Address dst_address, Handle process_handle, uint64_t src_address, Size size);"],
|
||||
[0x75, "Result UnmapProcessMemory(Address dst_address, Handle process_handle, uint64_t src_address, Size size);"],
|
||||
[0x76, "Result QueryProcessMemory(Address out_memory_info, PageInfo* out_page_info, Handle process_handle, uint64_t address);"],
|
||||
[0x77, "Result MapProcessCodeMemory(Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);"],
|
||||
[0x78, "Result UnmapProcessCodeMemory(Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size);"],
|
||||
[0x79, "Result CreateProcess(Handle* out_handle, Address parameters, Address caps, int32_t num_caps);"],
|
||||
[0x7A, "Result StartProcess(Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size);"],
|
||||
[0x7B, "Result TerminateProcess(Handle process_handle);"],
|
||||
[0x7C, "Result GetProcessInfo(int64_t* out_info, Handle process_handle, ProcessInfoType info_type);"],
|
||||
[0x7D, "Result CreateResourceLimit(Handle* out_handle);"],
|
||||
[0x7E, "Result SetResourceLimitLimitValue(Handle resource_limit_handle, LimitableResource which, int64_t limit_value);"],
|
||||
[0x7F, "void CallSecureMonitor(SecureMonitorArguments args);"],
|
||||
|
||||
[0x90, "Result MapInsecureMemory(Address address, Size size);"],
|
||||
[0x91, "Result UnmapInsecureMemory(Address address, Size size);"],
|
||||
]
|
||||
|
||||
# These use a custom ABI, and therefore require custom wrappers
|
||||
SKIP_WRAPPERS = {
|
||||
0x20: "SendSyncRequestLight",
|
||||
0x42: "ReplyAndReceiveLight",
|
||||
0x7F: "CallSecureMonitor",
|
||||
}
|
||||
|
||||
BIT_32 = 0
|
||||
BIT_64 = 1
|
||||
|
||||
REG_SIZES = [4, 8]
|
||||
SUFFIX_NAMES = ["64From32", "64"]
|
||||
TYPE_SIZES = {
|
||||
# SVC types
|
||||
"ArbitrationType": 4,
|
||||
"BreakReason": 4,
|
||||
"CodeMemoryOperation": 4,
|
||||
"DebugThreadParam": 4,
|
||||
"DeviceName": 4,
|
||||
"HardwareBreakPointRegisterName": 4,
|
||||
"Handle": 4,
|
||||
"InfoType": 4,
|
||||
"InterruptType": 4,
|
||||
"IoPoolType": 4,
|
||||
"KernelDebugType": 4,
|
||||
"KernelTraceState": 4,
|
||||
"LimitableResource": 4,
|
||||
"MemoryMapping": 4,
|
||||
"MemoryPermission": 4,
|
||||
"PageInfo": 4,
|
||||
"ProcessActivity": 4,
|
||||
"ProcessInfoType": 4,
|
||||
"Result": 4,
|
||||
"SignalType": 4,
|
||||
"SystemInfoType": 4,
|
||||
"ThreadActivity": 4,
|
||||
|
||||
# Arch-specific types
|
||||
"ilp32::LastThreadContext": 16,
|
||||
"ilp32::PhysicalMemoryInfo": 16,
|
||||
"ilp32::SecureMonitorArguments": 32,
|
||||
"lp64::LastThreadContext": 32,
|
||||
"lp64::PhysicalMemoryInfo": 24,
|
||||
"lp64::SecureMonitorArguments": 64,
|
||||
|
||||
# Generic types
|
||||
"bool": 1,
|
||||
"int32_t": 4,
|
||||
"int64_t": 8,
|
||||
"uint32_t": 4,
|
||||
"uint64_t": 8,
|
||||
"void": 0,
|
||||
}
|
||||
|
||||
TYPE_REPLACEMENTS = {
|
||||
"Address": ["uint32_t", "uint64_t"],
|
||||
"LastThreadContext": ["ilp32::LastThreadContext", "lp64::LastThreadContext"],
|
||||
"PhysicalAddress": ["uint64_t", "uint64_t"],
|
||||
"PhysicalMemoryInfo": ["ilp32::PhysicalMemoryInfo", "lp64::PhysicalMemoryInfo"],
|
||||
"SecureMonitorArguments": ["ilp32::SecureMonitorArguments", "lp64::SecureMonitorArguments"],
|
||||
"Size": ["uint32_t", "uint64_t"],
|
||||
"ThreadFunc": ["uint32_t", "uint64_t"],
|
||||
}
|
||||
|
||||
# Statically verify that the hardcoded sizes match the intended
|
||||
# sizes in C++.
|
||||
def emit_size_check():
|
||||
lines = []
|
||||
|
||||
for type, size in TYPE_SIZES.items():
|
||||
if type != "void":
|
||||
lines.append(f"static_assert(sizeof({type}) == {size});")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
# Replaces a type with an arch-specific one, if it exists.
|
||||
def substitute_type(name, bitness):
|
||||
if name in TYPE_REPLACEMENTS:
|
||||
return TYPE_REPLACEMENTS[name][bitness]
|
||||
else:
|
||||
return name
|
||||
|
||||
|
||||
class Argument:
|
||||
def __init__(self, type_name, var_name, is_output, is_outptr, is_address):
|
||||
self.type_name = type_name
|
||||
self.var_name = var_name
|
||||
self.is_output = is_output
|
||||
self.is_outptr = is_outptr
|
||||
self.is_address = is_address
|
||||
|
||||
|
||||
# Parses C-style string declarations for SVCs.
|
||||
def parse_declaration(declaration, bitness):
|
||||
return_type, rest = declaration.split(" ", 1)
|
||||
func_name, rest = rest.split("(", 1)
|
||||
arg_names, rest = rest.split(")", 1)
|
||||
argument_types = []
|
||||
|
||||
return_type = substitute_type(return_type, bitness)
|
||||
assert return_type in TYPE_SIZES, f"Unknown type '{return_type}'"
|
||||
|
||||
if arg_names:
|
||||
for arg_name in arg_names.split(", "):
|
||||
type_name, var_name = arg_name.replace("*", "").split(" ", 1)
|
||||
|
||||
# All outputs must contain out_ in the name.
|
||||
is_output = var_name == "out" or var_name.find("out_") != -1
|
||||
|
||||
# User-pointer outputs are not written to registers.
|
||||
is_outptr = is_output and arg_name.find("*") == -1
|
||||
|
||||
# Special handling is performed for output addresses to avoid awkwardness
|
||||
# in conversion for the 32-bit equivalents.
|
||||
is_address = is_output and not is_outptr and \
|
||||
type_name in ["Address", "Size"]
|
||||
type_name = substitute_type(type_name, bitness)
|
||||
|
||||
assert type_name in TYPE_SIZES, f"Unknown type '{type_name}'"
|
||||
|
||||
argument_types.append(
|
||||
Argument(type_name, var_name, is_output, is_outptr, is_address))
|
||||
|
||||
return (return_type, func_name, argument_types)
|
||||
|
||||
|
||||
class RegisterAllocator:
|
||||
def __init__(self, num_regs, byte_size, parameter_count):
|
||||
self.registers = {}
|
||||
self.num_regs = num_regs
|
||||
self.byte_size = byte_size
|
||||
self.parameter_count = parameter_count
|
||||
|
||||
# Mark the given register as allocated, for use in layout
|
||||
# calculation if the NGRN exceeds the ABI parameter count.
|
||||
def allocate(self, i):
|
||||
assert i not in self.registers, f"Register R{i} already allocated"
|
||||
self.registers[i] = True
|
||||
return i
|
||||
|
||||
# Calculate the next available location for a register;
|
||||
# the NGRN has exceeded the ABI parameter count.
|
||||
def allocate_first_free(self):
|
||||
for i in range(0, self.num_regs):
|
||||
if i in self.registers:
|
||||
continue
|
||||
|
||||
self.allocate(i)
|
||||
return i
|
||||
|
||||
assert False, "No registers available"
|
||||
|
||||
# Add a single register at the given NGRN.
|
||||
# If the index exceeds the ABI parameter count, try to find a
|
||||
# location to add it. Returns the output location and increment.
|
||||
def add_single(self, ngrn):
|
||||
if ngrn >= self.parameter_count:
|
||||
return (self.allocate_first_free(), 0)
|
||||
else:
|
||||
return (self.allocate(ngrn), 1)
|
||||
|
||||
# Add registers at the given NGRN for a data type of
|
||||
# the given size. Returns the output locations and increment.
|
||||
def add(self, ngrn, data_size, align=True):
|
||||
if data_size <= self.byte_size:
|
||||
r, i = self.add_single(ngrn)
|
||||
return ([r], i)
|
||||
|
||||
regs = []
|
||||
inc = ngrn % 2 if align else 0
|
||||
remaining_size = data_size
|
||||
while remaining_size > 0:
|
||||
r, i = self.add_single(ngrn + inc)
|
||||
regs.append(r)
|
||||
inc += i
|
||||
remaining_size -= self.byte_size
|
||||
|
||||
return (regs, inc)
|
||||
|
||||
|
||||
def reg_alloc(bitness):
|
||||
if bitness == 0:
|
||||
# aapcs32: 4 4-byte registers
|
||||
return RegisterAllocator(8, 4, 4)
|
||||
elif bitness == 1:
|
||||
# aapcs64: 8 8-byte registers
|
||||
return RegisterAllocator(8, 8, 8)
|
||||
|
||||
|
||||
# Converts a parsed SVC declaration into register lists for
|
||||
# the return value, outputs, and inputs.
|
||||
def get_registers(parse_result, bitness):
|
||||
output_alloc = reg_alloc(bitness)
|
||||
input_alloc = reg_alloc(bitness)
|
||||
return_type, _, arguments = parse_result
|
||||
|
||||
return_write = []
|
||||
output_writes = []
|
||||
input_reads = []
|
||||
|
||||
input_ngrn = 0
|
||||
output_ngrn = 0
|
||||
|
||||
# Run the input calculation.
|
||||
for arg in arguments:
|
||||
if arg.is_output and not arg.is_outptr:
|
||||
input_ngrn += 1
|
||||
continue
|
||||
|
||||
regs, increment = input_alloc.add(
|
||||
input_ngrn, TYPE_SIZES[arg.type_name], align=True)
|
||||
input_reads.append([arg.type_name, arg.var_name, regs])
|
||||
input_ngrn += increment
|
||||
|
||||
# Include the return value if this SVC returns a value.
|
||||
if return_type != "void":
|
||||
regs, increment = output_alloc.add(
|
||||
output_ngrn, TYPE_SIZES[return_type], align=False)
|
||||
return_write.append([return_type, regs])
|
||||
output_ngrn += increment
|
||||
|
||||
# Run the output calculation.
|
||||
for arg in arguments:
|
||||
if not arg.is_output or arg.is_outptr:
|
||||
continue
|
||||
|
||||
regs, increment = output_alloc.add(
|
||||
output_ngrn, TYPE_SIZES[arg.type_name], align=False)
|
||||
output_writes.append(
|
||||
[arg.type_name, arg.var_name, regs, arg.is_address])
|
||||
output_ngrn += increment
|
||||
|
||||
return (return_write, output_writes, input_reads)
|
||||
|
||||
|
||||
# Collects possibly multiple source registers into the named C++ value.
|
||||
def emit_gather(sources, name, type_name, reg_size):
|
||||
get_fn = f"GetReg{reg_size*8}"
|
||||
|
||||
if len(sources) == 1:
|
||||
s, = sources
|
||||
line = f"{name} = Convert<{type_name}>({get_fn}(system, {s}));"
|
||||
return [line]
|
||||
|
||||
var_type = f"std::array<uint{reg_size*8}_t, {len(sources)}>"
|
||||
lines = [
|
||||
f"{var_type} {name}_gather{{}};"
|
||||
]
|
||||
for i in range(0, len(sources)):
|
||||
lines.append(
|
||||
f"{name}_gather[{i}] = {get_fn}(system, {sources[i]});")
|
||||
|
||||
lines.append(f"{name} = Convert<{type_name}>({name}_gather);")
|
||||
return lines
|
||||
|
||||
|
||||
# Produces one or more statements which assign the named C++ value
|
||||
# into possibly multiple registers.
|
||||
def emit_scatter(destinations, name, reg_size):
|
||||
set_fn = f"SetReg{reg_size*8}"
|
||||
reg_type = f"uint{reg_size*8}_t"
|
||||
|
||||
if len(destinations) == 1:
|
||||
d, = destinations
|
||||
line = f"{set_fn}(system, {d}, Convert<{reg_type}>({name}));"
|
||||
return [line]
|
||||
|
||||
var_type = f"std::array<{reg_type}, {len(destinations)}>"
|
||||
lines = [
|
||||
f"auto {name}_scatter = Convert<{var_type}>({name});"
|
||||
]
|
||||
|
||||
for i in range(0, len(destinations)):
|
||||
lines.append(
|
||||
f"{set_fn}(system, {destinations[i]}, {name}_scatter[{i}]);")
|
||||
|
||||
return lines
|
||||
|
||||
|
||||
def emit_lines(lines, indent=' '):
|
||||
output_lines = []
|
||||
first = True
|
||||
for line in lines:
|
||||
if line and not first:
|
||||
output_lines.append(indent + line)
|
||||
else:
|
||||
output_lines.append(line)
|
||||
first = False
|
||||
|
||||
return "\n".join(output_lines)
|
||||
|
||||
|
||||
# Emit a C++ function to wrap a guest SVC.
|
||||
def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size):
|
||||
return_write, output_writes, input_reads = register_info
|
||||
lines = [
|
||||
f"static void SvcWrap_{wrapped_fn}{suffix}(Core::System& system) {{"
|
||||
]
|
||||
|
||||
# Get everything ready.
|
||||
for return_type, _ in return_write:
|
||||
lines.append(f"{return_type} ret{{}};")
|
||||
if return_write:
|
||||
lines.append("")
|
||||
|
||||
for output_type, var_name, _, is_address in output_writes:
|
||||
output_type = "uintptr_t" if is_address else output_type
|
||||
lines.append(f"{output_type} {var_name}{{}};")
|
||||
for input_type, var_name, _ in input_reads:
|
||||
lines.append(f"{input_type} {var_name}{{}};")
|
||||
|
||||
if output_writes or input_reads:
|
||||
lines.append("")
|
||||
|
||||
for input_type, var_name, sources in input_reads:
|
||||
lines += emit_gather(sources, var_name, input_type, byte_size)
|
||||
if input_reads:
|
||||
lines.append("")
|
||||
|
||||
# Build the call.
|
||||
call_arguments = ["system"]
|
||||
for arg in arguments:
|
||||
if arg.is_output and not arg.is_outptr:
|
||||
call_arguments.append(f"&{arg.var_name}")
|
||||
else:
|
||||
call_arguments.append(arg.var_name)
|
||||
|
||||
line = ""
|
||||
if return_write:
|
||||
line += "ret = "
|
||||
|
||||
line += f"{wrapped_fn}{suffix}({', '.join(call_arguments)});"
|
||||
lines.append(line)
|
||||
|
||||
if return_write or output_writes:
|
||||
lines.append("")
|
||||
|
||||
# Write back the return value and outputs.
|
||||
for _, destinations in return_write:
|
||||
lines += emit_scatter(destinations, "ret", byte_size)
|
||||
for _, var_name, destinations, _ in output_writes:
|
||||
lines += emit_scatter(destinations, var_name, byte_size)
|
||||
|
||||
# Finish.
|
||||
return emit_lines(lines) + "\n}"
|
||||
|
||||
|
||||
COPYRIGHT = """\
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// This file is automatically generated using svc_generator.py.
|
||||
"""
|
||||
|
||||
PROLOGUE_H = """
|
||||
#pragma once
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
// clang-format off
|
||||
"""
|
||||
|
||||
EPILOGUE_H = """
|
||||
// clang-format on
|
||||
|
||||
// Custom ABI.
|
||||
Result ReplyAndReceiveLight(Core::System& system, Handle handle, uint32_t* args);
|
||||
Result ReplyAndReceiveLight64From32(Core::System& system, Handle handle, uint32_t* args);
|
||||
Result ReplyAndReceiveLight64(Core::System& system, Handle handle, uint32_t* args);
|
||||
|
||||
Result SendSyncRequestLight(Core::System& system, Handle session_handle, uint32_t* args);
|
||||
Result SendSyncRequestLight64From32(Core::System& system, Handle session_handle, uint32_t* args);
|
||||
Result SendSyncRequestLight64(Core::System& system, Handle session_handle, uint32_t* args);
|
||||
|
||||
void CallSecureMonitor(Core::System& system, lp64::SecureMonitorArguments* args);
|
||||
void CallSecureMonitor64From32(Core::System& system, ilp32::SecureMonitorArguments* args);
|
||||
void CallSecureMonitor64(Core::System& system, lp64::SecureMonitorArguments* args);
|
||||
|
||||
// Defined in svc_light_ipc.cpp.
|
||||
void SvcWrap_ReplyAndReceiveLight64From32(Core::System& system);
|
||||
void SvcWrap_ReplyAndReceiveLight64(Core::System& system);
|
||||
|
||||
void SvcWrap_SendSyncRequestLight64From32(Core::System& system);
|
||||
void SvcWrap_SendSyncRequestLight64(Core::System& system);
|
||||
|
||||
// Defined in svc_secure_monitor_call.cpp.
|
||||
void SvcWrap_CallSecureMonitor64From32(Core::System& system);
|
||||
void SvcWrap_CallSecureMonitor64(Core::System& system);
|
||||
|
||||
// Perform a supervisor call by index.
|
||||
void Call(Core::System& system, u32 imm);
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
"""
|
||||
|
||||
PROLOGUE_CPP = """
|
||||
#include <type_traits>
|
||||
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
|
||||
namespace Kernel::Svc {
|
||||
|
||||
static uint32_t GetReg32(Core::System& system, int n) {
|
||||
return static_cast<uint32_t>(system.CurrentArmInterface().GetReg(n));
|
||||
}
|
||||
|
||||
static void SetReg32(Core::System& system, int n, uint32_t result) {
|
||||
system.CurrentArmInterface().SetReg(n, static_cast<uint64_t>(result));
|
||||
}
|
||||
|
||||
static uint64_t GetReg64(Core::System& system, int n) {
|
||||
return system.CurrentArmInterface().GetReg(n);
|
||||
}
|
||||
|
||||
static void SetReg64(Core::System& system, int n, uint64_t result) {
|
||||
system.CurrentArmInterface().SetReg(n, result);
|
||||
}
|
||||
|
||||
// Like bit_cast, but handles the case when the source and dest
|
||||
// are differently-sized.
|
||||
template <typename To, typename From>
|
||||
requires(std::is_trivial_v<To> && std::is_trivially_copyable_v<From>)
|
||||
static To Convert(const From& from) {
|
||||
To to{};
|
||||
|
||||
if constexpr (sizeof(To) >= sizeof(From)) {
|
||||
std::memcpy(&to, &from, sizeof(From));
|
||||
} else {
|
||||
std::memcpy(&to, &from, sizeof(To));
|
||||
}
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
"""
|
||||
|
||||
EPILOGUE_CPP = """
|
||||
// clang-format on
|
||||
|
||||
void Call(Core::System& system, u32 imm) {
|
||||
auto& kernel = system.Kernel();
|
||||
kernel.EnterSVCProfile();
|
||||
|
||||
if (system.CurrentProcess()->Is64BitProcess()) {
|
||||
Call64(system, imm);
|
||||
} else {
|
||||
Call32(system, imm);
|
||||
}
|
||||
|
||||
kernel.ExitSVCProfile();
|
||||
}
|
||||
|
||||
} // namespace Kernel::Svc
|
||||
"""
|
||||
|
||||
|
||||
def emit_call(bitness, names, suffix):
|
||||
bit_size = REG_SIZES[bitness]*8
|
||||
indent = " "
|
||||
lines = [
|
||||
f"static void Call{bit_size}(Core::System& system, u32 imm) {{",
|
||||
f"{indent}switch (static_cast<SvcId>(imm)) {{"
|
||||
]
|
||||
|
||||
for _, name in names:
|
||||
lines.append(f"{indent}case SvcId::{name}:")
|
||||
lines.append(f"{indent*2}return SvcWrap_{name}{suffix}(system);")
|
||||
|
||||
lines.append(f"{indent}default:")
|
||||
lines.append(
|
||||
f"{indent*2}LOG_CRITICAL(Kernel_SVC, \"Unknown SVC {{:x}}!\", imm);")
|
||||
lines.append(f"{indent*2}break;")
|
||||
lines.append(f"{indent}}}")
|
||||
lines.append("}")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def build_fn_declaration(return_type, name, arguments):
|
||||
arg_list = ["Core::System& system"]
|
||||
for arg in arguments:
|
||||
type_name = "uintptr_t" if arg.is_address else arg.type_name
|
||||
pointer = "*" if arg.is_output and not arg.is_outptr else ""
|
||||
arg_list.append(f"{type_name}{pointer} {arg.var_name}")
|
||||
|
||||
return f"{return_type} {name}({', '.join(arg_list)});"
|
||||
|
||||
|
||||
def build_enum_declarations():
|
||||
lines = ["enum class SvcId : u32 {"]
|
||||
indent = " "
|
||||
|
||||
for imm, decl in SVCS:
|
||||
_, name, _ = parse_declaration(decl, BIT_64)
|
||||
lines.append(f"{indent}{name} = {hex(imm)},")
|
||||
|
||||
lines.append("};")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def main():
|
||||
arch_fw_declarations = [[], []]
|
||||
svc_fw_declarations = []
|
||||
wrapper_fns = []
|
||||
names = []
|
||||
|
||||
for imm, decl in SVCS:
|
||||
return_type, name, arguments = parse_declaration(decl, BIT_64)
|
||||
|
||||
if imm not in SKIP_WRAPPERS:
|
||||
svc_fw_declarations.append(
|
||||
build_fn_declaration(return_type, name, arguments))
|
||||
|
||||
names.append([imm, name])
|
||||
|
||||
for bitness in range(2):
|
||||
byte_size = REG_SIZES[bitness]
|
||||
suffix = SUFFIX_NAMES[bitness]
|
||||
|
||||
for imm, decl in SVCS:
|
||||
if imm in SKIP_WRAPPERS:
|
||||
continue
|
||||
|
||||
parse_result = parse_declaration(decl, bitness)
|
||||
return_type, name, arguments = parse_result
|
||||
|
||||
register_info = get_registers(parse_result, bitness)
|
||||
wrapper_fns.append(
|
||||
emit_wrapper(name, suffix, register_info, arguments, byte_size))
|
||||
arch_fw_declarations[bitness].append(
|
||||
build_fn_declaration(return_type, name + suffix, arguments))
|
||||
|
||||
call_32 = emit_call(BIT_32, names, SUFFIX_NAMES[BIT_32])
|
||||
call_64 = emit_call(BIT_64, names, SUFFIX_NAMES[BIT_64])
|
||||
enum_decls = build_enum_declarations()
|
||||
|
||||
with open("svc.h", "w") as f:
|
||||
f.write(COPYRIGHT)
|
||||
f.write(PROLOGUE_H)
|
||||
f.write("\n".join(svc_fw_declarations))
|
||||
f.write("\n\n")
|
||||
f.write("\n".join(arch_fw_declarations[BIT_32]))
|
||||
f.write("\n\n")
|
||||
f.write("\n".join(arch_fw_declarations[BIT_64]))
|
||||
f.write("\n\n")
|
||||
f.write(enum_decls)
|
||||
f.write(EPILOGUE_H)
|
||||
|
||||
with open("svc.cpp", "w") as f:
|
||||
f.write(COPYRIGHT)
|
||||
f.write(PROLOGUE_CPP)
|
||||
f.write(emit_size_check())
|
||||
f.write("\n\n")
|
||||
f.write("\n\n".join(wrapper_fns))
|
||||
f.write("\n\n")
|
||||
f.write(call_32)
|
||||
f.write("\n\n")
|
||||
f.write(call_64)
|
||||
f.write(EPILOGUE_CPP)
|
||||
|
||||
print(f"Done (emitted {len(names)} definitions)")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,733 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static inline u64 Param(const Core::System& system, int n) {
|
||||
return system.CurrentArmInterface().GetReg(n);
|
||||
}
|
||||
|
||||
static inline u32 Param32(const Core::System& system, int n) {
|
||||
return static_cast<u32>(system.CurrentArmInterface().GetReg(n));
|
||||
}
|
||||
|
||||
/**
|
||||
* HLE a function return from the current ARM userland process
|
||||
* @param system System context
|
||||
* @param result Result to return
|
||||
*/
|
||||
static inline void FuncReturn(Core::System& system, u64 result) {
|
||||
system.CurrentArmInterface().SetReg(0, result);
|
||||
}
|
||||
|
||||
static inline void FuncReturn32(Core::System& system, u32 result) {
|
||||
system.CurrentArmInterface().SetReg(0, (u64)result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function wrappers that return type Result
|
||||
|
||||
template <Result func(Core::System&, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0)).raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), Param(system, 1)).raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(
|
||||
system,
|
||||
func(system, static_cast<u32>(Param(system, 0)), static_cast<u32>(Param(system, 1))).raw);
|
||||
}
|
||||
|
||||
// Used by SetThreadActivity
|
||||
template <Result func(Core::System&, Handle, Svc::ThreadActivity)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)),
|
||||
static_cast<Svc::ThreadActivity>(Param(system, 1)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32, u64, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
|
||||
Param(system, 2), Param(system, 3))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by MapProcessMemory and UnmapProcessMemory
|
||||
template <Result func(Core::System&, u64, u32, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1)),
|
||||
Param(system, 2), Param(system, 3))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by ControlCodeMemory
|
||||
template <Result func(Core::System&, Handle, u32, VAddr, size_t, Svc::MemoryPermission)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<Handle>(Param(system, 0)),
|
||||
static_cast<u32>(Param(system, 1)), Param(system, 2), Param(system, 3),
|
||||
static_cast<Svc::MemoryPermission>(Param(system, 4)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32*)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param = 0;
|
||||
const u32 retval = func(system, ¶m).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32*, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, static_cast<u32>(Param(system, 1))).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32*, u32*)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
u32 param_2 = 0;
|
||||
const u32 retval = func(system, ¶m_1, ¶m_2).raw;
|
||||
|
||||
auto& arm_interface = system.CurrentArmInterface();
|
||||
arm_interface.SetReg(1, param_1);
|
||||
arm_interface.SetReg(2, param_2);
|
||||
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32*, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1)).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32*, u64, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval =
|
||||
func(system, ¶m_1, Param(system, 1), static_cast<u32>(Param(system, 2))).raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64*, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u64 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, static_cast<u32>(Param(system, 1))).raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), static_cast<u32>(Param(system, 1))).raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64*, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u64 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1)).raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64*, u32, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u64 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, static_cast<u32>(Param(system, 1)),
|
||||
static_cast<u32>(Param(system, 2)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetResourceLimitLimitValue.
|
||||
template <Result func(Core::System&, u64*, Handle, Svc::LimitableResource)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u64 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, static_cast<Handle>(Param(system, 1)),
|
||||
static_cast<Svc::LimitableResource>(Param(system, 2)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1)).raw);
|
||||
}
|
||||
|
||||
// Used by SetResourceLimitLimitValue
|
||||
template <Result func(Core::System&, Handle, Svc::LimitableResource, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<Handle>(Param(system, 0)),
|
||||
static_cast<Svc::LimitableResource>(Param(system, 1)), Param(system, 2))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by SetThreadCoreMask
|
||||
template <Result func(Core::System&, Handle, s32, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)),
|
||||
static_cast<s32>(Param(system, 1)), Param(system, 2))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by GetThreadCoreMask
|
||||
template <Result func(Core::System&, Handle, s32*, u64*)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
s32 param_1 = 0;
|
||||
u64 param_2 = 0;
|
||||
const Result retval = func(system, static_cast<u32>(Param(system, 2)), ¶m_1, ¶m_2);
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
FuncReturn(system, retval.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u64, u32, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
||||
static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u64, u32, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
||||
static_cast<u32>(Param(system, 2)), Param(system, 3))
|
||||
.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32, u64, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0)), Param(system, 1),
|
||||
static_cast<u32>(Param(system, 2)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), Param(system, 1), Param(system, 2)).raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u64, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(
|
||||
system,
|
||||
func(system, Param(system, 0), Param(system, 1), static_cast<u32>(Param(system, 2))).raw);
|
||||
}
|
||||
|
||||
// Used by SetMemoryPermission
|
||||
template <Result func(Core::System&, u64, u64, Svc::MemoryPermission)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
||||
static_cast<Svc::MemoryPermission>(Param(system, 2)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by MapSharedMemory
|
||||
template <Result func(Core::System&, Handle, u64, u64, Svc::MemoryPermission)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<Handle>(Param(system, 0)), Param(system, 1),
|
||||
Param(system, 2), static_cast<Svc::MemoryPermission>(Param(system, 3)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(
|
||||
system,
|
||||
func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2)).raw);
|
||||
}
|
||||
|
||||
// Used by WaitSynchronization
|
||||
template <Result func(Core::System&, s32*, u64, s32, s64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
s32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1), static_cast<s32>(Param(system, 2)),
|
||||
static_cast<s64>(Param(system, 3)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u64, u64, u32, s64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system, Param(system, 0), Param(system, 1),
|
||||
static_cast<u32>(Param(system, 2)), static_cast<s64>(Param(system, 3)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by GetInfo
|
||||
template <Result func(Core::System&, u64*, u64, Handle, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u64 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1),
|
||||
static_cast<Handle>(Param(system, 2)), Param(system, 3))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, u32*, u64, u64, u64, u32, s32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1), Param(system, 2), Param(system, 3),
|
||||
static_cast<u32>(Param(system, 4)), static_cast<s32>(Param(system, 5)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by CreateTransferMemory
|
||||
template <Result func(Core::System&, Handle*, u64, u64, Svc::MemoryPermission)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1), Param(system, 2),
|
||||
static_cast<Svc::MemoryPermission>(Param(system, 3)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by CreateCodeMemory
|
||||
template <Result func(Core::System&, Handle*, VAddr, size_t)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1), Param(system, 2)).raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
template <Result func(Core::System&, Handle*, u64, u32, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param(system, 1), static_cast<u32>(Param(system, 2)),
|
||||
static_cast<u32>(Param(system, 3)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by CreateSession
|
||||
template <Result func(Core::System&, Handle*, Handle*, u32, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
Handle param_1 = 0;
|
||||
Handle param_2 = 0;
|
||||
const u32 retval = func(system, ¶m_1, ¶m_2, static_cast<u32>(Param(system, 2)),
|
||||
static_cast<u32>(Param(system, 3)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by ReplyAndReceive
|
||||
template <Result func(Core::System&, s32*, Handle*, s32, Handle, s64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
s32 param_1 = 0;
|
||||
s32 num_handles = static_cast<s32>(Param(system, 2));
|
||||
|
||||
std::vector<Handle> handles(num_handles);
|
||||
system.Memory().ReadBlock(Param(system, 1), handles.data(), num_handles * sizeof(Handle));
|
||||
|
||||
const u32 retval = func(system, ¶m_1, handles.data(), num_handles,
|
||||
static_cast<s32>(Param(system, 3)), static_cast<s64>(Param(system, 4)))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by WaitForAddress
|
||||
template <Result func(Core::System&, u64, Svc::ArbitrationType, s32, s64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system,
|
||||
func(system, Param(system, 0), static_cast<Svc::ArbitrationType>(Param(system, 1)),
|
||||
static_cast<s32>(Param(system, 2)), static_cast<s64>(Param(system, 3)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
// Used by SignalToAddress
|
||||
template <Result func(Core::System&, u64, Svc::SignalType, s32, s32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system,
|
||||
func(system, Param(system, 0), static_cast<Svc::SignalType>(Param(system, 1)),
|
||||
static_cast<s32>(Param(system, 2)), static_cast<s32>(Param(system, 3)))
|
||||
.raw);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function wrappers that return type u32
|
||||
|
||||
template <u32 func(Core::System&)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function wrappers that return type u64
|
||||
|
||||
template <u64 func(Core::System&)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
FuncReturn(system, func(system));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Function wrappers that return type void
|
||||
|
||||
template <void func(Core::System&)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system);
|
||||
}
|
||||
|
||||
template <void func(Core::System&, u32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, static_cast<u32>(Param(system, 0)));
|
||||
}
|
||||
|
||||
template <void func(Core::System&, u32, u64, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2),
|
||||
Param(system, 3));
|
||||
}
|
||||
|
||||
template <void func(Core::System&, s64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, static_cast<s64>(Param(system, 0)));
|
||||
}
|
||||
|
||||
template <void func(Core::System&, u64, s32)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, Param(system, 0), static_cast<s32>(Param(system, 1)));
|
||||
}
|
||||
|
||||
template <void func(Core::System&, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, Param(system, 0), Param(system, 1));
|
||||
}
|
||||
|
||||
template <void func(Core::System&, u64, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, Param(system, 0), Param(system, 1), Param(system, 2));
|
||||
}
|
||||
|
||||
template <void func(Core::System&, u32, u64, u64)>
|
||||
void SvcWrap64(Core::System& system) {
|
||||
func(system, static_cast<u32>(Param(system, 0)), Param(system, 1), Param(system, 2));
|
||||
}
|
||||
|
||||
// Used by QueryMemory32, ArbitrateLock32
|
||||
template <Result func(Core::System&, u32, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
FuncReturn32(system,
|
||||
func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2)).raw);
|
||||
}
|
||||
|
||||
// Used by Break32
|
||||
template <void func(Core::System&, u32, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2));
|
||||
}
|
||||
|
||||
// Used by ExitProcess32, ExitThread32
|
||||
template <void func(Core::System&)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
func(system);
|
||||
}
|
||||
|
||||
// Used by GetCurrentProcessorNumber32
|
||||
template <u32 func(Core::System&)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
FuncReturn32(system, func(system));
|
||||
}
|
||||
|
||||
// Used by SleepThread32
|
||||
template <void func(Core::System&, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
func(system, Param32(system, 0), Param32(system, 1));
|
||||
}
|
||||
|
||||
// Used by CreateThread32
|
||||
template <Result func(Core::System&, Handle*, u32, u32, u32, u32, s32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
Handle param_1 = 0;
|
||||
|
||||
const u32 retval = func(system, ¶m_1, Param32(system, 0), Param32(system, 1),
|
||||
Param32(system, 2), Param32(system, 3), Param32(system, 4))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetInfo32
|
||||
template <Result func(Core::System&, u32*, u32*, u32, u32, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
u32 param_2 = 0;
|
||||
|
||||
const u32 retval = func(system, ¶m_1, ¶m_2, Param32(system, 0), Param32(system, 1),
|
||||
Param32(system, 2), Param32(system, 3))
|
||||
.raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetThreadPriority32, ConnectToNamedPort32
|
||||
template <Result func(Core::System&, u32*, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
const u32 retval = func(system, ¶m_1, Param32(system, 1)).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetThreadId32
|
||||
template <Result func(Core::System&, u32*, u32*, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
u32 param_2 = 0;
|
||||
|
||||
const u32 retval = func(system, ¶m_1, ¶m_2, Param32(system, 1)).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetSystemTick32
|
||||
template <void func(Core::System&, u32*, u32*)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
u32 param_2 = 0;
|
||||
|
||||
func(system, ¶m_1, ¶m_2);
|
||||
system.CurrentArmInterface().SetReg(0, param_1);
|
||||
system.CurrentArmInterface().SetReg(1, param_2);
|
||||
}
|
||||
|
||||
// Used by CreateEvent32
|
||||
template <Result func(Core::System&, Handle*, Handle*)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
Handle param_1 = 0;
|
||||
Handle param_2 = 0;
|
||||
|
||||
const u32 retval = func(system, ¶m_1, ¶m_2).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetThreadId32
|
||||
template <Result func(Core::System&, Handle, u32*, u32*, u32*)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
u32 param_1 = 0;
|
||||
u32 param_2 = 0;
|
||||
u32 param_3 = 0;
|
||||
|
||||
const u32 retval = func(system, Param32(system, 2), ¶m_1, ¶m_2, ¶m_3).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
system.CurrentArmInterface().SetReg(3, param_3);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by GetThreadCoreMask32
|
||||
template <Result func(Core::System&, Handle, s32*, u32*, u32*)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
s32 param_1 = 0;
|
||||
u32 param_2 = 0;
|
||||
u32 param_3 = 0;
|
||||
|
||||
const u32 retval = func(system, Param32(system, 2), ¶m_1, ¶m_2, ¶m_3).raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
system.CurrentArmInterface().SetReg(2, param_2);
|
||||
system.CurrentArmInterface().SetReg(3, param_3);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by SignalProcessWideKey32
|
||||
template <void func(Core::System&, u32, s32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
func(system, static_cast<u32>(Param(system, 0)), static_cast<s32>(Param(system, 1)));
|
||||
}
|
||||
|
||||
// Used by SetThreadActivity32
|
||||
template <Result func(Core::System&, Handle, Svc::ThreadActivity)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval = func(system, static_cast<Handle>(Param(system, 0)),
|
||||
static_cast<Svc::ThreadActivity>(Param(system, 1)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by SetThreadPriority32
|
||||
template <Result func(Core::System&, Handle, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval =
|
||||
func(system, static_cast<Handle>(Param(system, 0)), static_cast<u32>(Param(system, 1))).raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by SetMemoryAttribute32
|
||||
template <Result func(Core::System&, Handle, u32, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval =
|
||||
func(system, static_cast<Handle>(Param(system, 0)), static_cast<u32>(Param(system, 1)),
|
||||
static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by MapSharedMemory32
|
||||
template <Result func(Core::System&, Handle, u32, u32, Svc::MemoryPermission)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval = func(system, static_cast<Handle>(Param(system, 0)),
|
||||
static_cast<u32>(Param(system, 1)), static_cast<u32>(Param(system, 2)),
|
||||
static_cast<Svc::MemoryPermission>(Param(system, 3)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by SetThreadCoreMask32
|
||||
template <Result func(Core::System&, Handle, s32, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval =
|
||||
func(system, static_cast<Handle>(Param(system, 0)), static_cast<s32>(Param(system, 1)),
|
||||
static_cast<u32>(Param(system, 2)), static_cast<u32>(Param(system, 3)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by WaitProcessWideKeyAtomic32
|
||||
template <Result func(Core::System&, u32, u32, Handle, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval =
|
||||
func(system, static_cast<u32>(Param(system, 0)), static_cast<u32>(Param(system, 1)),
|
||||
static_cast<Handle>(Param(system, 2)), static_cast<u32>(Param(system, 3)),
|
||||
static_cast<u32>(Param(system, 4)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by WaitForAddress32
|
||||
template <Result func(Core::System&, u32, Svc::ArbitrationType, s32, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval = func(system, static_cast<u32>(Param(system, 0)),
|
||||
static_cast<Svc::ArbitrationType>(Param(system, 1)),
|
||||
static_cast<s32>(Param(system, 2)), static_cast<u32>(Param(system, 3)),
|
||||
static_cast<u32>(Param(system, 4)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by SignalToAddress32
|
||||
template <Result func(Core::System&, u32, Svc::SignalType, s32, s32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval = func(system, static_cast<u32>(Param(system, 0)),
|
||||
static_cast<Svc::SignalType>(Param(system, 1)),
|
||||
static_cast<s32>(Param(system, 2)), static_cast<s32>(Param(system, 3)))
|
||||
.raw;
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by SendSyncRequest32, ArbitrateUnlock32
|
||||
template <Result func(Core::System&, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
|
||||
}
|
||||
|
||||
// Used by CreateTransferMemory32
|
||||
template <Result func(Core::System&, Handle*, u32, u32, Svc::MemoryPermission)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
Handle handle = 0;
|
||||
const u32 retval = func(system, &handle, Param32(system, 1), Param32(system, 2),
|
||||
static_cast<Svc::MemoryPermission>(Param32(system, 3)))
|
||||
.raw;
|
||||
system.CurrentArmInterface().SetReg(1, handle);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by WaitSynchronization32
|
||||
template <Result func(Core::System&, u32, u32, s32, u32, s32*)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
s32 param_1 = 0;
|
||||
const u32 retval = func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2),
|
||||
Param32(system, 3), ¶m_1)
|
||||
.raw;
|
||||
system.CurrentArmInterface().SetReg(1, param_1);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by CreateCodeMemory32
|
||||
template <Result func(Core::System&, Handle*, u32, u32)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
Handle handle = 0;
|
||||
|
||||
const u32 retval = func(system, &handle, Param32(system, 1), Param32(system, 2)).raw;
|
||||
|
||||
system.CurrentArmInterface().SetReg(1, handle);
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by ControlCodeMemory32
|
||||
template <Result func(Core::System&, Handle, u32, u64, u64, Svc::MemoryPermission)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u32 retval =
|
||||
func(system, Param32(system, 0), Param32(system, 1), Param(system, 2), Param(system, 4),
|
||||
static_cast<Svc::MemoryPermission>(Param32(system, 6)))
|
||||
.raw;
|
||||
|
||||
FuncReturn(system, retval);
|
||||
}
|
||||
|
||||
// Used by Invalidate/Store/FlushProcessDataCache32
|
||||
template <Result func(Core::System&, Handle, u64, u64)>
|
||||
void SvcWrap32(Core::System& system) {
|
||||
const u64 address = (Param(system, 3) << 32) | Param(system, 2);
|
||||
const u64 size = (Param(system, 4) << 32) | Param(system, 1);
|
||||
FuncReturn32(system, func(system, Param32(system, 0), address, size).raw);
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
Loading…
Reference in New Issue