print_user_ctx helper
authorBarret Rhoden <brho@cs.berkeley.edu>
Sat, 8 Feb 2014 21:59:04 +0000 (13:59 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Sun, 9 Feb 2014 07:22:59 +0000 (23:22 -0800)
Debugging.

kern/arch/x86/trap.c
kern/include/trap.h
kern/src/trap.c

index ef408eb..bd1da28 100644 (file)
@@ -251,6 +251,7 @@ static void trap_dispatch(struct hw_trapframe *hw_tf)
                        break;
                case T_ILLOP:
                {
+                       /* TODO: this can PF if there is a concurrent unmap/PM removal. */
                        uintptr_t ip = x86_get_ip_hw(hw_tf);
                        pcpui = &per_cpu_info[core_id()];
                        pcpui->__lock_checking_enabled--;               /* for print debugging */
index 2a91f78..4f3d223 100644 (file)
@@ -22,6 +22,7 @@ void register_raw_irq(unsigned int vector, isr_t handler, void *data);
 void unregister_raw_irq(unsigned int vector, isr_t handler, void *data);
 int register_dev_irq(int irq, isr_t handler, void *irq_arg);
 void print_trapframe(struct hw_trapframe *hw_tf);
+void print_user_ctx(struct user_context *ctx);
 void page_fault_handler(struct hw_trapframe *hw_tf);
 /* Generic per-core timer interrupt handler.  set_percore_timer() will fire the
  * timer_interrupt(). */
index 67266d6..c8714e7 100644 (file)
@@ -226,3 +226,13 @@ void print_kctx_depths(const char *str)
        printk("%s: Core %d, irq depth %d, ktrap depth %d, irqon %d\n", str, coreid,
               irq_depth(pcpui), ktrap_depth(pcpui), irq_is_enabled());
 }
+
+void print_user_ctx(struct user_context *ctx)
+{
+       if (ctx->type == ROS_SW_CTX)
+               print_swtrapframe(&ctx->tf.sw_tf);
+       else if (ctx->type == ROS_HW_CTX)
+               print_trapframe(&ctx->tf.hw_tf);
+       else
+               printk("Bad TF %p type %d!\n", ctx, ctx->type);
+}