libnx/nx/include/switch/svc.h
2017-09-09 01:42:33 +02:00

39 lines
890 B
C

/**
* @file svc.h
* @brief Syscall wrappers.
*/
#pragma once
#include "types.h"
/// Pseudo handle for the current process
#define CUR_PROCESS_HANDLE 0xFFFF8001
/// Pseudo handle for the current thread
#define CUR_THREAD_HANDLE 0xFFFF8000
/**
* @brief Gets the thread local storage buffer.
* @return The thread local storage buffer.
*/
static inline void* getThreadLocalStorage(void)
{
void* ret;
__asm__ ("mrs %x[data], tpidrro_el0" : [data] "=r" (ret));
return ret;
}
/**
* @brief Gets the thread command buffer.
* @return The thread command buffer.
*/
static inline u32* getThreadCommandBuffer(void)
{
return (u32*)getThreadLocalStorage();
}
Result svcConnectToNamedPort();
Result svcReplyAndReceive(s32* index, const Handle* handles, s32 handleCount, Handle replyTarget, u64 timeout);
Result svcManageNamedPort(Handle* portServer, const char* name, s32 maxSessions);