[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xen/x86: Tweak #PF handler. Simplify gdbstub copy to/from guest.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1173794671 0
# Node ID 40a6e2280d7b5f21e2f7540afd456cd3f2c14c76
# Parent  8cd8e9e4e1adab032e6da49824f36d392d5898cf
xen/x86: Tweak #PF handler. Simplify gdbstub copy to/from guest.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/gdbstub.c |   28 +++-------------------------
 xen/arch/x86/traps.c   |    7 ++++---
 2 files changed, 7 insertions(+), 28 deletions(-)

diff -r 8cd8e9e4e1ad -r 40a6e2280d7b xen/arch/x86/gdbstub.c
--- a/xen/arch/x86/gdbstub.c    Tue Mar 13 13:28:26 2007 +0000
+++ b/xen/arch/x86/gdbstub.c    Tue Mar 13 14:04:31 2007 +0000
@@ -73,38 +73,16 @@ gdb_arch_read_reg(unsigned long regnum, 
 
 /* Like copy_from_user, but safe to call with interrupts disabled.
    Trust me, and don't look behind the curtain. */
-unsigned 
+unsigned int
 gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
 {
-    int __d0, __d1, __d2;
-    ASSERT(!local_irq_is_enabled());
-    __asm__ __volatile__(
-        "1: rep; movsb\n"
-        "2:\n"
-        ".section .fixup,\"ax\"\n"
-        "3:     addl $4, %%esp\n"
-        "       jmp 2b\n"
-        ".previous\n"
-        ".section __pre_ex_table,\"a\"\n"
-        "   "__FIXUP_ALIGN"\n"
-        "   "__FIXUP_WORD" 1b,3b\n"
-        ".previous\n"
-        ".section __ex_table,\"a\"\n"
-        "   "__FIXUP_ALIGN"\n"
-        "   "__FIXUP_WORD" 1b,2b\n"
-        ".previous\n"
-        : "=c"(__d2), "=D" (__d0), "=S" (__d1)
-        : "0"(len), "1"(dest), "2"(src)
-        : "memory");
-    ASSERT(!local_irq_is_enabled());
-    return __d2;
+    return copy_from_user(dest, src, len);
 }
 
 unsigned int 
 gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
 {
-    /* XXX  */
-    return len;
+    return copy_to_user(dest, src, len);
 }
 
 void 
diff -r 8cd8e9e4e1ad -r 40a6e2280d7b xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Tue Mar 13 13:28:26 2007 +0000
+++ b/xen/arch/x86/traps.c      Tue Mar 13 14:04:31 2007 +0000
@@ -905,6 +905,10 @@ static int fixup_page_fault(unsigned lon
     struct vcpu   *v = current;
     struct domain *d = v->domain;
 
+    /* No fixups in interrupt context or when interrupts are disabled. */
+    if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) )
+        return 0;
+
     if ( unlikely(IN_HYPERVISOR_RANGE(addr)) )
     {
         if ( paging_mode_external(d) && guest_mode(regs) )
@@ -914,9 +918,6 @@ static int fixup_page_fault(unsigned lon
                 addr - GDT_LDT_VIRT_START, regs);
         return 0;
     }
-
-    ASSERT(!in_irq());
-    ASSERT(regs->eflags & X86_EFLAGS_IF);
 
     if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
          guest_kernel_mode(v, regs) &&

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.