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