X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm_lowlevel.S;h=ac11b36d19cf5cee70c7f3c68043405a7933a2e8;hp=975fe9891deb2bb8a2c9c1ef5980a2abcf4de839;hb=6ce5a308d167ac392c0f0ca66811f51580358191;hpb=62786ba1c9a264dfd00aa705f62bd65b5b0e7bb0 diff --git a/palacios/src/palacios/svm_lowlevel.S b/palacios/src/palacios/svm_lowlevel.S index 975fe98..ac11b36 100644 --- a/palacios/src/palacios/svm_lowlevel.S +++ b/palacios/src/palacios/svm_lowlevel.S @@ -18,6 +18,9 @@ #define clgi .byte 0x0F,0x01,0xDD +#define SVM_VM_HSAVE_PA_MSR .dword 0xc0010117 + + #ifdef __V3_32BIT__ #define Save_SVM_Registers(location) \ @@ -49,14 +52,17 @@ popl %eax; +// 32 bit GCC passes arguments via stack + v3_svm_launch: push %ebp; movl %esp, %ebp; pushf; - push %fs; - push %gs; pusha; + movl 16(%ebp), %eax; + vmsave; + pushl 12(%ebp); pushl 8(%ebp); @@ -71,9 +77,11 @@ v3_svm_launch: addl $4, %esp; + + movl 16(%ebp), %eax; + vmload; + popa; - pop %gs; - pop %fs; popf; pop %ebp; ret @@ -156,29 +164,19 @@ v3_svm_launch: popq %rbx; \ popq %rbp; + +// Note that this is only for 64 bit GCC, 32 bit GCC passes via stack // VMCB => RDI // vm_regs => RSI -// ptr to fs => RDX -// ptr to gs => RCX +// HOST VMCB => RDX v3_svm_launch: pushf; - push %fs; - push %gs; PUSHA - - - -// pushq %rdx // fs -// pushq %rcx // gs - - -// pushq (%rdx) -// pop %fs -// pushq (%rcx) -// pop %gs - - + + pushq %rdx; + movq %rdx, %rax; + vmsave; pushq %rsi @@ -195,21 +193,11 @@ v3_svm_launch: addq $8, %rsp -// popq %rcx -// popq %rdx - -// push %fs -// popq %rax -// movq %rax, (%rdx) - -// push %gs -// popq %rax -// movq %rax, (%rcx) + popq %rax; + vmload; POPA - pop %gs; - pop %fs; popf; ret