128ff435c64d893fc4ba1a88fff2793fc5df203a
[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_shared_page_alloc,
21         SYS_shared_page_free,
22         SYS_getenvid,
23         SYS_env_destroy,
24         SYS_yield,
25         SYS_proc_create,
26         SYS_proc_run,
27
28         SYS_endofcalls //Should always be last
29 };
30 #define NSYSCALLS (SYS_endofcalls -1)
31 // syscall number starts at 1 and goes up to NSYSCALLS, without holes.
32 #define INVALID_SYSCALL(syscallno) ((syscallno) > NSYSCALLS)
33
34 /* For Buster Measurement Flags */
35 #define BUSTER_SHARED                   0x0001
36 #define BUSTER_STRIDED                  0x0002
37 #define BUSTER_LOCKED                   0x0004
38 #define BUSTER_PRINT_TICKS              0x0008
39 #define BUSTER_JUST_LOCKS               0x0010 // unimplemented
40
41 #define NUM_SYSCALL_ARGS 6
42 typedef struct syscall_req {
43         uint32_t num;
44         uint32_t flags;
45         uint32_t args[NUM_SYSCALL_ARGS];
46 } syscall_req_t;
47
48 typedef struct syscall_rsp {
49         int32_t retval;
50 } syscall_rsp_t;
51
52 // Generic Syscall Ring Buffer
53 DEFINE_RING_TYPES(syscall, syscall_req_t, syscall_rsp_t);
54
55 #endif /* !ROS_INCLUDE_SYSCALL_H */