WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: Allow exceptions to be handled while

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Allow exceptions to be handled while interrupts are
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 21 Feb 2007 04:30:10 -0800
Delivery-date: Wed, 21 Feb 2007 04:29:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1172052820 0
# Node ID bca284f67702cf46502809f29eb634e2ab6d294f
# Parent  2840b5e7f585ad20f3de72592ec5a0fcaa945ed6
x86: Allow exceptions to be handled while interrupts are
disabled. Handlers must take special care if necessary.
Fixes the debug 'd' key.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/traps.c        |   10 +++++++---
 xen/arch/x86/x86_32/entry.S |    4 ++--
 xen/arch/x86/x86_64/entry.S |    4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff -r 2840b5e7f585 -r bca284f67702 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Wed Feb 21 00:04:59 2007 +0000
+++ b/xen/arch/x86/traps.c      Wed Feb 21 10:13:40 2007 +0000
@@ -625,7 +625,8 @@ asmlinkage int do_invalid_op(struct cpu_
     if ( unlikely(!guest_mode(regs)) )
     {
         struct bug_frame bug;
-        if ( (__copy_from_user(&bug, (char *)regs->eip, sizeof(bug)) == 0) &&
+        if ( is_kernel(regs->eip) &&
+             (__copy_from_user(&bug, (char *)regs->eip, sizeof(bug)) == 0) &&
              (memcmp(bug.ud2, "\xf\xb",    sizeof(bug.ud2)) == 0) &&
              (memcmp(bug.mov, BUG_MOV_STR, sizeof(bug.mov)) == 0) &&
              (bug.ret == 0xc2) )
@@ -877,6 +878,9 @@ static int fixup_page_fault(unsigned lon
         return 0;
     }
 
+    ASSERT(!in_irq());
+    ASSERT(regs->eflags & X86_EFLAGS_IF);
+
     if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
          guest_kernel_mode(v, regs) &&
          /* Do not check if access-protection fault since the page may 
@@ -903,8 +907,6 @@ asmlinkage int do_page_fault(struct cpu_
 {
     unsigned long addr, fixup;
     int rc;
-
-    ASSERT(!in_irq());
 
     addr = read_cr2();
 
@@ -1916,6 +1918,8 @@ void unset_nmi_callback(void)
 
 asmlinkage int math_state_restore(struct cpu_user_regs *regs)
 {
+    BUG_ON(!guest_mode(regs));
+
     setup_fpu(current);
 
     if ( current->arch.guest_context.ctrlreg[0] & X86_CR0_TS )
diff -r 2840b5e7f585 -r bca284f67702 xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S       Wed Feb 21 00:04:59 2007 +0000
+++ b/xen/arch/x86/x86_32/entry.S       Wed Feb 21 10:13:40 2007 +0000
@@ -424,7 +424,7 @@ handle_exception:
         testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%esp)
         jz    exception_with_ints_disabled
         sti                             # re-enable interrupts
-        xorl  %eax,%eax
+1:      xorl  %eax,%eax
         movw  UREGS_entry_vector(%esp),%ax
         movl  %esp,%edx
         pushl %edx                      # push the cpu_user_regs pointer
@@ -451,7 +451,7 @@ exception_with_ints_disabled:
         call  search_pre_exception_table
         addl  $4,%esp
         testl %eax,%eax                 # no fixup code for faulting EIP?
-        jz    FATAL_exception_with_ints_disabled
+        jz    1b
         movl  %eax,UREGS_eip(%esp)
         movl  %esp,%esi
         subl  $4,%esp
diff -r 2840b5e7f585 -r bca284f67702 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S       Wed Feb 21 00:04:59 2007 +0000
+++ b/xen/arch/x86/x86_64/entry.S       Wed Feb 21 10:13:40 2007 +0000
@@ -362,7 +362,7 @@ ENTRY(handle_exception)
         testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%rsp)
         jz    exception_with_ints_disabled
         sti
-        movq  %rsp,%rdi
+1:      movq  %rsp,%rdi
         movl  UREGS_entry_vector(%rsp),%eax
         leaq  exception_table(%rip),%rdx
         GET_CURRENT(%rbx)
@@ -388,7 +388,7 @@ exception_with_ints_disabled:
         movq  %rsp,%rdi
         call  search_pre_exception_table
         testq %rax,%rax                 # no fixup code for faulting EIP?
-        jz    FATAL_exception_with_ints_disabled
+        jz    1b
         movq  %rax,UREGS_rip(%rsp)
         subq  $8,UREGS_rsp(%rsp)        # add ec/ev to previous stack frame
         testb $15,UREGS_rsp(%rsp)       # return %rsp is now aligned?

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Allow exceptions to be handled while interrupts are, Xen patchbot-unstable <=