PageRenderTime 38ms CodeModel.GetById 24ms app.highlight 12ms RepoModel.GetById 0ms app.codeStats 0ms

/arch/x86/kernel/asm-offsets_64.c

https://bitbucket.org/cresqo/cm7-p500-kernel
C | 140 lines | 126 code | 9 blank | 5 comment | 0 complexity | 1636a4fd9b57143681e98448d0ad05f8 MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1/*
  2 * Generate definitions needed by assembly language modules.
  3 * This code generates raw asm output which is post-processed to extract
  4 * and format the required data.
  5 */
  6#define COMPILE_OFFSETS
  7
  8#include <linux/crypto.h>
  9#include <linux/sched.h> 
 10#include <linux/stddef.h>
 11#include <linux/errno.h> 
 12#include <linux/hardirq.h>
 13#include <linux/suspend.h>
 14#include <linux/kbuild.h>
 15#include <asm/processor.h>
 16#include <asm/segment.h>
 17#include <asm/thread_info.h>
 18#include <asm/ia32.h>
 19#include <asm/bootparam.h>
 20#include <asm/suspend.h>
 21
 22#include <xen/interface/xen.h>
 23
 24#include <asm/sigframe.h>
 25
 26#define __NO_STUBS 1
 27#undef __SYSCALL
 28#undef _ASM_X86_UNISTD_64_H
 29#define __SYSCALL(nr, sym) [nr] = 1,
 30static char syscalls[] = {
 31#include <asm/unistd.h>
 32};
 33
 34int main(void)
 35{
 36#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
 37	ENTRY(state);
 38	ENTRY(flags); 
 39	ENTRY(pid);
 40	BLANK();
 41#undef ENTRY
 42#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
 43	ENTRY(flags);
 44	ENTRY(addr_limit);
 45	ENTRY(preempt_count);
 46	ENTRY(status);
 47#ifdef CONFIG_IA32_EMULATION
 48	ENTRY(sysenter_return);
 49#endif
 50	BLANK();
 51#undef ENTRY
 52#ifdef CONFIG_PARAVIRT
 53	BLANK();
 54	OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
 55	OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
 56	OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
 57	OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
 58	OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
 59	OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
 60	OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
 61	OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
 62	OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
 63	OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
 64	OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
 65	OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
 66#endif
 67
 68
 69#ifdef CONFIG_IA32_EMULATION
 70#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
 71	ENTRY(ax);
 72	ENTRY(bx);
 73	ENTRY(cx);
 74	ENTRY(dx);
 75	ENTRY(si);
 76	ENTRY(di);
 77	ENTRY(bp);
 78	ENTRY(sp);
 79	ENTRY(ip);
 80	BLANK();
 81#undef ENTRY
 82	DEFINE(IA32_RT_SIGFRAME_sigcontext,
 83	       offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
 84	BLANK();
 85#endif
 86	DEFINE(pbe_address, offsetof(struct pbe, address));
 87	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
 88	DEFINE(pbe_next, offsetof(struct pbe, next));
 89	BLANK();
 90#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
 91	ENTRY(bx);
 92	ENTRY(bx);
 93	ENTRY(cx);
 94	ENTRY(dx);
 95	ENTRY(sp);
 96	ENTRY(bp);
 97	ENTRY(si);
 98	ENTRY(di);
 99	ENTRY(r8);
100	ENTRY(r9);
101	ENTRY(r10);
102	ENTRY(r11);
103	ENTRY(r12);
104	ENTRY(r13);
105	ENTRY(r14);
106	ENTRY(r15);
107	ENTRY(flags);
108	BLANK();
109#undef ENTRY
110#define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
111	ENTRY(cr0);
112	ENTRY(cr2);
113	ENTRY(cr3);
114	ENTRY(cr4);
115	ENTRY(cr8);
116	BLANK();
117#undef ENTRY
118	DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
119	BLANK();
120	DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
121	BLANK();
122	DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
123
124	BLANK();
125	OFFSET(BP_scratch, boot_params, scratch);
126	OFFSET(BP_loadflags, boot_params, hdr.loadflags);
127	OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
128	OFFSET(BP_version, boot_params, hdr.version);
129	OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment);
130
131	BLANK();
132	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
133#ifdef CONFIG_XEN
134	BLANK();
135	OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
136	OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
137#undef ENTRY
138#endif
139	return 0;
140}