remove obsolete boot code -- we now use the code in stand/

This commit is contained in:
perry 1998-02-18 19:23:23 +00:00
parent 3add465995
commit 8486362eaf
14 changed files with 0 additions and 2771 deletions

View File

@ -1,95 +0,0 @@
# $NetBSD: Makefile,v 1.25 1997/08/22 21:53:00 perry Exp $
#
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
# This boot program is obsolete. It has been left in place for
# reference only. It doesn't even build any longer. Please use the
# boot blocks in sys/arch/i386/stand instead!
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Ported to boot 386BSD by Julian Elischer (julian@tfs.com)
# September 1992
#
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
#
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
# CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
#
# Carnegie Mellon requests users of this software to return to
#
# Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
# School of Computer Science
# Carnegie Mellon University
# Pittsburgh PA 15213-3890
#
# any improvements or extensions that they make and grant Carnegie Mellon
# the rights to redistribute these changes.
#
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
# This boot program is obsolete. It has been left in place for
# reference only. It doesn't even build any longer. Please use the
# boot blocks in sys/arch/i386/stand instead!
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
all:
@echo "This boot program is obsolete. It has been left in place for"
@echo "reference only. It doesn't even build any longer. Please use"
@echo "the boot blocks in sys/arch/i386/stand instead."
S= ${.CURDIR}/../../..
.PHONY: machine-links
machine-links:
-rm -f machine && \
ln -s ${.CURDIR}/../include machine
-rm -f ${MACHINE_ARCH} && \
ln -s ${.CURDIR}/../include ${MACHINE_ARCH}
real-all: machine-links biosboot bootbios
NOPROG= noprog
NOMAN= noman
CFLAGS= -O6 -D_KERNEL -DI386_CPU -DI486_CPU -DI586_CPU
CFLAGS+=-DDO_BAD144 -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
# Uncomment this to make the boot block talk to a serial port.
#CPPFLAGS+=-DSERIAL
# start.o should be first
OBJS= start.o table.o boot.o asm.o bios.o io.o disk.o sys.o version.o
boot: ${OBJS}
${LD} -Bstatic -e start -N -T 0 -o boot ${OBJS}
cp boot boot.sym
@strip boot
@sh ${.CURDIR}/rmaouthdr boot boot.tmp
@mv -f boot.tmp boot
@ls -l boot
biosboot: boot
dd if=boot of=biosboot count=1
bootbios: boot
dd if=boot of=bootbios skip=1
install: biosboot bootbios
cp biosboot ${DESTDIR}/usr/mdec/sdboot
cp bootbios ${DESTDIR}/usr/mdec/bootsd
rm -f ${DESTDIR}/usr/mdec/wdboot
ln ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/wdboot
rm -f ${DESTDIR}/usr/mdec/bootwd
ln ${DESTDIR}/usr/mdec/bootsd ${DESTDIR}/usr/mdec/bootwd
rm -f ${DESTDIR}/usr/mdec/fdboot
ln ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/fdboot
rm -f ${DESTDIR}/usr/mdec/bootfd
ln ${DESTDIR}/usr/mdec/bootsd ${DESTDIR}/usr/mdec/bootfd
CLEANFILES+=biosboot bootbios boot boot.sym machine ${MACHINE_ARCH}
.include <bsd.prog.mk>

View File

