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.


Device File Virtualization Proof of Concept (Kernel+Preload)
[palacios.git] / gears / services / devfile / scripts / syscall_arr.py
1 import bs4
2
3 #http://blog.rchapman.org/post/36801038863/linux-system-call-table-for-x86-64
4
5 def fd_arr():
6         ff = open('syscalltable.txt','r')
7         soup = bs4.BeautifulSoup(ff.read())
8         ff.close()
9         ff = open('sys_fd_arr.h','w')
10         
11         len_list = len(list(soup.find_all('tr')))
12         ff.write('int sys_pointer_arr[323] = {\n')
13         for (i,row) in enumerate(list(soup.find_all('tr'))):
14                 print str(row.find('td'))[4:len(str(row.find('td')))-5]
15                 
16                 if len(list(row.find_all('td')))>0:
17                         candidate = -1
18                         for (j,ele) in enumerate(list(row.find_all('td'))[2::]):
19                                 inner = str(ele)[4:len(str(ele))-5]
20                                 inner_split = inner.split()
21                                 for inn in inner_split:
22                                         if 'fd' in inn:
23                                                 print inner
24                                                 candidate = j
25                         if i>=len_list-1:
26                                 ff.write(str(candidate)+'\n')
27                         else:
28                                 ff.write(str(candidate)+',\n')
29         ff.write('};\n')
30         ff.close()
31         return
32
33 def main():
34         ff = open('syscalltable.txt','r')
35         soup = bs4.BeautifulSoup(ff.read())
36         ff.close()
37         ff = open('sys_point_arr.h','w')
38         
39         len_list = len(list(soup.find_all('tr')))
40         ff.write('int sys_pointer_arr[323] = {\n')
41         for (i,row) in enumerate(list(soup.find_all('tr'))):
42                 print str(row.find('td'))[4:len(str(row.find('td')))-5]
43                 bit_vec = ''
44                 if len(list(row.find_all('td')))>0:
45                         for ele in list(row.find_all('td'))[2::]:
46                                 inner = str(ele)[4:len(str(ele))-5]
47                                 if '*' in inner:
48                                         bit_vec+= '1'
49                                 elif '' == inner:
50                                         bit_vec+= '0'
51                                 else:
52                                         bit_vec+= '0'
53                         bit_vec+='00'
54                         print bit_vec[::-1]
55                         print int(bit_vec[::-1],2)
56                         if i>=len_list-1:
57                                 ff.write(str(int(bit_vec[::-1],2))+'\n')
58                         else:
59                                 ff.write(str(int(bit_vec[::-1],2))+',\n')
60         ff.write('};\n')
61         ff.close()
62         return
63
64
65 if __name__ == "__main__":
66     main()