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.


Initial revision
[palacios.git] / palacios / scripts / generate_vmcs_serialization.pl
1 #!/usr/bin/perl
2
3 $#ARGV==0 or die "gimme a filename\n";
4
5 $file=shift;
6
7 @list=();
8
9 open(HEADER,">$file.h");
10 open(SOURCE,">$file.c");
11
12 print HEADER "#ifndef $file\n#define $file\n#include <geekos/vmcs.h>\n";
13 print SOURCE "#include <geekos/$file.h>\n";
14
15 while (<STDIN>) {
16   if (/\#define\s+(\S+)\s+/) {
17     push @list, $1;
18     GenSerUnserCode($1);
19   }
20 }
21
22 GenPrintAllCode(@list);
23
24 print HEADER "#endif\n";
25
26 sub GenSerUnserCode {
27   my $name=shift;
28
29   print SOURCE <<END
30
31 void    Set_$name(uint_t val) { VMCS_WRITE($name,val); } 
32 uint_t  Get_$name() { uint_t rc; VMCS_READ($name,&rc); return rc; }
33
34 void    SerialPrint_$name() { SerialPrint("$name = %x\\n", Get_$name()); }
35
36 END
37
38 ;
39   print HEADER <<END2
40
41 void    Set_$name(uint_t val);
42 uint_t  Get_$name();
43
44 void    SerialPrint_$name();
45
46 END2
47
48 ;
49
50 }
51
52
53 sub GenPrintAllCode  {
54   print SOURCE "void SerialPrint_VMCS_ALL() {\n";
55   while (my $name=shift) { 
56     print SOURCE "  SerialPrint_$name();\n";
57   }
58   print SOURCE "}\n";
59   print HEADER "void SerialPrint_VMCS_ALL();\n";
60 }