parlib: Improve panic() and assert()
[akaros.git] / kern / arch / x86 / trap.c
index aa73e6e..6b365d5 100644 (file)
@@ -553,9 +553,10 @@ static void trap_dispatch(struct hw_trapframe *hw_tf)
        // Handle processor exceptions.
        switch(hw_tf->tf_trapno) {
                case T_BRKPT:
-                       enable_irq();
-                       monitor(hw_tf);
-                       disable_irq();
+                       if (!in_kernel(hw_tf))
+                               backtrace_user_ctx(current, current_ctx);
+                       else
+                               monitor(hw_tf);
                        handled = TRUE;
                        break;
                case T_ILLOP:
@@ -883,6 +884,9 @@ static bool handle_vmexit_cpuid(struct vm_trapframe *tf)
 {
        uint32_t eax, ebx, ecx, edx;
 
+       if (tf->tf_rax == 0x0B)
+               return FALSE;   // Handle in userspace.
+
        cpuid(tf->tf_rax, tf->tf_rcx, &eax, &ebx, &ecx, &edx);
        switch (tf->tf_rax) {
                case 0x01: