Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/stand/cdboot Support reading /boot > 64k. Bas...
details: https://anonhg.NetBSD.org/src/rev/ddce6acbde6a
branches: trunk
changeset: 748447:ddce6acbde6a
user: dsl <dsl%NetBSD.org@localhost>
date: Sat Oct 24 11:23:06 2009 +0000
description:
Support reading /boot > 64k. Based on the patch from Izumi Tsutsui.
Compiles but not actually tested! Fixes PR/42202
diffstat:
sys/arch/i386/stand/cdboot/cdboot.S | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
diffs (76 lines):
diff -r d50b697d7842 -r ddce6acbde6a sys/arch/i386/stand/cdboot/cdboot.S
--- a/sys/arch/i386/stand/cdboot/cdboot.S Sat Oct 24 11:22:48 2009 +0000
+++ b/sys/arch/i386/stand/cdboot/cdboot.S Sat Oct 24 11:23:06 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cdboot.S,v 1.9 2009/10/24 10:28:30 dsl Exp $ */
+/* $NetBSD: cdboot.S,v 1.10 2009/10/24 11:23:06 dsl Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -33,9 +33,6 @@
* This is a primary boot loader that loads a secondary boot loader
* directly from CD without performing floppy/hard disk emulation as
* described by the El Torito specification.
- *
- * TODO:
- * - Support for loading secondary boot loader > 64kB
*/
#include <machine/asm.h>
@@ -302,21 +299,34 @@
* %eax = LBA of starting sector
* %ebx = buffer to store sectors
* %dh = number of sectors to read
+ *
+ * Long transfers are split onto multiple 64k reads
*/
+#define MAX_SECTORS (0x10000/BLOCK_SIZE)
read_sectors:
- pusha
+ pushal
movl %eax, edd_lba
shrl $4, %ebx /* Convert buffer addr to seg:0 */
movw %bx, edd_segment
- movb %dh, edd_nsecs
- movb boot_drive, %dl
+1: movb %dh, edd_nsecs
+ cmpb $MAX_SECTORS, %dh
+ jle 2f /* j if less than 64k */
+ movb $MAX_SECTORS, edd_nsecs /* Read 16 sectors - 64k bytes */
+2: movb boot_drive, %dl
movw $edd_packet, %si
read_again:
movb $0x42, %ah
+ push %dx /* bios shouldn't kill %dh, but ... */
int $0x13
+ pop %dx /* ... better safe than sorry! */
jc read_fail
- popa
+ addw $0x1000, edd_segment /* Advance segment addr by 64k bytes */
+ addl $MAX_SECTORS, edd_lba /* And sector number to match */
+ sub edd_nsecs, %dh /* Number of sectors remaining */
+ jnz 1b
+ popal
ret
+
read_fail:
cmpb $ERROR_TIMEOUT, %ah
jz read_again
@@ -324,17 +334,6 @@
call message
jmp panic
-/*
- * For debugging purpose
- */
-put_char:
- pusha
- movb $0x0e, %ah
- movw $0x0001, %bx
- int $0x10
- popa
- ret
-
#include <message.S>
edd_packet:
Home |
Main Index |
Thread Index |
Old Index