xen-vtx-unstable

annotate xen/arch/x86/x86_64/traps.c @ 3602:9a9c5a491401

bitkeeper revision 1.1159.235.1 (42000d3dwcPyT8aY4VIPYGCfCAJuQQ)

More x86/64. Status: traps.c now included in the build, but actual building
of IDT doesn't happen, and we need some sort of entry.S. More page-table
building required so that arch_init_memory() can work. And there is something
odd with MP-table parsing; I currently suspect that __init sections are
causing problems.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@viper.(none)
date Tue Feb 01 23:14:05 2005 +0000 (2005-02-01)
parents
children e6af5d8f8b39
rev   line source
kaf24@3602 1
kaf24@3602 2 #include <xen/config.h>
kaf24@3602 3 #include <xen/init.h>
kaf24@3602 4 #include <xen/sched.h>
kaf24@3602 5 #include <xen/lib.h>
kaf24@3602 6 #include <xen/errno.h>
kaf24@3602 7 #include <xen/mm.h>
kaf24@3602 8 #include <xen/irq.h>
kaf24@3602 9
kaf24@3602 10 static int kstack_depth_to_print = 8*20;
kaf24@3602 11
kaf24@3602 12 static inline int kernel_text_address(unsigned long addr)
kaf24@3602 13 {
kaf24@3602 14 if (addr >= (unsigned long) &_stext &&
kaf24@3602 15 addr <= (unsigned long) &_etext)
kaf24@3602 16 return 1;
kaf24@3602 17 return 0;
kaf24@3602 18
kaf24@3602 19 }
kaf24@3602 20
kaf24@3602 21 void show_guest_stack(void)
kaf24@3602 22 {
kaf24@3602 23 int i;
kaf24@3602 24 execution_context_t *ec = get_execution_context();
kaf24@3602 25 unsigned long *stack = (unsigned long *)ec->rsp;
kaf24@3602 26 printk("Guest RIP is %lx\n", ec->rip);
kaf24@3602 27
kaf24@3602 28 for ( i = 0; i < kstack_depth_to_print; i++ )
kaf24@3602 29 {
kaf24@3602 30 if ( ((long)stack & (STACK_SIZE-1)) == 0 )
kaf24@3602 31 break;
kaf24@3602 32 if ( i && ((i % 8) == 0) )
kaf24@3602 33 printk("\n ");
kaf24@3602 34 printk("%08lx ", *stack++);
kaf24@3602 35 }
kaf24@3602 36 printk("\n");
kaf24@3602 37
kaf24@3602 38 }
kaf24@3602 39
kaf24@3602 40 void show_trace(unsigned long *rsp)
kaf24@3602 41 {
kaf24@3602 42 unsigned long *stack, addr;
kaf24@3602 43 int i;
kaf24@3602 44
kaf24@3602 45 printk("Call Trace from RSP=%p: ", rsp);
kaf24@3602 46 stack = rsp;
kaf24@3602 47 i = 0;
kaf24@3602 48 while (((long) stack & (STACK_SIZE-1)) != 0) {
kaf24@3602 49 addr = *stack++;
kaf24@3602 50 if (kernel_text_address(addr)) {
kaf24@3602 51 if (i && ((i % 6) == 0))
kaf24@3602 52 printk("\n ");
kaf24@3602 53 printk("[<%08lx>] ", addr);
kaf24@3602 54 i++;
kaf24@3602 55 }
kaf24@3602 56 }
kaf24@3602 57 printk("\n");
kaf24@3602 58 }
kaf24@3602 59
kaf24@3602 60 void show_stack(unsigned long *rsp)
kaf24@3602 61 {
kaf24@3602 62 unsigned long *stack;
kaf24@3602 63 int i;
kaf24@3602 64
kaf24@3602 65 printk("Stack trace from RSP=%p:\n", rsp);
kaf24@3602 66
kaf24@3602 67 stack = rsp;
kaf24@3602 68 for ( i = 0; i < kstack_depth_to_print; i++ )
kaf24@3602 69 {
kaf24@3602 70 if ( ((long)stack & (STACK_SIZE-1)) == 0 )
kaf24@3602 71 break;
kaf24@3602 72 if ( i && ((i % 8) == 0) )
kaf24@3602 73 printk("\n ");
kaf24@3602 74 if ( kernel_text_address(*stack) )
kaf24@3602 75 printk("[%08lx] ", *stack++);
kaf24@3602 76 else
kaf24@3602 77 printk("%08lx ", *stack++);
kaf24@3602 78 }
kaf24@3602 79 printk("\n");
kaf24@3602 80
kaf24@3602 81 show_trace(rsp);
kaf24@3602 82 }
kaf24@3602 83
kaf24@3602 84 void show_registers(struct xen_regs *regs)
kaf24@3602 85 {
kaf24@3602 86 printk("CPU: %d\nEIP: %04lx:[<%08lx>] \nEFLAGS: %08lx\n",
kaf24@3602 87 smp_processor_id(), 0xffff & regs->cs, regs->rip, regs->eflags);
kaf24@3602 88 printk("rax: %08lx rbx: %08lx rcx: %08lx rdx: %08lx\n",
kaf24@3602 89 regs->rax, regs->rbx, regs->rcx, regs->rdx);
kaf24@3602 90 printk("rsi: %08lx rdi: %08lx rbp: %08lx rsp: %08lx ss: %04x\n",
kaf24@3602 91 regs->rsi, regs->rdi, regs->rbp, regs->rsp, regs->ss);
kaf24@3602 92 printk("r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
kaf24@3602 93 regs->r8, regs->r9, regs->r10, regs->r11);
kaf24@3602 94 printk("r12: %08lx r13: %08lx r14: %08lx r15: %08lx\n",
kaf24@3602 95 regs->r12, regs->r13, regs->r14, regs->r15);
kaf24@3602 96
kaf24@3602 97 show_stack((unsigned long *)regs->rsp);
kaf24@3602 98 }
kaf24@3602 99
kaf24@3602 100 void __init doublefault_init(void)
kaf24@3602 101 {
kaf24@3602 102 }
kaf24@3602 103
kaf24@3602 104 void *decode_reg(struct xen_regs *regs, u8 b)
kaf24@3602 105 {
kaf24@3602 106 switch ( b )
kaf24@3602 107 {
kaf24@3602 108 case 0: return &regs->rax;
kaf24@3602 109 case 1: return &regs->rcx;
kaf24@3602 110 case 2: return &regs->rdx;
kaf24@3602 111 case 3: return &regs->rbx;
kaf24@3602 112 case 4: return &regs->rsp;
kaf24@3602 113 case 5: return &regs->rbp;
kaf24@3602 114 case 6: return &regs->rsi;
kaf24@3602 115 case 7: return &regs->rdi;
kaf24@3602 116 case 8: return &regs->r8;
kaf24@3602 117 case 9: return &regs->r9;
kaf24@3602 118 case 10: return &regs->r10;
kaf24@3602 119 case 11: return &regs->r11;
kaf24@3602 120 case 12: return &regs->r12;
kaf24@3602 121 case 13: return &regs->r13;
kaf24@3602 122 case 14: return &regs->r14;
kaf24@3602 123 case 15: return &regs->r15;
kaf24@3602 124 }
kaf24@3602 125
kaf24@3602 126 return NULL;
kaf24@3602 127 }