From: Michal Simek <monstr@monstr.eu>
To: linuxppc-dev@ozlabs.org
Cc: arnd@arndb.de, tmarri@apm.com, suzuki@in.ibm.com,
john.williams@petalogix.com
Subject: [RFC PATCH 3/7] powerpc: simpleboot get load address from ELF instead of assuming zero
Date: Thu, 16 Jun 2011 16:14:24 +0200 [thread overview]
Message-ID: <1308233668-24166-4-git-send-email-monstr@monstr.eu> (raw)
In-Reply-To: <1308233668-24166-3-git-send-email-monstr@monstr.eu>
From: John Williams <john.williams@petalogix.com>
simpleboot current assumes that the physical load address is zero, even if
the ELF payload has a non-zero paddr.
This is a simple fix that avoids a custom pltform_ops handler in this case.
Signed-off-by: John Williams <john.williams@petalogix.com>
---
arch/powerpc/boot/elf.h | 1 +
arch/powerpc/boot/elf_util.c | 2 ++
arch/powerpc/boot/main.c | 1 +
3 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/elf.h b/arch/powerpc/boot/elf.h
index 1941bc5..39af242 100644
--- a/arch/powerpc/boot/elf.h
+++ b/arch/powerpc/boot/elf.h
@@ -150,6 +150,7 @@ struct elf_info {
unsigned long loadsize;
unsigned long memsize;
unsigned long elfoffset;
+ unsigned long loadaddr;
};
int parse_elf64(void *hdr, struct elf_info *info);
int parse_elf32(void *hdr, struct elf_info *info);
diff --git a/arch/powerpc/boot/elf_util.c b/arch/powerpc/boot/elf_util.c
index 1567a0c..3aef4f0 100644
--- a/arch/powerpc/boot/elf_util.c
+++ b/arch/powerpc/boot/elf_util.c
@@ -43,6 +43,7 @@ int parse_elf64(void *hdr, struct elf_info *info)
info->loadsize = (unsigned long)elf64ph->p_filesz;
info->memsize = (unsigned long)elf64ph->p_memsz;
info->elfoffset = (unsigned long)elf64ph->p_offset;
+ info->loadaddr = (unsigned long)elf64ph->p_paddr;
return 1;
}
@@ -74,5 +75,6 @@ int parse_elf32(void *hdr, struct elf_info *info)
info->loadsize = elf32ph->p_filesz;
info->memsize = elf32ph->p_memsz;
info->elfoffset = elf32ph->p_offset;
+ info->loadaddr = elf32ph->p_paddr;
return 1;
}
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index a28f021..fbbffa5 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -56,6 +56,7 @@ static struct addr_range prep_kernel(void)
if (platform_ops.vmlinux_alloc) {
addr = platform_ops.vmlinux_alloc(ei.memsize);
} else {
+ addr = ei.loadaddr;
/*
* Check if the kernel image (without bss) would overwrite the
* bootwrapper. The device tree has been moved in fdt_init()
--
1.5.5.6
next prev parent reply other threads:[~2011-06-16 14:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-16 14:14 [RFC] Relocatable kernel for ppc44x Michal Simek
2011-06-16 14:14 ` [RFC PATCH 1/7] powerpc: ppc440 remove zero physical memory base assumption Michal Simek
2011-06-16 14:14 ` [RFC PATCH 2/7] powerpc: Permit non-zero physical start address for PPC44x Michal Simek
2011-06-16 14:14 ` Michal Simek [this message]
2011-06-16 14:14 ` [RFC PATCH 4/7] powerpc: Let simpleboot function with non zero-based memory maps Michal Simek
2011-06-16 14:14 ` [RFC PATCH 5/7] powerpc: Consider a non-zero boot address when computing the bootwrapper start Michal Simek
2011-06-16 14:14 ` [RFC PATCH 6/7] powerpc: Update the default FIT image to use the correct load/boot addresses Michal Simek
2011-06-16 14:14 ` [RFC PATCH 7/7] powerpc: Support RELOCATABLE kernel for PPC44x Michal Simek
2011-07-12 11:09 ` Suzuki Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308233668-24166-4-git-send-email-monstr@monstr.eu \
--to=monstr@monstr.eu \
--cc=arnd@arndb.de \
--cc=john.williams@petalogix.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=suzuki@in.ibm.com \
--cc=tmarri@apm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).