diff --git a/sys/arch/i386/stand/lib/Makefile b/sys/arch/i386/stand/lib/Makefile index d310103d6e46..cc171e82fe57 100644 --- a/sys/arch/i386/stand/lib/Makefile +++ b/sys/arch/i386/stand/lib/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 1999/02/13 02:54:46 lukem Exp $ +# $NetBSD: Makefile,v 1.11 1999/03/08 21:44:48 drochner Exp $ S?= ${.CURDIR}/../../../../ @@ -18,7 +18,8 @@ CPPFLAGS= -I$S/lib/libsa ${I386CPPFLAGS} ${I386MISCCPPFLAGS} SRCS= pcio.c conio.S comio.S comio_direct.c SRCS+= getsecs.c biosgetrtc.S biosdelay.S biosreboot.S gatea20.c SRCS+= biosmem.S getextmemx.c biosmemx.S -SRCS+= pread.c menuutils.c parseutils.c bootinfo.c bootinfo_biosgeom.c +SRCS+= pread.c menuutils.c parseutils.c +SRCS+= bootinfo.c bootinfo_biosgeom.c bootinfo_memmap.c SRCS+= loadfile.c startprog.S netbsd_opts.c panic.c .if (${I386_INCLUDE_DISK} == "yes") SRCS+= biosdisk.c biosdisk_ll.c bios_disk.S diff --git a/sys/arch/i386/stand/lib/bootinfo.h b/sys/arch/i386/stand/lib/bootinfo.h index d53d7f6788b5..3a4606836967 100644 --- a/sys/arch/i386/stand/lib/bootinfo.h +++ b/sys/arch/i386/stand/lib/bootinfo.h @@ -1,4 +1,4 @@ -/* $NetBSD: bootinfo.h,v 1.3 1999/03/08 00:09:25 fvdl Exp $ */ +/* $NetBSD: bootinfo.h,v 1.4 1999/03/08 21:44:48 drochner Exp $ */ /* * Copyright (c) 1997 @@ -53,3 +53,4 @@ extern struct bootinfo *bootinfo; void bi_add __P((struct btinfo_common*, int, int)); void bi_getbiosgeom __P((void)); +void bi_getmemmap __P((void)); diff --git a/sys/arch/i386/stand/lib/bootinfo_memmap.c b/sys/arch/i386/stand/lib/bootinfo_memmap.c new file mode 100644 index 000000000000..11e5c5e9971e --- /dev/null +++ b/sys/arch/i386/stand/lib/bootinfo_memmap.c @@ -0,0 +1,67 @@ +/* $NetBSD: bootinfo_memmap.c,v 1.1 1999/03/08 21:44:48 drochner Exp $ */ + +/* + * Copyright (c) 1999 + * Matthias Drochner. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project + * by Matthias Drochner. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "libi386.h" +#include "bootinfo.h" + +extern int getmementry __P((int *, int *)); + +void +bi_getmemmap() +{ + int buf[5], i, nranges, n; + struct btinfo_memmap *bimm; + + nranges = 0; + i = 0; + do { + if (getmementry(&i, buf)) + break; + nranges++; + } while (i); + + bimm = alloc(sizeof(struct btinfo_memmap) + + (nranges - 1) * sizeof(struct bi_memmap_entry)); + + i = 0; + for (n = 0; n < nranges; n++) { + getmementry(&i, buf); + bcopy(buf, &bimm->entry[n], sizeof(struct bi_memmap_entry)); + } + bimm->num = nranges; + + BI_ADD(bimm, BTINFO_MEMMAP, sizeof(struct btinfo_memmap) + + (nranges - 1) * sizeof(struct bi_memmap_entry)); +}