debuggers.hg

changeset 21043:b8d2a4134a68

x86-64: fix hotplug fault handling for 32-bit domains' M2P range

- handle only when memory hotplug regions were actually found
- fix off-by-one error in fault handler's sanity checking
- use first L4 table entry

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 03 17:41:58 2010 +0000 (2010-03-03)
parents 401c0012b827
children fd6946ad6816
files xen/arch/x86/x86_64/mm.c
line diff
     1.1 --- a/xen/arch/x86/x86_64/mm.c	Wed Mar 03 17:40:48 2010 +0000
     1.2 +++ b/xen/arch/x86/x86_64/mm.c	Wed Mar 03 17:41:58 2010 +0000
     1.3 @@ -1213,12 +1213,9 @@ int pagefault_by_memadd(unsigned long ad
     1.4  {
     1.5      struct domain *d = current->domain;
     1.6  
     1.7 -    if (guest_mode(regs) &&
     1.8 -        is_pv_32bit_domain(d) &&
     1.9 -        ((addr >= HYPERVISOR_COMPAT_VIRT_START(d)) &&
    1.10 -             (addr < MACH2PHYS_COMPAT_VIRT_END)) )
    1.11 -            return 1;
    1.12 -    return 0;
    1.13 +    return mem_hotplug && guest_mode(regs) && is_pv_32bit_domain(d) &&
    1.14 +           (addr >= HYPERVISOR_COMPAT_VIRT_START(d)) &&
    1.15 +           (addr < MACH2PHYS_COMPAT_VIRT_END);
    1.16  }
    1.17  
    1.18  int handle_memadd_fault(unsigned long addr, struct cpu_user_regs *regs)
    1.19 @@ -1236,15 +1233,15 @@ int handle_memadd_fault(unsigned long ad
    1.20      if (!is_pv_32on64_domain(d))
    1.21          return 0;
    1.22  
    1.23 -    if ((addr < HYPERVISOR_COMPAT_VIRT_START(d)) ||
    1.24 -             (addr > MACH2PHYS_COMPAT_VIRT_END) )
    1.25 +    if ( (addr < HYPERVISOR_COMPAT_VIRT_START(d)) ||
    1.26 +         (addr >= MACH2PHYS_COMPAT_VIRT_END) )
    1.27          return 0;
    1.28  
    1.29      mfn = (read_cr3()) >> PAGE_SHIFT;
    1.30  
    1.31      pl4e = map_domain_page(mfn);
    1.32  
    1.33 -    l4e = pl4e[addr];
    1.34 +    l4e = pl4e[0];
    1.35  
    1.36      if (!(l4e_get_flags(l4e) & _PAGE_PRESENT))
    1.37          goto unmap;