debuggers.hg

view xen/arch/x86/x86_32/asm-offsets.c @ 4632:05621922c024

bitkeeper revision 1.1340 (426652e8h-OWfDH7vm_elbT4wtH2cA)

Merge maf46@ssh-relay1.cl.cam.ac.uk:/usr/groups/xeno/BK/xen-unstable.bk
into fleming.research:/scratch/fleming/mafetter/xen-unstable.bk

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author mafetter@fleming.research
date Wed Apr 20 13:02:32 2005 +0000 (2005-04-20)
parents a01199a95070 d10fe13887d7
children 38a02ee9a9c8 65b28c74cec2
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>
11 #define DEFINE(_sym, _val) \
12 __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
13 #define BLANK() \
14 __asm__ __volatile__ ( "\n->" : : )
15 #define OFFSET(_sym, _str, _mem) \
16 DEFINE(_sym, offsetof(_str, _mem));
18 /* base-2 logarithm */
19 #define __L2(_x) (((_x) & 0x00000002) ? 1 : 0)
20 #define __L4(_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
21 #define __L8(_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
22 #define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
23 #define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
25 void __dummy__(void)
26 {
27 OFFSET(XREGS_eax, struct xen_regs, eax);
28 OFFSET(XREGS_ebx, struct xen_regs, ebx);
29 OFFSET(XREGS_ecx, struct xen_regs, ecx);
30 OFFSET(XREGS_edx, struct xen_regs, edx);
31 OFFSET(XREGS_esi, struct xen_regs, esi);
32 OFFSET(XREGS_edi, struct xen_regs, edi);
33 OFFSET(XREGS_esp, struct xen_regs, esp);
34 OFFSET(XREGS_ebp, struct xen_regs, ebp);
35 OFFSET(XREGS_eip, struct xen_regs, eip);
36 OFFSET(XREGS_cs, struct xen_regs, cs);
37 OFFSET(XREGS_ds, struct xen_regs, ds);
38 OFFSET(XREGS_es, struct xen_regs, es);
39 OFFSET(XREGS_fs, struct xen_regs, fs);
40 OFFSET(XREGS_gs, struct xen_regs, gs);
41 OFFSET(XREGS_ss, struct xen_regs, ss);
42 OFFSET(XREGS_eflags, struct xen_regs, eflags);
43 OFFSET(XREGS_error_code, struct xen_regs, error_code);
44 OFFSET(XREGS_entry_vector, struct xen_regs, entry_vector);
45 OFFSET(XREGS_kernel_sizeof, struct xen_regs, esp);
46 DEFINE(XREGS_user_sizeof, sizeof(struct xen_regs));
47 BLANK();
49 OFFSET(EDOMAIN_processor, struct exec_domain, processor);
50 OFFSET(EDOMAIN_vcpu_info, struct exec_domain, vcpu_info);
51 OFFSET(EDOMAIN_event_sel, struct exec_domain, arch.event_selector);
52 OFFSET(EDOMAIN_event_addr, struct exec_domain, arch.event_address);
53 OFFSET(EDOMAIN_failsafe_sel, struct exec_domain, arch.failsafe_selector);
54 OFFSET(EDOMAIN_failsafe_addr, struct exec_domain, arch.failsafe_address);
55 OFFSET(EDOMAIN_trap_bounce, struct exec_domain, arch.trap_bounce);
56 OFFSET(EDOMAIN_thread_flags, struct exec_domain, arch.flags);
57 OFFSET(EDOMAIN_kernel_ss, struct exec_domain, arch.kernel_ss);
58 OFFSET(EDOMAIN_kernel_sp, struct exec_domain, arch.kernel_sp);
59 BLANK();
61 OFFSET(VCPUINFO_upcall_pending, vcpu_info_t, evtchn_upcall_pending);
62 OFFSET(VCPUINFO_upcall_mask, vcpu_info_t, evtchn_upcall_mask);
63 BLANK();
65 OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
66 OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
67 OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
68 OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
69 OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
70 BLANK();
72 #if PERF_COUNTERS
73 OFFSET(PERFC_hypercalls, struct perfcounter, hypercalls);
74 OFFSET(PERFC_exceptions, struct perfcounter, exceptions);
75 BLANK();
76 #endif
78 OFFSET(MULTICALL_op, multicall_entry_t, op);
79 OFFSET(MULTICALL_arg0, multicall_entry_t, args[0]);
80 OFFSET(MULTICALL_arg1, multicall_entry_t, args[1]);
81 OFFSET(MULTICALL_arg2, multicall_entry_t, args[2]);
82 OFFSET(MULTICALL_arg3, multicall_entry_t, args[3]);
83 OFFSET(MULTICALL_arg4, multicall_entry_t, args[4]);
84 OFFSET(MULTICALL_result, multicall_entry_t, args[5]);
85 BLANK();
87 DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE));
88 BLANK();
90 DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
91 }