]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/elfcore.h
1 #ifndef _LINUX_ELFCORE_H
2 #define _LINUX_ELFCORE_H
4 #include <linux/user.h>
6 #include <linux/sched/task_stack.h>
9 #include <uapi/linux/elfcore.h>
11 struct coredump_params
;
13 static inline void elf_core_copy_regs(elf_gregset_t
*elfregs
, struct pt_regs
*regs
)
15 #ifdef ELF_CORE_COPY_REGS
16 ELF_CORE_COPY_REGS((*elfregs
), regs
)
18 BUG_ON(sizeof(*elfregs
) != sizeof(*regs
));
19 *(struct pt_regs
*)elfregs
= *regs
;
23 static inline void elf_core_copy_kernel_regs(elf_gregset_t
*elfregs
, struct pt_regs
*regs
)
25 #ifdef ELF_CORE_COPY_KERNEL_REGS
26 ELF_CORE_COPY_KERNEL_REGS((*elfregs
), regs
);
28 elf_core_copy_regs(elfregs
, regs
);
32 static inline int elf_core_copy_task_regs(struct task_struct
*t
, elf_gregset_t
* elfregs
)
34 #if defined (ELF_CORE_COPY_TASK_REGS)
35 return ELF_CORE_COPY_TASK_REGS(t
, elfregs
);
36 #elif defined (task_pt_regs)
37 elf_core_copy_regs(elfregs
, task_pt_regs(t
));
42 extern int dump_fpu (struct pt_regs
*, elf_fpregset_t
*);
44 static inline int elf_core_copy_task_fpregs(struct task_struct
*t
, struct pt_regs
*regs
, elf_fpregset_t
*fpu
)
46 #ifdef ELF_CORE_COPY_FPREGS
47 return ELF_CORE_COPY_FPREGS(t
, fpu
);
49 return dump_fpu(regs
, fpu
);
53 #ifdef ELF_CORE_COPY_XFPREGS
54 static inline int elf_core_copy_task_xfpregs(struct task_struct
*t
, elf_fpxregset_t
*xfpu
)
56 return ELF_CORE_COPY_XFPREGS(t
, xfpu
);
61 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
62 * extra segments containing the gate DSO contents. Dumping its
63 * contents makes post-mortem fully interpretable later without matching up
64 * the same kernel and hardware config to see what PC values meant.
65 * Dumping its extra ELF program headers includes all the other information
66 * a debugger needs to easily find how the gate DSO was being used.
68 extern Elf_Half
elf_core_extra_phdrs(void);
70 elf_core_write_extra_phdrs(struct coredump_params
*cprm
, loff_t offset
);
72 elf_core_write_extra_data(struct coredump_params
*cprm
);
73 extern size_t elf_core_extra_data_size(void);
75 #endif /* _LINUX_ELFCORE_H */