svc: add a few more SVC bindings

Mostly debug and IPC related.
This commit is contained in:
Daz Jones 2015-08-23 20:27:31 +01:00
parent 24fd71c4ad
commit debe7a7553
2 changed files with 112 additions and 22 deletions

View File

@ -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);

View File

@ -326,7 +326,6 @@ svcOpenProcess:
str r1, [r2]
bx lr
.global svcOpenThread
.type svcOpenThread, %function
svcOpenThread:
@ -336,7 +335,6 @@ svcOpenThread:
str r1, [r2]
bx lr
.global svcGetProcessId
.type svcGetProcessId, %function
svcGetProcessId:
@ -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:
@ -383,6 +386,65 @@ svcCreatePort:
add sp, sp, #8
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
svcDebugActiveProcess:
@ -462,12 +524,24 @@ svcUnmapProcessMemory:
svc 0x72
bx lr
.global svcTerminateProcess
.type svcTerminateProcess, %function
svcTerminateProcess:
svc 0x76
bx lr
.global svcBackdoor
.type svcBackdoor, %function
svcBackdoor:
svc 0x7B
bx lr
.global svcKernelSetState
.type svcKernelSetState, %function
svcKernelSetState:
svc 0x7C
bx lr
.global svcQueryProcessMemory
.type svcQueryProcessMemory, %function
svcQueryProcessMemory: