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

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