usb/isp1760: Use polling instead of SOF interrupts to fix Errata 2
[zen-stable.git] / fs / compat_binfmt_elf.c
blob112e45a17e99717e1226f3b229c5ffe73c8193f3
1 /*
2 * 32-bit compatibility support for ELF format executables and core dumps.
4 * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
10 * Red Hat Author: Roland McGrath.
12 * This file is used in a 64-bit kernel that wants to support 32-bit ELF.
13 * asm/elf.h is responsible for defining the compat_* and COMPAT_* macros
14 * used below, with definitions appropriate for 32-bit ABI compatibility.
16 * We use macros to rename the ABI types and machine-dependent
17 * functions used in binfmt_elf.c to compat versions.
20 #include <linux/elfcore-compat.h>
21 #include <linux/time.h>
24 * Rename the basic ELF layout types to refer to the 32-bit class of files.
26 #undef ELF_CLASS
27 #define ELF_CLASS ELFCLASS32
29 #undef elfhdr
30 #undef elf_phdr
31 #undef elf_shdr
32 #undef elf_note
33 #undef elf_addr_t
34 #define elfhdr elf32_hdr
35 #define elf_phdr elf32_phdr
36 #define elf_shdr elf32_shdr
37 #define elf_note elf32_note
38 #define elf_addr_t Elf32_Addr
41 * The machine-dependent core note format types are defined in elfcore-compat.h,
42 * which requires asm/elf.h to define compat_elf_gregset_t et al.
44 #define elf_prstatus compat_elf_prstatus
45 #define elf_prpsinfo compat_elf_prpsinfo
48 * Compat version of cputime_to_compat_timeval, perhaps this
49 * should be an inline in <linux/compat.h>.
51 static void cputime_to_compat_timeval(const cputime_t cputime,
52 struct compat_timeval *value)
54 struct timeval tv;
55 cputime_to_timeval(cputime, &tv);
56 value->tv_sec = tv.tv_sec;
57 value->tv_usec = tv.tv_usec;
60 #undef cputime_to_timeval
61 #define cputime_to_timeval cputime_to_compat_timeval
65 * To use this file, asm/elf.h must define compat_elf_check_arch.
66 * The other following macros can be defined if the compat versions
67 * differ from the native ones, or omitted when they match.
70 #undef ELF_ARCH
71 #undef elf_check_arch
72 #define elf_check_arch compat_elf_check_arch
74 #ifdef COMPAT_ELF_PLATFORM
75 #undef ELF_PLATFORM
76 #define ELF_PLATFORM COMPAT_ELF_PLATFORM
77 #endif
79 #ifdef COMPAT_ELF_HWCAP
80 #undef ELF_HWCAP
81 #define ELF_HWCAP COMPAT_ELF_HWCAP
82 #endif
84 #ifdef COMPAT_ARCH_DLINFO
85 #undef ARCH_DLINFO
86 #define ARCH_DLINFO COMPAT_ARCH_DLINFO
87 #endif
89 #ifdef COMPAT_ELF_ET_DYN_BASE
90 #undef ELF_ET_DYN_BASE
91 #define ELF_ET_DYN_BASE COMPAT_ELF_ET_DYN_BASE
92 #endif
94 #ifdef COMPAT_ELF_EXEC_PAGESIZE
95 #undef ELF_EXEC_PAGESIZE
96 #define ELF_EXEC_PAGESIZE COMPAT_ELF_EXEC_PAGESIZE
97 #endif
99 #ifdef COMPAT_ELF_PLAT_INIT
100 #undef ELF_PLAT_INIT
101 #define ELF_PLAT_INIT COMPAT_ELF_PLAT_INIT
102 #endif
104 #ifdef COMPAT_SET_PERSONALITY
105 #undef SET_PERSONALITY
106 #define SET_PERSONALITY COMPAT_SET_PERSONALITY
107 #endif
109 #ifdef compat_start_thread
110 #undef start_thread
111 #define start_thread compat_start_thread
112 #endif
114 #ifdef compat_arch_setup_additional_pages
115 #undef ARCH_HAS_SETUP_ADDITIONAL_PAGES
116 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
117 #undef arch_setup_additional_pages
118 #define arch_setup_additional_pages compat_arch_setup_additional_pages
119 #endif
122 * Rename a few of the symbols that binfmt_elf.c will define.
123 * These are all local so the names don't really matter, but it
124 * might make some debugging less confusing not to duplicate them.
126 #define elf_format compat_elf_format
127 #define init_elf_binfmt init_compat_elf_binfmt
128 #define exit_elf_binfmt exit_compat_elf_binfmt
131 * We share all the actual code with the native (64-bit) version.
133 #include "binfmt_elf.c"