@ -1,151 +0,0 @@
$NetBSD: README.386BSD,v 1.3 1994/10/27 04:14:26 cgd Exp $
This Boot code is different from the original boot code that came with
386BSD in that it uses the BIOS to load the kernel and to provide all i/o
services. The advantage ofthis is that the same boot code exactly, can run
on any device that is supported by the BIOS. (That's most of them)
This is important for the 'generic scsi' project because it means we can
write drivers for new scsi adapters without having to develop an new
set of boot blocks for each.
At this point you should read the first part of README.MACH... come back here
when you have done that:
In normal operation, when co-existing with other operating systems, the
following operations occur:
1/ the BIOS loads the first block of the disk (called the Master Boot Record
or MBR) and if it has the correct magic numbers, jumps into it:
2/ The MBR code, looks at the Partition table that is embedded within it,
to detirmine which is the partition to boot from. If you are using the os-bs
bootblocks (highly recommended) then it will give you a menu to choose from.
3/ The MBR will load the first record of the selected partition and
if it has (the same) magic numbers, jumps into it. In 386bsd this is the
first stage boot, (or boot1) it is represented in /usr/mdec by
wdboot, asboot and sdboot. If the disk has been set up without DOS partitioning
then this block will be at block zero, and will have been loaded directly by
the BIOS.
4/ Boot1 will look at block0 (which might be itself if there are no DOS
partitions) and will find the 386bsd partition, and using the information
regarding the start position of that partition, will load the next 13 sectors
or so, to around 60000 (640k - 256k). and will jump into it at the appropriate
entry point. Since boot1 and boot2 were compiled together as one file
and then split later, boot1 knows the exact position within boot2 of the
entry point.
Boot 1 also contains a compiled in DOS partition table
(in case it is at block 0), which contains a 386bsd partition starting
at 0. This ensures that the same code can work whether or not
boot1 is at block 0.
5/ Boot2 asks the user for a boot device, partition and filename, and then
loads the MBR of the selected device. This may or may not be the device
which was originally used to boot the first MBR. The partition table
of the new MBR is searched for a 386bsd partition, and if one is found,
that is then in turn searched for the disklabel. This could all be on the
second disk at this point, if the user selected it.
6/On finding the disklabel, boot2 can find the correct unix partition
within the 386bsd partition, and using cutdown filesystem code,
look for the file to boot (e.g. 386bsd).
7/ Boot2 loads this file starting at the location specified by the a.out header,
(see later) and leaps into it at the location specified in he header.
if the file does not exist or cannot be loaded, boot2 goes back to step 5.
386bsd is now running and will hopefully start vm etc. and get to multi-user
mode.
##########################################################################
During all these steps, all i/o is performed using the BIOS. This has a number
of side effects:
1/ Since BIOS disk calls are specified in terms of cylinder,head and sector,
and the BIOS read the disk information from either the CMOS or from some other
location which is un-available to us, we must use the cyl,head,sec information
that is given in the MBR, rather than the start address in the MBR, because
we cannot guarentee that we can corectly calculate C,H,S from the start address.
Therefore, the C,H,S information in the MBR must be as correct for this boot
to work as it would be for DOS to boot. For example, adaptec BIOS routines
assume a layout of 64 heads and 32 sectors giving 1MB per ficticious cylinder.
You must use these figures to calculate the correct values. Luckily, the DOS
fdisk program will do all this for you if you tell it to give you a DOS
partition, and you can change it to a 386BSD partition later. If you use
no DOS partitioning, then the compiled in table in Boot1 will do just fine.
If you want to do it by hand remember that BIOS counts sectors starting at 1.
(cylinders and heads start at 0 (??))
2/ you cannot overwrite the bottom 4k of ram until you have finished ALL
bios calls, as BIOS uses this area as scratch memory.
3/ Since BIOS runs in REAL mode, and Boot2 runs in protected mode,
Boot 2 switches back to real mode just before each BIOS call and then
back to protected mode on each return. Touch this at your peril.!
#########################################################################
In answering the prompt from Boot2:
you can,
1/ leave it alone.. it will boot the indicated file from the first
partition of the first drive seen by the BIOS (C:)
2/ enter only "-s" to boot the default to single user mode
3/ enter only a filename (optionally with -s) to boot that kernel,
4/ enter a whole line of the form shown in the prompt. This allows you to
boot some other partition, possibly on the second drive, as root.
##########################################################################
In the case you have two drives the same type (both scsi or bith IDE/ESDI),
wd(0,a)xxx
will boot xxx from drive 0, a partition.
wd(1,a)xxx
will boot xxx from drive 1, a partition.
similarly for sd.
if you have one wd drive and one scsi drive, then you MUST
use device 'hd'
otherwise the following will happen:
with wd0 and sd0, you specify sd1 or wd1 to indicate the 2nd drive.
it boots the kernel correctly, then tells the kernel to use sd1 as root.
you however may not have an sd1, and problems arise.
hd is special in that the kernel is always told to use unit 0,
The correct TYPE of device will be specified too, so the kernel
will be told either sd0 or wd0.
Whether sd or wd is specified to the kernel is read from the disklabel,
so ensure that all SCSI disks have type SCSI in their disklabel or the
boot code will assume they are ESDI or IDE. (Remember, because it is
working through the BIOS it has ho idea what kind of disk it is.
##########################################################################
Installing:
The makefile supplied has a target install which will create the
files wdboot,bootwd ,sdboot and bootsd in /usr/mdec.
BEWARE these will overwrite the existing wdboot and bootwd. (so back
them up)
there are also targets wd and sd which wil only do one of them
The commented out targets wd0 and sd0 are examples of how to
load the new bootblocks, however,make sure you change the
device type and label to suit your drive if you uncomment them.
(see 'man disklabel')
If you already have made partitions using the old bootblocks
these should install painlessly.
Before you do this ensure you have a booting floppy with correct
disktab and bootblock files on it so that if it doesn't work, you can
re-disklabel from the floppy.

View File

@ -1,207 +0,0 @@
/* $NetBSD: README.MACH,v 1.5 1994/10/27 04:14:28 cgd Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer, September 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
********NOTE: This is not all relevant to the 386BSD version**********
AT386 Protected Mode Bootstrap Loader
=====================================
1. Overview of Startup
-------------------
After the system is rebooted, the BIOS bootstrap routine reads Sector
1, Track 0 into memory at location 0000:7C00H. If location 0000:7DFEH
(last two bytes of that sector) contains the value AA55H, the BIOS
bootstrap routine will transfer control to 0000:7C00H. Otherwise, the
boot code in that sector is bad and the boot routine stops.
For DOS compatibility reason, one extra stage of boot is required if
the boot device is a hard disk. The first sector of the hard disk will
contain the MOS-DOS boot code and a boot record partition table.
When this sector is loaded into 0000:7C00H, it will relocate itself
to somewhere else and then load the first sector of the active
partition into 0000:7C00H. Both UNIX and DOS use the command "fdisk"
to install this first sector into the hard disk and to manipulate
the hard disk partitions.
2. The First Stage Bootstrap Loader
--------------------------------
After startup, the first stage boot is loaded at 0000:7C00H. This
first stage boot will load itself and the second stage boot into
memory at location 0000:1000H. For floppy disks, the first cylinder
is reserved as the boot cylinder, and the boot code (first and second)
will be loaded from there. Currently, only double sided, high density
(15 sectors per track) floppies are supported. For hard disks, the
first 29 sectors of the active partition is reserved for boot code
which will be loaded by the first stage boot. All the disk types
recognized by BIOS are supported by this bootstrap loader.
3. The Second Stage Bootstrap Loader
--------------------------------
After the boot code is loaded, the control is passed to the second
stage bootstrap loader "boot2()". In order to be able to load the
big kernel image (bigger than 512K or 640K, depends on the memory
configuration), the second stage boot loader will run on the protected
mode. This bootstarp loader does not have any stand alone device
drivers, all the I/O's are through the BIOS calls. Since the first
stage boot code will no longer be used at this moment, the memory
location of the first stage boot code (0000:1000H to 0000:1200H) will
be used as an internal buffer for BIOS calls. Immediately after this
[For NetBSD, we have a different buffer which can hold an entire floppy
track.]
internal buffer is the GDT table for the second stage boot loader.
Since this boot loader needs to switch back and forth between protected
and real mode in order to use BIOS calls, the limit of the boot code
and boot data segments must not be greater than 64K.
The boot loader loads the kernel image at memory location above 1 MB
to skip the memory hole between 521K/640K and 1MB. After the kernel
is loaded, the boot loader stores the information in the stack and
then passes control to kernel. Currently, the three information passed
fromm the boot loader to the kernel are type of the boot device, size
of the base memory and size of the extended memory.
[NetBSD receives: howto, bootdev, esym.]
[NetBSD is loaded where-ever the "MByte" bits of the load address specify;
normally the load address is F8100000, so it loads at 1MB.]
4. The UNIX Startup
----------------
Since the boot loader loads the kernel image at memory location above
1MB, the kernel has to start as protected mode. In addition, the
link editor description file (vuifile) has to indicate that
the text and data segments start above 1MB. Also, the boot loader
passes the infomation to the kernel through the stack.
[MOST of what is mentionned below is NOT relevant to NetBSD.]
5. Disk Layout and Bad Block Handling
---------------------------------
The System V/386 Release 3.2 (AT) disk layout will be used as the disk
layout for the MACH System on the AT platform.
This disk layout is as follows:
* Reserve the first sector of cylinder 0 for the DOS boot record which
contains the master boot code (446 bytes) and the partition table.
(Refer to DOS Technical Reference Manual page 9-6 to 9-10).
* Reserve the first 29 sectors of the UNIX partition for the first
and the second stage bootstrap.
* Reserve the 30th sector of the UNIX partition for the pdinfo and
the vtoc tables.
* Reserve the 31st to the 34th sectors of the UNIX partition for the
bad track and the bad block mapping tables.
* Reserve up to 253 consecutive tracks when required, beginning with
the 35th sector of the UNIX partition, for alternate tracks.
* Reserve up to 253 consecutive blocks, beginning with the first
sector after the alternate tracks area, for alternate blocks.
SEC
1
----------------------------------------------------
| X | | CYL 0, TRK 0
---------------- .......... --------------------
| .......... |
---------------- .......... --------------------
| .......... |
===============================================================
^ | BOOTSTRAP | CYL N, TRK M
| ----------------------------------------------------
| | |30 |31 |32 |33 |34 |
---------------------------------------------------- ---
U | .......... | ^
N ---------------- .......... --------------------- |
I | .......... | Alternate Tracks
X ---------------- .......... --------------------- |
| .......... | V
P ---------------------------------------------------- ---
A | .......... | ^
R ---------------- .......... --------------------- |
T | .......... | Alternate Blocks
I ---------------- .......... -------------------- |
T | .......... | V
I ---------------------------------------------------- ---
O | Unix root partition starts from here |
N ---------------- -----------------
| |
----------------------------------------------------
| |
----------------------------------------------------
| |
| ---------------------------------------------------
| | |
| ----------------------------------------------------
V | |
===============================================================
| ........ |
--------------- ........ --------------
| ........ |
----------------------------------------------------
The bad block handling mechanism is as follows:
* Use the alternate track in the alternate tracks area if the
track containing the target sector is bad.
* Use the alternate block in the alternate blocks area if the
target sector is bad.
6. How to make:
-----------
Since the kernel image is loaded above 1 MB, the kernel must start
as protected mode. This means that this bootstrap loader will work
only when the corresponding changes on the kernel startup code are done.
The make command to generate this bootstrap loader is:
make -f boot.mk fdboot (floppy boot loader)
make -f boot.mk hdboot (wini boot loader)
[To make NetBSD bootblocks "make install" (warning: they will be installed
in /usr/mdec.. make backups).]

View File

@ -1,290 +0,0 @@
/* $NetBSD: asm.S,v 1.12 1995/03/12 00:10:53 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <machine/asm.h>
#define addr32 .byte 0x67
#define data32 .byte 0x66
CR0_PE = 0x1
.data
.globl _ourseg
_ourseg:
.long 0
/*
* real_to_prot()
* transfer from real mode to protected mode.
*/
ENTRY(real_to_prot)
# guarantee that interrupt is disabled when in prot mode
cli
# load the gdtr
addr32
data32
lgdt _C_LABEL(Gdtr)
# set the PE bit of CR0
movl %cr0, %eax
data32
orl $CR0_PE, %eax
movl %eax, %cr0
# make intrasegment jump to flush the processor pipeline and
# reload CS register
data32
ljmp $0x18, $xprot
xprot:
# we are in USE32 mode now
# set up the protected mode segment registers : DS, SS, ES
movl $0x20, %eax
movl %ax, %ds
movl %ax, %ss
movl %ax, %es
ret
/*
* prot_to_real()
* transfer from protected mode to real mode
*/
ENTRY(prot_to_real)
# set up a dummy stack frame for the second seg change.
movl _ourseg, %eax
pushw %ax
movl $xreal, %eax # gas botches pushw $xreal - extra bytes 0, 0
pushw %ax # decode to add %al, (%eax) (%al usually 0)
# Change to use16 mode.
ljmp $0x28, $x16
x16:
# clear the PE bit of CR0
movl %cr0, %eax
data32
andl $~CR0_PE, %eax
movl %eax, %cr0
# make intersegment jmp to flush the processor pipeline
# using the fake stack frame set up earlier
# and reload CS register
lret
xreal:
# we are in real mode now
# set up the real mode segment registers : DS, SS, ES
movl %cs, %ax
movl %ax, %ds
movl %ax, %ss
movl %ax, %es
sti
data32
ret
/*
* startprog(phyaddr)
* start the program on protected mode where phyaddr is the entry point
*/
ENTRY(startprog)
pushl %ebp
movl %esp, %ebp
# get things we need into registers
movl 8(%ebp), %ecx # entry offset
movl 12(%ebp), %eax # &argv
# make a new stack at 0:0x90000 (big segs)
movl $0x10, %ebx
movw %bx, %ss
movl $0x90000, %ebx
movl %ebx, %esp
# push some number of args onto the stack
pushl 28(%eax) # argv[7] = cnvmem
pushl 32(%eax) # argv[8] = extmem
pushl 16(%eax) # argv[4] = esym
pushl $0 # nominally a cyl offset in the boot.
pushl 8(%eax) # argv[2] = bootdev
pushl 4(%eax) # argv[1] = howto
pushl $0 # dummy 'return' address
# push on our entry address
movl $0x8, %ebx # segment
pushl %ebx
pushl %ecx
# convert over the other data segs
movl $0x10, %ebx
movl %bx, %ds
movl %bx, %es
# convert the PC (and code seg)
lret
/*
* pbzero(dst, cnt)
* where dst is a virtual address and cnt is the length
*/
ENTRY(pbzero)
pushl %ebp
movl %esp, %ebp
pushl %es
pushl %edi
cld
# set %es to point at the flat segment
movl $0x10, %eax
movl %ax, %es
movl 8(%ebp), %edi # destination
movl 12(%ebp), %ecx # count
xorl %eax, %eax # value
rep
stosb
popl %edi
popl %es
popl %ebp
ret
/*
* pcpy(src, dst, cnt)
* where src is a virtual address and dst is a physical address
*/
ENTRY(pcpy)
pushl %ebp
movl %esp, %ebp
pushl %es
pushl %esi
pushl %edi
cld
# set %es to point at the flat segment
movl $0x10, %eax
movl %ax, %es
movl 8(%ebp), %esi # source
movl 12(%ebp), %edi # destination
movl 16(%ebp), %ecx # count
rep
movsb
popl %edi
popl %esi
popl %es
popl %ebp
ret
#ifdef CHECKSUM
/*
* cksum(src, cnt)
* where src is a virtual address and cnt is the length
*/
ENTRY(cksum)
pushl %ebp
movl %esp, %ebp
pushl %es
pushl %edi
cld
# set %es to point at the flat segment
movl $0x10, %eax
movl %ax, %es
movl 8(%ebp), %edi # destination
movl 12(%ebp), %ecx # count
shrl $2, %ecx
xorl %edx, %edx # value
1: es
lodsl
xorl %eax, %edx
loop 1b
movl %edx, %eax
popl %edi
popl %es
popl %ebp
ret
#endif
#if 0
ENTRY(getword)
pushl %ebp
movl %esp, %ebp
pushl %es
# set %es to point at the flat segment
movl $0x10, %eax
movl %ax, %es
movl 8(%ebp), %eax
es
movl (%eax), %edx
movl %edx, %eax
popl %es
popl %ebp
ret
#endif

View File

@ -1,396 +0,0 @@
/* $NetBSD: bios.S,v 1.15 1996/06/18 07:17:47 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <machine/asm.h>
#define addr32 .byte 0x67
#define data32 .byte 0x66
/*
# BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
# Call with %ah = 0x2
# %al = number of sectors
# %ch = cylinder
# %cl = sector
# %dh = head
# %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
# %es:%bx = segment:offset of buffer
# Return:
# %al = 0x0 on success; err code on failure
*/
ENTRY(biosread)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movb 28(%esp), %dh
movw 24(%esp), %cx
xchgb %ch, %cl # cylinder; the highest 2 bits of cyl is in %cl
rorb $2, %cl
movb 32(%esp), %al
orb %al, %cl
incb %cl # sector; sec starts from 1, not 0
movb 20(%esp), %dl # device
movl 40(%esp), %ebx # offset
# prot_to_real will set %es to BOOTSEG
call _C_LABEL(prot_to_real) # enter real mode
movb $0x2, %ah # subfunction
addr32
movb 36(%esp), %al # number of sectors
int $0x13
setc %bl
data32
call _C_LABEL(real_to_prot) # back to protected mode
xorl %eax, %eax
movb %bl, %al # return value in %ax
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
#ifndef SERIAL
/*
# BIOS call "INT 10H Function 0Eh" to write character to console
# Call with %ah = 0x0e
# %al = character
# %bh = page
# %bl = foreground color
*/
#else /* SERIAL */
/*
# BIOS call "INT 14H Function 01h" to write character to console
# Call with %ah = 0x01
# %al = character
# %dx = port number
*/
#endif /* SERIAL */
ENTRY(putc)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movb 20(%esp), %cl
call _C_LABEL(prot_to_real)
movb %cl, %al
#ifndef SERIAL
movb $0x0e, %ah
data32
movl $0x0001, %ebx
int $0x10 # display a byte
#else /* SERIAL */
movb $0x01, %ah
xorl %edx, %edx
int $0x14 # display a byte
#endif /* SERIAL */
data32
call _C_LABEL(real_to_prot)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
#ifndef SERIAL
/*
# BIOS call "INT 16H Function 00H" to read character from the keyboard
# Call with %ah = 0x00
# Return: %ah = keyboard scan code
# %al = ASCII character
*/
#else /* SERIAL */
/*
# BIOS call "INT 14H Function 02H" to read character from the serial port
# Call with %ah = 0x02
# %dx = port number
# Return: %ah = line status
# %al = ASCII character
*/
#endif /* SERIAL */
ENTRY(getc)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
call _C_LABEL(prot_to_real)
#ifndef SERIAL
movb $0x00, %ah
int $0x16
#else /* SERIAL */
movb $0x02, %ah
xorl %edx, %edx
int $0x14
#endif /* SERIAL */
movb %al, %bl # real_to_prot uses %eax
data32
call _C_LABEL(real_to_prot)
xorl %eax, %eax
movb %bl, %al
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
#ifndef SERIAL
/*
# BIOS call "INT 16H Function 01H" to check whether a character is pending
# Call with %ah = 0x01
# Return:
# If key waiting to be input:
# %ah = keyboard scan code
# %al = ASCII character
# ZF = clear
# else
# ZF = set
*/
#else /* SERIAL */
/*
# BIOS call "INT 14H Function 03H" to check whether a character is pending
# Call with %ah = 0x03
# %dx = port number
# Return: %ah = line status
# %al = modem status
*/
#endif /* SERIAL */
ENTRY(ischar)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
call _C_LABEL(prot_to_real)
#ifndef SERIAL
movb $0x01, %ah
int $0x16
setnz %ah
#else /* SERIAL */
movb $0x03, %ah
xorl %edx, %edx
int $0x14
andb $0x1f, %ah
#endif /* SERIAL */
movb %ah, %bl # real_to_prot uses %eax
data32
call _C_LABEL(real_to_prot)
xorl %eax, %eax
movb %bl, %al
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/*
#
# get_diskinfo(): return a word that represents the
# max number of sectors and heads and drives for this device
#
*/
ENTRY(get_diskinfo)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movb 20(%esp), %dl # diskinfo(drive #)
call _C_LABEL(prot_to_real) # enter real mode
movb $0x08, %ah # ask for disk info
int $0x13
jnc ok
/*
* Urk. Call failed. It is not supported for floppies by old BIOS's.
* Guess it's a 15-sector floppy. Initialize all the registers for
* documentation, although we only need head and sector counts.
*/
subb %ah, %ah # %ax = 0
movb %ah, %bh # %bh = 0
movb $2, %bl # %bl bits 0-3 = drive type, 2 = 1.2M
movb $79, %ch # max track
movb $15, %cl # max sector
movb $1, %dh # max head
movb $1, %dl # # floppy drives installed
# es:di = parameter table
# carry = 0
ok:
data32
call _C_LABEL(real_to_prot) # back to protected mode
xorl %eax, %eax
/*form a longword representing all this gunk*/
movb %dh, %ah # max head
andb $0x3f, %cl # mask of cylinder gunk
movb %cl, %al # max sector (and # sectors)
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/*
#
# memsize(i) : return the memory size in KB. i == 0 for conventional memory,
# i == 1 for extended memory
# BIOS call "INT 12H" to get conventional memory size
# BIOS call "INT 15H, AH=88H" to get extended memory size
# Both have the return value in AX.
#
*/
ENTRY(memsize)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movl 20(%esp), %ebx
call _C_LABEL(prot_to_real) # enter real mode
testb %bl, %bl
data32
jnz xext
int $0x12
data32
jmp xdone
xext:
movb $0x88, %ah
int $0x15
xdone:
movl %eax, %ebx
data32
call _C_LABEL(real_to_prot)
movl %ebx, %eax
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
/*
# BIOS call "INT 15H Function 86H" to sleep for a set number of microseconds
# Call with %ah = 0x86
# %cx = time interval (high)
# %dx = time interval (low)
# Return:
# If error
# CF = set
# else
# CF = clear
*/
ENTRY(usleep)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movw 20(%esp), %dx
movw 22(%esp), %cx
call _C_LABEL(prot_to_real)
movb $0x86, %ah
int $0x15
setnc %ah
movb %ah, %bl # real_to_prot uses %eax
data32
call _C_LABEL(real_to_prot)
xorl %eax, %eax
movb %bl, %al
popl %edi
popl %esi
popl %ebx
popl %ebp
ret

View File

@ -1,326 +0,0 @@
/* $NetBSD: boot.c,v 1.32 1996/08/30 01:34:01 thorpej Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/exec.h>
#include "boot.h"
#include <sys/reboot.h>
struct exec head;
int argv[9];
#ifdef CHECKSUM
int cflag;
#endif
char *name;
char *names[] = {
"/netbsd", "/onetbsd", "/netbsd.old",
};
#define NUMNAMES (sizeof(names)/sizeof(char *))
/* Number of seconds that prompt should wait during boot */
#define PROMPTWAIT 5
static void getbootdev __P((int *howto));
static void loadprog __P((int howto));
extern char *version;
extern int end;
void
netbsd_boot(drive)
int drive;
{
int loadflags;
char *t;
printf("\n"
">> NetBSD BOOT: %d/%d k [%s]\n"
"use hd(1,a)/netbsd to boot sd0 when wd0 is also installed\n",
argv[7] = memsize(0),
argv[8] = memsize(1),
version);
gateA20(1);
for (;;) {
/***************************************************************\
* As a default set it to the first partition of the first *
* floppy or hard drive *
\***************************************************************/
maj = (drive & 0x80 ? 0 : 2); /* a good first bet */
unit = drive & 0x7f;
part = 0;
loadflags = 0;
getbootdev(&loadflags);
if (openrd()) {
printf("Can't find %s\n", name);
continue;
}
loadprog(loadflags);
}
}
static void
loadprog(howto)
int howto;
{
long int startaddr;
long int addr; /* physical address.. not directly useable */
int i;
static int (*x_entry)() = 0;
read(&head, sizeof(head));
if (N_BADMAG(head)) {
printf("invalid format\n");
return;
}
poff = N_TXTOFF(head);
startaddr = (int)head.a_entry;
addr = (startaddr & 0x00f00000); /* some MEG boundary */
printf("Booting %s(%d,%c)%s @ 0x%x\n",
devs[maj], unit, 'a'+part, name, addr);
/*
* The +40960 is for memory used by locore.s for the kernel page
* table and proc0 stack. XXX
*/
if ((addr + N_BSSADDR(head) + head.a_bss + 40960) >
((memsize(1) + 1024) * 1024)) {
printf("kernel too large\n");
return;
}
/********************************************************/
/* LOAD THE TEXT SEGMENT */
/********************************************************/
printf("%d", head.a_text);
xread(addr, head.a_text);
#ifdef CHECKSUM
if (cflag)
printf("(%x)", cksum(addr, head.a_text));
#endif
addr += head.a_text;
/********************************************************/
/* Load the Initialised data after the text */
/********************************************************/
if (N_GETMAGIC(head) == NMAGIC) {
i = CLBYTES - (addr & CLOFSET);
if (i < CLBYTES) {
pbzero(addr, i);
addr += i;
}
}
printf("+%d", head.a_data);
xread(addr, head.a_data);
#ifdef CHECKSUM
if (cflag)
printf("(%x)", cksum(addr, head.a_data));
#endif
addr += head.a_data;
/********************************************************/
/* Skip over the uninitialised data */
/* (but clear it) */
/********************************************************/
printf("+%d", head.a_bss);
pbzero(addr, head.a_bss);
argv[3] = (addr += head.a_bss);
/********************************************************/
/* copy in the symbol header */
/********************************************************/
pcpy(&head.a_syms, addr, sizeof(head.a_syms));
addr += sizeof(head.a_syms);
if (head.a_syms == 0)
goto nosyms;
/********************************************************/
/* READ in the symbol table */
/********************************************************/
printf("+[%d", head.a_syms);
xread(addr, head.a_syms);
#ifdef CHECKSUM
if (cflag)
printf("(%x)", cksum(addr, head.a_syms));
#endif
addr += head.a_syms;
/********************************************************/
/* Followed by the next integer (another header) */
/* more debug symbols? */
/********************************************************/
read(&i, sizeof(int));
pcpy(&i, addr, sizeof(int));
if (i) {
i -= sizeof(int);
addr += sizeof(int);
printf("+%d", i);
xread(addr, i);
#ifdef CHECKSUM
if (cflag)
printf("(%x)", cksum(addr, i));
#endif
addr += i;
}
putchar(']');
/********************************************************/
/* and that many bytes of (debug symbols?) */
/********************************************************/
nosyms:
argv[4] = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
/********************************************************/
/* and note the end address of all this */
/********************************************************/
printf("=0x%x\n", addr);
#ifdef CHECKSUM
if (cflag)
return;
#endif
/*
* We now pass the various bootstrap parameters to the loaded
* image via the argument list
*
* arg0 = 8 (magic)
* arg1 = boot flags
* arg2 = boot device
* arg3 = start of symbol table (0 if not loaded)
* arg4 = end of symbol table (0 if not loaded)
* arg5 = transfer address from image
* arg6 = transfer address for next image pointer
* arg7 = conventional memory size (640)
* arg8 = extended memory size (8196)
*/
#ifndef ONEDISK
if (maj == 2) {
printf("\n\nInsert file system floppy\n");
getc();
}
#endif
startaddr &= 0xffffff;
argv[1] = howto;
argv[2] = (MAKEBOOTDEV(maj, 0, 0, unit, part));
argv[5] = startaddr;
argv[6] = (int) &x_entry;
argv[0] = 8;
/****************************************************************/
/* copy that first page and overwrite any BIOS variables */
/****************************************************************/
printf("entry point at 0x%x\n", (int)startaddr);
startprog((int)startaddr, argv);
}
static void
getbootdev(howto)
int *howto;
{
static int currname = 0;
static char namebuf[100]; /* don't allocate on stack! */
char c, *ptr;
name = names[currname];
printf("Boot: [[[%s(%d,%c)]%s][-adrs]] :- ",
devs[maj], unit, 'a'+part, name);
#ifdef CHECKSUM
cflag = 0;
#endif
if (awaitkey(PROMPTWAIT)) {
gets(namebuf);
ptr = namebuf;
while (c = *ptr) {
while (c == ' ')
c = *++ptr;
if (!c)
return;
if (c == '-')
while ((c = *++ptr) && c != ' ') {
if (c == 'a')
*howto |= RB_ASKNAME;
else if (c == 'b')
*howto |= RB_HALT;
#ifdef CHECKSUM
else if (c == 'c')
cflag = 1;
#endif
else if (c == 'd')
*howto |= RB_KDB;
else if (c == 'r')
*howto |= RB_DFLTROOT;
else if (c == 's')
*howto |= RB_SINGLE;
}
else {
name = ptr;
while ((c = *++ptr) && c != ' ');
if (c)
*ptr++ = 0;
}
}
} else {
putchar('\n');
if (++currname == NUMNAMES)
currname = 0;
}
}

View File

@ -1,43 +0,0 @@
/* $NetBSD: boot.h,v 1.7 1996/08/30 01:34:11 thorpej Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ufs/quota.h>
#include <ufs/ffs/fs.h>
#include <ufs/ufs/inode.h>
extern char *devs[], *name, *iodest;
extern struct fs *fs;
extern struct inode inode;
extern int dosdev, unit, part, maj, boff, poff, bnum, cnt;
void netbsd_boot __P((int));

View File

@ -1,222 +0,0 @@
/* $NetBSD: disk.c,v 1.14 1996/06/18 06:10:33 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include "boot.h"
#ifdef DO_BAD144
#include <sys/dkbad.h>
#endif DO_BAD144
#include <sys/disklabel.h>
#define BIOS_DEV_FLOPPY 0x0
#define BIOS_DEV_WIN 0x80
#define BPS 512
#define SPT(di) ((di)&0xff)
#define HEADS(di) ((((di)>>8)&0xff)+1)
char *devs[] = {"wd", "hd", "fd", "", "sd", 0};
#ifdef DO_BAD144
struct dkbad dkb;
int do_bad144;
int bsize;
#endif DO_BAD144
char *iodest;
struct fs *fs;
struct inode inode;
int spt, spc;
int dosdev, unit, part, maj, boff, poff, bnum, cnt;
extern struct disklabel disklabel;
extern char iobuf[];
devopen()
{
struct dos_partition *dptr;
struct disklabel *lp;
int i, sector, di;
di = get_diskinfo(dosdev);
spc = (spt = SPT(di)) * HEADS(di);
if (dosdev == 2) {
boff = 0;
part = (spt == 15 ? 3 : 1);
} else {
Bread(0, iobuf);
dptr = (struct dos_partition *)&iobuf[DOSPARTOFF];
sector = LABELSECTOR;
for (i = 0; i < NDOSPART; i++, dptr++)
if (dptr->dp_typ == DOSPTYP_386BSD) {
sector = dptr->dp_start + LABELSECTOR;
break;
}
lp = &disklabel;
Bread(sector++, lp);
if (lp->d_magic != DISKMAGIC) {
printf("bad disklabel");
return 1;
}
if (maj == 4 || maj == 0 || maj == 1) {
if (lp->d_type == DTYPE_SCSI)
maj = 4; /* use scsi as boot dev */
else
maj = 0; /* must be ESDI/IDE */
}
boff = lp->d_partitions[part].p_offset;
#ifdef DO_BAD144
bsize = lp->d_partitions[part].p_size;
do_bad144 = 0;
if (lp->d_flags & D_BADSECT) {
/* this disk uses bad144 */
int i;
int dkbbnum;
struct dkbad *dkbptr;
/* find the first readable bad144 sector */
dkbbnum = lp->d_secperunit - lp->d_nsectors;
if (lp->d_secsize > DEV_BSIZE)
dkbbnum *= lp->d_secsize / DEV_BSIZE;
do_bad144 = 0;
for (i = 5; i; i--) {
/* XXX: what if the "DOS sector" < 512 bytes ??? */
Bread(dkbbnum, iobuf);
dkbptr = (struct dkbad *)&iobuf[0];
/* XXX why is this not in <sys/dkbad.h> ??? */
#define DKBAD_MAGIC 0x4321
if (dkbptr->bt_mbz == 0 &&
dkbptr->bt_flag == DKBAD_MAGIC) {
dkb = *dkbptr; /* structure copy */
do_bad144 = 1;
break;
}
dkbbnum += 2;
}
if (!do_bad144)
printf("Bad badsect table\n");
else
printf("Using bad144 bad sector at %d\n",
dkbbnum);
}
#endif DO_BAD144
}
return 0;
}
devread()
{
int offset, sector = bnum;
for (offset = 0; offset < cnt; offset += BPS)
Bread(badsect(sector++), iodest + offset);
}
#define I_ADDR ((void *) 0) /* XXX where all reads go */
/* Read ahead buffer large enough for one track on a 1440K floppy. For
* reading from floppies, the bootstrap has to be loaded on a 64K boundary
* to ensure that this buffer doesn't cross a 64K DMA boundary.
*/
#define RA_SECTORS 18
static char ra_buf[RA_SECTORS * BPS];
static int ra_dev;
static int ra_end;
static int ra_first;
Bread(sector, addr)
int sector;
void *addr;
{
if (dosdev != ra_dev || sector < ra_first || sector >= ra_end) {
int cyl, head, sec, nsec;
cyl = sector / spc;
head = (sector % spc) / spt;
sec = sector % spt;
nsec = spt - sec;
if (nsec > RA_SECTORS)
nsec = RA_SECTORS;
twiddle();
while (biosread(dosdev, cyl, head, sec, nsec, ra_buf)) {
printf("Error: C:%d H:%d S:%d\n", cyl, head, sec);
nsec = 1;
twiddle();
}
ra_dev = dosdev;
ra_first = sector;
ra_end = sector + nsec;
}
bcopy(ra_buf + (sector - ra_first) * BPS, addr, BPS);
}
badsect(sector)
int sector;
{
int i;
#ifdef DO_BAD144
if (do_bad144) {
u_short cyl, head, sec;
int newsec;
struct disklabel *dl = &disklabel;
/* XXX */
/* from wd.c */
/* bt_cyl = cylinder number in sorted order */
/* bt_trksec is actually (head << 8) + sec */
/* only remap sectors in the partition */
if (sector < boff || sector >= boff + bsize)
goto no_remap;
cyl = sector / dl->d_secpercyl;
head = (sector % dl->d_secpercyl) / dl->d_nsectors;
sec = sector % dl->d_nsectors;
sec += head << 8;
/* now, look in the table for a possible bad sector */
for (i = 0; i < 126; i++) {
if (dkb.bt_bad[i].bt_cyl == cyl &&
dkb.bt_bad[i].bt_trksec == sec) {
/* found same sector */
goto remap;
} else if (dkb.bt_bad[i].bt_cyl > cyl) {
goto no_remap;
}
}
goto no_remap;
remap:
/* otherwise find replacement sector */
newsec = dl->d_secperunit - dl->d_nsectors - i -1;
return newsec;
}
#endif DO_BAD144
no_remap:
return sector;
}

