217a4e1bbb597d713e5c9252ca6242a9388ada89
[akaros.git] / kern / include / ros / syscall.h
1 #ifndef ROS_INCLUDE_SYSCALL_H
2 #define ROS_INCLUDE_SYSCALL_H
3
4 #include <arch/types.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_serial_write,
19         SYS_serial_read,
20         SYS_eth_read,
21         SYS_eth_write,
22         SYS_run_binary,
23         SYS_getpid,
24         SYS_proc_destroy,
25         SYS_shared_page_alloc,
26         SYS_shared_page_free,
27         SYS_yield,
28         SYS_proc_create,
29         SYS_proc_run,
30         SYS_frontend,           // forward a syscall to front-end machine
31
32         SYS_endofcalls //Should always be last
33 };
34 #define NSYSCALLS (SYS_endofcalls -1)
35 // syscall number starts at 1 and goes up to NSYSCALLS, without holes.
36 #define INVALID_SYSCALL(syscallno) ((syscallno) > NSYSCALLS)
37
38 /* For Buster Measurement Flags */
39 #define BUSTER_SHARED                   0x0001
40 #define BUSTER_STRIDED                  0x0002
41 #define BUSTER_LOCKED                   0x0004
42 #define BUSTER_PRINT_TICKS              0x0008
43 #define BUSTER_JUST_LOCKS               0x0010 // unimplemented
44
45 #define NUM_SYSCALL_ARGS 6
46 typedef struct syscall_req {
47         uint32_t num;
48         uint32_t flags;
49         uint32_t args[NUM_SYSCALL_ARGS];
50 } syscall_req_t;
51
52 typedef struct syscall_rsp {
53         int32_t retval;
54 } syscall_rsp_t;
55
56 // Generic Syscall Ring Buffer
57 #define SYSCALLRINGSIZE    PGSIZE
58 DEFINE_RING_TYPES_WITH_SIZE(syscall, syscall_req_t, syscall_rsp_t, SYSCALLRINGSIZE);
59
60 #endif /* !ROS_INCLUDE_SYSCALL_H */