19 EXTERN handle_svm_exit
22 EXPORT safe_svm_launch
25 ;; These need to be kept similar with the svm return values in svm.h
26 SVM_HANDLER_SUCCESS equ 0x00
27 SVM_HANDLER_ERROR equ 0x1
28 SVM_HANDLER_HALT equ 0x2
33 ; Save and restore registers needed by SVM
34 %macro Save_SVM_Registers 1
44 %macro Restore_SVM_Registers 1
65 ;VMRUN equ db 0Fh, 01h, D8h
66 ;VMLOAD equ db 0x0F,0x01,0xDA
67 ;VMSAVE equ db 0x0F,0x01,0xDB
68 ;STGI equ db 0x0F,0x01,0xDC
69 ;CLGI equ db 0x0F,0x01,0xDD
120 ; I think its safe to say that there are some pretty serious register issues...
129 ; db 00fh, 001h, 0d8h
142 ;; Need to check this..
143 ;; save_svm_launch(rax, struct guest_gprs * regs)
149 pusha ;; Save Host state
152 push dword [ebp + 12] ;; pointer to the guest GPR save area
153 push dword [ebp + 8] ;; pointer to the VMCB pointer
155 mov eax, [esp + 4] ;; mov guest GPR pointer to eax
157 Restore_SVM_Registers eax ;; Restore Guest GPR state
158 pop eax ;; pop VMCB pointer into eax
164 pop eax ;; pop Guest GPR pointer into eax
165 Save_SVM_Registers eax ;; save guest GPRs
167 popa ;; Restore Host state
186 ; call handle_svm_exit
188 ; mov [ebp + 12], eax
192 ; Restore_SVM_Registers