aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-um/elf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-um/elf.h')
-rw-r--r--include/asm-um/elf.h174
1 files changed, 153 insertions, 21 deletions
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 */