View File

@ -1,240 +0,0 @@
/* $NetBSD: io.c,v 1.19 1996/06/18 07:47:04 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include <sys/types.h>
#include <machine/pio.h>
void gateA20 __P((int on));
/*void printf __P((const char *format, int data));*/ /* not quite right XXX */
void putchar __P((int c));
void gets __P((char *buf));
int strcmp __P((const char *s1, const char *s2));
void bcopy __P((char *from, char *to, int len));
int awaitkey __P((int seconds));
void twiddle __P((void));
#define K_RDWR 0x60 /* keyboard data & cmds (read/write) */
#define K_STATUS 0x64 /* keyboard status */
#define K_CMD 0x64 /* keybd ctlr command (write-only) */
#define K_OBUF_FUL 0x01 /* output buffer full */
#define K_IBUF_FUL 0x02 /* input buffer full */
#define KC_CMD_WIN 0xd0 /* read output port */
#define KC_CMD_WOUT 0xd1 /* write output port */
#define KB_A20 0xdf /* enable A20,
enable output buffer full interrupt
enable data line
enable clock line */
/*
* Gate A20 for high memory
*/
void
gateA20(on)
int on;
{
#ifdef IBM_L40
outb(0x92, 0x2);
#else IBM_L40
while (inb(K_STATUS) & K_IBUF_FUL);
while (inb(K_STATUS) & K_OBUF_FUL)
(void)inb(K_RDWR);
outb(K_CMD, KC_CMD_WOUT);
while (inb(K_STATUS) & K_IBUF_FUL);
if (on)
outb(K_RDWR, 0xdf);
else
outb(K_RDWR, 0xcd);
while (inb(K_STATUS) & K_IBUF_FUL);
while (inb(K_STATUS) & K_OBUF_FUL)
(void)inb(K_RDWR);
#endif IBM_L40
}
/* printf - only handles %d as decimal, %c as char, %s as string */
void
printf(format, data)
const char *format;
int data;
{
int *dataptr = &data;
char c;
while (c = *format++) {
if (c != '%') {
putchar(c);
continue;
}
c = *format++;
if (c == 'd') {
int num = *dataptr++, dig;
char buf[10], *ptr = buf;
if (num < 0) {
num = -num;
putchar('-');
}
do {
dig = num % 10;
*ptr++ = '0' + dig;
} while (num /= 10);
do
putchar(*--ptr);
while (ptr != buf);
} else if (c == 'x') {
unsigned int num = (unsigned int)*dataptr++, dig;
char buf[8], *ptr = buf;
do {
dig = num & 0xf;
*ptr++ = dig > 9 ?
'a' + dig - 10 :
'0' + dig;
} while (num >>= 4);
do
putchar(*--ptr);
while (ptr != buf);
} else if (c == 'c') {
putchar((char)*dataptr++);
} else if (c == 's') {
char *ptr = (char *)*dataptr++;
while (c = *ptr++)
putchar(c);
}
}
}
void
putchar(c)
int c;
{
if (c == '\n')
putc('\r');
putc(c);
}
void
gets(buf)
char *buf;
{
char *ptr = buf;
for (;;) {
register int c = getc();
if (c == '\n' || c == '\r') {
putchar('\n');
*ptr = '\0';
return;
} else if (c == '\b' || c == '\177') {
if (ptr > buf) {
putchar('\b');
putchar(' ');
putchar('\b');
ptr--;
}
} else {
putchar(c);
*ptr++ = c;
}
}
/* shouldn't ever be reached; we have to return in the loop. */
}
int
strcmp(s1, s2)
const char *s1, *s2;
{
while (*s1 == *s2) {
if (!*s1++)
return 0;
s2++;
}
return 1;
}
void
bcopy(from, to, len)
char *from, *to;
int len;
{
if (from > to)
while (--len >= 0)
*to++ = *from++;
else {
to += len;
from += len;
while (--len >= 0)
*--to = *--from;
}
}
/* Number of milliseconds to sleep during each microsleep */
#define NAPTIME 50
/*
* awaitkey takes a number of seconds to wait for a key to be
* struck. If a key is struck during the period, it returns true, else
* it returns false. It returns (nearly) as soon as the key is
* hit. Note that it does something only slightly smarter than busy waiting.
*/
int
awaitkey(seconds)
int seconds;
{
int i;
/*
* We sleep for brief periods (typically 50 milliseconds, set
* by NAPTIME), polling the input buffer at the end of
* each period.
*/
for (i = ((seconds*1000)/NAPTIME); i > 0; i--) {
/* multiply by 1000 to get microseconds. */
usleep(NAPTIME*1000);
if (ischar())
break;
}
/* If a character was hit, "i" will still be non-zero. */
return (i != 0);
}
void
twiddle()
{
static int pos;
putchar("|/-\\"[pos++ & 3]);
putchar('\b');
}

