github.com/racerxdl/gonx@v0.0.0-20210103083128-c5afc43bcbd2/svc/svc.go (about) 1 package svc 2 3 // 4 // 5 //// SvcSetMemoryPermission Sets memory permission 6 //// svc 0x02 7 ////export svcSetMemoryPermission 8 //func SvcSetMemoryPermission(addr uintptr, size uintptr, perm uint32) uint64 9 // 10 //// SvcSetMemoryAttribute Sets memory attributes 11 //// svc 0x03 12 ////export svcSetMemoryAttribute 13 //func SvcSetMemoryAttribute(addr uintptr, size uintptr, state0, state1 uint32) uint64 14 // 15 //// SvcMapMemory Maps a memory range into a different range. Mainly used for adding guard pages around stack. 16 //// svc 0x04 17 ////export svcMapMemory 18 //func SvcMapMemory(dstAddr, srcAddr uintptr, size uintptr) uint64 19 // 20 //// SvcUnmapMemory Unmaps a region that was previously mapped with SvcMapMemory. 21 //// svc 0x05 22 ////export svcUnmapMemory 23 //func SvcUnmapMemory(dstAddr, srcAddr uintptr, size uintptr) uint64 24 // 25 //// SvcQueryMemory Query information about an address. Will always fetch the lowest page-aligned mapping that contains the provided address. 26 //// svc 0x06 27 ////export svcQueryMemory 28 //func SvcQueryMemory(memoryInfo, pageInfo uintptr, size uintptr) uint64 29 // 30 // 31 //// SvcCreateThread Creates a thread. 32 //// svc 0x08 33 ////export svcCreateThread 34 //func SvcCreateThread(handle *uint32, entry, arg, stackTop uintptr, prio, cpuid int) uint64 35 // 36 //// SvcStartThread Starts a freshly created thread. 37 //// svc 0x09 38 ////export svcStartThread 39 //func SvcStartThread(handle uint32) uint64 40 // 41 //// SvcExitThread Exits the current thread. 42 //// svc 0x0A 43 ////export svcExitThread 44 //func SvcExitThread(handle uint32) uint64 45 // 46 //// SvcExitThread Gets a thread's priority. 47 //// svc 0x0C 48 ////export svcGetThreadPriority 49 //func svcGetThreadPriority(priority, handle *uint32) uint64 50 // 51 //// SvcSetThreadPriority Gets a thread's priority. 52 //// svc 0x0D 53 ////export svcSetThreadPriority 54 //func SvcSetThreadPriority(handle uint32, priority *uint32) uint64 55 // 56 //// SvcGetThreadCoreMask Gets a thread's core mask. 57 //// svc 0x0E 58 ////export svcGetThreadCoreMask 59 //func SvcGetThreadCoreMask(preferedCore *uint32, affinityMask *uint64, handle uint32) uint64 60 // 61 //// SvcSetThreadCoreMask Sets a thread's core mask. 62 //// svc 0x0F 63 ////export svcSetThreadCoreMask 64 //func SvcSetThreadCoreMask(handle uint32, preferedCore uint32, affinityMask uint64) uint64 65 // 66 //// SvcGetCurrentProcessorNumber Gets the current processor's number. 67 //// svc 0x10 68 ////export svcGetCurrentProcessorNumber 69 //func SvcGetCurrentProcessorNumber() uint32 70 // 71 //// SvcSignalEvent Sets an event's signalled status. 72 //// svc 0x11 73 ////export svcSignalEvent 74 //func SvcSignalEvent(handle uint32) uint64 75 // 76 //// SvcClearEvent Clears an event's signalled status. 77 //// svc 0x12 78 ////export svcClearEvent 79 //func SvcClearEvent(handle uint32) uint64 80 // 81 //// SvcMapSharedMemory Maps a block of shared memory. 82 //// svc 0x13 83 ////export svcMapSharedMemory 84 //func SvcMapSharedMemory(handle uint32, addr uintptr, size uintptr, perm uint32) uint64 85 // 86 //// SvcUnmapSharedMemory Unmaps a block of shared memory. 87 //// svc 0x14 88 ////export svcUnmapSharedMemory 89 //func SvcUnmapSharedMemory(handle uint32, addr uintptr, size uintptr) uint64 90 // 91 //// SvcCreateTransferMemory Creates a block of transfer memory. 92 //// svc 0x15 93 ////export svcCreateTransferMemory 94 //func SvcCreateTransferMemory(handle *uint32, addr uintptr, size uintptr, perm uint32) uint64 95 // 96 //// SvcCloseHandle Closes a handle, decrementing the reference count of the corresponding kernel object. 97 //// This might result in the kernel freeing the object. 98 //// svc 0x16. 99 ////export svcCloseHandle 100 //func SvcCloseHandle(session uint32) uint64 101 // 102 //// SvcResetSignal Resets a signal. 103 //// svc 0x17. 104 ////export svcResetSignal 105 //func SvcResetSignal(handle uint32) uint64 106 // 107 //// SvcWaitSynchronization Waits on one or more synchronization objects, optionally with a timeout. 108 //// handleCount must not be greater than 40. This is a Horizon Kernel Limitation 109 //// svc 0x18 110 ////export svcWaitSynchronization 111 //func SvcWaitSynchronization(index *uint32, handles *uint32, handleCount int32, timeout uint64) uint64 112 // 113 //// SvcCancelSynchronization Cancels a svcWaitSynchronization operation being done on a synchronization object in another thread. 114 //// svc 0x19 115 ////export svcCancelSynchronization 116 //func SvcCancelSynchronization(thread uint32) uint64 117 // 118 //// SvcArbitrateLock Arbitrates a mutex lock operation in userspace. 119 //// svc 0x1A 120 ////export svcArbitrateLock 121 //func SvcArbitrateLock(waitTag uint32, tagLocation *uint32, selfTag uint32) uint64 122 // 123 //// SvcArbitrateUnlock Arbitrates a mutex unlock operation in userspace. 124 //// svc 0x1B 125 ////export svcArbitrateUnlock 126 //func SvcArbitrateUnlock(tagLocation *uint32) uint64 127 // 128 //// SvcWaitProcessWideKeyAtomic Performs a condition variable wait operation in userspace. 129 //// svc 0x1C 130 ////export svcWaitProcessWideKeyAtomic 131 //func SvcWaitProcessWideKeyAtomic(key, tagLocation *uint32, selfTag uint32, timeout uint64) uint64 132 // 133 //// SvcSignalProcessWideKey Performs a condition variable wake-up operation in userspace. 134 //// svc 0x1D 135 ////export svcSignalProcessWideKey 136 //func SvcSignalProcessWideKey(key *uint32, num uint32) 137 // 138 //// SvcGetSystemTick Gets the current system tick. 139 //// svc 0x1E 140 ////export svcGetSystemTick 141 //func SvcGetSystemTick() uint64 142 // 143 //// SvcConnectToNamedPort Connects to a registered named port. 144 //// Expects byte to be a null terminated string 145 //// svc 0x1F 146 ////export svcConnectToNamedPort 147 //func SvcConnectToNamedPort(session *uint32, name *byte) uint64 148 // 149 //// SvcSendSyncRequestLight Sends a light IPC synchronization request to a session. 150 //// svc 0x20 151 ////export svcSendSyncRequestLight 152 //func SvcSendSyncRequestLight(session uint64) uint64 153 // 154 //// SvcSendSyncRequest Sends an IPC synchronization request to a session. 155 //// svc 0x21 156 ////export svcSyncRequest 157 //func SvcSendSyncRequest(session uint64) uint64 158 // 159 //// SvcSendSyncRequestWithUserBuffer Sends an IPC synchronization request to a session from an user allocated buffer. 160 //// Size must be page-aligned (0x1000) 161 //// svc 0x22 162 ////export svcSendSyncRequestWithUserBuffer 163 //func SvcSendSyncRequestWithUserBuffer(userBuffer uintptr, size uintptr, session uint64) uint64 164 // 165 //// SvcSendAsyncRequestWithUserBuffer Sends an IPC synchronization request to a session from an user allocated buffer (asynchronous version). 166 //// Size must be page-aligned (0x1000) 167 //// svc 0x23 168 ////export svcSendAsyncRequestWithUserBuffer 169 //func SvcSendAsyncRequestWithUserBuffer(handle *uint32, userBuffer uintptr, size uintptr, session uint64) uint64 170 // 171 //// SvcGetProcessId Gets the PID associated with a process. 172 //// svc 0x24 173 ////export svcGetProcessId 174 //func SvcGetProcessId(processID *uint64, handle uint32) uint64 175 // 176 //// SvcGetThreadId Gets the TID associated with a process. 177 //// svc 0x25 178 ////export svcGetThreadId 179 //func SvcGetThreadId(threadID *uint64, handle uint32) uint64 180 // 181 //// SvcBreak Breaks execution. Panic. 182 //// Used for triggering a debugger 183 //// svc 0x26 184 ////export svcBreak 185 //func SvcBreak(breakReason uint32, inval1, inval2 uint64) uint64 186 // 187 // 188 //// SvcReturnFromException Returns from an exception. 189 //// NO RETURN 190 //// svc 0x28 191 ////export svcReturnFromException 192 //func SvcReturnFromException(result uint64) 193 194 //// SvcFlushEntireDataCache Flushes the entire data cache (by set/way). 195 //// This is a privileged syscall and is dangerous, and should not be used if not needed 196 //// svc 0x2A 197 ////export svcFlushEntireDataCache 198 //func SvcFlushEntireDataCache() uint64 199 // 200 //// SvcFlushDataCache Flushes data cache for a virtual address range. 201 //// svc 0x2B 202 ////export svcFlushDataCache 203 //func SvcFlushDataCache(addr, size uintptr) uint64 204 // 205 //// SvcMapPhysicalMemory Maps new heap memory at the desired address. 206 //// Only on firmware 3.0.0+ 207 //// svc 0x2C 208 ////export svcMapPhysicalMemory 209 //func SvcMapPhysicalMemory(addr, size uintptr) uint64 210 // 211 //// SvcUnmapPhysicalMemory Undoes the effects of SvcMapPhysicalMemory. 212 //// Only on firmware 3.0.0+ 213 //// svc 0x2D 214 ////export svcUnmapPhysicalMemory 215 //func SvcUnmapPhysicalMemory(addr, size uintptr) uint64 216 // 217 //// SvcGetDebugFutureThreadInfo Gets information about a thread that will be scheduled in the future. 218 //// outContext -> Output LastThreadContext for the thread that will be scheduled. 219 //// outThreadId -> Output thread id for the thread that will be scheduled. 220 //// debug -> handle. 221 //// nanoseconds -> Nanoseconds in the future to get scheduled thread at. 222 //// 223 //// This is a privileged syscall 224 //// Only on firmware 5.0.0+ 225 //// svc 0x2E 226 ////export svcGetDebugFutureThreadInfo 227 //func SvcGetDebugFutureThreadInfo(outContext uintptr, outThreadId *uint64, debug uint32, nanoseconds uint64) uint64 228 // 229 //// SvcGetLastThreadInfo Gets information about the previously-scheduled thread. 230 //// outContext -> Output LastThreadContext for the thread that will be scheduled. 231 //// outTLSAddress -> Output tls address for the previously scheduled thread. 232 //// outFlags -> Output flags for the previously scheduled thread. 233 //// 234 //// svc 0x2F 235 ////export svcGetLastThreadInfo 236 //func SvcGetLastThreadInfo(outContext uintptr, outTLSAddress *uint64, outFlags *uint32) uint64 237 // 238 //// SvcGetResourceLimitLimitValue Gets the maximum value a LimitableResource can have, for a Resource Limit handle. 239 //// 240 //// This is a privileged syscall. 241 //// svc 0x30 242 ////export svcGetResourceLimitLimitValue 243 //func SvcGetResourceLimitLimitValue(out *int64, resLimit uint32, which uint32) uint64 244 // 245 //// SvcGetResourceLimitCurrentValue Gets the maximum value a LimitableResource can have, for a Resource Limit handle. 246 //// 247 //// This is a privileged syscall. 248 //// svc 0x31 249 ////export svcGetResourceLimitCurrentValue 250 //func SvcGetResourceLimitCurrentValue(out *int64, resLimit uint32, which uint32) uint64 251 // 252 //// SvcSetThreadActivity Configures the pause/unpause status of a thread. 253 //// 254 //// svc 0x32 255 ////export svcSetThreadActivity 256 //func SvcSetThreadActivity(thread uint32, paused bool) uint64 257 // 258 //// SvcGetThreadContext3 Dumps the registers of a thread paused by svcSetThreadActivity (register groups: all). 259 //// 260 //// svc 0x33 261 ////export svcGetThreadContext3 262 //func SvcGetThreadContext3(ctx uintptr, thread uint32) uint64 263 // 264 //// SvcWaitForAddress Arbitrates an address depending on type and value. 265 //// 266 //// Only on firmware 4.0.0+ 267 //// svc 0x34 268 ////export svcWaitForAddress 269 //func SvcWaitForAddress(addr uintptr, arbType uint32, value uint32, timeout uint64) uint64 270 // 271 //// SvcSignalToAddress Signals (and updates) an address depending on type and value. 272 //// 273 //// Only on firmware 4.0.0+ 274 //// svc 0x35 275 ////export svcSignalToAddress 276 //func SvcSignalToAddress(addr uintptr, signalType, value, count uint32) uint64 277 // 278 //// SvcSynchronizePreemptionState Sets thread preemption state (used during abort/panic). 279 //// 280 //// Only on firmware 8.0.0+ 281 //// svc 0x36 282 ////export svcSynchronizePreemptionState 283 //func SvcSynchronizePreemptionState()