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.


XEND instruction now correctly generates GPF when not in RTM mode
[palacios.git] / gears / services / mpi / hcall.h
1 #ifndef __HCALL__
2 #define __HCALL__
3
4 /*
5   Calling convention:
6
7 64 bit:
8   rax = hcall number
9   rbx = 0x6464646464646464...
10   rcx = 1st arg
11   rdx = 2nd arg
12   rsi = 3rd arg
13   rdi = 4th arg
14   r8  = 5th arg
15   r9  = 6th arg
16   r10 = 7th arg
17   r11 = 8th arg
18
19 32 bit:
20   eax = hcall number
21   ebx = 0x32323232
22   arguments on stack in C order (first argument is TOS)
23      arguments are also 32 bit
24 */
25 #define HCALL64(rc,id,a,b,c,d,e,f,g,h)                \
26   asm volatile ("movq %1, %%rax; "                    \
27                 "pushq %%rbx; "                       \
28                 "movq $0x6464646464646464, %%rbx; "   \
29                 "movq %2, %%rcx; "                    \
30                 "movq %3, %%rdx; "                    \
31                 "movq %4, %%rsi; "                    \
32                 "movq %5, %%rdi; "                    \
33                 "movq %6, %%r8 ; "                    \
34                 "movq %7, %%r9 ; "                    \
35                 "movq %8, %%r10; "                    \
36                 "movq %9, %%r11; "                    \
37                 "vmmcall ;       "                    \
38                 "movq %%rax, %0; "                    \
39                 "popq %%rbx; "                        \
40                 : "=m"(rc)                            \
41                 : "m"(id),                            \
42                   "m"(a), "m"(b), "m"(c), "m"(d),     \
43                   "m"(e), "m"(f), "m"(g), "m"(h)      \
44                 : "%rax","%rcx","%rdx","%rsi","%rdi", \
45                   "%r8","%r9","%r10","%r11"           \
46                 )
47
48 #define HCALL32(rc,id,a,b,c,d,e,f,g,h)                \
49   asm volatile ("movl %1, %%eax; "                    \
50                 "pushl %%ebx; "                       \
51                 "movl $0x32323232, %%ebx; "           \
52                 "pushl %9;"                           \
53                 "pushl %8;"                           \
54                 "pushl %7;"                           \
55                 "pushl %6;"                           \
56                 "pushl %5;"                           \
57                 "pushl %4;"                           \
58                 "pushl %3;"                           \
59                 "pushl %2;"                           \
60                 "vmmcall ;       "                    \
61                 "movl %%eax, %0; "                    \
62                 "addl $32, %%esp; "                   \
63                 "popl %%ebx; "                        \
64                 : "=r"(rc)                            \
65                 : "m"(id),                            \
66                   "m"(a), "m"(b), "m"(c), "m"(d),     \
67                 "m"(e), "m"(f), "m"(g), "m"(h)        \
68                 : "%eax"                              \
69                 )
70
71 #ifdef __x86_64__
72 #define HCALL(rc,id,a,b,c,d,e,f,g,h)  HCALL64(rc,id,a,b,c,d,e,f,g,h)
73 #else
74 #define HCALL(rc,id,a,b,c,d,e,f,g,h)  HCALL32(rc,id,a,b,c,d,e,f,g,h)   
75 #endif
76
77 #endif