Skip to content

Commit bd53e44

Browse files
author
Greg Ungerer
committed
m68knommu: implement minimal regset support
Add code support to the m68k architecture for regsets. Currently the only thing that will need to use regsets for m68k will be coredump support of the elf_fdpic loader. So the changes are conditional on that. The added support is the minimum definitions required to support just that. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
1 parent 6ed2db9 commit bd53e44

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

arch/m68k/kernel/ptrace.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <linux/ptrace.h>
2020
#include <linux/user.h>
2121
#include <linux/signal.h>
22+
#include <linux/regset.h>
23+
#include <linux/elf.h>
2224

2325
#include <linux/uaccess.h>
2426
#include <asm/page.h>
@@ -291,3 +293,59 @@ asmlinkage void syscall_trace_leave(void)
291293
ptrace_report_syscall_exit(task_pt_regs(current), 0);
292294
}
293295
#endif /* CONFIG_COLDFIRE */
296+
297+
#if defined(CONFIG_BINFMT_ELF_FDPIC) && defined(CONFIG_ELF_CORE)
298+
/*
299+
* Currently the only thing that needs to use regsets for m68k is the
300+
* coredump support of the elf_fdpic loader. Implement the minimum
301+
* definitions required for that.
302+
*/
303+
static int m68k_regset_get(struct task_struct *target,
304+
const struct user_regset *regset,
305+
struct membuf to)
306+
{
307+
struct pt_regs *ptregs = task_pt_regs(target);
308+
u32 uregs[ELF_NGREG];
309+
310+
ELF_CORE_COPY_REGS(uregs, ptregs);
311+
return membuf_write(&to, uregs, sizeof(uregs));
312+
}
313+
314+
enum m68k_regset {
315+
REGSET_GPR,
316+
#ifdef CONFIG_FPU
317+
REGSET_FPU,
318+
#endif
319+
};
320+
321+
static const struct user_regset m68k_user_regsets[] = {
322+
[REGSET_GPR] = {
323+
.core_note_type = NT_PRSTATUS,
324+
.n = ELF_NGREG,
325+
.size = sizeof(u32),
326+
.align = sizeof(u16),
327+
.regset_get = m68k_regset_get,
328+
},
329+
#ifdef CONFIG_FPU
330+
[REGSET_FPU] = {
331+
.core_note_type = NT_PRFPREG,
332+
.n = sizeof(struct user_m68kfp_struct) / sizeof(u32),
333+
.size = sizeof(u32),
334+
.align = sizeof(u32),
335+
}
336+
#endif /* CONFIG_FPU */
337+
};
338+
339+
static const struct user_regset_view user_m68k_view = {
340+
.name = "m68k",
341+
.e_machine = EM_68K,
342+
.ei_osabi = ELF_OSABI,
343+
.regsets = m68k_user_regsets,
344+
.n = ARRAY_SIZE(m68k_user_regsets)
345+
};
346+
347+
const struct user_regset_view *task_user_regset_view(struct task_struct *task)
348+
{
349+
return &user_m68k_view;
350+
}
351+
#endif /* CONFIG_BINFMT_ELF_FDPIC && CONFIG_ELF_CORE */

0 commit comments

Comments
 (0)