2 #include <linux/coredump.h>
9 Elf32_Half
elf_core_extra_phdrs(void)
11 return vsyscall_ehdr
? (((struct elfhdr
*)vsyscall_ehdr
)->e_phnum
) : 0;
14 int elf_core_write_extra_phdrs(struct coredump_params
*cprm
, loff_t offset
)
16 if ( vsyscall_ehdr
) {
17 const struct elfhdr
*const ehdrp
=
18 (struct elfhdr
*) vsyscall_ehdr
;
19 const struct elf_phdr
*const phdrp
=
20 (const struct elf_phdr
*) (vsyscall_ehdr
+ ehdrp
->e_phoff
);
24 for (i
= 0; i
< ehdrp
->e_phnum
; ++i
) {
25 struct elf_phdr phdr
= phdrp
[i
];
27 if (phdr
.p_type
== PT_LOAD
) {
28 ofs
= phdr
.p_offset
= offset
;
29 offset
+= phdr
.p_filesz
;
33 phdr
.p_paddr
= 0; /* match other core phdrs */
34 if (!dump_emit(cprm
, &phdr
, sizeof(phdr
)))
41 int elf_core_write_extra_data(struct coredump_params
*cprm
)
43 if ( vsyscall_ehdr
) {
44 const struct elfhdr
*const ehdrp
=
45 (struct elfhdr
*) vsyscall_ehdr
;
46 const struct elf_phdr
*const phdrp
=
47 (const struct elf_phdr
*) (vsyscall_ehdr
+ ehdrp
->e_phoff
);
50 for (i
= 0; i
< ehdrp
->e_phnum
; ++i
) {
51 if (phdrp
[i
].p_type
== PT_LOAD
) {
52 void *addr
= (void *) phdrp
[i
].p_vaddr
;
53 size_t filesz
= phdrp
[i
].p_filesz
;
54 if (!dump_emit(cprm
, addr
, filesz
))
62 size_t elf_core_extra_data_size(void)
64 if ( vsyscall_ehdr
) {
65 const struct elfhdr
*const ehdrp
=
66 (struct elfhdr
*)vsyscall_ehdr
;
67 const struct elf_phdr
*const phdrp
=
68 (const struct elf_phdr
*) (vsyscall_ehdr
+ ehdrp
->e_phoff
);
71 for (i
= 0; i
< ehdrp
->e_phnum
; ++i
)
72 if (phdrp
[i
].p_type
== PT_LOAD
)
73 return (size_t) phdrp
[i
].p_filesz
;