ia64/xen-unstable

changeset 16977:99b8ffe25088

x86: adjust reserved bit page fault handling
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 04 13:57:01 2008 +0000 (2008-02-04)
parents 7e6a705e8ec5
children 0695363214c3 32e9c52fc6d9
files xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/traps.c	Mon Feb 04 13:51:17 2008 +0000
     1.2 +++ b/xen/arch/x86/traps.c	Mon Feb 04 13:57:01 2008 +0000
     1.3 @@ -823,6 +823,15 @@ asmlinkage void do_machine_check(struct 
     1.4      machine_check_vector(regs, regs->error_code);
     1.5  }
     1.6  
     1.7 +static void reserved_bit_page_fault(
     1.8 +    unsigned long addr, struct cpu_user_regs *regs)
     1.9 +{
    1.10 +    printk("d%d:v%d: reserved bit in page table (ec=%04X)\n",
    1.11 +           current->domain->domain_id, current->vcpu_id, regs->error_code);
    1.12 +    show_page_walk(addr);
    1.13 +    show_execution_state(regs);
    1.14 +}
    1.15 +
    1.16  void propagate_page_fault(unsigned long addr, u16 error_code)
    1.17  {
    1.18      struct trap_info *ti;
    1.19 @@ -848,10 +857,13 @@ void propagate_page_fault(unsigned long 
    1.20          tb->flags |= TBF_INTERRUPT;
    1.21      if ( unlikely(null_trap_bounce(v, tb)) )
    1.22      {
    1.23 -        printk("Unhandled page fault in domain %d on VCPU %d (ec=%04X)\n",
    1.24 +        printk("d%d:v%d: unhandled page fault (ec=%04X)\n",
    1.25                 v->domain->domain_id, v->vcpu_id, error_code);
    1.26          show_page_walk(addr);
    1.27      }
    1.28 +
    1.29 +    if ( unlikely(error_code & PFEC_reserved_bit) )
    1.30 +        reserved_bit_page_fault(addr, guest_cpu_user_regs());
    1.31  }
    1.32  
    1.33  static int handle_gdt_ldt_mapping_fault(
    1.34 @@ -1047,7 +1059,8 @@ static int fixup_page_fault(unsigned lon
    1.35                  trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr);
    1.36              return ret;
    1.37          }
    1.38 -        if ( (addr >= GDT_LDT_VIRT_START) && (addr < GDT_LDT_VIRT_END) )
    1.39 +        if ( !(regs->error_code & PFEC_reserved_bit) &&
    1.40 +             (addr >= GDT_LDT_VIRT_START) && (addr < GDT_LDT_VIRT_END) )
    1.41              return handle_gdt_ldt_mapping_fault(
    1.42                  addr - GDT_LDT_VIRT_START, regs);
    1.43          return 0;
    1.44 @@ -1057,7 +1070,8 @@ static int fixup_page_fault(unsigned lon
    1.45           guest_kernel_mode(v, regs) &&
    1.46           /* Do not check if access-protection fault since the page may 
    1.47              legitimately be not present in shadow page tables */
    1.48 -         ((regs->error_code & PFEC_write_access) == PFEC_write_access) &&
    1.49 +         ((regs->error_code & (PFEC_write_access|PFEC_reserved_bit)) ==
    1.50 +          PFEC_write_access) &&
    1.51           ptwr_do_page_fault(v, addr, regs) )
    1.52          return EXCRET_fault_fixed;
    1.53  
    1.54 @@ -1101,6 +1115,8 @@ asmlinkage void do_page_fault(struct cpu
    1.55          if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
    1.56          {
    1.57              perfc_incr(copy_user_faults);
    1.58 +            if ( unlikely(regs->error_code & PFEC_reserved_bit) )
    1.59 +                reserved_bit_page_fault(addr, regs);
    1.60              regs->eip = fixup;
    1.61              return;
    1.62          }