debuggers.hg
changeset 3659:bf2c38625b39
bitkeeper revision 1.1159.212.72 (42011b79Y7C9nEKFZ5pdQXwp8jC9hw)
More x86/64. Now boot secondary CPUs, but I seem to have problems
executing IRET, so interrupts are fatal.
Signed-off-by: keir.fraser@cl.cam.ac.uk
More x86/64. Now boot secondary CPUs, but I seem to have problems
executing IRET, so interrupts are fatal.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Wed Feb 02 18:27:05 2005 +0000 (2005-02-02) |
parents | 0ef6e8e6e85d |
children | 060c1ea52343 |
files | .rootkeys xen/arch/x86/Rules.mk xen/arch/x86/boot/x86_64.S xen/arch/x86/irq.c xen/arch/x86/smpboot.c xen/arch/x86/traps.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/traps.c xen/include/asm-x86/config.h xen/include/asm-x86/desc.h xen/include/asm-x86/irq.h xen/include/asm-x86/pda.h xen/include/asm-x86/smp.h xen/include/asm-x86/x86_32/asm_defns.h xen/include/asm-x86/x86_64/asm_defns.h xen/include/asm-x86/x86_64/current.h |
line diff
1.1 --- a/.rootkeys Wed Feb 02 15:24:31 2005 +0000 1.2 +++ b/.rootkeys Wed Feb 02 18:27:05 2005 +0000 1.3 @@ -1020,7 +1020,6 @@ 41aaf567Mi3OishhvrCtET1y-mxQBg xen/inclu 1.4 41a61536MFhNalgbVmYGXAhQsPTZNw xen/include/asm-x86/multicall.h 1.5 3ddb79c3xjYnrv5t3VqYlR4tNEOl4Q xen/include/asm-x86/page.h 1.6 3ddb79c3ysKUbxZuwKBRK3WXU2TlEg xen/include/asm-x86/pci.h 1.7 -404f1bb41Yl-5ZjIWnG66HDCj6OIWA xen/include/asm-x86/pda.h 1.8 4022a73diKn2Ax4-R4gzk59lm1YdDg xen/include/asm-x86/pdb.h 1.9 3ddb79c2QF5-pZGzuX4QukPCDAl59A xen/include/asm-x86/processor.h 1.10 40cf1596bim9F9DNdV75klgRSZ6Y2A xen/include/asm-x86/regs.h
2.1 --- a/xen/arch/x86/Rules.mk Wed Feb 02 15:24:31 2005 +0000 2.2 +++ b/xen/arch/x86/Rules.mk Wed Feb 02 18:27:05 2005 +0000 2.3 @@ -5,7 +5,7 @@ CC := gcc 2.4 LD := ld 2.5 2.6 CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing 2.7 -CFLAGS += -iwithprefix include -Wall -Werror -pipe 2.8 +CFLAGS += -iwithprefix include -Wall -Werror -Wno-format -pipe 2.9 CFLAGS += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls 2.10 2.11 ifeq ($(optimize),y)
3.1 --- a/xen/arch/x86/boot/x86_64.S Wed Feb 02 15:24:31 2005 +0000 3.2 +++ b/xen/arch/x86/boot/x86_64.S Wed Feb 02 18:27:05 2005 +0000 3.3 @@ -52,16 +52,16 @@ 3: in %dx,%al 3.4 3.5 /* Set up a few descriptors: on entry only CS is guaranteed good. */ 3.6 lgdt %cs:0x1001f0 3.7 - mov $(__HYPERVISOR_DS),%ecx 3.8 + mov $(__HYPERVISOR_DS32),%ecx 3.9 mov %ecx,%ds 3.10 mov %ecx,%es 3.11 3.12 + cmp $(SECONDARY_CPU_FLAG),%ebx 3.13 + je skip_boot_checks 3.14 + 3.15 /* Check for Multiboot bootloader */ 3.16 - cmp $(SECONDARY_CPU_FLAG),%ebx 3.17 - je skip_multiboot_check 3.18 cmp $0x2BADB002,%eax 3.19 jne not_multiboot 3.20 -skip_multiboot_check: 3.21 3.22 /* Save the Multiboot info structure for later use. */ 3.23 mov %ebx,0x1001e0 3.24 @@ -75,7 +75,8 @@ skip_multiboot_check: 3.25 cpuid 3.26 bt $29,%edx # Long mode feature? 3.27 jnc bad_cpu 3.28 - 3.29 +skip_boot_checks: 3.30 + 3.31 /* Set up FPU. */ 3.32 fninit 3.33 3.34 @@ -123,6 +124,13 @@ 1: /* Now in compatibility mode. Lo 3.35 ret 3.36 __high_start: 3.37 3.38 + mov $(__HYPERVISOR_DS64),%ecx 3.39 + mov %ecx,%ds 3.40 + mov %ecx,%es 3.41 + mov %ecx,%fs 3.42 + mov %ecx,%gs 3.43 + mov %ecx,%ss 3.44 + 3.45 lidt idt_descr(%rip) 3.46 3.47 cmp $(SECONDARY_CPU_FLAG),%ebx 3.48 @@ -203,7 +211,7 @@ SYMBOL_NAME(idt): 3.49 .quad SYMBOL_NAME(idt_table) 3.50 3.51 ENTRY(stack_start) 3.52 - .quad SYMBOL_NAME(cpu0_stack) + 8100 3.53 + .quad SYMBOL_NAME(cpu0_stack) + 8000 3.54 3.55 high_start: 3.56 .quad __high_start 3.57 @@ -241,9 +249,8 @@ ENTRY(cpu0_stack) # Initial stack is 3.58 ENTRY(stext) 3.59 ENTRY(_stext) 3.60 3.61 -.globl switch_to, ret_from_intr, do_iopl 3.62 +.globl switch_to, do_iopl 3.63 switch_to: 3.64 -ret_from_intr: 3.65 do_iopl: 3.66 .globl copy_from_user, copy_to_user, copy_user_generic, new_thread 3.67 copy_from_user:
4.1 --- a/xen/arch/x86/irq.c Wed Feb 02 15:24:31 2005 +0000 4.2 +++ b/xen/arch/x86/irq.c Wed Feb 02 18:27:05 2005 +0000 4.3 @@ -87,13 +87,9 @@ void enable_irq(unsigned int irq) 4.4 spin_unlock_irqrestore(&desc->lock, flags); 4.5 } 4.6 4.7 -asmlinkage void do_IRQ(struct xen_regs regs) 4.8 +asmlinkage void do_IRQ(struct xen_regs *regs) 4.9 { 4.10 -#if defined(__i386__) 4.11 - unsigned int irq = regs.entry_vector; 4.12 -#else 4.13 - unsigned int irq = 0; /* XXX */ 4.14 -#endif 4.15 + unsigned int irq = regs->entry_vector; 4.16 irq_desc_t *desc = &irq_desc[irq]; 4.17 struct irqaction *action; 4.18 4.19 @@ -127,7 +123,7 @@ asmlinkage void do_IRQ(struct xen_regs r 4.20 desc->status &= ~IRQ_PENDING; 4.21 irq_enter(smp_processor_id(), irq); 4.22 spin_unlock_irq(&desc->lock); 4.23 - action->handler(irq, action->dev_id, ®s); 4.24 + action->handler(irq, action->dev_id, regs); 4.25 spin_lock_irq(&desc->lock); 4.26 irq_exit(smp_processor_id(), irq); 4.27 }
5.1 --- a/xen/arch/x86/smpboot.c Wed Feb 02 15:24:31 2005 +0000 5.2 +++ b/xen/arch/x86/smpboot.c Wed Feb 02 18:27:05 2005 +0000 5.3 @@ -409,7 +409,7 @@ void __init start_secondary(void) 5.4 * At this point, boot CPU has fully initialised the IDT. It is 5.5 * now safe to make ourselves a private copy. 5.6 */ 5.7 - idt_tables[cpu] = xmalloc_array(struct desc_struct, IDT_ENTRIES); 5.8 + idt_tables[cpu] = xmalloc_array(idt_entry_t, IDT_ENTRIES); 5.9 memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES*8); 5.10 *(unsigned short *)(&idt_load[0]) = (IDT_ENTRIES*8)-1; 5.11 *(unsigned long *)(&idt_load[2]) = (unsigned long)idt_tables[cpu]; 5.12 @@ -650,7 +650,8 @@ static void __init do_boot_cpu (int apic 5.13 struct exec_domain *ed; 5.14 unsigned long boot_error = 0; 5.15 int timeout, cpu; 5.16 - unsigned long start_eip, stack; 5.17 + unsigned long start_eip; 5.18 + void *stack; 5.19 5.20 cpu = ++cpucount; 5.21 5.22 @@ -673,11 +674,15 @@ static void __init do_boot_cpu (int apic 5.23 /* So we see what's up. */ 5.24 printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip); 5.25 5.26 - stack = __pa(alloc_xenheap_pages(1)); 5.27 - stack_start.esp = stack + STACK_SIZE - STACK_RESERVED; 5.28 + stack = (void *)alloc_xenheap_pages(1); 5.29 +#if defined(__i386__) 5.30 + stack_start.esp = __pa(stack) + STACK_SIZE - STACK_RESERVED; 5.31 +#elif defined(__x86_64__) 5.32 + stack_start.esp = (unsigned long)stack + STACK_SIZE - STACK_RESERVED; 5.33 +#endif 5.34 5.35 /* Debug build: detect stack overflow by setting up a guard page. */ 5.36 - memguard_guard_range(__va(stack), PAGE_SIZE); 5.37 + memguard_guard_range(stack, PAGE_SIZE); 5.38 5.39 /* 5.40 * This grunge runs the startup process for 5.41 @@ -739,7 +744,7 @@ static void __init do_boot_cpu (int apic 5.42 printk("CPU%d has booted.\n", cpu); 5.43 } else { 5.44 boot_error= 1; 5.45 - if (*((volatile unsigned long *)phys_to_virt(start_eip)) 5.46 + if (*((volatile unsigned int *)phys_to_virt(start_eip)) 5.47 == 0xA5A5A5A5) 5.48 /* trampoline started but...? */ 5.49 printk("Stuck ??\n");
6.1 --- a/xen/arch/x86/traps.c Wed Feb 02 15:24:31 2005 +0000 6.2 +++ b/xen/arch/x86/traps.c Wed Feb 02 18:27:05 2005 +0000 6.3 @@ -116,7 +116,7 @@ asmlinkage void fatal_trap(int trapnr, s 6.4 if ( trapnr == TRAP_page_fault ) 6.5 { 6.6 __asm__ __volatile__ ("mov %%cr2,%0" : "=r" (cr2) : ); 6.7 - printk("Faulting linear address might be %08lx\n", cr2); 6.8 + printk("Faulting linear address might be %0lx %lx\n", cr2, cr2); 6.9 } 6.10 6.11 printk("************************************\n"); 6.12 @@ -165,7 +165,7 @@ static inline int do_trap(int trapnr, ch 6.13 6.14 if ( likely((fixup = search_exception_table(regs->eip)) != 0) ) 6.15 { 6.16 - DPRINTK("Trap %d: %08lx -> %08lx\n", trapnr, regs->eip, fixup); 6.17 + DPRINTK("Trap %d: %p -> %p\n", trapnr, regs->eip, fixup); 6.18 regs->eip = fixup; 6.19 return 0; 6.20 } 6.21 @@ -322,7 +322,7 @@ asmlinkage int do_page_fault(struct xen_ 6.22 { 6.23 perfc_incrc(copy_user_faults); 6.24 if ( !ed->mm.shadow_mode ) 6.25 - DPRINTK("Page fault: %08lx -> %08lx\n", regs->eip, fixup); 6.26 + DPRINTK("Page fault: %p -> %p\n", regs->eip, fixup); 6.27 regs->eip = fixup; 6.28 return 0; 6.29 } 6.30 @@ -334,12 +334,12 @@ asmlinkage int do_page_fault(struct xen_ 6.31 { 6.32 unsigned long page; 6.33 page = l2_pgentry_val(idle_pg_table[addr >> L2_PAGETABLE_SHIFT]); 6.34 - printk("*pde = %08lx\n", page); 6.35 + printk("*pde = %p\n", page); 6.36 if ( page & _PAGE_PRESENT ) 6.37 { 6.38 page &= PAGE_MASK; 6.39 page = ((unsigned long *) __va(page))[(addr&0x3ff000)>>PAGE_SHIFT]; 6.40 - printk(" *pte = %08lx\n", page); 6.41 + printk(" *pte = %p\n", page); 6.42 } 6.43 #ifdef MEMORY_GUARD 6.44 if ( !(regs->error_code & 1) ) 6.45 @@ -351,7 +351,7 @@ asmlinkage int do_page_fault(struct xen_ 6.46 show_registers(regs); 6.47 panic("CPU%d FATAL PAGE FAULT\n" 6.48 "[error_code=%04x]\n" 6.49 - "Faulting linear address might be %08lx\n", 6.50 + "Faulting linear address might be %p\n", 6.51 smp_processor_id(), regs->error_code, addr); 6.52 return 0; 6.53 } 6.54 @@ -555,7 +555,7 @@ asmlinkage int do_general_protection(str 6.55 6.56 if ( likely((fixup = search_exception_table(regs->eip)) != 0) ) 6.57 { 6.58 - DPRINTK("GPF (%04x): %08lx -> %08lx\n", 6.59 + DPRINTK("GPF (%04x): %p -> %p\n", 6.60 regs->error_code, regs->eip, fixup); 6.61 regs->eip = fixup; 6.62 return 0; 6.63 @@ -705,16 +705,6 @@ void set_task_gate(unsigned int n, unsig 6.64 idt_table[n].b = 0x8500; 6.65 } 6.66 6.67 -#define _set_seg_desc(gate_addr,type,dpl,base,limit) {\ 6.68 - *((gate_addr)+1) = ((base) & 0xff000000) | \ 6.69 - (((base) & 0x00ff0000)>>16) | \ 6.70 - ((limit) & 0xf0000) | \ 6.71 - ((dpl)<<13) | \ 6.72 - (0x00408000) | \ 6.73 - ((type)<<8); \ 6.74 - *(gate_addr) = (((base) & 0x0000ffff)<<16) | \ 6.75 - ((limit) & 0x0ffff); } 6.76 - 6.77 void set_tss_desc(unsigned int n, void *addr) 6.78 { 6.79 _set_tssldt_desc( 6.80 @@ -729,7 +719,6 @@ void __init trap_init(void) 6.81 extern void doublefault_init(void); 6.82 doublefault_init(); 6.83 6.84 -#ifdef __i386__ 6.85 /* 6.86 * Note that interrupt gates are always used, rather than trap gates. We 6.87 * must have interrupts disabled until DS/ES/FS/GS are saved because the 6.88 @@ -760,8 +749,10 @@ void __init trap_init(void) 6.89 set_intr_gate(TRAP_simd_error,&simd_coprocessor_error); 6.90 set_intr_gate(TRAP_deferred_nmi,&nmi); 6.91 6.92 - /* Only ring 1 can access Xen services. */ 6.93 - _set_gate(idt_table+HYPERCALL_VECTOR,14,1,&hypercall); 6.94 +#if defined(__i386__) 6.95 + _set_gate(idt_table+HYPERCALL_VECTOR, 14, 1, &hypercall); 6.96 +#elif defined(__x86_64__) 6.97 + _set_gate(idt_table+HYPERCALL_VECTOR, 14, 3, &hypercall); 6.98 #endif 6.99 6.100 /* CPU0 uses the master IDT. */
7.1 --- a/xen/arch/x86/x86_32/traps.c Wed Feb 02 15:24:31 2005 +0000 7.2 +++ b/xen/arch/x86/x86_32/traps.c Wed Feb 02 18:27:05 2005 +0000 7.3 @@ -23,15 +23,15 @@ void show_guest_stack(void) 7.4 int i; 7.5 execution_context_t *ec = get_execution_context(); 7.6 unsigned long *stack = (unsigned long *)ec->esp; 7.7 - printk("Guest EIP is %lx\n",ec->eip); 7.8 + printk("Guest EIP is %lx\n ",ec->eip); 7.9 7.10 for ( i = 0; i < kstack_depth_to_print; i++ ) 7.11 { 7.12 if ( ((long)stack & (STACK_SIZE-1)) == 0 ) 7.13 break; 7.14 if ( i && ((i % 8) == 0) ) 7.15 - printk("\n "); 7.16 - printk("%08lx ", *stack++); 7.17 + printk("\n "); 7.18 + printk("%p ", *stack++); 7.19 } 7.20 printk("\n"); 7.21 7.22 @@ -42,7 +42,7 @@ void show_trace(unsigned long *esp) 7.23 unsigned long *stack, addr; 7.24 int i; 7.25 7.26 - printk("Call Trace from ESP=%p: ", esp); 7.27 + printk("Call Trace from ESP=%p:\n ", esp); 7.28 stack = esp; 7.29 i = 0; 7.30 while (((long) stack & (STACK_SIZE-1)) != 0) { 7.31 @@ -50,7 +50,7 @@ void show_trace(unsigned long *esp) 7.32 if (kernel_text_address(addr)) { 7.33 if (i && ((i % 6) == 0)) 7.34 printk("\n "); 7.35 - printk("[<%08lx>] ", addr); 7.36 + printk("[<%p>] ", addr); 7.37 i++; 7.38 } 7.39 } 7.40 @@ -62,7 +62,7 @@ void show_stack(unsigned long *esp) 7.41 unsigned long *stack; 7.42 int i; 7.43 7.44 - printk("Stack trace from ESP=%p:\n", esp); 7.45 + printk("Stack trace from ESP=%p:\n ", esp); 7.46 7.47 stack = esp; 7.48 for ( i = 0; i < kstack_depth_to_print; i++ ) 7.49 @@ -70,11 +70,11 @@ void show_stack(unsigned long *esp) 7.50 if ( ((long)stack & (STACK_SIZE-1)) == 0 ) 7.51 break; 7.52 if ( i && ((i % 8) == 0) ) 7.53 - printk("\n "); 7.54 + printk("\n "); 7.55 if ( kernel_text_address(*stack) ) 7.56 - printk("[%08lx] ", *stack++); 7.57 + printk("[%p] ", *stack++); 7.58 else 7.59 - printk("%08lx ", *stack++); 7.60 + printk("%p ", *stack++); 7.61 } 7.62 printk("\n"); 7.63 7.64 @@ -105,11 +105,11 @@ void show_registers(struct xen_regs *reg 7.65 gs = __HYPERVISOR_DS; 7.66 } 7.67 7.68 - printk("CPU: %d\nEIP: %04lx:[<%08lx>] \nEFLAGS: %08lx\n", 7.69 + printk("CPU: %d\nEIP: %04lx:[<%p>] \nEFLAGS: %p\n", 7.70 smp_processor_id(), 0xffff & regs->cs, regs->eip, regs->eflags); 7.71 - printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", 7.72 + printk("eax: %p ebx: %p ecx: %p edx: %p\n", 7.73 regs->eax, regs->ebx, regs->ecx, regs->edx); 7.74 - printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", 7.75 + printk("esi: %p edi: %p ebp: %p esp: %p\n", 7.76 regs->esi, regs->edi, regs->ebp, esp); 7.77 printk("ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", 7.78 ds, es, fs, gs, ss);
8.1 --- a/xen/arch/x86/x86_64/entry.S Wed Feb 02 15:24:31 2005 +0000 8.2 +++ b/xen/arch/x86/x86_64/entry.S Wed Feb 02 18:27:05 2005 +0000 8.3 @@ -0,0 +1,154 @@ 8.4 +/* 8.5 + * Hypercall and fault low-level handling routines. 8.6 + * 8.7 + * Copyright (c) 2005, K A Fraser 8.8 + */ 8.9 + 8.10 +#include <xen/config.h> 8.11 +#include <xen/errno.h> 8.12 +#include <xen/softirq.h> 8.13 +#include <asm/asm_defns.h> 8.14 +#include <asm/apicdef.h> 8.15 +#include <public/xen.h> 8.16 + 8.17 +ENTRY(hypercall) 8.18 + iret 8.19 + 8.20 +ENTRY(ret_from_intr) 8.21 +restore_all_xen: 8.22 + popq %r15 8.23 + popq %r14 8.24 + popq %r13 8.25 + popq %r12 8.26 + popq %rbp 8.27 + popq %rbx 8.28 + popq %r11 8.29 + popq %r10 8.30 + popq %r9 8.31 + popq %r8 8.32 + popq %rax 8.33 + popq %rcx 8.34 + popq %rdx 8.35 + popq %rsi 8.36 + popq %rdi 8.37 + addq $8,%rsp 8.38 + iret 8.39 + 8.40 +error_code: 8.41 + SAVE_ALL 8.42 + movq %rsp,%rdi 8.43 + movl XREGS_entry_vector(%rsp),%eax 8.44 + leaq SYMBOL_NAME(exception_table)(%rip),%rdx 8.45 + callq *(%rdx,%rax,8) 8.46 + jmp restore_all_xen 8.47 + 8.48 +ENTRY(divide_error) 8.49 + pushq $0 8.50 + movl $TRAP_divide_error,4(%rsp) 8.51 + jmp error_code 8.52 + 8.53 +ENTRY(coprocessor_error) 8.54 + pushq $0 8.55 + movl $TRAP_copro_error,4(%rsp) 8.56 + jmp error_code 8.57 + 8.58 +ENTRY(simd_coprocessor_error) 8.59 + pushq $0 8.60 + movl $TRAP_simd_error,4(%rsp) 8.61 + jmp error_code 8.62 + 8.63 +ENTRY(device_not_available) 8.64 + pushq $0 8.65 + movl $TRAP_no_device,4(%rsp) 8.66 + jmp error_code 8.67 + 8.68 +ENTRY(debug) 8.69 + pushq $0 8.70 + movl $TRAP_debug,4(%rsp) 8.71 + jmp error_code 8.72 + 8.73 +ENTRY(int3) 8.74 + pushq $0 8.75 + movl $TRAP_int3,4(%rsp) 8.76 + jmp error_code 8.77 + 8.78 +ENTRY(overflow) 8.79 + pushq $0 8.80 + movl $TRAP_overflow,4(%rsp) 8.81 + jmp error_code 8.82 + 8.83 +ENTRY(bounds) 8.84 + pushq $0 8.85 + movl $TRAP_bounds,4(%rsp) 8.86 + jmp error_code 8.87 + 8.88 +ENTRY(invalid_op) 8.89 + pushq $0 8.90 + movl $TRAP_invalid_op,4(%rsp) 8.91 + jmp error_code 8.92 + 8.93 +ENTRY(coprocessor_segment_overrun) 8.94 + pushq $0 8.95 + movl $TRAP_copro_seg,4(%rsp) 8.96 + jmp error_code 8.97 + 8.98 +ENTRY(invalid_TSS) 8.99 + movl $TRAP_invalid_tss,4(%rsp) 8.100 + jmp error_code 8.101 + 8.102 +ENTRY(segment_not_present) 8.103 + movl $TRAP_no_segment,4(%rsp) 8.104 + jmp error_code 8.105 + 8.106 +ENTRY(stack_segment) 8.107 + movl $TRAP_stack_error,4(%rsp) 8.108 + jmp error_code 8.109 + 8.110 +ENTRY(general_protection) 8.111 + movl $TRAP_gp_fault,4(%rsp) 8.112 + jmp error_code 8.113 + 8.114 +ENTRY(alignment_check) 8.115 + movl $TRAP_alignment_check,4(%rsp) 8.116 + jmp error_code 8.117 + 8.118 +ENTRY(page_fault) 8.119 + movl $TRAP_page_fault,4(%rsp) 8.120 + jmp error_code 8.121 + 8.122 +ENTRY(machine_check) 8.123 + pushq $0 8.124 + movl $TRAP_machine_check,4(%rsp) 8.125 + jmp error_code 8.126 + 8.127 +ENTRY(spurious_interrupt_bug) 8.128 + pushq $0 8.129 + movl $TRAP_spurious_int,4(%rsp) 8.130 + jmp error_code 8.131 + 8.132 +ENTRY(nmi) 8.133 + iret 8.134 + 8.135 +.data 8.136 + 8.137 +ENTRY(exception_table) 8.138 + .quad SYMBOL_NAME(do_divide_error) 8.139 + .quad SYMBOL_NAME(do_debug) 8.140 + .quad 0 # nmi 8.141 + .quad SYMBOL_NAME(do_int3) 8.142 + .quad SYMBOL_NAME(do_overflow) 8.143 + .quad SYMBOL_NAME(do_bounds) 8.144 + .quad SYMBOL_NAME(do_invalid_op) 8.145 + .quad SYMBOL_NAME(math_state_restore) 8.146 + .quad 0 # double fault 8.147 + .quad SYMBOL_NAME(do_coprocessor_segment_overrun) 8.148 + .quad SYMBOL_NAME(do_invalid_TSS) 8.149 + .quad SYMBOL_NAME(do_segment_not_present) 8.150 + .quad SYMBOL_NAME(do_stack_segment) 8.151 + .quad SYMBOL_NAME(do_general_protection) 8.152 + .quad SYMBOL_NAME(do_page_fault) 8.153 + .quad SYMBOL_NAME(do_spurious_interrupt_bug) 8.154 + .quad SYMBOL_NAME(do_coprocessor_error) 8.155 + .quad SYMBOL_NAME(do_alignment_check) 8.156 + .quad SYMBOL_NAME(do_machine_check) 8.157 + .quad SYMBOL_NAME(do_simd_coprocessor_error)
9.1 --- a/xen/arch/x86/x86_64/traps.c Wed Feb 02 15:24:31 2005 +0000 9.2 +++ b/xen/arch/x86/x86_64/traps.c Wed Feb 02 18:27:05 2005 +0000 9.3 @@ -23,15 +23,15 @@ void show_guest_stack(void) 9.4 int i; 9.5 execution_context_t *ec = get_execution_context(); 9.6 unsigned long *stack = (unsigned long *)ec->rsp; 9.7 - printk("Guest RIP is %lx\n", ec->rip); 9.8 + printk("Guest RIP is %lx\n ", ec->rip); 9.9 9.10 for ( i = 0; i < kstack_depth_to_print; i++ ) 9.11 { 9.12 if ( ((long)stack & (STACK_SIZE-1)) == 0 ) 9.13 break; 9.14 if ( i && ((i % 8) == 0) ) 9.15 - printk("\n "); 9.16 - printk("%08lx ", *stack++); 9.17 + printk("\n "); 9.18 + printk("%p ", *stack++); 9.19 } 9.20 printk("\n"); 9.21 9.22 @@ -42,7 +42,7 @@ void show_trace(unsigned long *rsp) 9.23 unsigned long *stack, addr; 9.24 int i; 9.25 9.26 - printk("Call Trace from RSP=%p: ", rsp); 9.27 + printk("Call Trace from RSP=%p:\n ", rsp); 9.28 stack = rsp; 9.29 i = 0; 9.30 while (((long) stack & (STACK_SIZE-1)) != 0) { 9.31 @@ -50,7 +50,7 @@ void show_trace(unsigned long *rsp) 9.32 if (kernel_text_address(addr)) { 9.33 if (i && ((i % 6) == 0)) 9.34 printk("\n "); 9.35 - printk("[<%08lx>] ", addr); 9.36 + printk("[<%p>] ", addr); 9.37 i++; 9.38 } 9.39 } 9.40 @@ -62,7 +62,7 @@ void show_stack(unsigned long *rsp) 9.41 unsigned long *stack; 9.42 int i; 9.43 9.44 - printk("Stack trace from RSP=%p:\n", rsp); 9.45 + printk("Stack trace from RSP=%p:\n ", rsp); 9.46 9.47 stack = rsp; 9.48 for ( i = 0; i < kstack_depth_to_print; i++ ) 9.49 @@ -70,11 +70,11 @@ void show_stack(unsigned long *rsp) 9.50 if ( ((long)stack & (STACK_SIZE-1)) == 0 ) 9.51 break; 9.52 if ( i && ((i % 8) == 0) ) 9.53 - printk("\n "); 9.54 + printk("\n "); 9.55 if ( kernel_text_address(*stack) ) 9.56 - printk("[%08lx] ", *stack++); 9.57 + printk("[%p] ", *stack++); 9.58 else 9.59 - printk("%08lx ", *stack++); 9.60 + printk("%p ", *stack++); 9.61 } 9.62 printk("\n"); 9.63 9.64 @@ -83,15 +83,15 @@ void show_stack(unsigned long *rsp) 9.65 9.66 void show_registers(struct xen_regs *regs) 9.67 { 9.68 - printk("CPU: %d\nEIP: %04lx:[<%08lx>] \nEFLAGS: %08lx\n", 9.69 + printk("CPU: %d\nEIP: %04lx:[<%p>] \nEFLAGS: %p\n", 9.70 smp_processor_id(), 0xffff & regs->cs, regs->rip, regs->eflags); 9.71 - printk("rax: %08lx rbx: %08lx rcx: %08lx rdx: %08lx\n", 9.72 + printk("rax: %p rbx: %p rcx: %p rdx: %p\n", 9.73 regs->rax, regs->rbx, regs->rcx, regs->rdx); 9.74 - printk("rsi: %08lx rdi: %08lx rbp: %08lx rsp: %08lx ss: %04x\n", 9.75 - regs->rsi, regs->rdi, regs->rbp, regs->rsp, regs->ss); 9.76 - printk("r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n", 9.77 + printk("rsi: %p rdi: %p rbp: %p rsp: %p\n", 9.78 + regs->rsi, regs->rdi, regs->rbp, regs->rsp); 9.79 + printk("r8: %p r9: %p r10: %p r11: %p\n", 9.80 regs->r8, regs->r9, regs->r10, regs->r11); 9.81 - printk("r12: %08lx r13: %08lx r14: %08lx r15: %08lx\n", 9.82 + printk("r12: %p r13: %p r14: %p r15: %p\n", 9.83 regs->r12, regs->r13, regs->r14, regs->r15); 9.84 9.85 show_stack((unsigned long *)regs->rsp);
10.1 --- a/xen/include/asm-x86/config.h Wed Feb 02 15:24:31 2005 +0000 10.2 +++ b/xen/include/asm-x86/config.h Wed Feb 02 18:27:05 2005 +0000 10.3 @@ -61,7 +61,6 @@ 10.4 #define NR_CPUS 16 10.5 10.6 /* Linkage for x86 */ 10.7 -#define asmlinkage __attribute__((regparm(0))) 10.8 #define __ALIGN .align 16,0x90 10.9 #define __ALIGN_STR ".align 16,0x90" 10.10 #define SYMBOL_NAME_STR(X) #X 10.11 @@ -97,6 +96,8 @@ extern void __out_of_line_bug(int line) 10.12 10.13 #if defined(__x86_64__) 10.14 10.15 +#define asmlinkage 10.16 + 10.17 #define XENHEAP_DEFAULT_MB (16) 10.18 10.19 #define PML4_ENTRY_BITS 39 10.20 @@ -175,7 +176,10 @@ extern void __out_of_line_bug(int line) 10.21 10.22 #define __HYPERVISOR_CS64 0x0810 10.23 #define __HYPERVISOR_CS32 0x0808 10.24 -#define __HYPERVISOR_DS 0x0818 10.25 +#define __HYPERVISOR_CS __HYPERVISOR_CS64 10.26 +#define __HYPERVISOR_DS64 0x0000 10.27 +#define __HYPERVISOR_DS32 0x0818 10.28 +#define __HYPERVISOR_DS __HYPERVISOR_DS64 10.29 10.30 /* For generic assembly code: use macros to define operation/operand sizes. */ 10.31 #define __OS "q" /* Operation Suffix */ 10.32 @@ -183,6 +187,8 @@ extern void __out_of_line_bug(int line) 10.33 10.34 #elif defined(__i386__) 10.35 10.36 +#define asmlinkage __attribute__((regparm(0))) 10.37 + 10.38 #define XENHEAP_DEFAULT_MB (12) 10.39 #define DIRECTMAP_PHYS_END (12*1024*1024) 10.40
11.1 --- a/xen/include/asm-x86/desc.h Wed Feb 02 15:24:31 2005 +0000 11.2 +++ b/xen/include/asm-x86/desc.h Wed Feb 02 18:27:05 2005 +0000 11.3 @@ -50,7 +50,19 @@ typedef struct { 11.4 u64 a, b; 11.5 } idt_entry_t; 11.6 11.7 -#define _set_gate(gate_addr,type,dpl,addr) ((void)0) 11.8 +#define _set_gate(gate_addr,type,dpl,addr) \ 11.9 +do { \ 11.10 + (gate_addr)->a = \ 11.11 + (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \ 11.12 + ((unsigned long)(dpl) << 45) | \ 11.13 + ((unsigned long)(type) << 40) | \ 11.14 + ((unsigned long)(addr) & 0xFFFFUL) | \ 11.15 + ((unsigned long)__HYPERVISOR_CS64 << 16) | \ 11.16 + (1UL << 47); \ 11.17 + (gate_addr)->b = \ 11.18 + ((unsigned long)(addr) >> 32); \ 11.19 +} while (0) 11.20 + 11.21 #define _set_tssldt_desc(n,addr,limit,type) ((void)0) 11.22 11.23 #elif defined(__i386__)
12.1 --- a/xen/include/asm-x86/irq.h Wed Feb 02 15:24:31 2005 +0000 12.2 +++ b/xen/include/asm-x86/irq.h Wed Feb 02 18:27:05 2005 +0000 12.3 @@ -15,11 +15,11 @@ extern void enable_irq(unsigned int); 12.4 * IDT vectors usable for external interrupt sources start 12.5 * at 0x20: 12.6 */ 12.7 -#define FIRST_EXTERNAL_VECTOR 0x30 12.8 +#define FIRST_EXTERNAL_VECTOR 0x30 12.9 12.10 #define NR_IRQS (256 - FIRST_EXTERNAL_VECTOR) 12.11 12.12 -#define HYPERCALL_VECTOR 0x82 12.13 +#define HYPERCALL_VECTOR 0x82 12.14 12.15 /* 12.16 * Vectors 0x30-0x3f are used for ISA interrupts. 12.17 @@ -28,30 +28,30 @@ extern void enable_irq(unsigned int); 12.18 /* 12.19 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff 12.20 */ 12.21 -#define SPURIOUS_APIC_VECTOR 0xff 12.22 -#define ERROR_APIC_VECTOR 0xfe 12.23 -#define INVALIDATE_TLB_VECTOR 0xfd 12.24 -#define EVENT_CHECK_VECTOR 0xfc 12.25 -#define CALL_FUNCTION_VECTOR 0xfb 12.26 -#define KDB_VECTOR 0xfa 12.27 +#define SPURIOUS_APIC_VECTOR 0xff 12.28 +#define ERROR_APIC_VECTOR 0xfe 12.29 +#define INVALIDATE_TLB_VECTOR 0xfd 12.30 +#define EVENT_CHECK_VECTOR 0xfc 12.31 +#define CALL_FUNCTION_VECTOR 0xfb 12.32 +#define KDB_VECTOR 0xfa 12.33 12.34 /* 12.35 * Local APIC timer IRQ vector is on a different priority level, 12.36 * to work around the 'lost local interrupt if more than 2 IRQ 12.37 * sources per level' errata. 12.38 */ 12.39 -#define LOCAL_TIMER_VECTOR 0xef 12.40 +#define LOCAL_TIMER_VECTOR 0xef 12.41 12.42 /* 12.43 * First APIC vector available to drivers: (vectors 0x40-0xee) 12.44 * we start at 0x41 to spread out vectors evenly between priority 12.45 * levels. (0x82 is the hypercall vector) 12.46 */ 12.47 -#define FIRST_DEVICE_VECTOR 0x41 12.48 -#define FIRST_SYSTEM_VECTOR 0xef 12.49 +#define FIRST_DEVICE_VECTOR 0x41 12.50 +#define FIRST_SYSTEM_VECTOR 0xef 12.51 12.52 extern int irq_vector[NR_IRQS]; 12.53 -#define IO_APIC_VECTOR(irq) irq_vector[irq] 12.54 +#define IO_APIC_VECTOR(irq) irq_vector[irq] 12.55 12.56 /* 12.57 * Various low-level irq details needed by irq.c, process.c, 12.58 @@ -84,63 +84,13 @@ extern char _stext, _etext; 12.59 12.60 #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) 12.61 12.62 -#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v) 12.63 -#define XBUILD_SMP_INTERRUPT(x,v)\ 12.64 -asmlinkage void x(void); \ 12.65 -asmlinkage void call_##x(void); \ 12.66 -__asm__( \ 12.67 -"\n"__ALIGN_STR"\n" \ 12.68 -SYMBOL_NAME_STR(x) ":\n\t" \ 12.69 - "push"__OS" $"#v"<<16\n\t" \ 12.70 - SAVE_ALL(a) \ 12.71 - SYMBOL_NAME_STR(call_##x)":\n\t" \ 12.72 - "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 12.73 - "jmp ret_from_intr\n"); 12.74 - 12.75 -#define BUILD_SMP_TIMER_INTERRUPT(x,v) XBUILD_SMP_TIMER_INTERRUPT(x,v) 12.76 -#define XBUILD_SMP_TIMER_INTERRUPT(x,v) \ 12.77 -asmlinkage void x(struct xen_regs * regs); \ 12.78 -asmlinkage void call_##x(void); \ 12.79 -__asm__( \ 12.80 -"\n"__ALIGN_STR"\n" \ 12.81 -SYMBOL_NAME_STR(x) ":\n\t" \ 12.82 - "push"__OS" $"#v"<<16\n\t" \ 12.83 - SAVE_ALL(a) \ 12.84 - "mov %"__OP"sp,%"__OP"ax\n\t" \ 12.85 - "push %"__OP"ax\n\t" \ 12.86 - SYMBOL_NAME_STR(call_##x)":\n\t" \ 12.87 - "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 12.88 - "add $4,%"__OP"sp\n\t" \ 12.89 - "jmp ret_from_intr\n"); 12.90 - 12.91 -#define BUILD_COMMON_IRQ() \ 12.92 -asmlinkage void call_do_IRQ(void); \ 12.93 -__asm__( \ 12.94 - "\n" __ALIGN_STR"\n" \ 12.95 - "common_interrupt:\n\t" \ 12.96 - SAVE_ALL(a) \ 12.97 - SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \ 12.98 - "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \ 12.99 - "jmp ret_from_intr\n"); 12.100 - 12.101 -#define IRQ_NAME2(nr) nr##_interrupt(void) 12.102 -#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) 12.103 - 12.104 -#define BUILD_IRQ(nr) \ 12.105 -asmlinkage void IRQ_NAME(nr); \ 12.106 -__asm__( \ 12.107 -"\n"__ALIGN_STR"\n" \ 12.108 -SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ 12.109 - "push"__OS" $"#nr"<<16\n\t" \ 12.110 - "jmp common_interrupt"); 12.111 - 12.112 #include <xen/irq.h> 12.113 12.114 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) 12.115 { 12.116 #if defined(CONFIG_X86_IO_APIC) 12.117 - if (IO_APIC_IRQ(i)) 12.118 - send_IPI_self(IO_APIC_VECTOR(i)); 12.119 + if (IO_APIC_IRQ(i)) 12.120 + send_IPI_self(IO_APIC_VECTOR(i)); 12.121 #endif 12.122 } 12.123
13.1 --- a/xen/include/asm-x86/pda.h Wed Feb 02 15:24:31 2005 +0000 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,63 +0,0 @@ 13.4 -#ifndef X86_64_PDA_H 13.5 -#define X86_64_PDA_H 13.6 - 13.7 -#include <xen/cache.h> 13.8 - 13.9 -/* Per processor datastructure. %gs points to it while the kernel runs */ 13.10 -/* To use a new field with the *_pda macros it needs to be added to tools/offset.c */ 13.11 -struct x8664_pda { 13.12 - unsigned long kernelstack; /* TOS for current process */ 13.13 - unsigned long oldrsp; /* user rsp for system call */ 13.14 - unsigned long irqrsp; /* Old rsp for interrupts. */ 13.15 - struct exec_domain *pcurrent; /* Current process */ 13.16 - int irqcount; /* Irq nesting counter. Starts with -1 */ 13.17 - int cpunumber; /* Logical CPU number */ 13.18 - char *irqstackptr; /* top of irqstack */ 13.19 - unsigned long volatile *level4_pgt; 13.20 -} __cacheline_aligned; 13.21 - 13.22 -#define PDA_STACKOFFSET (5*8) 13.23 - 13.24 -#define IRQSTACK_ORDER 2 13.25 -#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) 13.26 - 13.27 -extern struct x8664_pda cpu_pda[]; 13.28 - 13.29 -/* 13.30 - * There is no fast way to get the base address of the PDA, all the accesses 13.31 - * have to mention %fs/%gs. So it needs to be done this Torvaldian way. 13.32 - */ 13.33 -#define sizeof_field(type,field) (sizeof(((type *)0)->field)) 13.34 -#define typeof_field(type,field) typeof(((type *)0)->field) 13.35 - 13.36 -extern void __bad_pda_field(void); 13.37 -/* Don't use offsetof because it requires too much infrastructure */ 13.38 -#define pda_offset(field) ((unsigned long)&((struct x8664_pda *)0)->field) 13.39 - 13.40 -#define pda_to_op(op,field,val) do { \ 13.41 - switch (sizeof_field(struct x8664_pda, field)) { \ 13.42 - case 2: asm volatile(op "w %0,%%gs:%P1" :: "r" (val), "i"(pda_offset(field)):"memory"); break; \ 13.43 - case 4: asm volatile(op "l %0,%%gs:%P1" :: "r" (val), "i"(pda_offset(field)):"memory"); break; \ 13.44 - case 8: asm volatile(op "q %0,%%gs:%P1" :: "r" (val), "i"(pda_offset(field)):"memory"); break; \ 13.45 - default: __bad_pda_field(); \ 13.46 - } \ 13.47 - } while (0) 13.48 - 13.49 - 13.50 -#define pda_from_op(op,field) ({ \ 13.51 - typedef typeof_field(struct x8664_pda, field) T__; T__ ret__; \ 13.52 - switch (sizeof_field(struct x8664_pda, field)) { \ 13.53 - case 2: asm volatile(op "w %%gs:%P1,%0":"=r" (ret__): "i" (pda_offset(field)):"memory"); break; \ 13.54 - case 4: asm volatile(op "l %%gs:%P1,%0":"=r" (ret__): "i" (pda_offset(field)):"memory"); break; \ 13.55 - case 8: asm volatile(op "q %%gs:%P1,%0":"=r" (ret__): "i" (pda_offset(field)):"memory"); break; \ 13.56 - default: __bad_pda_field(); \ 13.57 - } \ 13.58 - ret__; }) 13.59 - 13.60 - 13.61 -#define read_pda(field) pda_from_op("mov",field) 13.62 -#define write_pda(field,val) pda_to_op("mov",field,val) 13.63 -#define add_pda(field,val) pda_to_op("add",field,val) 13.64 -#define sub_pda(field,val) pda_to_op("sub",field,val) 13.65 - 13.66 -#endif
14.1 --- a/xen/include/asm-x86/smp.h Wed Feb 02 15:24:31 2005 +0000 14.2 +++ b/xen/include/asm-x86/smp.h Wed Feb 02 18:27:05 2005 +0000 14.3 @@ -61,12 +61,7 @@ extern void smp_store_cpu_info(int id); 14.4 * so this is correct in the x86 case. 14.5 */ 14.6 14.7 -#if defined(__i386__) 14.8 #define smp_processor_id() (current->processor) 14.9 -#elif defined(__x86_64__) 14.10 -#include <asm/pda.h> 14.11 -#define smp_processor_id() read_pda(cpunumber) 14.12 -#endif 14.13 14.14 static __inline int hard_smp_processor_id(void) 14.15 {
15.1 --- a/xen/include/asm-x86/x86_32/asm_defns.h Wed Feb 02 15:24:31 2005 +0000 15.2 +++ b/xen/include/asm-x86/x86_32/asm_defns.h Wed Feb 02 18:27:05 2005 +0000 15.3 @@ -78,4 +78,51 @@ 15.4 15.5 #endif 15.6 15.7 +#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v) 15.8 +#define XBUILD_SMP_INTERRUPT(x,v)\ 15.9 +asmlinkage void x(void); \ 15.10 +__asm__( \ 15.11 + "\n"__ALIGN_STR"\n" \ 15.12 + SYMBOL_NAME_STR(x) ":\n\t" \ 15.13 + "pushl $"#v"<<16\n\t" \ 15.14 + SAVE_ALL(a) \ 15.15 + "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 15.16 + "jmp ret_from_intr\n"); 15.17 + 15.18 +#define BUILD_SMP_TIMER_INTERRUPT(x,v) XBUILD_SMP_TIMER_INTERRUPT(x,v) 15.19 +#define XBUILD_SMP_TIMER_INTERRUPT(x,v) \ 15.20 +asmlinkage void x(struct xen_regs * regs); \ 15.21 +__asm__( \ 15.22 +"\n"__ALIGN_STR"\n" \ 15.23 +SYMBOL_NAME_STR(x) ":\n\t" \ 15.24 + "pushl $"#v"<<16\n\t" \ 15.25 + SAVE_ALL(a) \ 15.26 + "movl %esp,%eax\n\t" \ 15.27 + "pushl %eax\n\t" \ 15.28 + "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 15.29 + "addl $4,%esp\n\t" \ 15.30 + "jmp ret_from_intr\n"); 15.31 + 15.32 +#define BUILD_COMMON_IRQ() \ 15.33 +__asm__( \ 15.34 + "\n" __ALIGN_STR"\n" \ 15.35 + "common_interrupt:\n\t" \ 15.36 + SAVE_ALL(a) \ 15.37 + "movl %esp,%eax\n\t" \ 15.38 + "pushl %eax\n\t" \ 15.39 + "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \ 15.40 + "addl $4,%esp\n\t" \ 15.41 + "jmp ret_from_intr\n"); 15.42 + 15.43 +#define IRQ_NAME2(nr) nr##_interrupt(void) 15.44 +#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) 15.45 + 15.46 +#define BUILD_IRQ(nr) \ 15.47 +asmlinkage void IRQ_NAME(nr); \ 15.48 +__asm__( \ 15.49 +"\n"__ALIGN_STR"\n" \ 15.50 +SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ 15.51 + "pushl $"#nr"<<16\n\t" \ 15.52 + "jmp common_interrupt"); 15.53 + 15.54 #endif /* __X86_32_ASM_DEFNS_H__ */
16.1 --- a/xen/include/asm-x86/x86_64/asm_defns.h Wed Feb 02 15:24:31 2005 +0000 16.2 +++ b/xen/include/asm-x86/x86_64/asm_defns.h Wed Feb 02 18:27:05 2005 +0000 16.3 @@ -1,6 +1,93 @@ 16.4 #ifndef __X86_64_ASM_DEFNS_H__ 16.5 #define __X86_64_ASM_DEFNS_H__ 16.6 16.7 -#define SAVE_ALL(_r) "" 16.8 +/* Maybe auto-generate the following two cases (quoted vs. unquoted). */ 16.9 +#ifndef __ASSEMBLY__ 16.10 + 16.11 +#define SAVE_ALL \ 16.12 + "cld;" \ 16.13 + "pushq %rdi;" \ 16.14 + "pushq %rsi;" \ 16.15 + "pushq %rdx;" \ 16.16 + "pushq %rcx;" \ 16.17 + "pushq %rax;" \ 16.18 + "pushq %r8;" \ 16.19 + "pushq %r9;" \ 16.20 + "pushq %r10;" \ 16.21 + "pushq %r11;" \ 16.22 + "pushq %rbx;" \ 16.23 + "pushq %rbp;" \ 16.24 + "pushq %r12;" \ 16.25 + "pushq %r13;" \ 16.26 + "pushq %r14;" \ 16.27 + "pushq %r15;" 16.28 + 16.29 +#else 16.30 + 16.31 +#define SAVE_ALL \ 16.32 + cld; \ 16.33 + pushq %rdi; \ 16.34 + pushq %rsi; \ 16.35 + pushq %rdx; \ 16.36 + pushq %rcx; \ 16.37 + pushq %rax; \ 16.38 + pushq %r8; \ 16.39 + pushq %r9; \ 16.40 + pushq %r10; \ 16.41 + pushq %r11; \ 16.42 + pushq %rbx; \ 16.43 + pushq %rbp; \ 16.44 + pushq %r12; \ 16.45 + pushq %r13; \ 16.46 + pushq %r14; \ 16.47 + pushq %r15; 16.48 + 16.49 +#endif 16.50 + 16.51 +#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v) 16.52 +#define XBUILD_SMP_INTERRUPT(x,v)\ 16.53 +asmlinkage void x(void); \ 16.54 +__asm__( \ 16.55 + "\n"__ALIGN_STR"\n" \ 16.56 + SYMBOL_NAME_STR(x) ":\n\t" \ 16.57 + "pushq $0\n\t" \ 16.58 + "movl $"#v",4(%rsp)\n\t" \ 16.59 + SAVE_ALL \ 16.60 + "callq "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 16.61 + "jmp ret_from_intr\n"); 16.62 + 16.63 +#define BUILD_SMP_TIMER_INTERRUPT(x,v) XBUILD_SMP_TIMER_INTERRUPT(x,v) 16.64 +#define XBUILD_SMP_TIMER_INTERRUPT(x,v) \ 16.65 +asmlinkage void x(struct xen_regs * regs); \ 16.66 +__asm__( \ 16.67 +"\n"__ALIGN_STR"\n" \ 16.68 +SYMBOL_NAME_STR(x) ":\n\t" \ 16.69 + "pushq $0\n\t" \ 16.70 + "movl $"#v",4(%rsp)\n\t" \ 16.71 + SAVE_ALL \ 16.72 + "movq %rsp,%rdi\n\t" \ 16.73 + "callq "SYMBOL_NAME_STR(smp_##x)"\n\t" \ 16.74 + "jmp ret_from_intr\n"); 16.75 + 16.76 +#define BUILD_COMMON_IRQ() \ 16.77 +__asm__( \ 16.78 + "\n" __ALIGN_STR"\n" \ 16.79 + "common_interrupt:\n\t" \ 16.80 + SAVE_ALL \ 16.81 + "movq %rsp,%rdi\n\t" \ 16.82 + "callq " SYMBOL_NAME_STR(do_IRQ) "\n\t" \ 16.83 + "jmp ret_from_intr\n"); 16.84 + 16.85 +#define IRQ_NAME2(nr) nr##_interrupt(void) 16.86 +#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) 16.87 + 16.88 +#define BUILD_IRQ(nr) \ 16.89 +asmlinkage void IRQ_NAME(nr); \ 16.90 +__asm__( \ 16.91 +"\n"__ALIGN_STR"\n" \ 16.92 +SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ 16.93 + "pushq $0\n\t" \ 16.94 + "movl $"#nr",4(%rsp)\n\t" \ 16.95 + "jmp common_interrupt"); 16.96 16.97 #endif /* __X86_64_ASM_DEFNS_H__ */
17.1 --- a/xen/include/asm-x86/x86_64/current.h Wed Feb 02 15:24:31 2005 +0000 17.2 +++ b/xen/include/asm-x86/x86_64/current.h Wed Feb 02 18:27:05 2005 +0000 17.3 @@ -1,18 +1,16 @@ 17.4 #ifndef _X86_64_CURRENT_H 17.5 #define _X86_64_CURRENT_H 17.6 17.7 -#if !defined(__ASSEMBLY__) 17.8 struct domain; 17.9 17.10 -#include <asm/pda.h> 17.11 - 17.12 #define STACK_RESERVED \ 17.13 - (sizeof(execution_context_t)) 17.14 + (sizeof(execution_context_t) + sizeof(struct domain *)) 17.15 17.16 static inline struct exec_domain *get_current(void) 17.17 { 17.18 struct exec_domain *ed; 17.19 - ed = read_pda(pcurrent); 17.20 + __asm__ ( "orq %%rsp,%0; andq $~7,%0; movq (%0),%0" 17.21 + : "=r" (ed) : "0" (STACK_SIZE-8) ); 17.22 return ed; 17.23 } 17.24 17.25 @@ -20,7 +18,8 @@ static inline struct exec_domain *get_cu 17.26 17.27 static inline void set_current(struct exec_domain *ed) 17.28 { 17.29 - write_pda(pcurrent, ed); 17.30 + __asm__ ( "orq %%rsp,%0; andq $~7,%0; movq %1,(%0)" 17.31 + : : "r" (STACK_SIZE-8), "r" (ed) ); 17.32 } 17.33 17.34 static inline execution_context_t *get_execution_context(void) 17.35 @@ -47,14 +46,4 @@ static inline unsigned long get_stack_to 17.36 17.37 #define schedule_tail(_d) ((_d)->thread.schedule_tail)(_d) 17.38 17.39 -#else 17.40 - 17.41 -#ifndef ASM_OFFSET_H 17.42 -#include <asm/offset.h> 17.43 -#endif 17.44 - 17.45 -#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg 17.46 - 17.47 -#endif 17.48 - 17.49 #endif /* !(_X86_64_CURRENT_H) */