View File

@ -1,4 +0,0 @@
#!/bin/csh -f
# $NetBSD: rmaouthdr,v 1.3 1994/10/27 04:14:39 cgd Exp $
dd if=$1 of=$2 ibs=32 skip=1 obs=1024b

View File

@ -1,390 +0,0 @@
/* $NetBSD: start.S,v 1.14 1996/08/30 01:34:15 thorpej Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <machine/asm.h>
#define addr32 .byte 0x67
#define data32 .byte 0x66
BOOTSEG = 0x0100 # boot will be loaded here (below 640K)
BOOTSTACK = 0xfffc # boot stack
SIGNATURE = 0xaa55
LOADSZ = 15 # size of unix boot
PARTSTART = 0x1be # starting address of partition table
NUMPART = 4 # number of partitions in partition table
PARTSZ = 16 # each partition table entry is 16 bytes
BSDPART = 0xA5 # value of boot_ind, means bootable partition
BOOTABLE = 0x80 # value of boot_ind, means bootable partition
.text
.globl start
ENTRY(boot1)
start:
# start (aka boot1) is loaded at 0x0:0x7c00 but we want 0x7c0:0
# ljmp to the next instruction to adjust %cs
data32
ljmp $0x7c0, $start1
start1:
# set up %ds
movl %cs, %ax
movl %ax, %ds
# set up %ss and %esp
data32
movl $BOOTSEG, %eax
movl %ax, %ss
data32
movl $BOOTSTACK, %esp
/*** set up %es, (where we will load boot2 to) ***/
movl %ax, %es
#ifdef SERIAL
# Initialize the serial port to 9600 baud, 8N1.
data32
pushl %edx
data32
movl $0x00e3, %eax
xorl %edx, %edx
int $0x14
data32
popl %edx
#endif /* SERIAL */
#ifdef DEBUG
data32
movl $one, %esi
data32
call message
#endif /* DEBUG */
# bootstrap passes us drive number in %dl
cmpb $0x80, %dl
data32
jae hd
fd:
# reset the disk system
#ifdef DEBUG
data32
movl $two, %esi
data32
call message
#endif /* DEBUG */
movb $0x00, %ah
int $0x13
#ifdef DEBUG
data32
movl $three, %esi
data32
call message
#endif /* DEBUG */
data32
movl $0x0001, %ecx # cyl 0, sector 1
movb $0x00, %dh # head
# XXX Override the drive number.
movb $0x00, %dl
data32
jmp load
hd: /**** load sector 0 into the BOOTSEG ****/
#ifdef DEBUG
data32
movl $four, %esi
data32
call message
#endif /* DEBUG */
data32
movl $0x0201, %eax
xorl %ebx, %ebx # %bx = 0
data32
movl $0x0001, %ecx
#ifdef DEBUG
data32
movl $five, %esi
data32
call message
#endif /* DEBUG */
data32
andl $0xff, %edx
/*mov $0x0080, %edx*/
int $0x13
data32
jb read_error
/***# find the first 386BSD partition *****/
data32
movl $PARTSTART, %ebx
data32
movl $NUMPART, %ecx
again:
addr32
movb %es:4(%ebx), %al
cmpb $BSDPART, %al
data32
je found
data32
addl $PARTSZ, %ebx
data32
loop again
data32
movl $enoboot, %esi
data32
jmp err_stop
/*
# BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
# Call with %ah = 0x2
# %al = number of sectors
# %ch = cylinder
# %cl = sector
# %dh = head
# %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
# %es:%bx = segment:offset of buffer
# Return:
# %al = 0x0 on success; err code on failure
*/
found:
addr32
movb %es:1(%ebx), %dh /* head */
addr32
movl %es:2(%ebx), %ecx /*sect, cyl (+ 2 bytes junk in top word) */
load:
movb $0x2, %ah /* function 2 */
movb $LOADSZ, %al /* number of blocks */
xorl %ebx, %ebx /* %bx = 0, put it at 0 in the BOOTSEG */
int $0x13
data32
jb read_error
# ljmp to the second stage boot loader (boot2).
# After ljmp, %cs is BOOTSEG and boot1 (512 bytes) will be used
# as an internal buffer "intbuf".
#ifdef DEBUG
data32
movl $six, %esi
data32
call message
#endif /* DEBUG */
data32
ljmp $BOOTSEG, $_C_LABEL(boot2)
#
# read_error
#
read_error:
data32
movl $eread, %esi
err_stop:
data32
call message
data32
jmp stop
#
# message: write the error message in %ds:%esi to console
#
message:
#ifndef SERIAL
/*
# BIOS call "INT 10H Function 0Eh" to write character to console
# Call with %ah = 0x0e
# %al = character
# %bh = page
# %bl = foreground color
*/
#else /* SERIAL */
/*
# BIOS call "INT 14H Function 01h" to write character to console
# Call with %ah = 0x01
# %al = character
# %dx = port number
*/
#endif /* SERIAL */
data32
pushl %eax
data32
pushl %ebx
data32
pushl %edx
nextb:
cld
lodsb # load a byte into %al
testb %al, %al
data32
jz done
#ifndef SERIAL
movb $0x0e, %ah
data32
movl $0x0001, %ebx
int $0x10
#else /* SERIAL */
movb $0x01, %ah
xorl %edx, %edx
int $0x14
#endif /* SERIAL */
data32
jmp nextb
done:
data32
popl %edx
data32
popl %ebx
data32
popl %eax
data32
ret
/* Conventional GDT indexes. */
BOOT_CS_INDEX = 3
BOOT_CS16_INDEX = 5
BOOT_DS_INDEX = 4
ENTRY(boot2)
data32
xorl %eax, %eax
movl %cs, %ax
movl %ax, %ds
movl %ax, %es
addr32
data32
movl %eax, _C_LABEL(ourseg)
data32
shll $4, %eax
/* fix up GDT entries for bootstrap */
#define FIXUP(gdt_index) \
addr32; \
movl %eax, _C_LABEL(Gdt)+(8*gdt_index)+2; /* actually movw %ax */ \
addr32; \
movb %bl, _C_LABEL(Gdt)+(8*gdt_index)+4
data32
shldl $16, %eax, %ebx
FIXUP(BOOT_CS_INDEX)
FIXUP(BOOT_CS16_INDEX)
FIXUP(BOOT_DS_INDEX)
/* fix up GDT pointer */
data32
addl $_C_LABEL(Gdt), %eax
addr32
data32
movl %eax, _C_LABEL(Gdtr)+2
/* change to protected mode */
data32
call _C_LABEL(real_to_prot)
/* clear the bss */
movl $_C_LABEL(edata), %edi
movl $_C_LABEL(end), %ecx
subl %edi, %ecx
subb %al, %al
rep
stosb
movzbl %dl, %edx /* discard head (%dh) and random high bits */
pushl %edx
call _C_LABEL(netbsd_boot)
stop:
cli
hlt
/* error messages */
#ifdef DEBUG
one: .asciz "1\r\n"
two: .asciz "2\r\n"
three: .asciz "3\r\n"
four: .asciz "4\r\n"
five: .asciz "5\r\n"
six: .asciz "6\r\n"
seven: .asciz "7\r\n"
#endif /* DEBUG */
eread: .asciz "Read error\r\n"
enoboot: .asciz "No bootable partition\r\n"
endofcode:
/* throw in a partition in case we are block0 as well */
/* flag, head, sec, cyl, typ, ehead, esect, ecyl, start, len */
. = _C_LABEL(boot1) + PARTSTART
.byte 0x0,0,0,0,0,0,0,0
.long 0,0
.byte 0x0,0,0,0,0,0,0,0
.long 0,0
.byte 0x0,0,0,0,0,0,0,0
.long 0,0
.byte BOOTABLE,0,1,0,BSDPART,255,255,255
.long 0,50000
/* the last 2 bytes in the sector 0 contain the signature */
. = _C_LABEL(boot1) + 0x1fe
.short SIGNATURE
. = _C_LABEL(boot1) + 0x200
.globl _disklabel
_disklabel:
. = _C_LABEL(boot1) + 0x400

