Decoupling Architectural-specific Code (#35)
[lunaix-os.git] / lunaix-os / kernel / debug / failsafe.c
index 5fdbc5d47676471ebc67f8b77c2703d52a817929..7c1ecfffbcfd7b15a786de6e9698e1eab49f23bf 100644 (file)
@@ -9,16 +9,26 @@ LOG_MODULE("NMM")
 void
 do_failsafe_unrecoverable(ptr_t frame_link, ptr_t stack_link)
 {
+    ERROR("------- [cut here] ------- \n");
     ERROR("diagnositic mode");
-
     ERROR("check: init stack: %s", 
             check_bootstack_sanity() ? "ok" : "smashing");
 
     // TODO ...check other invariants
+    if (current_thread && current_thread->hstate)
+    {
+        struct hart_state* hstate = current_thread->hstate;
+    
+        trace_print_transition_full(hstate);
+        ERROR("++++++");
 
-    ERROR("non recoverable: Nightmare Moon arrival.");
+        trace_dump_state(hstate);
+        ERROR("++++++");
+    }
 
     trace_printstack();
-
+    ERROR("++++++");
+    
+    ERROR("non recoverable: Nightmare Moon arrival.");
     spin();
 }
\ No newline at end of file