blob: 1d41d3f1edbcaa3d39450561d25b8ef0fb801e38 [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
Jeremy Fitzhardinge555cf2b2008-07-08 15:06:45 -070021#include <xen/interface/xen.h>
22
Hiroshi Shimamoto8869a2e2008-12-18 14:46:52 -080023#include <asm/sigframe.h>
24
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020025#define __NO_STUBS 1
26#undef __SYSCALL
H. Peter Anvin1965aae2008-10-22 22:26:29 -070027#undef _ASM_X86_UNISTD_64_H
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020028#define __SYSCALL(nr, sym) [nr] = 1,
29static char syscalls[] = {
30#include <asm/unistd.h>
31};
32
33int main(void)
34{
35#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
36 ENTRY(state);
37 ENTRY(flags);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020038 ENTRY(pid);
39 BLANK();
40#undef ENTRY
Glauber Costa26ccb8a2008-06-24 11:19:35 -030041#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020042 ENTRY(flags);
43 ENTRY(addr_limit);
44 ENTRY(preempt_count);
45 ENTRY(status);
Roland McGrath36197c92008-01-30 13:30:43 +010046#ifdef CONFIG_IA32_EMULATION
47 ENTRY(sysenter_return);
48#endif
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020049 BLANK();
50#undef ENTRY
51#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
52 ENTRY(kernelstack);
53 ENTRY(oldrsp);
54 ENTRY(pcurrent);
55 ENTRY(irqcount);
56 ENTRY(cpunumber);
57 ENTRY(irqstackptr);
58 ENTRY(data_offset);
59 BLANK();
60#undef ENTRY
Glauber de Oliveira Costaa59153dc2008-01-30 13:33:19 +010061#ifdef CONFIG_PARAVIRT
62 BLANK();
63 OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
64 OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
65 OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
66 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
67 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
Jeremy Fitzhardingefab58422008-06-25 00:19:31 -040068 OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
Glauber de Oliveira Costaa59153dc2008-01-30 13:33:19 +010069 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
Jeremy Fitzhardinge2be29982008-06-25 00:19:28 -040070 OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
71 OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
72 OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
Glauber de Oliveira Costaa59153dc2008-01-30 13:33:19 +010073 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
74 OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
75#endif
76
77
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020078#ifdef CONFIG_IA32_EMULATION
79#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
H. Peter Anvin742fa542008-01-30 13:30:56 +010080 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);
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020089 BLANK();
90#undef ENTRY
91 DEFINE(IA32_RT_SIGFRAME_sigcontext,
Hiroshi Shimamoto8869a2e2008-12-18 14:46:52 -080092 offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +020093 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();
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +020099#define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
H. Peter Anvin65ea5b02008-01-30 13:30:56 +0100100 ENTRY(bx);
101 ENTRY(bx);
102 ENTRY(cx);
103 ENTRY(dx);
104 ENTRY(sp);
105 ENTRY(bp);
106 ENTRY(si);
107 ENTRY(di);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +0200108 ENTRY(r8);
109 ENTRY(r9);
110 ENTRY(r10);
111 ENTRY(r11);
112 ENTRY(r12);
113 ENTRY(r13);
114 ENTRY(r14);
115 ENTRY(r15);
H. Peter Anvin65ea5b02008-01-30 13:30:56 +0100116 ENTRY(flags);
Rafael J. Wysocki0de80bc2007-10-23 22:37:24 +0200117 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
Glauber de Oliveira Costaca241c72008-01-30 13:31:31 +0100127 DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200128 BLANK();
129 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
130 BLANK();
131 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
Eric W. Biedermanbd531472007-10-26 11:29:04 -0600132
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);
Jeremy Fitzhardinge8c5e5ac2008-07-08 15:06:44 -0700138
139 BLANK();
140 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
Jeremy Fitzhardinge555cf2b2008-07-08 15:06:45 -0700141#ifdef CONFIG_XEN
142 BLANK();
143 OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
144 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
145#undef ENTRY
146#endif
Thomas Gleixnerc3ca5f32007-10-11 11:14:19 +0200147 return 0;
148}