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