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.


Added memory ranges
[palacios.git] / palacios / src / geekos / svm_lowlevel.asm
1 ;  -*- fundamental -*-
2
3
4 %ifndef SVM_ASM
5 %define SVM_ASM
6
7 %include "defs.asm"
8 %include "symbol.asm"
9
10
11
12 EXTERN handle_svm_exit
13
14 EXPORT launch_svm
15
16
17 [BITS 32]
18
19 %macro vmrun 0
20         db      00fh, 001h, 0d8h
21 %endmacro
22
23
24 ;VMRUN  equ db 0Fh, 01h, D8h
25 ;VMLOAD equ db 0x0F,0x01,0xDA
26 ;VMSAVE equ db 0x0F,0x01,0xDB
27 ;STGI   equ db 0x0F,0x01,0xDC
28 ;CLGI   equ db 0x0F,0x01,0xDD
29
30
31
32
33 ; I think its safe to say that there are some pretty serious register issues...
34 launch_svm:
35         push    ebp
36         mov     ebp, esp
37         pusha
38         
39         mov     eax, [ebp + 8]
40         vmrun
41 ;       db      00fh, 001h, 0d8h
42         popa
43         pop     ebp
44         ret
45
46 %endif
47
48
49
50
51 ; eventual svm_launch
52 ;   pusha
53 ;   pushf
54 ;
55 ; .vmm_loop
56 ;       vmrun
57 ;       push guest GPRs
58 ;       call handle_svm_exit
59 ;       jz .vmm_loop
60 ;  popf
61 ;  popa
62 ;  ret
63 ;
64 ;
65 ;
66
67
68
69 ;; Need to check this..
70 ;; Since RAX/EAX is saved in the VMCB, we should probably just 
71 ;;      do our own replacement for pusha/popa that excludes [e|r]ax
72 safe_svm_launch:
73         push    ebp
74         mov     ebp, esp
75         pushf
76         pusha
77
78 .vmm_loop:
79         mov     eax, [ebp + 8]
80         vmrun
81         pusha
82         call    handle_svm_exit
83         and     eax, eax
84         popa                    ;; restore the guest GPRs, (DOES THIS AFFECT E/RFLAGS?)
85         jz      .vmm_loop
86
87         ;; HOW DO WE GET THE RETURN VALUE OF HANDLE_SVM_EXIT BACK TO THE CALLER
88         popf
89         popa
90         pop     ebp
91         ret