nlm: Ensure callback code also checks that the files match
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / elfcore.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_ELFCORE_H
2#define _LINUX_ELFCORE_H
3
1da177e4 4#include <linux/user.h>
187f1882 5#include <linux/bug.h>
1da177e4 6#include <asm/elf.h>
607ca46e 7#include <uapi/linux/elfcore.h>
1da177e4 8
1da177e4
LT
9static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
10{
11#ifdef ELF_CORE_COPY_REGS
12 ELF_CORE_COPY_REGS((*elfregs), regs)
13#else
14 BUG_ON(sizeof(*elfregs) != sizeof(*regs));
15 *(struct pt_regs *)elfregs = *regs;
16#endif
17}
18
6cd61c0b
TH
19static inline void elf_core_copy_kernel_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
20{
21#ifdef ELF_CORE_COPY_KERNEL_REGS
22 ELF_CORE_COPY_KERNEL_REGS((*elfregs), regs);
23#else
24 elf_core_copy_regs(elfregs, regs);
25#endif
26}
27
1da177e4
LT
28static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
29{
e9bf0cc7 30#if defined (ELF_CORE_COPY_TASK_REGS)
1da177e4 31 return ELF_CORE_COPY_TASK_REGS(t, elfregs);
e9bf0cc7 32#elif defined (task_pt_regs)
a65e7bfc 33 elf_core_copy_regs(elfregs, task_pt_regs(t));
1da177e4
LT
34#endif
35 return 0;
36}
37
38extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
39
40static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_regs *regs, elf_fpregset_t *fpu)
41{
42#ifdef ELF_CORE_COPY_FPREGS
43 return ELF_CORE_COPY_FPREGS(t, fpu);
44#else
45 return dump_fpu(regs, fpu);
46#endif
47}
48
49#ifdef ELF_CORE_COPY_XFPREGS
50static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
51{
52 return ELF_CORE_COPY_XFPREGS(t, xfpu);
53}
54#endif
55
1fcccbac
DH
56/*
57 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
58 * extra segments containing the gate DSO contents. Dumping its
59 * contents makes post-mortem fully interpretable later without matching up
60 * the same kernel and hardware config to see what PC values meant.
61 * Dumping its extra ELF program headers includes all the other information
62 * a debugger needs to easily find how the gate DSO was being used.
63 */
64extern Elf_Half elf_core_extra_phdrs(void);
65extern int
66elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size,
67 unsigned long limit);
68extern int
69elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit);
8d9032bb 70extern size_t elf_core_extra_data_size(void);
1da177e4
LT
71
72#endif /* _LINUX_ELFCORE_H */