Blame SOURCES/0004-Workaround-for-a-win8.1-32-S4-resume-bug.patch

bde9c9
From 0182f348c6bc7cb676cb52941cbb0b220639c4e0 Mon Sep 17 00:00:00 2001
54e7d3
From: Radim Krcmar <rkrcmar@redhat.com>
54e7d3
Date: Mon, 10 Mar 2014 15:14:27 +0100
54e7d3
Subject: Workaround for a win8.1-32 S4 resume bug
54e7d3
MIME-Version: 1.0
54e7d3
Content-Type: text/plain; charset=UTF-8
54e7d3
Content-Transfer-Encoding: 8bit
54e7d3
54e7d3
RH-Author: Radim Krcmar <rkrcmar@redhat.com>
54e7d3
Message-id: <1394464467-23560-1-git-send-email-rkrcmar@redhat.com>
54e7d3
Patchwork-id: 58069
54e7d3
O-Subject: [RHEL7.0 seabios PATCH] Workaround for a win8.1-32 S4 resume bug
54e7d3
Bugzilla: 1050775
54e7d3
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
54e7d3
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
54e7d3
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
54e7d3
54e7d3
bug:  https://bugzilla.redhat.com/show_bug.cgi?id=1050775
54e7d3
brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7176174
54e7d3
This patch has no upstream equivalent.
54e7d3
54e7d3
When a 32 bit version of windows 8.1 resumes from suspend, it writes 1
54e7d3
into 0x72 in the early boot because it didn't expect a NULL pointer.
54e7d3
0x72 is lower offset byte of 0x1c interrupt entry, so we jump into a
54e7d3
middle of other function if this interrupt is triggered.
54e7d3
54e7d3
Because 0x1c is only triggered from our handle_08, we detect if our
54e7d3
default value (function that does only iret) has its lower offset byte
54e7d3
overwritten and skip it in that case.
54e7d3
(Windows never sets own callback there, so we always detect this bug
54e7d3
 correctly, as seabios doesn't use it either
54e7d3
 Other sources shouldn't incorrectly overwrite it or use seabios code,
54e7d3
 but it is quite ok even if the guest did this on purpose.)
54e7d3
54e7d3
The reason Windows uses NULL pointer is still unknown, but this bug is
54e7d3
blocking WHQL certification, so we have to work around it in 7.0.
54e7d3
54e7d3
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
bde9c9
bde9c9
(cherry picked from commit 8629f200084ce1aab31d193280d34b5fb16e543f)
bde9c9
Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
54e7d3
---
54e7d3
 src/clock.c | 8 +++++++-
54e7d3
 1 file changed, 7 insertions(+), 1 deletion(-)
54e7d3
54e7d3
diff --git a/src/clock.c b/src/clock.c
bde9c9
index e44e1120..298a7229 100644
54e7d3
--- a/src/clock.c
54e7d3
+++ b/src/clock.c
54e7d3
@@ -309,7 +309,13 @@ handle_08(void)
54e7d3
     struct bregs br;
54e7d3
     memset(&br, 0, sizeof(br));
54e7d3
     br.flags = F_IF;
54e7d3
-    call16_int(0x1c, &br);
54e7d3
+    struct segoff_s isr1c = GET_IVT(0x1c);
54e7d3
+    // hardcoded address of entry_iret_official with lower segment byte
54e7d3
+    // overwritten by 1
54e7d3
+    if (isr1c.seg == ((SEG_BIOS & ~0xff) | 0x1) && isr1c.offset == 0xff53)
54e7d3
+        dprintf(1, "Worked around win8.1-32 S4 resume bug\n");
54e7d3
+    else
54e7d3
+        call16_int(0x1c, &br);
54e7d3
 
54e7d3
     pic_eoi1();
54e7d3
 }
54e7d3
-- 
bde9c9
2.31.1
54e7d3