Make errno and return value work for async syscalls.
[akaros.git] / kern / arch / sparc / trap.h
1 #ifndef ROS_INC_ARCH_TRAP_H
2 #define ROS_INC_ARCH_TRAP_H
3
4 #define SIZEOF_TRAPFRAME_T      0xA8
5 #define SIZEOF_KERNEL_MESSAGE_T 0x18
6
7 #ifndef __ASSEMBLER__
8
9 #include <ros/common.h>
10 #include <ros/arch/trapframe.h>
11 #include <arch/sparc.h>
12
13 /* the struct trapframe and friends are in ros/arch/trapframe.h */
14
15 void data_access_exception(trapframe_t* state);
16 void real_fp_exception(trapframe_t* state, ancillary_state_t* astate);
17 void address_unaligned(trapframe_t* state);
18 void illegal_instruction(trapframe_t* state);
19
20 void save_fp_state(ancillary_state_t* silly);
21 void restore_fp_state(ancillary_state_t* silly);
22 void emulate_fpu(trapframe_t* state, ancillary_state_t* astate);
23
24 static inline void set_errno(trapframe_t* tf, uint32_t errno)
25 {
26         if (tf)
27                 tf->gpr[9] = errno;
28 }
29
30 static inline bool in_kernel(struct trapframe *tf)
31 {
32         return tf->psr & PSR_PS;
33 }
34
35 #endif /* !__ASSEMBLER__ */
36
37 #endif /* !ROS_INC_ARCH_TRAP_H */