All local system calls are asynchronous (XCC)
[akaros.git] / kern / include / syscall.h
1 #ifndef ROS_KERN_SYSCALL_H
2 #define ROS_KERN_SYSCALL_H
3 #ifndef ROS_KERNEL
4 # error "This is ROS kernel header; user programs should not #include it"
5 #endif
6
7 #include <ros/common.h>
8 #include <process.h>
9
10 #define SYSTRACE_ON                                     0x01
11 #define SYSTRACE_LOUD                           0x02
12 #define SYSTRACE_ALLPROC                        0x04
13
14 #define MAX_NUM_TRACED                          10
15 #define MAX_SYSTRACES                           1024
16
17 #define MAX_ASRC_BATCH                          10
18
19 /* Consider cache aligning this */
20 struct systrace_record {
21         uint64_t                timestamp;
22         uintreg_t               syscallno;
23         uintreg_t               arg1;
24         uintreg_t               arg2;
25         uintreg_t               arg3;
26         uintreg_t               arg4;
27         uintreg_t               arg5;
28         int                             pid;
29         uint32_t                coreid;
30         uint32_t                vcoreid;
31 };
32
33 /* Syscall table */
34 typedef intreg_t (*syscall_t)(struct proc *, uintreg_t, uintreg_t, uintreg_t,
35                               uintreg_t, uintreg_t);
36 struct sys_table_entry {
37         syscall_t call;
38         char *name;
39 };
40 const static struct sys_table_entry syscall_table[];
41 /* Syscall invocation */
42 void prep_syscalls(struct proc *p, struct syscall *sysc, unsigned int nr_calls);
43 intreg_t syscall(struct proc *p, uintreg_t num, uintreg_t a1, uintreg_t a2,
44                  uintreg_t a3, uintreg_t a4, uintreg_t a5);
45 void run_local_syscall(void);
46 void set_errno(int errno);
47
48 /* Tracing functions */
49 void systrace_start(bool silent);
50 void systrace_stop(void);
51 int systrace_reg(bool all, struct proc *p);
52 int systrace_dereg(bool all, struct proc *p);
53 void systrace_print(bool all, struct proc *p);
54 void systrace_clear_buffer(void);
55
56 #endif /* !ROS_KERN_SYSCALL_H */