direct-io.hg

changeset 14363:40a6e2280d7b

xen/x86: Tweak #PF handler. Simplify gdbstub copy to/from guest.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Mar 13 14:04:31 2007 +0000 (2007-03-13)
parents 8cd8e9e4e1ad
children 127bee61972b
files xen/arch/x86/gdbstub.c xen/arch/x86/traps.c
line diff
     1.1 --- a/xen/arch/x86/gdbstub.c	Tue Mar 13 13:28:26 2007 +0000
     1.2 +++ b/xen/arch/x86/gdbstub.c	Tue Mar 13 14:04:31 2007 +0000
     1.3 @@ -73,38 +73,16 @@ gdb_arch_read_reg(unsigned long regnum, 
     1.4  
     1.5  /* Like copy_from_user, but safe to call with interrupts disabled.
     1.6     Trust me, and don't look behind the curtain. */
     1.7 -unsigned 
     1.8 +unsigned int
     1.9  gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
    1.10  {
    1.11 -    int __d0, __d1, __d2;
    1.12 -    ASSERT(!local_irq_is_enabled());
    1.13 -    __asm__ __volatile__(
    1.14 -        "1: rep; movsb\n"
    1.15 -        "2:\n"
    1.16 -        ".section .fixup,\"ax\"\n"
    1.17 -        "3:     addl $4, %%esp\n"
    1.18 -        "       jmp 2b\n"
    1.19 -        ".previous\n"
    1.20 -        ".section __pre_ex_table,\"a\"\n"
    1.21 -        "   "__FIXUP_ALIGN"\n"
    1.22 -        "   "__FIXUP_WORD" 1b,3b\n"
    1.23 -        ".previous\n"
    1.24 -        ".section __ex_table,\"a\"\n"
    1.25 -        "   "__FIXUP_ALIGN"\n"
    1.26 -        "   "__FIXUP_WORD" 1b,2b\n"
    1.27 -        ".previous\n"
    1.28 -        : "=c"(__d2), "=D" (__d0), "=S" (__d1)
    1.29 -        : "0"(len), "1"(dest), "2"(src)
    1.30 -        : "memory");
    1.31 -    ASSERT(!local_irq_is_enabled());
    1.32 -    return __d2;
    1.33 +    return copy_from_user(dest, src, len);
    1.34  }
    1.35  
    1.36  unsigned int 
    1.37  gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
    1.38  {
    1.39 -    /* XXX  */
    1.40 -    return len;
    1.41 +    return copy_to_user(dest, src, len);
    1.42  }
    1.43  
    1.44  void 
     2.1 --- a/xen/arch/x86/traps.c	Tue Mar 13 13:28:26 2007 +0000
     2.2 +++ b/xen/arch/x86/traps.c	Tue Mar 13 14:04:31 2007 +0000
     2.3 @@ -905,6 +905,10 @@ static int fixup_page_fault(unsigned lon
     2.4      struct vcpu   *v = current;
     2.5      struct domain *d = v->domain;
     2.6  
     2.7 +    /* No fixups in interrupt context or when interrupts are disabled. */
     2.8 +    if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
     2.9 +        return 0;
    2.10 +
    2.11      if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
    2.12      {
    2.13          if ( paging_mode_external(d) && guest_mode(regs) )
    2.14 @@ -915,9 +919,6 @@ static int fixup_page_fault(unsigned lon
    2.15          return 0;
    2.16      }
    2.17  
    2.18 -    ASSERT(!in_irq());
    2.19 -    ASSERT(regs->eflags & X86_EFLAGS_IF);
    2.20 -
    2.21      if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
    2.22           guest_kernel_mode(v, regs) &&
    2.23           /* Do not check if access-protection fault since the page may