Compiles with GCC
[akaros.git] / kern / include / ros / syscall.h
1 #ifndef ROS_INCLUDE_SYSCALL_H
2 #define ROS_INCLUDE_SYSCALL_H
3
4 #include <ros/common.h>
5 #include <ros/ring_buffer.h>
6
7 /* system call numbers */
8 enum
9 {
10         SYS_begofcalls, //Should always be first
11
12         SYS_null,
13         SYS_cache_buster,
14         SYS_cache_invalidate,
15         SYS_cputs,
16         SYS_cgetc,
17         SYS_getcpuid,
18         SYS_getpid,
19         SYS_proc_destroy,
20         SYS_shared_page_alloc,
21         SYS_shared_page_free,
22         SYS_yield,
23         SYS_proc_create,
24         SYS_proc_run,
25
26         SYS_mmap,
27         SYS_brk,
28         /*
29         SYS_mprotect,
30         SYS_mremap,
31         SYS_mincore, // can read page tables instead
32         SYS_madvise,
33         SYS_mlock,
34         SYS_msync,
35         */
36
37         SYS_serial_write,
38         SYS_serial_read,
39         SYS_frontend,           // forward a syscall to front-end machine
40
41         SYS_endofcalls //Should always be last
42 };
43 #define NSYSCALLS (SYS_endofcalls -1)
44 // syscall number starts at 1 and goes up to NSYSCALLS, without holes.
45 #define INVALID_SYSCALL(syscallno) ((syscallno) > NSYSCALLS)
46
47 /* For Buster Measurement Flags */
48 #define BUSTER_SHARED                   0x0001
49 #define BUSTER_STRIDED                  0x0002
50 #define BUSTER_LOCKED                   0x0004
51 #define BUSTER_PRINT_TICKS              0x0008
52 #define BUSTER_JUST_LOCKS               0x0010 // unimplemented
53
54 #define NUM_SYSCALL_ARGS 6
55 typedef struct syscall_req {
56         uint32_t num;
57         uint32_t flags;
58         uint32_t args[NUM_SYSCALL_ARGS];
59 } syscall_req_t;
60
61 typedef struct syscall_rsp {
62         int32_t retval;
63 } syscall_rsp_t;
64
65 // Generic Syscall Ring Buffer
66 #define SYSCALLRINGSIZE    PGSIZE
67 //DEFINE_RING_TYPES_WITH_SIZE(syscall, syscall_req_t, syscall_rsp_t, SYSCALLRINGSIZE);
68 DEFINE_RING_TYPES(syscall, syscall_req_t, syscall_rsp_t);
69
70 #endif /* !ROS_INCLUDE_SYSCALL_H */