Blame 0001-Workaround-for-a-win8.1-32-S4-resume-bug.patch

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