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

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