Messages in this thread Patch in this message | | | Date | Tue, 14 Dec 2010 15:38:28 +0530 | From | "Suzuki K. Poulose" <> | Subject | [Patch 8/21] ia64 Implementation of elf_core_copy_extra_phdrs() |
| |
ia64 impelementation for elf_core_copy_extra_phdrs(). Adapted from elf_core_write_extra_phdrs().
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> --- arch/ia64/kernel/elfcore.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
Index: linux-2.6.36-rc7/arch/ia64/kernel/elfcore.c =================================================================== --- linux-2.6.36-rc7.orig/arch/ia64/kernel/elfcore.c +++ linux-2.6.36-rc7/arch/ia64/kernel/elfcore.c @@ -42,6 +42,40 @@ int elf_core_write_extra_phdrs(struct fi return 1; } +int elf_core_copy_extra_phdrs(char *bufp, loff_t offset, size_t *size, + unsigned long limit) +{ + const struct elf_phdr *const gate_phdrs = + (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); + int i; + Elf64_Off ofs = 0; + struct elf_phdr *phdr = (struct elf_phdr *) bufp; + + for (i = 0; i < GATE_EHDR->e_phnum; ++i) { + *size += sizeof(*phdr); + if (*size > limit) + return 0; + + *phdr = gate_phdrs[i]; + + if (phdr->p_type == PT_LOAD) { + phdr->p_memsz = PAGE_ALIGN(phdr->p_memsz); + phdr->p_filesz = phdr->p_memsz; + if (ofs == 0) { + ofs = phdr->p_offset = *offset; + offset += phdr->p_filesz; + } else { + phdr->p_offset = ofs; + } + } else { + phdr->p_offset += ofs; + } + phdr->p_paddr = 0; /* match other core phdrs */ + phdr++; + } + return 1; +} + int elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit) {
| |