svc.h/s cleanup; add svcWriteProcessMemory & svcControlProcessMemory

This commit is contained in:
fincs 2015-04-13 17:56:38 +02:00
parent 16732899d5
commit 7b059d9395
2 changed files with 52 additions and 34 deletions

View File

@ -195,6 +195,7 @@ s32 svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_
void __attribute__((noreturn)) svcExitThread();
void svcSleepThread(s64 ns);
s32 svcSetThreadPriority(Handle thread, s32 prio);
s32 svcGetProcessorID();
s32 svcCreateMutex(Handle* mutex, bool initially_locked);
s32 svcReleaseMutex(Handle handle);
s32 svcCreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count);
@ -232,8 +233,9 @@ Result svcGetProcessDebugEvent(DebugEventInfo *info, Handle debug);
Result svcContinueDebugEvent(Handle debug, u32 flags);
Result svcGetProcessList(s32* processCount, u32* processIds, s32 processIdMaxCount);
Result svcReadProcessMemory(void* buffer, Handle debug, u32 addr, u32 size);
Result svcWriteProcessMemory(Handle debug, const void* buffer, u32 addr, u32 size);
Result svcControlProcessMemory(Handle process, u32 addr0, u32 addr1, u32 size, u32 type, u32 perm);
Result svcMapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
Result svcUnmapProcessMemory(Handle process, u32 startAddr, u32 endAddr);
Result svcBackdoor(s32 (*callback)(void));
Result svcQueryProcessMemory(MemInfo* info, PageInfo* out, Handle process, u32 addr);
s32 svcGetProcessorID();

View File

@ -65,6 +65,12 @@ svcSetThreadPriority:
svc 0x0C
bx lr
.global svcGetProcessorID
.type svcGetProcessorID, %function
svcGetProcessorID:
svc 0x11
bx lr
.global svcCreateMutex
.type svcCreateMutex, %function
svcCreateMutex:
@ -80,6 +86,24 @@ svcReleaseMutex:
svc 0x14
bx lr
.global svcCreateSemaphore
.type svcCreateSemaphore, %function
svcCreateSemaphore:
push {r0}
svc 0x15
pop {r3}
str r1, [r3]
bx lr
.global svcReleaseSemaphore
.type svcReleaseSemaphore, %function
svcReleaseSemaphore:
push {r0}
svc 0x16
pop {r3}
str r1, [r3]
bx lr
.global svcCreateEvent
.type svcCreateEvent, %function
svcCreateEvent:
@ -265,30 +289,6 @@ svcGetProcessId:
str r1, [r3]
bx lr
.global svcOutputDebugString
.type svcOutputDebugString, %function
svcOutputDebugString:
svc 0x3D
bx lr
.global svcCreateSemaphore
.type svcCreateSemaphore, %function
svcCreateSemaphore:
push {r0}
svc 0x15
pop {r3}
str r1, [r3]
bx lr
.global svcReleaseSemaphore
.type svcReleaseSemaphore, %function
svcReleaseSemaphore:
push {r0}
svc 0x16
pop {r3}
str r1, [r3]
bx lr
.global svcGetThreadId
.type svcGetThreadId, %function
svcGetThreadId:
@ -298,6 +298,12 @@ svcGetThreadId:
str r1, [r3]
bx lr
.global svcOutputDebugString
.type svcOutputDebugString, %function
svcOutputDebugString:
svc 0x3D
bx lr
.global svcCreatePort
.type svcCreatePort, %function
svcCreatePort:
@ -361,6 +367,22 @@ svcReadProcessMemory:
svc 0x6A
bx lr
.global svcWriteProcessMemory
.type svcWriteProcessMemory, %function
svcWriteProcessMemory:
svc 0x6B
bx lr
.global svcControlProcessMemory
.type svcControlProcessMemory, %function
svcControlProcessMemory:
push {r4-r5}
ldr r4, [sp, #0x8]
ldr r5, [sp, #0xC]
svc 0x70
pop {r4-r5}
bx lr
.global svcMapProcessMemory
.type svcMapProcessMemory, %function
svcMapProcessMemory:
@ -391,9 +413,3 @@ svcQueryProcessMemory:
add sp, sp, #8
pop {r4-r6}
bx lr
.global svcGetProcessorID
.type svcGetProcessorID, %function
svcGetProcessorID:
svc 0x11
bx lr