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

[Xen-devel] [PATCH 5/6] mini-os/x86-64 entry: defer RESTORE_REST until return



No need to do a RESTORE_REST at this point because if we saw pending
events after we enabled event delivery, we have to do a SAVE_REST again.
Instead, we do a "lazy" RESTORE_REST, deferring it until immediate before
actual return.
The offset of saved-on-stack rflags register is changed as well.

Signed-off-by: Xu Zhang <xzhang@xxxxxxxxxx>
---
 extras/mini-os/arch/x86/x86_64.S |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/extras/mini-os/arch/x86/x86_64.S b/extras/mini-os/arch/x86/x86_64.S
index 5e0021b..25add86 100644
--- a/extras/mini-os/arch/x86/x86_64.S
+++ b/extras/mini-os/arch/x86/x86_64.S
@@ -60,7 +60,7 @@ NMI_MASK = 0x80000000
 
 #define RDI 112
 #define ORIG_RAX 120       /* + error_code */ 
-#define EFLAGS 144
+#define RFLAGS 144
 
 
 /* Macros */
@@ -184,18 +184,17 @@ ENTRY(hypervisor_callback2)
        decl %gs:0
 
 error_exit:
-       RESTORE_REST
-
 retint_kernel:
-retint_restore_args:
-       movl EFLAGS-6*8(%rsp), %eax
-       shr $9, %eax                    # EAX[0] == IRET_EFLAGS.IF
+       movl RFLAGS(%rsp), %eax
+       shr $9, %eax                    # EAX[0] == IRET_RFLAGS.IF
        XEN_GET_VCPU_INFO(%rsi)
        andb evtchn_upcall_mask(%rsi),%al
-       andb $1,%al                     # EAX[0] == IRET_EFLAGS.IF & event_mask
+       andb $1,%al                     # EAX[0] == IRET_RFLAGS.IF & event_mask
        jnz restore_all_enable_events   #        != 0 => enable event delivery
        XEN_PUT_VCPU_INFO(%rsi)
 
+retint_restore_args:
+       RESTORE_REST
        RESTORE_ALL
        HYPERVISOR_IRET 0
 
@@ -206,12 +205,13 @@ scrit:    /**** START OF CRITICAL REGION ****/
        XEN_TEST_PENDING(%rsi)
        jnz  14f                        # process more events if necessary...
        XEN_PUT_VCPU_INFO(%rsi)
+
+       RESTORE_REST
        RESTORE_ALL
        HYPERVISOR_IRET 0
 
 14:    XEN_LOCKED_BLOCK_EVENTS(%rsi)
        XEN_PUT_VCPU_INFO(%rsi)
-       SAVE_REST
        movq %rsp,%rdi                  # set the argument again
        jmp  11b
 ecrit:  /**** END OF CRITICAL REGION ****/
-- 
1.7.7.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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