Load the kernel symbol table in the boot loader and not at compile time.

(Boot with the -D flag if you want symbols.)

Make it easier to extend `struct bootinfo' without losing either forwards
or backwards compatibility.

ddb_aout.c:
Get the symbol table from wherever the loader put it.
Nuke db_symtab[SYMTAB_SPACE].

boot.c:
Enable loading of symbols.  Align them on a page boundary.  Add printfs
about the symbol table sizes.
Pass the memory sizes to the kernel.
Fix initialization of `unit' (it got moved out of the loop).
Fix adding the bss size (it got moved inside an ifdef).
Initialize serial port when RB_SERIAL is toggled on.
Fix comments.
Clean up formatting of recently added code.

io.c:
Clean up formatting of recently added code.

netboot/main.c, machdep.c, wd.c:
Change names of bootinfo fields.

LINT:
Nuke SYMTAB_SPACE.
Fix comment about DODUMP.

Makefile.i386:
Nuke use of dbsym.
Exclude gcc symbols from kernel unless compiling with -g.
Remove unused macro.
Fix comments and formatting.

genassym.c:
Generate defines for some new bootinfo fields.  Change names of old ones.

locore.s:
Copy only the valid part of the `struct bootinfo' passed by the loader.
Reserve space for symbol table, if any.

machdep.c:
Check the memory sizes passed by the loader, if any.  Don't use them yet.

bootinfo.h:
Add a size field so that we can resolve some mismatches between the loader
bootinfo and the kernel boot info.  The version number is not so good for
this because of historical botches and because it's harder to maintain.
Add memory size and symbol table fields.  Change the names of everything.

Hacks to save a few bytes:

asm.S, boot.c, boot2.S:
Replace `ouraddr' by `(BOOTSEG << 4)'.

