Pass a 64-bit boot partition base LBA into x86 /boot,

while maintaining compatibility with existing bootxx code.
This commit is contained in:
jakllsch 2011-01-05 23:13:01 +00:00
parent f4b63a89c1
commit 6808b172e4
5 changed files with 22 additions and 13 deletions

View File

@ -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 @@ BINMODE=444
.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

View File

@ -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 @@ boot_start_1:
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 @@ boot_start_1:
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

View File

@ -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 @@ extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
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 @@ static const char *default_filename;
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 @@ print_banner(void)
* 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;

View File

@ -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 @@ is taken as the current.
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.

View File

@ -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 @@ struct x86_boot_params {
#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