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

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