Kernel messages infrastructure
[akaros.git] / kern / arch / sparc / trap.h
index ab57870..c1352e8 100644 (file)
@@ -1,32 +1,36 @@
 #ifndef ROS_INC_ARCH_TRAP_H
 #define ROS_INC_ARCH_TRAP_H
 
 #ifndef ROS_INC_ARCH_TRAP_H
 #define ROS_INC_ARCH_TRAP_H
 
-#define SIZEOF_TRAPFRAME_T     0xA8
-#define SIZEOF_ACTIVE_MESSAGE_T        0x18
+#define SIZEOF_TRAPFRAME_T     0xB0
+#define SIZEOF_KERNEL_MESSAGE_T        0x18
 
 #ifndef __ASSEMBLER__
 
 #include <ros/common.h>
 
 #ifndef __ASSEMBLER__
 
 #include <ros/common.h>
+#include <ros/arch/trapframe.h>
 
 
-typedef struct
+/* the struct trapframe and friends are in ros/arch/trapframe.h */
+
+void data_access_exception(trapframe_t* state);
+void real_fp_exception(trapframe_t* state, ancillary_state_t* astate);
+void address_unaligned(trapframe_t* state);
+void illegal_instruction(trapframe_t* state);
+
+void save_fp_state(ancillary_state_t* silly);
+void restore_fp_state(ancillary_state_t* silly);
+void emulate_fpu(trapframe_t* state, ancillary_state_t* astate);
+
+static inline void set_errno(trapframe_t* tf, uint32_t errno)
 {
 {
-       uint32_t gpr[32];
-       uint32_t psr;
-       uint32_t pc;
-       uint32_t npc;
-       uint32_t wim;
-       uint32_t tbr;
-       uint32_t y;
-       uint32_t fault_status;
-       uint32_t fault_addr;
-       uint64_t timestamp;
-} trapframe_t;
-
-typedef struct
+       tf->gpr[9] = errno;
+}
+
+/* TODO: Need to determine if the TF was in the kernel. */
+static inline bool in_kernel(struct trapframe *tf)
 {
 {
-       uint32_t fpr[32];
-       uint32_t fsr;
-} ancillary_state_t;
+       static_assert(0);
+       return LIES;
+}
 
 #endif /* !__ASSEMBLER__ */
 
 
 #endif /* !__ASSEMBLER__ */