ia64/xen-unstable

view xen/include/asm-x86/current.h @ 9518:5715cf117178

Ensure curr_vcpu in domain.c is set correctly, even when
nr physical cpus is greater than max virtual cpus per domain.

Also do not initialise secondary CPU smp_processor_id() from
smpboot.c cpucount. It will be wrong if some CPUs fail to boot.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Mar 29 15:39:22 2006 +0100 (2006-03-29)
parents b54e981957eb
children 9b1c9d4133f8
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 <public/xen.h>
12 #include <asm/page.h>
14 struct vcpu;
16 struct cpu_info {
17 struct cpu_user_regs guest_cpu_user_regs;
18 unsigned int processor_id;
19 struct vcpu *current_ed;
20 };
22 static inline struct cpu_info *get_cpu_info(void)
23 {
24 struct cpu_info *cpu_info;
25 __asm__ ( "and %%"__OP"sp,%0; or %2,%0"
26 : "=r" (cpu_info)
27 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-sizeof(struct cpu_info))
28 );
29 return cpu_info;
30 }
32 #define get_current() (get_cpu_info()->current_ed)
33 #define set_current(_ed) (get_cpu_info()->current_ed = (_ed))
34 #define current (get_current())
36 #define get_processor_id() (get_cpu_info()->processor_id)
37 #define set_processor_id(_id) (get_cpu_info()->processor_id = (_id))
39 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
41 /*
42 * Get the bottom-of-stack, as stored in the per-CPU TSS. This actually points
43 * into the middle of cpu_info.guest_cpu_user_regs, at the section that
44 * precisely corresponds to a CPU trap frame.
45 */
46 #define get_stack_bottom() \
47 ((unsigned long)&get_cpu_info()->guest_cpu_user_regs.es)
49 #define reset_stack_and_jump(__fn) \
50 __asm__ __volatile__ ( \
51 "mov %0,%%"__OP"sp; jmp "STR(__fn) \
52 : : "r" (guest_cpu_user_regs()) : "memory" )
54 #define schedule_tail(_ed) (((_ed)->arch.schedule_tail)(_ed))
56 extern void set_current_execstate(struct vcpu *v);
58 #endif /* __X86_CURRENT_H__ */