2 Device File Virtualization Guest Preload Library Helpers
4 (c) Akhil Guliani and William Gross, 2015
6 Adapted from MPI module (c) 2012 Peter Dinda
8 Note that the calling convention here is a bit different
9 since we need to return errno
22 rbx = 0x6464646464646464...
35 arguments on stack in C order (first argument is TOS)
36 arguments are also 32 bit
39 RAX is assumed to be the return code from the system call
40 RBX is assumed to be the errno set by the system call
43 RBX comes back via overwrite of id
45 #define HCALL64(rc,id,a,b,c,d,e,f,g,h) \
46 asm volatile ("movq %1, %%rax; " \
48 "movq $0x6464646464646464, %%rbx; " \
62 : "m"(a), "m"(b), "m"(c), "m"(d), \
63 "m"(e), "m"(f), "m"(g), "m"(h) \
64 : "%rax","%rcx","%rdx","%rsi","%rdi", \
65 "%r8","%r9","%r10","%r11" \
68 #define HCALL32(rc,id,a,b,c,d,e,f,g,h) \
69 asm volatile ("movl %1, %%eax; " \
71 "movl $0x32323232, %%ebx; " \
85 : "=m"(rc), "=m"(id) \
86 : "m"(a), "m"(b), "m"(c), "m"(d), \
87 "m"(e), "m"(f), "m"(g), "m"(h) \
92 #define HCALL(rc,id,a,b,c,d,e,f,g,h) HCALL64(rc,id,a,b,c,d,e,f,g,h)
94 #define HCALL(rc,id,a,b,c,d,e,f,g,h) HCALL32(rc,id,a,b,c,d,e,f,g,h)