qemu/qemu-bios-bigger-roms.patch
Mark McLoughlin 997cc54758 Doesn't build yet:
In file included from /git/qemu-kvm/hw/ppc440.c:23: ../kvm.h:35: error:
    conflicting types for ‘kvm_init’ ../libkvm-all.h:180: note:
    previous declaration of ‘kvm_init’ was here
0.10.50-7.kvm87
- Update to kvm-87
- Drop upstreamed patches
- Re-enable preadv()/pwritev() since #497429 is long since fixed
2009-06-27 15:10:13 +00:00

81 lines
1.7 KiB
Diff

From f5042b31db5e1270f7bd96a6f4b20fd63dcb013b Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer@redhat.com>
Date: Wed, 24 Jun 2009 14:31:41 +0100
Subject: [PATCH] compute checksum for roms bigger than a segment
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>
---
kvm/bios/rombios.c | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c
index 6186199..fc289c0 100644
--- a/kvm/bios/rombios.c
+++ b/kvm/bios/rombios.c
@@ -10170,22 +10170,43 @@ no_serial:
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
--
1.6.2.2