qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Victor Kaplansky" <victork@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org, qemu-s390x@nongnu.org,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [Qemu-devel] [PATCH v2 1/3] tests/boot-sector: Add magic bytes to s390x boot code header
Date: Fri, 16 Mar 2018 06:39:53 +0100	[thread overview]
Message-ID: <1521178795-21894-2-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1521178795-21894-1-git-send-email-thuth@redhat.com>

We're going to use the s390x boot code for testing CD-ROM booting.
But the ISO loader of the s390-ccw bios is a little bit more picky
than the network loader and expects some magic bytes in the header
of the file (see linux_s390_magic in pc-bios/s390-ccw/bootmap.c), so
we've got to add them in our boot code here, too.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/boot-sector.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/boot-sector.c b/tests/boot-sector.c
index c373f0e..7824286 100644
--- a/tests/boot-sector.c
+++ b/tests/boot-sector.c
@@ -68,8 +68,11 @@ static uint8_t x86_boot_sector[512] = {
 };
 
 /* For s390x, use a mini "kernel" with the appropriate signature */
-static const uint8_t s390x_psw[] = {
-    0x00, 0x08, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00
+static const uint8_t s390x_psw_and_magic[] = {
+    0x00, 0x08, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,  /* Program status word  */
+    0x02, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x50,  /* Magic:               */
+    0x02, 0x00, 0x00, 0x68, 0x60, 0x00, 0x00, 0x50,  /* see linux_s390_magic */
+    0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40   /* in the s390-ccw bios */
 };
 static const uint8_t s390x_code[] = {
     0xa7, 0xf4, 0x00, 0x0a,                                /* j 0x10010 */
@@ -110,7 +113,7 @@ int boot_sector_init(char *fname)
     } else if (g_str_equal(arch, "s390x")) {
         len = 0x10000 + sizeof(s390x_code);
         boot_code = g_malloc0(len);
-        memcpy(boot_code, s390x_psw, sizeof(s390x_psw));
+        memcpy(boot_code, s390x_psw_and_magic, sizeof(s390x_psw_and_magic));
         memcpy(&boot_code[0x10000], s390x_code, sizeof(s390x_code));
     } else {
         g_assert_not_reached();
-- 
1.8.3.1

  reply	other threads:[~2018-03-16  5:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  5:39 [Qemu-devel] [PATCH v2 0/3] Add new CD-ROM related qtests Thomas Huth
2018-03-16  5:39 ` Thomas Huth [this message]
2018-03-16 11:58   ` [Qemu-devel] [PATCH v2 1/3] tests/boot-sector: Add magic bytes to s390x boot code header Philippe Mathieu-Daudé
2018-03-16  5:39 ` [Qemu-devel] [PATCH v2 2/3] tests/cdrom-test: Test booting from CD-ROM ISO image file Thomas Huth
2018-03-16 11:58   ` Philippe Mathieu-Daudé
2018-03-16  5:39 ` [Qemu-devel] [PATCH v2 3/3] tests/cdrom-test: Test that -cdrom parameter is working Thomas Huth
2018-03-16  5:54 ` [Qemu-devel] [PATCH v2 0/3] Add new CD-ROM related qtests Hervé Poussineau
2018-03-16 11:01 ` Mark Cave-Ayland
2018-03-16 12:56 ` Michael S. Tsirkin
2018-03-29 18:28 ` John Snow
2018-04-02 18:39   ` Thomas Huth
2018-04-02 19:34     ` John Snow
2018-04-02 19:43       ` Thomas Huth

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=1521178795-21894-2-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=hpoussin@reactos.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=victork@redhat.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).