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.h196
1 files changed, 0 insertions, 196 deletions
diff --git a/include/asm-um/elf.h b/include/asm-um/elf.h
index ebf7c63886e0..e69de29bb2d1 100644
--- a/include/asm-um/elf.h
+++ b/include/asm-um/elf.h
@@ -1,196 +0,0 @@
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#if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT)
11
12#define R_386_NONE 0
13#define R_386_32 1
14#define R_386_PC32 2
15#define R_386_GOT32 3
16#define R_386_PLT32 4
17#define R_386_COPY 5
18#define R_386_GLOB_DAT 6
19#define R_386_JMP_SLOT 7
20#define R_386_RELATIVE 8
21#define R_386_GOTOFF 9
22#define R_386_GOTPC 10
23#define R_386_NUM 11
24
25#elif defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
26
27/* x86-64 relocation types */
28#define R_X86_64_NONE 0 /* No reloc */
29#define R_X86_64_64 1 /* Direct 64 bit */
30#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
31#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
32#define R_X86_64_PLT32 4 /* 32 bit PLT address */
33#define R_X86_64_COPY 5 /* Copy symbol at runtime */
34#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
35#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
36#define R_X86_64_RELATIVE 8 /* Adjust by program base */
37#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
38 offset to GOT */
39#define R_X86_64_32 10 /* Direct 32 bit zero extended */
40#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
41#define R_X86_64_16 12 /* Direct 16 bit zero extended */
42#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
43#define R_X86_64_8 14 /* Direct 8 bit sign extended */
44#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
45
46#define R_X86_64_NUM 16
47
48#endif
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
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 */