[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131004103141.1612.89888.stgit@f19-x64>
Date: Fri, 04 Oct 2013 16:01:41 +0530
From: Janani Venkataraman <jananive@...ibm.com>
To: linux-kernel@...r.kernel.org
Cc: amwang@...hat.com, rdunlap@...otime.net, andi@...stfloor.org,
aravinda@...ux.vnet.ibm.com, hch@....de, mhiramat@...hat.com,
jeremy.fitzhardinge@...rix.com, xemul@...allels.com,
suzuki@...ux.vnet.ibm.com, kosaki.motohiro@...fujitsu.com,
adobriyan@...il.com, tarundsk@...ux.vnet.ibm.com,
vapier@...too.org, roland@...k.frob.com, tj@...nel.org,
ananth@...ux.vnet.ibm.com, gorcunov@...nvz.org, avagin@...nvz.org,
oleg@...hat.com, eparis@...hat.com, d.hatayama@...fujitsu.com,
james.hogan@...tec.com, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org
Subject: [PATCH 08/19] elf_core_copy_extra_phdrs() for UML
From:Suzuki K. Poulose <suzuki@...ibm.com>
elf_core_copy_extra_phdrs() for UML. Adapted from elf_core_write_extra_phdrs()
Signed-off-by: Suzuki K. Poulose <suzuki@...ibm.com>
---
arch/x86/um/elfcore.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/arch/x86/um/elfcore.c b/arch/x86/um/elfcore.c
index 6bb49b6..edecfce 100644
--- a/arch/x86/um/elfcore.c
+++ b/arch/x86/um/elfcore.c
@@ -41,6 +41,38 @@ int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size,
return 1;
}
+int elf_core_copy_extra_phdrs(char *bufp, loff_t offset, size_t *size,
+ unsigned long limit)
+{
+ if (vsyscall_ehdr) {
+ const struct elfhdr *const ehdrp =
+ (struct elfhdr *) vsyscall_ehdr;
+ const struct elf_phdr *const phdrp =
+ (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff);
+ struct elf_phdr *phdr = (struct elf_phdr *)bufp;
+ int i;
+ Elf32_Off ofs = 0;
+
+ for (i = 0; i < ehdrp->e_phnum; ++i) {
+ *size += sizeof(*phdr);
+ if (*size > limit)
+ return 0;
+
+ *phdr = phdrp[i];
+
+ if (phdr.p_type == PT_LOAD) {
+ ofs = phdr.p_offset = offset;
+ offset += phdr.p_filesz;
+ } 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)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists