Kernel messages infrastructure
[akaros.git] / kern / arch / sparc / trap.h
index 3aeee38..c1352e8 100644 (file)
@@ -2,33 +2,14 @@
 #define ROS_INC_ARCH_TRAP_H
 
 #define SIZEOF_TRAPFRAME_T     0xB0
-#define SIZEOF_ACTIVE_MESSAGE_T        0x18
+#define SIZEOF_KERNEL_MESSAGE_T        0x18
 
 #ifndef __ASSEMBLER__
 
 #include <ros/common.h>
+#include <ros/arch/trapframe.h>
 
-typedef struct
-{
-       uint32_t gpr[32] __attribute__((aligned (8)));
-       uint32_t psr;
-       uint32_t pc;
-       uint32_t npc;
-       uint32_t wim;
-       uint32_t tbr;
-       uint32_t y;
-       uint32_t asr13;
-       uint32_t pc_insn;
-       uint32_t fault_status;
-       uint32_t fault_addr;
-       uint64_t timestamp;
-} trapframe_t;
-
-typedef struct
-{
-       uint32_t fpr[32] __attribute__((aligned (8)));
-       uint32_t fsr;
-} ancillary_state_t;
+/* 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);
@@ -44,6 +25,13 @@ static inline void set_errno(trapframe_t* tf, uint32_t errno)
        tf->gpr[9] = errno;
 }
 
+/* TODO: Need to determine if the TF was in the kernel. */
+static inline bool in_kernel(struct trapframe *tf)
+{
+       static_assert(0);
+       return LIES;
+}
+
 #endif /* !__ASSEMBLER__ */
 
 #endif /* !ROS_INC_ARCH_TRAP_H */