ia64/xen-unstable

changeset 16713:973221f4d9c7

x86: INT3 and INTO trap gates should have DPL==3.
This was broken by c/s 16667 (gdbstub changes).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 15 11:29:15 2008 +0000 (2008-01-15)
parents 45d16899a21d
children 235bef53d5bd b6cc74f275fd
files xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/traps.c	Sun Jan 13 10:50:18 2008 +0000
     1.2 +++ b/xen/arch/x86/traps.c	Tue Jan 15 11:29:15 2008 +0000
     1.3 @@ -2679,14 +2679,24 @@ asmlinkage void do_spurious_interrupt_bu
     1.4  {
     1.5  }
     1.6  
     1.7 -void set_intr_gate(unsigned int n, void *addr)
     1.8 +static void __set_intr_gate(unsigned int n, uint32_t dpl, void *addr)
     1.9  {
    1.10      int i;
    1.11      /* Keep secondary tables in sync with IRQ updates. */
    1.12      for ( i = 1; i < NR_CPUS; i++ )
    1.13          if ( idt_tables[i] != NULL )
    1.14 -            _set_gate(&idt_tables[i][n], 14, 0, addr);
    1.15 -    _set_gate(&idt_table[n], 14, 0, addr);
    1.16 +            _set_gate(&idt_tables[i][n], 14, dpl, addr);
    1.17 +    _set_gate(&idt_table[n], 14, dpl, addr);
    1.18 +}
    1.19 +
    1.20 +static void set_swint_gate(unsigned int n, void *addr)
    1.21 +{
    1.22 +    __set_intr_gate(n, 3, addr);
    1.23 +}
    1.24 +
    1.25 +void set_intr_gate(unsigned int n, void *addr)
    1.26 +{
    1.27 +    __set_intr_gate(n, 0, addr);
    1.28  }
    1.29  
    1.30  void set_tss_desc(unsigned int n, void *addr)
    1.31 @@ -2753,8 +2763,8 @@ void __init trap_init(void)
    1.32      set_intr_gate(TRAP_divide_error,&divide_error);
    1.33      set_intr_gate(TRAP_debug,&debug);
    1.34      set_intr_gate(TRAP_nmi,&nmi);
    1.35 -    set_intr_gate(TRAP_int3,&int3);         /* usable from all privileges */
    1.36 -    set_intr_gate(TRAP_overflow,&overflow); /* usable from all privileges */
    1.37 +    set_swint_gate(TRAP_int3,&int3);         /* usable from all privileges */
    1.38 +    set_swint_gate(TRAP_overflow,&overflow); /* usable from all privileges */
    1.39      set_intr_gate(TRAP_bounds,&bounds);
    1.40      set_intr_gate(TRAP_invalid_op,&invalid_op);
    1.41      set_intr_gate(TRAP_no_device,&device_not_available);