Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


bug fix for 32 bit ebp cloberring
[palacios.git] / palacios / src / palacios / svm_lowlevel.S
index 0d5e870..45c5575 100644 (file)
@@ -22,6 +22,8 @@
 
 #ifdef __V3_32BIT__
 
+// Note that RAX is saved in the VMCB, so we don't touch it here
+
 #define Save_SVM_Registers(location)   \
        pushl   %eax;                   \
        movl    location, %eax;         \
        movl    %ebx, 32(%eax);         \
        movl    %edx, 40(%eax);         \
        movl    %ecx, 48(%eax);         \
-       pushl   %ebx;                   \
-       movl    8(%esp), %ebx;          \
-       movl    %ebx, 56(%eax);         \
-       popl    %ebx;                   \
        popl    %eax;                   
        
 
@@ -76,12 +74,15 @@ v3_svm_launch:
 
        addl    $4, %esp;
 
+       popa;
+       popf;
 
        movl    16(%ebp), %eax;
        vmload;
 
-       popa;
-       popf;
+       // We don't detect failures here, so just return 0
+       xorl    %eax, %eax 
+
        pop     %ebp;
        ret
 
@@ -89,6 +90,8 @@ v3_svm_launch:
 
 #elif __V3_64BIT__
 
+// Note that RAX is saved in the VMCB, so we don't touch it here
+
 #define Save_SVM_Registers(location)   \
        pushq   %rax;                   \
        movq    location, %rax;         \
@@ -99,10 +102,6 @@ v3_svm_launch:
        movq    %rbx, 32(%rax);         \
        movq    %rdx, 40(%rax);         \
        movq    %rcx, 48(%rax);         \
-       pushq   %rbx;                   \
-       movq    16(%rsp), %rbx;         \
-       movq    %rbx, 56(%rax);         \
-       popq    %rbx;                   \
                                        \
        movq    %r8, 64(%rax);          \
        movq    %r9, 72(%rax);          \