aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/elf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-s390/elf.h')
-rw-r--r--include/asm-s390/elf.h51
1 files changed, 12 insertions, 39 deletions
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index b3ac262c4582..3cad56923815 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -113,6 +113,9 @@
113typedef s390_fp_regs elf_fpregset_t; 113typedef s390_fp_regs elf_fpregset_t;
114typedef s390_regs elf_gregset_t; 114typedef s390_regs elf_gregset_t;
115 115
116typedef s390_fp_regs compat_elf_fpregset_t;
117typedef s390_compat_regs compat_elf_gregset_t;
118
116#include <linux/sched.h> /* for task_struct */ 119#include <linux/sched.h> /* for task_struct */
117#include <asm/system.h> /* for save_access_regs */ 120#include <asm/system.h> /* for save_access_regs */
118#include <asm/mmu_context.h> 121#include <asm/mmu_context.h>
@@ -123,6 +126,10 @@ typedef s390_regs elf_gregset_t;
123#define elf_check_arch(x) \ 126#define elf_check_arch(x) \
124 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \ 127 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
125 && (x)->e_ident[EI_CLASS] == ELF_CLASS) 128 && (x)->e_ident[EI_CLASS] == ELF_CLASS)
129#define compat_elf_check_arch(x) \
130 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
131 && (x)->e_ident[EI_CLASS] == ELF_CLASS)
132#define compat_start_thread start_thread31
126 133
127/* For SVR4/S390 the function pointer to be registered with `atexit` is 134/* For SVR4/S390 the function pointer to be registered with `atexit` is
128 passed in R14. */ 135 passed in R14. */
@@ -131,6 +138,7 @@ typedef s390_regs elf_gregset_t;
131 _r->gprs[14] = 0; \ 138 _r->gprs[14] = 0; \
132 } while (0) 139 } while (0)
133 140
141#define CORE_DUMP_USE_REGSET
134#define USE_ELF_CORE_DUMP 142#define USE_ELF_CORE_DUMP
135#define ELF_EXEC_PAGESIZE 4096 143#define ELF_EXEC_PAGESIZE 4096
136 144
@@ -140,44 +148,6 @@ typedef s390_regs elf_gregset_t;
140 that it will "exec", and that there is sufficient room for the brk. */ 148 that it will "exec", and that there is sufficient room for the brk. */
141#define ELF_ET_DYN_BASE (STACK_TOP / 3 * 2) 149#define ELF_ET_DYN_BASE (STACK_TOP / 3 * 2)
142 150
143/* Wow, the "main" arch needs arch dependent functions too.. :) */
144
145/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
146 now struct_user_regs, they are different) */
147
148static inline int dump_regs(struct pt_regs *ptregs, elf_gregset_t *regs)
149{
150 memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs));
151 save_access_regs(regs->acrs);
152 regs->orig_gpr2 = ptregs->orig_gpr2;
153 return 1;
154}
155
156#define ELF_CORE_COPY_REGS(pr_reg, regs) dump_regs(regs, &pr_reg);
157
158static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
159{
160 struct pt_regs *ptregs = task_pt_regs(tsk);
161 memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs));
162 memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs));
163 regs->orig_gpr2 = ptregs->orig_gpr2;
164 return 1;
165}
166
167#define ELF_CORE_COPY_TASK_REGS(tsk, regs) dump_task_regs(tsk, regs)
168
169static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
170{
171 if (tsk == current)
172 save_fp_regs(fpregs);
173 else
174 memcpy(fpregs, &tsk->thread.fp_regs, sizeof(elf_fpregset_t));
175 return 1;
176}
177
178#define ELF_CORE_COPY_FPREGS(tsk, fpregs) dump_task_fpu(tsk, fpregs)
179
180
181/* This yields a mask that user programs can use to figure out what 151/* This yields a mask that user programs can use to figure out what
182 instruction set this CPU supports. */ 152 instruction set this CPU supports. */
183 153
@@ -204,7 +174,10 @@ do { \
204 set_personality(PER_SVR4); \ 174 set_personality(PER_SVR4); \
205 else if (current->personality != PER_LINUX32) \ 175 else if (current->personality != PER_LINUX32) \
206 set_personality(PER_LINUX); \ 176 set_personality(PER_LINUX); \
207 clear_thread_flag(TIF_31BIT); \ 177 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
178 set_thread_flag(TIF_31BIT); \
179 else \
180 clear_thread_flag(TIF_31BIT); \
208} while (0) 181} while (0)
209#endif /* __s390x__ */ 182#endif /* __s390x__ */
210 183