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 #define COMPILE_OFFSETS
7 
8 #include <xen/types.h>
9 #include <xen/sched.h>
10 #include <xen/bitops.h>
11 #include <public/xen.h>
12 #include <asm/current.h>
13 #include <asm/procinfo.h>
14 
15 #define DEFINE(_sym, _val)                                                 \
16     asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
17                   : : "i" (_val) )
18 #define BLANK()                                                            \
19     asm volatile ( "\n.ascii\"==><==\"" : : )
20 #define OFFSET(_sym, _str, _mem)                                           \
21     DEFINE(_sym, offsetof(_str, _mem));
22 
__dummy__(void)23 void __dummy__(void)
24 {
25    OFFSET(UREGS_sp, struct cpu_user_regs, sp);
26    OFFSET(UREGS_lr, struct cpu_user_regs, lr);
27    OFFSET(UREGS_pc, struct cpu_user_regs, pc);
28    OFFSET(UREGS_cpsr, struct cpu_user_regs, cpsr);
29    OFFSET(UREGS_hsr, struct cpu_user_regs, hsr);
30 
31    OFFSET(UREGS_LR_usr, struct cpu_user_regs, lr_usr);
32    OFFSET(UREGS_SP_usr, struct cpu_user_regs, sp_usr);
33 
34    OFFSET(UREGS_SP_svc, struct cpu_user_regs, sp_svc);
35    OFFSET(UREGS_LR_svc, struct cpu_user_regs, lr_svc);
36    OFFSET(UREGS_SPSR_svc, struct cpu_user_regs, spsr_svc);
37 
38    OFFSET(UREGS_SP_abt, struct cpu_user_regs, sp_abt);
39    OFFSET(UREGS_LR_abt, struct cpu_user_regs, lr_abt);
40    OFFSET(UREGS_SPSR_abt, struct cpu_user_regs, spsr_abt);
41 
42    OFFSET(UREGS_SP_und, struct cpu_user_regs, sp_und);
43    OFFSET(UREGS_LR_und, struct cpu_user_regs, lr_und);
44    OFFSET(UREGS_SPSR_und, struct cpu_user_regs, spsr_und);
45 
46    OFFSET(UREGS_SP_irq, struct cpu_user_regs, sp_irq);
47    OFFSET(UREGS_LR_irq, struct cpu_user_regs, lr_irq);
48    OFFSET(UREGS_SPSR_irq, struct cpu_user_regs, spsr_irq);
49 
50    OFFSET(UREGS_SP_fiq, struct cpu_user_regs, sp_fiq);
51    OFFSET(UREGS_LR_fiq, struct cpu_user_regs, lr_fiq);
52    OFFSET(UREGS_SPSR_fiq, struct cpu_user_regs, spsr_fiq);
53 
54    OFFSET(UREGS_R8_fiq, struct cpu_user_regs, r8_fiq);
55    OFFSET(UREGS_R9_fiq, struct cpu_user_regs, r9_fiq);
56    OFFSET(UREGS_R10_fiq, struct cpu_user_regs, r10_fiq);
57    OFFSET(UREGS_R11_fiq, struct cpu_user_regs, r11_fiq);
58    OFFSET(UREGS_R12_fiq, struct cpu_user_regs, r12_fiq);
59 
60    OFFSET(UREGS_kernel_sizeof, struct cpu_user_regs, cpsr);
61    DEFINE(UREGS_user_sizeof, sizeof(struct cpu_user_regs));
62    BLANK();
63 
64    DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
65 
66    OFFSET(VCPU_arch_saved_context, struct vcpu, arch.saved_context);
67 
68    BLANK();
69    DEFINE(PROCINFO_sizeof, sizeof(struct proc_info_list));
70    OFFSET(PROCINFO_cpu_val, struct proc_info_list, cpu_val);
71    OFFSET(PROCINFO_cpu_mask, struct proc_info_list, cpu_mask);
72    OFFSET(PROCINFO_cpu_init, struct proc_info_list, cpu_init);
73 
74    BLANK();
75    OFFSET(INITINFO_stack, struct init_info, stack);
76 
77 }
78 
79 /*
80  * Local variables:
81  * mode: C
82  * c-file-style: "BSD"
83  * c-basic-offset: 4
84  * indent-tabs-mode: nil
85  * End:
86  */
87