X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/32b9a6d76790c73d3d2d36d9081a2581cc65d184..28c176b668c841a3b7fb093faccf0efa39257603:/lunaix-os/arch/i386/includes/sys/hart.h?ds=sidebyside diff --git a/lunaix-os/arch/i386/includes/sys/hart.h b/lunaix-os/arch/i386/includes/sys/hart.h deleted file mode 100644 index 9a6381a..0000000 --- a/lunaix-os/arch/i386/includes/sys/hart.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef __LUNAIX_ARCH_HART_H -#define __LUNAIX_ARCH_HART_H - -#include "vectors.h" - -#ifndef __ASM__ -#include -#include - -struct exec_param; - -struct regcontext -{ - reg_t eax; - reg_t ebx; - reg_t ecx; - reg_t edx; - reg_t edi; - reg_t ebp; - reg_t esi; - reg_t ds; - reg_t es; - reg_t fs; - reg_t gs; -} compact; - -struct hart_state -{ - unsigned int depth; - struct regcontext registers; - union - { - reg_t esp; - volatile struct exec_param* execp; - }; -} compact; - -struct exec_param -{ - struct hart_state* parent_state; - reg_t vector; - reg_t err_code; - reg_t eip; - reg_t cs; - reg_t eflags; - reg_t esp; - reg_t ss; -} compact; - - -static inline void -hart_flow_redirect(struct hart_state* hstate, ptr_t pc, ptr_t sp) -{ - hstate->execp->eip = pc; - hstate->execp->esp = sp; -} - -static inline ptr_t -hart_pc(struct hart_state* hstate) -{ - return hstate->execp->eip; -} - -static inline ptr_t -hart_sp(struct hart_state* hstate) -{ - return hstate->execp->esp; -} - -static inline bool -kernel_context(struct hart_state* hstate) -{ - return !((hstate->execp->cs) & 0b11); -} - -static inline ptr_t -hart_stack_frame(struct hart_state* hstate) -{ - return hstate->registers.ebp; -} - -static inline int -hart_vector_stamp(struct hart_state* hstate) { - return hstate->execp->vector; -} - -static inline unsigned int -hart_ecause(struct hart_state* hstate) { - return hstate->execp->err_code; -} - -static inline struct hart_state* -hart_parent_state(struct hart_state* hstate) -{ - return hstate->execp->parent_state; -} - -static inline void -hart_push_state(struct hart_state* p_hstate, struct hart_state* hstate) -{ - hstate->execp->parent_state = p_hstate; -} - -#endif - -#endif /* __LUNAIX_ARCH_HART_H */