ia64/xen-unstable

view xen/arch/x86/x86_32/asm-offsets.c @ 16989:92734271810a

vmx realmode: Emulate protected-mode transition while CS and SS have
bad selector values (bottom two bits non-zero).

Allows opensuse 10.3 install CD to boot. Unfortunately SUSE Linux 10.1
install CD still fails to work...

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 05 15:45:10 2008 +0000 (2008-02-05)
parents 2324110ef2c6
children a49673cd23d2
line source
1 /*
2 * Generate definitions needed by assembly language modules.
3 * This code generates raw asm output which is post-processed
4 * to extract and format the required data.
5 */
7 #include <xen/config.h>
8 #include <xen/perfc.h>
9 #include <xen/sched.h>
10 #include <asm/fixmap.h>
11 #include <asm/hardirq.h>
13 #define DEFINE(_sym, _val) \
14 __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
15 #define BLANK() \
16 __asm__ __volatile__ ( "\n->" : : )
17 #define OFFSET(_sym, _str, _mem) \
18 DEFINE(_sym, offsetof(_str, _mem));
20 /* base-2 logarithm */
21 #define __L2(_x) (((_x) & 0x00000002) ? 1 : 0)
22 #define __L4(_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
23 #define __L8(_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
24 #define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
25 #define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
27 void __dummy__(void)
28 {
29 OFFSET(UREGS_eax, struct cpu_user_regs, eax);
30 OFFSET(UREGS_ebx, struct cpu_user_regs, ebx);
31 OFFSET(UREGS_ecx, struct cpu_user_regs, ecx);
32 OFFSET(UREGS_edx, struct cpu_user_regs, edx);
33 OFFSET(UREGS_esi, struct cpu_user_regs, esi);
34 OFFSET(UREGS_edi, struct cpu_user_regs, edi);
35 OFFSET(UREGS_esp, struct cpu_user_regs, esp);
36 OFFSET(UREGS_ebp, struct cpu_user_regs, ebp);
37 OFFSET(UREGS_eip, struct cpu_user_regs, eip);
38 OFFSET(UREGS_cs, struct cpu_user_regs, cs);
39 OFFSET(UREGS_ds, struct cpu_user_regs, ds);
40 OFFSET(UREGS_es, struct cpu_user_regs, es);
41 OFFSET(UREGS_fs, struct cpu_user_regs, fs);
42 OFFSET(UREGS_gs, struct cpu_user_regs, gs);
43 OFFSET(UREGS_ss, struct cpu_user_regs, ss);
44 OFFSET(UREGS_eflags, struct cpu_user_regs, eflags);
45 OFFSET(UREGS_error_code, struct cpu_user_regs, error_code);
46 OFFSET(UREGS_entry_vector, struct cpu_user_regs, entry_vector);
47 OFFSET(UREGS_saved_upcall_mask, struct cpu_user_regs, saved_upcall_mask);
48 OFFSET(UREGS_kernel_sizeof, struct cpu_user_regs, esp);
49 DEFINE(UREGS_user_sizeof, sizeof(struct cpu_user_regs));
50 BLANK();
52 OFFSET(VCPU_processor, struct vcpu, processor);
53 OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info);
54 OFFSET(VCPU_trap_bounce, struct vcpu, arch.trap_bounce);
55 OFFSET(VCPU_thread_flags, struct vcpu, arch.flags);
56 OFFSET(VCPU_event_sel, struct vcpu,
57 arch.guest_context.event_callback_cs);
58 OFFSET(VCPU_event_addr, struct vcpu,
59 arch.guest_context.event_callback_eip);
60 OFFSET(VCPU_failsafe_sel, struct vcpu,
61 arch.guest_context.failsafe_callback_cs);
62 OFFSET(VCPU_failsafe_addr, struct vcpu,
63 arch.guest_context.failsafe_callback_eip);
64 OFFSET(VCPU_kernel_ss, struct vcpu,
65 arch.guest_context.kernel_ss);
66 OFFSET(VCPU_kernel_sp, struct vcpu,
67 arch.guest_context.kernel_sp);
68 OFFSET(VCPU_guest_context_flags, struct vcpu, arch.guest_context.flags);
69 OFFSET(VCPU_nmi_pending, struct vcpu, nmi_pending);
70 OFFSET(VCPU_nmi_masked, struct vcpu, nmi_masked);
71 DEFINE(_VGCF_failsafe_disables_events, _VGCF_failsafe_disables_events);
72 BLANK();
74 OFFSET(TSS_ss0, struct tss_struct, ss0);
75 OFFSET(TSS_esp0, struct tss_struct, esp0);
76 OFFSET(TSS_ss1, struct tss_struct, ss1);
77 OFFSET(TSS_esp1, struct tss_struct, esp1);
78 DEFINE(TSS_sizeof, sizeof(struct tss_struct));
79 BLANK();
81 OFFSET(VCPU_svm_vmcb_pa, struct vcpu, arch.hvm_svm.vmcb_pa);
82 OFFSET(VCPU_svm_vmcb, struct vcpu, arch.hvm_svm.vmcb);
83 OFFSET(VCPU_svm_vmcb_in_sync, struct vcpu, arch.hvm_svm.vmcb_in_sync);
84 BLANK();
86 OFFSET(VCPU_vmx_launched, struct vcpu, arch.hvm_vmx.launched);
87 OFFSET(VCPU_vmx_emul, struct vcpu, arch.hvm_vmx.vmxemul);
88 OFFSET(VCPU_hvm_guest_cr2, struct vcpu, arch.hvm_vcpu.guest_cr[2]);
89 BLANK();
91 OFFSET(VMCB_rax, struct vmcb_struct, rax);
92 OFFSET(VMCB_rip, struct vmcb_struct, rip);
93 OFFSET(VMCB_rsp, struct vmcb_struct, rsp);
94 OFFSET(VMCB_rflags, struct vmcb_struct, rflags);
95 BLANK();
97 OFFSET(VCPUINFO_upcall_pending, vcpu_info_t, evtchn_upcall_pending);
98 OFFSET(VCPUINFO_upcall_mask, vcpu_info_t, evtchn_upcall_mask);
99 BLANK();
101 DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
102 BLANK();
104 OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
105 OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
106 OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
107 OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
108 BLANK();
110 #if PERF_COUNTERS
111 DEFINE(PERFC_hypercalls, PERFC_hypercalls);
112 DEFINE(PERFC_exceptions, PERFC_exceptions);
113 BLANK();
114 #endif
116 DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE));
117 BLANK();
119 DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
120 BLANK();
122 OFFSET(CPUINFO_ext_features, struct cpuinfo_x86, x86_capability[1]);
123 }