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

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