X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/6b995c8cb722d10aaacba52999f5c43e43daeb85..bb5ae5c85c0812c52e8d53187f2c6b0ee9525c8c:/lunaix-os/arch/aarch64/includes/asm/hart.h diff --git a/lunaix-os/arch/aarch64/includes/asm/hart.h b/lunaix-os/arch/aarch64/includes/asm/hart.h index ae84ddd..52571e6 100644 --- a/lunaix-os/arch/aarch64/includes/asm/hart.h +++ b/lunaix-os/arch/aarch64/includes/asm/hart.h @@ -15,7 +15,7 @@ struct regcontext union { reg_t x[31]; struct { - reg_t x[29]; + reg_t x_[29]; reg_t fp; reg_t lr; }; @@ -29,7 +29,7 @@ struct exec_param reg_t link; struct { reg_t sp_el0; - reg_t sp_el1; + reg_t rsvd; }; reg_t syndrome; @@ -43,12 +43,14 @@ struct hart_state } compact align(16); static inline int -hart_vector_stamp(struct hart_state* hstate) { +hart_vector_stamp(struct hart_state* hstate) +{ return BITS_GET(hstate->execp.syndrome, SYNDROME_ETYPE); } static inline unsigned int -hart_ecause(struct hart_state* hstate) { +hart_ecause(struct hart_state* hstate) +{ return hstate->execp.syndrome; } @@ -73,17 +75,16 @@ hart_pc(struct hart_state* hstate) static inline ptr_t hart_sp(struct hart_state* hstate) { - if (spsr_from_el0(hstate->execp.spsr)) { - return hstate->execp.sp_el0; - } - return hstate->execp.sp_el1; + return __ptr(&hstate[-1]); } static inline bool kernel_context(struct hart_state* hstate) { - // TODO - return false; + reg_t spsr; + + spsr = hstate->execp.spsr; + return !spsr_from_el0(spsr); } static inline ptr_t