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.


moved svm_lowlevel.asm over to gas syntax in svm_lowlevel.S
[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
53 #elif __V3_64BIT__
54
55 #endif
56
57
58 v3_stgi:
59         stgi;
60         ret;
61
62 v3_clgi:
63         clgi;
64         ret;
65         
66         
67 v3_svm_launch:
68         push    %ebp;
69         movl    %esp, %ebp;
70         pushf;
71         push    %fs;
72         push    %gs;
73         pusha;
74
75         pushl   12(%ebp);
76         pushl   8(%ebp);
77
78         Restore_SVM_Registers(8(%esp));
79         popl    %eax;
80
81         vmload;
82         vmrun;
83         vmsave;
84
85         Save_SVM_Registers(4(%esp));
86
87         addl    $4, %esp;
88
89         popa;
90         pop     %gs;
91         pop     %fs;
92         popf;
93         pop     %ebp;
94         ret