blob: 70b19807acf99a85f0240575d30c18494a811118 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Generate definitions needed by assembly language modules.
3 * This code generates raw asm output which is post-processed
4 * to extract and format the required data.
5 */
6
Herbert Xu6c2bb982006-05-16 22:09:29 +10007#include <linux/crypto.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <linux/sched.h>
9#include <linux/signal.h>
10#include <linux/personality.h>
11#include <linux/suspend.h>
12#include <asm/ucontext.h>
13#include "sigframe.h"
14#include <asm/fixmap.h>
15#include <asm/processor.h>
16#include <asm/thread_info.h>
Ingo Molnare6e54942006-06-27 02:53:50 -070017#include <asm/elf.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19#define DEFINE(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21
22#define BLANK() asm volatile("\n->" : : )
23
24#define OFFSET(sym, str, mem) \
25 DEFINE(sym, offsetof(struct str, mem));
26
27void foo(void)
28{
29 OFFSET(SIGCONTEXT_eax, sigcontext, eax);
30 OFFSET(SIGCONTEXT_ebx, sigcontext, ebx);
31 OFFSET(SIGCONTEXT_ecx, sigcontext, ecx);
32 OFFSET(SIGCONTEXT_edx, sigcontext, edx);
33 OFFSET(SIGCONTEXT_esi, sigcontext, esi);
34 OFFSET(SIGCONTEXT_edi, sigcontext, edi);
35 OFFSET(SIGCONTEXT_ebp, sigcontext, ebp);
36 OFFSET(SIGCONTEXT_esp, sigcontext, esp);
37 OFFSET(SIGCONTEXT_eip, sigcontext, eip);
38 BLANK();
39
40 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
41 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
42 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
43 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
44 OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
45 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
46 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
47 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
48 BLANK();
49
50 OFFSET(TI_task, thread_info, task);
51 OFFSET(TI_exec_domain, thread_info, exec_domain);
52 OFFSET(TI_flags, thread_info, flags);
53 OFFSET(TI_status, thread_info, status);
54 OFFSET(TI_cpu, thread_info, cpu);
55 OFFSET(TI_preempt_count, thread_info, preempt_count);
56 OFFSET(TI_addr_limit, thread_info, addr_limit);
57 OFFSET(TI_restart_block, thread_info, restart_block);
Ingo Molnare6e54942006-06-27 02:53:50 -070058 OFFSET(TI_sysenter_return, thread_info, sysenter_return);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 BLANK();
60
Stas Sergeevbe44d2a2006-12-07 02:14:01 +010061 OFFSET(GDS_size, Xgt_desc_struct, size);
62 OFFSET(GDS_address, Xgt_desc_struct, address);
63 OFFSET(GDS_pad, Xgt_desc_struct, pad);
64 BLANK();
65
Jeremy Fitzhardingeeb5b7b92006-12-07 02:14:02 +010066 OFFSET(PT_EBX, pt_regs, ebx);
67 OFFSET(PT_ECX, pt_regs, ecx);
68 OFFSET(PT_EDX, pt_regs, edx);
69 OFFSET(PT_ESI, pt_regs, esi);
70 OFFSET(PT_EDI, pt_regs, edi);
71 OFFSET(PT_EBP, pt_regs, ebp);
72 OFFSET(PT_EAX, pt_regs, eax);
73 OFFSET(PT_DS, pt_regs, xds);
74 OFFSET(PT_ES, pt_regs, xes);
75 OFFSET(PT_ORIG_EAX, pt_regs, orig_eax);
76 OFFSET(PT_EIP, pt_regs, eip);
77 OFFSET(PT_CS, pt_regs, xcs);
78 OFFSET(PT_EFLAGS, pt_regs, eflags);
79 OFFSET(PT_OLDESP, pt_regs, esp);
80 OFFSET(PT_OLDSS, pt_regs, xss);
81 BLANK();
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
84 OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
85 BLANK();
86
87 OFFSET(pbe_address, pbe, address);
88 OFFSET(pbe_orig_address, pbe, orig_address);
89 OFFSET(pbe_next, pbe, next);
90
91 /* Offset from the sysenter stack to tss.esp0 */
92 DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, esp0) -
93 sizeof(struct tss_struct));
94
95 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
Ingo Molnare6e54942006-06-27 02:53:50 -070096 DEFINE(VDSO_PRELINK, VDSO_PRELINK);
Herbert Xu6c2bb982006-05-16 22:09:29 +100097
98 OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
Linus Torvalds1da177e2005-04-16 15:20:36 -070099}