aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBodo Stroesser <bstroesser@fujitsu-siemens.com>2005-05-05 19:15:35 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 19:36:37 -0400
commitdbc35cc73f2edd6e39d7e814dbb6eddad6294665 (patch)
tree42d2d84208e595d832e7f74f92ec678ff848c3f2 /include
parent51a141104a37369be2822f423ed4444aa34d26a2 (diff)
[PATCH] uml: s390 preparation, elf.h
This patch make elh.h a symlink to the new arch-specific include files of the form elf-<subarch>.h, as in the same way already is done for some other includes. Also moves Elf-stuff from archparam-<subarch>.h and elf.h to the new elf-<subarch>.h files. Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-um/archparam-i386.h137
-rw-r--r--include/asm-um/archparam-ppc.h20
-rw-r--r--include/asm-um/archparam-x86_64.h36
-rw-r--r--include/asm-um/elf-i386.h169
-rw-r--r--include/asm-um/elf-ppc.h54
-rw-r--r--include/asm-um/elf-x86_64.h73
-rw-r--r--include/asm-um/elf.h174
-rw-r--r--include/asm-um/fixmap.h1
8 files changed, 450 insertions, 214 deletions
diff --git a/include/asm-um/archparam-i386.h b/include/asm-um/archparam-i386.h
index 6f78de5b621b..49e89b8d7e58 100644
--- a/include/asm-um/archparam-i386.h
+++ b/include/asm-um/archparam-i386.h
@@ -6,143 +6,6 @@
6#ifndef __UM_ARCHPARAM_I386_H 6#ifndef __UM_ARCHPARAM_I386_H
7#define __UM_ARCHPARAM_I386_H 7#define __UM_ARCHPARAM_I386_H
8 8
9/********* Bits for asm-um/elf.h ************/
10
11#include <asm/user.h>
12
13extern char * elf_aux_platform;
14#define ELF_PLATFORM (elf_aux_platform)
15
16#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
17
18typedef struct user_i387_struct elf_fpregset_t;
19typedef unsigned long elf_greg_t;
20
21#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
22typedef elf_greg_t elf_gregset_t[ELF_NGREG];
23
24#define ELF_DATA ELFDATA2LSB
25#define ELF_ARCH EM_386
26
27#define ELF_PLAT_INIT(regs, load_addr) do { \
28 PT_REGS_EBX(regs) = 0; \
29 PT_REGS_ECX(regs) = 0; \
30 PT_REGS_EDX(regs) = 0; \
31 PT_REGS_ESI(regs) = 0; \
32 PT_REGS_EDI(regs) = 0; \
33 PT_REGS_EBP(regs) = 0; \
34 PT_REGS_EAX(regs) = 0; \
35} while(0)
36
37/* Shamelessly stolen from include/asm-i386/elf.h */
38
39#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
40 pr_reg[0] = PT_REGS_EBX(regs); \
41 pr_reg[1] = PT_REGS_ECX(regs); \
42 pr_reg[2] = PT_REGS_EDX(regs); \
43 pr_reg[3] = PT_REGS_ESI(regs); \
44 pr_reg[4] = PT_REGS_EDI(regs); \
45 pr_reg[5] = PT_REGS_EBP(regs); \
46 pr_reg[6] = PT_REGS_EAX(regs); \
47 pr_reg[7] = PT_REGS_DS(regs); \
48 pr_reg[8] = PT_REGS_ES(regs); \
49 /* fake once used fs and gs selectors? */ \
50 pr_reg[9] = PT_REGS_DS(regs); \
51 pr_reg[10] = PT_REGS_DS(regs); \
52 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
53 pr_reg[12] = PT_REGS_IP(regs); \
54 pr_reg[13] = PT_REGS_CS(regs); \
55 pr_reg[14] = PT_REGS_EFLAGS(regs); \
56 pr_reg[15] = PT_REGS_SP(regs); \
57 pr_reg[16] = PT_REGS_SS(regs); \
58} while(0);
59
60
61extern unsigned long vsyscall_ehdr;
62extern unsigned long vsyscall_end;
63extern unsigned long __kernel_vsyscall;
64
65#define VSYSCALL_BASE vsyscall_ehdr
66#define VSYSCALL_END vsyscall_end
67
68/*
69 * This is the range that is readable by user mode, and things
70 * acting like user mode such as get_user_pages.
71 */
72#define FIXADDR_USER_START VSYSCALL_BASE
73#define FIXADDR_USER_END VSYSCALL_END
74
75/*
76 * Architecture-neutral AT_ values in 0-17, leave some room
77 * for more of them, start the x86-specific ones at 32.
78 */
79#define AT_SYSINFO 32
80#define AT_SYSINFO_EHDR 33
81
82#define ARCH_DLINFO \
83do { \
84 if ( vsyscall_ehdr ) { \
85 NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
86 NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
87 } \
88} while (0)
89
90/*
91 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
92 * extra segments containing the vsyscall DSO contents. Dumping its
93 * contents makes post-mortem fully interpretable later without matching up
94 * the same kernel and hardware config to see what PC values meant.
95 * Dumping its extra ELF program headers includes all the other information
96 * a debugger needs to easily find how the vsyscall DSO was being used.
97 */
98#define ELF_CORE_EXTRA_PHDRS \
99 (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 )
100
101#define ELF_CORE_WRITE_EXTRA_PHDRS \
102if ( vsyscall_ehdr ) { \
103 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
104 const struct elf_phdr *const phdrp = \
105 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
106 int i; \
107 Elf32_Off ofs = 0; \
108 for (i = 0; i < ehdrp->e_phnum; ++i) { \
109 struct elf_phdr phdr = phdrp[i]; \
110 if (phdr.p_type == PT_LOAD) { \
111 ofs = phdr.p_offset = offset; \
112 offset += phdr.p_filesz; \
113 } \
114 else \
115 phdr.p_offset += ofs; \
116 phdr.p_paddr = 0; /* match other core phdrs */ \
117 DUMP_WRITE(&phdr, sizeof(phdr)); \
118 } \
119}
120#define ELF_CORE_WRITE_EXTRA_DATA \
121if ( vsyscall_ehdr ) { \
122 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
123 const struct elf_phdr *const phdrp = \
124 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
125 int i; \
126 for (i = 0; i < ehdrp->e_phnum; ++i) { \
127 if (phdrp[i].p_type == PT_LOAD) \
128 DUMP_WRITE((void *) phdrp[i].p_vaddr, \
129 phdrp[i].p_filesz); \
130 } \
131}
132
133#define R_386_NONE 0
134#define R_386_32 1
135#define R_386_PC32 2
136#define R_386_GOT32 3
137#define R_386_PLT32 4
138#define R_386_COPY 5
139#define R_386_GLOB_DAT 6
140#define R_386_JMP_SLOT 7
141#define R_386_RELATIVE 8
142#define R_386_GOTOFF 9
143#define R_386_GOTPC 10
144#define R_386_NUM 11
145
146/********* Nothing for asm-um/hardirq.h **********/ 9/********* Nothing for asm-um/hardirq.h **********/
147 10
148/********* Nothing for asm-um/hw_irq.h **********/ 11/********* Nothing for asm-um/hw_irq.h **********/
diff --git a/include/asm-um/archparam-ppc.h b/include/asm-um/archparam-ppc.h
index 0ebced92a762..172cd6ffacc4 100644
--- a/include/asm-um/archparam-ppc.h
+++ b/include/asm-um/archparam-ppc.h
@@ -1,26 +1,6 @@
1#ifndef __UM_ARCHPARAM_PPC_H 1#ifndef __UM_ARCHPARAM_PPC_H
2#define __UM_ARCHPARAM_PPC_H 2#define __UM_ARCHPARAM_PPC_H
3 3
4/********* Bits for asm-um/elf.h ************/
5
6#define ELF_PLATFORM (0)
7
8#define ELF_ET_DYN_BASE (0x08000000)
9
10/* the following stolen from asm-ppc/elf.h */
11#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
12#define ELF_NFPREG 33 /* includes fpscr */
13/* General registers */
14typedef unsigned long elf_greg_t;
15typedef elf_greg_t elf_gregset_t[ELF_NGREG];
16
17/* Floating point registers */
18typedef double elf_fpreg_t;
19typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
20
21#define ELF_DATA ELFDATA2MSB
22#define ELF_ARCH EM_PPC
23
24/********* Bits for asm-um/hw_irq.h **********/ 4/********* Bits for asm-um/hw_irq.h **********/
25 5
26struct hw_interrupt_type; 6struct hw_interrupt_type;
diff --git a/include/asm-um/archparam-x86_64.h b/include/asm-um/archparam-x86_64.h
index 96321c4892f1..270ed9586b68 100644
--- a/include/asm-um/archparam-x86_64.h
+++ b/include/asm-um/archparam-x86_64.h
@@ -7,42 +7,6 @@
7#ifndef __UM_ARCHPARAM_X86_64_H 7#ifndef __UM_ARCHPARAM_X86_64_H
8#define __UM_ARCHPARAM_X86_64_H 8#define __UM_ARCHPARAM_X86_64_H
9 9
10#include <asm/user.h>
11
12#define ELF_PLATFORM "x86_64"
13
14#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
15
16typedef unsigned long elf_greg_t;
17typedef struct { } elf_fpregset_t;
18
19#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
20typedef elf_greg_t elf_gregset_t[ELF_NGREG];
21
22#define ELF_DATA ELFDATA2LSB
23#define ELF_ARCH EM_X86_64
24
25#define ELF_PLAT_INIT(regs, load_addr) do { \
26 PT_REGS_RBX(regs) = 0; \
27 PT_REGS_RCX(regs) = 0; \
28 PT_REGS_RDX(regs) = 0; \
29 PT_REGS_RSI(regs) = 0; \
30 PT_REGS_RDI(regs) = 0; \
31 PT_REGS_RBP(regs) = 0; \
32 PT_REGS_RAX(regs) = 0; \
33 PT_REGS_R8(regs) = 0; \
34 PT_REGS_R9(regs) = 0; \
35 PT_REGS_R10(regs) = 0; \
36 PT_REGS_R11(regs) = 0; \
37 PT_REGS_R12(regs) = 0; \
38 PT_REGS_R13(regs) = 0; \
39 PT_REGS_R14(regs) = 0; \
40 PT_REGS_R15(regs) = 0; \
41} while (0)
42
43#ifdef TIF_IA32 /* XXX */
44 clear_thread_flag(TIF_IA32);
45#endif
46 10
47/* No user-accessible fixmap addresses, i.e. vsyscall */ 11/* No user-accessible fixmap addresses, i.e. vsyscall */
48#define FIXADDR_USER_START 0 12#define FIXADDR_USER_START 0
diff --git a/include/asm-um/elf-i386.h b/include/asm-um/elf-i386.h
new file mode 100644
index 000000000000..b72e23519e00
--- /dev/null
+++ b/include/asm-um/elf-i386.h
@@ -0,0 +1,169 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5#ifndef __UM_ELF_I386_H
6#define __UM_ELF_I386_H
7
8#include "user.h"
9
10#define R_386_NONE 0
11#define R_386_32 1
12#define R_386_PC32 2
13#define R_386_GOT32 3
14#define R_386_PLT32 4
15#define R_386_COPY 5
16#define R_386_GLOB_DAT 6
17#define R_386_JMP_SLOT 7
18#define R_386_RELATIVE 8
19#define R_386_GOTOFF 9
20#define R_386_GOTPC 10
21#define R_386_NUM 11
22
23typedef unsigned long elf_greg_t;
24
25#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
26typedef elf_greg_t elf_gregset_t[ELF_NGREG];
27
28typedef struct user_i387_struct elf_fpregset_t;
29
30/*
31 * This is used to ensure we don't load something for the wrong architecture.
32 */
33#define elf_check_arch(x) \
34 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
35
36#define ELF_CLASS ELFCLASS32
37#define ELF_DATA ELFDATA2LSB
38#define ELF_ARCH EM_386
39
40#define ELF_PLAT_INIT(regs, load_addr) do { \
41 PT_REGS_EBX(regs) = 0; \
42 PT_REGS_ECX(regs) = 0; \
43 PT_REGS_EDX(regs) = 0; \
44 PT_REGS_ESI(regs) = 0; \
45 PT_REGS_EDI(regs) = 0; \
46 PT_REGS_EBP(regs) = 0; \
47 PT_REGS_EAX(regs) = 0; \
48} while(0)
49
50#define USE_ELF_CORE_DUMP
51#define ELF_EXEC_PAGESIZE 4096
52
53#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
54
55/* Shamelessly stolen from include/asm-i386/elf.h */
56
57#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
58 pr_reg[0] = PT_REGS_EBX(regs); \
59 pr_reg[1] = PT_REGS_ECX(regs); \
60 pr_reg[2] = PT_REGS_EDX(regs); \
61 pr_reg[3] = PT_REGS_ESI(regs); \
62 pr_reg[4] = PT_REGS_EDI(regs); \
63 pr_reg[5] = PT_REGS_EBP(regs); \
64 pr_reg[6] = PT_REGS_EAX(regs); \
65 pr_reg[7] = PT_REGS_DS(regs); \
66 pr_reg[8] = PT_REGS_ES(regs); \
67 /* fake once used fs and gs selectors? */ \
68 pr_reg[9] = PT_REGS_DS(regs); \
69 pr_reg[10] = PT_REGS_DS(regs); \
70 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
71 pr_reg[12] = PT_REGS_IP(regs); \
72 pr_reg[13] = PT_REGS_CS(regs); \
73 pr_reg[14] = PT_REGS_EFLAGS(regs); \
74 pr_reg[15] = PT_REGS_SP(regs); \
75 pr_reg[16] = PT_REGS_SS(regs); \
76} while(0);
77
78extern long elf_aux_hwcap;
79#define ELF_HWCAP (elf_aux_hwcap)
80
81extern char * elf_aux_platform;
82#define ELF_PLATFORM (elf_aux_platform)
83
84#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
85
86extern unsigned long vsyscall_ehdr;
87extern unsigned long vsyscall_end;
88extern unsigned long __kernel_vsyscall;
89
90#define VSYSCALL_BASE vsyscall_ehdr
91#define VSYSCALL_END vsyscall_end
92
93/*
94 * This is the range that is readable by user mode, and things
95 * acting like user mode such as get_user_pages.
96 */
97#define FIXADDR_USER_START VSYSCALL_BASE
98#define FIXADDR_USER_END VSYSCALL_END
99
100/*
101 * Architecture-neutral AT_ values in 0-17, leave some room
102 * for more of them, start the x86-specific ones at 32.
103 */
104#define AT_SYSINFO 32
105#define AT_SYSINFO_EHDR 33
106
107#define ARCH_DLINFO \
108do { \
109 if ( vsyscall_ehdr ) { \
110 NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
111 NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
112 } \
113} while (0)
114
115/*
116 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
117 * extra segments containing the vsyscall DSO contents. Dumping its
118 * contents makes post-mortem fully interpretable later without matching up
119 * the same kernel and hardware config to see what PC values meant.
120 * Dumping its extra ELF program headers includes all the other information
121 * a debugger needs to easily find how the vsyscall DSO was being used.
122 */
123#define ELF_CORE_EXTRA_PHDRS \
124 (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 )
125
126#define ELF_CORE_WRITE_EXTRA_PHDRS \
127if ( vsyscall_ehdr ) { \
128 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
129 const struct elf_phdr *const phdrp = \
130 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
131 int i; \
132 Elf32_Off ofs = 0; \
133 for (i = 0; i < ehdrp->e_phnum; ++i) { \
134 struct elf_phdr phdr = phdrp[i]; \
135 if (phdr.p_type == PT_LOAD) { \
136 ofs = phdr.p_offset = offset; \
137 offset += phdr.p_filesz; \
138 } \
139 else \
140 phdr.p_offset += ofs; \
141 phdr.p_paddr = 0; /* match other core phdrs */ \
142 DUMP_WRITE(&phdr, sizeof(phdr)); \
143 } \
144}
145#define ELF_CORE_WRITE_EXTRA_DATA \
146if ( vsyscall_ehdr ) { \
147 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
148 const struct elf_phdr *const phdrp = \
149 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
150 int i; \
151 for (i = 0; i < ehdrp->e_phnum; ++i) { \
152 if (phdrp[i].p_type == PT_LOAD) \
153 DUMP_WRITE((void *) phdrp[i].p_vaddr, \
154 phdrp[i].p_filesz); \
155 } \
156}
157
158#endif
159
160/*
161 * Overrides for Emacs so that we follow Linus's tabbing style.
162 * Emacs will notice this stuff at the end of the file and automatically
163 * adjust the settings for this buffer only. This must remain at the end
164 * of the file.
165 * ---------------------------------------------------------------------------
166 * Local variables:
167 * c-file-style: "linux"
168 * End:
169 */
diff --git a/include/asm-um/elf-ppc.h b/include/asm-um/elf-ppc.h
new file mode 100644
index 000000000000..2998cf925042
--- /dev/null
+++ b/include/asm-um/elf-ppc.h
@@ -0,0 +1,54 @@
1#ifndef __UM_ELF_PPC_H
2#define __UM_ELF_PPC_H
3
4#include "linux/config.h"
5
6extern long elf_aux_hwcap;
7#define ELF_HWCAP (elf_aux_hwcap)
8
9#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
10
11#define ELF_EXEC_PAGESIZE 4096
12
13#define elf_check_arch(x) (1)
14
15#ifdef CONFIG_64_BIT
16#define ELF_CLASS ELFCLASS64
17#else
18#define ELF_CLASS ELFCLASS32
19#endif
20
21#define USE_ELF_CORE_DUMP
22
23#define R_386_NONE 0
24#define R_386_32 1
25#define R_386_PC32 2
26#define R_386_GOT32 3
27#define R_386_PLT32 4
28#define R_386_COPY 5
29#define R_386_GLOB_DAT 6
30#define R_386_JMP_SLOT 7
31#define R_386_RELATIVE 8
32#define R_386_GOTOFF 9
33#define R_386_GOTPC 10
34#define R_386_NUM 11
35
36#define ELF_PLATFORM (0)
37
38#define ELF_ET_DYN_BASE (0x08000000)
39
40/* the following stolen from asm-ppc/elf.h */
41#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
42#define ELF_NFPREG 33 /* includes fpscr */
43/* General registers */
44typedef unsigned long elf_greg_t;
45typedef elf_greg_t elf_gregset_t[ELF_NGREG];
46
47/* Floating point registers */
48typedef double elf_fpreg_t;
49typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
50
51#define ELF_DATA ELFDATA2MSB
52#define ELF_ARCH EM_PPC
53
54#endif
diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h
new file mode 100644
index 000000000000..19309d001aa0
--- /dev/null
+++ b/include/asm-um/elf-x86_64.h
@@ -0,0 +1,73 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6#ifndef __UM_ELF_X86_64_H
7#define __UM_ELF_X86_64_H
8
9#include <asm/user.h>
10
11typedef unsigned long elf_greg_t;
12
13#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
14typedef elf_greg_t elf_gregset_t[ELF_NGREG];
15
16typedef struct { } elf_fpregset_t;
17
18/*
19 * This is used to ensure we don't load something for the wrong architecture.
20 */
21#define elf_check_arch(x) \
22 ((x)->e_machine == EM_X86_64)
23
24#define ELF_CLASS ELFCLASS64
25#define ELF_DATA ELFDATA2LSB
26#define ELF_ARCH EM_X86_64
27
28#define ELF_PLAT_INIT(regs, load_addr) do { \
29 PT_REGS_RBX(regs) = 0; \
30 PT_REGS_RCX(regs) = 0; \
31 PT_REGS_RDX(regs) = 0; \
32 PT_REGS_RSI(regs) = 0; \
33 PT_REGS_RDI(regs) = 0; \
34 PT_REGS_RBP(regs) = 0; \
35 PT_REGS_RAX(regs) = 0; \
36 PT_REGS_R8(regs) = 0; \
37 PT_REGS_R9(regs) = 0; \
38 PT_REGS_R10(regs) = 0; \
39 PT_REGS_R11(regs) = 0; \
40 PT_REGS_R12(regs) = 0; \
41 PT_REGS_R13(regs) = 0; \
42 PT_REGS_R14(regs) = 0; \
43 PT_REGS_R15(regs) = 0; \
44} while (0)
45
46#ifdef TIF_IA32 /* XXX */
47 clear_thread_flag(TIF_IA32); \
48#endif
49
50#define USE_ELF_CORE_DUMP
51#define ELF_EXEC_PAGESIZE 4096
52
53#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
54
55extern long elf_aux_hwcap;
56#define ELF_HWCAP (elf_aux_hwcap)
57
58#define ELF_PLATFORM "x86_64"
59
60#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
61
62#endif
63
64/*
65 * Overrides for Emacs so that we follow Linus's tabbing style.
66 * Emacs will notice this stuff at the end of the file and automatically
67 * adjust the settings for this buffer only. This must remain at the end
68 * of the file.
69 * ---------------------------------------------------------------------------
70 * Local variables:
71 * c-file-style: "linux"
72 * End:
73 */
diff --git a/include/asm-um/elf.h b/include/asm-um/elf.h
index d41112bfb299..ebf7c63886e0 100644
--- a/include/asm-um/elf.h
+++ b/include/asm-um/elf.h
@@ -1,25 +1,11 @@
1#ifndef __UM_ELF_H 1/*
2#define __UM_ELF_H 2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5#ifndef __UM_ELF_I386_H
6#define __UM_ELF_I386_H
3 7
4#include "linux/config.h" 8#include "user.h"
5#include "asm/archparam.h"
6
7extern long elf_aux_hwcap;
8#define ELF_HWCAP (elf_aux_hwcap)
9
10#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
11
12#define ELF_EXEC_PAGESIZE 4096
13
14#define elf_check_arch(x) (1)
15
16#ifdef CONFIG_64BIT
17#define ELF_CLASS ELFCLASS64
18#else
19#define ELF_CLASS ELFCLASS32
20#endif
21
22#define USE_ELF_CORE_DUMP
23 9
24#if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT) 10#if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT)
25 11
@@ -61,4 +47,150 @@ extern long elf_aux_hwcap;
61 47
62#endif 48#endif
63 49
50typedef unsigned long elf_greg_t;
51
52#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
53typedef elf_greg_t elf_gregset_t[ELF_NGREG];
54
55typedef struct user_i387_struct elf_fpregset_t;
56
57/*
58 * This is used to ensure we don't load something for the wrong architecture.
59 */
60#define elf_check_arch(x) \
61 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
62
63#define ELF_CLASS ELFCLASS32
64#define ELF_DATA ELFDATA2LSB
65#define ELF_ARCH EM_386
66
67#define ELF_PLAT_INIT(regs, load_addr) do { \
68 PT_REGS_EBX(regs) = 0; \
69 PT_REGS_ECX(regs) = 0; \
70 PT_REGS_EDX(regs) = 0; \
71 PT_REGS_ESI(regs) = 0; \
72 PT_REGS_EDI(regs) = 0; \
73 PT_REGS_EBP(regs) = 0; \
74 PT_REGS_EAX(regs) = 0; \
75} while(0)
76
77#define USE_ELF_CORE_DUMP
78#define ELF_EXEC_PAGESIZE 4096
79
80#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
81
82/* Shamelessly stolen from include/asm-i386/elf.h */
83
84#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
85 pr_reg[0] = PT_REGS_EBX(regs); \
86 pr_reg[1] = PT_REGS_ECX(regs); \
87 pr_reg[2] = PT_REGS_EDX(regs); \
88 pr_reg[3] = PT_REGS_ESI(regs); \
89 pr_reg[4] = PT_REGS_EDI(regs); \
90 pr_reg[5] = PT_REGS_EBP(regs); \
91 pr_reg[6] = PT_REGS_EAX(regs); \
92 pr_reg[7] = PT_REGS_DS(regs); \
93 pr_reg[8] = PT_REGS_ES(regs); \
94 /* fake once used fs and gs selectors? */ \
95 pr_reg[9] = PT_REGS_DS(regs); \
96 pr_reg[10] = PT_REGS_DS(regs); \
97 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
98 pr_reg[12] = PT_REGS_IP(regs); \
99 pr_reg[13] = PT_REGS_CS(regs); \
100 pr_reg[14] = PT_REGS_EFLAGS(regs); \
101 pr_reg[15] = PT_REGS_SP(regs); \
102 pr_reg[16] = PT_REGS_SS(regs); \
103} while(0);
104
105extern long elf_aux_hwcap;
106#define ELF_HWCAP (elf_aux_hwcap)
107
108extern char * elf_aux_platform;
109#define ELF_PLATFORM (elf_aux_platform)
110
111#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
112
113extern unsigned long vsyscall_ehdr;
114extern unsigned long vsyscall_end;
115extern unsigned long __kernel_vsyscall;
116
117#define VSYSCALL_BASE vsyscall_ehdr
118#define VSYSCALL_END vsyscall_end
119
120/*
121 * This is the range that is readable by user mode, and things
122 * acting like user mode such as get_user_pages.
123 */
124#define FIXADDR_USER_START VSYSCALL_BASE
125#define FIXADDR_USER_END VSYSCALL_END
126
127/*
128 * Architecture-neutral AT_ values in 0-17, leave some room
129 * for more of them, start the x86-specific ones at 32.
130 */
131#define AT_SYSINFO 32
132#define AT_SYSINFO_EHDR 33
133
134#define ARCH_DLINFO \
135do { \
136 if ( vsyscall_ehdr ) { \
137 NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
138 NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
139 } \
140} while (0)
141
142/*
143 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
144 * extra segments containing the vsyscall DSO contents. Dumping its
145 * contents makes post-mortem fully interpretable later without matching up
146 * the same kernel and hardware config to see what PC values meant.
147 * Dumping its extra ELF program headers includes all the other information
148 * a debugger needs to easily find how the vsyscall DSO was being used.
149 */
150#define ELF_CORE_EXTRA_PHDRS \
151 (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 )
152
153#define ELF_CORE_WRITE_EXTRA_PHDRS \
154if ( vsyscall_ehdr ) { \
155 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
156 const struct elf_phdr *const phdrp = \
157 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
158 int i; \
159 Elf32_Off ofs = 0; \
160 for (i = 0; i < ehdrp->e_phnum; ++i) { \
161 struct elf_phdr phdr = phdrp[i]; \
162 if (phdr.p_type == PT_LOAD) { \
163 ofs = phdr.p_offset = offset; \
164 offset += phdr.p_filesz; \
165 } \
166 else \
167 phdr.p_offset += ofs; \
168 phdr.p_paddr = 0; /* match other core phdrs */ \
169 DUMP_WRITE(&phdr, sizeof(phdr)); \
170 } \
171}
172#define ELF_CORE_WRITE_EXTRA_DATA \
173if ( vsyscall_ehdr ) { \
174 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
175 const struct elf_phdr *const phdrp = \
176 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
177 int i; \
178 for (i = 0; i < ehdrp->e_phnum; ++i) { \
179 if (phdrp[i].p_type == PT_LOAD) \
180 DUMP_WRITE((void *) phdrp[i].p_vaddr, \
181 phdrp[i].p_filesz); \
182 } \
183}
184
64#endif 185#endif
186
187/*
188 * Overrides for Emacs so that we follow Linus's tabbing style.
189 * Emacs will notice this stuff at the end of the file and automatically
190 * adjust the settings for this buffer only. This must remain at the end
191 * of the file.
192 * ---------------------------------------------------------------------------
193 * Local variables:
194 * c-file-style: "linux"
195 * End:
196 */
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h
index 900f3fbb9fab..ae0ca3932d50 100644
--- a/include/asm-um/fixmap.h
+++ b/include/asm-um/fixmap.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <asm/kmap_types.h> 5#include <asm/kmap_types.h>
6#include <asm/archparam.h> 6#include <asm/archparam.h>
7#include <asm/elf.h>
7 8
8/* 9/*
9 * Here we define all the compile-time 'special' virtual 10 * Here we define all the compile-time 'special' virtual