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 | */ |
---|
6 | |
---|
7 | #include <xen/config.h> |
---|
8 | #include <xen/perfc.h> |
---|
9 | #include <xen/sched.h> |
---|
10 | #ifdef CONFIG_COMPAT |
---|
11 | #include <compat/xen.h> |
---|
12 | #endif |
---|
13 | #include <asm/fixmap.h> |
---|
14 | #include <asm/hardirq.h> |
---|
15 | |
---|
16 | #define DEFINE(_sym, _val) \ |
---|
17 | __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) ) |
---|
18 | #define BLANK() \ |
---|
19 | __asm__ __volatile__ ( "\n->" : : ) |
---|
20 | #define OFFSET(_sym, _str, _mem) \ |
---|
21 | DEFINE(_sym, offsetof(_str, _mem)); |
---|
22 | |
---|
23 | /* base-2 logarithm */ |
---|
24 | #define __L2(_x) (((_x) & 0x00000002) ? 1 : 0) |
---|
25 | #define __L4(_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x)) |
---|
26 | #define __L8(_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x)) |
---|
27 | #define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x)) |
---|
28 | #define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x)) |
---|
29 | |
---|
30 | void __dummy__(void) |
---|
31 | { |
---|
32 | OFFSET(UREGS_r15, struct cpu_user_regs, r15); |
---|
33 | OFFSET(UREGS_r14, struct cpu_user_regs, r14); |
---|
34 | OFFSET(UREGS_r13, struct cpu_user_regs, r13); |
---|
35 | OFFSET(UREGS_r12, struct cpu_user_regs, r12); |
---|
36 | OFFSET(UREGS_rbp, struct cpu_user_regs, rbp); |
---|
37 | OFFSET(UREGS_rbx, struct cpu_user_regs, rbx); |
---|
38 | OFFSET(UREGS_r11, struct cpu_user_regs, r11); |
---|
39 | OFFSET(UREGS_r10, struct cpu_user_regs, r10); |
---|
40 | OFFSET(UREGS_r9, struct cpu_user_regs, r9); |
---|
41 | OFFSET(UREGS_r8, struct cpu_user_regs, r8); |
---|
42 | OFFSET(UREGS_rax, struct cpu_user_regs, rax); |
---|
43 | OFFSET(UREGS_rcx, struct cpu_user_regs, rcx); |
---|
44 | OFFSET(UREGS_rdx, struct cpu_user_regs, rdx); |
---|
45 | OFFSET(UREGS_rsi, struct cpu_user_regs, rsi); |
---|
46 | OFFSET(UREGS_rdi, struct cpu_user_regs, rdi); |
---|
47 | OFFSET(UREGS_error_code, struct cpu_user_regs, error_code); |
---|
48 | OFFSET(UREGS_entry_vector, struct cpu_user_regs, entry_vector); |
---|
49 | OFFSET(UREGS_rip, struct cpu_user_regs, rip); |
---|
50 | OFFSET(UREGS_cs, struct cpu_user_regs, cs); |
---|
51 | OFFSET(UREGS_eflags, struct cpu_user_regs, eflags); |
---|
52 | OFFSET(UREGS_rsp, struct cpu_user_regs, rsp); |
---|
53 | OFFSET(UREGS_ss, struct cpu_user_regs, ss); |
---|
54 | OFFSET(UREGS_kernel_sizeof, struct cpu_user_regs, es); |
---|
55 | DEFINE(UREGS_user_sizeof, sizeof(struct cpu_user_regs)); |
---|
56 | BLANK(); |
---|
57 | |
---|
58 | OFFSET(VCPU_processor, struct vcpu, processor); |
---|
59 | OFFSET(VCPU_domain, struct vcpu, domain); |
---|
60 | OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info); |
---|
61 | OFFSET(VCPU_trap_bounce, struct vcpu, arch.trap_bounce); |
---|
62 | OFFSET(VCPU_int80_bounce, struct vcpu, arch.int80_bounce); |
---|
63 | OFFSET(VCPU_thread_flags, struct vcpu, arch.flags); |
---|
64 | OFFSET(VCPU_event_addr, struct vcpu, |
---|
65 | arch.guest_context.event_callback_eip); |
---|
66 | OFFSET(VCPU_event_sel, struct vcpu, |
---|
67 | arch.guest_context.event_callback_cs); |
---|
68 | OFFSET(VCPU_failsafe_addr, struct vcpu, |
---|
69 | arch.guest_context.failsafe_callback_eip); |
---|
70 | OFFSET(VCPU_failsafe_sel, struct vcpu, |
---|
71 | arch.guest_context.failsafe_callback_cs); |
---|
72 | OFFSET(VCPU_syscall_addr, struct vcpu, |
---|
73 | arch.guest_context.syscall_callback_eip); |
---|
74 | OFFSET(VCPU_kernel_sp, struct vcpu, arch.guest_context.kernel_sp); |
---|
75 | OFFSET(VCPU_kernel_ss, struct vcpu, arch.guest_context.kernel_ss); |
---|
76 | OFFSET(VCPU_guest_context_flags, struct vcpu, arch.guest_context.flags); |
---|
77 | OFFSET(VCPU_arch_guest_fpu_ctxt, struct vcpu, arch.guest_context.fpu_ctxt); |
---|
78 | OFFSET(VCPU_nmi_addr, struct vcpu, nmi_addr); |
---|
79 | OFFSET(VCPU_nmi_pending, struct vcpu, nmi_pending); |
---|
80 | OFFSET(VCPU_nmi_masked, struct vcpu, nmi_masked); |
---|
81 | DEFINE(_VGCF_failsafe_disables_events, _VGCF_failsafe_disables_events); |
---|
82 | DEFINE(_VGCF_syscall_disables_events, _VGCF_syscall_disables_events); |
---|
83 | BLANK(); |
---|
84 | |
---|
85 | OFFSET(VCPU_svm_vmcb_pa, struct vcpu, arch.hvm_svm.vmcb_pa); |
---|
86 | OFFSET(VCPU_svm_vmcb, struct vcpu, arch.hvm_svm.vmcb); |
---|
87 | OFFSET(VCPU_svm_vmexit_tsc, struct vcpu, arch.hvm_svm.vmexit_tsc); |
---|
88 | BLANK(); |
---|
89 | |
---|
90 | OFFSET(VCPU_vmx_launched, struct vcpu, arch.hvm_vmx.launched); |
---|
91 | OFFSET(VCPU_vmx_cr2, struct vcpu, arch.hvm_vmx.cpu_cr2); |
---|
92 | BLANK(); |
---|
93 | |
---|
94 | OFFSET(DOMAIN_is_32bit_pv, struct domain, arch.is_32bit_pv); |
---|
95 | BLANK(); |
---|
96 | |
---|
97 | OFFSET(VMCB_rax, struct vmcb_struct, rax); |
---|
98 | OFFSET(VMCB_tsc_offset, struct vmcb_struct, tsc_offset); |
---|
99 | BLANK(); |
---|
100 | |
---|
101 | OFFSET(VCPUINFO_upcall_pending, struct vcpu_info, evtchn_upcall_pending); |
---|
102 | OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask); |
---|
103 | BLANK(); |
---|
104 | |
---|
105 | #ifdef CONFIG_COMPAT |
---|
106 | OFFSET(COMPAT_VCPUINFO_upcall_pending, struct compat_vcpu_info, evtchn_upcall_pending); |
---|
107 | OFFSET(COMPAT_VCPUINFO_upcall_mask, struct compat_vcpu_info, evtchn_upcall_mask); |
---|
108 | BLANK(); |
---|
109 | #endif |
---|
110 | |
---|
111 | OFFSET(CPUINFO_current_vcpu, struct cpu_info, current_vcpu); |
---|
112 | DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info)); |
---|
113 | BLANK(); |
---|
114 | |
---|
115 | OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code); |
---|
116 | OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags); |
---|
117 | OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs); |
---|
118 | OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip); |
---|
119 | BLANK(); |
---|
120 | |
---|
121 | #if PERF_COUNTERS |
---|
122 | DEFINE(PERFC_hypercalls, PERFC_hypercalls); |
---|
123 | DEFINE(PERFC_exceptions, PERFC_exceptions); |
---|
124 | BLANK(); |
---|
125 | #endif |
---|
126 | |
---|
127 | DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t))); |
---|
128 | } |
---|