1 #ifndef __LUNAIX_ARCH_HART_H
2 #define __LUNAIX_ARCH_HART_H
5 #include <lunaix/types.h>
6 #include <lunaix/bits.h>
7 #include <asm/aa64_spsr.h>
9 #define SYNDROME_ETYPE BITS(63, 56)
27 struct hart_state* parent_state;
41 struct regcontext registers;
42 struct exec_param execp;
46 hart_vector_stamp(struct hart_state* hstate) {
47 return BITS_GET(hstate->execp.syndrome, SYNDROME_ETYPE);
50 static inline unsigned int
51 hart_ecause(struct hart_state* hstate) {
52 return hstate->execp.syndrome;
55 static inline struct hart_state*
56 hart_parent_state(struct hart_state* hstate)
58 return hstate->execp.parent_state;
62 hart_push_state(struct hart_state* p_hstate, struct hart_state* hstate)
64 hstate->execp.parent_state = p_hstate;
68 hart_pc(struct hart_state* hstate)
70 return hstate->execp.link;
74 hart_sp(struct hart_state* hstate)
76 if (spsr_from_el0(hstate->execp.spsr)) {
77 return hstate->execp.sp_el0;
79 return hstate->execp.sp_el1;
83 kernel_context(struct hart_state* hstate)
90 hart_stack_frame(struct hart_state* hstate)
92 return hstate->registers.fp;
97 #endif /* __LUNAIX_ARCH_HART_H */