Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / AcessNative / syscalls.h
1 /**
2  */
3 #ifndef _NATIVE_SYSCALLS_H_
4 #define _NATIVE_SYSCALLS_H_
5
6 #define SERVER_PORT     0xACE
7
8 #define SYSCALL_TRACE   1
9
10 #if SYSCALL_TRACE
11 #define SYSTRACE(str, x...)     do{ if(gbSyscallDebugEnabled)Debug(str, x); }while(0)
12 #else
13 #define SYSTRACE(...)   do{}while(0)
14 #endif
15
16 /*
17  * Request format
18  * 
19  * tRequestHeader       header
20  * tRequestValue        params[header.NParams]
21  * tRequestValue        retvals[header.NReturn]
22  * uint8_t      paramData[SUM(params[].Lengh)];
23  */
24
25 typedef struct {
26         uint32_t        pid;
27         uint32_t        key;
28 } tRequestAuthHdr;
29
30 typedef struct sRequestValue {
31         /// \see eArgumentTypes
32         uint16_t        Type;
33         uint16_t        Flags;
34         uint32_t        Length;
35 }       tRequestValue;
36
37 typedef struct sRequestHeader {
38         uint32_t        ClientID;
39         uint32_t        MessageLength;
40         uint16_t        CallID; //!< \see eSyscalls
41         uint16_t        NParams;
42         
43         tRequestValue   Params[];
44 } __attribute__((packed))       tRequestHeader;
45
46
47 enum eSyscalls {
48         #define _(n) n
49         #include "syscalls_list.h"
50         #undef _
51         N_SYSCALLS
52 };
53
54 #ifndef DONT_INCLUDE_SYSCALL_NAMES
55 static const char * casSYSCALL_NAMES[] = {
56         #define _(n) #n
57         #include "syscalls_list.h"
58         #undef _
59         "-"
60 };
61 #endif
62
63 enum eArgumentTypes {
64         ARG_TYPE_VOID,
65         ARG_TYPE_INT32,
66         ARG_TYPE_INT64,
67         ARG_TYPE_STRING,
68         ARG_TYPE_DATA
69 };
70 enum eArgumentFlags {
71         ARG_FLAG_RETURN = 0x40, // Pass back in the return message
72         ARG_FLAG_ZEROED = 0x80  // Not present in the message, just fill with zero
73 };
74
75 #endif

UCC git Repository :: git.ucc.asn.au