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