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

[Xen-changelog] [xen-unstable] svm: Simplify asm stub for vmentry/vmexit.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1178994144 -3600
# Node ID 65ce4866d20be1394f3c7f83f6451686d4be1fb0
# Parent  384a29655270532dfb6b07fe7c5b13ca0c1514ac
svm: Simplify asm stub for vmentry/vmexit.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/x86_32/exits.S |   28 ++++++---------------
 xen/arch/x86/hvm/svm/x86_64/exits.S |   46 +++++++++++++-----------------------
 2 files changed, 25 insertions(+), 49 deletions(-)

diff -r 384a29655270 -r 65ce4866d20b xen/arch/x86/hvm/svm/x86_32/exits.S
--- a/xen/arch/x86/hvm/svm/x86_32/exits.S       Sat May 12 19:04:35 2007 +0100
+++ b/xen/arch/x86/hvm/svm/x86_32/exits.S       Sat May 12 19:22:24 2007 +0100
@@ -31,26 +31,13 @@
         andl $~3,reg;            \
         movl (reg),reg;
 
-#define HVM_MONITOR_EFLAGS 0x202 /* IF on */
-#define NR_SKIPPED_REGS    7     /* Skip SS thru EAX */
-#define HVM_SAVE_ALL_NOSEGREGS                  \
-        pushl $HVM_MONITOR_EFLAGS;              \
-        popf;                                   \
-        subl $(NR_SKIPPED_REGS*4),%esp;         \
-        pushl %ebp;                             \
-        pushl %edi;                             \
-        pushl %esi;                             \
-        pushl %edx;                             \
-        pushl %ecx;                             \
-        pushl %ebx;
-
 #define VMRUN  .byte 0x0F,0x01,0xD8
 #define STGI   .byte 0x0F,0x01,0xDC
 #define CLGI   .byte 0x0F,0x01,0xDD
 
 ENTRY(svm_asm_do_resume)
         GET_CURRENT(%ebx)
-        cli                             # tests must not race interrupts
+        CLGI
         movl VCPU_processor(%ebx),%eax
         shl  $IRQSTAT_shift,%eax
         testl $~0,irq_stat(%eax,1)
@@ -58,9 +45,6 @@ ENTRY(svm_asm_do_resume)
         call svm_intr_assist
         call svm_load_cr2
 
-        CLGI                
-        sti
-        GET_CURRENT(%ebx)
         movl VCPU_svm_vmcb(%ebx),%ecx
         movl UREGS_eax(%esp),%eax
         movl %eax,VMCB_rax(%ecx)
@@ -72,11 +56,15 @@ ENTRY(svm_asm_do_resume)
         popl %esi
         popl %edi
         popl %ebp
-        addl $(NR_SKIPPED_REGS*4),%esp
 
         VMRUN
 
-        HVM_SAVE_ALL_NOSEGREGS
+        pushl %ebp
+        pushl %edi
+        pushl %esi
+        pushl %edx
+        pushl %ecx
+        pushl %ebx
 
         GET_CURRENT(%ebx)
         movb $0,VCPU_svm_vmcb_in_sync(%ebx)
@@ -95,6 +83,6 @@ svm_stgi_label:
 
         ALIGN
 svm_process_softirqs:
-        sti       
+        STGI
         call do_softirq
         jmp  svm_asm_do_resume
diff -r 384a29655270 -r 65ce4866d20b xen/arch/x86/hvm/svm/x86_64/exits.S
--- a/xen/arch/x86/hvm/svm/x86_64/exits.S       Sat May 12 19:04:35 2007 +0100
+++ b/xen/arch/x86/hvm/svm/x86_64/exits.S       Sat May 12 19:22:24 2007 +0100
@@ -31,35 +31,13 @@
         andq $~7,reg;            \
         movq (reg),reg;
 
-#define HVM_MONITOR_RFLAGS 0x202 /* IF on */
-#define NR_SKIPPED_REGS    6     /* Skip SS thru error_code */
-#define HVM_SAVE_ALL_NOSEGREGS                  \
-        pushq $HVM_MONITOR_RFLAGS;              \
-        popfq;                                  \
-        subq $(NR_SKIPPED_REGS*8),%rsp;         \
-        pushq %rdi;                             \
-        pushq %rsi;                             \
-        pushq %rdx;                             \
-        pushq %rcx;                             \
-        pushq %rax;                             \
-        pushq %r8;                              \
-        pushq %r9;                              \
-        pushq %r10;                             \
-        pushq %r11;                             \
-        pushq %rbx;                             \
-        pushq %rbp;                             \
-        pushq %r12;                             \
-        pushq %r13;                             \
-        pushq %r14;                             \
-        pushq %r15;
-
 #define VMRUN  .byte 0x0F,0x01,0xD8
 #define STGI   .byte 0x0F,0x01,0xDC
 #define CLGI   .byte 0x0F,0x01,0xDD
 
 ENTRY(svm_asm_do_resume)
         GET_CURRENT(%rbx)
-        cli                             # tests must not race interrupts
+        CLGI
         movl VCPU_processor(%rbx),%eax
         shl  $IRQSTAT_shift,%rax
         leaq irq_stat(%rip),%rdx
@@ -68,9 +46,6 @@ ENTRY(svm_asm_do_resume)
         call svm_intr_assist
         call svm_load_cr2
 
-        CLGI                
-        sti
-        GET_CURRENT(%rbx)
         movq VCPU_svm_vmcb(%rbx),%rcx
         movq UREGS_rax(%rsp),%rax
         movq %rax,VMCB_rax(%rcx)
@@ -91,11 +66,24 @@ ENTRY(svm_asm_do_resume)
         popq %rdx
         popq %rsi
         popq %rdi
-        addq $(NR_SKIPPED_REGS*8),%rsp
 
         VMRUN
 
-        HVM_SAVE_ALL_NOSEGREGS
+        pushq %rdi
+        pushq %rsi
+        pushq %rdx
+        pushq %rcx
+        pushq %rax
+        pushq %r8
+        pushq %r9
+        pushq %r10
+        pushq %r11
+        pushq %rbx
+        pushq %rbp
+        pushq %r12
+        pushq %r13
+        pushq %r14
+        pushq %r15
 
         GET_CURRENT(%rbx)
         movb $0,VCPU_svm_vmcb_in_sync(%rbx)
@@ -112,6 +100,6 @@ svm_stgi_label:
 
         ALIGN
 svm_process_softirqs:
-        sti
+        STGI
         call do_softirq
         jmp  svm_asm_do_resume

_______________________________________________
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®.