Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Pass a 64-bit boot partition base LBA into x86 /boot,



details:   https://anonhg.NetBSD.org/src/rev/358ca469eb5f
branches:  trunk
changeset: 760485:358ca469eb5f
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed Jan 05 23:13:01 2011 +0000

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

diffstat:

 sys/arch/i386/stand/boot/Makefile.boot |   3 +--
 sys/arch/i386/stand/boot/biosboot.S    |  18 +++++++++++++-----
 sys/arch/i386/stand/boot/boot2.c       |   8 ++++----
 sys/arch/i386/stand/boot/version       |   3 ++-
 sys/sys/bootblock.h                    |   3 ++-
 5 files changed, 22 insertions(+), 13 deletions(-)

diffs (133 lines):

diff -r 59d9d4f7f0fa -r 358ca469eb5f sys/arch/i386/stand/boot/Makefile.boot
--- a/sys/arch/i386/stand/boot/Makefile.boot    Wed Jan 05 22:57:01 2011 +0000
+++ b/sys/arch/i386/stand/boot/Makefile.boot    Wed Jan 05 23:13:01 2011 +0000
@@ -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
diff -r 59d9d4f7f0fa -r 358ca469eb5f sys/arch/i386/stand/boot/biosboot.S
--- a/sys/arch/i386/stand/boot/biosboot.S       Wed Jan 05 22:57:01 2011 +0000
+++ b/sys/arch/i386/stand/boot/biosboot.S       Wed Jan 05 23:13:01 2011 +0000
@@ -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
 
diff -r 59d9d4f7f0fa -r 358ca469eb5f sys/arch/i386/stand/boot/boot2.c
--- a/sys/arch/i386/stand/boot/boot2.c  Wed Jan 05 22:57:01 2011 +0000
+++ b/sys/arch/i386/stand/boot/boot2.c  Wed Jan 05 23:13:01 2011 +0000
@@ -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;
diff -r 59d9d4f7f0fa -r 358ca469eb5f sys/arch/i386/stand/boot/version
--- a/sys/arch/i386/stand/boot/version  Wed Jan 05 22:57:01 2011 +0000
+++ b/sys/arch/i386/stand/boot/version  Wed Jan 05 23:13:01 2011 +0000
@@ -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.
diff -r 59d9d4f7f0fa -r 358ca469eb5f sys/sys/bootblock.h
--- a/sys/sys/bootblock.h       Wed Jan 05 22:57:01 2011 +0000
+++ b/sys/sys/bootblock.h       Wed Jan 05 23:13:01 2011 +0000
@@ -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



Home | Main Index | Thread Index | Old Index