source: trunk/packages/xen-common/xen-common/xen/arch/powerpc/powerpc64/asm-offsets.c @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 2.6 KB
Line 
1/* from xen/arch/x86/x86_32/asm-offsets.c */
2
3/*
4 * Generate definitions needed by assembly language modules.
5 * This code generates raw asm output which is post-processed
6 * to extract and format the required data.
7 */
8
9#include <xen/sched.h>
10#include <public/xen.h>
11#include <asm/powerpc64/procarea.h>
12#include <asm/hardirq.h>
13
14#define DEFINE(_sym, _val) \
15    __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) )
16#define BLANK() \
17    __asm__ __volatile__ ( "\n->" : : )
18#define OFFSET(_sym, _str, _mem) \
19    DEFINE(_sym, offsetof(_str, _mem));
20
21/* base-2 logarithm */
22#define __L2(_x)  (((_x) & 0x00000002) ?   1 : 0)
23#define __L4(_x)  (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x))
24#define __L8(_x)  (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x))
25#define __L16(_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x))
26#define LOG_2(_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x))
27
28extern void __dummy__(void);
29void __dummy__(void) 
30{
31    DEFINE(GPR_WIDTH, sizeof(unsigned long));
32    DEFINE(FPR_WIDTH, sizeof(double));
33
34    OFFSET(PAREA_vcpu, struct processor_area, cur_vcpu);
35    OFFSET(PAREA_stack, struct processor_area, hyp_stack_base);
36    OFFSET(PAREA_r1, struct processor_area, saved_regs[0]);
37    OFFSET(PAREA_cr, struct processor_area, saved_regs[1]);
38
39    OFFSET(UREGS_gprs, struct cpu_user_regs, gprs);
40    OFFSET(UREGS_r0, struct cpu_user_regs, gprs[0]);
41    OFFSET(UREGS_r1, struct cpu_user_regs, gprs[1]);
42    OFFSET(UREGS_r13, struct cpu_user_regs, gprs[13]);
43    OFFSET(UREGS_srr0, struct cpu_user_regs, srr0);
44    OFFSET(UREGS_srr1, struct cpu_user_regs, srr1);
45    OFFSET(UREGS_pc, struct cpu_user_regs, pc);
46    OFFSET(UREGS_msr, struct cpu_user_regs, msr);
47    OFFSET(UREGS_lr, struct cpu_user_regs, lr);
48    OFFSET(UREGS_ctr, struct cpu_user_regs, ctr);
49    OFFSET(UREGS_xer, struct cpu_user_regs, xer);
50    OFFSET(UREGS_hid4, struct cpu_user_regs, hid4);
51    OFFSET(UREGS_dar, struct cpu_user_regs, dar);
52    OFFSET(UREGS_dsisr, struct cpu_user_regs, dsisr);
53    OFFSET(UREGS_cr, struct cpu_user_regs, cr);
54    OFFSET(UREGS_fpscr, struct cpu_user_regs, fpscr);
55    DEFINE(UREGS_sizeof, sizeof(struct cpu_user_regs));
56
57    OFFSET(VCPU_fprs, struct vcpu, arch.fprs);
58    OFFSET(VCPU_fpscr, struct vcpu, arch.ctxt.fpscr);
59    OFFSET(VCPU_vrs, struct vcpu, arch.vrs);
60    OFFSET(VCPU_vscr, struct vcpu, arch.vscr);
61    OFFSET(VCPU_vrsave, struct vcpu, arch.vrsave);
62    OFFSET(VCPU_dec, struct vcpu, arch.dec);
63    OFFSET(VCPU_processor, struct vcpu, processor);
64
65    DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
66    OFFSET(IRQSTAT_pending, irq_cpustat_t, __softirq_pending);
67}
Note: See TracBrowser for help on using the repository browser.