2014-07-28 20:58:47 +02:00
|
|
|
/*
|
|
|
|
svc.h _ Syscall wrappers.
|
|
|
|
*/
|
|
|
|
|
2014-01-18 23:18:03 +01:00
|
|
|
#ifndef SVC_H
|
|
|
|
#define SVC_H
|
|
|
|
|
2014-07-28 20:58:47 +02:00
|
|
|
typedef enum {
|
2014-08-21 22:59:42 +02:00
|
|
|
MEMOP_FREE =1, // Free heap
|
|
|
|
MEMOP_ALLOC=3, // Allocate heap
|
|
|
|
MEMOP_MAP =4, // Mirror mapping
|
|
|
|
MEMOP_UNMAP=5, // Mirror unmapping
|
|
|
|
MEMOP_PROT =6, // Change protection
|
|
|
|
|
|
|
|
MEMOP_FREE_LINEAR =0x10001, // Free linear heap
|
|
|
|
MEMOP_ALLOC_LINEAR=0x10003 // Allocate linear heap
|
2014-07-28 20:58:47 +02:00
|
|
|
} MemOp;
|
|
|
|
|
|
|
|
typedef enum {
|
2014-08-21 22:59:42 +02:00
|
|
|
MEMPERM_READ =1,
|
|
|
|
MEMPERM_WRITE =2,
|
|
|
|
MEMPERM_EXECUTE=4,
|
|
|
|
MEMPERM_MAX =0xFFFFFFFF //force 4-byte
|
2014-07-28 20:58:47 +02:00
|
|
|
} MemPerm;
|
|
|
|
|
2014-08-16 23:48:05 +02:00
|
|
|
u32* getThreadCommandBuffer(void);
|
|
|
|
|
2014-07-28 20:58:47 +02:00
|
|
|
s32 svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm);
|
2014-08-20 22:16:28 +02:00
|
|
|
void __attribute__((noreturn)) svcExitProcess();
|
2014-07-28 20:58:47 +02:00
|
|
|
s32 svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_top, s32 thread_priority, s32 processor_id);
|
2014-08-20 22:16:28 +02:00
|
|
|
void __attribute__((noreturn)) svcExitThread();
|
2014-07-28 20:58:47 +02:00
|
|
|
void svcSleepThread(s64 ns);
|
|
|
|
s32 svcCreateMutex(Handle* mutex, bool initially_locked);
|
|
|
|
s32 svcReleaseMutex(Handle handle);
|
|
|
|
s32 svcCreateEvent(Handle* event, u8 reset_type);
|
|
|
|
s32 svcSignalEvent(Handle handle);
|
|
|
|
s32 svcClearEvent(Handle handle);
|
|
|
|
s32 svcCreateMemoryBlock(Handle* memblock, u32 addr, u32 size, MemPerm my_perm, MemPerm other_perm);
|
|
|
|
s32 svcMapMemoryBlock(Handle memblock, u32 addr, MemPerm my_perm, MemPerm other_perm);
|
|
|
|
s32 svcUnmapMemoryBlock(Handle memblock, u32 addr);
|
|
|
|
s32 svcWaitSynchronization(Handle handle, s64 nanoseconds);
|
|
|
|
s32 svcWaitSynchronizationN(s32* out, Handle* handles, s32 handles_num, bool wait_all, s64 nanoseconds);
|
|
|
|
s32 svcCloseHandle(Handle handle);
|
2014-08-17 22:37:49 +02:00
|
|
|
s32 svcDuplicateHandle(Handle* out, Handle original);
|
2014-07-28 20:58:47 +02:00
|
|
|
u64 svcGetSystemTick();
|
|
|
|
s32 svcGetSystemInfo(s64* out, u32 type, s32 param);
|
|
|
|
s32 svcGetProcessInfo(s64* out, Handle process, u32 type);
|
|
|
|
s32 svcConnectToPort(volatile Handle* out, const char* portName);
|
|
|
|
s32 svcSendSyncRequest(Handle session);
|
|
|
|
s32 svcGetProcessId(u32 *out, Handle handle);
|
|
|
|
|
2014-01-18 23:18:03 +01:00
|
|
|
#endif
|