blob: 2b32719a3fea75c7ec4e5d0ee9e3a25c34aafc04 [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>
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>
Eric W. Biedermanbd531472007-10-26 11:29:04 -060018#include <asm/bootparam.h>
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020019
20#define DEFINE(sym, val) \
21 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
22
23#define BLANK() asm volatile("\n->" : : )
24
Eric W. Biedermanbd531472007-10-26 11:29:04 -060025#define OFFSET(sym, str, mem) \
26 DEFINE(sym, offsetof(struct str, mem))
27
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020028#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);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020041 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);
Roland McGrath36197c92008-01-30 13:30:43 +010049#ifdef CONFIG_IA32_EMULATION
50 ENTRY(sysenter_return);
51#endif
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020052 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
64#ifdef CONFIG_IA32_EMULATION
65#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
H. Peter Anvin742fa542008-01-30 13:30:56 +010066 ENTRY(ax);
67 ENTRY(bx);
68 ENTRY(cx);
69 ENTRY(dx);
70 ENTRY(si);
71 ENTRY(di);
72 ENTRY(bp);
73 ENTRY(sp);
74 ENTRY(ip);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020075 BLANK();
76#undef ENTRY
77 DEFINE(IA32_RT_SIGFRAME_sigcontext,
78 offsetof (struct rt_sigframe32, uc.uc_mcontext));
79 BLANK();
80#endif
81 DEFINE(pbe_address, offsetof(struct pbe, address));
82 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
83 DEFINE(pbe_next, offsetof(struct pbe, next));
84 BLANK();
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +020085#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010086 ENTRY(bx);
87 ENTRY(bx);
88 ENTRY(cx);
89 ENTRY(dx);
90 ENTRY(sp);
91 ENTRY(bp);
92 ENTRY(si);
93 ENTRY(di);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +020094 ENTRY(r8);
95 ENTRY(r9);
96 ENTRY(r10);
97 ENTRY(r11);
98 ENTRY(r12);
99 ENTRY(r13);
100 ENTRY(r14);
101 ENTRY(r15);
H. Peter Anvin65ea5b02008-01-30 13:30:56 +0100102 ENTRY(flags);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +0200103 BLANK();
104#undef ENTRY
105#define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
106 ENTRY(cr0);
107 ENTRY(cr2);
108 ENTRY(cr3);
109 ENTRY(cr4);
110 ENTRY(cr8);
111 BLANK();
112#undef ENTRY
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100113 DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200114 BLANK();
115 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
116 BLANK();
117 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
Eric W. Biedermanbd531472007-10-26 11:29:04 -0600118
119 BLANK();
120 OFFSET(BP_scratch, boot_params, scratch);
121 OFFSET(BP_loadflags, boot_params, hdr.loadflags);
122 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
123 OFFSET(BP_version, boot_params, hdr.version);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200124 return 0;
125}