View File

@ -1,251 +0,0 @@
/* $NetBSD: sys.c,v 1.15 1997/03/29 21:40:19 christos Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#include "boot.h"
#include <sys/dirent.h>
#include <sys/reboot.h>
char mapbuf[MAXBSIZE], iobuf[MAXBSIZE], fsbuf[SBSIZE];
int mapblock = 0;
char pathname[MAXPATHLEN + 1];
void bcopy(), pcpy();
read(buffer, count)
char *buffer;
int count;
{
_read(buffer, count, bcopy);
}
xread(buffer, count)
char *buffer;
int count;
{
_read(buffer, count, pcpy);
}
_read(buffer, count, copy)
char *buffer;
int count;
void (*copy)();
{
int logno, off, size;
int cnt2;
while (count) {
off = blkoff(fs, poff);
logno = lblkno(fs, poff);
cnt2 = size = blksize(fs, &inode, logno);
bnum = fsbtodb(fs, block_map(logno)) + boff;
cnt = cnt2;
iodest = iobuf;
devread();
size -= off;
if (size > count)
size = count;
copy(iodest + off, buffer, size);
buffer += size;
count -= size;
poff += size;
}
}
find(path)
char *path;
{
char *rest, ch;
int block, off, loc, ino = ROOTINO, parent;
struct dirent *dp;
int nlinks = 0;
loop:
iodest = iobuf;
cnt = fs->fs_bsize;
bnum = fsbtodb(fs, ino_to_fsba(fs,ino)) + boff;
devread();
bcopy(&((struct dinode *)iodest)[ino_to_fsbo(fs,ino)],
&inode.i_din,
sizeof(struct dinode));
if ((inode.i_mode & IFMT) == IFLNK) {
int link_len = inode.i_size;
int len = strlen(path);
if (link_len + len > MAXPATHLEN ||
++ nlinks > MAXSYMLINKS)
return 0;
bcopy(path, &pathname[link_len], len + 1);
if (link_len < fs->fs_maxsymlinklen)
bcopy(inode.i_shortlink, pathname, link_len);
else {
poff = 0;
read(pathname,link_len);
}
path = pathname;
if (*pathname == '/')
ino = ROOTINO;
else
ino = parent;
goto loop;
}
if (!*path)
return 1;
while (*path == '/')
path++;
if (!inode.i_size || ((inode.i_mode & IFMT) != IFDIR))
return 0;
parent = ino;
for (rest = path; (ch = *rest) && ch != '/'; rest++);
*rest = 0;
loc = 0;
do {
if (loc >= inode.i_size)
return 0;
if (!(off = blkoff(fs, loc))) {
int cnt2;
block = lblkno(fs, loc);
cnt2 = blksize(fs, &inode, block);
bnum = fsbtodb(fs, block_map(block)) + boff;
cnt = cnt2;
iodest = iobuf;
devread();
}
dp = (struct dirent *)(iodest + off);
if (dp->d_reclen < 8) {
printf("directory corrupted (possible geometry mismatch)\n");
return 0;
}
loc += dp->d_reclen;
} while (!dp->d_fileno || strcmp(path, dp->d_name));
ino = dp->d_fileno;
*(path = rest) = ch;
goto loop;
}
block_map(file_block)
int file_block;
{
if (file_block < NDADDR)
return(inode.i_db[file_block]);
if ((bnum = fsbtodb(fs, inode.i_ib[0]) + boff) != mapblock) {
iodest = mapbuf;
cnt = fs->fs_bsize;
devread();
mapblock = bnum;
}
return (((int *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]);
}
openrd()
{
char **devp, *cp = name;
/*******************************************************\
* If bracket given look for preceding device name *
\*******************************************************/
while (*cp && *cp!='(')
cp++;
if (!*cp) {
cp = name;
} else {
if (cp != name) {
*cp = '\0';
for (devp = devs; *devp; devp++)
if (!strcmp(name, *devp))
break;
if (!*devp) {
printf("Unknown device\n");
return 1;
}
maj = devp-devs;
}
/*******************************************************\
* Look inside brackets for unit number, and partition *
\*******************************************************/
cp++;
if (*cp >= '0' && *cp <= '9') {
unit = *cp++ - '0';
#if 0
/* Modern bios'es can boot from disks higher than d */
if (unit > 1) {
printf("Bad unit\n");
return 1;
}
#endif
}
if (!*cp || (*cp == ',' && !*++cp))
return 1;
if (*cp >= 'a' && *cp <= 'p')
part = *cp++ - 'a';
while (*cp && *cp++!=')') ;
if (!*cp)
return 1;
}
if (maj == 1) {
dosdev = unit | 0x80;
unit = 0;
} else if (maj == 0 || maj == 4)
dosdev = unit | 0x80;
else if (maj == 2)
dosdev = unit;
inode.i_dev = dosdev;
/***********************************************\
* Now we know the disk unit and part, *
* Load disk info, (open the device) *
\***********************************************/
if (devopen())
return 1;
/***********************************************\
* Load Filesystem info (mount the device) *
\***********************************************/
iodest = (char *)(fs = (struct fs *)fsbuf);
cnt = SBSIZE;
bnum = SBLOCK + boff;
devread();
/*
* Deal with old file system format. This is borrowed from
* ffs_oldfscompat() in ufs/ffs/ffs_vfsops.c.
*/
if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
fs->fs_qbmask = ~fs->fs_bmask; /* XXX */
fs->fs_qfmask = ~fs->fs_fmask; /* XXX */
} /* XXX */
/***********************************************\
* Find the actual FILE on the mounted device *
\***********************************************/
if (!find(cp))
return 1;
poff = 0;
name = cp;
return 0;
}

