| 1 | #ifndef _SYSLET_H_ |
| 2 | #define _SYSLET_H_ |
| 3 | |
| 4 | #include "kcompat.h" |
| 5 | |
| 6 | struct syslet_frame { |
| 7 | u64 ip; |
| 8 | u64 sp; |
| 9 | }; |
| 10 | |
| 11 | struct syslet_args { |
| 12 | u64 ring_ptr; |
| 13 | u64 caller_data; |
| 14 | struct syslet_frame frame; |
| 15 | }; |
| 16 | |
| 17 | struct syslet_completion { |
| 18 | u64 status; |
| 19 | u64 caller_data; |
| 20 | }; |
| 21 | |
| 22 | struct syslet_ring { |
| 23 | u32 kernel_head; |
| 24 | u32 user_tail; |
| 25 | u32 elements; |
| 26 | u32 wait_group; |
| 27 | struct syslet_completion comp[0]; |
| 28 | }; |
| 29 | |
| 30 | #ifdef __x86_64__ |
| 31 | #define __NR_syslet_ring_wait 287 |
| 32 | #elif defined __i386__ |
| 33 | #define __NR_syslet_ring_wait 326 |
| 34 | #endif |
| 35 | |
| 36 | #define ESYSLETPENDING 132 |
| 37 | |
| 38 | typedef void (*syslet_return_func_t)(void); |
| 39 | |
| 40 | static inline void fill_syslet_args(struct syslet_args *args, |
| 41 | struct syslet_ring *ring, uint64_t caller_data, |
| 42 | syslet_return_func_t func, void *stack) |
| 43 | { |
| 44 | args->ring_ptr = (u64)(unsigned long)ring; |
| 45 | args->caller_data = caller_data; |
| 46 | args->frame.ip = (u64)(unsigned long)func; |
| 47 | args->frame.sp = (u64)(unsigned long)stack; |
| 48 | } |
| 49 | |
| 50 | #endif |