10 SVM_ERROR equ 0xFFFFFFFF
11 SVM_SUCCESS equ 0x00000000
21 EXTERN handle_svm_exit
24 EXPORT safe_svm_launch
29 ;; These need to be kept similar with the svm return values in svm.h
30 SVM_HANDLER_SUCCESS equ 0x00
31 SVM_HANDLER_ERROR equ 0x1
32 SVM_HANDLER_HALT equ 0x2
37 ; Save and restore registers needed by SVM
38 %macro Save_SVM_Registers 1
44 mov [eax + 24], dword 0 ;; esp
51 mov [eax + 56], ebx ;; eax
58 %macro Restore_SVM_Registers 1
64 ;; mov esp, [eax + 24]
68 ;; mov eax, [eax + 56]
84 ;VMRUN equ db 0Fh, 01h, D8h
85 ;VMLOAD equ db 0x0F,0x01,0xDA
86 ;VMSAVE equ db 0x0F,0x01,0xDB
87 ;STGI equ db 0x0F,0x01,0xDC
88 ;CLGI equ db 0x0F,0x01,0xDD
139 ; I think its safe to say that there are some pretty serious register issues...
148 ; db 00fh, 001h, 0d8h
161 ;; Need to check this..
162 ;; save_svm_launch(rax, struct guest_gprs * regs)
168 pusha ;; Save Host state
171 push dword [ebp + 12] ;; pointer to the guest GPR save area
172 push dword [ebp + 8] ;; pointer to the VMCB pointer
174 ;; mov eax, [esp + 4] ;; mov guest GPR pointer to eax
176 Restore_SVM_Registers [esp + 4] ;; Restore Guest GPR state
177 pop eax ;; pop VMCB pointer into eax
183 ;; pop eax ;; pop Guest GPR pointer into eax
184 Save_SVM_Registers [esp] ;; save guest GPRs
186 add esp, 4 ;; skip past the gpr ptr
188 popa ;; Restore Host state