boot.c:
Don't statically initialize `loadflags' to 0.  Disable the "REDUNDANT"
code that skips the BIOS variables.  Eliminate `total'.  Combine some
more printfs.

boot.h, disk.c, io.c, table.c:
Move all statically initialzed data to table.c.

io.c:
Don't put the A20 gate bits in a variable.
This commit is contained in:
Bruce Evans 1995-01-25 21:40:47 +00:00
parent 61b1d15857
commit b5d89ca8ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5908
24 changed files with 411 additions and 212 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $Id: genassym.c,v 1.21 1994/12/03 10:02:20 bde Exp $ * $Id: genassym.c,v 1.22 1995/01/21 15:22:28 bde Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -76,7 +76,7 @@ main()
struct pcb *pcb = (struct pcb *)0; struct pcb *pcb = (struct pcb *)0;
struct trapframe *tf = (struct trapframe *)0; struct trapframe *tf = (struct trapframe *)0;
struct sigframe *sigf = (struct sigframe *)0; struct sigframe *sigf = (struct sigframe *)0;
struct bootinfo_t *bootinfo = (struct bootinfo_t *)0; struct bootinfo *bootinfo = (struct bootinfo *)0;
/* XXX should use %p to print pointers. About 80 lines are wrong. */ /* XXX should use %p to print pointers. About 80 lines are wrong. */
printf("#define\tUDOT_SZ %d\n", sizeof(struct user)); printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
@ -194,11 +194,16 @@ main()
printf("#define\tEFAULT %d\n", EFAULT); printf("#define\tEFAULT %d\n", EFAULT);
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG); printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN); printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN);
printf("#define\tBOOTINFO_SIZE %d\n", sizeof *bootinfo); printf("#define\tBOOTINFO_SIZE %d\n", sizeof *bootinfo);
printf("#define\tBOOTINFO_VERSION %d\n", &bootinfo->version); printf("#define\tBI_VERSION %d\n", &bootinfo->bi_version);
printf("#define\tBOOTINFO_KERNELNAME %d\n", &bootinfo->kernelname); printf("#define\tBI_KERNELNAME %d\n", &bootinfo->bi_kernelname);
printf("#define\tBOOTINFO_NFS_DISKLESS %d\n", &bootinfo->nfs_diskless); printf("#define\tBI_NFS_DISKLESS %d\n", &bootinfo->bi_nfs_diskless);
printf("#define\tBI_ENDCOMMON %d\n", &bootinfo->bi_endcommon);
printf("#define\tNFSDISKLESS_SIZE %d\n", sizeof(struct nfs_diskless)); printf("#define\tNFSDISKLESS_SIZE %d\n", sizeof(struct nfs_diskless));
printf("#define\tBI_SIZE %d\n", &bootinfo->bi_size);
printf("#define\tBI_SYMTAB %d\n", &bootinfo->bi_symtab);
printf("#define\tBI_ESYMTAB %d\n", &bootinfo->bi_esymtab);
return (0); return (0);
} }

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.45 1994/11/18 05:27:34 phk Exp $ * $Id: locore.s,v 1.46 1995/01/14 13:20:07 bde Exp $
*/ */
/* /*
@ -53,6 +53,7 @@
#include <machine/cputypes.h> /* x86 cpu type definitions */ #include <machine/cputypes.h> /* x86 cpu type definitions */
#include <sys/syscall.h> /* system call numbers */ #include <sys/syscall.h> /* system call numbers */
#include <machine/asmacros.h> /* miscellaneous asm macros */ #include <machine/asmacros.h> /* miscellaneous asm macros */
#include <sys/reboot.h>
#include "apm.h" #include "apm.h"
#if NAPM > 0 #if NAPM > 0
#define ASM #define ASM
@ -124,7 +125,7 @@ tmpstk:
_cpu: .long 0 /* are we 386, 386sx, or 486 */ _cpu: .long 0 /* are we 386, 386sx, or 486 */
_cpu_id: .long 0 /* stepping ID */ _cpu_id: .long 0 /* stepping ID */
_cpu_vendor: .space 20 /* CPU origin code */ _cpu_vendor: .space 20 /* CPU origin code */
_bootinfo: .space BOOTINFO_SIZE /* the bootstrapper knew it! */ _bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */
_cold: .long 1 /* cold till we are not */ _cold: .long 1 /* cold till we are not */
_atdevbase: .long 0 /* location of start of iomem in virtual */ _atdevbase: .long 0 /* location of start of iomem in virtual */
_atdevphys: .long 0 /* location of device mapping ptes (phys) */ _atdevphys: .long 0 /* location of device mapping ptes (phys) */
@ -243,7 +244,7 @@ NON_GPROF_ENTRY(btext)
*/ */
1: /* newboot: */ 1: /* newboot: */
movl 28(%ebp),%ebx /* &bootinfo.version */ movl 28(%ebp),%ebx /* &bootinfo.version */
movl BOOTINFO_VERSION(%ebx),%eax movl BI_VERSION(%ebx),%eax
cmpl $1,%eax /* We only understand version 1 */ cmpl $1,%eax /* We only understand version 1 */
je 1f je 1f
movl $1,%eax /* Return status */ movl $1,%eax /* Return status */
@ -254,7 +255,7 @@ NON_GPROF_ENTRY(btext)
/* /*
* If we have a kernelname copy it in * If we have a kernelname copy it in
*/ */
movl BOOTINFO_KERNELNAME(%ebx),%esi movl BI_KERNELNAME(%ebx),%esi
cmpl $0,%esi cmpl $0,%esi
je 1f /* No kernelname */ je 1f /* No kernelname */
lea _kernelname-KERNBASE,%edi lea _kernelname-KERNBASE,%edi
@ -265,11 +266,26 @@ NON_GPROF_ENTRY(btext)
1: 1:
/* /*
* Copy the bootinfo structure * Determine the size of the boot loader's copy of the bootinfo
* struct. This is impossible to do properly because old versions
* of the struct don't contain a size field and there are 2 old
* versions with the same version number.
*/
movl $BI_ENDCOMMON,%ecx /* prepare for sizeless version */
testl $RB_BOOTINFO,8(%ebp) /* bi_size (and bootinfo) valid? */
je got_bi_size /* no, sizeless version */
movl BI_SIZE(%ebx),%ecx
got_bi_size:
/*
* Copy the common part of the bootinfo struct
*/ */
movl %ebx,%esi movl %ebx,%esi
lea _bootinfo-KERNBASE,%edi movl $_bootinfo-KERNBASE,%edi
cmpl $BOOTINFO_SIZE,%ecx
jbe got_common_bi_size
movl $BOOTINFO_SIZE,%ecx movl $BOOTINFO_SIZE,%ecx
got_common_bi_size:
cld cld
rep rep
movsb movsb
@ -278,7 +294,7 @@ NON_GPROF_ENTRY(btext)
/* /*
* If we have a nfs_diskless structure copy it in * If we have a nfs_diskless structure copy it in
*/ */
movl BOOTINFO_NFS_DISKLESS(%ebx),%esi movl BI_NFS_DISKLESS(%ebx),%esi
cmpl $0,%esi cmpl $0,%esi
je 2f je 2f
lea _nfs_diskless-KERNBASE,%edi lea _nfs_diskless-KERNBASE,%edi
@ -517,6 +533,21 @@ NON_GPROF_ENTRY(btext)
rep rep
stosb stosb
#ifdef DDB
/* include symbols in "kernel image" if they are loaded */
movl _bootinfo+BI_ESYMTAB-KERNBASE,%edi
testl %edi,%edi
je over_symalloc
addl $NBPG-1,%edi
andl $~(NBPG-1),%edi
movl %edi,%esi
movl %esi,_KERNend-KERNBASE
movl $KERNBASE,%edi
addl %edi,_bootinfo+BI_SYMTAB-KERNBASE
addl %edi,_bootinfo+BI_ESYMTAB-KERNBASE
over_symalloc:
#endif
/* /*
* The value in esi is both the end of the kernel bss and a pointer to * The value in esi is both the end of the kernel bss and a pointer to
* the kernel page directory, and is used by the rest of locore to build * the kernel page directory, and is used by the rest of locore to build

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.45 1994/11/18 05:27:34 phk Exp $ * $Id: locore.s,v 1.46 1995/01/14 13:20:07 bde Exp $
*/ */
/* /*
@ -53,6 +53,7 @@
#include <machine/cputypes.h> /* x86 cpu type definitions */ #include <machine/cputypes.h> /* x86 cpu type definitions */
#include <sys/syscall.h> /* system call numbers */ #include <sys/syscall.h> /* system call numbers */
#include <machine/asmacros.h> /* miscellaneous asm macros */ #include <machine/asmacros.h> /* miscellaneous asm macros */
#include <sys/reboot.h>
#include "apm.h" #include "apm.h"
#if NAPM > 0 #if NAPM > 0
#define ASM #define ASM
@ -124,7 +125,7 @@ tmpstk:
_cpu: .long 0 /* are we 386, 386sx, or 486 */ _cpu: .long 0 /* are we 386, 386sx, or 486 */
_cpu_id: .long 0 /* stepping ID */ _cpu_id: .long 0 /* stepping ID */
_cpu_vendor: .space 20 /* CPU origin code */ _cpu_vendor: .space 20 /* CPU origin code */
_bootinfo: .space BOOTINFO_SIZE /* the bootstrapper knew it! */ _bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */
_cold: .long 1 /* cold till we are not */ _cold: .long 1 /* cold till we are not */
_atdevbase: .long 0 /* location of start of iomem in virtual */ _atdevbase: .long 0 /* location of start of iomem in virtual */
_atdevphys: .long 0 /* location of device mapping ptes (phys) */ _atdevphys: .long 0 /* location of device mapping ptes (phys) */
@ -243,7 +244,7 @@ NON_GPROF_ENTRY(btext)
*/ */
1: /* newboot: */ 1: /* newboot: */
movl 28(%ebp),%ebx /* &bootinfo.version */ movl 28(%ebp),%ebx /* &bootinfo.version */
movl BOOTINFO_VERSION(%ebx),%eax movl BI_VERSION(%ebx),%eax
cmpl $1,%eax /* We only understand version 1 */ cmpl $1,%eax /* We only understand version 1 */
je 1f je 1f
movl $1,%eax /* Return status */ movl $1,%eax /* Return status */
@ -254,7 +255,7 @@ NON_GPROF_ENTRY(btext)
/* /*
* If we have a kernelname copy it in * If we have a kernelname copy it in
*/ */
movl BOOTINFO_KERNELNAME(%ebx),%esi movl BI_KERNELNAME(%ebx),%esi
cmpl $0,%esi cmpl $0,%esi
je 1f /* No kernelname */ je 1f /* No kernelname */
lea _kernelname-KERNBASE,%edi lea _kernelname-KERNBASE,%edi
@ -265,11 +266,26 @@ NON_GPROF_ENTRY(btext)
1: 1:
/* /*
* Copy the bootinfo structure * Determine the size of the boot loader's copy of the bootinfo
* struct. This is impossible to do properly because old versions
* of the struct don't contain a size field and there are 2 old
* versions with the same version number.
*/
movl $BI_ENDCOMMON,%ecx /* prepare for sizeless version */
testl $RB_BOOTINFO,8(%ebp) /* bi_size (and bootinfo) valid? */
je got_bi_size /* no, sizeless version */
movl BI_SIZE(%ebx),%ecx
got_bi_size:
/*
* Copy the common part of the bootinfo struct
*/ */
movl %ebx,%esi movl %ebx,%esi
lea _bootinfo-KERNBASE,%edi movl $_bootinfo-KERNBASE,%edi
cmpl $BOOTINFO_SIZE,%ecx
jbe got_common_bi_size
movl $BOOTINFO_SIZE,%ecx movl $BOOTINFO_SIZE,%ecx
got_common_bi_size:
cld cld
rep rep
movsb movsb
@ -278,7 +294,7 @@ NON_GPROF_ENTRY(btext)
/* /*
* If we have a nfs_diskless structure copy it in * If we have a nfs_diskless structure copy it in
*/ */
movl BOOTINFO_NFS_DISKLESS(%ebx),%esi movl BI_NFS_DISKLESS(%ebx),%esi
cmpl $0,%esi cmpl $0,%esi
je 2f je 2f
lea _nfs_diskless-KERNBASE,%edi lea _nfs_diskless-KERNBASE,%edi
@ -517,6 +533,21 @@ NON_GPROF_ENTRY(btext)
rep rep
stosb stosb
#ifdef DDB
/* include symbols in "kernel image" if they are loaded */
movl _bootinfo+BI_ESYMTAB-KERNBASE,%edi
testl %edi,%edi
je over_symalloc
addl $NBPG-1,%edi
andl $~(NBPG-1),%edi
movl %edi,%esi
movl %esi,_KERNend-KERNBASE
movl $KERNBASE,%edi
addl %edi,_bootinfo+BI_SYMTAB-KERNBASE
addl %edi,_bootinfo+BI_ESYMTAB-KERNBASE
over_symalloc:
#endif
/* /*
* The value in esi is both the end of the kernel bss and a pointer to * The value in esi is both the end of the kernel bss and a pointer to
* the kernel page directory, and is used by the rest of locore to build * the kernel page directory, and is used by the rest of locore to build

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.102 1995/01/17 01:15:12 bde Exp $ * $Id: machdep.c,v 1.103 1995/01/24 09:56:29 davidg Exp $
*/ */
#include "npx.h" #include "npx.h"
@ -359,8 +359,8 @@ cpu_startup()
if (bootverbose) { if (bootverbose) {
printf("BIOS Geometries:"); printf("BIOS Geometries:");
for (i=0; i < N_BIOS_GEOM; i++) for (i=0; i < N_BIOS_GEOM; i++)
printf(" %x:%x\n", i, bootinfo.bios_geom[i]); printf(" %x:%x\n", i, bootinfo.bi_bios_geom[i]);
printf(" %d accounted for\n",bootinfo.n_bios_used); printf(" %d accounted for\n", bootinfo.bi_n_bios_used);
} }
} }
@ -1234,6 +1234,20 @@ init386(first)
biosbasemem = rtcin(RTC_BASELO)+ (rtcin(RTC_BASEHI)<<8); biosbasemem = rtcin(RTC_BASELO)+ (rtcin(RTC_BASEHI)<<8);
biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8); biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8);
/*
* Print a warning if the official BIOS interface disagrees
* with the hackish interface used above. Eventually only
* the official interface should be used.
*/
if (bootinfo.bi_memsizes_valid) {
if (bootinfo.bi_basemem != biosbasemem)
printf("BIOS basemem (%dK) != RTC basemem (%dK)\n",
bootinfo.bi_basemem, biosbasemem);
if (bootinfo.bi_extmem != biosextmem)
printf("BIOS extmem (%dK) != RTC extmem (%dK)\n",
bootinfo.bi_extmem, biosextmem);
}
/* /*
* If BIOS tells us that it has more than 640k in the basemem, * If BIOS tells us that it has more than 640k in the basemem,
* don't believe it - set it to 640k. * don't believe it - set it to 640k.

View File

@ -1,6 +1,6 @@
# Copyright 1990 W. Jolitz # Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91 # from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.51 1994/11/27 14:26:16 davidg Exp $ # $Id: Makefile.i386,v 1.52 1994/12/31 19:27:28 gibbs Exp $
# #
# Makefile for FreeBSD # Makefile for FreeBSD
# #
@ -14,17 +14,16 @@
# /sys/i386/conf/Makefile.i386 # /sys/i386/conf/Makefile.i386
# after which config should be rerun for all machines. # after which config should be rerun for all machines.
# #
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE # N.B.: DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
# #
# -DTRACE compile in kernel tracing hooks # -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas # -DQUOTA compile in file system quotas
# -DFOO almost all options
# #
TOUCH?= touch -f -c
LD?= /usr/bin/ld
CC?= cc CC?= cc
CPP?= cpp CPP?= cpp
DBSYM?= /usr/sbin/dbsym LD?= /usr/bin/ld
.if exists(./@/.) .if exists(./@/.)
S= ./@ S= ./@
@ -61,12 +60,16 @@ SFILES= ${I386}/i386/exception.s ${I386}/i386/microtime.s \
${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s ${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s
SYSTEM_CFILES= ioconf.c param.c vnode_if.c SYSTEM_CFILES= ioconf.c param.c vnode_if.c
SYSTEM_SFILES= ${I386}/i386/locore.s SYSTEM_SFILES= ${I386}/i386/locore.s
SYSTEM_OBJS=locore.o vnode_if.o ${OBJS} ioconf.o param.o SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \ .if ${CFLAGS:M-g} == ""
${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@ SYMORDER_EXCLUDE=-x symbols.exclude
.endif
SYSTEM_LD_TAIL= @echo rearranging symbols; \
symorder ${SYMORDER_EXCLUDE} symbols.sort $@; \
size $@; chmod 755 $@
%BEFORE_DEPEND %BEFORE_DEPEND
@ -99,7 +102,8 @@ ${LIBKERN}:
@(cd $S/libkern; make) @(cd $S/libkern; make)
clean: clean:
rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym \
symbols.exclude symbols.sort
#lint: /tmp param.c #lint: /tmp param.c
# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
@ -107,6 +111,10 @@ clean:
# grep -v 'struct/union .* never defined' | \ # grep -v 'struct/union .* never defined' | \
# grep -v 'possible pointer alignment problem' # grep -v 'possible pointer alignment problem'
symbols.exclude: Makefile
echo "gcc2_compiled." >symbols.exclude
echo "___gnu_compiled_c" >>symbols.exclude
symbols.sort: ${I386}/i386/symbols.raw symbols.sort: ${I386}/i386/symbols.raw
grep -v '^#' ${I386}/i386/symbols.raw \ grep -v '^#' ${I386}/i386/symbols.raw \
| sed 's/^ //' | sort -u > symbols.sort | sed 's/^ //' | sort -u > symbols.sort

View File

@ -1,6 +1,6 @@
# Copyright 1990 W. Jolitz # Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91 # from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.51 1994/11/27 14:26:16 davidg Exp $ # $Id: Makefile.i386,v 1.52 1994/12/31 19:27:28 gibbs Exp $
# #
# Makefile for FreeBSD # Makefile for FreeBSD
# #
@ -14,17 +14,16 @@
# /sys/i386/conf/Makefile.i386 # /sys/i386/conf/Makefile.i386
# after which config should be rerun for all machines. # after which config should be rerun for all machines.
# #
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE # N.B.: DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
# #
# -DTRACE compile in kernel tracing hooks # -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas # -DQUOTA compile in file system quotas
# -DFOO almost all options
# #
TOUCH?= touch -f -c
LD?= /usr/bin/ld
CC?= cc CC?= cc
CPP?= cpp CPP?= cpp
DBSYM?= /usr/sbin/dbsym LD?= /usr/bin/ld
.if exists(./@/.) .if exists(./@/.)
S= ./@ S= ./@
@ -61,12 +60,16 @@ SFILES= ${I386}/i386/exception.s ${I386}/i386/microtime.s \
${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s ${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s
SYSTEM_CFILES= ioconf.c param.c vnode_if.c SYSTEM_CFILES= ioconf.c param.c vnode_if.c
SYSTEM_SFILES= ${I386}/i386/locore.s SYSTEM_SFILES= ${I386}/i386/locore.s
SYSTEM_OBJS=locore.o vnode_if.o ${OBJS} ioconf.o param.o SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \ .if ${CFLAGS:M-g} == ""
${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@ SYMORDER_EXCLUDE=-x symbols.exclude
.endif
SYSTEM_LD_TAIL= @echo rearranging symbols; \
symorder ${SYMORDER_EXCLUDE} symbols.sort $@; \
size $@; chmod 755 $@
%BEFORE_DEPEND %BEFORE_DEPEND
@ -99,7 +102,8 @@ ${LIBKERN}:
@(cd $S/libkern; make) @(cd $S/libkern; make)
clean: clean:
rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym \
symbols.exclude symbols.sort
#lint: /tmp param.c #lint: /tmp param.c
# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
@ -107,6 +111,10 @@ clean:
# grep -v 'struct/union .* never defined' | \ # grep -v 'struct/union .* never defined' | \
# grep -v 'possible pointer alignment problem' # grep -v 'possible pointer alignment problem'
symbols.exclude: Makefile
echo "gcc2_compiled." >symbols.exclude
echo "___gnu_compiled_c" >>symbols.exclude
symbols.sort: ${I386}/i386/symbols.raw symbols.sort: ${I386}/i386/symbols.raw
grep -v '^#' ${I386}/i386/symbols.raw \ grep -v '^#' ${I386}/i386/symbols.raw \
| sed 's/^ //' | sort -u > symbols.sort | sed 's/^ //' | sort -u > symbols.sort

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in # LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can. # as much of the source tree as it can.
# #
# $Id: LINT,v 1.127 1995/01/24 20:38:39 paul Exp $ # $Id: LINT,v 1.128 1995/01/25 20:35:14 jmz Exp $
# #
# NB: You probably don't want to try running a kernel built from this # NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from # file. Instead, you should start from GENERIC, and add options from
@ -91,14 +91,16 @@ options SYSVMSG
# DEBUGGING OPTIONS # DEBUGGING OPTIONS
# #
# This line enables the kernel debugger, DDB, and the line following # Enable the kernel debugger.
# allocates extra space for a copy of the debugger symbol table which
# is stored in the initialized data area of the kernel. If you change
# the latter option, remove db_aout.o before compiling.
# #
options DODUMP #We dump core-image on panic options DDB
options DDB #Kernel debugger
options "SYMTAB_SPACE=163834" #This kernel needs LOTS of symtable #
# Enable dumping of the kernel image to swap for panics. This is not
# the default because writing to misconfigured swap may wipe out file
# systems.
#
options DODUMP
# #
# KTRACE enables the system-call tracing facility ktrace(2). # KTRACE enables the system-call tracing facility ktrace(2).

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the * any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes. * rights to redistribute these changes.
* *
* $Id: db_aout.c,v 1.8 1994/09/05 14:04:56 bde Exp $ * $Id: db_aout.c,v 1.9 1994/09/27 03:34:52 phk Exp $
*/ */
/* /*
@ -37,6 +37,9 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <machine/bootinfo.h>
#include <ddb/ddb.h> #include <ddb/ddb.h>
#include <ddb/db_sym.h> #include <ddb/db_sym.h>
@ -67,13 +70,6 @@
(sp = (struct nlist *)((symtab) + 1), \ (sp = (struct nlist *)((symtab) + 1), \
ep = (struct nlist *)((char *)sp + *(symtab))) ep = (struct nlist *)((char *)sp + *(symtab)))
#ifndef SYMTAB_SPACE
#define SYMTAB_SPACE 73000
#endif /*SYMTAB_SPACE*/
int db_symtabsize = SYMTAB_SPACE;
char db_symtab[SYMTAB_SPACE] = { 1 };
void void
X_db_sym_init(symtab, esymtab, name) X_db_sym_init(symtab, esymtab, name)
int * symtab; /* pointer to start of symbol table */ int * symtab; /* pointer to start of symbol table */
@ -97,7 +93,6 @@ X_db_sym_init(symtab, esymtab, name)
strtab = (char *)sym_end; strtab = (char *)sym_end;
strlen = *(int *)strtab; strlen = *(int *)strtab;
#if 0
if (strtab + ((strlen + sizeof(int) - 1) & ~(sizeof(int)-1)) if (strtab + ((strlen + sizeof(int) - 1) & ~(sizeof(int)-1))
!= esymtab) != esymtab)
{ {
@ -107,7 +102,6 @@ X_db_sym_init(symtab, esymtab, name)
db_printf("[ preserving %#x bytes of %s symbol table ]\n", db_printf("[ preserving %#x bytes of %s symbol table ]\n",
esymtab - (char *)symtab, name); esymtab - (char *)symtab, name);
#endif
for (sp = sym_start; sp < sym_end; sp++) { for (sp = sym_start; sp < sym_end; sp++) {
register int strx; register int strx;
@ -233,9 +227,11 @@ X_db_line_at_pc(symtab, cursym, filename, linenum, off)
sp = (struct nlist *)symtab->start; sp = (struct nlist *)symtab->start;
ep = (struct nlist *)symtab->end; ep = (struct nlist *)symtab->end;
/* XXX - gcc specific */ /*
#define NEWSRC(str) ((str) != NULL && \ * XXX - this used to remove "gcc_compiled.", but that is obsolete. We
(str)[0] == 'g' && strcmp((str), "gcc_compiled.") == 0) * now remove unwanted names using symorder.
*/
#define NEWSRC(str) 0
for (; sp < ep; sp++) { for (; sp < ep; sp++) {
@ -327,16 +323,11 @@ X_db_sym_numargs(symtab, cursym, nargp, argnamep)
void void
kdb_init(void) kdb_init(void)
{ {
#if 0 if (bootinfo.bi_esymtab != bootinfo.bi_symtab)
extern char *esym; X_db_sym_init((int *)bootinfo.bi_symtab,
extern int end; (char *)((bootinfo.bi_esymtab + sizeof(int) - 1)
& ~(sizeof(int) - 1)),
if (esym > (char *)&end) { "kernel");
X_db_sym_init((int *)&end, esym, "kernel");
}
#endif
X_db_sym_init (db_symtab, 0, "kernel");
} }
#if 0 #if 0

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, Revision 2.2 92/04/04 11:34:13 rpd * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd
* $Id: asm.S,v 1.4 1994/10/02 05:18:24 rgrimes Exp $ * $Id: asm.S,v 1.5 1994/10/06 09:41:01 rgrimes Exp $
*/ */
@ -59,7 +59,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
CR0_PE_ON = 0x1 CR0_PE_ON = 0x1
CR0_PE_OFF = 0xfffffffe CR0_PE_OFF = 0xfffffffe
.globl _ouraddr
.text .text
/* /*
@ -118,8 +117,7 @@ xprot:
ENTRY(prot_to_real) ENTRY(prot_to_real)
/* set up a dummy stack frame for the second seg change. */ /* set up a dummy stack frame for the second seg change. */
movl _ouraddr, %eax movw $BOOTSEG, %ax
sarl $4, %eax
pushw %ax pushw %ax
movw $xreal, %ax /* gas botches pushw $xreal, extra bytes 0, 0 */ movw $xreal, %ax /* gas botches pushw $xreal, extra bytes 0, 0 */
pushw %ax /* decode to add %al, (%eax) (%al usually 0) */ pushw %ax /* decode to add %al, (%eax) (%al usually 0) */

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, [92/04/03 16:51:14 rvb] * from: Mach, [92/04/03 16:51:14 rvb]
* $Id: boot.c,v 1.29 1994/12/18 20:30:10 joerg Exp $ * $Id: boot.c,v 1.30 1995/01/20 07:48:19 wpaul Exp $
*/ */
@ -57,13 +57,15 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/reboot.h> #include <sys/reboot.h>
#include <machine/bootinfo.h> #include <machine/bootinfo.h>
#define ouraddr (BOOTSEG << 4) /* XXX */
struct exec head; struct exec head;
struct bootinfo_t bootinfo; struct bootinfo bootinfo;
char *name = { "/kernel" };
extern void init_serial(void); extern void init_serial(void);
extern int probe_keyboard(void); extern int probe_keyboard(void);
int loadflags = 0; int loadflags;
unsigned char loadsyms;
extern int end; extern int end;
boot(drive) boot(drive)
@ -75,31 +77,39 @@ int drive;
if (probe_keyboard()) { if (probe_keyboard()) {
init_serial(); init_serial();
loadflags |= RB_SERIAL; loadflags |= RB_SERIAL;
printf ("\nNo keyboard found.\n"); printf("\nNo keyboard found.\n");
} }
/* Pick up the story from the Bios on geometry of disks */ /* Pick up the story from the Bios on geometry of disks */
for(ret = 0; ret < N_BIOS_GEOM; ret ++) for(ret = 0; ret < N_BIOS_GEOM; ret ++)
bootinfo.bios_geom[ret] = get_diskinfo(ret + 0x80); bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80);
/* This is nasty, but why use 4 printf()s when 1 will do. */ bootinfo.bi_basemem = memsize(0);
bootinfo.bi_extmem = memsize(1);
bootinfo.bi_memsizes_valid = 1;
printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\nUse hd(1,a)/kernel to boot sd0 when wd0 is also installed.\nUsage: [[[%s(%d,a)]%s][-s][-r][-a][-c][-d][-b][-v][-h]]\nUse ? for file list or simply press Return for defaults\n", ouraddr, memsize(0), memsize(1), devs[(drive & 0x80) ? 0 : 2], /* This is ugly, but why use 4 printf()s when 1 will do? */
(unit = (drive & 0x7f)), name); printf("\n\
>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n\
Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.\n\
Usage: [[[%s(%d,a)]%s][-s][-r][-a][-c][-d][-D][-b][-v][-h]]\n\
Use ? for file list or simply press Return for defaults\n",
ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem,
devs[drive & 0x80 ? 0 : 2], drive & 0x7f, name);
gateA20(); gateA20();
loadstart: loadstart:
/***************************************************************\ /***************************************************************\
* As a default set it to the first partition of the first * * As a default set it to the first partition of the boot *
* floppy or hard drive * * floppy or hard drive *
\***************************************************************/ \***************************************************************/
part = 0; part = 0;
unit = drive & 0x7f;
maj = (drive&0x80 ? 0 : 2); /* a good first bet */ maj = (drive&0x80 ? 0 : 2); /* a good first bet */
printf ("Boot: "); printf("Boot: ");
getbootdev(&loadflags); getbootdev(&loadflags);
ret = openrd(); ret = openrd();
if (ret != 0) { if (ret != 0) {
@ -120,9 +130,10 @@ loadprog(howto)
long int startaddr; long int startaddr;
long int addr; /* physical address.. not directly useable */ long int addr; /* physical address.. not directly useable */
long int bootdev; long int bootdev;
long int total;
int i; int i;
#ifdef REDUNDANT
unsigned char tmpbuf[4096]; /* we need to load the first 4k here */ unsigned char tmpbuf[4096]; /* we need to load the first 4k here */
#endif
read(&head, sizeof(head)); read(&head, sizeof(head));
if ( N_BADMAG(head)) { if ( N_BADMAG(head)) {
@ -134,7 +145,12 @@ loadprog(howto)
/*if(poff==0) /*if(poff==0)
poff = 32;*/ poff = 32;*/
startaddr = (int)head.a_entry & 0x00FFFFFF; /* some MEG boundary */ /*
* We assume that the entry address is the same as the lowest text
* address and that the kernel startup code handles relocation by
* this address rounded down to a multiple of 16M.
*/
startaddr = head.a_entry & 0x00FFFFFF;
addr = startaddr; addr = startaddr;
printf("Booting %s(%d,%c)%s @ 0x%x\n" printf("Booting %s(%d,%c)%s @ 0x%x\n"
, devs[maj] , devs[maj]
@ -165,12 +181,18 @@ loadprog(howto)
printf("text=0x%x ", head.a_text); printf("text=0x%x ", head.a_text);
/********************************************************/ /********************************************************/
/* LOAD THE TEXT SEGMENT */ /* LOAD THE TEXT SEGMENT */
#ifdef REDUNDANT
/* don't clobber the first 4k yet (BIOS NEEDS IT) */ /* don't clobber the first 4k yet (BIOS NEEDS IT) */
/********************************************************/ /********************************************************/
read(tmpbuf,4096); read(tmpbuf,4096);
addr += 4096; addr += 4096;
xread(addr, head.a_text - 4096); xread(addr, head.a_text - 4096);
addr += head.a_text - 4096; addr += head.a_text - 4096;
#else
/* Assume we're loading high, so that the BIOS isn't in the way. */
xread(addr, head.a_text);
addr += head.a_text;
#endif
/********************************************************/ /********************************************************/
/* Load the Initialised data after the text */ /* Load the Initialised data after the text */
@ -190,6 +212,9 @@ loadprog(howto)
/* /*
* This doesn't do us any good anymore either. * This doesn't do us any good anymore either.
* XXX however, we should be checking that we don't load over the top of
* ourselves or into nonexistent memory. A full symbol table is unlikely
* to fit on 4MB machines.
*/ */
#ifdef REDUNDANT #ifdef REDUNDANT
if( (addr < ouraddr) && ((addr + head.a_bss) > ouraddr)) if( (addr < ouraddr) && ((addr + head.a_bss) > ouraddr))
@ -200,50 +225,53 @@ loadprog(howto)
{ {
pbzero(addr,head.a_bss); pbzero(addr,head.a_bss);
} }
addr += head.a_bss;
#else #else
pbzero(addr,head.a_bss); pbzero(addr,head.a_bss);
#endif #endif
#ifdef LOADSYMS /* not yet, haven't worked this out yet */ addr += head.a_bss;
if (addr > 0x100000) if (loadsyms)
{ {
unsigned pad;
/* Pad to a page boundary. */
pad = (unsigned)addr % NBPG;
if (pad != 0) {
pad = NBPG - pad;
addr += pad;
}
bootinfo.bi_symtab = addr;
/********************************************************/ /********************************************************/
/*copy in the symbol header */ /* Copy the symbol table size */
/********************************************************/ /********************************************************/
pcpy(&head.a_syms, addr, sizeof(head.a_syms)); pcpy(&head.a_syms, addr, sizeof(head.a_syms));
addr += sizeof(head.a_syms); addr += sizeof(head.a_syms);
/********************************************************/ /********************************************************/
/* READ in the symbol table */ /* Load the symbol table */
/********************************************************/ /********************************************************/
printf("symbols=[+0x%x", head.a_syms); printf("symbols=[+0x%x+0x%x+0x%x", pad, sizeof(head.a_syms),
head.a_syms);
xread(addr, head.a_syms); xread(addr, head.a_syms);
addr += head.a_syms; addr += head.a_syms;
/********************************************************/ /********************************************************/
/* Followed by the next integer (another header) */ /* Load the string table size */
/* more debug symbols? */
/********************************************************/ /********************************************************/
read(&i, sizeof(int)); read(&i, sizeof(int));
pcpy(&i, addr, sizeof(int)); pcpy(&i, addr, sizeof(int));
i -= sizeof(int); i -= sizeof(int);
addr += sizeof(int); addr += sizeof(int);
/********************************************************/ /********************************************************/
/* and that many bytes of (debug symbols?) */ /* Load the string table */
/********************************************************/ /********************************************************/
printf("+0x%x] ", i); printf("+0x%x+0x%x] ", sizeof(int), i);
xread(addr, i); xread(addr, i);
addr += i; addr += i;
}
#endif LOADSYMS
/********************************************************/ bootinfo.bi_esymtab = addr;
/* and note the end address of all this */ }
/********************************************************/
total = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
printf("total=0x%x ", total);
/* /*
* For backwards compatibility, use the previously-unused adaptor * For backwards compatibility, use the previously-unused adaptor
@ -251,18 +279,22 @@ loadprog(howto)
*/ */
bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part); bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part);
#ifdef REDUNDANT
/****************************************************************/ /****************************************************************/
/* copy that first page and overwrite any BIOS variables */ /* copy that first page and overwrite any BIOS variables */
/****************************************************************/ /****************************************************************/
printf("entry point=0x%x\n" ,(int)startaddr);
/* Under no circumstances overwrite precious BIOS variables! */ /* Under no circumstances overwrite precious BIOS variables! */
pcpy(tmpbuf, startaddr, 0x400); pcpy(tmpbuf, startaddr, 0x400);
pcpy(tmpbuf + 0x500, startaddr + 0x500, 4096 - 0x500); pcpy(tmpbuf + 0x500, startaddr + 0x500, 4096 - 0x500);
bootinfo.version=1; #endif
bootinfo.kernelname=(char *)((int)name + (BOOTSEG<<4));
bootinfo.nfs_diskless=0; bootinfo.bi_version = BOOTINFO_VERSION;
startprog((int)startaddr, howto, bootdev, (int)&bootinfo+(BOOTSEG<<4)); bootinfo.bi_kernelname = name + ouraddr;
return; bootinfo.bi_nfs_diskless = NULL;
bootinfo.bi_size = sizeof(bootinfo);
printf("total=0x%x entry point=0x%x\n", (int)addr, (int)startaddr);
startprog((int)startaddr, howto | RB_BOOTINFO, bootdev,
(int)&bootinfo + ouraddr);
} }
#define NAMEBUF_LEN 100 #define NAMEBUF_LEN 100
@ -291,12 +323,17 @@ getbootdev(howto)
*howto |= RB_SINGLE; continue; *howto |= RB_SINGLE; continue;
case 'd': case 'd':
*howto |= RB_KDB; continue; *howto |= RB_KDB; continue;
case 'D':
loadsyms = 1; continue;
case 'b': case 'b':
*howto |= RB_HALT; continue; *howto |= RB_HALT; continue;
case 'v': case 'v':
*howto |= RB_VERBOSE; continue; *howto |= RB_VERBOSE; continue;
case 'h': case 'h':
*howto ^= RB_SERIAL; continue; *howto ^= RB_SERIAL;
if (*howto & RB_SERIAL)
init_serial();
continue;
} }
else { else {
name = ptr; name = ptr;
@ -308,4 +345,3 @@ getbootdev(howto)
} else } else
printf("\n"); printf("\n");
} }

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, Revision 2.2 92/04/04 11:35:03 rpd * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd
* $Id: boot.h,v 1.4 1994/08/21 17:47:26 paul Exp $ * $Id: boot.h,v 1.5 1994/12/18 19:14:15 bde Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -38,4 +38,4 @@ extern char *devs[], *name, *iodest;
extern struct fs *fs; extern struct fs *fs;
extern struct inode inode; extern struct inode inode;
extern int dosdev, unit, slice, part, maj, boff, poff, bnum, cnt; extern int dosdev, unit, slice, part, maj, boff, poff, bnum, cnt;
extern long int ouraddr; extern unsigned long tw_chars;

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, Revision 2.2 92/04/04 11:35:26 rpd * from: Mach, Revision 2.2 92/04/04 11:35:26 rpd
* $Id: boot2.S,v 1.4 1994/06/22 05:52:25 jkh Exp $ * $Id: boot2.S,v 1.5 1994/08/30 01:38:03 bde Exp $
*/ */
#include "asm.h" #include "asm.h"
@ -49,8 +49,6 @@
* boot2() -- second stage boot * boot2() -- second stage boot
*/ */
.globl EXT(ouraddr)
ENTRY(boot2) ENTRY(boot2)
data32 data32
subl %eax, %eax subl %eax, %eax
@ -59,9 +57,6 @@ ENTRY(boot2)
mov %ax, %es mov %ax, %es
data32 data32
shll $4, %eax shll $4, %eax
addr32
data32
movl %eax, EXT(ouraddr)
/* fix up GDT entries for bootstrap */ /* fix up GDT entries for bootstrap */
#define FIXUP(gdt_index) \ #define FIXUP(gdt_index) \
@ -175,12 +170,3 @@ ENTRY(boot2)
oops: oops:
hlt hlt
jmp oops jmp oops
.data
.align 2
#if 0 /* XXX this would give losing "_ouraddr :". Better declared in C */
EXT(ouraddr):
#else
_ouraddr:
#endif
.long 0

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, Revision 2.2 92/04/04 11:35:49 rpd * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
* $Id: disk.c,v 1.5 1994/05/16 03:06:00 ache Exp $ * $Id: disk.c,v 1.6 1994/12/18 19:14:19 bde Exp $
*/ */
/* /*
@ -50,8 +50,6 @@
#define SPT(di) ((di)&0xff) #define SPT(di) ((di)&0xff)
#define HEADS(di) ((((di)>>8)&0xff)+1) #define HEADS(di) ((((di)>>8)&0xff)+1)
char *devs[] = {"wd", "hd", "fd", "wt", "sd", 0};
#ifdef DO_BAD144 #ifdef DO_BAD144
struct dkbad dkb; struct dkbad dkb;
int do_bad144; int do_bad144;

View File

@ -24,9 +24,10 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, Revision 2.2 92/04/04 11:35:57 rpd * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd
* $Id: io.c,v 1.10 1994/11/07 11:26:29 davidg Exp $ * $Id: io.c,v 1.11 1995/01/20 07:48:21 wpaul Exp $
*/ */
#include "boot.h"
#include <machine/cpufunc.h> #include <machine/cpufunc.h>
#include <sys/reboot.h> #include <sys/reboot.h>
@ -49,7 +50,6 @@ extern int loadflags;
/* /*
* Gate A20 for high memory * Gate A20 for high memory
*/ */
unsigned char x_20 = KB_A20;
gateA20() gateA20()
{ {
#ifdef IBM_L40 #ifdef IBM_L40
@ -61,7 +61,7 @@ gateA20()
outb(K_CMD, KC_CMD_WOUT); outb(K_CMD, KC_CMD_WOUT);
while (inb(K_STATUS) & K_IBUF_FUL); while (inb(K_STATUS) & K_IBUF_FUL);
outb(K_RDWR, x_20); outb(K_RDWR, KB_A20);
while (inb(K_STATUS) & K_IBUF_FUL); while (inb(K_STATUS) & K_IBUF_FUL);
#endif IBM_L40 #endif IBM_L40
} }
@ -121,11 +121,15 @@ printf(format,data)
putchar(c) putchar(c)
{ {
if (c == '\n') { if (c == '\n') {
if (loadflags & RB_SERIAL) serial_putc('\r'); if (loadflags & RB_SERIAL)
else putc('\r'); serial_putc('\r');
else
putc('\r');
} }
if (loadflags & RB_SERIAL) serial_putc(c); if (loadflags & RB_SERIAL)
else putc(c); serial_putc(c);
else
putc(c);
} }
getchar(in_buf) getchar(in_buf)
@ -190,7 +194,6 @@ char *buf;
default: default:
ptr++; ptr++;
} }
return 0; return 0;
} }
@ -215,8 +218,6 @@ int len;
/* To quote Ken: "You are not expected to understand this." :) */ /* To quote Ken: "You are not expected to understand this." :) */
static unsigned long tw_chars = 0x5C2D2F7C; /* "\-/|" */
twiddle() twiddle()
{ {
putchar((char)tw_chars); putchar((char)tw_chars);

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* from: Mach, Revision 2.2 92/04/04 11:36:43 rpd * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd
* $Id: table.c,v 1.3 1993/10/16 19:11:40 rgrimes Exp $ * $Id: table.c,v 1.4 1994/08/30 01:38:04 bde Exp $
*/ */
/* /*
@ -129,3 +129,11 @@ struct pseudo_desc Gdtr = { sizeof Gdt - 1, RUN, RUN };
struct pseudo_desc Idtr_prot = { sizeof Idt - 1, RUN, RUN }; struct pseudo_desc Idtr_prot = { sizeof Idt - 1, RUN, RUN };
struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 }; struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 };
#endif #endif
/*
* All initialized data is defined in one file to reduce space wastage from
* fragmentation.
*/
char *devs[] = { "wd", "hd", "fd", "wt", "sd", 0 };
char *name = "/kernel";
unsigned long tw_chars = 0x5C2D2F7C; /* "\-/|" */

View File

@ -25,7 +25,7 @@ void (*kernelentry)();
struct nfs_diskless nfsdiskless; struct nfs_diskless nfsdiskless;
int hostnamelen; int hostnamelen;
char config_buffer[512]; /* Max TFTP packet */ char config_buffer[512]; /* Max TFTP packet */
struct bootinfo_t bootinfo; struct bootinfo bootinfo;
unsigned long netmask; unsigned long netmask;
extern char packet[]; extern char packet[];
@ -281,9 +281,9 @@ load()
printf("entry=0x%X.\n\r",head.a_entry); printf("entry=0x%X.\n\r",head.a_entry);
/* Jump to kernel */ /* Jump to kernel */
bootinfo.version = 1; bootinfo.bi_version = BOOTINFO_VERSION;
bootinfo.kernelname = kernel; bootinfo.bi_kernelname = kernel;
bootinfo.nfs_diskless = &nfsdiskless; bootinfo.bi_nfs_diskless = &nfsdiskless;
kernelentry = (void *)(head.a_entry & 0x00FFFFFF); kernelentry = (void *)(head.a_entry & 0x00FFFFFF);
(*kernelentry)(0,NODEV,0,0,0,&bootinfo,0,0,0); (*kernelentry)(0,NODEV,0,0,0,&bootinfo,0,0,0);
printf("*** %s execute failure ***\n",kernel); printf("*** %s execute failure ***\n",kernel);

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in # LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can. # as much of the source tree as it can.
# #
# $Id: LINT,v 1.127 1995/01/24 20:38:39 paul Exp $ # $Id: LINT,v 1.128 1995/01/25 20:35:14 jmz Exp $
# #
# NB: You probably don't want to try running a kernel built from this # NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from # file. Instead, you should start from GENERIC, and add options from
@ -91,14 +91,16 @@ options SYSVMSG
# DEBUGGING OPTIONS # DEBUGGING OPTIONS
# #
# This line enables the kernel debugger, DDB, and the line following # Enable the kernel debugger.
# allocates extra space for a copy of the debugger symbol table which
# is stored in the initialized data area of the kernel. If you change
# the latter option, remove db_aout.o before compiling.
# #
options DODUMP #We dump core-image on panic options DDB
options DDB #Kernel debugger
options "SYMTAB_SPACE=163834" #This kernel needs LOTS of symtable #
# Enable dumping of the kernel image to swap for panics. This is not
# the default because writing to misconfigured swap may wipe out file
# systems.
#
options DODUMP
# #
# KTRACE enables the system-call tracing facility ktrace(2). # KTRACE enables the system-call tracing facility ktrace(2).

View File

@ -1,6 +1,6 @@
# Copyright 1990 W. Jolitz # Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91 # from: @(#)Makefile.i386 7.1 5/10/91
# $Id: Makefile.i386,v 1.51 1994/11/27 14:26:16 davidg Exp $ # $Id: Makefile.i386,v 1.52 1994/12/31 19:27:28 gibbs Exp $
# #
# Makefile for FreeBSD # Makefile for FreeBSD
# #
@ -14,17 +14,16 @@
# /sys/i386/conf/Makefile.i386 # /sys/i386/conf/Makefile.i386
# after which config should be rerun for all machines. # after which config should be rerun for all machines.
# #
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE # N.B.: DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
# #
# -DTRACE compile in kernel tracing hooks # -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas # -DQUOTA compile in file system quotas
# -DFOO almost all options
# #
TOUCH?= touch -f -c
LD?= /usr/bin/ld
CC?= cc CC?= cc
CPP?= cpp CPP?= cpp
DBSYM?= /usr/sbin/dbsym LD?= /usr/bin/ld
.if exists(./@/.) .if exists(./@/.)
S= ./@ S= ./@
@ -61,12 +60,16 @@ SFILES= ${I386}/i386/exception.s ${I386}/i386/microtime.s \
${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s ${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s
SYSTEM_CFILES= ioconf.c param.c vnode_if.c SYSTEM_CFILES= ioconf.c param.c vnode_if.c
SYSTEM_SFILES= ${I386}/i386/locore.s SYSTEM_SFILES= ${I386}/i386/locore.s
SYSTEM_OBJS=locore.o vnode_if.o ${OBJS} ioconf.o param.o SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \ .if ${CFLAGS:M-g} == ""
${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@ SYMORDER_EXCLUDE=-x symbols.exclude
.endif
SYSTEM_LD_TAIL= @echo rearranging symbols; \
symorder ${SYMORDER_EXCLUDE} symbols.sort $@; \
size $@; chmod 755 $@
%BEFORE_DEPEND %BEFORE_DEPEND
@ -99,7 +102,8 @@ ${LIBKERN}:
@(cd $S/libkern; make) @(cd $S/libkern; make)
clean: clean:
rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym \
symbols.exclude symbols.sort
#lint: /tmp param.c #lint: /tmp param.c
# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
@ -107,6 +111,10 @@ clean:
# grep -v 'struct/union .* never defined' | \ # grep -v 'struct/union .* never defined' | \
# grep -v 'possible pointer alignment problem' # grep -v 'possible pointer alignment problem'
symbols.exclude: Makefile
echo "gcc2_compiled." >symbols.exclude
echo "___gnu_compiled_c" >>symbols.exclude
symbols.sort: ${I386}/i386/symbols.raw symbols.sort: ${I386}/i386/symbols.raw
grep -v '^#' ${I386}/i386/symbols.raw \ grep -v '^#' ${I386}/i386/symbols.raw \
| sed 's/^ //' | sort -u > symbols.sort | sed 's/^ //' | sort -u > symbols.sort

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in # LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can. # as much of the source tree as it can.
# #
# $Id: LINT,v 1.127 1995/01/24 20:38:39 paul Exp $ # $Id: LINT,v 1.128 1995/01/25 20:35:14 jmz Exp $
# #
# NB: You probably don't want to try running a kernel built from this # NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from # file. Instead, you should start from GENERIC, and add options from
@ -91,14 +91,16 @@ options SYSVMSG
# DEBUGGING OPTIONS # DEBUGGING OPTIONS
# #
# This line enables the kernel debugger, DDB, and the line following # Enable the kernel debugger.
# allocates extra space for a copy of the debugger symbol table which
# is stored in the initialized data area of the kernel. If you change
# the latter option, remove db_aout.o before compiling.
# #
options DODUMP #We dump core-image on panic options DDB
options DDB #Kernel debugger
options "SYMTAB_SPACE=163834" #This kernel needs LOTS of symtable #
# Enable dumping of the kernel image to swap for panics. This is not
# the default because writing to misconfigured swap may wipe out file
# systems.
#
options DODUMP
# #
# KTRACE enables the system-call tracing facility ktrace(2). # KTRACE enables the system-call tracing facility ktrace(2).

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $Id: genassym.c,v 1.21 1994/12/03 10:02:20 bde Exp $ * $Id: genassym.c,v 1.22 1995/01/21 15:22:28 bde Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -76,7 +76,7 @@ main()
struct pcb *pcb = (struct pcb *)0; struct pcb *pcb = (struct pcb *)0;
struct trapframe *tf = (struct trapframe *)0; struct trapframe *tf = (struct trapframe *)0;
struct sigframe *sigf = (struct sigframe *)0; struct sigframe *sigf = (struct sigframe *)0;
struct bootinfo_t *bootinfo = (struct bootinfo_t *)0; struct bootinfo *bootinfo = (struct bootinfo *)0;
/* XXX should use %p to print pointers. About 80 lines are wrong. */ /* XXX should use %p to print pointers. About 80 lines are wrong. */
printf("#define\tUDOT_SZ %d\n", sizeof(struct user)); printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
@ -194,11 +194,16 @@ main()
printf("#define\tEFAULT %d\n", EFAULT); printf("#define\tEFAULT %d\n", EFAULT);
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG); printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN); printf("#define\tMAXPATHLEN %d\n", MAXPATHLEN);
printf("#define\tBOOTINFO_SIZE %d\n", sizeof *bootinfo); printf("#define\tBOOTINFO_SIZE %d\n", sizeof *bootinfo);
printf("#define\tBOOTINFO_VERSION %d\n", &bootinfo->version); printf("#define\tBI_VERSION %d\n", &bootinfo->bi_version);
printf("#define\tBOOTINFO_KERNELNAME %d\n", &bootinfo->kernelname); printf("#define\tBI_KERNELNAME %d\n", &bootinfo->bi_kernelname);
printf("#define\tBOOTINFO_NFS_DISKLESS %d\n", &bootinfo->nfs_diskless); printf("#define\tBI_NFS_DISKLESS %d\n", &bootinfo->bi_nfs_diskless);
printf("#define\tBI_ENDCOMMON %d\n", &bootinfo->bi_endcommon);
printf("#define\tNFSDISKLESS_SIZE %d\n", sizeof(struct nfs_diskless)); printf("#define\tNFSDISKLESS_SIZE %d\n", sizeof(struct nfs_diskless));
printf("#define\tBI_SIZE %d\n", &bootinfo->bi_size);
printf("#define\tBI_SYMTAB %d\n", &bootinfo->bi_symtab);
printf("#define\tBI_ESYMTAB %d\n", &bootinfo->bi_esymtab);
return (0); return (0);
} }

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91 * from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.45 1994/11/18 05:27:34 phk Exp $ * $Id: locore.s,v 1.46 1995/01/14 13:20:07 bde Exp $
*/ */
/* /*
@ -53,6 +53,7 @@
#include <machine/cputypes.h> /* x86 cpu type definitions */ #include <machine/cputypes.h> /* x86 cpu type definitions */
#include <sys/syscall.h> /* system call numbers */ #include <sys/syscall.h> /* system call numbers */
#include <machine/asmacros.h> /* miscellaneous asm macros */ #include <machine/asmacros.h> /* miscellaneous asm macros */
#include <sys/reboot.h>
#include "apm.h" #include "apm.h"
#if NAPM > 0 #if NAPM > 0
#define ASM #define ASM
@ -124,7 +125,7 @@ tmpstk:
_cpu: .long 0 /* are we 386, 386sx, or 486 */ _cpu: .long 0 /* are we 386, 386sx, or 486 */
_cpu_id: .long 0 /* stepping ID */ _cpu_id: .long 0 /* stepping ID */
_cpu_vendor: .space 20 /* CPU origin code */ _cpu_vendor: .space 20 /* CPU origin code */
_bootinfo: .space BOOTINFO_SIZE /* the bootstrapper knew it! */ _bootinfo: .space BOOTINFO_SIZE /* bootinfo that we can handle */
_cold: .long 1 /* cold till we are not */ _cold: .long 1 /* cold till we are not */
_atdevbase: .long 0 /* location of start of iomem in virtual */ _atdevbase: .long 0 /* location of start of iomem in virtual */
_atdevphys: .long 0 /* location of device mapping ptes (phys) */ _atdevphys: .long 0 /* location of device mapping ptes (phys) */
@ -243,7 +244,7 @@ NON_GPROF_ENTRY(btext)
*/ */
1: /* newboot: */ 1: /* newboot: */
movl 28(%ebp),%ebx /* &bootinfo.version */ movl 28(%ebp),%ebx /* &bootinfo.version */
movl BOOTINFO_VERSION(%ebx),%eax movl BI_VERSION(%ebx),%eax
cmpl $1,%eax /* We only understand version 1 */ cmpl $1,%eax /* We only understand version 1 */
je 1f je 1f
movl $1,%eax /* Return status */ movl $1,%eax /* Return status */
@ -254,7 +255,7 @@ NON_GPROF_ENTRY(btext)
/* /*
* If we have a kernelname copy it in * If we have a kernelname copy it in
*/ */
movl BOOTINFO_KERNELNAME(%ebx),%esi movl BI_KERNELNAME(%ebx),%esi
cmpl $0,%esi cmpl $0,%esi
je 1f /* No kernelname */ je 1f /* No kernelname */
lea _kernelname-KERNBASE,%edi lea _kernelname-KERNBASE,%edi
@ -265,11 +266,26 @@ NON_GPROF_ENTRY(btext)
1: 1:
/* /*
* Copy the bootinfo structure * Determine the size of the boot loader's copy of the bootinfo
* struct. This is impossible to do properly because old versions
* of the struct don't contain a size field and there are 2 old
* versions with the same version number.
*/
movl $BI_ENDCOMMON,%ecx /* prepare for sizeless version */
testl $RB_BOOTINFO,8(%ebp) /* bi_size (and bootinfo) valid? */
je got_bi_size /* no, sizeless version */
movl BI_SIZE(%ebx),%ecx
got_bi_size:
/*
* Copy the common part of the bootinfo struct
*/ */
movl %ebx,%esi movl %ebx,%esi
lea _bootinfo-KERNBASE,%edi movl $_bootinfo-KERNBASE,%edi
cmpl $BOOTINFO_SIZE,%ecx
jbe got_common_bi_size
movl $BOOTINFO_SIZE,%ecx movl $BOOTINFO_SIZE,%ecx
got_common_bi_size:
cld cld
rep rep
movsb movsb
@ -278,7 +294,7 @@ NON_GPROF_ENTRY(btext)
/* /*
* If we have a nfs_diskless structure copy it in * If we have a nfs_diskless structure copy it in
*/ */
movl BOOTINFO_NFS_DISKLESS(%ebx),%esi movl BI_NFS_DISKLESS(%ebx),%esi
cmpl $0,%esi cmpl $0,%esi
je 2f je 2f
lea _nfs_diskless-KERNBASE,%edi lea _nfs_diskless-KERNBASE,%edi
@ -517,6 +533,21 @@ NON_GPROF_ENTRY(btext)
rep rep
stosb stosb
#ifdef DDB
/* include symbols in "kernel image" if they are loaded */
movl _bootinfo+BI_ESYMTAB-KERNBASE,%edi
testl %edi,%edi
je over_symalloc
addl $NBPG-1,%edi
andl $~(NBPG-1),%edi
movl %edi,%esi
movl %esi,_KERNend-KERNBASE
movl $KERNBASE,%edi
addl %edi,_bootinfo+BI_SYMTAB-KERNBASE
addl %edi,_bootinfo+BI_ESYMTAB-KERNBASE
over_symalloc:
#endif
/* /*
* The value in esi is both the end of the kernel bss and a pointer to * The value in esi is both the end of the kernel bss and a pointer to
* the kernel page directory, and is used by the rest of locore to build * the kernel page directory, and is used by the rest of locore to build

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.102 1995/01/17 01:15:12 bde Exp $ * $Id: machdep.c,v 1.103 1995/01/24 09:56:29 davidg Exp $
*/ */
#include "npx.h" #include "npx.h"
@ -359,8 +359,8 @@ cpu_startup()
if (bootverbose) { if (bootverbose) {
printf("BIOS Geometries:"); printf("BIOS Geometries:");
for (i=0; i < N_BIOS_GEOM; i++) for (i=0; i < N_BIOS_GEOM; i++)
printf(" %x:%x\n", i, bootinfo.bios_geom[i]); printf(" %x:%x\n", i, bootinfo.bi_bios_geom[i]);
printf(" %d accounted for\n",bootinfo.n_bios_used); printf(" %d accounted for\n", bootinfo.bi_n_bios_used);
} }
} }
@ -1234,6 +1234,20 @@ init386(first)
biosbasemem = rtcin(RTC_BASELO)+ (rtcin(RTC_BASEHI)<<8); biosbasemem = rtcin(RTC_BASELO)+ (rtcin(RTC_BASEHI)<<8);
biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8); biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8);
/*
* Print a warning if the official BIOS interface disagrees
* with the hackish interface used above. Eventually only
* the official interface should be used.
*/
if (bootinfo.bi_memsizes_valid) {
if (bootinfo.bi_basemem != biosbasemem)
printf("BIOS basemem (%dK) != RTC basemem (%dK)\n",
bootinfo.bi_basemem, biosbasemem);
if (bootinfo.bi_extmem != biosextmem)
printf("BIOS extmem (%dK) != RTC extmem (%dK)\n",
bootinfo.bi_extmem, biosextmem);
}
/* /*
* If BIOS tells us that it has more than 640k in the basemem, * If BIOS tells us that it has more than 640k in the basemem,
* don't believe it - set it to 640k. * don't believe it - set it to 640k.

View File

@ -29,22 +29,41 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: bootinfo.h,v 1.2 1994/11/18 05:02:43 phk Exp $ * $Id: bootinfo.h,v 1.3 1994/11/18 05:26:52 phk Exp $
*/ */
#ifndef _MACHINE_BOOTINFO_H_ #ifndef _MACHINE_BOOTINFO_H_
#define _MACHINE_BOOTINFO_H_ #define _MACHINE_BOOTINFO_H_
#define N_BIOS_GEOM 8 /* Only change the version number if you break compatibility. */
struct bootinfo_t { #define BOOTINFO_VERSION 1
unsigned int version;
unsigned char *kernelname; #define N_BIOS_GEOM 8
struct nfs_diskless *nfs_diskless;
unsigned int n_bios_used; /*
unsigned long bios_geom[N_BIOS_GEOM]; * A zero bootinfo field often means that there is no info available.
* Flags are used to indicate the validity of fields where zero is a
* normal value.
*/
struct bootinfo {
unsigned int bi_version;
unsigned char *bi_kernelname;
struct nfs_diskless *bi_nfs_diskless;
/* End of fields that are always present. */
#define bi_endcommon bi_n_bios_used
unsigned int bi_n_bios_used;
unsigned long bi_bios_geom[N_BIOS_GEOM];
unsigned int bi_size;
unsigned char bi_memsizes_valid;
unsigned char bi_pad[3];
unsigned long bi_basemem;
unsigned long bi_extmem;
unsigned long bi_symtab;
unsigned long bi_esymtab;
}; };
#ifdef KERNEL #ifdef KERNEL
extern struct bootinfo_t bootinfo; extern struct bootinfo bootinfo;
#endif #endif
#endif /* _MACHINE_BOOTINFO_H_ */
#endif /* !_MACHINE_BOOTINFO_H_ */

View File

@ -37,7 +37,7 @@ static int wdtest = 0;
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91 * from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.62 1994/12/13 18:20:08 guido Exp $ * $Id: wd.c,v 1.63 1994/12/24 09:43:12 bde Exp $
*/ */
/* TODO: /* TODO:
@ -1269,15 +1269,16 @@ wdgetctlr(struct disk *du)
|| wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0) || wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0)
return (1); return (1);
if (du->dk_unit == bootinfo.n_bios_used) { if (du->dk_unit == bootinfo.bi_n_bios_used) {
du->dk_dd.d_secsize = DEV_BSIZE; du->dk_dd.d_secsize = DEV_BSIZE;
du->dk_dd.d_nsectors = du->dk_dd.d_nsectors =
bootinfo.bios_geom[du->dk_unit] & 0xff; bootinfo.bi_bios_geom[du->dk_unit] & 0xff;
du->dk_dd.d_ntracks = du->dk_dd.d_ntracks =
((bootinfo.bios_geom[du->dk_unit] >> 8) & 0xff) +1; ((bootinfo.bi_bios_geom[du->dk_unit] >> 8) & 0xff)
+ 1;
/* XXX Why 2 ? */ /* XXX Why 2 ? */
du->dk_dd.d_ncylinders = du->dk_dd.d_ncylinders =
(bootinfo.bios_geom[du->dk_unit] >> 16) + 2; (bootinfo.bi_bios_geom[du->dk_unit] >> 16) + 2;
du->dk_dd.d_secpercyl = du->dk_dd.d_secpercyl =
du->dk_dd.d_ntracks * du->dk_dd.d_nsectors; du->dk_dd.d_ntracks * du->dk_dd.d_nsectors;
du->dk_dd.d_secperunit = du->dk_dd.d_secperunit =
@ -1290,7 +1291,7 @@ wdgetctlr(struct disk *du)
sizeof du->dk_dd.d_typename); sizeof du->dk_dd.d_typename);
strncpy(du->dk_params.wdp_model, "ST506", strncpy(du->dk_params.wdp_model, "ST506",
sizeof du->dk_params.wdp_model); sizeof du->dk_params.wdp_model);
bootinfo.n_bios_used ++; bootinfo.bi_n_bios_used ++;
return 0; return 0;
} }
/* /*