From: Thomas Huth <thuth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: agraf@suse.de, Thomas Huth <thuth@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH RFC 0/2] s390x: Make the s390-ccw BIOS relocatable
Date: Thu, 5 Mar 2015 12:02:19 +0100 [thread overview]
Message-ID: <1425553341-566-1-git-send-email-thuth@linux.vnet.ibm.com> (raw)
Currently, our s390-ccw.img sits at the fix address 126 MiB in memory.
This has two big disadvantages: 1) We can not start guests with less
than 128 MiB RAM and 2) if the guest uses a really huge ramdisk > 126 MiB,
the s390-ccw BIOS gets overwritten and the boot silently crashes.
These two patches now fix these problems by relocating the s390-ccw
BIOS to the end of the RAM. The basic idea here is to compile the
BIOS with the "-fpie" compiler option to create position independent
code. Sounds easy at a first glance - however, with -fpie, we only
get position independent _code_ - and a so called GOT (global offset
table) which contains absolute references to global variables again
(this is normally needed for supporting dynamic libraries - in our
s390-ccw BIOS, it's just bad luck that we get a GOT).
So to be able to really move around our s390-ccw.img in RAM, we've got
to relocate the entries in the GOT, too. This is what the first patch
is good for. I've changed the ELF loader there to parse the reloc section
of the ELF file. I only included the bare minimum of relocation types
(R_390_RELATIVE) in the patch so far, but this can easily be extended
in case we need more (with different compiler version etc.).
The second patch then adds the required changes to the s390-ccw BIOS
Makefile and our s390 ipl code in QEMU.
Now I'd like to get some feedback on this approach: Is it ok to extend
the ELF loader this way? Does anybody have better/nicer ideas to solve
the problem of a relocatable BIOS?
Thanks for any insights!
Thomas Huth (2):
elf-loader: Provide the possibility to relocate s390 ELF files
s390/bios: Make the s390-ccw.img relocatable
hw/core/loader.c | 2 +
hw/s390x/ipl.c | 23 +++++++++++++++-
include/elf.h | 2 +
include/hw/elf_ops.h | 60 +++++++++++++++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/Makefile | 11 ++++---
5 files changed, 91 insertions(+), 7 deletions(-)
next reply other threads:[~2015-03-05 11:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 11:02 Thomas Huth [this message]
2015-03-05 11:02 ` [Qemu-devel] [PATCH RFC 1/2] elf-loader: Provide the possibility to relocate s390 ELF files Thomas Huth
2015-03-05 11:02 ` [Qemu-devel] [PATCH RFC 2/2] s390/bios: Make the s390-ccw.img relocatable Thomas Huth
2015-03-05 11:10 ` [Qemu-devel] [PATCH RFC 0/2] s390x: Make the s390-ccw BIOS relocatable Alexander Graf
2015-03-05 12:43 ` Christian Borntraeger
2015-03-05 12:49 ` Alexander Graf
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=1425553341-566-1-git-send-email-thuth@linux.vnet.ibm.com \
--to=thuth@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
/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).