]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/x86/kernel/asm-offsets_64.c
x86: use kbuild.h
[net-next-2.6.git] / arch / x86 / kernel / asm-offsets_64.c
CommitLineData
c3ca5f30
TG
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
7#include <linux/crypto.h>
8#include <linux/sched.h>
9#include <linux/stddef.h>
10#include <linux/errno.h>
11#include <linux/hardirq.h>
12#include <linux/suspend.h>
66916cd2 13#include <linux/kbuild.h>
c3ca5f30
TG
14#include <asm/pda.h>
15#include <asm/processor.h>
16#include <asm/segment.h>
17#include <asm/thread_info.h>
18#include <asm/ia32.h>
bd53147d 19#include <asm/bootparam.h>
c3ca5f30 20
c3ca5f30
TG
21#define __NO_STUBS 1
22#undef __SYSCALL
23#undef _ASM_X86_64_UNISTD_H_
24#define __SYSCALL(nr, sym) [nr] = 1,
25static char syscalls[] = {
26#include <asm/unistd.h>
27};
28
29int main(void)
30{
31#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
32 ENTRY(state);
33 ENTRY(flags);
c3ca5f30
TG
34 ENTRY(pid);
35 BLANK();
36#undef ENTRY
37#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
38 ENTRY(flags);
39 ENTRY(addr_limit);
40 ENTRY(preempt_count);
41 ENTRY(status);
36197c92
RM
42#ifdef CONFIG_IA32_EMULATION
43 ENTRY(sysenter_return);
44#endif
c3ca5f30
TG
45 BLANK();
46#undef ENTRY
47#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
48 ENTRY(kernelstack);
49 ENTRY(oldrsp);
50 ENTRY(pcurrent);
51 ENTRY(irqcount);
52 ENTRY(cpunumber);
53 ENTRY(irqstackptr);
54 ENTRY(data_offset);
55 BLANK();
56#undef ENTRY
a59153dc
GOC
57#ifdef CONFIG_PARAVIRT
58 BLANK();
59 OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
60 OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
61 OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
62 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
63 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
64 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
65 OFFSET(PV_CPU_irq_enable_syscall_ret, pv_cpu_ops, irq_enable_syscall_ret);
66 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
67 OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
68#endif
69
70
c3ca5f30
TG
71#ifdef CONFIG_IA32_EMULATION
72#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
742fa54a
PA
73 ENTRY(ax);
74 ENTRY(bx);
75 ENTRY(cx);
76 ENTRY(dx);
77 ENTRY(si);
78 ENTRY(di);
79 ENTRY(bp);
80 ENTRY(sp);
81 ENTRY(ip);
c3ca5f30
TG
82 BLANK();
83#undef ENTRY
84 DEFINE(IA32_RT_SIGFRAME_sigcontext,
85 offsetof (struct rt_sigframe32, uc.uc_mcontext));
86 BLANK();
87#endif
88 DEFINE(pbe_address, offsetof(struct pbe, address));
89 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
90 DEFINE(pbe_next, offsetof(struct pbe, next));
91 BLANK();
0de80bcc 92#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
65ea5b03
PA
93 ENTRY(bx);
94 ENTRY(bx);
95 ENTRY(cx);
96 ENTRY(dx);
97 ENTRY(sp);
98 ENTRY(bp);
99 ENTRY(si);
100 ENTRY(di);
0de80bcc
RW
101 ENTRY(r8);
102 ENTRY(r9);
103 ENTRY(r10);
104 ENTRY(r11);
105 ENTRY(r12);
106 ENTRY(r13);
107 ENTRY(r14);
108 ENTRY(r15);
65ea5b03 109 ENTRY(flags);
0de80bcc
RW
110 BLANK();
111#undef ENTRY
112#define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
113 ENTRY(cr0);
114 ENTRY(cr2);
115 ENTRY(cr3);
116 ENTRY(cr4);
117 ENTRY(cr8);
118 BLANK();
119#undef ENTRY
ca241c75 120 DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
c3ca5f30
TG
121 BLANK();
122 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
123 BLANK();
124 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
bd53147d
EB
125
126 BLANK();
127 OFFSET(BP_scratch, boot_params, scratch);
128 OFFSET(BP_loadflags, boot_params, hdr.loadflags);
129 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
130 OFFSET(BP_version, boot_params, hdr.version);
c3ca5f30
TG
131 return 0;
132}