aa64: finalise context switch, page fault handler and syscall
[lunaix-os.git] / lunaix-os / arch / aarch64 / includes / asm / hart.h
index fa1f4bfd165f7b30322d84bc398c9b98e27ff13c..52571e67a07664f5aee5379a8834c51e7655ed39 100644 (file)
@@ -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;
 }
 
@@ -79,8 +81,10 @@ hart_sp(struct hart_state* hstate)
 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