Module Name:    src
Committed By:   jakllsch
Date:           Wed Jan  5 23:13:02 UTC 2011

Modified Files:
        src/sys/arch/i386/stand/boot: Makefile.boot biosboot.S boot2.c version
        src/sys/sys: bootblock.h

Log Message:
Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/boot/biosboot.S
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/i386/stand/boot/boot2.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/boot/version
cvs rdiff -u -r1.50 -r1.51 src/sys/sys/bootblock.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/boot/Makefile.boot
diff -u src/sys/arch/i386/stand/boot/Makefile.boot:1.47 src/sys/arch/i386/stand/boot/Makefile.boot:1.48
--- src/sys/arch/i386/stand/boot/Makefile.boot:1.47	Mon Dec 20 00:55:10 2010
+++ src/sys/arch/i386/stand/boot/Makefile.boot	Wed Jan  5 23:13:01 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.boot,v 1.47 2010/12/20 00:55:10 jakllsch Exp $
+# $NetBSD: Makefile.boot,v 1.48 2011/01/05 23:13:01 jakllsch Exp $
 
 S=	${.CURDIR}/../../../../..
 
@@ -32,7 +32,6 @@
 .PATH:	${.CURDIR}/.. ${.CURDIR}/../../lib
 
 LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
-# CPPFLAGS+= -D__daddr_t=int32_t
 CPPFLAGS+= -I ${.CURDIR}/..  -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
 CPPFLAGS+= -I ${.OBJDIR}
 #CPPFLAGS+= -DDEBUG_MEMSIZE

Index: src/sys/arch/i386/stand/boot/biosboot.S
diff -u src/sys/arch/i386/stand/boot/biosboot.S:1.7 src/sys/arch/i386/stand/boot/biosboot.S:1.8
--- src/sys/arch/i386/stand/boot/biosboot.S:1.7	Mon Dec 20 00:39:06 2010
+++ src/sys/arch/i386/stand/boot/biosboot.S	Wed Jan  5 23:13:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosboot.S,v 1.7 2010/12/20 00:39:06 jakllsch Exp $	*/
+/*	$NetBSD: biosboot.S,v 1.8 2011/01/05 23:13:01 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,8 +37,8 @@
  *
  * On entry:
  * 	%dl			BIOS drive number
- *	%ebx			Sector number of netbsd partition
- *	%ds:%esi		Boot parameter block (patched by installboot)
+ *	%ecx:%ebx		Sector number of NetBSD partition
+ *	%ds:%si			Boot parameter block (patched by installboot)
  *	%cs			0x1000
  *	%ds, %es, %ss		All zero
  *	%sp			near 0xfffc
@@ -77,6 +77,8 @@
 	mov	%cs, %ax
 	mov	%ax, %es
 
+	movl	%ecx, %ebp		/* move LBA out of the way */
+
 	/* Grab boot_params patched into bootxx by installboot */
 	cmpl	$X86_BOOT_MAGIC_1,-4(%si)	/* sanity check ptr */
 	jne	2f
@@ -110,11 +112,17 @@
 	rep
 	stosl
 
-	and	$0xff, %edx
+	testb	$X86_BP_FLAGS_LBA64VALID, boot_params+4
+	jnz	1f
+	xorl	%ebp, %ebp		/* high part of LBA is not valid */
+1:
+
+	movzbl	%dl, %edx
+	push	%ebp			/* high 32 bits of first sector */
 	push	%ebx			/* first sector of bios partition */
 	push	%edx			/* bios disk */
 	call	_C_LABEL(boot2)		/* C bootstrap code */
-	add	$8, %esp
+	addl	$12, %esp
 	call	prot_to_real
 	.code16
 

Index: src/sys/arch/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.50 src/sys/arch/i386/stand/boot/boot2.c:1.51
--- src/sys/arch/i386/stand/boot/boot2.c:1.50	Mon Dec 20 01:12:44 2010
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Jan  5 23:13:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.50 2010/12/20 01:12:44 jakllsch Exp $	*/
+/*	$NetBSD: boot2.c,v 1.51 2011/01/05 23:13:01 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
 int errno;
 
 int boot_biosdev;
-u_int boot_biossector;
+daddr_t boot_biossector;
 
 static const char * const names[][2] = {
 	{ "netbsd", "netbsd.gz" },
@@ -112,7 +112,7 @@
 char *sprint_bootsel(const char *);
 void bootit(const char *, int, int);
 void print_banner(void);
-void boot2(int, u_int);
+void boot2(int, uint64_t);
 
 void	command_help(char *);
 void	command_ls(char *);
@@ -276,7 +276,7 @@
  * biossector: Sector number of the NetBSD partition
  */
 void
-boot2(int biosdev, u_int biossector)
+boot2(int biosdev, uint64_t biossector)
 {
 	extern char twiddle_toggle;
 	int currname;

Index: src/sys/arch/i386/stand/boot/version
diff -u src/sys/arch/i386/stand/boot/version:1.12 src/sys/arch/i386/stand/boot/version:1.13
--- src/sys/arch/i386/stand/boot/version:1.12	Wed Jan  5 22:28:05 2011
+++ src/sys/arch/i386/stand/boot/version	Wed Jan  5 23:13:01 2011
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.12 2011/01/05 22:28:05 jakllsch Exp $
+$NetBSD: version,v 1.13 2011/01/05 23:13:01 jakllsch Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -44,3 +44,4 @@
 	restored on ACPI resume.
 5.5:	Adjust stack and heap areas to not overlap.
 5.6:	GUID Partition Table support.
+5.7:	Recognize 64-bit LBA from bootxx.

Index: src/sys/sys/bootblock.h
diff -u src/sys/sys/bootblock.h:1.50 src/sys/sys/bootblock.h:1.51
--- src/sys/sys/bootblock.h:1.50	Sun Jan 17 14:54:43 2010
+++ src/sys/sys/bootblock.h	Wed Jan  5 23:13:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootblock.h,v 1.50 2010/01/17 14:54:43 drochner Exp $	*/
+/*	$NetBSD: bootblock.h,v 1.51 2011/01/05 23:13:01 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
@@ -1070,6 +1070,7 @@
 #define	X86_BP_FLAGS_PASSWORD		2
 #define	X86_BP_FLAGS_NOMODULES		4
 #define	X86_BP_FLAGS_NOBOOTCONF		8
+#define	X86_BP_FLAGS_LBA64VALID		0x10
 
 		/* values for bp_consdev */
 #define	X86_BP_CONSDEV_PC	0

Reply via email to