blob: 8793ab33e2c16406632513ecdc2febefe26c66a3 [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/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
Jeremy Fitzhardinge555cf2b2008-07-08 15:06:45 -070020#include <xen/interface/xen.h>
21
Hiroshi Shimamoto8869a2e2008-12-18 14:46:52 -080022#include <asm/sigframe.h>
23
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020024#define __NO_STUBS 1
25#undef __SYSCALL
H. Peter Anvin1965aae2008-10-22 22:26:29 -070026#undef _ASM_X86_UNISTD_64_H
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020027#define __SYSCALL(nr, sym) [nr] = 1,
28static char syscalls[] = {
29#include <asm/unistd.h>
30};
31
32int main(void)
33{
34#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
35 ENTRY(state);
36 ENTRY(flags);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020037 ENTRY(pid);
38 BLANK();
39#undef ENTRY
Glauber Costa26ccb8a2008-06-24 11:19:35 -030040#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020041 ENTRY(flags);
42 ENTRY(addr_limit);
43 ENTRY(preempt_count);
44 ENTRY(status);
Roland McGrath36197c92008-01-30 13:30:43 +010045#ifdef CONFIG_IA32_EMULATION
46 ENTRY(sysenter_return);
47#endif
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020048 BLANK();
49#undef ENTRY
Glauber de Oliveira Costaa59153d2008-01-30 13:33:19 +010050#ifdef CONFIG_PARAVIRT
51 BLANK();
52 OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
53 OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
54 OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
55 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
56 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
Jeremy Fitzhardingefab58422008-06-25 00:19:31 -040057 OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
Glauber de Oliveira Costaa59153d2008-01-30 13:33:19 +010058 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
Jeremy Fitzhardinge2be29982008-06-25 00:19:28 -040059 OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
60 OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
61 OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
Glauber de Oliveira Costaa59153d2008-01-30 13:33:19 +010062 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
63 OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
64#endif
65
66
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020067#ifdef CONFIG_IA32_EMULATION
68#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
H. Peter Anvin742fa542008-01-30 13:30:56 +010069 ENTRY(ax);
70 ENTRY(bx);
71 ENTRY(cx);
72 ENTRY(dx);
73 ENTRY(si);
74 ENTRY(di);
75 ENTRY(bp);
76 ENTRY(sp);
77 ENTRY(ip);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020078 BLANK();
79#undef ENTRY
80 DEFINE(IA32_RT_SIGFRAME_sigcontext,
Hiroshi Shimamoto8869a2e2008-12-18 14:46:52 -080081 offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020082 BLANK();
83#endif
84 DEFINE(pbe_address, offsetof(struct pbe, address));
85 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
86 DEFINE(pbe_next, offsetof(struct pbe, next));
87 BLANK();
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +020088#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010089 ENTRY(bx);
90 ENTRY(bx);
91 ENTRY(cx);
92 ENTRY(dx);
93 ENTRY(sp);
94 ENTRY(bp);
95 ENTRY(si);
96 ENTRY(di);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +020097 ENTRY(r8);
98 ENTRY(r9);
99 ENTRY(r10);
100 ENTRY(r11);
101 ENTRY(r12);
102 ENTRY(r13);
103 ENTRY(r14);
104 ENTRY(r15);
H. Peter Anvin65ea5b02008-01-30 13:30:56 +0100105 ENTRY(flags);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +0200106 BLANK();
107#undef ENTRY
108#define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
109 ENTRY(cr0);
110 ENTRY(cr2);
111 ENTRY(cr3);
112 ENTRY(cr4);
113 ENTRY(cr8);
114 BLANK();
115#undef ENTRY
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100116 DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200117 BLANK();
118 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
119 BLANK();
120 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
Eric W. Biedermanbd531472007-10-26 11:29:04 -0600121
122 BLANK();
123 OFFSET(BP_scratch, boot_params, scratch);
124 OFFSET(BP_loadflags, boot_params, hdr.loadflags);
125 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
126 OFFSET(BP_version, boot_params, hdr.version);
Jeremy Fitzhardinge8c5e5ac2008-07-08 15:06:44 -0700127
128 BLANK();
129 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
Jeremy Fitzhardinge555cf2b2008-07-08 15:06:45 -0700130#ifdef CONFIG_XEN
131 BLANK();
132 OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
133 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
134#undef ENTRY
135#endif
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200136 return 0;
137}