My Project
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
svc.h
Go to the documentation of this file.
1 /*
2  svc.h _ Syscall wrappers.
3 */
4 
5 #ifndef SVC_H
6 #define SVC_H
7 
8 typedef enum {
9  MEMOP_FREE =1, // Free heap
10  MEMOP_ALLOC=3, // Allocate heap
11  MEMOP_MAP =4, // Mirror mapping
12  MEMOP_UNMAP=5, // Mirror unmapping
13  MEMOP_PROT =6, // Change protection
14 
15  MEMOP_FREE_LINEAR =0x10001, // Free linear heap
16  MEMOP_ALLOC_LINEAR=0x10003 // Allocate linear heap
17 } MemOp;
18 
19 typedef enum {
23  MEMPERM_MAX =0xFFFFFFFF //force 4-byte
24 } MemPerm;
25 
26 typedef struct {
31 } MemInfo;
32 
33 typedef struct {
35 } PageInfo;
36 
37 typedef enum {
44 
45 
47 
48 s32 svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm);
49 s32 svcQueryMemory(MemInfo* info, PageInfo* out, u32 addr);
50 void __attribute__((noreturn)) svcExitProcess();
51 s32 svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_top, s32 thread_priority, s32 processor_id);
52 void __attribute__((noreturn)) svcExitThread();
53 void svcSleepThread(s64 ns);
54 s32 svcCreateMutex(Handle* mutex, bool initially_locked);
55 s32 svcReleaseMutex(Handle handle);
56 s32 svcCreateEvent(Handle* event, u8 reset_type);
57 s32 svcSignalEvent(Handle handle);
58 s32 svcClearEvent(Handle handle);
59 s32 svcCreateTimer(Handle* timer, u8 reset_type);
60 s32 svcSetTimer(Handle timer, s64 initial, s64 interval);
62 s32 svcClearTimer(Handle timer);
63 s32 svcCreateMemoryBlock(Handle* memblock, u32 addr, u32 size, MemPerm my_perm, MemPerm other_perm);
64 s32 svcMapMemoryBlock(Handle memblock, u32 addr, MemPerm my_perm, MemPerm other_perm);
65 s32 svcUnmapMemoryBlock(Handle memblock, u32 addr);
67 s32 svcArbitrateAddress(Handle arbiter, u32 addr, ArbitrationType type, s32 value, s64 nanoseconds);
68 s32 svcWaitSynchronization(Handle handle, s64 nanoseconds);
69 s32 svcWaitSynchronizationN(s32* out, Handle* handles, s32 handles_num, bool wait_all, s64 nanoseconds);
70 s32 svcCloseHandle(Handle handle);
71 s32 svcDuplicateHandle(Handle* out, Handle original);
73 s32 svcGetSystemInfo(s64* out, u32 type, s32 param);
74 s32 svcGetProcessInfo(s64* out, Handle process, u32 type);
75 s32 svcConnectToPort(volatile Handle* out, const char* portName);
77 s32 svcGetProcessId(u32 *out, Handle handle);
78 s32 svcOutputDebugString(const char* str, int length);
79 
80 #endif
void svcSleepThread(s64 ns)
u32 flags
Definition: svc.h:34
s32 svcClearEvent(Handle handle)
s32 svcClearTimer(Handle timer)
u32 size
Definition: svc.h:28
Definition: svc.h:9
s32 svcCloseHandle(Handle handle)
s32 svcWaitSynchronization(Handle handle, s64 nanoseconds)
s32 svcCreateThread(Handle *thread, ThreadFunc entrypoint, u32 arg, u32 *stack_top, s32 thread_priority, s32 processor_id)
void(* ThreadFunc)(u32)
Definition: types.h:43
s32 svcCreateAddressArbiter(Handle *arbiter)
ArbitrationType
Definition: svc.h:37
u32 perm
Definition: svc.h:29
u32 Handle
Definition: types.h:41
s32 svcUnmapMemoryBlock(Handle memblock, u32 addr)
s32 svcOutputDebugString(const char *str, int length)
MemPerm
Definition: svc.h:19
u32 * getThreadCommandBuffer(void)
uint8_t u8
Definition: types.h:21
void __attribute__((noreturn)) svcExitProcess()
Definition: initSystem.c:27
uint64_t u64
Definition: types.h:24
u64 svcGetSystemTick()
u32 base_addr
Definition: svc.h:27
uint32_t u32
Definition: types.h:23
s32 svcGetProcessInfo(s64 *out, Handle process, u32 type)
s32 svcQueryMemory(MemInfo *info, PageInfo *out, u32 addr)
int32_t s32
Definition: types.h:28
Definition: svc.h:13
Definition: svc.h:26
s32 svcCreateTimer(Handle *timer, u8 reset_type)
Definition: svc.h:33
s32 svcControlMemory(u32 *addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm)
MemOp
Definition: svc.h:8
s32 svcGetSystemInfo(s64 *out, u32 type, s32 param)
s32 svcConnectToPort(volatile Handle *out, const char *portName)
s32 svcCreateEvent(Handle *event, u8 reset_type)
int64_t s64
Definition: types.h:29
s32 svcMapMemoryBlock(Handle memblock, u32 addr, MemPerm my_perm, MemPerm other_perm)
s32 svcCreateMutex(Handle *mutex, bool initially_locked)
s32 svcSendSyncRequest(Handle session)
s32 svcArbitrateAddress(Handle arbiter, u32 addr, ArbitrationType type, s32 value, s64 nanoseconds)
u32 state
Definition: svc.h:30
Definition: svc.h:11
s32 svcReleaseMutex(Handle handle)
s32 svcSetTimer(Handle timer, s64 initial, s64 interval)
s32 svcSignalEvent(Handle handle)
s32 svcGetProcessId(u32 *out, Handle handle)
s32 svcWaitSynchronizationN(s32 *out, Handle *handles, s32 handles_num, bool wait_all, s64 nanoseconds)
s32 svcCancelTimer(Handle timer)
s32 svcDuplicateHandle(Handle *out, Handle original)
s32 svcCreateMemoryBlock(Handle *memblock, u32 addr, u32 size, MemPerm my_perm, MemPerm other_perm)