Merge pull request #156 from Dazzozo/yay-svcs
svc: add a few more SVC bindings
This commit is contained in:
commit
2a0e9655a6
@ -270,6 +270,10 @@ Result svcMapMemoryBlock(Handle memblock, u32 addr, MemPerm my_perm, MemPerm oth
|
||||
Result svcMapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
|
||||
Result svcUnmapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
|
||||
Result svcUnmapMemoryBlock(Handle memblock, u32 addr);
|
||||
|
||||
Result svcStartInterProcessDma(Handle* dma, Handle dstProcess, void* dst, Handle srcProcess, const void* src, u32 size, void* dmaConfig);
|
||||
Result svcStopDma(Handle dma);
|
||||
Result svcGetDmaState(void* dmaState, Handle dma);
|
||||
/**
|
||||
* @brief Memory information query
|
||||
* @param addr Virtual memory address
|
||||
@ -280,6 +284,9 @@ Result svcQueryProcessMemory(MemInfo* info, PageInfo* out, Handle process, u32 a
|
||||
Result svcCreateAddressArbiter(Handle *arbiter);
|
||||
Result svcArbitrateAddress(Handle arbiter, u32 addr, ArbitrationType type, s32 value, s64 nanoseconds);
|
||||
|
||||
Result svcInvalidateProcessDataCache(Handle process, void* addr, u32 size);
|
||||
Result svcFlushProcessDataCache(Handle process, void const* addr, u32 size);
|
||||
|
||||
Result svcReadProcessMemory(void* buffer, Handle debug, u32 addr, u32 size);
|
||||
Result svcWriteProcessMemory(Handle debug, const void* buffer, u32 addr, u32 size);
|
||||
///@}
|
||||
@ -295,6 +302,7 @@ Result svcWriteProcessMemory(Handle debug, const void* buffer, u32 addr, u32 siz
|
||||
*/
|
||||
Result svcOpenProcess(Handle* process, u32 processId);
|
||||
void svcExitProcess() __attribute__((noreturn));
|
||||
Result svcTerminateProcess(Handle process);
|
||||
|
||||
Result svcGetProcessInfo(s64* out, Handle process, u32 type);
|
||||
Result svcGetProcessId(u32 *out, Handle handle);
|
||||
@ -312,7 +320,7 @@ Result svcConnectToPort(volatile Handle* out, const char* portName);
|
||||
* @param arg The argument passed to @p entrypoint
|
||||
* @param stack_top The top of the thread's stack. Must be 0x8 bytes mem-aligned.
|
||||
* @param thread_priority Low values gives the thread higher priority.
|
||||
* For userland app, this has to be withing the range [0x18;0x3F]
|
||||
* For userland apps, this has to be within the range [0x18;0x3F]
|
||||
* @param processor_id The id of the processor the thread should be ran on. Those are labelled starting from 0.
|
||||
* For old 3ds it has to be <2, and for new 3DS <4.
|
||||
* Value -1 means all CPUs and -2 read from the Exheader.
|
||||
@ -355,7 +363,7 @@ Result svcGetThreadPriority(s32 *out, Handle handle);
|
||||
|
||||
/**
|
||||
* @brief Changes the priority of a thread
|
||||
* @param prio For userland apps, this has to be withing the range [0x18;0x3F]
|
||||
* @param prio For userland apps, this has to be within the range [0x18;0x3F]
|
||||
*
|
||||
* Low values gives the thread higher priority.
|
||||
*/
|
||||
@ -396,14 +404,20 @@ Result svcGetThreadInfo(s64* out, Handle thread, ThreadInfoType type);
|
||||
///@{
|
||||
Result svcCreateMutex(Handle* mutex, bool initially_locked);
|
||||
Result svcReleaseMutex(Handle handle);
|
||||
|
||||
Result svcCreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count);
|
||||
Result svcReleaseSemaphore(s32* count, Handle semaphore, s32 release_count);
|
||||
|
||||
Result svcCreateEvent(Handle* event, u8 reset_type);
|
||||
Result svcSignalEvent(Handle handle);
|
||||
Result svcClearEvent(Handle handle);
|
||||
|
||||
Result svcWaitSynchronization(Handle handle, s64 nanoseconds);
|
||||
Result svcWaitSynchronizationN(s32* out, Handle* handles, s32 handles_num, bool wait_all, s64 nanoseconds);
|
||||
|
||||
Result svcSendSyncRequest(Handle session);
|
||||
Result svcAcceptSession(Handle* session, Handle port);
|
||||
Result svcReplyAndReceive(s32* index, Handle* handles, s32 handleCount, Handle replyTarget);
|
||||
///@}
|
||||
|
||||
///@name Time
|
||||
@ -420,11 +434,13 @@ u64 svcGetSystemTick();
|
||||
Result svcCloseHandle(Handle handle);
|
||||
Result svcDuplicateHandle(Handle* out, Handle original);
|
||||
Result svcGetSystemInfo(s64* out, u32 type, s32 param);
|
||||
Result svcKernelSetState(u32 type, u32 param0, u32 param1, u32 param2);
|
||||
///@}
|
||||
|
||||
|
||||
///@name Debugging
|
||||
///@{
|
||||
void svcBreak(UserBreakType breakReason);
|
||||
Result svcOutputDebugString(const char* str, int length);
|
||||
Result svcDebugActiveProcess(Handle* debug, u32 processId);
|
||||
Result svcBreakDebugProcess(Handle debug);
|
||||
|
@ -270,7 +270,7 @@ svcDuplicateHandle:
|
||||
.type svcGetSystemTick, %function
|
||||
svcGetSystemTick:
|
||||
svc 0x28
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcGetSystemInfo
|
||||
.type svcGetSystemInfo, %function
|
||||
@ -315,7 +315,7 @@ svcConnectToPort:
|
||||
.type svcSendSyncRequest, %function
|
||||
svcSendSyncRequest:
|
||||
svc 0x32
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcOpenProcess
|
||||
.type svcOpenProcess, %function
|
||||
@ -324,8 +324,7 @@ svcOpenProcess:
|
||||
svc 0x33
|
||||
pop {r2}
|
||||
str r1, [r2]
|
||||
bx lr
|
||||
|
||||
bx lr
|
||||
|
||||
.global svcOpenThread
|
||||
.type svcOpenThread, %function
|
||||
@ -334,8 +333,7 @@ svcOpenThread:
|
||||
svc 0x34
|
||||
pop {r2}
|
||||
str r1, [r2]
|
||||
bx lr
|
||||
|
||||
bx lr
|
||||
|
||||
.global svcGetProcessId
|
||||
.type svcGetProcessId, %function
|
||||
@ -346,7 +344,6 @@ svcGetProcessId:
|
||||
str r1, [r3]
|
||||
bx lr
|
||||
|
||||
|
||||
.global svcGetProcessIdOfThread
|
||||
.type svcGetProcessIdOfThread, %function
|
||||
svcGetProcessIdOfThread:
|
||||
@ -365,6 +362,12 @@ svcGetThreadId:
|
||||
str r1, [r3]
|
||||
bx lr
|
||||
|
||||
.global svcBreak
|
||||
.type svcBreak, %function
|
||||
svcBreak:
|
||||
svc 0x3C
|
||||
bx lr
|
||||
|
||||
.global svcOutputDebugString
|
||||
.type svcOutputDebugString, %function
|
||||
svcOutputDebugString:
|
||||
@ -381,7 +384,66 @@ svcCreatePort:
|
||||
ldr r3, [sp, #4]
|
||||
str r2, [r3]
|
||||
add sp, sp, #8
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcAcceptSession
|
||||
.type svcAcceptSession, %function
|
||||
svcAcceptSession:
|
||||
str r0, [sp, #-4]!
|
||||
svc 0x4A
|
||||
ldr r2, [sp]
|
||||
str r1, [r2]
|
||||
add sp, sp, #4
|
||||
bx lr
|
||||
|
||||
.global svcReplyAndReceive
|
||||
.type svcReplyAndReceive, %function
|
||||
svcReplyAndReceive:
|
||||
str r0, [sp, #-4]!
|
||||
svc 0x4F
|
||||
ldr r2, [sp]
|
||||
str r1, [r2]
|
||||
add sp, sp, #4
|
||||
bx lr
|
||||
|
||||
.global svcInvalidateProcessDataCache
|
||||
.type svcInvalidateProcessDataCache, %function
|
||||
svcInvalidateProcessDataCache:
|
||||
svc 0x52
|
||||
bx lr
|
||||
|
||||
.global svcFlushProcessDataCache
|
||||
.type svcFlushProcessDataCache, %function
|
||||
svcFlushProcessDataCache:
|
||||
svc 0x54
|
||||
bx lr
|
||||
|
||||
.global svcStartInterProcessDma
|
||||
.type svcStartInterProcessDma, %function
|
||||
svcStartInterProcessDma:
|
||||
stmfd sp!, {r0, r4, r5}
|
||||
ldr r0, [sp, #0xC]
|
||||
ldr r4, [sp, #0x10]
|
||||
ldr r5, [sp, #0x14]
|
||||
svc 0x55
|
||||
ldmfd sp!, {r2, r4, r5}
|
||||
str r1, [r2]
|
||||
bx lr
|
||||
|
||||
.global svcStopDma
|
||||
.type svcStopDma, %function
|
||||
svcStopDma:
|
||||
svc 0x56
|
||||
bx lr
|
||||
|
||||
.global svcGetDmaState
|
||||
.type svcGetDmaState, %function
|
||||
svcGetDmaState:
|
||||
str r0, [sp, #-4]!
|
||||
svc 0x57
|
||||
ldr r3, [sp], #4
|
||||
str r1, [r3]
|
||||
bx lr
|
||||
|
||||
.global svcDebugActiveProcess
|
||||
.type svcDebugActiveProcess, %function
|
||||
@ -390,31 +452,31 @@ svcDebugActiveProcess:
|
||||
svc 0x60
|
||||
pop {r2}
|
||||
str r1, [r2]
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcBreakDebugProcess
|
||||
.type svcBreakDebugProcess, %function
|
||||
svcBreakDebugProcess:
|
||||
svc 0x61
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcTerminateDebugProcess
|
||||
.type svcTerminateDebugProcess, %function
|
||||
svcTerminateDebugProcess:
|
||||
svc 0x62
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcGetProcessDebugEvent
|
||||
.type svcGetProcessDebugEvent, %function
|
||||
svcGetProcessDebugEvent:
|
||||
svc 0x63
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcContinueDebugEvent
|
||||
.type svcContinueDebugEvent, %function
|
||||
svcContinueDebugEvent:
|
||||
svc 0x64
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcGetProcessList
|
||||
.type svcGetProcessList, %function
|
||||
@ -426,13 +488,13 @@ svcGetProcessList:
|
||||
ldr r3, [sp, #4]
|
||||
str r2, [r3]
|
||||
add sp, sp, #8
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcReadProcessMemory
|
||||
.type svcReadProcessMemory, %function
|
||||
svcReadProcessMemory:
|
||||
svc 0x6A
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcWriteProcessMemory
|
||||
.type svcWriteProcessMemory, %function
|
||||
@ -448,25 +510,37 @@ svcControlProcessMemory:
|
||||
ldr r5, [sp, #0xC]
|
||||
svc 0x70
|
||||
pop {r4-r5}
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcMapProcessMemory
|
||||
.type svcMapProcessMemory, %function
|
||||
svcMapProcessMemory:
|
||||
svc 0x71
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcUnmapProcessMemory
|
||||
.type svcUnmapProcessMemory, %function
|
||||
svcUnmapProcessMemory:
|
||||
svc 0x72
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcTerminateProcess
|
||||
.type svcTerminateProcess, %function
|
||||
svcTerminateProcess:
|
||||
svc 0x76
|
||||
bx lr
|
||||
|
||||
.global svcBackdoor
|
||||
.type svcBackdoor, %function
|
||||
svcBackdoor:
|
||||
svc 0x7B
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
.global svcKernelSetState
|
||||
.type svcKernelSetState, %function
|
||||
svcKernelSetState:
|
||||
svc 0x7C
|
||||
bx lr
|
||||
|
||||
.global svcQueryProcessMemory
|
||||
.type svcQueryProcessMemory, %function
|
||||
@ -479,4 +553,4 @@ svcQueryProcessMemory:
|
||||
str r5, [r6]
|
||||
add sp, sp, #8
|
||||
pop {r4-r6}
|
||||
bx lr
|
||||
bx lr
|
||||
|
Loading…
Reference in New Issue
Block a user