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 file
*file
, loff_t offset
, size_t *size
,
17 if ( vsyscall_ehdr
) {
18 const struct elfhdr
*const ehdrp
=
19 (struct elfhdr
*) vsyscall_ehdr
;
20 const struct elf_phdr
*const phdrp
=
21 (const struct elf_phdr
*) (vsyscall_ehdr
+ ehdrp
->e_phoff
);
25 for (i
= 0; i
< ehdrp
->e_phnum
; ++i
) {
26 struct elf_phdr phdr
= phdrp
[i
];
28 if (phdr
.p_type
== PT_LOAD
) {
29 ofs
= phdr
.p_offset
= offset
;
30 offset
+= phdr
.p_filesz
;
34 phdr
.p_paddr
= 0; /* match other core phdrs */
35 *size
+= sizeof(phdr
);
37 || !dump_write(file
, &phdr
, sizeof(phdr
)))
44 int elf_core_write_extra_data(struct file
*file
, size_t *size
,
47 if ( vsyscall_ehdr
) {
48 const struct elfhdr
*const ehdrp
=
49 (struct elfhdr
*) vsyscall_ehdr
;
50 const struct elf_phdr
*const phdrp
=
51 (const struct elf_phdr
*) (vsyscall_ehdr
+ ehdrp
->e_phoff
);
54 for (i
= 0; i
< ehdrp
->e_phnum
; ++i
) {
55 if (phdrp
[i
].p_type
== PT_LOAD
) {
56 void *addr
= (void *) phdrp
[i
].p_vaddr
;
57 size_t filesz
= phdrp
[i
].p_filesz
;
61 || !dump_write(file
, addr
, filesz
))
69 size_t elf_core_extra_data_size(void)
71 if ( vsyscall_ehdr
) {
72 const struct elfhdr
*const ehdrp
=
73 (struct elfhdr
*)vsyscall_ehdr
;
74 const struct elf_phdr
*const phdrp
=
75 (const struct elf_phdr
*) (vsyscall_ehdr
+ ehdrp
->e_phoff
);
78 for (i
= 0; i
< ehdrp
->e_phnum
; ++i
)
79 if (phdrp
[i
].p_type
== PT_LOAD
)
80 return (size_t) phdrp
[i
].p_filesz
;