Make errno and return value work for async syscalls.
[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         int                             pid;
24         uint32_t                coreid;
25         uint32_t                vcoreid;
26 };
27
28 struct sys_return {
29         uint32_t *returnloc;
30         uint32_t *errno_loc;
31 };
32
33 intreg_t syscall(struct proc *p, uintreg_t num, uintreg_t a1, uintreg_t a2,
34                  uintreg_t a3, uintreg_t a4, uintreg_t a5);
35
36 /* Tracing functions */
37 void systrace_start(bool silent);
38 void systrace_stop(void);
39 int systrace_reg(bool all, struct proc *p);
40 int systrace_dereg(bool all, struct proc *p);
41 void systrace_print(bool all, struct proc *p);
42 void systrace_clear_buffer(void);
43
44 #endif /* !ROS_KERN_SYSCALL_H */