93eb37825f9be16da9319c31ee9948546263c5ca
[akaros.git] / kern / include / ros / syscall.h
1 #ifndef ROS_INCLUDE_SYSCALL_H
2 #define ROS_INCLUDE_SYSCALL_H
3
4 /* system call numbers.  need to #def them for use in assembly. */
5 #define SYS_null                                         1
6 #define SYS_cache_buster                         2
7 #define SYS_cache_invalidate             3
8 #define SYS_reboot                                       4
9 #define SYS_cputs                                        5
10 #define SYS_cgetc                                        6
11 #define SYS_getcpuid                             7
12 #define SYS_getvcoreid                           8
13 #define SYS_getpid                                       9
14 #define SYS_proc_create                         10
15 #define SYS_proc_run                            11
16 #define SYS_proc_destroy                        12
17 #define SYS_yield                                       13
18 #define SYS_run_binary                          14
19 #define SYS_fork                                        15
20 #define SYS_exec                                        16
21 #define SYS_trywait                                     17
22 #define SYS_mmap                                        18
23 #define SYS_brk                                         19
24 #define SYS_shared_page_alloc           20
25 #define SYS_shared_page_free            21
26 /*
27 #define SYS_mprotect
28 #define SYS_mremap
29 #define SYS_mincore // can read page tables instead
30 #define SYS_madvise
31 #define SYS_mlock
32 #define SYS_msync
33 */
34 #define SYS_resource_req                        22
35 /* Platform specific syscalls */
36 #define SYS_serial_read                         23
37 #define SYS_serial_write                        24
38 #define SYS_eth_read                            25
39 #define SYS_eth_write                           26
40 #define SYS_frontend                            27
41
42 /* For Buster Measurement Flags */
43 #define BUSTER_SHARED                   0x0001
44 #define BUSTER_STRIDED                  0x0002
45 #define BUSTER_LOCKED                   0x0004
46 #define BUSTER_PRINT_TICKS              0x0008
47 #define BUSTER_JUST_LOCKS               0x0010 // unimplemented
48
49 #ifndef __ASSEMBLER__
50
51 #include <ros/common.h>
52 #include <ros/ring_buffer.h>
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 /* __ASSEMBLER__ */
71 #endif /* !ROS_INCLUDE_SYSCALL_H */