asm-offsets_64.c 3.6 KB
Newer Older
1 2 3 4 5
/*
 * Generate definitions needed by assembly language modules.
 * This code generates raw asm output which is post-processed to extract
 * and format the required data.
 */
6
#define COMPILE_OFFSETS
7 8 9 10 11 12 13

#include <linux/crypto.h>
#include <linux/sched.h> 
#include <linux/stddef.h>
#include <linux/errno.h> 
#include <linux/hardirq.h>
#include <linux/suspend.h>
C
Christoph Lameter 已提交
14
#include <linux/kbuild.h>
15 16 17 18
#include <asm/processor.h>
#include <asm/segment.h>
#include <asm/thread_info.h>
#include <asm/ia32.h>
19
#include <asm/bootparam.h>
20
#include <asm/suspend.h>
21

J
Jeremy Fitzhardinge 已提交
22 23
#include <xen/interface/xen.h>

24 25
#include <asm/sigframe.h>

26 27
#define __NO_STUBS 1
#undef __SYSCALL
H
H. Peter Anvin 已提交
28
#undef _ASM_X86_UNISTD_64_H
29 30 31 32 33 34 35 36 37 38 39 40 41
#define __SYSCALL(nr, sym) [nr] = 1,
static char syscalls[] = {
#include <asm/unistd.h>
};

int main(void)
{
#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
	ENTRY(state);
	ENTRY(flags); 
	ENTRY(pid);
	BLANK();
#undef ENTRY
G
Glauber Costa 已提交
42
#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
43 44 45 46
	ENTRY(flags);
	ENTRY(addr_limit);
	ENTRY(preempt_count);
	ENTRY(status);
R
Roland McGrath 已提交
47 48 49
#ifdef CONFIG_IA32_EMULATION
	ENTRY(sysenter_return);
#endif
50 51
	BLANK();
#undef ENTRY
52 53 54 55 56 57 58
#ifdef CONFIG_PARAVIRT
	BLANK();
	OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
	OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
	OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
	OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
	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 62 63
	OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
	OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
	OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
64 65 66 67 68
	OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
	OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
#endif


69 70
#ifdef CONFIG_IA32_EMULATION
#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
71 72 73 74 75 76 77 78 79
	ENTRY(ax);
	ENTRY(bx);
	ENTRY(cx);
	ENTRY(dx);
	ENTRY(si);
	ENTRY(di);
	ENTRY(bp);
	ENTRY(sp);
	ENTRY(ip);
80 81 82
	BLANK();
#undef ENTRY
	DEFINE(IA32_RT_SIGFRAME_sigcontext,
83
	       offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
84 85 86 87 88 89
	BLANK();
#endif
	DEFINE(pbe_address, offsetof(struct pbe, address));
	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
	DEFINE(pbe_next, offsetof(struct pbe, next));
	BLANK();
90
#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
91 92 93 94 95 96 97 98
	ENTRY(bx);
	ENTRY(bx);
	ENTRY(cx);
	ENTRY(dx);
	ENTRY(sp);
	ENTRY(bp);
	ENTRY(si);
	ENTRY(di);
99 100 101 102 103 104 105 106
	ENTRY(r8);
	ENTRY(r9);
	ENTRY(r10);
	ENTRY(r11);
	ENTRY(r12);
	ENTRY(r13);
	ENTRY(r14);
	ENTRY(r15);
107
	ENTRY(flags);
108 109 110 111 112 113 114 115 116 117
	BLANK();
#undef ENTRY
#define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
	ENTRY(cr0);
	ENTRY(cr2);
	ENTRY(cr3);
	ENTRY(cr4);
	ENTRY(cr8);
	BLANK();
#undef ENTRY
118
	DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
119 120 121 122
	BLANK();
	DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
	BLANK();
	DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
123 124 125 126 127 128

	BLANK();
	OFFSET(BP_scratch, boot_params, scratch);
	OFFSET(BP_loadflags, boot_params, hdr.loadflags);
	OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
	OFFSET(BP_version, boot_params, hdr.version);
129
	OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment);
130 131 132

	BLANK();
	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
J
Jeremy Fitzhardinge 已提交
133 134 135 136 137 138
#ifdef CONFIG_XEN
	BLANK();
	OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
	OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
#undef ENTRY
#endif
139 140
	return 0;
}