Skip to contentSkip to conversation

rombios: compute checksum for roms bigger than a segment

PATCH New Akio Takebe 1 participant 1 message Jun 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rombios: compute checksum for roms bigger than a segment

Hi,

If we use gPXE with e1000 driver, the size of the gPXE rom is bigger than a segment. The current rombios cannot compute the checksum of such a rom.
I ported the following patch to xen.
http://www.nabble.com/-PATCH--compute-checksum-for-roms-bigger-than-a-segment-td22752831.html

FYI, the below is a BIOS map with gPXE of e1000.
(XEN) HVM5: BIOS map:

(XEN) HVM5:  c0000-c8fff: VGA BIOS
(XEN) HVM5:  c9000-d97ff: Etherboot ROM
(XEN) HVM5:  eb000-eb175: SMBIOS tables
(XEN) HVM5:  f0000-fffff: Main BIOS

From: Glauber Costa <[email protected]>
From: "Sebastian Herbszt" <[email protected]> Ported by: Akio Takebe <[email protected]>

Best Regards,

Akio Takebe

tools/firmware/rombios/rombios.c +28 -6
diff -r f72d26c00002 tools/firmware/rombios/rombios.c
@@ -10439,22 +10439,44 @@
   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
 
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel