ia64/xen-unstable

changeset 3847:02a6b1fa80df

bitkeeper revision 1.1215 (42142daa9YHoIs3M6QPvH1qZYBJO5g)

IDT fixes. Initialise IDT sanely on x86/64. On x86/32 try to keep
per-cpu IDTs in sync better.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@scramble.cl.cam.ac.uk
date Thu Feb 17 05:37:46 2005 +0000 (2005-02-17)
parents 7645e7facda9
children 786c05f5b537
files xen/arch/x86/boot/x86_64.S xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/boot/x86_64.S	Thu Feb 17 04:57:18 2005 +0000
     1.2 +++ b/xen/arch/x86/boot/x86_64.S	Thu Feb 17 05:37:46 2005 +0000
     1.3 @@ -148,15 +148,22 @@ 1:      /* Now in compatibility mode. Lo
     1.4          rep     stosb
     1.5  
     1.6          /* Initialise IDT with simple error defaults. */
     1.7 -        lea     ignore_int(%rip),%rdx
     1.8 -        mov     $(__HYPERVISOR_CS64 << 16),%eax
     1.9 -        mov     %dx,%ax            /* selector = 0x0010 = cs */
    1.10 -        mov     $0x8E00,%dx        /* interrupt gate - dpl=0, present */
    1.11 -        lea     idt_table(%rip),%rdi
    1.12 -        mov     $256,%rcx
    1.13 -1:      mov     %eax,(%rdi)
    1.14 -        mov     %edx,4(%rdi)
    1.15 -        add     $8,%rdi
    1.16 +        leaq    ignore_int(%rip),%rcx
    1.17 +        movl    %ecx,%eax
    1.18 +        andl    $0xFFFF0000,%eax
    1.19 +        orl     $0x00008E00,%eax
    1.20 +        shlq    $32,%rax
    1.21 +        movl    %ecx,%edx
    1.22 +        andl    $0x0000FFFF,%edx
    1.23 +        orl     $(__HYPERVISOR_CS64<<16),%edx
    1.24 +        orq     %rdx,%rax
    1.25 +        shrq    $32,%rcx
    1.26 +        movl    %ecx,%edx
    1.27 +        leaq    idt_table(%rip),%rdi
    1.28 +        movl    $256,%ecx
    1.29 +1:      movq    %rax,(%rdi)
    1.30 +        movq    %rdx,8(%rdi)
    1.31 +        addq    $16,%rdi
    1.32          loop    1b
    1.33  
    1.34          /* Pass off the Multiboot info structure to C land. */
    1.35 @@ -167,15 +174,6 @@ 1:      mov     %eax,(%rdi)
    1.36          call    __start_xen
    1.37          ud2     /* Force a panic (invalid opcode). */
    1.38  
    1.39 -/* This is the default interrupt handler. */
    1.40 -int_msg:
    1.41 -        .asciz "Unknown interrupt\n"
    1.42 -ignore_int:
    1.43 -        cld
    1.44 -        lea     int_msg(%rip),%rdi
    1.45 -        call    SYMBOL_NAME(printf)
    1.46 -1:      jmp     1b
    1.47 -
    1.48          .code32
    1.49  
    1.50          .org    0x1e0
    1.51 @@ -250,5 +248,16 @@ ENTRY(idle_pg_table_l2)
    1.52  ENTRY(cpu0_stack)
    1.53  
    1.54          .org 0x4000 + STACK_SIZE
    1.55 +        .code64
    1.56  ENTRY(stext)
    1.57  ENTRY(_stext)
    1.58 +
    1.59 +/* This is the default interrupt handler. */
    1.60 +int_msg:
    1.61 +        .asciz "Unknown interrupt\n"
    1.62 +ignore_int:
    1.63 +        cld
    1.64 +        leaq    int_msg(%rip),%rdi
    1.65 +        call    SYMBOL_NAME(printf)
    1.66 +1:      jmp     1b
    1.67 +
     2.1 --- a/xen/arch/x86/traps.c	Thu Feb 17 04:57:18 2005 +0000
     2.2 +++ b/xen/arch/x86/traps.c	Thu Feb 17 05:37:46 2005 +0000
     2.3 @@ -68,7 +68,7 @@ char opt_nmi[10] = "fatal";
     2.4  string_param("nmi", opt_nmi);
     2.5  
     2.6  /* Master table, used by all CPUs on x86/64, and by CPU0 on x86/32.*/
     2.7 -idt_entry_t idt_table[IDT_ENTRIES] = { {0, 0}, };
     2.8 +idt_entry_t idt_table[IDT_ENTRIES];
     2.9  
    2.10  asmlinkage void divide_error(void);
    2.11  asmlinkage void debug(void);
    2.12 @@ -714,7 +714,14 @@ asmlinkage int do_spurious_interrupt_bug
    2.13  
    2.14  void set_intr_gate(unsigned int n, void *addr)
    2.15  {
    2.16 -    _set_gate(idt_table+n,14,0,addr);
    2.17 +#ifdef __i386__
    2.18 +    int i;
    2.19 +    /* Keep secondary tables in sync with IRQ updates. */
    2.20 +    for ( i = 1; i < NR_CPUS; i++ )
    2.21 +        if ( idt_tables[i] != NULL )
    2.22 +            _set_gate(&idt_tables[i][n], 14, 0, addr);
    2.23 +#endif
    2.24 +    _set_gate(&idt_table[n], 14, 0, addr);
    2.25  }
    2.26  
    2.27  void set_system_gate(unsigned int n, void *addr)