bitkeeper revision 1.891.1.17 (40a3a57esEQK6wY-v_0LLZhFK4ZGUA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 13 May 2004 16:42:38 +0000 (16:42 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 13 May 2004 16:42:38 +0000 (16:42 +0000)
Now the Xen exit code is totally fixed!

xen/arch/i386/entry.S

index 4e9163a75dc725d4134cebc1c547b5b7ff0afaec..1d55a51617dbafc1ece3fb30062195a6c4245322 100644 (file)
@@ -247,10 +247,6 @@ restore_all_guest:
         movsl
         movsl
         movsl
-        # Third, reenable interrupts. They will definitely be reenabled by IRET
-        # in any case. They could be disabled here if we are returning from an
-        # interrupt. We need interrupts enabled if we take a fault.
-        sti
         # Finally, restore guest registers -- faults will cause failsafe
         popl %ebx
        popl %ecx
@@ -541,11 +537,14 @@ error_code:
        movl  %edx,%es
        movl  %edx,%fs
        movl  %edx,%gs
-       movl  EFLAGS(%esp),%edx
-       testl $0x200,%edx               # Is IF asserted in saved EFLAGS?
-       jz    1f                        # Don't STI if it isn't.
+        # We force a STI here. In most cases it is illegal to fault with
+        # interrupts disabled, so no need to check EFLAGS. There is one
+        # case when it /is/ valid -- on final return to guest context, we
+        # CLI so we can atomically check for events to notify guest about and
+        # return, all in one go. If we fault it is necessary to STI and the
+        # worst that will happen is that our return code is no longer atomic.
+        # This will do -- noone will ever notice. :-)
        sti
-1:     movl  %esp,%edx
        pushl %esi                      # push the error code
        pushl %edx                      # push the pt_regs pointer
        GET_CURRENT(%ebx)