diff options
Diffstat (limited to 'arch/x86/include/asm/elf.h')
-rw-r--r-- | arch/x86/include/asm/elf.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index f27f79abe021..5939f44fe0c0 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h | |||
@@ -155,7 +155,12 @@ do { \ | |||
155 | #define elf_check_arch(x) \ | 155 | #define elf_check_arch(x) \ |
156 | ((x)->e_machine == EM_X86_64) | 156 | ((x)->e_machine == EM_X86_64) |
157 | 157 | ||
158 | #define compat_elf_check_arch(x) elf_check_arch_ia32(x) | 158 | #define compat_elf_check_arch(x) \ |
159 | (elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64) | ||
160 | |||
161 | #if __USER32_DS != __USER_DS | ||
162 | # error "The following code assumes __USER32_DS == __USER_DS" | ||
163 | #endif | ||
159 | 164 | ||
160 | static inline void elf_common_init(struct thread_struct *t, | 165 | static inline void elf_common_init(struct thread_struct *t, |
161 | struct pt_regs *regs, const u16 ds) | 166 | struct pt_regs *regs, const u16 ds) |
@@ -178,8 +183,9 @@ static inline void elf_common_init(struct thread_struct *t, | |||
178 | void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp); | 183 | void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp); |
179 | #define compat_start_thread start_thread_ia32 | 184 | #define compat_start_thread start_thread_ia32 |
180 | 185 | ||
181 | void set_personality_ia32(void); | 186 | void set_personality_ia32(bool); |
182 | #define COMPAT_SET_PERSONALITY(ex) set_personality_ia32() | 187 | #define COMPAT_SET_PERSONALITY(ex) \ |
188 | set_personality_ia32((ex).e_machine == EM_X86_64) | ||
183 | 189 | ||
184 | #define COMPAT_ELF_PLATFORM ("i686") | 190 | #define COMPAT_ELF_PLATFORM ("i686") |
185 | 191 | ||
@@ -286,7 +292,7 @@ do { \ | |||
286 | #define VDSO_HIGH_BASE 0xffffe000U /* CONFIG_COMPAT_VDSO address */ | 292 | #define VDSO_HIGH_BASE 0xffffe000U /* CONFIG_COMPAT_VDSO address */ |
287 | 293 | ||
288 | /* 1GB for 64bit, 8MB for 32bit */ | 294 | /* 1GB for 64bit, 8MB for 32bit */ |
289 | #define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff) | 295 | #define STACK_RND_MASK (test_thread_flag(TIF_ADDR32) ? 0x7ff : 0x3fffff) |
290 | 296 | ||
291 | #define ARCH_DLINFO \ | 297 | #define ARCH_DLINFO \ |
292 | do { \ | 298 | do { \ |
@@ -295,9 +301,20 @@ do { \ | |||
295 | (unsigned long)current->mm->context.vdso); \ | 301 | (unsigned long)current->mm->context.vdso); \ |
296 | } while (0) | 302 | } while (0) |
297 | 303 | ||
304 | #define ARCH_DLINFO_X32 \ | ||
305 | do { \ | ||
306 | if (vdso_enabled) \ | ||
307 | NEW_AUX_ENT(AT_SYSINFO_EHDR, \ | ||
308 | (unsigned long)current->mm->context.vdso); \ | ||
309 | } while (0) | ||
310 | |||
298 | #define AT_SYSINFO 32 | 311 | #define AT_SYSINFO 32 |
299 | 312 | ||
300 | #define COMPAT_ARCH_DLINFO ARCH_DLINFO_IA32(sysctl_vsyscall32) | 313 | #define COMPAT_ARCH_DLINFO \ |
314 | if (test_thread_flag(TIF_X32)) \ | ||
315 | ARCH_DLINFO_X32; \ | ||
316 | else \ | ||
317 | ARCH_DLINFO_IA32(sysctl_vsyscall32) | ||
301 | 318 | ||
302 | #define COMPAT_ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) | 319 | #define COMPAT_ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) |
303 | 320 | ||
@@ -313,6 +330,8 @@ struct linux_binprm; | |||
313 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | 330 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 |
314 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, | 331 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, |
315 | int uses_interp); | 332 | int uses_interp); |
333 | extern int x32_setup_additional_pages(struct linux_binprm *bprm, | ||
334 | int uses_interp); | ||
316 | 335 | ||
317 | extern int syscall32_setup_pages(struct linux_binprm *, int exstack); | 336 | extern int syscall32_setup_pages(struct linux_binprm *, int exstack); |
318 | #define compat_arch_setup_additional_pages syscall32_setup_pages | 337 | #define compat_arch_setup_additional_pages syscall32_setup_pages |
@@ -329,7 +348,7 @@ static inline int mmap_is_ia32(void) | |||
329 | return 1; | 348 | return 1; |
330 | #endif | 349 | #endif |
331 | #ifdef CONFIG_IA32_EMULATION | 350 | #ifdef CONFIG_IA32_EMULATION |
332 | if (test_thread_flag(TIF_IA32)) | 351 | if (test_thread_flag(TIF_ADDR32)) |
333 | return 1; | 352 | return 1; |
334 | #endif | 353 | #endif |
335 | return 0; | 354 | return 0; |