View File

@ -1,96 +0,0 @@
/* $NetBSD: table.c,v 1.6 1994/10/27 04:14:42 cgd Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* Segment Descriptor
*
* 31 24 19 16 7 0
* ------------------------------------------------------------
* | | |B| |A| | | |1|0|E|W|A| |
* | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |
* | | |D| |L| 19..16| | |1|1|C|R|A| |
* ------------------------------------------------------------
* | | |
* | BASE 15..0 | LIMIT 15..0 |
* | | |
* ------------------------------------------------------------
*/
struct seg_desc {
unsigned short limit_15_0;
unsigned short base_15_0;
unsigned char base_23_16;
unsigned char p_dpl_type;
unsigned char g_b_a_limit;
unsigned char base_31_24;
};
#define RUN 0 /* not really 0, but filled in at boot time */
struct seg_desc Gdt[] = {
{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0x0 : null */
{0xFFFF, 0x0, 0x0, 0x9F, 0xCF, 0x0}, /* 0x08 : kernel code */
/* 0x9E? */
{0xFFFF, 0x0, 0x0, 0x93, 0xCF, 0x0}, /* 0x10 : kernel data */
/* 0x92? */
{0xFFFF, RUN, RUN, 0x9E, 0xCF, 0x0}, /* 0x18 : boot code */
{0xFFFF, RUN, RUN, 0x92, 0xCF, 0x0}, /* 0x20 : boot data */
{0xFFFF, RUN, RUN, 0x9E, 0x0, 0x0}, /* 0x28 : boot code, 16 bits */
};
struct pseudo_desc {
unsigned short limit;
unsigned short base_low;
unsigned short base_high;
};
struct pseudo_desc Gdtr = { sizeof Gdt - 1, RUN, RUN };

View File

@ -1,60 +0,0 @@
/* $NetBSD: version.c,v 1.29 1996/06/18 07:51:26 mycroft Exp $ */
/*
* NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.
*
* 1.28 -> 1.29
* various code cleanup. (mycroft)
*
* 1.27 -> 1.28
* fix gets to use real timeout instead of loop and do
* a little cleanup, and add some prototypes. A lot more
* needs to be done here. (perry)
*
* 1.26 -> 1.27
* size reduction and code cleanup. (mycroft)
*
* 1.25 -> 1.26
* size reduction and code cleanup. (mycroft)
*
* 1.24 -> 1.25
* add support for serial consoles. (mycroft)
*
* 1.23 -> 1.24
* change RCS ID format. NOW NEED TO UPDATE STRING BELOW
* BY HAND.
*
* 1.22 -> 1.23, 1.21.2.2
* fix problem with empty symbol tables. (mycroft)
*
* 1.21 -> 1.22, 1.21.2.1
* fix compatibility with pre-4.4 file systems. (mycroft)
*
* 1.20 -> 1.21
* update for 4.4-Lite file system includes and macros (cgd)
*
* 1.19 -> 1.20
* display options in std. format, more changes for size (cgd)
*
* 1.18 -> 1.19
* add a '-r' option, to specify RB_DFLTROOT (cgd)
*
* 1.17 -> 1.18
* removed some more code we don't need for BDB. (mycroft)
*
* 1.16 -> 1.17
* removed with prejudice the extra buffer for xread(), changes
* to make the code smaller, and general cleanup. (mycroft)
*
* 1.15 -> 1.16
* reduce BUFSIZE to 4k, because that's fixed the
* boot problems, for some. (cgd)
*
* 1.14 -> 1.15
* seperated 'version' out from boot.c (cgd)
*
* 1.1 -> 1.14
* look in boot.c revision logs
*/
char *version = "1.29";