rpms/kvm/F-10 kvm-int13.patch,NONE,1.1 kvm.spec,1.74,1.75

Glauber Costa glommer at fedoraproject.org
Tue Dec 2 15:57:33 UTC 2008


Author: glommer

Update of /cvs/pkgs/rpms/kvm/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv4990

Modified Files:
	kvm.spec 
Added Files:
	kvm-int13.patch 
Log Message:
Properly set flags for interrupt return #474059



kvm-int13.patch:

--- NEW FILE kvm-int13.patch ---
>From c7ad3762330b685f523b1be1f0fc3caa8d3e29c6 Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer at redhat.com>
Date: Mon, 1 Dec 2008 14:30:22 -0500
Subject: [PATCH] extboot: properly set int 0x13 return value

Callers of int 0x13 usually rely on the carry flag being
clear/set to indicate the status of the interrupt execution.

However, our current code clear or set the flags register,
which is totally useless. Whichever value it has, will
be overwritten by the flags value _before_ the interrupt, due to
the iret instruction.

This fixes a bug that prevents slackware (and possibly win2k, untested)
to boot.

Signed-off-by: Glauber Costa <glommer at redhat.com>
---
 extboot/extboot.S |   52 ++++++++++++++++++++++++++--------------------------
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/extboot/extboot.S b/extboot/extboot.S
index 2630abb..e3d1adf 100644
--- a/extboot/extboot.S
+++ b/extboot/extboot.S
@@ -99,24 +99,24 @@ int19_handler:
 
 #define FLAGS_CF	0x01
 
-.macro clc
-	push %ax
-	pushf
-	pop %ax
-	and $(~FLAGS_CF), %ax
-	push %ax
-	popf
-	pop %ax
+/* The two macro below clear/set the carry flag to indicate the status
+ * of the interrupt execution. It is not enough to issue a clc/stc instruction,
+ * since the value of the flags register will be overwritten by whatever is
+ * in the stack frame
+ */
+.macro clc_stack
+	push %bp
+	mov %sp, %bp
+	/* 8 = 2 (bp, just pushed) + 2 (ip) + 3 (real mode interrupt frame) */
+	and $(~FLAGS_CF), 8(%bp)
+	pop %bp
 .endm
 
-.macro stc
-	push %ax
-	pushf
-	pop %ax
-	or $(FLAGS_CF), %ax
-	push %ax
-	popf
-	pop %ax
+.macro stc_stack
+	push %bp
+	/* 8 = 2 (bp, just pushed) + 2 (ip) + 3 (real mode interrupt frame) */
+	or $(FLAGS_CF), 8(%bp)
+	pop %bp
 .endm
 
 /* we clobber %bx */
@@ -292,7 +292,7 @@ mul32:  /* lo,      hi,     lo,     hi */
 
 disk_reset:
 	movb $0, %ah
-	clc
+	clc_stack
 	ret
 
 /* this really should be a function, not a macro but i'm lazy */
@@ -395,7 +395,7 @@ disk_reset:
 	pop %ax
 
 	mov $0, %ah
-	clc
+	clc_stack
 	ret
 .endm
 
@@ -454,12 +454,12 @@ read_disk_drive_parameters:
 	pop %bx
 
 	/* do this last since it's the most sensitive */
-	clc
+	clc_stack
 	ret
 
 alternate_disk_reset:
 	movb $0, %ah
-	clc
+	clc_stack
 	ret
 
 read_disk_drive_size:
@@ -498,21 +498,21 @@ read_disk_drive_size:
 	freea
 	pop %bx
 
-	clc
+	clc_stack
 	ret
 
 check_if_extensions_present:
 	mov $0x30, %ah
 	mov $0xAA55, %bx
 	mov $0x07, %cx
-	clc
+	clc_stack
 	ret
 
 .macro extended_read_write_sectors cmd
 	cmpb $10, 0(%si)
 	jg 1f
 	mov $1, %ah
-	stc
+	stc_stack
 	ret
 1:
 	push %ax
@@ -544,7 +544,7 @@ check_if_extensions_present:
 	pop %ax
 
 	mov $0, %ah
-	clc
+	clc_stack
 	ret
 .endm
 
@@ -612,12 +612,12 @@ get_extended_drive_parameters:
 	pop %ax
 
 	mov $0, %ah
-	clc
+	clc_stack
 	ret
 
 terminate_disk_emulation:
 	mov $1, %ah
-	stc
+	stc_stack
 	ret
 
 int13_handler:
-- 
1.5.6.5



Index: kvm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kvm/F-10/kvm.spec,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- kvm.spec	24 Nov 2008 19:14:00 -0000	1.74
+++ kvm.spec	2 Dec 2008 15:57:02 -0000	1.75
@@ -1,7 +1,7 @@
 Summary: Kernel-based Virtual Machine
 Name: kvm
 Version: 74
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: Development/Tools
 URL: http://%{name}.sf.net
@@ -15,6 +15,7 @@
 Patch4: %{name}-fix-pc-bios-make-install-missing-files.patch
 Patch5: %{name}-cirrus-cve-2008-4539.patch
 Patch6: %{name}-restore-option-rom.patch
+Patch7: %{name}-int13.patch
 # patches from upstream qemu
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: SDL-devel
@@ -52,6 +53,7 @@
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 # we must not use any of the binaries from the qemu/pc-bios/ directory,
 # as they don't have the corresponding sources shipped with them
 rm -f qemu/pc-bios/*
@@ -142,6 +144,9 @@
 %{_sysconfdir}/sysconfig/modules/%{name}.modules
 
 %changelog
+* Tue Dec 02 2008 Glauber Costa <glommer at redhat.com> - 74-8
+- Properly set flags for interrupt return #474059
+
 * Mon Nov 24 2008 Glauber Costa <glommer at redhat.com> - 74-7
 - added upstream patch kvm-restore-option-rom.patch - #470561
 




More information about the fedora-extras-commits mailing list