Added fork, exec, wait
[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_cputs                                        4
9 #define SYS_cgetc                                        5
10 #define SYS_getcpuid                             6
11 #define SYS_getpid                                       7
12 #define SYS_proc_destroy                         8
13 #define SYS_shared_page_alloc            9
14 #define SYS_shared_page_free            10
15 #define SYS_yield                                       11
16 #define SYS_proc_create                         12
17 #define SYS_proc_run                            13
18 #define SYS_mmap                                        14
19 #define SYS_brk                                         15
20 /*
21 #define SYS_mprotect
22 #define SYS_mremap
23 #define SYS_mincore // can read page tables instead
24 #define SYS_madvise
25 #define SYS_mlock
26 #define SYS_msync
27 */
28 #define SYS_resource_req                        16
29 /* Read and write buffers over the serial port */
30 #define SYS_serial_write                        17
31 #define SYS_serial_read                         18
32 /* The next 3 syscalls go with the experimental network driver. These syscalls
33  * are used by newlib_backend / our remote binary loader to pull data from /
34  * put data into a buffer managed by the network driver.  These should go away
35  * as things mature. */
36 #define SYS_eth_read                            19
37 #define SYS_eth_write                           20
38 #define SYS_run_binary                          21
39 // forward a syscall to front-end machine
40 #define SYS_frontend                            22
41 #define SYS_getvcoreid                          23
42 #define SYS_reboot                              24
43 #define SYS_fork                                25
44 #define SYS_exec                                26
45 #define SYS_trywait                             27
46 // Keep this in sync with the last syscall number
47 #define NSYSCALLS                                       27
48 // syscall number starts at 1 and goes up to NSYSCALLS, without holes.
49 #define INVALID_SYSCALL(syscallno) ((syscallno) > NSYSCALLS)
50
51 /* For Buster Measurement Flags */
52 #define BUSTER_SHARED                   0x0001
53 #define BUSTER_STRIDED                  0x0002
54 #define BUSTER_LOCKED                   0x0004
55 #define BUSTER_PRINT_TICKS              0x0008
56 #define BUSTER_JUST_LOCKS               0x0010 // unimplemented
57
58 #ifndef __ASSEMBLER__
59
60 #include <ros/common.h>
61 #include <ros/ring_buffer.h>
62
63 #define NUM_SYSCALL_ARGS 6
64 typedef struct syscall_req {
65         uint32_t num;
66         uint32_t flags;
67         uint32_t args[NUM_SYSCALL_ARGS];
68 } syscall_req_t;
69
70 typedef struct syscall_rsp {
71         int32_t retval;
72 } syscall_rsp_t;
73
74 // Generic Syscall Ring Buffer
75 #define SYSCALLRINGSIZE    PGSIZE
76 //DEFINE_RING_TYPES_WITH_SIZE(syscall, syscall_req_t, syscall_rsp_t, SYSCALLRINGSIZE);
77 DEFINE_RING_TYPES(syscall, syscall_req_t, syscall_rsp_t);
78
79 #endif /* __ASSEMBLER__ */
80 #endif /* !ROS_INCLUDE_SYSCALL_H */