debuggers.hg

view xen/include/asm-x86/multicall.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents c0662cb08260
children
line source
1 /******************************************************************************
2 * asm-x86/multicall.h
3 */
5 #ifndef __ASM_X86_MULTICALL_H__
6 #define __ASM_X86_MULTICALL_H__
8 #include <xen/errno.h>
10 #ifdef __x86_64__
12 #define do_multicall_call(_call) \
13 do { \
14 __asm__ __volatile__ ( \
15 " movq %c1(%0),%%rax; " \
16 " leaq hypercall_table(%%rip),%%rdi; " \
17 " cmpq $("STR(NR_hypercalls)"),%%rax; " \
18 " jae 2f; " \
19 " movq (%%rdi,%%rax,8),%%rax; " \
20 " movq %c2+0*%c3(%0),%%rdi; " \
21 " movq %c2+1*%c3(%0),%%rsi; " \
22 " movq %c2+2*%c3(%0),%%rdx; " \
23 " movq %c2+3*%c3(%0),%%rcx; " \
24 " movq %c2+4*%c3(%0),%%r8; " \
25 " movq %c2+5*%c3(%0),%%r9; " \
26 " callq *%%rax; " \
27 "1: movq %%rax,%c4(%0)\n" \
28 ".section .fixup,\"ax\"\n" \
29 "2: movq $-"STR(ENOSYS)",%%rax\n" \
30 " jmp 1b\n" \
31 ".previous\n" \
32 : \
33 : "b" (_call), \
34 "i" (offsetof(__typeof__(*_call), op)), \
35 "i" (offsetof(__typeof__(*_call), args)), \
36 "i" (sizeof(*(_call)->args)), \
37 "i" (offsetof(__typeof__(*_call), result)) \
38 /* all the caller-saves registers */ \
39 : "rax", "rcx", "rdx", "rsi", "rdi", \
40 "r8", "r9", "r10", "r11" ); \
41 } while ( 0 )
43 #define compat_multicall_call(_call) \
44 __asm__ __volatile__ ( \
45 " movl %c1(%0),%%eax; " \
46 " leaq compat_hypercall_table(%%rip),%%rdi; "\
47 " cmpl $("STR(NR_hypercalls)"),%%eax; " \
48 " jae 2f; " \
49 " movq (%%rdi,%%rax,8),%%rax; " \
50 " movl %c2+0*%c3(%0),%%edi; " \
51 " movl %c2+1*%c3(%0),%%esi; " \
52 " movl %c2+2*%c3(%0),%%edx; " \
53 " movl %c2+3*%c3(%0),%%ecx; " \
54 " movl %c2+4*%c3(%0),%%r8d; " \
55 " movl %c2+5*%c3(%0),%%r9d; " \
56 " callq *%%rax; " \
57 "1: movl %%eax,%c4(%0)\n" \
58 ".section .fixup,\"ax\"\n" \
59 "2: movl $-"STR(ENOSYS)",%%eax\n" \
60 " jmp 1b\n" \
61 ".previous\n" \
62 : \
63 : "b" (_call), \
64 "i" (offsetof(__typeof__(*_call), op)), \
65 "i" (offsetof(__typeof__(*_call), args)), \
66 "i" (sizeof(*(_call)->args)), \
67 "i" (offsetof(__typeof__(*_call), result)) \
68 /* all the caller-saves registers */ \
69 : "rax", "rcx", "rdx", "rsi", "rdi", \
70 "r8", "r9", "r10", "r11" ) \
72 #else
74 #define do_multicall_call(_call) \
75 __asm__ __volatile__ ( \
76 " movl %c1(%0),%%eax; " \
77 " pushl %c2+5*%c3(%0); " \
78 " pushl %c2+4*%c3(%0); " \
79 " pushl %c2+3*%c3(%0); " \
80 " pushl %c2+2*%c3(%0); " \
81 " pushl %c2+1*%c3(%0); " \
82 " pushl %c2+0*%c3(%0); " \
83 " cmpl $("STR(NR_hypercalls)"),%%eax; " \
84 " jae 2f; " \
85 " call *hypercall_table(,%%eax,4); " \
86 "1: movl %%eax,%c4(%0); " \
87 " addl $24,%%esp\n" \
88 ".section .fixup,\"ax\"\n" \
89 "2: movl $-"STR(ENOSYS)",%%eax\n" \
90 " jmp 1b\n" \
91 ".previous\n" \
92 : \
93 : "bSD" (_call), \
94 "i" (offsetof(__typeof__(*_call), op)), \
95 "i" (offsetof(__typeof__(*_call), args)), \
96 "i" (sizeof(*(_call)->args)), \
97 "i" (offsetof(__typeof__(*_call), result)) \
98 /* all the caller-saves registers */ \
99 : "eax", "ecx", "edx" ) \
101 #endif
103 #endif /* __ASM_X86_MULTICALL_H__ */