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.


WTF??????
[palacios.git] / palacios / src / geekos / svm_lowlevel.asm
index 40bb8ea..fcb495f 100644 (file)
@@ -8,6 +8,12 @@
 %include "symbol.asm"
 
 
+EXPORT GetGDTR
+EXPORT GetIDTR
+
+
+
+EXTERN handle_svm_exit
 
 EXPORT launch_svm
 
@@ -27,16 +33,91 @@ EXPORT launch_svm
 
 
 
+
+GetGDTR:
+       push    ebp
+       mov     ebp, esp
+       pusha   
+       mov     ebx, [ebp + 8]
+       sgdt    [ebx]
+       
+       popa
+       pop     ebp
+       ret
+
+
+
+GetIDTR:
+       push    ebp
+       mov     ebp, esp
+       pusha   
+       mov     ebx, [ebp + 8]
+       sgdt    [ebx]
+       
+       popa
+       pop     ebp
+       ret
+
+
+
+; I think its safe to say that there are some pretty serious register issues...
 launch_svm:
        push    ebp
        mov     ebp, esp
        pusha
        
        mov     eax, [ebp + 8]
+       vmrun
+;      db      00fh, 001h, 0d8h
+       popa
+       pop     ebp
+       ret
+
+
+
+; eventual svm_launch
+;   pusha
+;   pushf
+;
+; .vmm_loop
 ;      vmrun
-       db      00fh, 001h, 0d8h
+;      push guest GPRs
+;      call handle_svm_exit
+;      jz .vmm_loop
+;  popf
+;  popa
+;  ret
+;
+;
+;
+
+
+
+;; Need to check this..
+;; Since RAX/EAX is saved in the VMCB, we should probably just 
+;;      do our own replacement for pusha/popa that excludes [e|r]ax
+safe_svm_launch:
+       push    ebp
+       mov     ebp, esp
+       pushf
+       pusha
+
+.vmm_loop:
+       mov     eax, [ebp + 8]
+       vmrun
+       pusha
+       call    handle_svm_exit
+       and     eax, eax
+       popa                    ;; restore the guest GPRs, (DOES THIS AFFECT E/RFLAGS?)
+       jz      .vmm_loop
+
+       ;; HOW DO WE GET THE RETURN VALUE OF HANDLE_SVM_EXIT BACK TO THE CALLER
+       popf
        popa
        pop     ebp
        ret
 
+
 %endif
+
+