More threading functionality

This commit is contained in:
plutoo 2018-01-01 23:32:44 +01:00
parent 03e9fdb883
commit 916dfb56f0
4 changed files with 19 additions and 1 deletions

View File

@ -12,3 +12,6 @@ Result threadCreate(
Result threadStart(Thread* t); Result threadStart(Thread* t);
Result threadWaitForExit(Thread* t); Result threadWaitForExit(Thread* t);
Result threadClose(Thread* t); Result threadClose(Thread* t);
Result threadPause(Thread* t);
Result threadResume(Thread* t);

View File

@ -43,6 +43,7 @@ Result svcMapSharedMemory(Handle handle, void* addr, size_t size, u32 perm);
Result svcUnmapSharedMemory(Handle handle, void* addr, size_t size); Result svcUnmapSharedMemory(Handle handle, void* addr, size_t size);
Result svcCreateTransferMemory(Handle* out, void* addr, size_t size, u32 perm); Result svcCreateTransferMemory(Handle* out, void* addr, size_t size, u32 perm);
Result svcWaitSynchronization(s32* index, const Handle* handles, s32 handleCount, u64 timeout); Result svcWaitSynchronization(s32* index, const Handle* handles, s32 handleCount, u64 timeout);
Result svcCancelSynchronization(Handle thread);
Result svcArbitrateLock(u32 wait_tag, u32* tag_location, u32 self_tag); Result svcArbitrateLock(u32 wait_tag, u32* tag_location, u32 self_tag);
Result svcArbitrateUnlock(u32* tag_location); Result svcArbitrateUnlock(u32* tag_location);
Result svcConnectToNamedPort(Handle* session, const char* name); Result svcConnectToNamedPort(Handle* session, const char* name);
@ -52,6 +53,7 @@ Result svcGetProcessId(u64 *processID, Handle handle);
Result svcBreak(u32 breakReason, u64 inval1, u64 inval2); Result svcBreak(u32 breakReason, u64 inval1, u64 inval2);
Result svcOutputDebugString(const char *str, u64 size); Result svcOutputDebugString(const char *str, u64 size);
Result svcGetInfo(u64* out, u64 id0, Handle handle, u64 id1); Result svcGetInfo(u64* out, u64 id0, Handle handle, u64 id1);
Result svcSetThreadActivity(Handle thread, bool paused);
Result svcCreateSession(Handle *server_handle, Handle *client_handle, u32 unk0, u64 unk1);//unk* are normally 0? Result svcCreateSession(Handle *server_handle, Handle *client_handle, u32 unk0, u64 unk1);//unk* are normally 0?
Result svcAcceptSession(Handle *session_handle, Handle port_handle); Result svcAcceptSession(Handle *session_handle, Handle port_handle);
Result svcReplyAndReceive(s32* index, const Handle* handles, s32 handleCount, Handle replyTarget, u64 timeout); Result svcReplyAndReceive(s32* index, const Handle* handles, s32 handleCount, Handle replyTarget, u64 timeout);

View File

@ -166,6 +166,11 @@ SVC_BEGIN svcGetInfo
ret ret
SVC_END SVC_END
SVC_BEGIN svcSetThreadActivity
svc 0x32
ret
SVC_END
SVC_BEGIN svcCreateSession SVC_BEGIN svcCreateSession
stp x0, x1, [sp, #-16]! stp x0, x1, [sp, #-16]!
svc 0x40 svc 0x40

View File

@ -124,3 +124,11 @@ Result threadClose(Thread* t) {
return rc; return rc;
} }
Result threadPause(Thread* t) {
return svcSetThreadActivity(t->handle, 1);
}
Result threadResume(Thread* t) {
return svcSetThreadActivity(t->handle, 0);
}