debuggers.hg

view xen/include/asm-x86/current.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 d867eb643fe4
children
line source
1 /******************************************************************************
2 * current.h
3 *
4 * Information structure that lives at the bottom of the per-cpu Xen stack.
5 */
7 #ifndef __X86_CURRENT_H__
8 #define __X86_CURRENT_H__
10 #include <xen/config.h>
11 #include <xen/percpu.h>
12 #include <public/xen.h>
13 #include <asm/page.h>
15 struct vcpu;
17 struct cpu_info {
18 struct cpu_user_regs guest_cpu_user_regs;
19 unsigned int processor_id;
20 struct vcpu *current_vcpu;
21 unsigned long per_cpu_offset;
22 #ifdef __x86_64__ /* get_stack_bottom() must be 16-byte aligned */
23 unsigned long __pad_for_stack_bottom;
24 #endif
25 };
27 static inline struct cpu_info *get_cpu_info(void)
28 {
29 struct cpu_info *cpu_info;
30 __asm__ ( "and %%"__OP"sp,%0; or %2,%0"
31 : "=r" (cpu_info)
32 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-sizeof(struct cpu_info))
33 );
34 return cpu_info;
35 }
37 #define get_current() (get_cpu_info()->current_vcpu)
38 #define set_current(vcpu) (get_cpu_info()->current_vcpu = (vcpu))
39 #define current (get_current())
41 #define get_processor_id() (get_cpu_info()->processor_id)
42 #define set_processor_id(id) do { \
43 struct cpu_info *ci__ = get_cpu_info(); \
44 ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
45 } while (0)
47 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
49 /*
50 * Get the bottom-of-stack, as stored in the per-CPU TSS. This actually points
51 * into the middle of cpu_info.guest_cpu_user_regs, at the section that
52 * precisely corresponds to a CPU trap frame.
53 */
54 #define get_stack_bottom() \
55 ((unsigned long)&get_cpu_info()->guest_cpu_user_regs.es)
57 #define reset_stack_and_jump(__fn) \
58 __asm__ __volatile__ ( \
59 "mov %0,%%"__OP"sp; jmp "STR(__fn) \
60 : : "r" (guest_cpu_user_regs()) : "memory" )
62 #define schedule_tail(vcpu) (((vcpu)->arch.schedule_tail)(vcpu))
64 /*
65 * Which VCPU's state is currently running on each CPU?
66 * This is not necesasrily the same as 'current' as a CPU may be
67 * executing a lazy state switch.
68 */
69 DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
71 #endif /* __X86_CURRENT_H__ */