yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-tests-boot-sector-Fix-the-bad-s390x-assembler-code.patch

77c23f
From f73b18e03c6758500bf367b1575205772d1f878f Mon Sep 17 00:00:00 2001
77c23f
From: Thomas Huth <thuth@redhat.com>
77c23f
Date: Fri, 29 May 2020 05:53:52 -0400
77c23f
Subject: [PATCH 10/42] tests/boot-sector: Fix the bad s390x assembler code
77c23f
77c23f
RH-Author: Thomas Huth <thuth@redhat.com>
77c23f
Message-id: <20200529055420.16855-11-thuth@redhat.com>
77c23f
Patchwork-id: 97031
77c23f
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 10/38] tests/boot-sector: Fix the bad s390x assembler code
77c23f
Bugzilla: 1828317
77c23f
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
77c23f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
77c23f
RH-Acked-by: David Hildenbrand <david@redhat.com>
77c23f
77c23f
There are currently two bugs in s390x_code[]: First, the initial jump
77c23f
uses the wrong offset, so it was jumping to 0x10014 instead of 0x10010.
77c23f
Second, LHI only loads the lower 32-bit of the register.
77c23f
77c23f
Everything worked fine as long as the s390-ccw bios code was jumping
77c23f
here with r3 containing zeroes in the uppermost 48 bit - which just
77c23f
happened to be the case so far by accident. But we can not rely on this
77c23f
fact, and indeed one of the recent suggested patches to jump2ipl.c cause
77c23f
the newer GCCs to put different values into r3. In that case the code
77c23f
from s390x_code[] crashes very ungracefully.
77c23f
77c23f
Thus let's make sure to jump to the right instruction, and use LGHI
77c23f
instead of LHI to make sure that we always zero out the upper bits
77c23f
of the register.
77c23f
77c23f
Signed-off-by: Thomas Huth <thuth@redhat.com>
77c23f
Message-Id: <20191217150642.27946-1-thuth@redhat.com>
77c23f
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
77c23f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
77c23f
(cherry picked from commit 5afec76fbe2c07d03fd8c9ac525140059499637a)
77c23f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
77c23f
---
77c23f
 tests/boot-sector.c | 4 ++--
77c23f
 1 file changed, 2 insertions(+), 2 deletions(-)
77c23f
77c23f
diff --git a/tests/boot-sector.c b/tests/boot-sector.c
77c23f
index 7824286b9a..9e66c6d013 100644
77c23f
--- a/tests/boot-sector.c
77c23f
+++ b/tests/boot-sector.c
77c23f
@@ -75,11 +75,11 @@ static const uint8_t s390x_psw_and_magic[] = {
77c23f
     0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40   /* in the s390-ccw bios */
77c23f
 };
77c23f
 static const uint8_t s390x_code[] = {
77c23f
-    0xa7, 0xf4, 0x00, 0x0a,                                /* j 0x10010 */
77c23f
+    0xa7, 0xf4, 0x00, 0x08,                                /* j 0x10010 */
77c23f
     0x00, 0x00, 0x00, 0x00,
77c23f
     'S', '3', '9', '0',
77c23f
     'E', 'P', 0x00, 0x01,
77c23f
-    0xa7, 0x38, HIGH(SIGNATURE_ADDR), LOW(SIGNATURE_ADDR), /* lhi r3,0x7c10 */
77c23f
+    0xa7, 0x39, HIGH(SIGNATURE_ADDR), LOW(SIGNATURE_ADDR), /* lghi r3,0x7c10 */
77c23f
     0xa7, 0x48, LOW(SIGNATURE), HIGH(SIGNATURE),           /* lhi r4,0xadde */
77c23f
     0x40, 0x40, 0x30, 0x00,                                /* sth r4,0(r3) */
77c23f
     0xa7, 0xf4, 0xff, 0xfa                                 /* j 0x10010 */
77c23f
-- 
77c23f
2.27.0
77c23f