ia64/xen-unstable

view xen/include/asm-x86/current.h @ 15812:86a154e1ef5d

[HVM] Shadow: don't shadow the p2m table.
For HVM vcpus with paging disabled, we used to shadow the p2m table,
and skip the p2m lookup to go from gfn to mfn. Instead, we now
provide a simple pagetable that gives a one-to-one mapping of 4GB, and
shadow that, making the translations from gfn to mfn via the p2m.
This removes the paging-disabled special-case code from the shadow
fault handler, and allows us to expand the p2m interface, since all HVM
translations now go through the same p2m lookups.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Aug 31 11:06:22 2007 +0100 (2007-08-31)
parents f3fb7727cb9a
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 };
23 static inline struct cpu_info *get_cpu_info(void)
24 {
25 struct cpu_info *cpu_info;
26 __asm__ ( "and %%"__OP"sp,%0; or %2,%0"
27 : "=r" (cpu_info)
28 : "0" (~(STACK_SIZE-1)), "i" (STACK_SIZE-sizeof(struct cpu_info))
29 );
30 return cpu_info;
31 }
33 #define get_current() (get_cpu_info()->current_vcpu)
34 #define set_current(vcpu) (get_cpu_info()->current_vcpu = (vcpu))
35 #define current (get_current())
37 #define get_processor_id() (get_cpu_info()->processor_id)
38 #define set_processor_id(id) (get_cpu_info()->processor_id = (id))
40 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
42 /*
43 * Get the bottom-of-stack, as stored in the per-CPU TSS. This actually points
44 * into the middle of cpu_info.guest_cpu_user_regs, at the section that
45 * precisely corresponds to a CPU trap frame.
46 */
47 #define get_stack_bottom() \
48 ((unsigned long)&get_cpu_info()->guest_cpu_user_regs.es)
50 #define reset_stack_and_jump(__fn) \
51 __asm__ __volatile__ ( \
52 "mov %0,%%"__OP"sp; jmp "STR(__fn) \
53 : : "r" (guest_cpu_user_regs()) : "memory" )
55 #define schedule_tail(vcpu) (((vcpu)->arch.schedule_tail)(vcpu))
57 /*
58 * Which VCPU's state is currently running on each CPU?
59 * This is not necesasrily the same as 'current' as a CPU may be
60 * executing a lazy state switch.
61 */
62 DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
64 #endif /* __X86_CURRENT_H__ */