Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 85

kvm-83-270.el5_11.src.rpm

From 9ce535bb48a68089614e089ee900f5e55a466e70 Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer@redhat.com>
Date: Thu, 24 Dec 2009 22:10:05 -0200
Subject: [PATCH 2/6] BZ550265 compute checksum for roms bigger than a segment.

RH-Author: Glauber Costa <glommer@redhat.com>
Message-id: <1261692605-24930-1-git-send-email-glommer@redhat.com>
Patchwork-id: 5937
O-Subject: [PATCH] BZ550265 compute checksum for roms bigger than a segment.
Bugzilla: 550265
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Naphtali Sprei <nsprei@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>

This is upstream in bochs CVS (argh) for quite a while now.
The basic problem is that the bios assumed any oprom would
fit a segment (therefore, 64k). Roms bigger than 64k, like
e1000, would then fail to load.

Signed-off-by: Glauber Costa <glommer@redhat.com>
RH-Upstream-status: bochs cvs
RH-Bugzilla: 550265
---
 bios/rombios.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 bios/rombios.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/bios/rombios.c b/bios/rombios.c
index 89c5b16..df8dbe8 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -10205,22 +10205,44 @@ 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
+  jz 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.3.rc4.29.g8146