ia64/xen-unstable

changeset 14078:0a970a431bbc

[XEN] don't emulate stack operations on shadowed pages
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Feb 22 12:21:29 2007 +0000 (2007-02-22)
parents f62a052384a5
children 3f7e8c763b55
files xen/arch/x86/mm/shadow/multi.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/multi.c	Wed Feb 21 18:38:11 2007 -0800
     1.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Thu Feb 22 12:21:29 2007 +0000
     1.3 @@ -2902,7 +2902,23 @@ static int sh_page_fault(struct vcpu *v,
     1.4  
     1.5      if ( is_hvm_domain(d) )
     1.6          hvm_store_cpu_guest_regs(v, regs, NULL);
     1.7 -    SHADOW_PRINTK("emulate: eip=%#lx\n", (unsigned long)regs->eip);
     1.8 +    SHADOW_PRINTK("emulate: eip=%#lx esp=%#lx\n", 
     1.9 +                  (unsigned long)regs->eip, (unsigned long)regs->esp);
    1.10 +
    1.11 +    /* Check whether this looks like a stack operation. */
    1.12 +    if ( (va & PAGE_MASK) == (regs->esp & PAGE_MASK) )
    1.13 +    {
    1.14 +        /* Forcibly unshadow and return.  It's important to do this before
    1.15 +         * we emulate: if the faulting stack operation was the guest handling
    1.16 +         * an interrupt, then 
    1.17 +         * (a) the instruction at %eip is irrelevant; and
    1.18 +         * (b) we might inject some other fault and mask the real one */
    1.19 +        gdprintk(XENLOG_DEBUG, "guest stack is on a shadowed frame: "
    1.20 +                 "%%esp=%#lx, cr2=%#lx, mfn=%#lx\n", 
    1.21 +                 (unsigned long)regs->esp, va, mfn_x(gmfn));
    1.22 +        sh_remove_shadows(v, gmfn, 0 /* thorough */, 1 /* must succeed */);
    1.23 +        goto done;
    1.24 +    }
    1.25  
    1.26      emul_ops = shadow_init_emulation(&emul_ctxt, regs);
    1.27