2009-09-28 07:30:15 +00:00
|
|
|
From b5c99e96655e8dc938f801e1ac0dbdf2d6dfba37 Mon Sep 17 00:00:00 2001
|
2009-06-24 16:22:39 +00:00
|
|
|
From: Glauber Costa <glommer@redhat.com>
|
|
|
|
Date: Wed, 24 Jun 2009 14:31:41 +0100
|
2009-07-28 07:59:51 +00:00
|
|
|
Subject: [PATCH] compute checksum for roms bigger than a segment
|
2009-06-24 16:22:39 +00:00
|
|
|
|
|
|
|
Some option roms (e1000 provided by gpxe project as an example)
|
|
|
|
are bigger than a segment. The current algorithm to compute the
|
|
|
|
checksum fails in such case. To proper compute the checksum, this
|
|
|
|
patch deals with the possibility of the rom's size crossing a
|
|
|
|
segment border.
|
|
|
|
|
|
|
|
We don't need to worry about it crossing more than one segment
|
|
|
|
border, since the option roms format only save one byte to store
|
|
|
|
the image size (thus, maximum size = 0xff = 128k = 2 segments)
|
|
|
|
|
|
|
|
[ including improvements suggested by malc ]
|
|
|
|
|
|
|
|
Signed-off-by: Glauber Costa <glommer@redhat.com>
|
|
|
|
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
|
2009-07-28 08:17:19 +00:00
|
|
|
Fedora-patch: qemu-bios-bigger-roms.patch
|
2009-06-24 16:22:39 +00:00
|
|
|
---
|
|
|
|
kvm/bios/rombios.c | 33 +++++++++++++++++++++++++++------
|
|
|
|
1 files changed, 27 insertions(+), 6 deletions(-)
|
|
|
|
|
2009-05-20 15:24:23 +00:00
|
|
|
diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c
|
2009-07-30 16:28:52 +00:00
|
|
|
index 6e1d446..8a96d8e 100644
|
2009-05-20 15:24:23 +00:00
|
|
|
--- a/kvm/bios/rombios.c
|
|
|
|
+++ b/kvm/bios/rombios.c
|
2009-07-30 16:28:52 +00:00
|
|
|
@@ -10189,22 +10189,43 @@ no_serial:
|
2009-04-02 03:51:08 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
rom_checksum:
|
|
|
|
- push ax
|
|
|
|
- push bx
|
|
|
|
- push cx
|
|
|
|
+ pusha
|
|
|
|
+ push ds
|
|
|
|
+
|
|
|
|
xor ax, ax
|
|
|
|
xor bx, bx
|
|
|
|
xor cx, cx
|
|
|
|
+ xor dx, dx
|
|
|
|
+
|
|
|
|
mov ch, [2]
|
|
|
|
shl cx, #1
|
|
|
|
+
|
|
|
|
+ jnc checksum_loop
|
|
|
|
+ xchg dx, cx
|
|
|
|
+ dec cx
|
|
|
|
+
|
|
|
|
checksum_loop:
|
|
|
|
add al, [bx]
|
|
|
|
inc bx
|
|
|
|
loop checksum_loop
|
|
|
|
+
|
|
|
|
+ test dx, dx
|
|
|
|
+ je checksum_out
|
|
|
|
+
|
|
|
|
+ add al, [bx]
|
|
|
|
+ mov cx, dx
|
|
|
|
+ mov dx, ds
|
|
|
|
+ add dh, #0x10
|
|
|
|
+ mov ds, dx
|
|
|
|
+ xor dx, dx
|
|
|
|
+ xor bx, bx
|
|
|
|
+
|
|
|
|
+ jmp checksum_loop
|
|
|
|
+
|
|
|
|
+checksum_out:
|
|
|
|
and al, #0xff
|
|
|
|
- pop cx
|
|
|
|
- pop bx
|
|
|
|
- pop ax
|
|
|
|
+ pop ds
|
|
|
|
+ popa
|
|
|
|
ret
|
2009-06-24 16:22:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
2009-07-28 07:59:51 +00:00
|
|
|
1.6.2.5
|
2009-06-24 16:22:39 +00:00
|
|
|
|