4 # define SIZEOF_HW_TRAPFRAME (36*8)
6 # define SIZEOF_HW_TRAPFRAME (36*4)
11 #ifndef ROS_KERN_TRAP_H
12 #error "Do not include include arch/trap.h directly"
15 #include <ros/trapframe.h>
16 #include <arch/arch.h>
18 /* Kernel message interrupt vector. ignored, for the most part */
19 #define I_KERNEL_MSG 255
20 #warning "make sure this poke vector is okay"
21 /* this is for an ipi that just wakes a core, but has no handler (for now) */
22 #define I_POKE_CORE 254
24 static inline bool in_kernel(struct hw_trapframe *hw_tf)
26 return hw_tf->sr & SR_PS;
29 static inline uintptr_t get_hwtf_pc(struct hw_trapframe *hw_tf)
33 //return hw_tf->tf_rip;
36 static inline uintptr_t get_hwtf_fp(struct hw_trapframe *hw_tf)
38 /* do you even have frame pointers? this is used for backtrace, but if you
39 * don't use FPs, we'll need to change up our parameters or something. */
42 //return hw_tf->tf_rbp;
45 static inline uintptr_t get_swtf_pc(struct sw_trapframe *sw_tf)
49 //return sw_tf->tf_rip;
52 static inline uintptr_t get_swtf_fp(struct sw_trapframe *sw_tf)
56 //return sw_tf->tf_rbp;
59 static inline uintptr_t get_vmtf_pc(struct vm_trapframe *vm_tf)
65 static inline uintptr_t get_vmtf_fp(struct vm_trapframe *vm_tf)
71 static inline void __attribute__((always_inline))
72 set_stack_pointer(uintptr_t sp)
74 asm volatile("move sp, %0" : : "r"(sp) : "memory");
77 static inline void __attribute__((always_inline))
78 set_frame_pointer(uintptr_t fp)
80 #warning "brho is just guessing here."
81 asm volatile("move fp, %0" : : "r"(fp) : "memory");
84 void handle_trap(struct hw_trapframe *hw_tf);
85 int emulate_fpu(struct hw_trapframe *hw_tf);
87 static inline bool arch_ctx_is_partial(struct user_context *ctx)
92 static inline void arch_finalize_ctx(struct user_context *ctx)