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.


updated assembly to build in 64 bit mode
[palacios.git] / palacios / src / palacios / svm_lowlevel.S
1 #;  -*- fundamental -*-
2
3
4 .text
5 .align 4
6
7 .globl v3_svm_launch
8 .globl v3_stgi
9 .globl v3_clgi
10
11 #define SVM_ERROR .dword 0xffffffff
12 #define SVM_SUCCESS .dword 0x00000000
13
14 #define vmrun .byte 0x0f,0x01,0xd8
15 #define vmload .byte 0x0F,0x01,0xDA
16 #define vmsave .byte 0x0F,0x01,0xDB
17 #define stgi   .byte 0x0F,0x01,0xDC
18 #define clgi   .byte 0x0F,0x01,0xDD
19
20
21 #ifdef __V3_32BIT__
22
23 #define Save_SVM_Registers(location)    \
24         pushl   %eax;                   \
25         movl    location, %eax;         \
26         movl    %edi, (%eax);           \
27         movl    %esi, 8(%eax);          \
28         movl    %ebp, 16(%eax);         \
29         movl    $0, 24(%eax);           \
30         movl    %ebx, 32(%eax);         \
31         movl    %edx, 40(%eax);         \
32         movl    %ecx, 48(%eax);         \
33         pushl   %ebx;                   \
34         movl    4(%esp), %ebx;          \
35         movl    %ebx, 56(%eax);         \
36         popl    %ebx;                   \
37         popl    %eax;                   
38         
39
40 #define Restore_SVM_Registers(location) \
41         pushl   %eax;                   \
42         movl    location, %eax;         \
43         movl    (%eax), %edi;           \
44         movl    8(%eax), %esi;          \
45         movl    16(%eax), %ebp;         \
46         movl    32(%eax), %ebx;         \
47         movl    40(%eax), %edx;         \
48         movl    48(%eax), %ecx;         \
49         popl    %eax;
50
51
52 v3_svm_launch:
53         push    %ebp;
54         movl    %esp, %ebp;
55         pushf;
56         push    %fs;
57         push    %gs;
58         pusha;
59
60         pushl   12(%ebp);
61         pushl   8(%ebp);
62
63         Restore_SVM_Registers(8(%esp));
64         popl    %eax;
65
66         vmload;
67         vmrun;
68         vmsave;
69
70         Save_SVM_Registers(4(%esp));
71
72         addl    $4, %esp;
73
74         popa;
75         pop     %gs;
76         pop     %fs;
77         popf;
78         pop     %ebp;
79         ret
80
81
82
83 #elif __V3_64BIT__
84
85 #define Save_SVM_Registers(location)    \
86         pushl   %eax;                   \
87         movl    location, %eax;         \
88         movl    %edi, (%eax);           \
89         movl    %esi, 8(%eax);          \
90         movl    %ebp, 16(%eax);         \
91         movl    $0, 24(%eax);           \
92         movl    %ebx, 32(%eax);         \
93         movl    %edx, 40(%eax);         \
94         movl    %ecx, 48(%eax);         \
95         pushl   %ebx;                   \
96         movl    4(%esp), %ebx;          \
97         movl    %ebx, 56(%eax);         \
98         popl    %ebx;                   \
99         popl    %eax;                   
100         
101
102 #define Restore_SVM_Registers(location) \
103         pushl   %eax;                   \
104         movl    location, %eax;         \
105         movl    (%eax), %edi;           \
106         movl    8(%eax), %esi;          \
107         movl    16(%eax), %ebp;         \
108         movl    32(%eax), %ebx;         \
109         movl    40(%eax), %edx;         \
110         movl    48(%eax), %ecx;         \
111         popl    %eax;
112
113
114
115 v3_svm_launch:
116
117         ret
118
119
120 #endif
121
122
123 v3_stgi:
124         stgi;
125         ret;
126
127 v3_clgi:
128         clgi;
129         ret;
130         
131