aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-10-11 05:14:19 -0400
committerThomas Gleixner <tglx@linutronix.de>2007-10-11 05:14:19 -0400
commitc3ca5f30b607298c6c33bfc5318de1cf542c50ef (patch)
tree9acb38588e4ebd66a8e4f51d6d90ec58d9b133aa /arch/x86_64/kernel
parent8b6f65ed7a216ff4591604ffe8d718981bad1224 (diff)
x86_64: prepare shared kernel/asm-offsets.c
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r--arch/x86_64/kernel/asm-offsets.c88
-rw-r--r--arch/x86_64/kernel/asm-offsets_64.c85
2 files changed, 89 insertions, 84 deletions
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c
index 778953bc636c..cfa82c899f47 100644
--- a/arch/x86_64/kernel/asm-offsets.c
+++ b/arch/x86_64/kernel/asm-offsets.c
@@ -1,85 +1,5 @@
1/* 1#ifdef CONFIG_X86_32
2 * Generate definitions needed by assembly language modules. 2# include "asm-offsets_32.c"
3 * This code generates raw asm output which is post-processed to extract 3#else
4 * and format the required data. 4# include "asm-offsets_64.c"
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>
18
19#define DEFINE(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21
22#define BLANK() asm volatile("\n->" : : )
23
24#define __NO_STUBS 1
25#undef __SYSCALL
26#undef _ASM_X86_64_UNISTD_H_
27#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);
37 ENTRY(thread);
38 ENTRY(pid);
39 BLANK();
40#undef ENTRY
41#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
42 ENTRY(flags);
43 ENTRY(addr_limit);
44 ENTRY(preempt_count);
45 ENTRY(status);
46 BLANK();
47#undef ENTRY
48#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
49 ENTRY(kernelstack);
50 ENTRY(oldrsp);
51 ENTRY(pcurrent);
52 ENTRY(irqcount);
53 ENTRY(cpunumber);
54 ENTRY(irqstackptr);
55 ENTRY(data_offset);
56 BLANK();
57#undef ENTRY
58#ifdef CONFIG_IA32_EMULATION
59#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
60 ENTRY(eax);
61 ENTRY(ebx);
62 ENTRY(ecx);
63 ENTRY(edx);
64 ENTRY(esi);
65 ENTRY(edi);
66 ENTRY(ebp);
67 ENTRY(esp);
68 ENTRY(eip);
69 BLANK();
70#undef ENTRY
71 DEFINE(IA32_RT_SIGFRAME_sigcontext,
72 offsetof (struct rt_sigframe32, uc.uc_mcontext));
73 BLANK();
74#endif 5#endif
75 DEFINE(pbe_address, offsetof(struct pbe, address));
76 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
77 DEFINE(pbe_next, offsetof(struct pbe, next));
78 BLANK();
79 DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
80 BLANK();
81 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
82 BLANK();
83 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
84 return 0;
85}
diff --git a/arch/x86_64/kernel/asm-offsets_64.c b/arch/x86_64/kernel/asm-offsets_64.c
new file mode 100644
index 000000000000..778953bc636c
--- /dev/null
+++ b/arch/x86_64/kernel/asm-offsets_64.c
@@ -0,0 +1,85 @@
1/*
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>
18
19#define DEFINE(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21
22#define BLANK() asm volatile("\n->" : : )
23
24#define __NO_STUBS 1
25#undef __SYSCALL
26#undef _ASM_X86_64_UNISTD_H_
27#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);
37 ENTRY(thread);
38 ENTRY(pid);
39 BLANK();
40#undef ENTRY
41#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
42 ENTRY(flags);
43 ENTRY(addr_limit);
44 ENTRY(preempt_count);
45 ENTRY(status);
46 BLANK();
47#undef ENTRY
48#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
49 ENTRY(kernelstack);
50 ENTRY(oldrsp);
51 ENTRY(pcurrent);
52 ENTRY(irqcount);
53 ENTRY(cpunumber);
54 ENTRY(irqstackptr);
55 ENTRY(data_offset);
56 BLANK();
57#undef ENTRY
58#ifdef CONFIG_IA32_EMULATION
59#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
60 ENTRY(eax);
61 ENTRY(ebx);
62 ENTRY(ecx);
63 ENTRY(edx);
64 ENTRY(esi);
65 ENTRY(edi);
66 ENTRY(ebp);
67 ENTRY(esp);
68 ENTRY(eip);
69 BLANK();
70#undef ENTRY
71 DEFINE(IA32_RT_SIGFRAME_sigcontext,
72 offsetof (struct rt_sigframe32, uc.uc_mcontext));
73 BLANK();
74#endif
75 DEFINE(pbe_address, offsetof(struct pbe, address));
76 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
77 DEFINE(pbe_next, offsetof(struct pbe, next));
78 BLANK();
79 DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
80 BLANK();
81 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
82 BLANK();
83 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
84 return 0;
85}