1 #ifndef __LUNAIX_ARCH_HART_H
2 #define __LUNAIX_ARCH_HART_H
7 #include <lunaix/compiler.h>
13 #ifdef CONFIG_ARCH_X86_64
35 struct hart_state* parent_state;
64 struct hart_state* parent_state;
80 struct regcontext registers;
84 volatile struct exec_param* execp;
89 hart_vector_stamp(struct hart_state* hstate) {
90 return hstate->execp->vector;
93 static inline unsigned int
94 hart_ecause(struct hart_state* hstate) {
95 return hstate->execp->err_code;
98 static inline struct hart_state*
99 hart_parent_state(struct hart_state* hstate)
101 return hstate->execp->parent_state;
105 hart_push_state(struct hart_state* p_hstate, struct hart_state* hstate)
107 hstate->execp->parent_state = p_hstate;
111 #ifdef CONFIG_ARCH_X86_64
113 hart_pc(struct hart_state* hstate)
115 return hstate->execp->rip;
119 hart_sp(struct hart_state* hstate)
121 return hstate->execp->rsp;
125 kernel_context(struct hart_state* hstate)
127 return !((hstate->execp->cs) & 0b11);
131 hart_stack_frame(struct hart_state* hstate)
133 return hstate->registers.rbp;
138 hart_pc(struct hart_state* hstate)
140 return hstate->execp->eip;
144 hart_sp(struct hart_state* hstate)
146 return hstate->execp->esp;
150 kernel_context(struct hart_state* hstate)
152 return !((hstate->execp->cs) & 0b11);
156 hart_stack_frame(struct hart_state* hstate)
158 return hstate->registers.ebp;
165 #endif /* __LUNAIX_ARCH_HART_H */