blob: 3295e7c08fe70ee05a1cff708b6fc711a6de8da7 [file] [log] [blame]
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +02001/*
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>
Christoph Lameter66916cd2008-04-29 01:03:54 -070013#include <linux/kbuild.h>
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020014#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>
Eric W. Biedermanbd531472007-10-26 11:29:04 -060019#include <asm/bootparam.h>
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020020
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020021#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);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020034 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);
Roland McGrath36197c92008-01-30 13:30:43 +010042#ifdef CONFIG_IA32_EMULATION
43 ENTRY(sysenter_return);
44#endif
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020045 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
Glauber de Oliveira Costaa59153dc2008-01-30 13:33:19 +010057#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);
Jeremy Fitzhardingefab58422008-06-25 00:19:31 -040064 OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
Glauber de Oliveira Costaa59153dc2008-01-30 13:33:19 +010065 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
Jeremy Fitzhardinge2be29982008-06-25 00:19:28 -040066 OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
67 OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
68 OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
Glauber de Oliveira Costaa59153dc2008-01-30 13:33:19 +010069 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
70 OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
71#endif
72
73
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020074#ifdef CONFIG_IA32_EMULATION
75#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
H. Peter Anvin742fa542008-01-30 13:30:56 +010076 ENTRY(ax);
77 ENTRY(bx);
78 ENTRY(cx);
79 ENTRY(dx);
80 ENTRY(si);
81 ENTRY(di);
82 ENTRY(bp);
83 ENTRY(sp);
84 ENTRY(ip);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020085 BLANK();
86#undef ENTRY
87 DEFINE(IA32_RT_SIGFRAME_sigcontext,
88 offsetof (struct rt_sigframe32, uc.uc_mcontext));
89 BLANK();
90#endif
91 DEFINE(pbe_address, offsetof(struct pbe, address));
92 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
93 DEFINE(pbe_next, offsetof(struct pbe, next));
94 BLANK();
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +020095#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010096 ENTRY(bx);
97 ENTRY(bx);
98 ENTRY(cx);
99 ENTRY(dx);
100 ENTRY(sp);
101 ENTRY(bp);
102 ENTRY(si);
103 ENTRY(di);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +0200104 ENTRY(r8);
105 ENTRY(r9);
106 ENTRY(r10);
107 ENTRY(r11);
108 ENTRY(r12);
109 ENTRY(r13);
110 ENTRY(r14);
111 ENTRY(r15);
H. Peter Anvin65ea5b02008-01-30 13:30:56 +0100112 ENTRY(flags);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +0200113 BLANK();
114#undef ENTRY
115#define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
116 ENTRY(cr0);
117 ENTRY(cr2);
118 ENTRY(cr3);
119 ENTRY(cr4);
120 ENTRY(cr8);
121 BLANK();
122#undef ENTRY
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100123 DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200124 BLANK();
125 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
126 BLANK();
127 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
Eric W. Biedermanbd531472007-10-26 11:29:04 -0600128
129 BLANK();
130 OFFSET(BP_scratch, boot_params, scratch);
131 OFFSET(BP_loadflags, boot_params, hdr.loadflags);
132 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
133 OFFSET(BP_version, boot_params, hdr.version);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200134 return 0;
135}