diff options
84 files changed, 1 insertions, 16133 deletions
diff --git a/sys/Makefile b/sys/Makefile index 57ff690..fd10875 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -1,15 +1,7 @@ # $FreeBSD$ -# This is the old aout only boot loader. -.if exists(${.CURDIR}/${MACHINE_ARCH}/boot) && ${OBJFORMAT} == "aout" -SUBDIR= ${MACHINE_ARCH}/boot -.elif exists(${.CURDIR}/boot) && ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" +# The boot loader SUBDIR= boot -.endif - -.if exists(${.CURDIR}/boot) && ${MACHINE_ARCH} == "alpha" -SUBDIR= boot -.endif # KLD modules build for both a.out and ELF SUBDIR+=modules diff --git a/sys/i386/boot/Makefile b/sys/i386/boot/Makefile deleted file mode 100644 index 3b0adfc..0000000 --- a/sys/i386/boot/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR= cdboot dosboot kzipboot netboot rawboot - -.include <bsd.subdir.mk> diff --git a/sys/i386/boot/Makefile.inc b/sys/i386/boot/Makefile.inc deleted file mode 100644 index 5050c03..0000000 --- a/sys/i386/boot/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ - -BINDIR?= /usr/mdec -CFLAGS+= -aout -.if exists(${.CURDIR}/../../../../include) -CFLAGS+= -nostdinc -I${.CURDIR}/../../../../include -.endif -CFLAGS+= -I${.CURDIR}/../../.. -I${.OBJDIR} -CLEANFILES+= machine - -.if defined(SRCS) -${SRCS:M*.[sS]:R:S/$/.o/g} ${SRCS:M*.c:R:S/$/.o/g}: machine -${SRCS:M*.cc:R:S/$/.o/g} ${SRCS:M*.C:R:S/$/.o/g}: machine -${SRCS:M*.cxx:R:S/$/.o/g} ${SRCS:N*.h:R:S/$/.o/g}: machine -.endif -.if defined(OBJS) -${OBJS}: machine -.endif - -beforedepend: machine -machine: - ln -s ${.CURDIR}/../../include ${.OBJDIR}/machine diff --git a/sys/i386/boot/biosboot/Makefile b/sys/i386/boot/biosboot/Makefile deleted file mode 100644 index 781221b..0000000 --- a/sys/i386/boot/biosboot/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# $FreeBSD$ -# - -PROG= boot -# Order is very important on the SRCS line for this prog -SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S -SRCS+= probe_keyboard.c io.c disk.c sys.c - -BINMODE= 444 -CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ - -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} -CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} -CFLAGS+= ${CWARNFLAGS} - -# By default, if a serial port is going to be used as console, use COM1 -# (aka /dev/ttyd0). -BOOT_COMCONSOLE_PORT?=0x3F8 -CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} - -BOOT_COMCONSOLE_SPEED?=9600 -CFLAGS+= -DCONSPEED=${BOOT_COMCONSOLE_SPEED} - -# Enable code to take the default boot string from a fixed location on the -# disk. See nextboot(8) and README.386BSD for more info. -#CFLAGS+= -DNAMEBLOCK -#CFLAGS+= -DNAMEBLOCK_WRITEBACK - -# Bias the conversion from the BIOS drive number to the FreeBSD unit number -# for hard disks. This may be useful for people booting in a mixed IDE/SCSI -# environment (set BOOT_HD_BIAS to the number of IDE drives). -#CFLAGS+= -DBOOT_HD_BIAS=1 -# -# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number -# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to -# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:da(0,a) instead of -# 1:wd(1,a). If `da' is given explicitly, then the drive is assumed to be -# SCSI and have BIOS drive number (da_unit_number + BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes da(0,a) correspond to 1:da(0,a) instead of 0:da(0,a). - -CLEANFILES+= boot.nohdr boot.strip boot1 boot2 sizetest -LDFLAGS+= -N -T 0 -nostdlib -NOSHARED= YES -NOMAN= -STRIP= - -# tunable timeout parameter, waiting for keypress, calibrated in ms -BOOTWAIT?= 5000 -# tunable timeout during string input, calibrated in ms -#TIMEOUT?= 30000 - -# Location that boot2 is loaded at -BOOTSEG= 0x1000 - -# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned -BOOTSTACK= 0xFFF0 - -boot.strip: boot - cp -p boot boot.strip - strip -aout boot.strip - size -aout boot.strip - -boot.nohdr: boot.strip - dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b - ls -l boot.nohdr - -boot1: boot.nohdr - dd if=boot.nohdr of=boot1 bs=512 count=1 - -boot2: boot.nohdr - dd if=boot.nohdr of=boot2 bs=512 skip=1 - @dd if=boot2 skip=14 of=sizetest 2> /dev/null - @if [ -s sizetest ] ; then \ - echo "boot2 is too big" >&2 ; \ - rm boot2 ; \ - exit 2 ; \ - fi - -all: boot1 boot2 - -install: - ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - boot1 boot2 ${DESTDIR}${BINDIR}/ - -install-boothelp: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ - ${.CURDIR}/boot.help ${DESTDIR}/ - -.include <bsd.kern.mk> -.include <bsd.prog.mk> diff --git a/sys/i386/boot/biosboot/README.386BSD b/sys/i386/boot/biosboot/README.386BSD deleted file mode 100644 index 3d7c09d..0000000 --- a/sys/i386/boot/biosboot/README.386BSD +++ /dev/null @@ -1,172 +0,0 @@ -Note: all my original references to 386BSD also refer to freeBSD and NetBSD -which in some ways are derived from 386BSD. --julian@freebsd.org - -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 determine which is the partition to boot from. If you install the -boot manager when FreeBSD is first installed, it will also give you a nice -menu for switching between operating systems. - -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 daboot. 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. This is the usual case with floppies. - -4/ Boot1 will look at block0 (which might be itself if there are no DOS -partitions) and will find the 386bsd partition, - -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. - -4A/ IF the NAMEBLOCK option is compiled into the bootcode, then the -boot1 code will load and examine block1 (usually unused) and -look for a default boot string to use later (if the correct magic number -is present). If the option NAMEBLOCK_WRITEBACK is also defined, then -it will zero out that name after finding it, and write the block back, -having "used up" that name. The block may contain multiple different -boot strings which will be "used up" one after the other (one per boot) -They are set using the "nextboot" utility. - -4B/ Using the information found in step 4, regarding the start position -of the BSD partition, boot1 will load the first 16 sectors of that partition, -to around 0x10000 (64k) 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. - -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. If the user makes no -actions then a default string will be used. - -If the NAMEBLOCK option is used, then the default string may have been -loaded from block2. If none was found then a compiled in default will be used. - -6/On finding the disklabel, on the disk the user spacified, 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. -This is no longer really a problem as we no-longer support loading the kernel -at location 0. - -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:) -If the NAMEBLOCK option is in use, the default name might be taken from block1 -(2nd block) on that drive (the drive on which boot 1 was loaded). - -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 several drives the same type (all scsi or all 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 da and for higher drive numbers (if the BIOS supports them). - -if you have one or more wd drives and one or more scsi drives, then you -MUST specify the BIOS drive number for booting the scsi drives: - 2:da(0,a)xxx -will boot xxx from scsi drive 0, a partition, provided `2' is the correct -BIOS drive number for da0. - -otherwise the following will happen: - -with wd0 and da0, you specify da1 or wd1 to indicate the 2nd drive. -it boots the kernel correctly, then tells the kernel to use da1 as root. -you however may not have an da1, and problems arise. - -Whether da 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 ,daboot and bootda in /usr/mdec. -BEWARE these will overwrite the existing wdboot and bootwd. (so back -them up) - -there are also targets wd and da which wil only do one of them - -The commented out targets wd0 and da0 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. - -$FreeBSD$ diff --git a/sys/i386/boot/biosboot/README.MACH b/sys/i386/boot/biosboot/README.MACH deleted file mode 100644 index 73d090a..0000000 --- a/sys/i386/boot/biosboot/README.MACH +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:33:55 rpd - * $FreeBSD$ - */ - -********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" -[ 386bsd does not have an 'fdisk' (yet) ] - 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. -[for 386bsd we load the second stage booter to 9000:0] - - - -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 - 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. - -[ 386bsd receives: howto, bootdev] - -[ 386bsd is loaded where-ever the "MByte" bits of the load address specify, -so if you link it for FE100000 it will load to 1MB, but if you link -it for FE000000 it will load ad 0MB] - -[for machines with only 512KB normal ram the kernel will need to be linked -for 1MB and the bootblocks modified to run below 512KB. (8000:0)] - - -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 386bsd] - -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 386bsd bootblocks "make da wd" (warning: they will be installed -in /dev/mdec.. take backups)] diff --git a/sys/i386/boot/biosboot/README.serial b/sys/i386/boot/biosboot/README.serial deleted file mode 100644 index 7edcdee..0000000 --- a/sys/i386/boot/biosboot/README.serial +++ /dev/null @@ -1,196 +0,0 @@ - - SERIAL CONSOLE USAGE NOTES - Written by - Bill Paul <wpaul@ctr.columbia.edu> - Revised for 3.0-CURRENT by - Kazutaka Yokota <yokota@zodiac.mech.utsunomiya-u.ac.jp> - -The FreeBSD boot block can now be used to boot FreeBSD on a system with -only a dumb terminal on a serial port as a console. This feature -is provided for the benefit of people who wish to install FreeBSD on -dedicated file/compute/terminal server machines that have no keyboard -(or monitor) attached, just as is possible with Sun workstations and -servers. People who don't need this extra functionality shouldn't notice -the changes at all (unless I've screwed something up horribly). - -To boot FreeBSD in serial console mode, you must do the following: - -- UNPLUG YOUR KEYBOARD. Most PC systems probe for the keyboard during the - Power-On Self-Test (POST) and will generate an error if the keyboard - isn't detected. Some BIOSes may be set to ignore this error. Many other - machines will pause the boot process and wait for you to reattach the - keyboard and press a key before proceeding any further. Consult the manual - of your motherboard to see how it responds to the error and how to - set the BIOS to ignore the error. If your computer complains about - the lack of a keyboard but boots anyway, then you don't have to do - anything special. (One machine with a PHOENIX BIOS that I have here - merely says 'Keyboard failed' then continues to boot normally.) If your - machine complains loudly about the lack of a keyboard and won't continue - to boot until you plug it back in, you'll have to go into your CMOS - configuration menu and change the 'Keyboard' setting to 'Not installed' - in order to bypass the keyboard probe. - - NOTE #1: - Setting the keyboard to 'Not installed' in the CMOS configuration - does *NOT* mean that you won't be able to use your keyboard. All this - does is tell the BIOS not to probe for a keyboard at power-on so that - it won't bitch and moan if the keyboard isn't plugged in. You can leave the - keyboard plugged in even with this flag set to 'Not installed' and the - keyboard will still work. I repeat: changing the CMOS 'keyboard' setting - to 'Not installed' only disables the BIOS's keyboard probe; it does - *NOT* actually disable the keyboard. - - NOTE #2: - If your system has a PS/2 mouse, chances are very good that you will - need to unplug your mouse as well as your keyboard. This is because - PS/2 mice share some hardware with the keyboard, and leaving the mouse - plugged in can fool the keyboard probe into thinking the keyboard is - still there. I have access to a Gateway 2000 Pentium 90Mhz system with - an AMI BIOS that behaves this way. In general this is not a problem - since the mouse isn't much good without the keyboard anyway. - -- PLUG A DUMB TERMINAL INTO COM1. If you don't have a dumb terminal, you - can use an old PC/XT with a modem program, or the serial port on - another UNIX box. If you don't have a COM1, get one. At this time, - there is no way to select a port other than COM1 for the boot blocks - without recompiling the boot blocks. If you're already using COM1 for - another device, you'll have to temporarily remove that device and - install a new boot block and kernel once you get FreeBSD up and running. - (It is assumed that COM1 will be available on a file/compute/terminal - server anyway; if you really need COM1 for something else (and you can't - switch that something else to COM2), then you probably shouldn't even - be bothering with all this in the first place.) - - NOTE #1: - The serial port settings are hardcoded to 9600 baud, 8 bits, no parity, - 1 stop bit, by default. If you wish to change the speed, you need to - recompile at least the boot blocks. Add the following line to - /etc/make.conf and compile new boot blocks: - - BOOT_COMCONSOLE_SPEED=115200 - - If the serial console is configured in some other way than by booting with - -h, or if the serial console used by the kernel is different from the one - used by the boot blocks, then you must also add the following option to the - kernel configuration file and compile a new kernel: - - options CONSPEED=115200 - - NOTE #2: - In addition to a serial cable, you will need a null modem adapter - in order to connect the terminal to the PC's serial port. If you don't - have one, go to Radio Shack and buy one: they're cheap. - - NOTE #3: - If you wish to drop into the kernel debugger from the serial console - (useful for remote diagnostics, but also dangerous if you generate a - spurious BREAK on the serial port!) then you should compile your kernel - with the following options: - - options BREAK_TO_DEBUGGER - options DDB - - -- MAKE SURE THE CONFIGURATION FILE OF YOUR KERNEL HAS APPROPRIATE FLAGS - SET FOR COM1. - - Relevant `flags' are: - 0x10 enable console support for this unit. The other console flags - are ignored unless this is set. Currently, at most one unit can - have console support; the first one (in config file order) with - this flag set is preferred. This option alone will not make - the serial port the console. Set the following flag or use the -h - option described below, together with this flag. - 0x20 force this unit to be the console (unless there is another - higher priority console). This replaces the COMCONSOLE option. - - Example: - device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 - - If the flags were not set, you need to run UserConfig (on a different - console) or recompile the kernel. - -- CREATE THE FILE "boot.config" IN THE ROOT DIRECTORY of the `a' partition - on the boot drive. Put the kernel name and options in one line. The - kernel name is optional. Options are subset of those described in boot(8): - -h toggle internal and serial consoles. You can use this to switch - console devices. For instance, if you boot from the VGA console, - you can use -h to force the kernel to use the serial port as its - console device. Alternatively, if you boot from the serial port, - you can use the -h to force the kernel to use the VGA display - as the console instead. (Can you say 'toggle' boys and girls? - I knew you could. :) - -D toggle single and dual console configurations. In the single - configuration the console will be either the VGA display (internal - console) or the serial port, depending on the state of the -h option - above. In the dual console configuration, both the VGA display - and the serial port will become the console at the same time, - regardless of the state of the -h option. - However, the dual console configuration takes effect only during - the boot prompt. Once the kernel is loaded, the console specified - by the -h option becomes the only console. - -P probe the keyboard. If no keyboard is found, the -D and -h options - are automatically set. - - Use either the -P option to select the console automatically, or the -h - option to force the serial console. - -- BOOT THE MACHINE. You'll see a prompt appear on the terminal that looks - something like this: - - No keyboard found - - >> FreeBSD BOOT @ 0x10000: 640/7168 k of memory, serial console - Boot default: 0:wd(0,a)kernel - - boot: - - This is identical to the prompt that normally appears on the VGA console, - except for the 'No keyboard found' message that indicates a keyboard - couldn't be detected, if the -P option is in `boot.config'. - - From here you can boot the system (or let it autoboot by itself) just - like you can from the VGA console and the kernel will automatically - use COM1 as the console device. This is done by passing a special flag - to the kernel in the 'boothowto' word. (The curious can refer to - <sys/reboot.h> and the sio driver sources for details.) - - -CAVEATS: - -- The idea here is to allow people to set up dedicated servers that require - no graphics hardware or attached keyboards. Unfortunately, while (most?) - every system will let you boot without a keyboard, there are quite a few - that will not let you boot without a graphics adapter. Machines with - AMI BIOSes can be configured to boot with no graphics adapter installed - simply by changing the 'graphics adapter' setting in the CMOS configuration - to 'Not installed.' However, many machines do not support this option - and will refuse to boot if you have no display hardware in the system. With - these machines, you'll have to leave some kind of graphics card plugged in, - (even if it's just a junky mono board) although you won't have to attach - a monitor into it. You might also try installing an AMI BIOS. :) - -- Using a port other than COM1 as the console requires some recompiling. - Again, it's usually assumed that COM1 will be available for use as a - console device on a dedicated file/compute/terminal server, so hopefully - you'll never need to do this. But if you feel you must change the console - to a different port, here's how: - - o Get the kernel source package. - o Edit /etc/make.conf and set BOOT_COMCONSOLE_PORT to the - address of the port you want to use (0x3F8, 0x2F8, 0x3E8 or - 0x2E8). Only COM1 through COM4 can be used; multiport serial - cards will not work. No interrupt setting is needed. - o Create a custom kernel configuration file and add appropriate - `flags' for the serial port you want to use. For example, if you - want to make COM2 the console: - - device sio1 at isa? port "IO_COM2" tty flags 0x10 irq 3 - - The console flags for the other serial ports should not be set. - o Recompile both the boot blocks and the kernel. - o Install the boot blocks with the disklabel command and boot - from the new kernel. - - -$FreeBSD$ diff --git a/sys/i386/boot/biosboot/asm.S b/sys/i386/boot/biosboot/asm.S deleted file mode 100644 index f14c7f5..0000000 --- a/sys/i386/boot/biosboot/asm.S +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd - * $FreeBSD$ - */ - - -/* - 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. -*/ - - .file "asm.s" - -#include "asm.h" - - -CR0_PE_ON = 0x1 -CR0_PE_OFF = 0xfffffffe - - .text - -/* - * - * 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 EXT(Gdtr) - - /* set the PE bit of CR0 */ - mov %cr0, %eax - - data32 - or $CR0_PE_ON, %eax - mov %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, FS - */ - movw $0x20, %ax /* data segment */ - mov %ax, %ds /* gas would waste a prefix byte for movw */ - mov %ax, %ss - mov %ax, %es - movw $0x10, %ax /* flat segment */ - mov %ax, %fs - -#ifdef BDE_DEBUGGER - /* load idtr so we can debug */ - lidt EXT(Idtr_prot) -#endif - - ret - -/* - * - * prot_to_real() - * transfer from protected mode to real mode - * - */ - -ENTRY(prot_to_real) - - /* Prepare %ax while we're still in a mode that gas understands. */ - movw $0x30, %ax - - /* Change to use16 mode. */ - ljmp $0x28, $x16 -x16: - - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - - /* clear the PE bit of CR0 */ - mov %cr0, %eax - data32 - and $CR0_PE_OFF, %eax - mov %eax, %cr0 - - /* - * make intersegment jmp to flush the processor pipeline - * and reload CS register - */ - data32 - ljmp $BOOTSEG, $xreal -xreal: - - /* - * we are in real mode now - * set up the real mode segment registers : DS, SS, ES, FS - */ - mov %cs, %ax - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - -#ifdef BDE_DEBUGGER - /* load idtr so we can debug */ - addr32 - data32 - lidt EXT(Idtr_real) -#endif - - data32 - ret - -/* - * startprog(phyaddr) - * start the program on protected mode where phyaddr is the entry point - * - * XXX This whole mess should go away and we should run the boot code in - * flat 32 bit mode with it linked -T BOOTSEG. See the netboot code for - * how this is done. - */ - -ENTRY(startprog) - push %ebp - mov %esp, %ebp - movl %esp, %eax /* Use eax as the old stack pointer */ - - /* convert the current stack to a 32 bit flat model */ - movw $0x10, %bx - mov %bx, %ss - addl $(BOOTSEG<<4),%esp - - /* copy the arguments from the old stack to the new stack */ - pushl 0x14(%eax) /* &bootinfo */ - pushl $0 /* was &nfsdiskless */ - pushl $0 /* was esym */ - pushl $0 /* was cyloffset */ - pushl 0x10(%eax) /* bootdev */ - pushl 0x0C(%eax) /* howto */ - movl $(ourreturn),%ebx - addl $(BOOTSEG<<4),%ebx /* Fix it up for flat segments */ - pushl %ebx /* our return address */ - - /* push on our entry address */ - pushl $0x08 /* segment selector */ - pushl 0x08(%eax) /* kernel entry address */ - - /* convert over the other data segs */ - movw $0x10, %bx - mov %bx, %ds - mov %bx, %es - - /* convert the PC (and code seg) */ - lret -ourreturn: - /* For now there is not much we can do, just lock in a loop */ - jmp ourreturn - -/* - * pcpy(src, dst, cnt) - * where src is a virtual address and dst is a physical address - */ - -ENTRY(pcpy) - push %ebp - mov %esp, %ebp - push %es - push %esi - push %edi - push %ecx - - cld - - /* set %es to point at the flat segment */ - movw $0x10, %ax - mov %ax, %es - - mov 0x8(%ebp), %esi /* source */ - mov 0xc(%ebp), %edi /* destination */ - mov 0x10(%ebp), %ecx /* count */ - - rep - movsb - - pop %ecx - pop %edi - pop %esi - pop %es - pop %ebp - - ret diff --git a/sys/i386/boot/biosboot/asm.h b/sys/i386/boot/biosboot/asm.h deleted file mode 100644 index 6f4bcc3..0000000 --- a/sys/i386/boot/biosboot/asm.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 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. - * - * from: Mach, Revision 2.7 92/02/29 15:33:41 rpd - * $FreeBSD$ - */ - -#define S_ARG0 4(%esp) -#define S_ARG1 8(%esp) -#define S_ARG2 12(%esp) -#define S_ARG3 16(%esp) - -#define FRAME pushl %ebp; movl %esp, %ebp -#define EMARF leave - -#define B_ARG0 8(%ebp) -#define B_ARG1 12(%ebp) -#define B_ARG2 16(%ebp) -#define B_ARG3 20(%ebp) - -#ifdef wheeze - -#define ALIGN 4 -#define EXT(x) x -#define LEXT(x) x: -#define LCL(x) ./**/x - -#define LB(x,n) ./**/x -#define LBb(x,n) ./**/x -#define LBf(x,n) ./**/x - -#define SVC lcall $7,$0 - -#define String .string -#define Value .value -#define Times(a,b) [a\*b] -#define Divide(a,b) [a\\b] - -#define INB inb (%dx) -#define OUTB outb (%dx) -#define INL inl (%dx) -#define OUTL outl (%dx) - -#else wheeze -#define ALIGN -#define LCL(x) x - -#define LB(x,n) n -#ifdef __STDC__ -#define EXT(x) _ ## x -#define LEXT(x) _ ## x ## : - -#define LBb(x,n) n ## b -#define LBf(x,n) n ## f -#else __STDC__ -#define EXT(x) _/**/x -#define LEXT(x) _/**/x/**/: -#define LBb(x,n) n/**/b -#define LBf(x,n) n/**/f -#endif __STDC__ -#define SVC .byte 0x9a; .long 0; .word 0x7 - -#define String .ascii -#define Value .word -#define Times(a,b) (a*b) -#define Divide(a,b) (a/b) - -#define INB inb %dx, %al -#define OUTB outb %al, %dx -#define INL inl %dx, %eax -#define OUTL outl %eax, %dx - -#endif wheeze - -#define addr32 .byte 0x67 -#define data32 .byte 0x66 - -#ifdef GPROF -#ifdef __STDC__ - -#define MCOUNT .data; LB(x, 9); .long 0; .text; lea LBb(x, 9),%edx; call mcount -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#define ASENTRY(x) .globl x; .align ALIGN; x ## : ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; - -#else __STDC__ - -#define MCOUNT .data; LB(x, 9): .long 0; .text; lea LBb(x, 9),%edx; call mcount -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) -#define ASENTRY(x) .globl x; .align ALIGN; x: ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; - -#endif __STDC__ -#else GPROF -#ifdef __STDC__ - -#define MCOUNT -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) -#define ASENTRY(x) .globl x; .align ALIGN; x ## : - -#else __STDC__ - -#define MCOUNT -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) -#define ASENTRY(x) .globl x; .align ALIGN; x: - -#endif __STDC__ -#endif GPROF - -#define Entry(x) .globl EXT(x); .align ALIGN; LEXT(x) -#define DATA(x) .globl EXT(x); .align ALIGN; LEXT(x) diff --git a/sys/i386/boot/biosboot/bios.S b/sys/i386/boot/biosboot/bios.S deleted file mode 100644 index 30fc764..0000000 --- a/sys/i386/boot/biosboot/bios.S +++ /dev/null @@ -1,478 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd - * $FreeBSD$ - */ - -/* - 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. -*/ - -/* - * Extensions for El Torito CD-ROM booting: - * - * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO - * Copyright © 1997 interface business GmbH, Dresden. - * All rights reserved. - * - * This code has been written by Jörg Wunsch, Dresden. - * Direct comments to <joerg_wunsch@interface-business.de>. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - - .file "bios.s" - -#include "asm.h" - .text - -#ifndef CDBOOT - -/* - * biosread(dev, cyl, head, sec, nsec, offset) - * Read "nsec" sectors from disk to offset "offset" in boot segment - * 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) - push %ebp - mov %esp, %ebp - - push %ebx - push %esi - push %edi - - movb 0x10(%ebp), %dh - movw 0x0c(%ebp), %cx - /* cylinder; the highest 2 bits of cyl is in %cl */ - xchgb %ch, %cl - rorb $2, %cl - movb 0x14(%ebp), %al - orb %al, %cl - incb %cl /* sector; sec starts from 1, not 0 */ - movb 0x8(%ebp), %dl /* device */ - movl 0x1c(%ebp), %ebx /* offset */ - - /* prot_to_real will set %es to BOOTSEG */ - call EXT(prot_to_real) /* enter real mode */ - movb $0x2, %ah /* subfunction */ - addr32 - movb 0x18(%ebp), %al /* number of sectors */ - - sti - int $0x13 - cli - - /* save return value (actually movw %ax, %bx) */ - mov %eax, %ebx - - data32 - call EXT(real_to_prot) /* back to protected mode */ - - xor %eax, %eax - movb %bh, %al /* return value in %ax */ - - pop %edi - pop %esi - pop %ebx - pop %ebp - - ret - -#else /* CDBOOT */ - - -/* - * int - * getbootspec(struct specpacket *offset) - * - * Read CD-ROM boot specification packet to "offset". - */ -ENTRY(getbootspec) - push %ebp - mov %esp, %ebp - - push %esi - push %ebx - - movw 0x8(%ebp), %si - mov $0x7f, %edx - - /* prot_to_real will set %es to BOOTSEG */ - call EXT(prot_to_real) /* enter real mode */ - movw $0x4b01, %ax /* (do not) terminate disk emulation */ - movb $0x7f, %dl /* any drive */ - - sti - int $0x13 - cli - - /* save return value (actually movw %ax, %bx) */ - mov %eax, %ebx - - data32 - call EXT(real_to_prot) /* back to protected mode */ - - xor %eax, %eax - movb %bh, %al /* return value in %ax */ - - pop %ebx - pop %esi - pop %ebp - - ret - - -/* - * int - * biosreadlba(struct daddrpacket *daddr) - * Read sectors using the BIOS "read extended" function - * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory - * Call with %ah = 0x42 - * %dl = drive (0x0 for floppy disk, or emulated CD) - * %ds:%si = ptr to disk address packet - * Return: - * %ah = 0x0 on success; err code on failure - */ - -ENTRY(biosreadlba) - push %ebp - mov %esp, %ebp - - push %ebx - push %esi - - movw 8(%ebp), %si - movl $0, %edx /* emulated CD is always drive 0 */ - - /* prot_to_real will set %es to BOOTSEG */ - call EXT(prot_to_real) /* enter real mode */ - movw $0x4200, %ax /* subfunction */ - movb $0, %dl - - sti - int $0x13 - cli - - /* save return value (actually movw %ax, %bx) */ - mov %eax, %ebx - - data32 - call EXT(real_to_prot) /* back to protected mode */ - - xor %eax, %eax - movb %bh, %al /* return value in %ax */ - - pop %esi - pop %ebx - pop %ebp - - ret - -#endif /* !CDBOOT */ - -/* - * putc(ch) - * BIOS call "INT 10H Function 0Eh" to write character to console - * Call with %ah = 0x0e - * %al = character - * %bh = page - * %bl = foreground color ( graphics modes) - */ - - -ENTRY(putc) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - movb 0x8(%ebp), %cl - - call EXT(prot_to_real) - - data32 - mov $0x1, %ebx /* %bh=0, %bl=1 (blue) */ - movb $0xe, %ah - movb %cl, %al - sti - int $0x10 /* display a byte */ - cli - - data32 - call EXT(real_to_prot) - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - - -/* - * getc() - * BIOS call "INT 16H Function 00H" to read character from keyboard - * Call with %ah = 0x0 - * Return: %ah = keyboard scan code - * %al = ASCII character - */ - -ENTRY(getc) - push %ebp - mov %esp, %ebp - push %ebx /* save %ebx */ - push %esi - push %edi - - call EXT(prot_to_real) - - movb $0x0, %ah - sti - int $0x16 - cli - - movb %al, %bl /* real_to_prot uses %eax */ - - data32 - call EXT(real_to_prot) - - xor %eax, %eax - movb %bl, %al - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret -/* - * ischar() - * if there is a character pending, return it; otherwise return 0 - * BIOS call "INT 16H Function 01H" to check whether a character is pending - * Call with %ah = 0x1 - * Return: - * If key waiting to be input: - * %ah = keyboard scan code - * %al = ASCII character - * Zero flag = clear - * else - * Zero flag = set - */ -ENTRY(ischar) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - call EXT(prot_to_real) /* enter real mode */ - - xor %ebx, %ebx - movb $0x1, %ah - sti - int $0x16 - cli - data32 - jz nochar - movb %al, %bl - -nochar: - data32 - call EXT(real_to_prot) - - xor %eax, %eax - movb %bl, %al - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/* - * - * get_diskinfo(): return a word that represents the - * max number of sectors and heads and drives for this device - * - */ - -ENTRY(get_diskinfo) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - movb 0x8(%ebp), %dl /* diskinfo(drive #) */ - call EXT(prot_to_real) /* enter real mode */ - - movb $0x8, %ah /* ask for disk info */ - - sti - int $0x13 - cli - - jnc ok - /* - * Urk. Call failed. It is not supported for floppies by old BIOS's. - * Guess it's a 15-sector floppy. - */ - subb %ah, %ah /* %ax = 0 */ - movb %al, %al - movb %ah, %bh /* %bh = 0 */ - movb $2, %bl /* %bl bits 0-3 = drive type, - bit 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 EXT(real_to_prot) /* back to protected mode */ - - /* - * form a longword representing all this gunk: - * 6 bit zero - * 10 bit max cylinder (0 based) - * 8 bit max head (0 based) - * 2 bit zero - * 6 bit max sector (1 based) = # sectors - */ - movb %cl, %al /* Upper two bits of cylinder count */ - andl $192,%eax - leal 0(,%eax,4),%eax /* << 2 */ - movb %ch, %al /* Lower 8 bits */ - sall $16,%eax /* << 16 */ - movb %dh, %ah /* max head */ - andb $0x3f, %cl /* mask of cylinder gunk */ - movb %cl, %al /* max sector (and # sectors) */ - - pop %edi - pop %esi - pop %ebx - pop %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) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - mov 8(%ebp), %ebx - - call EXT(prot_to_real) /* enter real mode */ - - cmpb $0x1, %bl - data32 - je xext - - sti - int $0x12 - cli - data32 - jmp xdone - -xext: movb $0x88, %ah - sti - int $0x15 - cli - -xdone: - pushl $0 /* actually pushw $0 */ - pushl %eax /* actually pushw %ax */ - - data32 - call EXT(real_to_prot) - - pop %eax - pop %edi - pop %esi - pop %ebx - pop %ebp - ret diff --git a/sys/i386/boot/biosboot/boot.c b/sys/i386/boot/biosboot/boot.c deleted file mode 100644 index bbd7497..0000000 --- a/sys/i386/boot/biosboot/boot.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * 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. - * - * from: Mach, [92/04/03 16:51:14 rvb] - * $FreeBSD$ - */ - - -/* - 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 "boot.h" -#include <a.out.h> -#include <sys/reboot.h> -#include <machine/bootinfo.h> - -#define ouraddr (BOOTSEG << 4) /* XXX */ - -#define BOOT_CONFIG_SIZE 512 -#define BOOT_HELP_SIZE 2048 -#define KERNEL_CONFIG_SIZE 512 -#define NAMEBUF_LEN 1024 /* oversized to defend against gets() */ - -static char boot_config[BOOT_CONFIG_SIZE]; -static char boot_help[BOOT_HELP_SIZE]; -#ifdef NAMEBLOCK -char *dflt_name; -#endif -char *name; -static char kernel_config[KERNEL_CONFIG_SIZE]; -static char kernel_config_namebuf[NAMEBUF_LEN + sizeof "config"]; -static char linebuf[NAMEBUF_LEN]; -static char namebuf[NAMEBUF_LEN]; -static struct bootinfo bootinfo; -int loadflags; - -static void getbootdev(char *ptr, int *howto); -static void loadprog(void); -static void readfile(char *path, char *buf, size_t nbytes); - -/* NORETURN */ -void -boot(int drive) -{ - int ret; - - /* Pick up the story from the Bios on geometry of disks */ - - for(ret = 0; ret < N_BIOS_GEOM; ret ++) - bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80); - - bootinfo.bi_basemem = memsize(0); - bootinfo.bi_extmem = memsize(1); - bootinfo.bi_memsizes_valid = 1; - - gateA20(); - - /* - * The default boot device is the first partition in the - * compatibility slice on the boot drive. - */ - dosdev = drive; - maj = 2; - unit = drive & 0x7f; -#ifdef dontneed - slice = 0; - part = 0; -#endif - if (drive & 0x80) { - /* Hard drive. Adjust. */ - maj = 0; -#if BOOT_HD_BIAS > 0 - if (unit >= BOOT_HD_BIAS) { - /* - * The drive is probably a SCSI drive with a unit - * number BOOT_HD_BIAS less than the BIOS drive - * number. - */ - maj = 4; - unit -= BOOT_HD_BIAS; - } -#endif - } -#ifndef RAWBOOT - readfile("boot.config", boot_config, BOOT_CONFIG_SIZE); - readfile("boot.help", boot_help, BOOT_HELP_SIZE); -#endif -#ifdef NAMEBLOCK - /* - * XXX - * DAMN! I don't understand why this is not being set - * by the code in boot2.S - */ - dflt_name= (char *)0x0000ffb0; - if( (*dflt_name++ == 'D') && (*dflt_name++ == 'N')) { - name = dflt_name; - } else -#endif /*NAMEBLOCK*/ - name = "kernel"; - if (boot_config[0] != '\0') { - printf("boot.config: %s", boot_config); - getbootdev(boot_config, &loadflags); - if (openrd() != 0) - name = "kernel"; - } -loadstart: - /* print this all each time.. (saves space to do so) */ - /* If we have looped, use the previous entries as defaults */ - printf("\r \n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory, %s%s console\n" - "Boot default: %d:%s(%d,%c)%s\n" - "%s\n" - "boot: ", - ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem, - (loadflags & RB_SERIAL) ? "serial" : "internal", - (loadflags & RB_DUAL) ? "/dual" : "", - dosdev & 0x7f, devs[maj], unit, 'a' + part, - name ? name : "*specify_a_kernel_name*", - boot_help); - - /* - * Ignore flags from previous attempted boot, if any. - * XXX this is now too strict. Settings given in boot.config should - * not be changed. - */ - loadflags &= (RB_DUAL | RB_SERIAL); - - /* - * Be paranoid and make doubly sure that the input buffer is empty. - */ - if (loadflags & (RB_DUAL | RB_SERIAL)) - init_serial(); - - if (!gets(linebuf)) - putchar('\n'); - else - getbootdev(linebuf, &loadflags); - if (name == NULL) - goto loadstart; - ret = openrd(); - if (ret != 0) { - if (ret > 0) - printf("Can't find %s\n", name); - goto loadstart; - } -/* if (inode.i_mode&IEXEC) - loadflags |= RB_KDB; -*/ - loadprog(); - goto loadstart; -} - -static void -loadprog(void) -{ - struct exec head; - int startaddr; - int addr; /* physical address.. not directly useable */ - int bootdev; - int i; - unsigned pad; - char *s, *t; - - read((void *)&head, sizeof(head)); - if ( N_BADMAG(head)) { - printf("Invalid format!\n"); - return; - } - - poff = N_TXTOFF(head); - /*if(poff==0) - poff = 32;*/ - - /* - * 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; - printf("Booting %d:%s(%d,%c)%s @ 0x%x\n" - , dosdev & 0x7f - , devs[maj] - , unit - , 'a'+part - , name - , addr); - if(addr < 0x00100000) - { - /* - * Bail out, instead of risking to damage the BIOS - * variables, the loader, or the adapter memory area. - * We don't support loading below 1 MB any more. - */ - printf("Start address too low\n"); - return; - } - printf("text=0x%x ", head.a_text); - /********************************************************/ - /* LOAD THE TEXT SEGMENT */ - /********************************************************/ - xread((void *)addr, head.a_text); - addr += head.a_text; - - /********************************************************/ - /* Load the Initialised data after the text */ - /********************************************************/ - while (addr & PAGE_MASK) - *(char *)addr++ = 0; - - printf("data=0x%x ", head.a_data); - xread((void *)addr, head.a_data); - addr += head.a_data; - - /********************************************************/ - /* Skip over the uninitialised data */ - /* (but clear it) */ - /********************************************************/ - printf("bss=0x%x ", head.a_bss); - -/* - * XXX however, we should be checking that we don't load ... into - * nonexistent memory. A full symbol table is unlikely to fit on 4MB - * machines. - */ - /* kzip & kernel will zero their own bss */ - addr += head.a_bss; - - /* Pad to a page boundary. */ - pad = (unsigned)addr & PAGE_MASK; - if (pad != 0) { - pad = PAGE_SIZE - pad; - addr += pad; - } - bootinfo.bi_symtab = addr; - - /********************************************************/ - /* Copy the symbol table size */ - /********************************************************/ - pcpy(&head.a_syms, (void *)addr, sizeof(head.a_syms)); - addr += sizeof(head.a_syms); - - /********************************************************/ - /* Load the symbol table */ - /********************************************************/ - printf("symbols=[+0x%x+0x%x+0x%x", pad, sizeof(head.a_syms), - head.a_syms); - xread((void *)addr, head.a_syms); - addr += head.a_syms; - - /********************************************************/ - /* Load the string table size */ - /********************************************************/ - read((void *)&i, sizeof(int)); - pcpy(&i, (void *)addr, sizeof(int)); - i -= sizeof(int); - addr += sizeof(int); - - /********************************************************/ - /* Load the string table */ - /********************************************************/ - printf("+0x%x+0x%x]\n", sizeof(int), i); - xread((void *)addr, i); - addr += i; - - bootinfo.bi_esymtab = addr; - - /* - * For backwards compatibility, use the previously-unused adaptor - * and controller bitfields to hold the slice number. - */ - bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part); - - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_kernelname = (u_int32_t)(name + ouraddr); - bootinfo.bi_nfs_diskless = 0; - bootinfo.bi_size = sizeof(bootinfo); - bootinfo.bi_bios_dev = dosdev; - - /* - * Load the kernel config file (if any). Its name is given by - * appending ".config" to the kernel name. Build the name inline - * because no str*() functions are available. The file has to be - * copied to &disklabel for userconfig. It can't be loaded there - * directly because the label is used late in readfile() in some - * unusual cases. - */ - s = name; - t = kernel_config_namebuf; - do - ; - while ((*t++ = *s++) != '\0'); - s = ".config"; - --t; - do - ; - while ((*t++ = *s++) != '\0'); - readfile(kernel_config_namebuf, kernel_config, KERNEL_CONFIG_SIZE); - pcpy(kernel_config, (char *)&disklabel + ouraddr, KERNEL_CONFIG_SIZE); - - printf("total=0x%x entry point=0x%x\n", addr, startaddr); - startprog(startaddr, loadflags | RB_BOOTINFO, bootdev, - (unsigned)&bootinfo + ouraddr); -} - -static void -readfile(char *path, char *buf, size_t nbytes) -{ - int openstatus; - - buf[0] = '\0'; - name = path; - openstatus = openrd(); - if (openstatus != 0) { - if (openstatus > 0) - printf("Can't find file %s\n", name); - } else { - /* XXX no way to determine file size. */ - read(buf, nbytes); - } - buf[nbytes - 1] = '\0'; -} - -static void -getbootdev(char *ptr, int *howto) -{ - char c; - int f; - char *p; - - /* Copy the flags to save some bytes. */ - f = *howto; - - c = *ptr; - for (;;) { -nextarg: - while (c == ' ' || c == '\n') - c = *++ptr; - if (c == '-') - while ((c = *++ptr) != '\0') { - if (c == ' ' || c == '\n') - goto nextarg; - if (c == 'a') - f |= RB_ASKNAME; - if (c == 'C') - f |= RB_CDROM; - if (c == 'c') - f |= RB_CONFIG; - if (c == 'D') - f ^= RB_DUAL; - if (c == 'd') - f |= RB_KDB; - if (c == 'g') - f |= RB_GDB; - if (c == 'h') - f ^= RB_SERIAL; - if (c == 'P') - f |= RB_PROBEKBD; - if (c == 'r') - f |= RB_DFLTROOT; - if (c == 's') - f |= RB_SINGLE; - if (c == 'v') - f |= RB_VERBOSE; - } - if (c == '\0') - break; - p = name = namebuf; - while (c != '\0' && c != ' ' && c != '\n') { - *p++ = c; - c = *++ptr; - } - *p = '\0'; - } - if (f & RB_PROBEKBD) { - if (probe_keyboard()) { - f |= RB_DUAL | RB_SERIAL; - printf("No keyboard found\n"); - } else - printf("Keyboard found\n"); - } - if (f & (RB_DUAL | RB_SERIAL)) - init_serial(); - *howto = f; -} diff --git a/sys/i386/boot/biosboot/boot.h b/sys/i386/boot/biosboot/boot.h deleted file mode 100644 index d5c4132..0000000 --- a/sys/i386/boot/biosboot/boot.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/time.h> - -#include <ufs/ffs/fs.h> -#include <ufs/ufs/quota.h> -#include <ufs/ufs/inode.h> - -#define RB_DUAL 0x40000 /* XXX */ -#define RB_PROBEKBD 0x80000 /* XXX */ - -extern char *devs[]; -extern char *name; -extern struct fs *fs; -extern struct inode inode; -extern int dosdev, unit, slice, part, maj, boff, poff; -extern unsigned tw_chars; -extern int loadflags; -extern struct disklabel disklabel; - -/* asm.S */ -#if ASM_ONLY -void real_to_prot(void); -void prot_to_real(void); -#endif -void startprog(unsigned int physaddr, int howto, int bootdev, - /* XXX struct bootinfo * */ unsigned int bootinfo); -void pcpy(const void *src, void *dst, size_t count); - -/* bios.S */ -int biosread(int dev, int cyl, int head, int sec, int nsec, void *offset); -void putc(int c); -int getc(void); -int ischar(void); -int get_diskinfo(int drive); -int memsize(int extended); -void vesa_mode(int mode); - -/* boot.c */ -void boot(int drive); - -/* boot2.S */ -void boot2(void); - -/* disk.c */ -int devopen(void); -void devread(char *iodest, int sector, int cnt); - -/* io.c */ -void gateA20(void); -void printf(const char *format, ...); -void putchar(int c); -void delay1ms(void); -int gets(char *buf); -int strcmp(const char *s1, const char *s2); -#ifdef CDBOOT -int strcasecmp(const char *s1, const char *s2); -#endif /* !CDBOOT */ -void bcopy(const void *from, void *to, size_t len); -void twiddle(void); - -/* probe_keyboard.c */ -int probe_keyboard(void); - -/* serial.S */ -void serial_putc(int ch); -int serial_getc(void); -int serial_ischar(void); -void init_serial(void); - -/* sys.c */ -void xread(char *addr, int size); -void read(char *buffer, int count); -int openrd(void); diff --git a/sys/i386/boot/biosboot/boot.help b/sys/i386/boot/biosboot/boot.help deleted file mode 100644 index 396fd94..0000000 --- a/sys/i386/boot/biosboot/boot.help +++ /dev/null @@ -1,18 +0,0 @@ -Usage: bios_drive:interface(unit,partition)kernel_name options - bios_drive 0, 1, ... - interface fd, wd or da - unit 0, 1, ... - partition a, c, ... - kernel_name name of kernel, or ? for list of files in root directory - options -a (ask name) -C (cdrom) -c (userconfig) -D (dual consoles) - -d (debug early) -g (gdb) -h (serial console) -P (probe kbd) - -r (default root) -s (single user) -v (verbose) -Examples: - 1:da(0,a)mykernel boot `mykernel' on the first SCSI drive when one IDE - drive is present - 1:wd(2,a) boot from the second (secondary master) IDE drive - 1:da(0,a)? list the files in the root directory on the specified - drive/unit/partition, and set the default bios_drive, - interface, unit and partition - -cv boot with the defaults, then run UserConfig to modify - hardware parameters (c), and print verbose messages (v) diff --git a/sys/i386/boot/biosboot/boot2.S b/sys/i386/boot/biosboot/boot2.S deleted file mode 100644 index 1b25853..0000000 --- a/sys/i386/boot/biosboot/boot2.S +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:35:26 rpd - * $FreeBSD$ - */ - -#include "asm.h" - -/* Conventional GDT indexes. */ -#define BOOT_CS_INDEX 3 -#define BOOT_CS16_INDEX 5 -#define BOOT_DS_INDEX 4 - -#ifdef BDE_DEBUGGER -#define DB_CS_INDEX 14 -#define DB_CS16_INDEX 15 -#define DB_DS_INDEX 16 -#define GDT_INDEX 17 -#endif - -/* Vector numbers. */ -#define BREAKPOINT_VECTOR 3 -#define DEBUG_VECTOR 1 - -/* - * boot2() -- second stage boot - * SP points to default string if found - */ - -ENTRY(boot2) - data32 - subl %eax, %eax - mov %cs, %ax - mov %ax, %ds - mov %ax, %es - data32 - shll $4, %eax - - /* fix up GDT entries for bootstrap */ -#define FIXUP(gdt_index) \ - addr32; \ - movl %eax, EXT(Gdt)+(8*gdt_index)+2; /* actually movw %ax */ \ - addr32; \ - movb %bl, EXT(Gdt)+(8*gdt_index)+4 - - data32 - shld $16, %eax, %ebx - FIXUP(BOOT_CS_INDEX) - FIXUP(BOOT_CS16_INDEX) - FIXUP(BOOT_DS_INDEX) - - /* fix up GDT pointer */ - data32 - movl %eax, %ecx - data32 - addl $ EXT(Gdt), %eax - addr32 - data32 - movl %eax, EXT(Gdtr)+2 - -#ifdef BDE_DEBUGGER - /* fix up GDT entry for GDT */ - data32 - shld $16, %eax, %ebx - FIXUP(GDT_INDEX) - - /* fix up IDT pointer */ - data32 - addl $ EXT(Idt), %ecx - addr32 - data32 - movl %ecx, EXT(Idtr_prot)+2 - - /* %es = vector table segment for a while */ - push %es - data32 - subl %eax, %eax - mov %ax, %es - - /* fix up GDT entries for bdb */ - data32 - movl $4*DEBUG_VECTOR, %esi - addr32 - movl %es: 2(%esi), %eax /* actually movw to %ax */ - data32 - shll $4, %eax - data32 - shld $16, %eax, %ebx - FIXUP(DB_CS_INDEX) - FIXUP(DB_CS16_INDEX) - FIXUP(DB_DS_INDEX) - - /* Fetch entry points of bdb's protected mode trap handlers. These - * are stored at 2 before the corresponding entry points for real mode. - */ - data32 - subl %ebx, %ebx - addr32 - movl %es: (%esi), %ebx /* actually movw to %bx */ - data32 - subl %ecx, %ecx - addr32 - movl %es: 4*(BREAKPOINT_VECTOR-DEBUG_VECTOR)(%esi), %ecx - /* actually movw to %cx */ - - /* %es = bdb segment for a while */ - data32 - shrl $4, %eax - mov %ax, %es - - /* fix up IDT entries for bdb */ - data32 - subl $2, %ebx /* calculate EA to check it */ - jb 1f /* give up if it would trap */ - addr32 - movl %es: (%ebx), %eax /* actually movw to %ax */ - addr32 - movl %eax, EXT(Idt)+8*DEBUG_VECTOR /* actually movw %ax */ -1: - data32 - subl $2, %ecx - jb 1f - addr32 - movl %es: (%ecx), %eax /* actually movw to %ax */ - addr32 - movl %eax, EXT(Idt)+8*BREAKPOINT_VECTOR /* actually movw %ax */ -1: - - /* finished with groping in real mode segments */ - pop %es -#endif /* BDE_DEBUGGER */ - - /* change to protected mode */ - data32 - call EXT(real_to_prot) - - /* clear the bss */ - movl $ EXT(edata), %edi /* no EXT(_edata) - krufty ld */ - movl $ EXT(end), %ecx /* or EXT(_end) */ - subl %edi, %ecx - subb %al, %al - rep - stosb - -#ifdef NAMEBLOCK - movl %esp, EXT(dflt_name) -#endif - - movzbl %dl, %edx /* discard head (%dh) and random high bits */ - pushl %edx - call EXT(boot) -oops: - hlt - jmp oops diff --git a/sys/i386/boot/biosboot/disk.c b/sys/i386/boot/biosboot/disk.c deleted file mode 100644 index d280e11..0000000 --- a/sys/i386/boot/biosboot/disk.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd - * $FreeBSD$ - */ - -/* - * 93/10/08 bde - * If there is no 386BSD partition, initialize the label sector with - * LABELSECTOR instead of with garbage. - * - * 93/08/22 bde - * Fixed reading of bad sector table. It is at the end of the 'c' - * partition, which is not always at the end of the disk. - */ - -#include "boot.h" -#include <sys/disklabel.h> -#include <sys/diskslice.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) - -static int bsize; - -static int spt, spc; - -struct fs *fs; -struct inode inode; -int dosdev, unit, slice, part, maj, boff; - -/*#define EMBEDDED_DISKLABEL 1*/ - -/* 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; - -static char *Bread(int dosdev, int sector); - -int -devopen(void) -{ - struct dos_partition *dptr; - struct disklabel *dl; - char *p; - int i, sector = 0, di, dosdev_copy; - - dosdev_copy = dosdev; - di = get_diskinfo(dosdev_copy); - spt = SPT(di); - - /* Hack for 2.88MB floppy drives. */ - if (!(dosdev_copy & 0x80) && spt == 36) - spt = 18; - - spc = spt * HEADS(di); - -#ifndef RAWBOOT - { -#ifdef EMBEDDED_DISKLABEL - dl = &disklabel; -#else EMBEDDED_DISKLABEL - p = Bread(dosdev_copy, 0); - dptr = (struct dos_partition *)(p+DOSPARTOFF); - slice = WHOLE_DISK_SLICE; - for (i = 0; i < NDOSPART; i++, dptr++) - if (dptr->dp_typ == DOSPTYP_386BSD) { - slice = BASE_SLICE + i; - sector = dptr->dp_start; - break; - } - p = Bread(dosdev_copy, sector + LABELSECTOR); - dl=((struct disklabel *)p); - disklabel = *dl; /* structure copy (maybe useful later)*/ -#endif EMBEDDED_DISKLABEL - if (dl->d_magic != DISKMAGIC) { - printf("bad disklabel\n"); - return 1; - } - if( (maj == 4) || (maj == 0) || (maj == 1)) - { - if (dl->d_type == DTYPE_SCSI) - { - maj = 4; /* use scsi as boot dev */ - } - else - { - maj = 0; /* must be ESDI/IDE */ - } - } - /* This little trick is for OnTrack DiskManager disks */ - boff = dl->d_partitions[part].p_offset - - dl->d_partitions[2].p_offset + sector; - - bsize = dl->d_partitions[part].p_size; - if (bsize == 0) { - printf("empty partition\n"); - return 1; - } - - } -#endif /* RAWBOOT */ - return 0; -} - - -/* - * Be aware that cnt is rounded up to N*BPS - */ -void -devread(char *iodest, int sector, int cnt) -{ - int offset; - char *p; - int dosdev_copy; - - for (offset = 0; offset < cnt; offset += BPS) - { - dosdev_copy = dosdev; - p = Bread(dosdev_copy, sector++); - bcopy(p, iodest+offset, BPS); - } -} - - -static char * -Bread(int dosdev, int sector) -{ - if (dosdev != ra_dev || sector < ra_first || sector >= ra_end) - { - int cyl, head, sec, nsec; - - cyl = sector/spc; - if (cyl > 1023) { - printf("Error: C:%d > 1023 (BIOS limit)\n", cyl); - for(;;); /* loop forever */ - } - head = (sector % spc) / spt; - sec = sector % spt; - nsec = spt - sec; - if (nsec > RA_SECTORS) - nsec = RA_SECTORS; - twiddle(); - if (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) - { - nsec = 1; - twiddle(); - while (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) { - printf("Error: D:0x%x C:%d H:%d S:%d\n", - dosdev, cyl, head, sec); - twiddle(); - } - } - ra_dev = dosdev; - ra_first = sector; - ra_end = sector + nsec; - } - return (ra_buf + (sector - ra_first) * BPS); -} diff --git a/sys/i386/boot/biosboot/io.c b/sys/i386/boot/biosboot/io.c deleted file mode 100644 index f705160..0000000 --- a/sys/i386/boot/biosboot/io.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd - * $FreeBSD$ - */ - -#include "boot.h" -#include <machine/cpufunc.h> -#include <sys/reboot.h> - -#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 */ - - -static int getchar(int in_buf); - -/* - * Gate A20 for high memory - */ -void -gateA20(void) -{ -#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); - outb(K_RDWR, KB_A20); - while (inb(K_STATUS) & K_IBUF_FUL); -#endif /* IBM_L40 */ -} - -/* printf - only handles %d as decimal, %c as char, %s as string */ - -void -printf(const char *format, ...) -{ - int *dataptr = (int *)&format; - char c; - - dataptr++; - while ((c = *format++)) - if (c != '%') - putchar(c); - else - switch (c = *format++) { - case 'd': { - int num = *dataptr++; - char buf[10], *ptr = buf; - if (num<0) { - num = -num; - putchar('-'); - } - do - *ptr++ = '0'+num%10; - while (num /= 10); - do - putchar(*--ptr); - while (ptr != buf); - break; - } - case 'x': { - unsigned int num = *dataptr++, dig; - char buf[8], *ptr = buf; - do - *ptr++ = (dig=(num&0xf)) > 9? - 'a' + dig - 10 : - '0' + dig; - while (num >>= 4); - do - putchar(*--ptr); - while (ptr != buf); - break; - } - case 'c': putchar((*dataptr++)&0xff); break; - case 's': { - char *ptr = (char *)*dataptr++; - while ((c = *ptr++)) - putchar(c); - break; - } - } -} - -void -putchar(int c) -{ - if (c == '\n') - putchar('\r'); - if (loadflags & RB_DUAL) { - putc(c); - serial_putc(c); - } else if (loadflags & RB_SERIAL) - serial_putc(c); - else - putc(c); -} - -static int -getchar(int in_buf) -{ - int c; - -loop: - if (loadflags & RB_DUAL) { - if (ischar()) - c = getc(); - else if (serial_ischar()) - c = serial_getc(); - else - goto loop; - } else if (loadflags & RB_SERIAL) - c = serial_getc(); - else - c = getc(); - if (c == '\r') - c = '\n'; - if (c == '\b') { - if (in_buf != 0) { - putchar('\b'); - putchar(' '); - } else { - goto loop; - } - } - putchar(c); - return(c); -} - -/* - * This routine uses an inb to an unused port, the time to execute that - * inb is approximately 1.25uS. This value is pretty constant across - * all CPU's and all buses, with the exception of some PCI implentations - * that do not forward this I/O adress to the ISA bus as they know it - * is not a valid ISA bus address, those machines execute this inb in - * 60 nS :-(. - * - * XXX this should be converted to use bios_tick. - */ -void -delay1ms(void) -{ - int i = 800; - while (--i >= 0) - (void)inb(0x84); -} - -static __inline int -isch(void) -{ - int isc; - - /* - * Checking the keyboard has the side effect of enabling clock - * interrupts so that bios_tick works. Check the keyboard to - * get this side effect even if we only want the serial status. - */ - isc = ischar(); - - if (loadflags & RB_DUAL) { - if (isc != 0) - return (isc); - } else if (!(loadflags & RB_SERIAL)) - return (isc); - return (serial_ischar()); -} - -static __inline unsigned -pword(unsigned physaddr) -{ - unsigned result; - - /* - * Give the fs prefix separately because gas omits it for - * "movl %fs:0x46c, %eax". - */ - __asm __volatile("fs; movl %1, %0" : "=r" (result) - : "m" (*(unsigned *)physaddr)); - return (result); -} - -int -gets(char *buf) -{ -#define bios_tick pword(0x46c) -#define BIOS_TICK_MS 55 - unsigned initial_bios_tick; - char *ptr=buf; - -#if BOOTWAIT - for (initial_bios_tick = bios_tick; - bios_tick - initial_bios_tick < BOOTWAIT / BIOS_TICK_MS;) -#endif - if (isch()) - for (;;) { - switch(*ptr = getchar(ptr - buf) & 0xff) { - case '\n': - case '\r': - *ptr = '\0'; - return 1; - case '\b': - if (ptr > buf) ptr--; - continue; - default: - ptr++; - } -#if TIMEOUT + 0 -#if !BOOTWAIT -#error "TIMEOUT without BOOTWAIT" -#endif - for (initial_bios_tick = bios_tick;;) { - if (isch()) - break; - if (bios_tick - initial_bios_tick >= - TIMEOUT / BIOS_TICK_MS) - return 0; - } -#endif - } - return 0; -} - -int -strcmp(const char *s1, const char *s2) -{ - while (*s1 == *s2) { - if (!*s1++) - return 0; - s2++; - } - return 1; -} - -#ifdef CDBOOT -int -strcasecmp(const char *s1, const char *s2) -{ - /* - * We only consider ASCII chars and don't anticipate - * control characters (they are invalid in filenames - * anyway). - */ - while ((*s1 & 0x5f) == (*s2 & 0x5f)) { - if (!*s1++) - return 0; - s2++; - } - return 1; -} -#endif /* !CDBOOT */ - -void -bcopy(const void *from, void *to, size_t len) -{ - char *fp = (char *)from; - char *tp = (char *)to; - - while (len-- > 0) - *tp++ = *fp++; -} - -/* To quote Ken: "You are not expected to understand this." :) */ - -void -twiddle(void) -{ - putchar((char)tw_chars); - tw_chars = (tw_chars >> 8) | ((tw_chars & (unsigned long)0xFF) << 24); - putchar('\b'); -} diff --git a/sys/i386/boot/biosboot/probe_keyboard.c b/sys/i386/boot/biosboot/probe_keyboard.c deleted file mode 100644 index 41d7e97..0000000 --- a/sys/i386/boot/biosboot/probe_keyboard.c +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * Copyright (c) 1997 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> - -#include <machine/cpufunc.h> - -#include <i386/isa/isa.h> - -#include <dev/kbd/atkbdcreg.h> - -#include "boot.h" - -#define PROBE_MAXRETRY 5 -#define PROBE_MAXWAIT 400 - -#define IO_DUMMY 0x84 - -/* 7 microsec delay necessary for some keyboard controllers */ -static void -delay7(void) -{ - /* - * I know this is broken, but no timer is avaiable yet at this stage... - * See also comments in `delay1ms()' in `io.c'. - */ - inb(IO_DUMMY); inb(IO_DUMMY); - inb(IO_DUMMY); inb(IO_DUMMY); - inb(IO_DUMMY); inb(IO_DUMMY); -} - -/* - * Perform a simple test on the keyboard; issue the ECHO command and see - * if the right answer is returned. We don't do anything as drastic as - * full keyboard reset; it will be too troublesome and take too much time. - */ -int -probe_keyboard(void) -{ - int retry = PROBE_MAXRETRY; - int wait; - int i; - - while (--retry >= 0) { - /* flush any noise */ - while (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) { - delay7(); - inb(IO_KBD + KBD_DATA_PORT); - delay1ms(); - } - - /* wait until the controller can accept a command */ - for (wait = PROBE_MAXWAIT; wait > 0; --wait) { - if (((i = inb(IO_KBD + KBD_STATUS_PORT)) - & (KBDS_INPUT_BUFFER_FULL | KBDS_ANY_BUFFER_FULL)) == 0) - break; - if (i & KBDS_ANY_BUFFER_FULL) { - delay7(); - inb(IO_KBD + KBD_DATA_PORT); - } - delay1ms(); - } - if (wait <= 0) - continue; - - /* send the ECHO command */ - outb(IO_KBD + KBD_DATA_PORT, KBDC_ECHO); - - /* wait for a response */ - for (wait = PROBE_MAXWAIT; wait > 0; --wait) { - if (inb(IO_KBD + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) - break; - delay1ms(); - } - if (wait <= 0) - continue; - - delay7(); - i = inb(IO_KBD + KBD_DATA_PORT); -#ifdef PROBE_KBD_BEBUG - printf("probe_keyboard: got 0x%x.\n", i); -#endif - if (i == KBD_ECHO) { - /* got the right answer */ - return (0); - } - } - - return (1); -} diff --git a/sys/i386/boot/biosboot/serial.S b/sys/i386/boot/biosboot/serial.S deleted file mode 100644 index 8473d00..0000000 --- a/sys/i386/boot/biosboot/serial.S +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd - * $FreeBSD$ - */ - -/* - 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. -*/ - -/* - * Serial bootblock interface routines - * Copyright (c) 1994, J"org Wunsch - * - * 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. - * - * THE AUTHOR ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. THE AUTHOR DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - */ - - .file "serial.S" - -#include <isa/sioreg.h> -#include "asm.h" - - .text - -/* - * The serial port interface routines implement a simple polled i/o - * interface to a standard serial port. Due to the space restrictions - * for the boot blocks, no BIOS support is used (since BIOS requires - * expensive real/protected mode switches), instead the rudimentary - * BIOS support is duplicated here. - * - * The base address and speed for the i/o port are passed from the - * Makefile in the COMCONSOLE and CONSPEED preprocessor macros. The - * line control parameters are currently hard-coded to 8 bits, no - * parity, 1 stop bit (8N1). This can be changed in init_serial(). - */ - -/* - * void serial_putc(int ch); - * Write character `ch' to port COMCONSOLE. - */ -ENTRY(serial_putc) - movl $10000, %ecx # timeout - movl $COMCONSOLE + 5, %edx # line status reg -1: - decl %ecx - je 2f - inb %dx, %al - testb $0x20, %al - je 1b # TX buffer not empty - - movb 4(%esp), %al - - subl $5, %edx # TX output reg - outb %al, %dx # send this one - -2: - ret - -/* - * int serial_getc(void); - * Read a character from port COMCONSOLE. - */ -ENTRY(serial_getc) - mov $COMCONSOLE + 5, %edx # line status reg -1: - inb %dx, %al - testb $0x01, %al - je 1b # no rx char available - - xorl %eax, %eax - subl $5, %edx # rx buffer reg - inb %dx, %al # fetch (first) character - - andb $0x7F, %al # remove any parity bits we get - cmpb $0x7F, %al # make DEL... - jne 2f - movb $0x08, %al # look like BS -2: - ret - -/* - * int serial_ischar(void); - * If there is a character in the input buffer of port COMCONSOLE, - * return nonzero; otherwise return 0. - */ -ENTRY(serial_ischar) - xorl %eax, %eax - movl $COMCONSOLE + 5, %edx # line status reg - inb %dx, %al - andb $0x01, %al # rx char available? - ret - -/* - * void init_serial(void); - * Initialize port COMCONSOLE to speed CONSPEED, line settings 8N1. - */ -ENTRY(init_serial) - movl $COMCONSOLE + 3, %edx # line control reg - movb $0x80, %al - outb %al, %dx # enable DLAB - - subl $3, %edx # divisor latch, low byte - movb $COMBRD(CONSPEED) & 0xff, %al - outb %al, %dx - incl %edx # divisor latch, high byte - movb $COMBRD(CONSPEED) >> 8, %al - outb %al, %dx - - incl %edx # fifo control register (if any) - xorl %eax,%eax - outb %al, %dx # disable fifo to reduce worst-case busy-wait - - incl %edx # line control reg - movb $0x03, %al - outb %al, %dx # 8N1 - - incl %edx # modem control reg - outb %al, %dx # enable DTR/RTS - - /* Flush the input buffer. */ - incl %edx # line status reg -1: - subl $5, %edx # rx buffer reg - inb %dx, %al # throw away (unconditionally the first time) - addl $5, %edx # line status reg - inb %dx, %al - testb $0x01, %al - jne 1b # more - - ret diff --git a/sys/i386/boot/biosboot/start.S b/sys/i386/boot/biosboot/start.S deleted file mode 100644 index 90fac55..0000000 --- a/sys/i386/boot/biosboot/start.S +++ /dev/null @@ -1,458 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:36:29 rpd - * $FreeBSD$ - */ - -/* - 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 "asm.h" - - .file "start.S" - -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 */ -NAMEBLOCKMAGIC= 0xfadefeed /* value of magicnumebr for block2 */ - -/* - * This DEBUGMSG(msg) macro may be useful for debugging. Its use is - * restricted to this file since it only works in real mode. - */ -#define DEBUGMSG(msg) \ - data32 ; \ - mov $msg, %esi ; \ - data32 ; \ - call message - - .text - -ENTRY(boot1) - - /* - * XXX I have encountered at least one machine (a no-name laptop - * with an AMI WinBIOS) that will refuse to run the bootblock - * unless this short jump and nop are here. I'm not certain, but - * this may be a case of the BIOS performing some kind of simple - * virus detection. - */ - jmp pacify_braindead_bios - nop -pacify_braindead_bios: - - /* - * start (aka boot1) is loaded at 0x0:0x7c00 but we want 0x7c0:0 - * ljmp to the next instruction to adjust %cs - */ - data32 - ljmp $0x7c0, $start - -start: - /* set up %ds */ - mov %cs, %ax - mov %ax, %ds - - /* set up %ss and %esp */ - data32 - mov $BOOTSEG, %eax - mov %ax, %ss - /* - * make a little room on the stack for - * us to save the default bootstring we might find.. - * effectively, we push the bootstring. - */ - data32 - mov $BOOTSTACK-64, %esp - - /* set up %es, (where we will load boot2 to) */ - mov %ax, %es - - - /* bootstrap passes us drive number in %dl */ - cmpb $0x80, %dl - data32 - jae hd - -fd: - /* - * XXX some bootstraps don't pass the drive number in %dl. - * This is a problem mainly when we are block 0 on a floppy. - * Force drive 0 for floppies. - * XXX %dl was assumed valid in the test that led here. - */ - mov $0x0, %dl - - /* reset the disk system */ - movb $0x0, %ah - int $0x13 - data32 - mov $0x0001, %ecx /* cyl 0, sector 1 */ - movb $0, %dh /* head */ - data32 - jmp load - -hd: /**** load sector 0 into the BOOTSEG ****/ - data32 - mov $0x0201, %eax - xor %ebx, %ebx /* %bx = 0 */ - data32 - mov $0x0001, %ecx - data32 - andl $0xff, %edx - /*mov $0x0080, %edx*/ - int $0x13 - data32 - jb read_error - - /* find the first 386BSD partition */ - data32 - mov $PARTSTART, %ebx - data32 - mov $NUMPART, %ecx -again: - addr32 - movb %es:4(%ebx), %al - cmpb $BSDPART, %al - data32 - je found - data32 - add $PARTSZ, %ebx - data32 - loop again - data32 - mov $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: -#ifdef NAMEBLOCK -/* - * Load the second sector and see if it is a boot instruction block. - * If it is then scan the contents for the first valid string and copy it to - * the location of the default boot string.. then zero it out. - * Finally write the block back to disk with the zero'd out entry.. - * I hate writing at this stage but we need this to be persistant. - * If the boot fails, then the next boot will get the next string. - * /etc/rc will regenerate a complete block2 iff the boot succeeds. - * - * Format of block 2 is: - * [NAMEBLOCKMAGIC] <--0xdeafc0de - * [nulls] - * [bootstring]NULL <---e.g. 0:wd(0,a)/kernel.experimental - * [bootstring]NULL <---e.g. 0:wd(0,a)/kernel.old - * .... - * [bootstring]NULL <---e.g. 0:wd(0,f)/kernel - * FF FF FF - */ -where: - /* - * save things we might smash - * (that are not smashed immedatly after us anyway.) - */ - data32 - push %ecx /* preserve 'cyl,sector ' */ - data32 - push %edx -/* - * Load the second sector - * 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 - */ - data32 - movl $0x0201, %eax /function 2 (read) 1 sector */ - xor %ebx, %ebx /* %bx = 0 */ /* buffer address (ES:0) */ - data32 - movl $0x0002, %ecx /* sector 2, cylinder 0 */ - data32 - andl $0x00ff, %edx /* head 0, drive N */ - int $0x13 - data32 - jb read_error - /* - * confirm that it is one for us - */ - data32 - xorl %ebx, %ebx /* magic number at start of buffer */ - data32 - addr32 - movl %es:(%ebx), %eax - data32 - cmpl $NAMEBLOCKMAGIC, %eax - data32 - jne notours /* not ours so return to caller */ - /* - * scan for a bootstring - * Skip the magic number, and scan till we find a non-null, - * or a -1 - */ - incl %ebx /* quicker and smaller */ - incl %ebx - incl %ebx -scan: - incl %ebx - addr32 - movb %es:(%ebx), %al /* load the next byte */ - testb %al, %al /* and if it is null */ - data32 /* keep scanning (past deleted entries) */ - jz scan - incb %al /* now look for -1 */ - data32 - jz notours /* if we reach the 0xFF then we have finished */ - - /* - * save our settings.. we need them twice.. - */ - data32 - push %ebx - /* - * copy it to the default string location - * which is just above the stack for 64 bytes. - */ - data32 - movl $BOOTSTACK-64, %ecx /* 64 bytes at the top of the stack */ -nxtbyte: - addr32 - movb %es:(%ebx), %al /* get the next byte in */ - addr32 - movb %al, %es:(%ecx) /* and transfer it to the name buffer */ - incl %ebx /* get on with the next byte */ - incl %ecx /* get on with the next byte */ - testb %al, %al /* if it was 0 then quit this */ - data32 - jnz nxtbyte /* and looop if more to do */ - - /* - * restore the saved settings and - * zero it out so next time we don't try it again - */ - data32 - pop %ebx /* get back our starting location */ -#ifdef NAMEBLOCK_WRITEBACK -nxtbyte2: - addr32 - movb %es:(%ebx), %al /* get the byte */ - addr32 - movb $0, %es:(%ebx) /* zero it out */ - data32 - incl %ebx /* point to the next byte */ - testb %al, %al /* check if we have finished.. */ - data32 - jne nxtbyte2 -/* - * Write the second sector back - * Load the second sector - * BIOS call "INT 0x13 Function 0x3" to write sectors from memory to disk - * Call with %ah = 0x3 - * %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 - */ - data32 - movl $0x0301, %eax /* write 1 sector */ - xor %ebx, %ebx /* buffer is at offset 0 */ - data32 - movl $0x0002, %ecx /* block 2 */ - data32 - andl $0xff, %edx /* head 0 */ - int $0x13 - data32 - jnb notours - data32 - mov $eread, %esi - jmp err_stop -#endif /* NAMEBLOCK_WRITEBACK */ - /* - * return to the main-line - */ -notours: - data32 - pop %edx - data32 - pop %ecx -#endif - movb $0x2, %ah /* function 2 */ - movb $LOADSZ, %al /* number of blocks */ - xor %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". - */ - - data32 - ljmp $BOOTSEG, $ EXT(boot2) - -/* - * read_error - */ -read_error: - data32 - mov $eread, %esi -err_stop: - data32 - call message - data32 - jmp stop - -/* - * message: write the error message in %ds:%esi to console - */ -message: - /* - * Use BIOS "int 10H Function 0Eh" to write character in teletype mode - * %ah = 0xe %al = character - * %bh = page %bl = foreground color (graphics modes) - */ - - data32 - push %eax - data32 - push %ebx - data32 - mov $0x0001, %ebx - cld - -nextb: - lodsb /* load a byte into %al */ - cmpb $0x0, %al - data32 - je done - movb $0xe, %ah - int $0x10 /* display a byte */ - data32 - jmp nextb -done: - data32 - pop %ebx - data32 - pop %eax - data32 - ret - -stop: hlt - data32 - jmp stop /* halt doesnt actually halt forever */ - -/* error messages */ - - -#ifdef DEBUG -one: String "1-\0" -two: String "2-\0" -three: String "3-\0" -four: String "4-\0" -#endif DEBUG -#ifdef NAMEBLOCK_WRITEBACK -ewrite: String "Write error\r\n\0" -#endif /* NAMEBLOCK_WRITEBACK */ -eread: String "Read error\r\n\0" -enoboot: String "No bootable partition\r\n\0" -endofcode: -/* - * Dummy partition table in case we are block 0. The ending c/h/s values - * of the non-null partition are almost arbitary. The length of this - * partition is bogus for backwards compatibility and as a signature. - * A real partition table shouldn't be as weird and broken as this one, - * and the isa slice initialization routine interprets this table as - * saying that the whole disk is used for FreeBSD. - */ -/* flag, head, sec, cyl, typ, ehead, esect, ecyl, start, len */ - . = EXT(boot1) + PARTSTART -strttbl: - .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 */ - . = EXT(boot1) + 0x1fe - .value SIGNATURE -ENTRY(disklabel) - . = EXT(boot1) + 0x400 diff --git a/sys/i386/boot/biosboot/sys.c b/sys/i386/boot/biosboot/sys.c deleted file mode 100644 index 289a732..0000000 --- a/sys/i386/boot/biosboot/sys.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $FreeBSD$ - */ - -#include "boot.h" -#include <sys/dirent.h> -#include <sys/reboot.h> - -#if 0 -/* #define BUFSIZE 4096 */ -#define BUFSIZE MAXBSIZE - -static char buf[BUFSIZE], fsbuf[SBSIZE], iobuf[MAXBSIZE]; -#endif - -static char biosdrivedigit; - -#define BUFSIZE 8192 -#define MAPBUFSIZE BUFSIZE -static char buf[BUFSIZE], fsbuf[BUFSIZE], iobuf[BUFSIZE]; - -static char mapbuf[MAPBUFSIZE]; -static int mapblock; - -int poff; - -#ifdef RAWBOOT -#define STARTBYTE 8192 /* Where on the media the kernel starts */ -#endif - -static int block_map(int file_block); -static int find(char *path); - -void -xread(char *addr, int size) -{ - int count = BUFSIZE; - while (size > 0) { - if (BUFSIZE > size) - count = size; - read(buf, count); - pcpy(buf, addr, count); - size -= count; - addr += count; - } -} - -#ifndef RAWBOOT -void -read(char *buffer, int count) -{ - int logno, off, size; - int cnt2, bnum2; - struct fs *fs_copy; - - while (count > 0 && poff < inode.i_size) { - fs_copy = fs; - off = blkoff(fs_copy, poff); - logno = lblkno(fs_copy, poff); - cnt2 = size = blksize(fs_copy, &inode, logno); - bnum2 = fsbtodb(fs_copy, block_map(logno)) + boff; - if ( (!off) && (size <= count)) { - devread(buffer, bnum2, cnt2); - } else { - size -= off; - if (size > count) - size = count; - devread(iobuf, bnum2, cnt2); - bcopy(iobuf+off, buffer, size); - } - buffer += size; - count -= size; - poff += size; - } -} -#else -void -read(char *buffer, int count) -{ - int cnt, bnum, off, size; - - off = STARTBYTE + poff; - poff += count; - - /* Read any unaligned bit at the front */ - cnt = off & 511; - if (cnt) { - size = 512-cnt; - if (count < size) - size = count; - devread(iobuf, off >> 9, 512); - bcopy(iobuf+cnt, buffer, size); - count -= size; - off += size; - buffer += size; - } - size = count & (~511); - if (size && (off & (~511))) { - devread(buffer, off >> 9, size); - off += size; - count -= size; - buffer += size; - } - if (count) { - devread(iobuf, off >> 9, 512); - bcopy(iobuf, buffer, count); - } -} -#endif - -static int -find(char *path) -{ - char *rest, ch; - int block, off, loc, ino = ROOTINO; - struct dirent *dp; - char list_only; - - list_only = (path[0] == '?' && path[1] == '\0'); -loop: - devread(iobuf, fsbtodb(fs, ino_to_fsba(fs, ino)) + boff, fs->fs_bsize); - bcopy((void *)&((struct dinode *)iobuf)[ino % fs->fs_inopb], - (void *)&inode.i_din, - sizeof (struct dinode)); - if (!*path) - return 1; - while (*path == '/') - path++; - if (!inode.i_size || ((inode.i_mode&IFMT) != IFDIR)) - return 0; - for (rest = path; (ch = *rest) && ch != '/'; rest++) ; - *rest = 0; - loc = 0; - do { - if (loc >= inode.i_size) { - if (list_only) { - putchar('\n'); - return -1; - } else { - return 0; - } - } - if (!(off = blkoff(fs, loc))) { - block = lblkno(fs, loc); - devread(iobuf, fsbtodb(fs, block_map(block)) + boff, - blksize(fs, &inode, block)); - } - dp = (struct dirent *)(iobuf + off); - loc += dp->d_reclen; - if (dp->d_fileno && list_only) - printf("%s ", dp->d_name); - } while (!dp->d_fileno || strcmp(path, dp->d_name)); - ino = dp->d_fileno; - *(path = rest) = ch; - goto loop; -} - - -static int -block_map(int file_block) -{ - int bnum; - if (file_block < NDADDR) - return(inode.i_db[file_block]); - if ((bnum=fsbtodb(fs, inode.i_ib[0])+boff) != mapblock) { - devread(mapbuf, bnum, fs->fs_bsize); - mapblock = bnum; - } - return (((int *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]); -} - - -int -openrd(void) -{ - char **devp, *name0 = name, *cp = name0; - int biosdrive, dosdev_copy, ret; - - /*******************************************************\ - * If bracket given look for preceding device name * - \*******************************************************/ - while (*cp && *cp!='(') - cp++; - if (!*cp) - { - cp = name0; - } - else - { - /* - * Look for a BIOS drive number (a leading digit followed - * by a colon). - */ - biosdrivedigit = '\0'; - if (*(name0 + 1) == ':' && *name0 >= '0' && *name0 <= '9') { - biosdrivedigit = *name0; - name0 += 2; - } - - if (cp++ != name0) - { - for (devp = devs; *devp; devp++) - if (name0[0] == (*devp)[0] && - name0[1] == (*devp)[1]) - break; - if (!*devp) - { - printf("Unknown device\n"); - return 1; - } - maj = devp-devs; - } - /*******************************************************\ - * Look inside brackets for unit number, and partition * - \*******************************************************/ - /* - * Allow any valid digit as the unit number, as the BIOS - * will complain if the unit number is out of range. - * Restricting the range here prevents the possibilty of using - * BIOSes that support more than 2 units. - * XXX Bad values may cause strange errors, need to check if - * what happens when a value out of range is supplied. - */ - if (*cp >= '0' && *cp <= '9') - unit = *cp++ - '0'; - if (!*cp || (*cp == ',' && !*++cp)) - return 1; - if (*cp >= 'a' && *cp <= 'p') - part = *cp++ - 'a'; - while (*cp && *cp++!=')') ; - if (!*cp) - return 1; - } - biosdrive = biosdrivedigit - '0'; - if (biosdrivedigit == '\0') { - biosdrive = unit; -#if BOOT_HD_BIAS > 0 - /* XXX */ - if (maj == 4) - biosdrive += BOOT_HD_BIAS; -#endif - } - switch(maj) - { - case 0: - case 4: - dosdev_copy = biosdrive | 0x80; - break; - case 2: - dosdev_copy = biosdrive; - break; - default: - printf("Unknown device\n"); - return 1; - } - dosdev = dosdev_copy; -#if 0 - /* XXX this is useful, but misplaced. */ - printf("dosdev= %x, biosdrive = %d, unit = %d, maj = %d\n", - dosdev_copy, biosdrive, unit, maj); -#endif - - /***********************************************\ - * Now we know the disk unit and part, * - * Load disk info, (open the device) * - \***********************************************/ - if (devopen()) - return 1; - -#ifndef RAWBOOT - /***********************************************\ - * Load Filesystem info (mount the device) * - \***********************************************/ - devread((char *)(fs = (struct fs *)fsbuf), SBLOCK + boff, SBSIZE); - /***********************************************\ - * Find the actual FILE on the mounted device * - \***********************************************/ - ret = find(cp); - name = cp; - if (ret == 0) - return 1; - if (ret < 0) { - name = NULL; - return -1; - } - poff = 0; -#endif /* RAWBOOT */ - return 0; -} diff --git a/sys/i386/boot/biosboot/table.c b/sys/i386/boot/biosboot/table.c deleted file mode 100644 index ac59b24..0000000 --- a/sys/i386/boot/biosboot/table.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd - * $FreeBSD$ - */ - -/* - 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 "boot.h" - -/* 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, 0x40, 0x0}, /* 0x18 : boot code */ - {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* 0x20 : boot data */ - {0xFFFF, RUN, RUN, 0x9E, 0x0, 0x0}, /* 0x28 : boot code, 16 bits */ - {0xFFFF, 0x0, 0x0, 0x92, 0x0, 0x0}, /* 0x30 : boot data, 16 bits */ -#ifdef BDE_DEBUGGER - /* More for bdb. */ - {}, /* BIOS_TMP_INDEX = 7 : null */ - {}, /* TSS_INDEX = 8 : null */ - {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* DS_286_INDEX = 9 */ - {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* ES_286_INDEX = 10 */ - {}, /* Unused = 11 : null */ - {0x7FFF, 0x8000, 0xB, 0xB2, 0x40, 0x0}, /* COLOR_INDEX = 12 */ - {0x7FFF, 0x0, 0xB, 0xB2, 0x40, 0x0}, /* MONO_INDEX = 13 */ - {0xFFFF, RUN, RUN, 0x9A, 0x40, 0x0}, /* DB_CS_INDEX = 14 */ - {0xFFFF, RUN, RUN, 0x9A, 0x0, 0x0}, /* DB_CS16_INDEX = 15 */ - {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* DB_DS_INDEX = 16 */ - {8*18-1, RUN, RUN, 0x92, 0x40, 0x0}, /* GDT_INDEX = 17 */ -#endif /* BDE_DEBUGGER */ -}; - -#ifdef BDE_DEBUGGER -struct idt_desc { - unsigned short entry_15_0; - unsigned short selector; - unsigned char padding; - unsigned char p_dpl_type; - unsigned short entry_31_16; -}; - -struct idt_desc Idt[] = { - {}, /* Null (int 0) */ - {RUN, 0x70, 0, 0x8E, 0}, /* DEBUG_VECTOR = 1 */ - {}, /* Null (int 2) */ - {RUN, 0x70, 0, 0xEE, 0}, /* BREAKPOINT_VECTOR = 3 */ -}; -#endif /* BDE_DEBUGGER */ - -struct pseudo_desc { - unsigned short limit; - unsigned short base_low; - unsigned short base_high; - }; - -struct pseudo_desc Gdtr = { sizeof Gdt - 1, RUN, RUN }; -#ifdef BDE_DEBUGGER -struct pseudo_desc Idtr_prot = { sizeof Idt - 1, RUN, RUN }; -struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 }; -#endif - -/* - * All initialized data is defined in one file to reduce space wastage from - * fragmentation. - */ -char *devs[] = { "wd", "dk", "fd", "wt", "da", 0 }; -unsigned tw_chars = 0x5C2D2F7C; /* "\-/|" */ diff --git a/sys/i386/boot/cdboot/Makefile b/sys/i386/boot/cdboot/Makefile deleted file mode 100644 index 383f054..0000000 --- a/sys/i386/boot/cdboot/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# $FreeBSD$ -# - -PROG= boot -# Order is very important on the SRCS line for this prog -SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S -SRCS+= probe_keyboard.c io.c cdrom.c malloc.c - -.PATH: ${.CURDIR}/../biosboot - -BINMODE= 444 -CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ - -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} -CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} -CFLAGS+= -I${.CURDIR}/../biosboot -CFLAGS+= -DCDBOOT -CFLAGS+= ${CWARNFLAGS} -#CFLAGS+= -DDEBUG - -# By default, if a serial port is going to be used as console, use COM1 -# (aka /dev/ttyd0). -BOOT_COMCONSOLE_PORT?=0x3F8 -CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} - -BOOT_COMCONSOLE_SPEED?=9600 -CFLAGS+= -DCONSPEED=${BOOT_COMCONSOLE_SPEED} - -# Enable code to take the default boot string from a fixed location on the -# disk. See nextboot(8) and README.386BSD for more info. -#CFLAGS+= -DNAMEBLOCK -#CFLAGS+= -DNAMEBLOCK_WRITEBACK - -# Bias the conversion from the BIOS drive number to the FreeBSD unit number -# for hard disks. This may be useful for people booting in a mixed IDE/SCSI -# environment (set BOOT_HD_BIAS to the number of IDE drives). -#CFLAGS+= -DBOOT_HD_BIAS=1 -# -# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number -# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to -# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:sd(0,a) instead of -# 1:wd(1,a). If `sd' is given explicitly, then the drive is assumed to be -# SCSI and have BIOS drive number (sd_unit_number + BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes sd(0,a) correspond to 1:sd(0,a) instead of 0:sd(0,a). - -CLEANFILES+= boot.img boot.nohdr boot.strip -LDFLAGS+= -N -T 0 -nostdlib -NOSHARED= YES -NOMAN= -STRIP= - -# tunable timeout parameter, waiting for keypress, calibrated in ms -BOOTWAIT?= 5000 -# tunable timeout during string input, calibrated in ms -#TIMEOUT?= 30000 - -# Location that boot2 is loaded at -BOOTSEG= 0x1000 - -# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned -BOOTSTACK= 0xFFF0 - -boot.strip: boot - cp -p boot boot.strip - strip -aout boot.strip - size -aout boot.strip - -boot.nohdr: boot.strip - dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b - ls -l boot.nohdr - -boot.img: boot.nohdr - dd if=boot.nohdr of=boot.img bs=1440k count=1 conv=sync - -all: boot.img - -install: - ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}\ - boot.img ${DESTDIR}${BINDIR}/cdboot - -.include <bsd.kern.mk> -.include <bsd.prog.mk> diff --git a/sys/i386/boot/cdboot/asm.S b/sys/i386/boot/cdboot/asm.S deleted file mode 100644 index 2190a35..0000000 --- a/sys/i386/boot/cdboot/asm.S +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd - * $FreeBSD$ - */ - - -/* - 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. -*/ - - .file "asm.s" - -#include "asm.h" - - -CR0_PE_ON = 0x1 -CR0_PE_OFF = 0xfffffffe - - .text - -/* - * - * 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 EXT(Gdtr) - - /* set the PE bit of CR0 */ - mov %cr0, %eax - - data32 - or $CR0_PE_ON, %eax - mov %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, FS - */ - movw $0x20, %ax /* data segment */ - mov %ax, %ds /* gas would waste a prefix byte for movw */ - mov %ax, %ss - mov %ax, %es - movw $0x10, %ax /* flat segment */ - mov %ax, %fs - -#ifdef BDE_DEBUGGER - /* load idtr so we can debug */ - lidt EXT(Idtr_prot) -#endif - - ret - -/* - * - * prot_to_real() - * transfer from protected mode to real mode - * - */ - -ENTRY(prot_to_real) - - /* Prepare %ax while we're still in a mode that gas understands. */ - movw $0x30, %ax - - /* Change to use16 mode. */ - ljmp $0x28, $x16 -x16: - - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - - /* clear the PE bit of CR0 */ - mov %cr0, %eax - data32 - and $CR0_PE_OFF, %eax - mov %eax, %cr0 - - /* - * make intersegment jmp to flush the processor pipeline - * and reload CS register - */ - data32 - ljmp $BOOTSEG, $xreal -xreal: - - /* - * we are in real mode now - * set up the real mode segment registers : DS, SS, ES, FS - */ - mov %cs, %ax - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - -#ifdef BDE_DEBUGGER - /* load idtr so we can debug */ - addr32 - data32 - lidt EXT(Idtr_real) -#endif - - data32 - ret - -/* - * startprog(phyaddr) - * start the program on protected mode where phyaddr is the entry point - * - * XXX This whole mess should go away and we should run the boot code in - * flat 32 bit mode with it linked -T BOOTSEG. See the netboot code for - * how this is done. - */ - -ENTRY(startprog) - push %ebp - mov %esp, %ebp - movl %esp, %eax /* Use eax as the old stack pointer */ - - /* convert the current stack to a 32 bit flat model */ - movw $0x10, %bx - mov %bx, %ss - addl $(BOOTSEG<<4),%esp - - /* copy the arguments from the old stack to the new stack */ - pushl 0x14(%eax) /* &bootinfo */ - pushl $0 /* was &nfsdiskless */ - pushl $0 /* was esym */ - pushl $0 /* was cyloffset */ - pushl 0x10(%eax) /* bootdev */ - pushl 0x0C(%eax) /* howto */ - movl $(ourreturn),%ebx - addl $(BOOTSEG<<4),%ebx /* Fix it up for flat segments */ - pushl %ebx /* our return address */ - - /* push on our entry address */ - pushl $0x08 /* segment selector */ - pushl 0x08(%eax) /* kernel entry address */ - - /* convert over the other data segs */ - movw $0x10, %bx - mov %bx, %ds - mov %bx, %es - - /* convert the PC (and code seg) */ - lret -ourreturn: - /* For now there is not much we can do, just lock in a loop */ - jmp ourreturn - -/* - * - * pbzero( dst, cnt) - * where src is a virtual address and dst is a physical address - */ - -ENTRY(pbzero) - push %ebp - mov %esp, %ebp - push %es - push %esi - push %edi - push %ecx - - cld - - /* set %es to point at the flat segment */ - movw $0x10, %ax - mov %ax, %es - - mov 0x8(%ebp), %edi /* destination */ - mov 0xc(%ebp), %ecx /* count */ - xorl %eax, %eax /* value 0 */ - - rep - stosb - - pop %ecx - pop %edi - pop %esi - pop %es - pop %ebp - - ret -/* - * pcpy(src, dst, cnt) - * where src is a virtual address and dst is a physical address - */ - -ENTRY(pcpy) - push %ebp - mov %esp, %ebp - push %es - push %esi - push %edi - push %ecx - - cld - - /* set %es to point at the flat segment */ - movw $0x10, %ax - mov %ax, %es - - mov 0x8(%ebp), %esi /* source */ - mov 0xc(%ebp), %edi /* destination */ - mov 0x10(%ebp), %ecx /* count */ - - rep - movsb - - pop %ecx - pop %edi - pop %esi - pop %es - pop %ebp - - ret diff --git a/sys/i386/boot/cdboot/boot.c b/sys/i386/boot/cdboot/boot.c deleted file mode 100644 index bee6b87..0000000 --- a/sys/i386/boot/cdboot/boot.c +++ /dev/null @@ -1,393 +0,0 @@ -/* - * 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. - * - * from: Mach, [92/04/03 16:51:14 rvb] - * $FreeBSD$ - */ - - -/* - 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. -*/ - -/* - * Extensions for El Torito CD-ROM booting: - * - * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO - * Copyright © 1997 interface business GmbH, Dresden. - * All rights reserved. - * - * This code was written by Jörg Wunsch, Dresden. - * Direct comments to <joerg_wunsch@interface-business.de>. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include "boot.h" -#include <a.out.h> -#include <sys/reboot.h> -#include <machine/bootinfo.h> -#ifdef PROBE_KEYBOARD_LOCK -#include <machine/cpufunc.h> -#endif - -#define ouraddr (BOOTSEG << 4) /* XXX */ - -int loadflags; - -/* - * XXX - * By now, only "cd". How do we learn from the BIOS we've been booted off - * an ATAPI CD-ROM? Do the non-{cd,wcd} drivers implement El Torito booting - * at all? - */ -static int maj = 6; -static struct specpacket spkt = { 0x13 }; -static char *name; -static char namebuf[128]; -static struct bootinfo bootinfo; - -static void getbootdev(char *ptr, int *howto); -static void loadprog(void); - -/* NORETURN */ -void -boot(int drive) -{ - int ret, i; - -#ifdef PROBE_KEYBOARD - if (probe_keyboard()) { - init_serial(); - loadflags |= RB_SERIAL; - printf("\nNo keyboard found."); - } -#endif - -#ifdef PROBE_KEYBOARD_LOCK - if (!(inb(0x64) & 0x10)) { - init_serial(); - loadflags |= RB_SERIAL; - printf("\nKeyboard locked."); - } -#endif - -#ifdef FORCE_COMCONSOLE - init_serial(); - loadflags |= RB_SERIAL; - printf("\nSerial console forced."); -#endif - - /* Pick up the story from the Bios on geometry of disks */ - - /* - * XXX - * Do we need to defer this until we can relinguish the - * BIOS emulation? - */ - - for(ret = 0; ret < N_BIOS_GEOM; ret ++) - bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80); - - bootinfo.bi_basemem = memsize(0); - bootinfo.bi_extmem = memsize(1); - bootinfo.bi_memsizes_valid = 1; - - gateA20(); - - ret = getbootspec(&spkt); - if (ret != 0) { - printf("Your BIOS int 0x13 extensions seem to be disabled.\n" - "It's impossible to boot a CD-ROM without them.\n" - "(BIOS int 0x13 fn 0x4b01 yielded error %d)\n", - ret); - while (1) - ; - } - - if (devopen(sessionstart) == -1) - printf("Warning: cannot open default session.\n" - "Maybe your BIOS int 0x13 extensions are disabled?\n" - "You need them in order to boot a CD-ROM.\n"); - - for (;;) { - - /* - * The El Torito specification stinks. Not only this - * crappy idea of `emulation booting' (and at least - * earlier versions of the AHA-2940 BIOS didn't - * implement anything else than floppy emulation - * booting), but note also that there's absolutely no - * way via the BIOS to obtain the starting LBA of your - * session. All you can get ahold of is the LBA of - * that funny emulated disk. Since this one just - * happens to be a file hidden inside the ISO9660 - * filesystem, it is located at a varying offset from - * the start of the session. We therefore allow to - * specify the starting block of the session to use in - * the boot string, so the operator can specify the - * session to boot from. However, (s)he needs to know - * the RBA for the session from the CD-ROM TOC. - */ - DPRINTF(("using session at sector %d\n", sessionstart)); - - name = "/kernel"; - printf("\n>> FreeBSD CD-ROM BOOT\n" - "Usage: [@%d]%s[-abcCdghrsv]\n" - "Use ? for file list or press Enter for defaults\n" - "\nBoot: ", - sessionstart, name); - - loadflags &= RB_SERIAL; /* clear all, but leave serial console */ - loadflags |= RB_CDROM; /* ...and default to CD-ROM root. */ - - getbootdev(namebuf, &loadflags); - - DPRINTF(("Selected: name=`%s', loadflags=0x%x\n", - name, loadflags)); - - ret = openrd(name); - - DPRINTF(("openrd() = %d\n", ret)); - - if (ret != 0) { - if (ret > 0) - printf("Can't find %s\n", name); - continue; - } - loadprog(); - } -} - -static void -loadprog(void) -{ - struct exec head; - u_int32_t startaddr, addr, bootdev; - int i; - unsigned pad; - - seek(0); - if (read((void *)&head, sizeof(head)) == -1 || - N_BADMAG(head)) { - printf("Invalid format!\n"); - return; - } - - /* - * 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; - printf("Booting CD-ROM [@%d]%s @ 0x%x\n", sessionstart, name, addr); - if(addr < 0x00100000) - { - /* - * Bail out, instead of risking to damage the BIOS - * variables, the loader, or the adapter memory area. - * We don't support loading below 1 MB any more. - */ - printf("Start address too low\n"); - return; - } - printf("text=0x%x ", head.a_text); - - /* load the text segment */ - seek(N_TXTOFF(head)); - if (xread((void *)addr, head.a_text) == -1) - return; - addr += head.a_text; - - /* Pad to a page boundary. */ - pad = (unsigned)addr & PAGE_MASK; - if (pad != 0) { - pad = PAGE_SIZE - pad; - pbzero((void *)addr, pad); - addr += pad; - } - - /* load the initialised data after the text */ - printf("data=0x%x ", head.a_data); - if (xread((void *)addr, head.a_data) == -1) - return; - addr += head.a_data; - - /* Skip over the uninitialised data (but clear it) */ - printf("bss=0x%x ", head.a_bss); - -/* - * XXX however, we should be checking that we don't load ... into - * nonexistent memory. A full symbol table is unlikely to fit on 4MB - * machines. - */ - pbzero((void *)addr, head.a_bss); - addr += head.a_bss; - - /* Pad to a page boundary. */ - pad = (unsigned)addr & PAGE_MASK; - if (pad != 0) { - pad = PAGE_SIZE - pad; - addr += pad; - } - bootinfo.bi_symtab = addr; - - /* Copy the symbol table size */ - pcpy(&head.a_syms, (void *)addr, sizeof(head.a_syms)); - addr += sizeof(head.a_syms); - - /* Load the symbol table */ - printf("symbols=[+0x%x+0x%x+0x%x", pad, sizeof(head.a_syms), - head.a_syms); - if (xread((void *)addr, head.a_syms) == -1) - return; - addr += head.a_syms; - - /* Load the string table size */ - if (read((void *)&i, sizeof(int)) == -1) - return; - pcpy(&i, (void *)addr, sizeof(int)); - i -= sizeof(int); - addr += sizeof(int); - - /* Load the string table */ - printf("+0x%x+0x%x]\n", sizeof(int), i); - if (xread((void *)addr, i) == -1) - return; - addr += i; - - bootinfo.bi_esymtab = addr; - - /* XXX what else can we say about a CD-ROM? */ - bootdev = MAKEBOOTDEV(maj, 0, 0, 0, 0); - - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_kernelname = (u_int32_t)(name + ouraddr); - bootinfo.bi_nfs_diskless = 0; - bootinfo.bi_size = sizeof(bootinfo); - printf("total=0x%x entry point=0x%x\n", (int)addr, (int)startaddr); - startprog((int)startaddr, loadflags | RB_BOOTINFO, bootdev, - (int)&bootinfo + ouraddr); -} - -static void -getbootdev(char *ptr, int *howto) -{ - char c; - - /* - * Be paranoid and make doubly sure that the input buffer is empty. - */ - if (*howto & RB_SERIAL) - init_serial(); - - if (!gets(ptr)) { - putchar('\n'); - return; - } - while ((c = *ptr) != '\0') { -nextarg: - while (c == ' ') - c = *++ptr; - if (c == '-') - while ((c = *++ptr) != '\0') { - if (c == ' ') - goto nextarg; - if (c == 'C') - *howto &= ~RB_CDROM; - if (c == 'a') - *howto |= RB_ASKNAME; - if (c == 'b') - *howto |= RB_HALT; - if (c == 'c') - *howto |= RB_CONFIG; - if (c == 'd') - *howto |= RB_KDB; - if (c == 'h') { - *howto ^= RB_SERIAL; - if (*howto & RB_SERIAL) - init_serial(); - continue; - } - if (c == 'g') - *howto |= RB_GDB; - if (c == 'r') - *howto |= RB_DFLTROOT; - if (c == 's') - *howto |= RB_SINGLE; - if (c == 'v') - *howto |= RB_VERBOSE; - } - if (c == '\0') - return; - name = ptr; - while (*++ptr != '\0') { - if (*ptr == ' ') { - *ptr++ = '\0'; - break; - } - } - } -} diff --git a/sys/i386/boot/cdboot/boot.h b/sys/i386/boot/cdboot/boot.h deleted file mode 100644 index c0973b3..0000000 --- a/sys/i386/boot/cdboot/boot.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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. - * - * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd - * $FreeBSD$ - */ -/* - * Extensions for El Torito CD-ROM booting: - * - * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO - * Copyright © 1997 interface business GmbH, Dresden. - * All rights reserved. - * - * This code has been written by Jörg Wunsch, Dresden. - * Direct comments to <joerg_wunsch@interface-business.de>. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/time.h> - -/* - * Specification packet per El Torito, BIOS int 0x13 fn 0x4b00/0x4b01 - */ -struct specpacket -{ - u_char size; /* must be 0x13 */ - u_char mediatype; /* - * 0 - no emulation - * 1 - 1.2 MB floppy - * 2 - 1.44 MB floppy - * 3 - 2.88 MB floppy - * 4 - hard disk C: - */ - u_char drvno; /* emulated drive number */ - u_char ctrlindx; /* controller index, see El Torito */ - u_int32_t lba; /* LBA of emulated disk drive */ - u_int16_t devspec; /* device specification, see El Torito */ - u_int16_t ubufseg; /* user buffer segment */ - u_int16_t loadseg; /* load segment; 0 => use BIOS default 0x7c0 */ - u_int16_t seccnt; /* number of auto-loaded (virtual) sectors */ - u_char cyls; /* same values as in int 0x13, fn 8 */ - u_char secs; - u_char heads; -}; - -/* - * Disk address packet for extended BIOS int 0x13 fn's 0x41...0x48. - */ -struct daddrpacket -{ - u_char size; /* size of daddrpacket, must be 0x10 */ - u_char reserved1; - u_char nblocks; /* - * number of 512-byte blocks to transfer, - * must be <= 127 - */ - u_char reserved2; - u_int16_t boffs; /* bseg:boffs denominate the transfer buffer */ - u_int16_t bseg; - u_int32_t lba; /* actually a 64-bit type, but 64-bit arith */ - u_int32_t lbahigh; /* is expensive, and we don't really need it */ -}; - -#ifdef DEBUG -# define DPRINTF(x) printf x -#else -# define DPRINTF(x) -#endif - - -/* asm.S */ -#if ASM_ONLY -void real_to_prot(void); -void prot_to_real(void); -#endif -void startprog(unsigned int physaddr, int howto, int bootdev, - /* XXX struct bootinfo * */ unsigned int bootinfo); -void pbzero(void *dst, size_t count); -void pcpy(const void *src, void *dst, size_t count); - -/* bios.S */ - -int biosread(int dev, int cyl, int head, int sec, int nsec, void *offset); -int getbootspec(struct specpacket *offset); -int biosreadlba(struct daddrpacket *daddr); -void putc(int c); -int getc(void); -int ischar(void); -int get_diskinfo(int drive); -int memsize(int extended); - -/* boot.c */ -extern int loadflags; - -void boot(int drive); - -/* boot2.S */ -void boot2(void); - -/* cdrom.c */ -extern u_int32_t sessionstart; - -int devopen(u_int32_t session); -void seek(u_int32_t offs); -int read(u_char *addr, size_t size); -int xread(u_char *addr, size_t size); -int openrd(char *name); - -/* io.c */ -void gateA20(void); -void printf(const char *format, ...); -void putchar(int c); -void delay1ms(void); -int gets(char *buf); -int strcasecmp(const char *s1, const char *s2); -int strcmp(const char *s1, const char *s2); -void bcopy(const void *from, void *to, size_t len); -void twiddle(void); - -/* probe_keyboard.c */ -int probe_keyboard(void); - -/* serial.S */ -void serial_putc(int ch); -int serial_getc(void); -int serial_ischar(void); -void init_serial(void); - -/* table.c */ -extern char *devs[]; -extern unsigned long tw_chars; - -/* malloc.c */ -void *malloc(size_t size); -void free(void *chunk); - -/* linker stuff */ -extern void end; diff --git a/sys/i386/boot/cdboot/cdrom.c b/sys/i386/boot/cdboot/cdrom.c deleted file mode 100644 index 5668abc..0000000 --- a/sys/i386/boot/cdboot/cdrom.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO - * Copyright © 1997 interface business GmbH, Dresden. - * All rights reserved. - * - * This code was written by Jörg Wunsch, Dresden. - * Direct comments to <joerg_wunsch@interface-business.de>. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - - -#include "boot.h" - -#include <isofs/cd9660/iso.h> - -#define BLKSIZE 2048 /* CD-ROM data block size */ -#define BIOSSEC 512 /* BIOS sector size */ - -#define CD2LBA(rba) ((rba) << 2) /* CD-ROM relative block to BIOS LBA */ - -u_int32_t sessionstart; - -static struct iso_primary_descriptor pdesc; - -static char *rootdirbuf; -static size_t rootdirsize; -static char xbuf[BLKSIZE]; -static u_int32_t curblk, startblk, filesize, offset; - -static int bread(u_int32_t rba, size_t nblks, void *buf); -static void badread(const char *msg, u_int32_t blkno); -static struct iso_directory_record *find(const char *path, int list_only); -static char *get_rr_name(struct iso_directory_record *dirp, size_t *len_ret); -static int iread(u_char *buf, size_t len, - void (*copyfun)(const void *src, void *dst, size_t size)); - -static struct daddrpacket dpkt = { 0x10 }; - -int -devopen(u_int32_t session) -{ - int rv; - u_int32_t rootdirblk; - struct iso_directory_record *rootdirp; - - if ((rv = bread(session + 16, 1, &pdesc)) != 0) { - printf("Error reading primary ISO descriptor: %d\n", rv); - return -1; - } - rootdirp = (struct iso_directory_record *)pdesc.root_directory_record; - rootdirblk = isonum_733(rootdirp->extent); - rootdirsize = isonum_733(rootdirp->size); - - /* just in case, round up */ - rootdirsize = (rootdirsize + BLKSIZE - 1) & ~(BLKSIZE - 1); - - if (rootdirbuf != NULL) - free(rootdirbuf); - if ((rootdirbuf = malloc(rootdirsize)) == 0) { - printf("Cannot allocate memory for the root " - "directory buffer.\n"); - return -1; - } - if ((rv = bread(rootdirblk, rootdirsize / BLKSIZE, rootdirbuf)) - != 0) { - printf("Error reading root directory: %d\n", rv); - return -1; - } - - DPRINTF(("Root directory is 0x%x bytes @ %d\n", - rootdirsize, rootdirblk)); - - return 0; -} - -static int -bread(u_int32_t rba, size_t nblks, void *buf) -{ - int i, rv; - - for (i = 0, rv = -1; rv != 0 && i < 3; i++) { - dpkt.nblocks = nblks * (BLKSIZE / BIOSSEC); - dpkt.boffs = (u_int16_t)((int)buf & 0xffff); - dpkt.bseg = BOOTSEG; - dpkt.lba = CD2LBA(rba); - -#ifdef DEBUG_VERBOSE - DPRINTF(("Calling biosreadlba(%d blocks, lba %d) = ", - dpkt.nblocks, dpkt.lba)); -#endif - - rv = biosreadlba(&dpkt); - -#ifdef DEBUG_VERBOSE - DPRINTF(("%d\n", rv)); -#endif - } - return rv; -} - - -void -seek(u_int32_t offs) -{ - offset = offs; -} - -static void -badread(const char *msg, u_int32_t blkno) -{ - printf("Error reading block %d from CD-ROM: %s\n", - blkno, msg); -} - -static __inline size_t -minlen(size_t a, size_t b) -{ - return a < b? a: b; -} - -/* - * Internal form of read()/xread(). - */ -static int -iread(u_char *buf, size_t len, - void (*copyfun)(const void *src, void *dst, size_t size)) -{ - u_int32_t newblk, ptr; - size_t bsize; - - newblk = offset / BLKSIZE + startblk; - - if (newblk != curblk) { - if (offset + len >= filesize) { - badread("access beyond file limit", newblk); - return -1; - } - if (bread(newblk, 1, xbuf)) { - badread("BIOS read error", newblk); - return -1; - } - curblk = newblk; - } - ptr = offset & (BLKSIZE - 1); - if (ptr > 0) { - /* initial short transfer */ - bsize = minlen(BLKSIZE - ptr, len); - copyfun(xbuf + ptr, buf, bsize); - buf += bsize; - len -= bsize; - offset += bsize; - } - for (; len > 0; len -= bsize) { - bsize = minlen(len, BLKSIZE); - newblk = offset / BLKSIZE + startblk; - - if (newblk != curblk) { - if (offset + bsize > filesize) { - badread("access beyond file limit", newblk); - return -1; - } - if (bread(newblk, 1, xbuf)) { - badread("BIOS read error", newblk); - return -1; - } - curblk = newblk; - } - copyfun(xbuf, buf, bsize); - buf += bsize; - offset += bsize; - } - return 0; -} - -int -read(u_char *buf, size_t len) -{ - DPRINTF(("read(0x%x, %d)\n", (int)buf, len)); - return iread(buf, len, bcopy); -} - -int -xread(u_char *buf, size_t len) -{ - DPRINTF(("xread(0x%x, %d)\n", (int)buf, len)); - return iread(buf, len, pcpy); -} - -static char * -get_rr_name(struct iso_directory_record *dirp, size_t *len_ret) -{ - struct rr_header { - char type[2]; - u_char len; - u_char version; - } *rrp; - struct rr_nm_header { - struct rr_header rrh; - u_char flags; - char name[0]; /* XXX -- using gcc extension */ - } *rrnmp; - char *cp; - - cp = dirp->name + (u_char)dirp->name_len[0]; - /* round up to 16-bit boundary; ugly */ - cp = (char *)(((int)cp + 1) & ~1); - rrp = (struct rr_header *)cp; - - if (rrp->type[0] != 'R' || rrp->type[1] != 'R') { - DPRINTF(("no RR, ")); - return 0; - } - - DPRINTF(("RR attribs: ")); - cp += rrp->len; - while (cp - (char *)dirp <= (u_char)dirp->length[0]) { - rrp = (struct rr_header *)cp; - DPRINTF(("%c%c ", rrp->type[0], rrp->type[1])); - if (rrp->type[0] == 'N' && rrp->type[1] == 'M') { - rrnmp = (struct rr_nm_header *)rrp; - *len_ret = rrp->len - sizeof(struct rr_nm_header); - return rrnmp->name; - } - cp += rrp->len; - } - - return 0; -} - -static struct iso_directory_record * -find(const char *path, int list_only) -{ - struct iso_directory_record *dirp; - char *ptr, *rrname; - size_t len, entrylen; - char namebuf[256]; - int i; - int (*comp)(const char *, const char *); - - while (*path && *path == '/') - path++; - - for (ptr = rootdirbuf, i = 1; - ptr < rootdirbuf + rootdirsize; - ptr += entrylen, i++) { - dirp = (struct iso_directory_record *)ptr; - entrylen = (u_char)dirp->length[0]; - len = (u_char)dirp->name_len[0]; - - DPRINTF(("# %d: offset 0x%x, length 0x%x = %d, ", - i, (int)(ptr - rootdirbuf), entrylen, entrylen)); - - if (entrylen == 0) { - /* - * Dir entry of length 0. That's the last - * entry in this block, advance to the next - * block (if any). In case we get beyond the - * end of the directory, we'll fall off the - * loop due to the rootdirsize condition in - * the `for' statement. - */ - DPRINTF(("entrylen 0\n")); - entrylen = (~((ptr - rootdirbuf) + BLKSIZE - 1)) - & (BLKSIZE - 1); - continue; - } - if (len == 0) { - DPRINTF(("name_len 0\n")); - continue; - } - if (len == 1 && - (dirp->name[0] == '\0' || dirp->name[1] == '\1')) { - DPRINTF(("dot/dot-dot entry\n")); - continue; - } - /* don't consider directories */ - if (dirp->flags[0] & 2) { - DPRINTF(("directory\n")); - continue; - } - rrname = get_rr_name(dirp, &len); - comp = rrname? strcmp: strcasecmp; - - bcopy(rrname? rrname: dirp->name, namebuf, len); - namebuf[len] = 0; - DPRINTF(("name `%s'\n", namebuf)); - - if (list_only) { -#ifndef DEBUG - printf("%s ", namebuf); -#endif - } else if (comp(path, namebuf) == 0) - return dirp; - } -#ifndef DEBUG - if (list_only) - printf("\n"); -#endif - return 0; -} - -int -openrd(char *name) -{ - char *cp; - const char *fname; - u_int32_t oldsession; - int session, list_only; - struct iso_directory_record *dirp; - - session = 0; - fname = name; - - /* - * We accept the following boot string: - * - * [@sessionstart] name - */ - for (cp = name; *cp; cp++) - switch (*cp) { - /* we don't support filenames with spaces */ - case ' ': case '\t': - break; - - case '@': - if (session) { - printf("Syntax error\n"); - return -1; - } - session++; - oldsession = sessionstart; - sessionstart = 0; - break; - - case '0': case '1': case '2': - case '3': case '4': case '5': - case '6': case '7': case '8': - case '9': - if (session == 1) { - sessionstart *= 10; - sessionstart += *cp - '0'; - } - break; - - default: - if (session == 1) { - session++; - fname = cp; - } - } - - if (session && devopen(sessionstart) == -1) { - (void)devopen(oldsession); - sessionstart = oldsession; - } - if (session == 1) - /* XXX no filename, only session arg */ - return -1; - - list_only = fname[0] == '?' && fname[1] == 0; - - DPRINTF(("Calling find(%s, %d):\n", fname, list_only)); - dirp = find(fname, list_only); - DPRINTF(("find() returned 0x%x\n", (int)dirp)); - - if (list_only) - return -1; - if (dirp == 0) - return 1; - - startblk = isonum_733(dirp->extent); - filesize = isonum_733(dirp->size); - - DPRINTF(("startblk = %d, filesize = %d\n", startblk, filesize)); - - curblk = 0; /* force a re-read, 0 is impossible file start */ - seek(0); - - return 0; -} diff --git a/sys/i386/boot/cdboot/malloc.c b/sys/i386/boot/cdboot/malloc.c deleted file mode 100644 index a68e776..0000000 --- a/sys/i386/boot/cdboot/malloc.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO - * Copyright © 1997 interface business GmbH, Dresden. - * All rights reserved. - * - * This code was written by Jörg Wunsch, Dresden. - * Direct comments to <joerg_wunsch@interface-business.de>. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Simple memory allocator for the bootstrap loader. Probably suffers - * a lot from fragmentation. - */ - -#include "boot.h" - -#include <stddef.h> - -/* ``Nobody will ever need more than 640 KB of RAM.'' :-) */ -#define MAXBRK (640 * 1024 * 1024) - -/* allocation unit */ -#define NCHUNKS 2048 - -struct chunk -{ - struct chunk *next; - size_t len; -}; - -static void *brkval; -static struct chunk *freelist; - -void * -malloc(size_t len) -{ - struct chunk *p, *q, *oldp; - size_t nelems; - - nelems = (len + sizeof(struct chunk) - 1) / sizeof(struct chunk) + 1; - - /* - * First, see if we can satisfy the request from the freelist. - */ - for (p = freelist, oldp = 0; - p && p != (struct chunk *)brkval; - oldp = p, p = p->next) { - if (p->len > nelems) { - /* chunk is larger, shorten, and return the tail */ - p->len -= nelems; - q = p + p->len; - q->next = 0; - q->len = nelems; - q++; - return (void *)q; - } - if (p->len == nelems) { - /* exact match, remove from freelist */ - if (oldp == 0) - freelist = p->next; - else - oldp->next = p->next; - p->next = 0; - p++; - return (void *)p; - } - } - /* - * Nothing found on freelist, try obtaining more space. - */ - if (brkval == 0) - brkval = &end; - q = p = (struct chunk *)brkval; - if ((int)(p + NCHUNKS) > MAXBRK) - return 0; - - p += NCHUNKS; - brkval = p; - - q->next = p; - q->len = NCHUNKS; - - if (oldp == 0) - freelist = q; - else { - if (oldp + oldp->len == q) { - /* extend last chunk */ - oldp->len += NCHUNKS; - oldp->next = p; - } else - oldp->next = q; - } - - return malloc(len); -} - -void -free(void *ptr) -{ - struct chunk *p, *q, *oldp; - - if (ptr == 0) - return; - - q = (struct chunk *)ptr; - q--; - if (q->next != 0) { - printf("malloc error: botched ptr to free()\n"); - return; - } - - /* - * Walk the freelist, and insert in the correct sequence. - */ - for (p = freelist, oldp = 0; - p && p != (struct chunk *)brkval; - oldp = p, p = p->next) { - if ((unsigned)p > (unsigned)q) { - if (q + q->len == p) { - /* aggregate with next chunk */ - q->len += p->len; - q->next = p->next; - p = p->next; - } - if (oldp) { - if (oldp + oldp->len == q) { - /* aggregate with previous chunk */ - oldp->len += q->len; - oldp->next = p; - } else { - /* insert into chain */ - q->next = p; - oldp->next = q; - } - return; - } - q->next = p; - freelist = q; - } - } - if (oldp) { - /* we are topmost */ - if (oldp + oldp->len == q) { - /* aggregate with previous chunk */ - oldp->len += q->len; - oldp->next = p; - } else { - oldp->next = q; - q->next = p; - } - return; - } - /* we are alone on the freelist */ - freelist = q; -} - diff --git a/sys/i386/boot/dosboot/Makefile b/sys/i386/boot/dosboot/Makefile deleted file mode 100644 index 88a25c7..0000000 --- a/sys/i386/boot/dosboot/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ -# - -MPROG= fbsdboot.exe -CLEANFILES+= ${MPROG} -BINMODE= 444 -NOMAN= -STRIP= - -all: ${MPROG} - -install: ${MPROG} - ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${INSTALLFLAGS} ${MPROG} ${DESTDIR}${BINDIR} - - -${MPROG}: ${MPROG}.uu - uudecode < ${.CURDIR}/${MPROG}.uu - -.include <bsd.prog.mk> diff --git a/sys/i386/boot/dosboot/ansi.h b/sys/i386/boot/dosboot/ansi.h deleted file mode 100644 index 23f6d9b..0000000 --- a/sys/i386/boot/dosboot/ansi.h +++ /dev/null @@ -1,58 +0,0 @@ -/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)ansi.h 7.1 (Berkeley) 3/9/91
- * $FreeBSD$
- */
-
-#ifndef _ANSI_H_
-#define _ANSI_H_
-
-/*
- * Types which are fundamental to the implementation and may appear in
- * more than one standard header are defined here. Standard headers
- * then use:
- * #ifdef _SIZE_T_
- * typedef _SIZE_T_ size_t;
- * #undef _SIZE_T_
- * #endif
- *
- * Thanks, ANSI!
- */
-#define _CLOCK_T_ unsigned long /* clock() */
-#define _PTRDIFF_T_ int /* ptr1 - ptr2 */
-#define _SIZE_T_ unsigned int /* sizeof() */
-#define _TIME_T_ long /* time() */
-#define _VA_LIST_ char * /* va_list */
-#define _WCHAR_T_ unsigned short /* wchar_t */
-
-#endif /* _ANSI_H_ */
diff --git a/sys/i386/boot/dosboot/boot.c b/sys/i386/boot/dosboot/boot.c deleted file mode 100644 index 0eb6d19..0000000 --- a/sys/i386/boot/dosboot/boot.c +++ /dev/null @@ -1,218 +0,0 @@ -/*
- * 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.
- *
- * from: Mach, [92/04/03 16:51:14 rvb]
- * $FreeBSD$
- */
-
-
-/*
- 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 <stdio.h>
-#include <conio.h>
-#include <process.h>
-#include <memory.h>
-
-#include "bootinfo.h"
-#include "protmod.h"
-#include "param.h"
-#include "boot.h"
-#include "reboot.h"
-
-#include "exec.h"
-
-int openrd(char *kernel);
-void ufs_read(char *buffer, long count);
-void xread(unsigned long addr, long size);
-
-static struct exec head;
-static long argv[10];
-static char buf[__LDPGSZ];
-static long int startaddr;
-
-void pbzero(unsigned long addr, unsigned long size)
-{
- long s;
-
- memset(buf, 0, __LDPGSZ);
- while (size) {
- s = size > __LDPGSZ ? __LDPGSZ : size;
- pm_copy(buf, addr, s);
- size -= s;
- addr += s;
- }
-}
-
-static long loadprog(long *hsize)
-{
- long addr; /* physical address.. not directly useable */
- long hmaddress;
- unsigned long pad;
- long i;
- static int (*x_entry)() = 0;
-
- ufs_read(&head, (long) sizeof(head));
- if (N_BADMAG(head)) {
- printf("Invalid format!\n");
- exit(0);
- }
-
- startaddr = (long)head.a_entry;
- addr = (startaddr & 0x00ffffffl); /* some MEG boundary */
- printf("Booting @ 0x%lx\n", addr);
- if(addr < 0x100000l)
- {
- printf("Start address too low!\n");
- exit(0);
- }
-
- poff = N_TXTOFF(head)+head.a_text+head.a_data+head.a_syms;
- ufs_read((void *)&i, sizeof(long));
- *hsize = head.a_text+head.a_data+head.a_bss;
- *hsize = (*hsize+NBPG-1)&~(NBPG-1);
- *hsize += i+4+head.a_syms;
- addr=hmaddress=get_high_memory(*hsize);
- if (!hmaddress) {
- printf("Sorry, can't allocate enough memory!\n");
- exit(0);
- }
-
- poff = N_TXTOFF(head);
-
- /********************************************************/
- /* LOAD THE TEXT SEGMENT */
- /********************************************************/
- printf("text=0x%lx ", head.a_text);
- xread(addr, head.a_text);
- addr += head.a_text;
-
- /********************************************************/
- /* Load the Initialised data after the text */
- /********************************************************/
- while (addr & CLOFSET)
- pm_copy("\0", addr++, 1);
-
- printf("data=0x%lx ", head.a_data);
- xread(addr, head.a_data);
- addr += head.a_data;
-
- /********************************************************/
- /* Skip over the uninitialised data */
- /* (but clear it) */
- /********************************************************/
- printf("bss=0x%lx ", head.a_bss);
- pbzero(addr, head.a_bss);
- addr += head.a_bss;
-
- /* Pad to a page boundary. */
- pad = (unsigned long)(addr-hmaddress+(startaddr & 0x00ffffffl)) % NBPG;
- if (pad != 0) {
- pad = NBPG - pad;
- addr += pad;
- }
- bootinfo.bi_symtab = addr-hmaddress+(startaddr & 0x00ffffffl);
-
- /********************************************************/
- /* Copy the symbol table size */
- /********************************************************/
- pm_copy((char *)&head.a_syms, addr, sizeof(head.a_syms));
- addr += sizeof(head.a_syms);
-
- /********************************************************/
- /* Load the symbol table */
- /********************************************************/
- printf("symbols=[+0x%lx+0x%lx+0x%lx", pad, (long) sizeof(head.a_syms),
- (long) head.a_syms);
- xread(addr, head.a_syms);
- addr += head.a_syms;
-
- /********************************************************/
- /* Load the string table size */
- /********************************************************/
- ufs_read((void *)&i, sizeof(long));
- pm_copy((char *)&i, addr, sizeof(long));
- i -= sizeof(long);
- addr += sizeof(long);
-
- /********************************************************/
- /* Load the string table */
- /********************************************************/
- printf("+0x%x+0x%lx] ", sizeof(long), i);
- xread(addr, i);
- addr += i;
-
- bootinfo.bi_esymtab = addr-hmaddress+(startaddr & 0x00ffffffl);
-
- /*
- * For backwards compatibility, use the previously-unused adaptor
- * and controller bitfields to hold the slice number.
- */
- printf("total=0x%lx entry point=0x%lx\n",
- addr-hmaddress+(startaddr & 0x00ffffffl),
- startaddr & 0x00ffffffl);
-
- return hmaddress;
-}
-
-void bsdboot(int drive, long loadflags, char *kernel)
-{
- long hmaddress, size, bootdev;
-
- /***************************************************************\
- * As a default set it to the first partition of the first *
- * floppy or hard drive *
- \***************************************************************/
- part = unit = 0;
- maj = (drive&0x80 ? 0 : 2); /* a good first bet */
-
- if (openrd(kernel)) {
- printf("Can't find %s\n", kernel);
- exit(0);
- }
- hmaddress = loadprog(&size);
- bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part);
- startprog(hmaddress, size, ((long)startaddr & 0xffffffl),
- loadflags | RB_BOOTINFO, bootdev);
-}
diff --git a/sys/i386/boot/dosboot/boot.h b/sys/i386/boot/dosboot/boot.h deleted file mode 100644 index f72fa1d..0000000 --- a/sys/i386/boot/dosboot/boot.h +++ /dev/null @@ -1,42 +0,0 @@ -/*
- * 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.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd
- * $FreeBSD$
- */
-
-#include "types.h"
-#include "param.h"
-#include "quota.h"
-#include "fs.h"
-#include "inode.h"
-
-extern char *devs[], *name, *iodest;
-extern struct fs *fs;
-extern struct inode inode;
-extern long dosdev, slice, unit, part, maj, boff, poff, bnum, cnt;
-
-extern void bsdboot(int d, long howto, char *kernel);
-extern void pbzero(unsigned long addr, unsigned long size);
diff --git a/sys/i386/boot/dosboot/bootinfo.h b/sys/i386/boot/dosboot/bootinfo.h deleted file mode 100644 index 7f56491..0000000 --- a/sys/i386/boot/dosboot/bootinfo.h +++ /dev/null @@ -1,69 +0,0 @@ -/*-
- * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon 97222
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer as
- * the first lines of this file unmodified.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Rodney W. Grimes.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_BOOTINFO_H_
-#define _MACHINE_BOOTINFO_H_
-
-/* Only change the version number if you break compatibility. */
-#define BOOTINFO_VERSION 1
-
-#define N_BIOS_GEOM 8
-
-/*
- * 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 long bi_version;
- unsigned char *bi_kernelname;
- void *bi_nfs_diskless;
- /* End of fields that are always present. */
-#define bi_endcommon bi_n_bios_used
- unsigned long bi_n_bios_used;
- unsigned long bi_bios_geom[N_BIOS_GEOM];
- unsigned long 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
-extern struct bootinfo bootinfo;
-#endif
-
-#endif /* _MACHINE_BOOTINFO_H_ */
diff --git a/sys/i386/boot/dosboot/cdefs.h b/sys/i386/boot/dosboot/cdefs.h deleted file mode 100644 index 07f727d..0000000 --- a/sys/i386/boot/dosboot/cdefs.h +++ /dev/null @@ -1,100 +0,0 @@ -/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)cdefs.h 8.1 (Berkeley) 6/2/93
- * $FreeBSD$
- */
-
-#ifndef _CDEFS_H_
-#define _CDEFS_H_
-
-#if defined(__cplusplus)
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS };
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-
-/*
- * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
- * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
- * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
- * in between its arguments. __CONCAT can also concatenate double-quoted
- * strings produced by the __STRING macro, but this only works with ANSI C.
- */
-#if defined(__STDC__) || defined(__cplusplus)
-#if defined(__P)
-#undef __P
-#endif /* defined(__P) */
-#define __P(protos) protos /* full-blown ANSI C */
-#define __CONCAT(x,y) x ## y
-#define __STRING(x) #x
-
-#else /* !(__STDC__ || __cplusplus) */
-#if defined(__P)
-#undef __P
-#endif /* defined(__P) */
-#define __P(protos) () /* traditional C preprocessor */
-#define __CONCAT(x,y) x/**/y
-#define __STRING(x) "x"
-
-/* delete ANSI C keywords */
-#define const
-#define inline
-#define signed
-#define volatile
-#endif /* !(__STDC__ || __cplusplus) */
-
-/*
- * GCC has extensions for declaring functions as const (`pure' - always returns
- * the same value given the same inputs, i.e., has no external state and
- * no side effects) and volatile (nonreturning or `dead').
- * These mainly affect optimization and warnings.
- *
- * To facilitate portability of a non-standard extension we define __pure
- * and __dead and use these for qualifying functions. Non-gcc compilers
- * which have similar extensions can then define these appropriately.
- *
- * Unfortunately, GCC complains if these are used under strict ANSI mode
- * (`gcc -ansi -pedantic'), hence we need to define them only if compiling
- * without this.
- */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#define __dead __volatile
-#define __pure __const
-#else
-#define __dead
-#define __pure
-#endif
-
-#endif /* !_CDEFS_H_ */
diff --git a/sys/i386/boot/dosboot/dinode.h b/sys/i386/boot/dosboot/dinode.h deleted file mode 100644 index 99a8849..0000000 --- a/sys/i386/boot/dosboot/dinode.h +++ /dev/null @@ -1,111 +0,0 @@ -/*
- * Copyright (c) 1982, 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)dinode.h 7.10 (Berkeley) 5/8/91
- * $FreeBSD$
- */
-
-#ifndef _UFS_DINODE_H_
-#define _UFS_DINODE_H_ 1
-
-/*
- * A dinode contains all the meta-data associated with a UFS file.
- * This structure defines the on-disk format of a dinode.
- */
-
-#define NDADDR 12 /* direct addresses in inode */
-#define NIADDR 3 /* indirect addresses in inode */
-
-#define MAXFASTLINK (((NDADDR+NIADDR) * sizeof(daddr_t)) - 1)
-
-struct dinode {
- u_short di_mode; /* 0: mode and type of file */
- short di_nlink; /* 2: number of links to file */
- uid_t di_uid; /* 4: owner's user id */
- gid_t di_gid; /* 6: owner's group id */
- union {
-/* u_quad_t v;*/
- u_long val[2];
- } di_qsize; /* 8: number of bytes in file */
- time_t di_atime; /* 16: time last accessed */
- long di_atspare;
- time_t di_mtime; /* 24: time last modified */
- long di_mtspare;
- time_t di_ctime; /* 32: last time inode changed */
- long di_ctspare;
- union {
- struct {
- daddr_t di_udb[NDADDR]; /* 40: disk block addresses */
- daddr_t di_uib[NIADDR]; /* 88: indirect blocks */
- } di_addr;
- char di_usymlink[MAXFASTLINK+1];
- } di_un;
- long di_flags; /* 100: status, currently unused */
- long di_blocks; /* 104: blocks actually held */
- long di_gen; /* 108: generation number */
-#define DI_SPARE_SZ 4 /* 112: spare for 4 longs */
- u_long di_spare[DI_SPARE_SZ]; /* reserved (unused) */
-};
-
-#define di_db di_un.di_addr.di_udb
-#define di_ib di_un.di_addr.di_uib
-#define di_symlink di_un.di_usymlink
-
-#if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
-#define di_size di_qsize.val[0]
-#else /* BYTE_ORDER == BIG_ENDIAN */
-#define di_size di_qsize.val[1]
-#endif
-#define di_rdev di_db[0]
-
-/* file modes */
-#define IFMT 0170000 /* mask of file type */
-#define IFIFO 0010000 /* named pipe (fifo) */
-#define IFCHR 0020000 /* character special device */
-#define IFDIR 0040000 /* directory */
-#define IFBLK 0060000 /* block special device */
-#define IFREG 0100000 /* regular file */
-#define IFLNK 0120000 /* symbolic link */
-#define IFSOCK 0140000 /* UNIX domain socket */
-
-#define ISUID 04000 /* set user identifier when exec'ing */
-#define ISGID 02000 /* set group identifier when exec'ing */
-#define ISVTX 01000 /* save execution information on exit */
-#define IREAD 0400 /* read permission */
-#define IWRITE 0200 /* write permission */
-#define IEXEC 0100 /* execute permission */
-
-#define DFASTLINK(di) \
- ((((di).di_mode & IFMT) == IFLNK) && \
- ((di).di_size <= MAXFASTLINK) && \
- ((di).di_size == (di).di_spare[0]))
-#endif /* _UFS_DINODE_H_ */
diff --git a/sys/i386/boot/dosboot/dir.h b/sys/i386/boot/dosboot/dir.h deleted file mode 100644 index 1b72f47..0000000 --- a/sys/i386/boot/dosboot/dir.h +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Copyright (c) 1982, 1986, 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)dir.h 7.3 (Berkeley) 2/5/91
- * $FreeBSD$
- */
-
-/*
- * The information in this file should be obtained from <dirent.h>
- * and is provided solely (and temporarily) for backward compatibility.
- */
-
-#ifndef _DIR_H_
-#define _DIR_H_
-
-#include "dirent.h"
-
-/*
- * Backwards compatibility.
- */
-#define direct dirent
-
-/*
- * The DIRSIZ macro gives the minimum record length which will hold
- * the directory entry. This requires the amount of space in struct direct
- * without the d_name field, plus enough space for the name with a terminating
- * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
- */
-#undef DIRSIZ
-#define DIRSIZ(dp) \
- ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
-
-#endif /* !_DIR_H_ */
diff --git a/sys/i386/boot/dosboot/dirent.h b/sys/i386/boot/dosboot/dirent.h deleted file mode 100644 index 009d7ec..0000000 --- a/sys/i386/boot/dosboot/dirent.h +++ /dev/null @@ -1,110 +0,0 @@ -/*-
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dirent.h 5.18 (Berkeley) 2/23/91
- *
- * $FreeBSD$
- */
-
-#ifndef _DIRENT_H_
-#define _DIRENT_H_
-
-/*
- * A directory entry has a struct dirent at the front of it, containing its
- * inode number, the length of the entry, and the length of the name
- * contained in the entry. These are followed by the name padded to a 4
- * byte boundary with null bytes. All names are guaranteed null terminated.
- * The maximum length of a name in a directory is MAXNAMLEN.
- */
-
-struct dirent {
- u_long d_fileno; /* file number of entry */
- u_short d_reclen; /* length of this record */
- u_short d_namlen; /* length of string in d_name */
-#ifdef _POSIX_SOURCE
- char d_name[255 + 1]; /* name must be no longer than this */
-#else
-#define MAXNAMLEN 255
- char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
-#endif
-};
-
-#ifdef _POSIX_SOURCE
-typedef void * DIR;
-#else
-
-#define d_ino d_fileno /* backward compatibility */
-
-/* definitions for library routines operating on directories. */
-#define DIRBLKSIZ 1024
-
-/* structure describing an open directory. */
-typedef struct _dirdesc {
- long dd_fd; /* file descriptor associated with directory */
- long dd_loc; /* offset in current buffer */
- long dd_size; /* amount of data returned by getdirentries */
- char *dd_buf; /* data buffer */
- long dd_len; /* size of data buffer */
- long dd_seek; /* magic cookie returned by getdirentries */
- void *dd_ddloc; /* Linked list of ddloc structs for telldir/seekdir */
-} DIR;
-
-#define dirfd(dirp) ((dirp)->dd_fd)
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#endif /* _POSIX_SOURCE */
-
-#ifndef KERNEL
-
-#include "cdefs.h"
-
-__BEGIN_DECLS
-DIR *opendir __P((const char *));
-struct dirent *readdir __P((DIR *));
-void rewinddir __P((DIR *));
-int closedir __P((DIR *));
-#ifndef _POSIX_SOURCE
-long telldir __P((const DIR *));
-void seekdir __P((DIR *, long));
-int scandir __P((const char *, struct dirent ***,
- int (*)(struct dirent *), int (*)(const void *, const void *)));
-int alphasort __P((const void *, const void *));
-int getdirentries __P((int, char *, int, long *));
-#endif /* not POSIX */
-__END_DECLS
-
-#endif /* !_KERNEL */
-
-#endif /* !_DIRENT_H_ */
diff --git a/sys/i386/boot/dosboot/disk.c b/sys/i386/boot/dosboot/disk.c deleted file mode 100644 index 7601fc3..0000000 --- a/sys/i386/boot/dosboot/disk.c +++ /dev/null @@ -1,194 +0,0 @@ -/*
- * 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.
- *
- * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
- * $FreeBSD$
- */
-#include <stdio.h>
-#include <memory.h>
-
-#define bcopy(a,b,c) memcpy(b,a,c)
-
-#include "boot.h"
-#include "disklabe.h"
-#include "diskslic.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)
-
-static char i_buf[BPS];
-#define I_ADDR ((void *) i_buf) /* XXX where all reads go */
-
-
-static int spt, spc;
-
-char *iodest;
-struct fs *fs;
-struct inode inode;
-long dosdev, slice, unit, part, maj, boff, poff, bnum, cnt;
-
-extern int biosread(int dev, int track, int head, int sector, int cnt, unsigned char far *buffer);
-
-struct disklabel disklabel;
-
-static void Bread(int dosdev, long sector);
-
-unsigned long get_diskinfo(int drive)
-{
- char dr = (char) drive;
- unsigned long rt;
-
- _asm {
- mov ah,8 ; get diskinfo
- mov dl,dr ; drive
- int 13h
- cmp ah,0
- je ok
- ;
- ; Failure! We assume it's a floppy!
- ;
- sub ax,ax
- mov bh,ah
- mov bl,2
- mov ch,79
- mov cl,15
- mov dh,1
- mov dl,1
- ok:
- mov ah,dh
- mov al,cl
- and al,3fh
- mov word ptr rt,ax
-
- xor bx,bx
- mov bl,cl
- and bl,0c0h
- shl bx,2
- mov bl,ch
- mov word ptr rt+2,bx
- }
- return rt;
-}
-
-int devopen(void)
-{
- struct dos_partition *dptr;
- struct disklabel *dl;
- int dosdev = (int) inode.i_dev;
- int i;
- long di, sector;
-
- di = get_diskinfo(dosdev);
- spc = (spt = (int)SPT(di)) * (int)HEADS(di);
- if (dosdev == 2)
- {
- boff = 0;
- part = (spt == 15 ? 3 : 1);
- }
- else
- {
-#ifdef EMBEDDED_DISKLABEL
- dl = &disklabel;
-#else EMBEDDED_DISKLABEL
- Bread(dosdev, 0);
- dptr = (struct dos_partition *)(((char *)I_ADDR)+DOSPARTOFF);
- sector = LABELSECTOR;
- slice = WHOLE_DISK_SLICE;
- for (i = 0; i < NDOSPART; i++, dptr++)
- if (dptr->dp_typ == DOSPTYP_386BSD) {
- slice = BASE_SLICE + i;
- sector = dptr->dp_start + LABELSECTOR;
- break;
- }
- Bread(dosdev, sector++);
- dl=((struct disklabel *)I_ADDR);
- disklabel = *dl; /* structure copy (maybe useful later)*/
-#endif EMBEDDED_DISKLABEL
- if (dl->d_magic != DISKMAGIC) {
- printf("bad disklabel");
- return 1;
- }
-
- if( (maj == 4) || (maj == 0) || (maj == 1)) {
- if (dl->d_type == DTYPE_SCSI)
- maj = 4; /* use scsi as boot dev */
- else
- maj = 0; /* must be ESDI/IDE */
- }
-
- boff = dl->d_partitions[part].p_offset;
- }
- return 0;
-}
-
-void devread(void)
-{
- long offset, sector = bnum;
- int dosdev = (int) inode.i_dev;
- for (offset = 0; offset < cnt; offset += BPS)
- {
- Bread(dosdev, sector++);
- bcopy(I_ADDR, iodest+offset, BPS);
- }
-}
-
-/* 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 long ra_end;
-static long ra_first;
-
-static void Bread(int dosdev, long sector)
-{
- if (dosdev != ra_dev || sector < ra_first || sector >= ra_end)
- {
- int cyl, head, sec, nsec;
-
- cyl = (int) (sector/(long)spc);
- head = (int) ((sector % (long) spc) / (long) spt);
- sec = (int) (sector % (long) spt);
- nsec = spt - sec;
- if (nsec > RA_SECTORS)
- nsec = RA_SECTORS;
- if (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0)
- {
- nsec = 1;
- while (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0)
- printf("Error: C:%d H:%d S:%d\n", cyl, head, sec);
- }
- ra_dev = dosdev;
- ra_first = sector;
- ra_end = sector + nsec;
- }
- bcopy(ra_buf + (sector - ra_first) * BPS, I_ADDR, BPS);
-}
diff --git a/sys/i386/boot/dosboot/disklabe.h b/sys/i386/boot/dosboot/disklabe.h deleted file mode 100644 index 755e928..0000000 --- a/sys/i386/boot/dosboot/disklabe.h +++ /dev/null @@ -1,409 +0,0 @@ -/*
- * Copyright (c) 1987, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)disklabel.h 8.1 (Berkeley) 6/2/93
- * $FreeBSD$
- */
-
-#ifndef _SYS_DISKLABEL_H_
-#define _SYS_DISKLABEL_H_
-
-/*
- * Disk description table, see disktab(5)
- */
-#define _PATH_DISKTAB "/etc/disktab"
-#define DISKTAB "/etc/disktab" /* deprecated */
-
-/*
- * Each disk has a label which includes information about the hardware
- * disk geometry, filesystem partitions, and drive specific information.
- * The label is in block 0 or 1, possibly offset from the beginning
- * to leave room for a bootstrap, etc.
- */
-
-/* XXX these should be defined per controller (or drive) elsewhere, not here! */
-#ifdef __i386__
-#define LABELSECTOR 1 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define OURPART 2 /* partition is 'all BSD' */
-#define RAWPART 3 /* partition is 'all device' */
-#define readMSPtolabel readMBRtolabel
-#endif
-
-#ifndef readMSPtolabel
-#define readMSPtolabel(a,b,c,d,e) /* zap calls if irrelevant */
-#endif
-
-#ifdef tahoe
-#define RAWPART 0
-#endif
-
-#ifndef RAWPART
-#define RAWPART 2
-#endif
-
-#ifndef OURPART
-#define OURPART RAWPART /* by default it's all ours */
-#endif
-
-#ifndef LABELSECTOR
-#define LABELSECTOR 0 /* sector containing label */
-#endif
-
-#ifndef LABELOFFSET
-#define LABELOFFSET 64 /* offset of label in sector */
-#endif
-
-#define DISKMAGIC ((u_long) 0x82564557ul) /* The disk magic number */
-#ifndef MAXPARTITIONS
-#define MAXPARTITIONS 8
-#endif
-
-
-#ifndef LOCORE
-struct disklabel {
- u_long d_magic; /* the magic number */
- short d_type; /* drive type */
- short d_subtype; /* controller/d_type specific */
- char d_typename[16]; /* type name, e.g. "eagle" */
- /*
- * d_packname contains the pack identifier and is returned when
- * the disklabel is read off the disk or in-core copy.
- * d_boot0 and d_boot1 are the (optional) names of the
- * primary (block 0) and secondary (block 1-15) bootstraps
- * as found in /boot. These are returned when using
- * getdiskbyname(3) to retrieve the values from /etc/disktab.
- */
-#if defined(_KERNEL) || defined(STANDALONE)
- char d_packname[16]; /* pack identifier */
-#else
- union {
- char un_d_packname[16]; /* pack identifier */
- struct {
- char *un_d_boot0; /* primary bootstrap name */
- char *un_d_boot1; /* secondary bootstrap name */
- } un_b;
- } d_un;
-#define d_packname d_un.un_d_packname
-#define d_boot0 d_un.un_b.un_d_boot0
-#define d_boot1 d_un.un_b.un_d_boot1
-#endif /* ! _KERNEL or STANDALONE */
- /* disk geometry: */
- u_long d_secsize; /* # of bytes per sector */
- u_long d_nsectors; /* # of data sectors per track */
- u_long d_ntracks; /* # of tracks per cylinder */
- u_long d_ncylinders; /* # of data cylinders per unit */
- u_long d_secpercyl; /* # of data sectors per cylinder */
- u_long d_secperunit; /* # of data sectors per unit */
- /*
- * Spares (bad sector replacements) below
- * are not counted in d_nsectors or d_secpercyl.
- * Spare sectors are assumed to be physical sectors
- * which occupy space at the end of each track and/or cylinder.
- */
- u_short d_sparespertrack; /* # of spare sectors per track */
- u_short d_sparespercyl; /* # of spare sectors per cylinder */
- /*
- * Alternate cylinders include maintenance, replacement,
- * configuration description areas, etc.
- */
- u_long d_acylinders; /* # of alt. cylinders per unit */
-
- /* hardware characteristics: */
- /*
- * d_interleave, d_trackskew and d_cylskew describe perturbations
- * in the media format used to compensate for a slow controller.
- * Interleave is physical sector interleave, set up by the formatter
- * or controller when formatting. When interleaving is in use,
- * logically adjacent sectors are not physically contiguous,
- * but instead are separated by some number of sectors.
- * It is specified as the ratio of physical sectors traversed
- * per logical sector. Thus an interleave of 1:1 implies contiguous
- * layout, while 2:1 implies that logical sector 0 is separated
- * by one sector from logical sector 1.
- * d_trackskew is the offset of sector 0 on track N
- * relative to sector 0 on track N-1 on the same cylinder.
- * Finally, d_cylskew is the offset of sector 0 on cylinder N
- * relative to sector 0 on cylinder N-1.
- */
- u_short d_rpm; /* rotational speed */
- u_short d_interleave; /* hardware sector interleave */
- u_short d_trackskew; /* sector 0 skew, per track */
- u_short d_cylskew; /* sector 0 skew, per cylinder */
- u_long d_headswitch; /* head switch time, usec */
- u_long d_trkseek; /* track-to-track seek, usec */
- u_long d_flags; /* generic flags */
-#define NDDATA 5
- u_long d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
- u_long d_spare[NSPARE]; /* reserved for future use */
- u_long d_magic2; /* the magic number (again) */
- u_short d_checksum; /* xor of data incl. partitions */
-
- /* filesystem and partition information: */
- u_short d_npartitions; /* number of partitions in following */
- u_long d_bbsize; /* size of boot area at sn0, bytes */
- u_long d_sbsize; /* max size of fs superblock, bytes */
- struct partition { /* the partition table */
- u_long p_size; /* number of sectors in partition */
- u_long p_offset; /* starting sector */
- u_long p_fsize; /* filesystem basic fragment size */
- u_char p_fstype; /* filesystem type, see below */
- u_char p_frag; /* filesystem fragments per block */
- union {
- u_short cpg; /* UFS: FS cylinders per group */
- u_short sgs; /* LFS: FS segment shift */
- } __partition_u1;
-#define p_cpg __partition_u1.cpg
-#define p_sgs __partition_u1.sgs
- } d_partitions[MAXPARTITIONS]; /* actually may be more */
-};
-/*
-struct cpu_disklabel {
-};
-*/
-#else /* LOCORE */
- /*
- * offsets for asm boot files.
- */
- .set d_secsize,40
- .set d_nsectors,44
- .set d_ntracks,48
- .set d_ncylinders,52
- .set d_secpercyl,56
- .set d_secperunit,60
- .set d_end_,276 /* size of disk label */
-#endif /* LOCORE */
-
-/* d_type values: */
-#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
-#define DTYPE_MSCP 2 /* MSCP */
-#define DTYPE_DEC 3 /* other DEC (rk, rl) */
-#define DTYPE_SCSI 4 /* SCSI */
-#define DTYPE_ESDI 5 /* ESDI interface */
-#define DTYPE_ST506 6 /* ST506 etc. */
-#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
-#define DTYPE_HPFL 8 /* HP Fiber-link */
-#define DTYPE_FLOPPY 10 /* floppy */
-
-/* d_subtype values: */
-#define DSTYPE_INDOSPART 0x8 /* is inside dos partition */
-#define DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */
-#define DSTYPE_GEOMETRY 0x10 /* drive params in label */
-
-#ifdef DKTYPENAMES
-static char *dktypenames[] = {
- "unknown",
- "SMD",
- "MSCP",
- "old DEC",
- "SCSI",
- "ESDI",
- "ST506",
- "HP-IB",
- "HP-FL",
- "type 9",
- "floppy",
- 0
-};
-#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
-#endif
-
-/*
- * Filesystem type and version.
- * Used to interpret other filesystem-specific
- * per-partition information.
- */
-#define FS_UNUSED 0 /* unused */
-#define FS_SWAP 1 /* swap */
-#define FS_V6 2 /* Sixth Edition */
-#define FS_V7 3 /* Seventh Edition */
-#define FS_SYSV 4 /* System V */
-#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
-#define FS_V8 6 /* Eighth Edition, 4K blocks */
-#define FS_BSDFFS 7 /* 4.2BSD fast file system */
-#define FS_MSDOS 8 /* MSDOS file system */
-#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */
-#define FS_OTHER 10 /* in use, but unknown/unsupported */
-#define FS_HPFS 11 /* OS/2 high-performance file system */
-#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
-#define FS_BOOT 13 /* partition contains bootstrap */
-
-#ifdef DKTYPENAMES
-static char *fstypenames[] = {
- "unused",
- "swap",
- "Version 6",
- "Version 7",
- "System V",
- "4.1BSD",
- "Eighth Edition",
- "4.2BSD",
- "MSDOS",
- "4.4LFS",
- "unknown",
- "HPFS",
- "ISO9660",
- "boot",
- 0
-};
-#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
-#endif
-
-/*
- * flags shared by various drives:
- */
-#define D_REMOVABLE 0x01 /* removable media */
-#define D_ECC 0x02 /* supports ECC */
-#define D_BADSECT 0x04 /* supports bad sector forw. */
-#define D_RAMDISK 0x08 /* disk emulator */
-#define D_CHAIN 0x10 /* can do back-back transfers */
-
-/*
- * Drive data for SMD.
- */
-#define d_smdflags d_drivedata[0]
-#define D_SSE 0x1 /* supports skip sectoring */
-#define d_mindist d_drivedata[1]
-#define d_maxdist d_drivedata[2]
-#define d_sdist d_drivedata[3]
-
-/*
- * Drive data for ST506.
- */
-#define d_precompcyl d_drivedata[0]
-#define d_gap3 d_drivedata[1] /* used only when formatting */
-
-/*
- * Drive data for SCSI.
- */
-#define d_blind d_drivedata[0]
-
-#ifndef LOCORE
-/*
- * Structure used to perform a format
- * or other raw operation, returning data
- * and/or register values.
- * Register identification and format
- * are device- and driver-dependent.
- */
-struct format_op {
- char *df_buf;
- long df_count; /* value-result */
- daddr_t df_startblk;
- long df_reg[8]; /* result */
-};
-
-/*
- * Structure used internally to retrieve
- * information about a partition on a disk.
- */
-struct partinfo {
- struct disklabel *disklab;
- struct partition *part;
-};
-
-/* DOS partition table -- located in boot block */
-
-#define DOSBBSECTOR 0 /* DOS boot block relative sector number */
-#define DOSPARTOFF 446
-#define NDOSPART 4
-#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
-#define MBR_PTYPE_FreeBSD 0xa5 /* FreeBSD partition type */
-
-struct dos_partition {
- unsigned char dp_flag; /* bootstrap flags */
- unsigned char dp_shd; /* starting head */
- unsigned char dp_ssect; /* starting sector */
- unsigned char dp_scyl; /* starting cylinder */
- unsigned char dp_typ; /* partition type */
- unsigned char dp_ehd; /* end head */
- unsigned char dp_esect; /* end sector */
- unsigned char dp_ecyl; /* end cylinder */
- unsigned long dp_start; /* absolute starting sector number */
- unsigned long dp_size; /* partition size in sectors */
-};
-
-extern struct dos_partition dos_partitions[NDOSPART];
-
-#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */
-#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */
-
-/*
- * Disk-specific ioctls.
- */
- /* get and set disklabel; DIOCGPART used internally */
-#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
-#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
-#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
-#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
-
-#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */
-
-#define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */
-
-#endif /* LOCORE */
-
-#ifdef KERNEL
-struct dkbad;
-
-u_int dkcksum __P((struct disklabel *));
-int writedisklabel __P((dev_t dev, void (*strat)(), struct disklabel *lp));
-char * readdisklabel __P((dev_t dev, void (*strat)(), struct disklabel *lp, struct dos_partition *dp, struct dkbad *bdp));
-int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, u_long openmask));
-void disksort __P((struct buf *ap, struct buf *bp));
-void diskerr __P((struct buf *, char *, char *, int, int, struct disklabel *));
-#ifdef __i386
-char * readMBRtolabel __P(( dev_t dev , void (*strat)(), register struct disklabel *lp, struct dos_partition *dp, int *cyl));
-#endif
-#endif
-
-#if !defined(_KERNEL) && !defined(LOCORE)
-
-#include "cdefs.h"
-
-__BEGIN_DECLS
-struct disklabel *getdiskbyname __P((const char *));
-__END_DECLS
-
-#endif
-
-#ifdef __i386
-/* encoding of disk minor numbers, should be elsewhere... */
-#define dkunit(dev) (minor(dev) >> 3)
-#define dkpart(dev) (minor(dev) & 07)
-#define dkminor(unit, part) (((unit) << 3) | (part))
-#endif
-
-#endif
-
-
diff --git a/sys/i386/boot/dosboot/dosboot.c b/sys/i386/boot/dosboot/dosboot.c deleted file mode 100644 index d8992e5b..0000000 --- a/sys/i386/boot/dosboot/dosboot.c +++ /dev/null @@ -1,217 +0,0 @@ -/*
- * dosboot.c Boot FreeBSD from DOS partition
- *
- * (C) 1994 by Christian Gusenbauer (cg@fimp01.fim.uni-linz.ac.at)
- * 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.
- *
- * I ALLOW YOU USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. I DISCLAIM
- * ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
- * USE OF THIS SOFTWARE.
- *
- * Parts of this file are
- * 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 <bios.h>
-#include <stdio.h>
-#include <process.h>
-
-#include "protmod.h"
-#include "param.h"
-#include "boot.h"
-#include "bootinfo.h"
-#include "reboot.h"
-
-#include "exec.h"
-
-#define BUFSIZE 4096
-
-static struct exec head;
-static long argv[10];
-static long startaddr;
-
-int biosread(int dev, int track, int head, int sector, int cnt, unsigned char far *buffer)
-{
- struct _diskinfo_t di;
- int r;
-
- di.drive = dev; /* first hard disk */
- di.head = head; /* head # */
- di.track = track; /* track # */
- di.sector = sector+1; /* sector # */
- di.nsectors = cnt; /* only 1 sector */
- di.buffer = (void far *) buffer; /* sector buffer */
- r= _bios_disk(_DISK_READ, &di);
- return r&0xFF00;
-}
-
-static void dosxread(FILE *fp, unsigned long addr, long size)
-{
- extern char buf[BUFSIZE];
-
- int count = BUFSIZE;
- while (size > 0l) {
- if (BUFSIZE > size)
- count = (int) size;
- fread(buf, count, 1, fp);
- pm_copy(buf, addr, count);
- size -= count;
- addr += count;
- }
-}
-
-static long loadprog(FILE *fp, long *hsize)
-{
- long int addr; /* physical address.. not directly useable */
- long int hmaddress, pad, i;
- static int (*x_entry)() = 0;
-
- fread(&head, sizeof(head), 1, fp);
- fseek(fp, 4096-sizeof(head), 1);
- if (N_BADMAG(head)) {
- printf("Invalid format!\n");
- exit(0);
- }
-
- startaddr = (long)head.a_entry;
- addr = (startaddr & 0x00ffffffl); /* some MEG boundary */
- printf("Booting @ 0x%lx\n", addr);
- if(addr < 0x100000l)
- {
- printf("Start address too low!\n");
- exit(0);
- }
-
- poff = N_TXTOFF(head)+head.a_text+head.a_data+head.a_syms;
- fseek(fp, poff, 0);
- fread(&i, sizeof(i), 1, fp);
- *hsize = head.a_text+head.a_data+head.a_bss;
- *hsize = (*hsize+NBPG-1)&~(NBPG-1);
- *hsize += i+4+head.a_syms;
- addr=hmaddress=get_high_memory(*hsize);
- if (!hmaddress) {
- printf("Sorry, can't allocate enough memory!\n");
- exit(0);
- }
-
- poff = N_TXTOFF(head);
- fseek(fp, poff, 0);
-
- /********************************************************/
- /* LOAD THE TEXT SEGMENT */
- /********************************************************/
- printf("text=0x%lx ", head.a_text);
- dosxread(fp, addr, head.a_text);
- addr += head.a_text;
-
- /********************************************************/
- /* Load the Initialised data after the text */
- /********************************************************/
- while (addr & CLOFSET)
- pm_copy("\0", addr++, 1);
-
- printf("data=0x%lx ", head.a_data);
- dosxread(fp, addr, head.a_data);
- addr += head.a_data;
-
- /********************************************************/
- /* Skip over the uninitialised data */
- /* (but clear it) */
- /********************************************************/
- printf("bss=0x%lx ", head.a_bss);
- pbzero(addr, head.a_bss);
- addr += head.a_bss;
-
- /* Pad to a page boundary. */
- pad = (unsigned long)(addr-hmaddress+(startaddr & 0x00ffffffl)) % NBPG;
- if (pad != 0) {
- pad = NBPG - pad;
- addr += pad;
- }
- bootinfo.bi_symtab = addr-hmaddress+(startaddr & 0x00ffffffl);
-
- /********************************************************/
- /* Copy the symbol table size */
- /********************************************************/
- pm_copy((char *)&head.a_syms, addr, sizeof(head.a_syms));
- addr += sizeof(head.a_syms);
-
- /********************************************************/
- /* Load the symbol table */
- /********************************************************/
- printf("symbols=[+0x%lx+0x%lx+0x%lx", pad, (long) sizeof(head.a_syms),
- (long) head.a_syms);
- dosxread(fp, addr, head.a_syms);
- addr += head.a_syms;
-
- /********************************************************/
- /* Load the string table size */
- /********************************************************/
- fread((void *)&i, sizeof(long), 1, fp);
- pm_copy((char *)&i, addr, sizeof(long));
- i -= sizeof(long);
- addr += sizeof(long);
-
- /********************************************************/
- /* Load the string table */
- /********************************************************/
- printf("+0x%x+0x%lx] ", sizeof(long), i);
- dosxread(fp, addr, i);
- addr += i;
-
- bootinfo.bi_esymtab = addr-hmaddress+(startaddr & 0x00ffffffl);
-
- /*
- * For backwards compatibility, use the previously-unused adaptor
- * and controller bitfields to hold the slice number.
- */
- printf("total=0x%lx entry point=0x%lx\n",
- addr-hmaddress+(startaddr & 0x00ffffffl),
- startaddr & 0x00ffffffl);
-
- return hmaddress;
-}
-
-void dosboot(long howto, char *kernel)
-{
- long hmaddress, size, bootdev;
- FILE *fp;
-
- fp = fopen(kernel, "rb"); /* open kernel for reading */
- if (!fp) {
- fprintf(stderr, "Sorry, can't open %s!\n", kernel);
- return;
- }
- hmaddress = loadprog(fp, &size);
- fclose(fp);
-
- bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part);
- startprog(hmaddress, size, ((long)startaddr & 0xffffffl),
- howto | RB_BOOTINFO, bootdev);
-}
diff --git a/sys/i386/boot/dosboot/dosboot.h b/sys/i386/boot/dosboot/dosboot.h deleted file mode 100644 index 2e43d74..0000000 --- a/sys/i386/boot/dosboot/dosboot.h +++ /dev/null @@ -1,18 +0,0 @@ -/*
- * dosboot.h Boot FreeBSD from DOS partition
- *
- * (C) 1994 by Christian Gusenbauer (cg@fimp01.fim.uni-linz.ac.at)
- * 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.
- *
- * I ALLOW YOU USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. I DISCLAIM
- * ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
- * USE OF THIS SOFTWARE.
- *
- */
-void dosboot(long howto, char *kernel);
diff --git a/sys/i386/boot/dosboot/endian.h b/sys/i386/boot/dosboot/endian.h deleted file mode 100644 index 84d04b2..0000000 --- a/sys/i386/boot/dosboot/endian.h +++ /dev/null @@ -1,120 +0,0 @@ -/*
- * Copyright (c) 1987, 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)endian.h 7.8 (Berkeley) 4/3/91
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_ENDIAN_H_
-#define _MACHINE_ENDIAN_H_ 1
-
-/*
- * Define the order of 32-bit words in 64-bit words.
- */
-#define _QUAD_HIGHWORD 1
-#define _QUAD_LOWWORD 0
-
-/*
- * Definitions for byte order, according to byte significance from low
- * address to high.
- */
-#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
-#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
-#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
-
-#define BYTE_ORDER LITTLE_ENDIAN
-
-#ifndef KERNEL
-#include "cdefs.h"
-#endif
-
-#define __word_swap_long(x) \
-({ register u_long X = (x); \
- __asm ("rorl $16, %1" \
- : "=r" (X) \
- : "0" (X)); \
- X; })
-#if __GNUC__ >= 2
-#define __byte_swap_long(x) \
-({ register u_long X = (x); \
- __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \
- : "=q" (X) \
- : "0" (X)); \
- X; })
-#define __byte_swap_word(x) \
-({ register u_short X = (x); \
- __asm ("xchgb %h1, %b1" \
- : "=q" (X) \
- : "0" (X)); \
- X; })
-#else /* __GNUC__ >= 2 */
-#define __byte_swap_long(x) \
-({ register u_long X = (x); \
- __asm ("rorw $8, %w1\n\trorl $16, %1\n\trorw $8, %w1" \
- : "=r" (X) \
- : "0" (X)); \
- X; })
-#define __byte_swap_word(x) \
-({ register u_short X = (x); \
- __asm ("rorw $8, %w1" \
- : "=r" (X) \
- : "0" (X)); \
- X; })
-#endif /* __GNUC__ >= 2 */
-
-/*
- * Macros for network/external number representation conversion.
- */
-#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
-#define ntohl(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define htons(x) (x)
-
-#define NTOHL(x) (x)
-#define NTOHS(x) (x)
-#define HTONL(x) (x)
-#define HTONS(x) (x)
-
-#else
-
-#define ntohl __byte_swap_long
-#define ntohs __byte_swap_word
-#define htonl __byte_swap_long
-#define htons __byte_swap_word
-
-#define NTOHL(x) (x) = ntohl((u_long)x)
-#define NTOHS(x) (x) = ntohs((u_short)x)
-#define HTONL(x) (x) = htonl((u_long)x)
-#define HTONS(x) (x) = htons((u_short)x)
-#endif
-#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/i386/boot/dosboot/exec.h b/sys/i386/boot/dosboot/exec.h deleted file mode 100644 index d64f63b..0000000 --- a/sys/i386/boot/dosboot/exec.h +++ /dev/null @@ -1,88 +0,0 @@ -/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)exec.h 8.3 (Berkeley) 1/21/94
- * $FreeBSD$
- */
-
-#ifndef _SYS_EXEC_H_
-#define _SYS_EXEC_H_
-
-/*
- * The following structure is found at the top of the user stack of each
- * user process. The ps program uses it to locate argv and environment
- * strings. Programs that wish ps to display other information may modify
- * it; normally ps_argvstr points to the text for argv[0], and ps_nargvstr
- * is the same as the program's argc. The fields ps_envstr and ps_nenvstr
- * are the equivalent for the environment.
- */
-struct ps_strings {
- char *ps_argvstr; /* first of 0 or more argument strings */
- long ps_nargvstr; /* the number of argument strings */
- char *ps_envstr; /* first of 0 or more environment strings */
- long ps_nenvstr; /* the number of environment strings */
-};
-
-/*
- * Address of ps_strings structure (in user space).
- */
-#define SPARE_USRSPACE 256
-#define PS_STRINGS ((struct ps_strings *) \
- (USRSTACK - sizeof(struct ps_strings) - SPARE_USRSPACE))
-
-/*
- * Arguments to the exec system call.
- */
-struct execve_args {
- char *fname;
- char **argv;
- char **envv;
-};
-
-struct execsw {
- int (*ex_imgact)(void * /* struct image_params * */);
- const char *ex_name;
-};
-
-#ifdef KERNEL
-extern const struct execsw **execsw;
-
-#endif
-
-#include "mexec.h"
-
-#endif
diff --git a/sys/i386/boot/dosboot/fbsdboot.c b/sys/i386/boot/dosboot/fbsdboot.c deleted file mode 100644 index 341a5c1..0000000 --- a/sys/i386/boot/dosboot/fbsdboot.c +++ /dev/null @@ -1,124 +0,0 @@ -/*
- * fbsdboot.c Boot FreeBSD from DOS
- *
- * (C) 1994 by Christian Gusenbauer (cg@fimp01.fim.uni-linz.ac.at)
- * 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.
- *
- * I ALLOW YOU USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. I DISCLAIM
- * ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
- * USE OF THIS SOFTWARE.
- *
- */
-#include <dos.h>
-#include <stdio.h>
-#include <process.h>
-
-#include "reboot.h"
-#include "boot.h"
-#include "bootinfo.h"
-#include "dosboot.h"
-#include "protmod.h"
-
-#define MAV 1
-#define MIV 7
-
-#define ptr2pa(x) (((((long)(x))&0xffff0000l)>>12l)+(((long)(x))&0xffffl))
-
-static void usage(char *name)
-{
- fprintf(stderr, "FreeBSD boot Version %d.%d\n", MAV, MIV);
- fprintf(stderr, "(c) 1994, 1995 Christian Gusenbauer,\n cg@fimp01.fim.uni-linz.ac.at\n\n");
- fprintf(stderr, "usage: %s [ options ] [ kernelname ]\n", name);
- fprintf(stderr, "where options are:\n");
- fprintf(stderr, "\t-r ... use compiled-in rootdev\n");
- fprintf(stderr, "\t-s ... reboot to single user only\n");
- fprintf(stderr, "\t-a ... ask for file name to reboot from\n");
- fprintf(stderr, "\t-d ... give control to kernel debugger\n");
- fprintf(stderr, "\t-g ... give control to GDB debugger\n");
- fprintf(stderr, "\t-c ... invoke user configuration routing\n");
- fprintf(stderr, "\t-v ... print all potentially useful info\n");
- fprintf(stderr, "\t-C ... use cdrom as root\n");
- fprintf(stderr, "\t-D ... boot a kernel from a DOS medium\n");
- fprintf(stderr, "\t (default: c:\\kernel)\n");
- exit(1);
-}
-
-static unsigned int memsize(int x)
-{
- unsigned int rt=0;
-
- switch (x) {
- case 1:
- _asm {
- mov bl,1
- mov ah,88h
- int 15h
- mov rt,ax
- }
- break;
- default:
- _asm {
- int 12h
- mov rt,ax
- }
- break;
- }
- return rt;
-}
-
-int main(int argc, char *argv[])
-{
- char *kernel="/kernel", *ptr;
- int i, dos=0;
- long howto=0;
- extern unsigned long get_diskinfo(int);
-
- VCPIboot = 0;
- slice = 0;
-
- for (i = 1; i < argc; i++) { /* check arguments */
- if (argv[i][0] != '-') { /* kernel name */
- kernel = argv[i];
- break;
- }
- ptr = &argv[i][1];
- while (*ptr) { /* check options */
- switch(*ptr) {
- case 'r': howto |= RB_DFLTROOT; break;
- case 's': howto |= RB_SINGLE; break;
- case 'a': howto |= RB_ASKNAME; break;
- case 'c': howto |= RB_CONFIG; break;
- case 'd': howto |= RB_KDB; break;
- case 'g': howto |= RB_GDB; break;
- case 'v': howto |= RB_VERBOSE; break;
- case 'C': howto |= RB_CDROM; break;
- case 'D': dos = 1; kernel = "c:\\kernel"; break;
- case '?':
- default: usage(argv[0]);
- }
- ptr++;
- }
- }
-
- bootinfo.bi_version = BOOTINFO_VERSION;
- for (i = 0; i < N_BIOS_GEOM; i++)
- bootinfo.bi_bios_geom[i] = get_diskinfo(0x80+i);
- bootinfo.bi_basemem = memsize(0);
- bootinfo.bi_extmem = memsize(1);
- bootinfo.bi_memsizes_valid = 0; /* that is not yet valid!! */
- bootinfo.bi_kernelname = (char *) ptr2pa(kernel);
- bootinfo.bi_nfs_diskless = NULL;
- bootinfo.bi_size = sizeof(bootinfo);
-
- if (dos)
- dosboot(howto, kernel); /* boot given kernel from DOS partition */
- else
- bsdboot(0x80, howto, kernel); /* boot from FreeBSD partition */
- return 0;
-}
diff --git a/sys/i386/boot/dosboot/fbsdboot.exe.uu b/sys/i386/boot/dosboot/fbsdboot.exe.uu deleted file mode 100644 index 19df2f4..0000000 --- a/sys/i386/boot/dosboot/fbsdboot.exe.uu +++ /dev/null @@ -1,503 +0,0 @@ -begin 664 fbsdboot.exe -M35K7`2P`FP!```$,___^#P`4```8`/D!'@````$`L`(``)<"```+`@``U0`` -M`,P```"]````K@```)\```"0````@0```'(```!C````5````$4````V```` -M(P```!0````H`BL`F@`K`!@'*P`.!RL`]`8K`*,&*P"9!BL`B08K`!P$*P#L -M`RL`U@,K`'$'*P"?`[(`90.R`$X#L@`W`[(`(P.R``8#L@#N`K(`U@*R`&0" -ML@!+`K(`.@*R`!X"L@#V`;(`Y0&R`*X!L@"D`;(`B`&R`$<!L@#Z`+(`\`"R -M`-P`L@"Z`+(`L`"R`(0`L@!7`+(`8`2R`/@#L@#N`[(`V@.R`+4"^`!T`O@` -M-P'X`#$$^``;!/@`_0/X`-X#^`#<`DP!IP%,`74!3`%/`$P!R05,`9(%3`$U -M!4P!9@1,`;4#J@%V`ZH!7@.J`?P"J@'K`JH!O@*J`:("J@%F`JH!50*J`1\" -MJ@$5`JH!^0&J`;@!J@&A`:H!5`&J`4H!J@$V`:H!%`&J`0H!J@'>`*H!R0"J -M`8\`J@%N`*H!.0"J`>\$J@&9!*H!<P2J`58$J@$T!*H!X`.J`<D#J@$F`/D! -MO@#Y`<,`^0'*`/D!Y0#Y`0<!^0$H`?D!```?!-0-)`10`OD!SP7Y`?0&^0'G -M!OD!S`;Y`:L&^0&/!OD!50?Y`3H'^0$5!_D!@0?Y`3<)^0$$`"\%6@GY`68) -M^0$T#B0$+@XD!.H/)`0-"_D!.`OY`5L,^0$>#?D!I`[Y`7T.^0$<#OD!P0WY -M`:<7^0%D$"0$:!`D!&P0)`1P$"0$=!`D!'@0)`1\$"0$-1GY`;$9^0%]&?D! -M,QOY`=P:^0$'&OD!I1OY`6(?^0$````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M`````````````````````````````````````````````%6+[&9H`0`'`!YH -M0@`>:&`.FEP'^0&+Y1YH7@`>:&`.FEP'^0&+Y6;_=@8>:*8`'FA@#II<!_D! -MB^4>:,P`'FA@#II<!_D!B^4>:.``'FA@#II<!_D!B^4>:`$!'FA@#II<!_D! -MB^4>:"4!'FA@#II<!_D!B^4>:$\!'FA@#II<!_D!B^4>:'@!'FA@#II<!_D! -MB^4>:*,!'FA@#II<!_D!B^4>:,X!'FA@#II<!_D!B^4>:.D!'FA@#II<!_D! -MB^4>:!("'FA@#II<!_D!B^5J`9KS`?D!R<N0R`(``,=&_@``BT8&2'4/LP&T -MB,T5B4;^BT;^R<N0S1+K\\@8``!75L=&[C`"C%[P9BO`9HE&^(E&[*.6>V:C -M(IVY`0`Y3@8/CL\`BT8(BU8*!00`B]B)5O2.1O0FQ#<F@#PM#X6C`$:,1OXF -M@#P`#X2)`(E.]HE>\B:*!)@]=@!T9G<2/&-T2'\<+$-T)O[(="@L'70TQ%X( -M9B;_-P[HA?Z#Q`3K1BQD="PL#G0N_LAT,.OB@$[Y(.LRQT;L`0#'1NXX`HQ> -M\.LCD(!.^`'K'(!.^03K%H!.^$#K$(!.^"#K"H!.^`+K!(!.^0B.1OY&)H`\ -M`'6#BU[RBT[V@\,$03M.!@^,4O_K$9"+V<'C`L1V"&8FBP!FB4;NQP;6G`$` -M,_^)/MB<ON:<C86``%":"`#X`(/$`HD$B50"@\8$1X'^!IURY(M^[FH`#NBR -M_H/$`J,.G<<&$)T``&H!#NB@_H/$`J,2G<<&%)T``,8&"IT`B]>+3O"`Y@\# -MTA/)$](3R1/2$\D3TA/)$]*'T8/A#P/7@]$`B1;:G(D.W)QF*\!FH]Z<QP8& -MG4@`HPB=.4;L=!;_=O!79O]V^)I"!*H!@\0(,\!>7\G+_W;P5V;_=OAH@`": -MJ@.R`(/$"C/`7E_)RY#(!```5HM&#HE&_(M&$`M&#G4'N/__7LG+D(M&_$BC -M4@*+3@@KT@/)$](#R1/2`\D3T@/)$](#3@:#T@`S#E0",Q96`BKV,0Y4`C$6 -M5@*+#E0"BQ96`K:2B196`J-:`HM&"HM6##,&7`(S%EX"*O8Q!EP",19>`J%< -M`HL67@*VDHD67@+1;OQ@M(>+3OR[(`2.P[Y"`LT5B&;^88I&_BKD7LG+D,@$ -M``!6QP9Z`D<`C-@KT@/`$](#P!/2`\`3T@/`$](%<@*#T@`S!GP",Q9^`BKV -M,09\`C$6?@*+%GX"MI*)%GX"QP:"`O\'C-@KT@/`$](#P!/2`\`3T@/`$](% -M\@*#T@`S!H0",Q:&`BKV,0:$`C$6A@*AA`*+%H8"MI*)%H8"C%[\QP:*`O__ -MBT;\*](#P!/2`\`3T@/`$](#P!/2,P:,`C,6C@(J]C$&C`(Q%HX"H8P"BQ:. -M`K:2B1:.`HQ&_,<&D@+__XM&_"O2`\`3T@/`$](#P!/2`\`3TC,&E`(S%I8" -M*O8Q!I0",1:6`J&4`HL6E@*VDHD6E@*,5OS'!IH"``"+1OPKT@/`$](#P!/2 -M`\`3T@/`$](S!IP",Q:>`BKV,0:<`C$6G@*AG`*+%IX"MI:)%IX"C$[\QP:B -M`O__BT;\*](#P!/2`\`3T@/`$](#P!/2,P:D`C,6I@(J]C$&I`(Q%J8"H:0" -MBQ:F`K::B1:F`F"TB;L@!([#OG("NR`HS16(9OYA@'[^`'0(BD;^*N1>R<NX -M,``VB48$,\!>R<O(`@``9L<&?`(`````QP:$`@``,\"CA@*C>@*C@@*CB@*C -MC`*CC@*,3O['!I("__^+1OXKT@/`$](#P!/2`\`3T@/`$](S!I0",Q:6`BKV -M,0:4`C$6E@*AE`*+%I8"MIJ)%I8"C%[^QP::`O__BT;^*](#P!/2`\`3T@/` -M$](#P!/2,P:<`C,6G@(J]C$&G`(Q%IX"H9P"BQ:>`K:2B1:>`HQ6_L<&H@(` -M`(M&_BO2`\`3T@/`$](#P!/2`\`3TC,&I`(S%J8"*O8Q!J0",1:F`HL6I@*V -MEHD6I@+'!JH"!P",V"O2`\`3T@/`$](#P!/2`\`3T@7J`H/2`#,&K`(S%JX" -M*O8Q!JP",1:N`HL6K@*V@HD6K@+'!K("*P",V"O2`\`3T@/`$](#P!/2`\`3 -MT@78$8/2`#,&M`(S%K8"*O8Q!K0",1:V`HL6M@*V@8D6M@+)RY#($@``5F:+ -M1@9FN0`$``!FF6;W^6:+T&;!ZA`%`P`D_(E&_AYH!`L>:`<+FD`'^0&#Q`B) -M1NZ)5O`+T'0\_W;P4)H^!OD!@\0$8+@`WLUGB5[XB4;V8?9&]_]U'<<&EGL! -M`(I&^"KD4(I&^9A0'F@0"YH0"?D!@\0(@4;^@`!@N`!#S2\\@'0283/`NA$` -M7LG+D&$SP)E>R<N0N!!#S2^)7O*,1O2T"/]>\CM&_G+CBU;^M`G_7O(]``!T -MUK0,_U[R/0``=,R)7OR)5OIABT;\F8M.^H/!`BO;`\,3T5[)R\@J``!75HS8 -M*](#P!/2`\`3T@/`$](#P!/2!;H"@](`B4;\B5;^9L=&^````)^,3O*X=`B) -M1O2+1O(KT@/`$](#P!/2`\`3T@/`$]*)1N2)5N8#1O2#T@")1N")5N(>C,B. -MV+M2"#Z('DP(/H@^30B[70B)7O"[8@B)7NZ[9PB)7NR,7O(?BT[RB_$KVXO[ -MB]$#7O`3]X/#`1/WCL9FBTX*9B:)#XE^UHE6V`-^[H/2`(/'`8/2`(["9HM& -M!F8FB06+1@Z+5A"+7NPKR0->UA-.V(/#`8/1`([!)HD')HE7`HS8*](#P!/2 -M`\`3T@/`$](#P!/2!:A[@](`B4;HB5;J'HS(CM@VBU[H-HM.ZCZ('AH(/H@^ -M&P@^B`X<"#Z(+AT('V:+1@[$7OB#1O@$9B:)!\1>^(-&^`1F)L<'"````&:+ -M1N#$7OB#1O@$9B:)!V:+1A+$7OB#1O@$9B:)!V:+1A;$7OB#1O@$9B:)!\1> -M^(-&^`1F*\!F)HD'Q%[X@T;X!&8FB0?$7OB#1O@$9B:)!XS8*](#P!/2`\`3 -MT@/`$](#P!/2!=:<@](`Q%[X@T;X!":)!R:)5P)FBT;\9J/T"HM&Y(M6YC,& -MU`(S%M8"*O8Q!M0",1;6`H,^EGL`=3\.Z$/ZB4;:"\!U"OJX&`".V.G'`9`> -M:#<+'FA@#II<!_D!@\0('FA8"QYH8`Z:7`?Y`8/$"&H`FO,!^0&#Q`*,V"O2 -M`\`3T@/`$](#P!/2`\`3T@5R`H/2`*/Z"HD6_`J,V"O2`\`3T@/`$](#P!/2 -M`\`3T@7R`H/2`*,`"XD6`@L.Z&3[:``@FH$@^0&#Q`*)1MR)5MX+T'4:'FAH -M"QYH8`Z:7`?Y`8/$"&H`FO,!^0&#Q`)F,\!FN0`(``"+7MR+5MZ+^X["\V:K -M*\D#TA/)`](3R0/2$\D#TA/)`U;<$\B!PO\/$\B!X@#PB5;HB4[JT?G1VM'Y -MT=K1^=':T?G1VHE6]AY65[@@!([8N'("!0@`B_"+1O:.P#/_N`'>S6=?7A]F -MBT;H9@4#````NP`0BT[VCL%F)HD&`!"+1NB+5NJ`Q!"#T@"CJ'N)%JI[C-@K -MT@/`$](#P!/2`\`3T@/`$](%^`J#T@"CK'N)%JY[C-@KT@/`$](#P!/2`\`3 -MT@/`$](%_@J#T@"CL'N)%K)[9L<&M'LX`$``N",(B4;TBT;TH[A[9L<&NGL` -M`"``^F:^`````+@,WLUG9@\@P&8E____?V8/(L!F,\!F#R+8N"@`CMB.P+@P -M`([0^@\!%O(*9NH`````&`"[$````([;CL..T[D`````O@````"_```0`/.D -MO`#P"0#+Z?W_7E_)RY#(!```5U9F,\"[(!-FN0`$``"+^QX'\V:K9H-^"@!T -M16:+1@J+5@QF/0`0``!V!3/2N``0B4;\B5;^4E!F_W8&'F@@$XOPB_J:#``K -M`(/$#&:+1OQF`48&*78*&7X,9H-^"@!UNUY?R<N0R!```&9J(!YHV!*::@!, -M`8/$"($^V!('`70N@3[8$@@!=":!/M@2"P%T'H$^V!+,`'06'FB`"YH0"?D! -M@\0$:@":\P'Y`8/$`F:A[!*+%NX29J,@(RKVB4;\B5;^4E`>:)$+FA`)^0&# -MQ`B#?OX0?QA]%AYHH@N:$`GY`8/$!&H`FO,!^0&#Q`*!/M@2"P%U!;D`$.L/ -M@3[8$LP`=00SR>L#N2``*\`##MP2$P;>$@,.X!(3!N(2`P[H$A,&ZA*)#J![ -MHZ)[9FH$C4;P%E"::@!,`8/$"&:AW!)F`P;@$F8#!N02Q%X&9B:)!V8%_P\` -M`"4`\&8FB0=FBT;P9@,&Z!)F!00```!F)@$'9B;_-YJH`RL`@\0$B4;TB5;V -MB4;\B5;^"]!U%AYHN@N:$`GY`8/$!&H`FO,!^0&#Q`*!/M@2"P%U!;D`$.L/ -M@3[8$LP`=00SR>L#N2``B0Z@>\<&HGL``&;_-MP2'FC@"YH0"?D!@\0(9O\V -MW!)F_W;\F@P`3`&#Q`AFH=P29@%&_/=&_/\/="1FBT;\9HE&^&9J`690'FCL -M"YH,`"L`@\0,9O]&_/=&_/\/==QF_S;@$AYH[@N:$`GY`8/$"&;_-N`29O]V -M_)H,`$P!@\0(9J'@$F8!1OQF_S;D$AYH^@N:$`GY`8/$"&;_-N029O]V_`[H -MEOV#Q`AFH>029@%&_(M&_"M&]`,&(".`Y`\KTHE&^(E6^@O0=!)FN``0``!F -M*T;X9HE&^&8!1ORA(".+%B(C*O8K1O0;5O8#1OP35OZC%IV)%AB=9FH$9O]V -M_!YHZ!*:#``K`(/$#&;_-N@29FH$9O]V^!YH!0R:$`GY`8/$$&;_-N@29H-& -M_`1FBT;\9E":#`!,`8/$"&:+1OQF`P;H$F:)1OQF:@2-1O`64)IJ`$P!@\0( -M9FH$9O]V_(U&\!90F@P`*P"#Q`QF@V[P!&;_=O!J!!YH(0R:$`GY`8/$"F;_ -M=O!F@T;\!&:+1OQF4)H,`$P!@\0(9HM&_&8#1O!FB4;\BU;^BPX@(XL>(B,J -M_P/!$],K1O0;5O:C&IV)%AR=4U%24!YH+PR:$`GY`8M&](M6]LG+D,@(``!6 -MBW8,9BO`9J.`66:CI'N*1@8E@``]`0`;P"4"`)FCBGN)%HQ[_W8.5IIP!4P! -M@\0$"\!T&O]V#E8>:$X,FA`)^0&#Q`AJ`)KS`?D!@\0"C4;X%E`.Z'#\@\0$ -MB4;\B5;^9J&D>V;!X`AFB]!FP>H0BPXBG8#-^L'A!(OQB]@+\J&`62O)"_`+ -M'HI["S:,>U93BT8(BU8*@,Z`4E"A(".+%B(C(O%24&;_=OAF_W;\FH@$*P"# -MQ!1>R<O(!@``BD8&B$;^M`B*5O[-$X#\`'0.*\"*_+,"M4^Q#[8!L@&*YHK! -M)#^)1OHSVXK9@./`P>,"BMV)7OR+1OJ+5OS)R\@.``!75HL^.IU7#NBM_X/$ -M`HE&_(E6_BKDHR0EB\B+1OR*Q(K6`O8:]BKD0/?IHR8E@_\"=2%FQP:$60`` -M``"#^0]U!;@#`.L#N`$`F:.D>XD6IGOI%@)F:@!7#NB&`H/$!KCB)(OPC%[V -M9K@!````9HE&^&:C(IW'1OX``(E^\HM>_HY&]B:`?`2E=`R#QA!#@_L$?/#K -M%Y"-1P*9HR*=B18DG68FBT0(9D!FB4;X9O]V^/]V\@[H*P*#Q`:X)".)1OR, -M7OX>O\*;B_`>!V:Y10```/-FI1^+V&:!/U=%5H)T%!YH7@R:$`GY`8/$!+@! -M`%Y?R<N09H,^BGL$=!!F@SZ*>P!T"&:#/HI[`747@SXH(P1U!;@$`.L",\`S -MTJ.*>XD6C'N+'J1[P>,$N"0C`]AFBX^8`&:)#H199HN/E`!FB0Z^F\<&B%D` -M`(O8]D=8!`^$%P%F@SZ\(P!T$XN'M`"+E[8``X>X`!.7N@#K")"A8".+%F(C -MB4;\B5;^9HM'+&8I1OQF@7\H``(``'859J%,(V;!Z`EF]V[\9HO09L'J$.LC -M9K@``@``9C/29O<V3"-F4&:+1OQF668STF;W\6:+T&;!ZA")1OR)5OXS]HDV -MB%G'1O@D(XQ>^HM^\F8/O\9F`T;\9E!7#NCW`(/$!H,^*",`=0B!/BHC(4-T -M+X/&`H/^"GT1B\:9.192(W?.<@8Y-E`C=\:#/HA9`'4W'FAL#)H0"?D!@\0$ -MZS^0B7;VBT;XBU;Z'K^*>8OP'@>.VF:Y@````/-FI1_'!HA9`0"+=O;KPF8/ -MO\9F`T;\9E`>:'\,FA`)^0&#Q`@SP%Y?R<O("@``5U9FH1Z=9HE&^*$ZG8E& -M]F8KP&:)1OPY!I1[?$U_!CD&DGMT16;_=OAF_T;X_W;V#NA^`8/$!E)0_W;V -M#N@N`(/$!HM>_,0VF'N-.+XD(V:Y@````/-FI6:ADGN`1OT"@U;^`&8Y1OQ\ -MNUY?R<O($```5U:+=@8Y-BA)=19FH2Y)9CE&"'P,9J$J268Y1@@/C/X`H28E -MF5)09O]V"(E&](E6]F989EEFF6;W^6:+T&;!ZA")1OZA)"694E")1O")5O)F -MBT8(9IEF]W[T9HO"9EEFF6;W^6:+T&;!ZA")1OQFBT[P9HM&"&:99O?Y9HO" -M9L'J$(OXH20E*\>)1OH]$@!^!<=&^A(`'F@H)?]V^E?_=OS_=OY6F@0`J@&# -MQ`X+P'13'F@H);@!`(E&^E!7_W;\_W;^5IH$`*H!@\0."\!T-(E^^(MV_HM^ -M_/]V^%=6'FB?#)H0"?D!@\0*'F@H)6H!_W;X5U;_=@::!`"J`8/$#@O`==6+ -M1@:C*$EFBT8(9J,N268/OT;Z9@-&"&:C*DF+1@@K!BY)P>`)!2@EOR0CB_`> -M!V:Y@````/-FI5Y?R<O("@``5U:#/HA9``^$O0",7OYFH8199CE&"`^,K@!F -MH;Z;9@,&A%EF.T8(#XZ=`+O"FV:+1@AF,])F]W<XB_B[PIMFBT8(9C/29O=W -M.&:+PF8STF;W=RR*X"K`B_"[PIMFBT8(9C/29O=W+&:+PF;!ZA`#\,=&^@`` -MQT;^DGF+7OZ+3OJ+UCD_=0@Y5P)U!^L4D#D_=PQ!@\,$@?N*>W+FZP.Y?@"# -M^7YT(HO!F;O"FXOZBT<\BU<^*T<L&U<N*\$;URT!`(/:`%Y?R<N+1@B+5@I> -M7\G+R`0``&;'1OP`$```9H-^"@!^2&:!?@H`$```?0AFBT8*9HE&_&;_=OP> -M:(!)#N@M`(/$"&;_=OQF_W8&'FB`29H,`"L`@\0,9HM&_&8!1@9F*48*9H-^ -M"@!_N,G+D,@0``!75F:#?@H`#X1O`<0>CGLFBT=()HM72O?0]](C!J![(Q:B -M>XE&](E6]F:AH'LFBD]09M/X9HE&^(M6^F8]#````'U9!0$`@](`Q!Z.>R:* -M3U`*R70(`\`3TO[)=?@[%FJ=<CEW!CL&:)UV,<0>CGLFBT=()HM72O?0]](C -M!FB=(Q9JG28#1S0F$U<V+0$`@]H`)B-'3"8C5T[K#9#$'HY[)HM',":+5S*) -M1OR)5OYF_W;X#NB^`X/$!,0>CGLFBD]D"LET"`/`$]+^R77X`P:$61,6AEF) -M1O")5O)FBT;\9J.2>V:+1O!FHQZ=9H-^]`!U&F:+1@IF.4;\?Q!FBT8&9J.8 -M>YK``O@`ZT^0QP:8>^"=C!Z:>XM&"HM6#&:+3O1F*4[\.5;^?`U_!3E&_'8& -MB4;\B5;^FL`"^`"+1O0#!IA[BQ::>XM._!Z+\([:Q'X&T>GSI1/)\Z0?BT;\ -M`48&BU;^`0:@>Q$6HGLI1@H95@QF@WX*``^%D?Y>7\G+R!8``%=69L=&_`(` -M``"XX)VCF'N,'II[Q!Z.>V8FBT<P9J.2>V8F_W<89B;_M[@`9HM&_&999IEF -M]_EFB]!FP>H0Q!Z.>R:+3QPFBW<>]]'WUHOXB]HCP2/64E"+\V989EEF]^G$ -M'HY[9B;_=WAF)O^WN`!FB4;J9HM&_&999IEF]_EFB\)F66:99O?YQ!Z.>R:* -M3V!FT^!F`T;J9B;_M[P`9HO09L'J$%97B_"+^F989EEF]^EFB]!FP>H0`_`3 -M^L0>CGLF`W<0)A-_$B:*3V0*R70(`_83__[)=?@#-H19$SZ&68DV'IV)/B"= -MFL`"^`#$'HY[9B;_=WAFBT;\9EEFF6;W^6:+PF;!ZA#!X`<#!IA[BQ::>QZ_ -M8)V+\!X'CMIFN2````#S9J4?Q%X&)H`_``^$L0&.7@B`/R]U"4.`/R]T^HE> -M!A8?9H,^:)T`#X2<`8HF89V`Y/"`_$`/A8X!BU8(B_.)5O".VNL'@'[W+W0* -M1HH$B$;W"L!U\,8$`&;'1OP`````B7;N%A]FH6B=9CE&_`^#5@'$'HY[)HM' -M2":+5TKWT/?2(T;\(U;^B4;R"]`/A<,`9HM&_":*3U!FT_AFB4;XBU;Z9CT, -M````?5D%`0"#T@#$'HY[)HI/4`K)=`@#P!/2_LEU^#L6:IUR.7<&.P9HG78Q -MQ!Z.>R:+1T@FBU=*]]#WTB,&:)TC%FJ=)@-'-"835S8M`0"#V@`F(T=,)B-7 -M3NL-D,0>CGLFBT<P)HM7,J.2>XD6E'MF_W;X#NBO`(/$!,0>CGLFBD]D"LET -M"`/`$]+^R77X`P:$61,6AEFC'IV)%B"=N."=HYA[C!Z:>YK``O@`BU[RC@:: -M>P,>F'N)7OB,1OHFBT<$*](!1OP15OYF)H,_``^$[/Z#PPB+^Q[%=@:Y__\S -MP/*N]]$K^?.F=`4;P!W__Q\+P`^%R/[$7OAF)HL'9HE&_(MV[HM&\(EV!HE& -M"(I.]X[`)H@,Z2;]N`$`7E_)RY`SP%Y?R<M5B^QF@WX&#'T0BUX&P>,"BX>( -MG8N7BIW)RV:AN)W$'HY[)HI/9&;3X&8#!H199J,>G68Y!K8,="3'!IA[BEF, -M'II[Q!Z.>V8FBT<P9J.2>YK``O@`9J$>G6:CM@S$'HY[9B;_=W1FBT8&9BT, -M````9EEFF6;W^6:+PF;!ZA"+V,'C`HN'BEF+EXQ9R<N0R`0``%:+1@:+5@B+ -M\(E6_F;'!IQ[@````,<&.IV``)I,`/@`"\!T!K@!`%[)R[B^>Z..>XP>D'NC -MF'N,'II[9L<&DGL`(```9J&$668%$````&:C'IV:P`+X`/]V_E8.Z!G\@\0$ -M"\!TOF8KP&:CH'M>R<O(#@``BT8&B4;RBT8*B4;TBT8(B4;VBT8,0(E&^(M& -M#HE&^F:+1A!FB4;\C4;R%E!J`IJ('/D!*L#)RY#("```5U:^`!!F@WX.`'Y; -MBWX&9H%^#@`0``!]`XMV#O]V"%=J`58>:(!)FIP'^0&#Q`R+QIE25F;_=@H> -M:(!)B7;\B5;^B7;XB5;ZF@P`*P"#Q`QFBT;X9@%&"F:+1OQF*48.9H-^#@!_ -MJ%Y?R<N0R!```%:+=@;_=@A69F@@``$`'F@R29J<!_D!@\0,9F@```$`:.`/ -M_W8(5II,&?D!@\0*@3XR20<!="Z!/C))"`%T)H$^,DD+`70>@3XR2<P`=!8> -M:+X,FA`)^0&#Q`1J`)KS`?D!@\0"9J%&28L62$EFHWI)*O:)1OR)5OY24!YH -MSPR:$`GY`8/$"(-^_A!_&'T6'FC@#)H0"?D!@\0$:@":\P'Y`8/$`H$^,DD+ -M`74%N0`0ZP^!/C))S`!U!#/)ZP.Y(`!J`"O``PXV21,&.$D##CI)$P8\20,. -M0DD3!D1)B0Z@>Z.B>U!1_W8(5II,&?D!@\0*_W8(5F9H!``!`(U&\!90FIP' -M^0&#Q`QFH39)9@,&.DEF`P8^2<1>"F8FB0=F!?\/```E`/!F)HD'9HM&\&8# -M!D))9@4$````9B8!!V8F_S>:J`,K`(/$!(E&](E6]HE&_(E6_@O0=18>:/@, -MFA`)^0&#Q`1J`)KS`?D!@\0"@3XR20L!=0:Y`!#K$)"!/C))S`!U!#/)ZP.Y -M(`!J`"O`B0Z@>Z.B>U!1_W8(5II,&?D!@\0*9O\V-DD>:!X-FA`)^0&#Q`AF -M_S8V26;_=OS_=@A6#NC$_8/$#&:A-DEF`4;\]T;\_P]T)&:+1OQFB4;X9FH! -M9E`>:"H-F@P`*P"#Q`QF_T;\]T;\_P]UW&;_-CI)'F@L#9H0"?D!@\0(9O\V -M.DEF_W;\_W8(5@[H;/V#Q`QFH3I)9@%&_&;_-CY)'F@X#9H0"?D!@\0(9O\V -M/DEF_W;\F@P`L@"#Q`AFH3Y)9@%&_(M&_"M&]`,&>DF`Y`\KTHE&^(E6^@O0 -M=!)FN``0``!F*T;X9HE&^&8!1ORA>DF+%GQ)*O8K1O0;5O8#1OP35OZC%IV) -M%AB=9FH$9O]V_!YH0DF:#``K`(/$#&;_-D))9FH$9O]V^!YH0PV:$`GY`8/$ -M$&;_-D))9H-&_`1FBT;\9E#_=@A6#NBM_(/$#&:+1OQF`P9"26:)1OS_=@A6 -M9F@$``$`C4;P%E":G`?Y`8/$#&9J!&;_=OR-1O`64)H,`"L`@\0,9H-N\`1F -M_W;P:@0>:%\-FA`)^0&#Q`IF_W;P9H-&_`1FBT;\9E#_=@A6#NA$_(/$#&:+ -M1OQF`T;P9HE&_(M6_HL.>DF+'GQ)*O\#P1/3*T;T&U;VHQJ=B18<G5-14E`> -M:&T-FA`)^0&#Q`R+1O2+5O9>R<O(#```5U:+?@H>:(P-_W8,5YI`!_D!@\0( -MB_")5OH+T'48_W8,5QYHCPT>:&`.FEP'^0&#Q`Q>7\G+C4;T%E#_=OI6#N@G -M_(/$"(E&_(E6_O]V^E::/@;Y`8/$!&:AI'MFP>`(9HO09L'J$(L.(IV`S?K! -MX02+\8O8"_*A@%DKR0OP"QZ*>PLVC'M64XM&!HM6"(#.@%)0H7I)BQ9\22+Q -M4E!F_W;T9O]V_)J(!"L`@\047E_)RP````````````````````"T,,TA/`)S -M!3/`!E#+OR`$BS8"`"OW@?X`$'(#O@`0^H[7@<3>O?MS$A8?#NA?`C/`4`[H -M.P6X_TS-(3:C[`V&X#:CZ@V+QK$$T^!(-J.J#;NL#3:,%X/D_C:)9P2X_O]0 -M-HEG"O?04#:)9P8VB6<(-HDFI@T#]XDV`@",PRO>]]NT2LTA-HP>Z`T6!_R_ -MV!&YX+TKSS/`\ZH6'XL.UA#C`O_1FKX$^0&:%@/Y`3/MFBH!^0$6'_\V$`[_ -M-@X._S8,#O\V"@[_-@@.FOP```!0#N@'`<,NH2@!CMBX`P#'!J@-\P%0+HL> -M*`&.VYH\!OD!#NB9`0[H>`2!/M@0UM9U!EA0_Q;<$+C_`%`._Q:H#2`$N``U -MS2&)'M0-C`;6#0X?N``ENNT`S2$6'XL.Z!#C*8X&Z`TFBS8L`*'J$(L6[!`S -MV_\>YA!S`^ED`:'N$(L6\!"[`P#_'N80C@;H#2:+#BP`XSZ.P3/_)H`]`'0T -MN0T`OL8-\Z9T"[G_?S/`\JYU(>OE!AX''XOWO_0-L02L+$%R#=+@DJPL07(% -M"L*JZ^X6'[L$`("G]`V_N`!$S2%R"O;"@'0%@(_T#4!+>>>^\A"_\A#HLP"^ -M\A"_\A#HJ@"^]A"_]A#HH0#+58OL,\GK&E6+[+D!`.L258OL5E>Y``'K"%6+ -M[%97N0$!B"X?#E$*R74>OGY)OWY)Z&T`OO(0O_80Z&0`@3[8$-;6=03_%MX0 -MOO80O_80Z$\`OO80O_80Z$8`FO("^0$+P'016`KD4'4+@WX&`'4%QT8&_P#H -M$`!8"N1U!XM&!K1,S2%?7EW+BP[H$.,'NP(`_Q[F$![%%M0-N``ES2$?PSOW -M<PZ#[P2+!0M%`G3R_QWK[L-5B^RX_`!0#NC8`H,^(@X`=`3_'B`.N/\`4`[H -MQ0*+Y5W+N`(`Z2[^65J+W"O8<@L['B@.<@6+XU)1RU)1H20.0'4%,\#I#O[_ -M+B0.5C/VN4(`,N3\K#+@XON`]%5T#P[HG?^X`0!0#NAX`K@!`%[+CP8J#H\& -M+`ZA[`VZ`0`\`G0IC@;H#2:.!BP`C`84#C/`F;D`@#/_\JZN=?M'1XD^$@ZY -M___RKO?1B]&_`0"^@0".'N@-K#P@=/L\"73W/`UT;PK`=&M'3JP\('3H/`ET -MY#P-=%P*P'18/")T)#Q<=`-"Z^0SR4&L/%QT^CPB=`0#T>O3B\'1Z1/1J`%U -MRNL!3JP\#70K"L!T)SPB=+H\7'0#0NOL,\E!K#Q<=/H\(G0$`]'KVXO!T>D3 -MT:@!==+KEQ8?B3X(#@/71]'GT><#UT*`XOXKXHO$HPH.C!8,#HO8`_L6!S:) -M/S:,5P*#PP3%-A(.K*H*P'7Z-HX>Z`V^@0#K`S/`JJP\('3[/`ET]SP-=0/I -M@P`*P'4"ZWTVB3\VC%<"@\,$3JP\('37/`ETTSP-=&(*P'1>/")T)SQ<=`.J -MZ^0SR4&L/%QT^CPB=`:P7/.JZ]&P7-'I\ZIS!K`BJNO%3JP\#70N"L!T*CPB -M=+<\7'0#JNOL,\E!K#Q<=/H\(G0&L%SSJNO9L%S1Z?.J<Y:P(JKKS3/`JA8? -MQP<``,='`@``_RXJ#E6+[(/L!!Z.!N@-)HL>+`".PXQ&_C/`,_8S_[G__PO; -M=`XF@#X```!T!O*N1JYU^HO'0"3^1HO^T>;1YKD)`.C``%)0B\;HN0"C#@Z) -M%A`.B5;\!A^+SXO8,_9?!TGC,XL$-CL&Q@UU%%%65P86![_&#;D&`/.G!U]> -M670+CE[\B3^,1P*#PP2.7OZLJ@K`=?KBS8Y>_(D/B4\"'XOE7<M5B^Q65QX' -MBU8&OOX0K3O"=!!`EG0,ES/`N?__\JZ+]^OKEE]>B^5=R@(`58OL5_]V!@[H -MRO\+P'0@DHOZ,\"Y___RKO?12;L"`($^V!#6UG4$_Q;:$+1`S2%?B^5=R@(` -M`%,&4;D`!(<.H!!14)J!(/D!6X\&H!!9B]H+V'0#!UO#B\'I%_L`<A4SP(OE -M7<MS^%#H&@!8,N2+Y5W+<P?H#@"X__^9B^5=RS+DZ`$`RZ+P#0KD=2*`/NL- -M`W(,/")S##P@<@2P!>L&/!-V`K`3NRX.UYBCX@W#BL3K]P#+`%6+[(/L$%=6 -MO___BT8&B_"+V/9'"D!T",9'"@#IIP"0]D0*@W4#Z9D`'E;H9@>#Q`2+^(O> -M@>M(#HN'/`^)1OX>5NAO!(/$!(I$"RKD4)H.%/D!@\0""\!\98-^_@!T8KA" -M#AY0C4[T%E&:SACY`8/$"(U&]HE&\(Q6\H!^]%QT%;A$#AY0C4;T%E":>ACY -M`8/$".L$D/].\+@*`%#_=O+_=O#_=OZ:"AGY`8/$"(U&]!90FD0B^0&#Q`0+ -MP'0#O___QD0*`(O'7E^+Y5W+58OL@^P(FL`3^0&)5OX+T'4&,\"9ZQF0_W;^ -M4/]V#O]V#/]V"O]V"/]V!IIV"_D!B^5=RU6+[#/`4/]V#/]V"O]V"/]V!IH, -M!_D!B^5=RY!5B^R#[`975HMV!AY6Z$8%@\0$B_B-1@X64/]V#/]V"AY6FM8. -M^0&#Q`R)1OH>5E?HI`6#Q`:+1OI>7XOE7<N058OL@^P$5E>+1@KW9@R+R`O* -M=&.)1OR)5O[$7@:+=@X+TG4A@_C_=!R+RP/(XP)R%%!34HO(Z&H`B\A:6U@K -MP8/:`.L\@_L!=P6Y`(#K!(O+]]E14%-2Z$D`B\A:6UA?*\&#V@`[SW(8`]ES -M#(S!@<$`$([!ZP+K)(O("\IUH>L`B\@+RG03BT[\*\B+P8M._AO*B]'W=@KK -M`XM&#%]>B^5=RU6+[(/L!(E._K\X#XO&+4@.`_CV1`H,=07V!0%T!8M%`NL# -MN``"B4;\]D0*#'4%]@4!=#.+1`0+P'0L.\%V`HO!4%-1!E#_=`+_-`93#N@V -M$X/$"@=96U@KR"E$!`/8`03K`.-BZ\([3OQR,#/2B\'W=OR+P2O"4U$&4`93 -M,\"*1`M0#NBV#8/$"`=96PO`="R#^/]T+2O(`]CKQU-1!AY6#NB&`(/$!`=9 -M6X/X_W07)H@'0TF+10*)1OSKIH!,"A#K!(!,"B"+1OXKP8OE7<,`58OL@^P& -M5[A4#AY0Z),#@\0$B_B-1@H64/]V"/]V!KA4#AY0FM8.^0&#Q`R)1OJX5`X> -M4%?HZP.#Q`:+1OI?B^5=RY!5B^R:4@[Y`:`?#@K`=`6:)AGY`5W+58OL5E>+ -M=@:*1`JH@W1?J$!U6Z@"=4@,`8A$"HO^@>](#H''.`^H#'4-]@4!=0@>5NB, -M`8/$!(M$!HD$_W4"_W0(4#/;BEP+4P[HQ0R#Q`@+P'01@_C_=1J`3`H@ZPJ` -M3`H@ZPF`3`H0QT0$``"X___K)8J_]`V`YX*`_X)U"XI\"O;'@G4#@`T@2(E$ -M!,0<,\`FB@=#B1Q?7EW+58OL5E>+=@B*1`JH@G1JJ$!U9L=$!```J`%T"Z@0 -M=%F+3`:)#"3^#`(D[XA$"HO^@>](#H''.`\SVXI<"Z@(=5&H!'4>]@4!=4B! -M_E0.=`R!_F`.=`:!_G@.=2;VA_0-0'0?N0$`C7X&41974P[H@Q2#Q`BY`0#K -M1KC__X!,"B#K95,>5NB<`(/$!%OV1`H(=-&+#(M4!BO*0HD4BU4"2HE4!.,E -M45'_=`C_=`93#NA"%(/$"%G$?`:+5@8FB!4[P76V,\"*1@;K'3/`]H?T#2!T -MX[D"`%%04%,.Z$H)@\0(,\"+R.O/7UY=RP!5B^Q6BW8$BD0*J(-T)J@(="+_ -M=`C_=`::;B#Y`8/$!(!D"O<SP(E$!HE$"(D$B40"B40$7EW#`%6+[%:+=@2X -M``)0FH$@^0%9B]Z!ZT@.@<,X#PO2=`N`3`H(QT<"``+K#H!,"@3'1P(!`(S: -MC4<!B50"B02)5`B)1`;'1`0``%Y=PP!5B^R#[`Q75J"<$(A&_,=&^@``Q%X* -M)HH'F#UW`'17=P@L871;+!%T!S/`F>D&`9`S]L9&_@''1O@!`/]&"L1>"B:` -M/P!U`^F*`(-^^`!U`^F!`":*!Y@]=`!T/'<0+"MT)"PW=#[^R'1&+`MT5,=& -M^```Z\:0O@$#QD;^`NNWD+X)`>OTD/?&`@!UXH/.`H/F_L9&_H#KH_?&`,!U -MT('.`$#KE_?&`,!UQ('.`(#KBX-^^@!UN,=&^@$`@$[\0.EY_X-^^@!UIL=& -M^@$`@&;\O^EG_[BD`5#_=@Y6_W8(_W8&FK`4^0&#Q`J)1O8+P'T#Z37__P9& -M#HM&$(OXB\B!Z4@.@<$X#XO8BD;^B$<**\")10*)!8E%"(E%!HI&]HA%"XO9 -MBD;\B`<SP(E%!(E'!(O'C-I>7XOE7<N058OL5E>+=@2[+!"!_E0.=!*[,!"! -M_F`.=`F[-!"!_G@.=5B+_H'O2`Z!QS@/]D0*#'5(]@4!=4.+!XM7`HO("\IT -M(8E$!HE4"(D$B50"QT0$``+'10(``H!,"@+&!1&X`0#K&5.X``)0FH$@^0%; -M6PO2=`>)!XE7`NO(,\!?7EW#58OL5E>+=@:+_H'O2`Z!QS@/]@40="PSVXI< -M"_:']`U`="`>5NAW`(/$!(-^!`!T$C/`B`6)10*)!(E$`HE$!HE$"%]>7<-5 -MB^Q6BT8("T8&=0@SP%#HS@#K/O]V"/]V!N@[`(/$!`O`=`:X___K*9"+=@:! -M[D@.@<8X#_8$0'08Q%X&*N0FBD<+4)IL&_D!@\0"/0$`]1O`7HOE7<N058OL -M@^P"5U8S_XM&!(O8B_"*3PJ+T8#A`X#Y`G5)]L((=0N!ZT@.]H<X#P%T.8L$ -M*T0&B4;^"\!^+5#_=`C_=`:*1`LJY%":^A[Y`8/$"#M&_G4,]D0*@'0-@&0* -M_>L'@$P*(+___XM$!HM4"(D$B50"QT0$``"+QUY?B^5=PY"X`0!0Z`$`RU6+ -M[(/L`E=6OD@.,_^)?O[K(8-^!`!U&/9$"@)T$AY6FGH-^0&#Q`1`=07'1O[_ -M_X/&##DV*!!R'8-^!`%UT_9$"H-TS1Y6FGH-^0&#Q`1`=-Y'Z]N0@WX$`74$ -MB\?K`XM&_EY?B^5=P@(`D"X/.0]/#X,/KP^W#^`/$A!5B^RX%`(.Z.[S5E<S -MP(E&^(A&^\1V"B:LB78*B$;^"L!T!H-^^`!]!HM&^.FU!+LX$"P@/%AW!=<D -M#^L"L`"Q`]+@`D;[U_[!TNB(1ON8B]C1XR[_I\8.BE;^N0$`Z#8$Z[$SP(E& -M\(E&]HE&[L=&_"``2(E&].N;BD;^/"UU!H!._`3KCCPK=0:`3OP!ZX0\('4' -M@$[\`NEY_SPC=0>`3OR`Z6[_@$[\".EG_XI._H#Y*G4/Z%P#"\!Y%_?8@$[\ -M!.L/@.DP,NV+1O:["@#WXP/!B4;VZ3O_QT;T``#I,_^*3OZ`^2IU#.@H`PO` -M>12X___K#X#I,#+MBT;TNPH`]^,#P8E&].D*_XI&_CQL=0:`3OP0ZR(\1G4& -M@$[\(.L8/$YU!H!._1#K#CQ,=0:`3OT$ZP2`3OT(Z=C^BD;^/&1U`^F4`3QI -M=0/IC0$\=74#Z8H!/%AU`^F)`3QX=0/IB`$\;W4#Z:(!/&-T&CQS="<\;G11 -M/'!T8#Q%=`<\1W0#Z;L`Z;4`Z(H"C;[L_18'JD^Y`0#I\0'HD`(+_W42C,`+ -MP'4,'@>_D1"+#I<0Z=@!5XM.].,',L#RKG4!3UDK^8?/Z<,!Z&("BT;XJ_9& -M_!!T`S/`J^D[_O9&_#!U!>@R`NLYZ#8"]D;]&'4PQD;_![D0`!8'4C/2C;[T -M_;X$`.BP`KD0`(V^[_U8,]*^!`#HH`+&AO#].KD)`.L8QD;_![D0`!8',]*- -MON_]O@0`Z($"N00`C;[L_>E-`?]&[H!._$"*1OX,()B+\(-^]`!_$W0'QT;T -M!@#K"H/X9W4%QT;T`0"-ONS]_W;N_W;T5A97_W80_W8.]D;]!'0*_QZV$(-& -M#@KK"/\>HA"#1@X(@\0.]D;\@'0/@W[T`'4)%E?_'JX0@\0$@_YG=1#W1OR` -M`'4)%E?_'JH0@\0$%@<F@#TM=05'@$[]`;G__U>P`/*N3UDK^8?/Z:\`@$[\ -M0,9&^@KK-<9&_P?K!,9&_R?V1OR`=!''1O`"`,9&\C"R40)6_XA6\\9&^A#K -M#O9&_(!T!(!._0+&1OH(]D;\$'0%Z/L`ZP[H[0#V1OQ`=`.9ZP(STO9&_$!T -M#PO2?0N`3OT!]]B#T@#WVH-^]`!]!\=&]`$`ZP2`9OSWB]@+VG4%QT;P``"- -M?NL6!XI.^C+MBW;TZ$`!]D;]`G0.XP8F@#TP=`9/)L8%,$'K`/9&_$!T,?9& -M_0%T"\9&\BW'1O`!`.L@]D;\`70+QD;R*\=&\`$`ZP_V1OP"=`G&1O(@QT;P -M`0"+1O8KP2M&\'T",\`&5U'V1OP,=0>+R+(@Z+L`4!8'C7[RBT[PZ)$`6/9& -M_`AT#?9&_`1U!XO(LC#HFP!97P=0Z'8`6/9&_`1T!XO(LB#HA@#I`/S$=@XF -MK8EV#L/$=@XFK8O0)JV2B78.P_9&_"!T".CI_X["B_C#Z-C_B_@+P'4#CL## -M'@?#F`97Q%X&)O]/!'@0)HL_)O\')HY'`JHSP%\'PU%2!E-0#NC#]H/$!EI9 -M@_C_=>CKZ.,;B_<!3OA7,_\FK.C`_POXXO<+_U]T!<=&^/__P^,9`4[X5S/_ -MBL+HI/\+^.+W"_]?=`7'1OC__\/]5Y,+]G\*"]MU!@O2=0+K&I(STO?QD_?Q -MDH?3!#`\.78#`D;_JHO"3NO862O/1_S#7UZ+Y5W+58OL@^P$5KY(#BO`B4;^ -MB4;\ZP.#Q@PY-B@0<B;V1`J#=?'&1`H`QT0$```KP(E$"(E$!HE$`HD$QD0+ -M_XEV_(Q>_HM&_(M6_EZ+Y5W+58OLBUX&.Q[R#7(&N``)^>L+M#[-(7(%QH?T -M#0#IN/%5B^R#[`2+7@8['O(-<@6X``GK,8,^GA``=$_W1@H`@'1(@WX,`'0: -M,\F+T;@!0LTA<DOW1@P"`'4.`T8($U8*>2BX`!;YZS:)5OZ)1OR+T;@"0LTA -M`T8($U8*>0V+3OZ+5ORX`$+-(>O8BU8(BTX*BD8,M$+-(7(%@*?T#?WI3/$` -M58OL@^P$,O^`/NL-`W(#BGX,BT8.B48,ZPA5B^R#[`0R_XA^_HM&"HO(QD;\ -M`*D`@'40J0!`=0?V!IL0@'4$QD;\@![%5@8D`PK'M#W-(1]S$H/X`G4)]\$` -M`70#Z:4`^>GG\).+P24`!3T`!74)M#[-(;@`$>OHQD;]`;@`1,TA]L*`=`2` -M3OQ`]D;\0'0#Z=\`BT8*J0`"=!ZI`P!T"3/)M$#-(>G)`+0^S2$>Q58&N`!# -MS2$?ZVGV1OR`=0/IL`"I`@!U`^FH`+G__XO1N`)"S2'WV1X6'XU6_[0_S2$? -M"\!T%8!^_QIU#_?9B]&X`D+-(3/)M$#-(3/)B]&X`$+-(>MMQD;]`(M.#.BL -M`(E.#/9&_O]U!_=&"@(`=0.`X?X>Q58&M#S-(1]S`^D;\)/V1O[_=0?W1@H" -M`'4TM#[-(8I&"B0#"D;^'L56!K0]S2$?<MB3]D;]`746]T8,`0!T#X#)`1[% -M5@:X`4/-(1]RN_9&_$!U/Q[%5@:X`$/-(1^+P3+)@^`!=`*Q$/=&"@@`=`.` -MR2`['O(-<@JT/LTAN``8Z;G^"D[\@,D!B(_T#8O#B^5=RS+)Z]RAY`WWT"/! -M,\FH@'4#@,D!PU6+[(/L`HM>!CL>\@UR!OFX``GK<S/`BTX,XVSVA_0-`G5E -M@3[8$-;6=03_%MH0BTX,'L56"+0_S2$?<P2T">M']H?T#8!T0("G]`W[5E<> -M!XY>"OR+\HOZB\CC)[0-@#P*=08F@(_T#02L.L1T'#P:=0@F@(_T#0+K!8@% -M1^+JB\<KP@8?7U[I].Z#^0%T!X`\"G3IZ^0&'_:']`U`=!RX`$3-(??"(`!U -M#1X6'XU6_[0_S2$?<LZP"NLP'A8?QD;_`(U6_[0_S2$?<KD+P'09@WX,`70? -MN?__B]&X`4+-(;D!`(!^_PIT![`-Q58(ZXK%5@CKB(!^_PIUV^NZ45?V1P(! -M=&;HU0"+_HL$J`%T`RO(24%!BW<$"_9T3P/.<PDSP+KP_^,SZT*X(`2.P":A -MH!`]`"!T%KH`@#O0<@;1ZG7XZR*#^@AR'='BB\)(B]`#P7,",\#WTB/"4N@N -M`%IS#8/Z\'0%N!``Z^+YZQN+T"M7!(E'!(E_"(MW"DJ)%$(#\L<$_O^)=PI? -M6<.+T/9'`@1T#TJ+=P1..]9V!3E7_G,V0E-1C-Z.QK$$T^AU`[@`$/9'`@1T -M"@/&BQ[H#2O#CL.+V+1*S2%96W(0B\+V1P($=`1*B5?^^.L!^<-7BW<(.W<* -M=0.+=P:M@_C^=`B+_B3^`_#K\D]/B_=?PU6+[(O7B]X>Q'X&,\"Y___RKHUU -M_\1^"KG___*N]]%T`ROY02OYC,".V(Y&"(?^BT8&"\EU!:5)2>L(]\8!`'0" -MI$G1Z?.E$\GSI(OSB_H?C,)=RU6+[(O7B]X>Q78*B_Z,V([`,\"Y___RKO?1 -MQ'X&B\=T!*5)ZP:H`70"I$G1Z?.E$\GSI(OSB_H?C,)=RU6+[%97LP&+3@R+ -M1@8STH/Y"G4!F1[%?@CI"P-75KZ$#C/_ZQ*0'E::/@;Y`8/$!$!T`4>#Q@PY -M-B@0<^F+QUY?RU6+[%:+=@;V1`J#=`R#?@X"?P:#?@X`?0G'!N(-%@#K4I"` -M9`KO@WX.`745'E::S!GY`8/$!`%&"A%6#,=&#@``'E;H0/2#Q`3V1`J`=`2` -M9`K\_W8._W8,_W8*BD0+*N10FBX4^0&#Q`@]__]U"3O0=06X___K`C/`7HOE -M7<N058OL@^P45U:+1@:+\(O(@>E(#H'!.`^+V(E._HI/"RKMB4[R@W\$`'T% -MQT<$``"X`0!0*\!04%&:+A3Y`8/$"(E&^(E6^@O2?0BX__^9Z4D!D/9$"@AU -M'HM>_O8'`746BT0$F8O(B]J+1OB+5OHKP1O3Z24!D(L$*T0&B4;\]D0*`W0^ -MBU[R]H?T#8!T)(M$!HM4"(E&[(E6[NL/Q%[L)H`_"G4#_T;\_T;LBP0Y1NQR -MZHM&^@M&^'48BT;\*]+IV`#V1`J`=>K'!N(-%@#I>?^0]D0*`74#Z;,`@WP$ -M`'4)QT;\``#II0"0BP0K1`8#1`2)1O"+7O+VA_0-@'4#Z8$`N0(`42O)45%3 -MB_B:+A3Y`8/$"#M&^'4^.U;Z=3D#?`:+3`B)?O2+1`:)1NR)3N[K$)#$7NPF -M@#\*=0/_1O#_1NR+1NPY1O1WZ8M>_O8'('0P_T;PZRLSP%#_=OK_=OC_=O*: -M+A3Y`8M>_H/$"(M'`HE&\(M>\O:']`T$=`1`B4;PBT;P*](I1O@95OJ+1OB+ -M5OH#1OR#T@!>7XOE7<M5B^Q75HMV!@OV?`8Y-O(-?PS'!N(-"0"X___K-I"@ -MZ@V*)NL-/1X#?00SP.LE]H3T#0%T$U::MASY`8/$`HOX"_AT#8D^\`W'!N(- -M"0"___^+QUY?B^5=RY!5B^R+3@X>5U;C2,5V"L1^!HO!2(O7]](KPAO;(\,# -MPHO6]](KPAO;(\,#PD"1*\'1Z?.E$\GSI)'C&`OV=0>,V`4`$([8"_]UQXS` -M!0`0CL#KOHM&!HM6"%Y?'UW+BTX.BT8&BU8('L5^"E<>!_R3"L!T$X/Y"G4. -M"])Y"K`MJO?;@](`]]J+]Y(ST@O`=`+W\9/W\9*'TP0P/#EV`@0GJHO""\-U -MXH@%3ZR&!8A$_XU$`3O'<O*,VE@?7UZ+Y5W+`%6+[(IF!A[%7@B*%X#\`G(8 -MBG<"BT\$ANG0R=#)@.'`"D\&BD<(Q%\*S1,?7<M5B^R+7@:T:,TAZ2OI`%6+ -M[%=64S/_BT8("\!]$4>+5@;WV/?:@]@`B48(B58&BT8,"\!]$4>+5@KWV/?: -M@]@`B48,B58*"\!U%8M."HM&"#/2]_&+V(M&!O?QB]/K.(O8BTX*BU8(BT8& -MT>O1V='JT=@+VW7T]_&+\/=F#)&+1@KWY@/1<@P[5@AW!W(&.T8&=@%.,]*6 -M3W4']]KWV(/:`%M>7UW*"`!5B^R+1@B+3@P+R(M."G4)BT8&]^%=R@@`4_?A -MB]B+1@;W9@P#V(M&!O?A`]-;7<H(`%6+[%-7,_^+1@@+P'T11XM6!O?8]]J# -MV`")1@B)5@:+1@P+P'T0BU8*]]CWVH/8`(E&#(E6"@O`=1B+3@J+1@@STO?Q -MBT8&]_&+PC/23WE#ZTB+V(M."HM6"(M&!M'KT=G1ZM'8"]MU]/?QB\CW9@R1 -M]V8*`]%R##M6"'<'<@L[1@9V!BM&"AM6#"M&!AM6"$]Y!_?:]]B#V@!?6UW* -M"`!5B^Q35HM&#`O`=16+3@J+1@@STO?QB]B+1@;W\8O3ZSB+R(M>"HM6"(M& -M!M'IT=O1ZM'8"\EU]/?SB_#W9@R1BT8*]^8#T7(,.U8(=P=R!CM&!G8!3C/2 -MEEY;7<H(``!5B^Q3BT8,"\!U%8M."HM&"#/2]_&+1@;W\8O",]+K18O(BUX* -MBU8(BT8&T>G1V]'JT=@+R77T]_.+R/=F#)'W9@H#T7(,.U8(=P=R"SM&!G8& -M*T8*&U8,*T8&&U8(]]KWV(/:`%M=R@@`58OL@^P(BUX&.Q[R#7('N``)^>GK -MYH$^V!#6UG4$_Q;:$/:']`T@=`NX`D(SR8O1S2%RW_:']`V`='R,7OJ.1@K% -M5@@SP(E&_HE&_/Q75HOZB_*)9OB+3@SC/[`*\JYU41Z.7OJ:6B#Y`3VH`'9* -M'X/L`HO<N@`"/2@"<P.Z@``KXHO4B_H6!XM.#*P\"G0,._MT&:KB].@F`.MY -ML`T[^W4#Z!L`JK`*_T;\Z^/H$`#KXEY?CE[ZZVVX_/\.Z!3C4%-1'@8?B\\K -MRN,248M>!K1`S2%9<@X!1OX[R'<''UE;6(OZPY\?@\0(@W[^`'4EGG,$M`GK -M)(Y>^O:']`U`=`Z.7@J+7@B`/QIU`_CK#/FX`!SK!HM&_BM&_(MF^%Y?CE[Z -MZ=OEBTX,"\EU!8O!Z<_E'L56"+1`S2$>!Q]S!+0)Z^`+P'7<]H?T#4!T"XO: -M)H`_&G4#^.O*^;@`'.O$`%E:H2@..\1S!RO$]]A24<LSP.OY58OL5L1V!HS! -MXP4F@$S^`5Y=RU6+[%97BTX&@_GH=VD>H<H0"\!T2+^$(8LVTA#%'LP0'E97 -M_]=?7G,KC-K%7PP[UG7O6!\>Q#;,$":+=!+%'L@0C-H[T'79'QZ!_WH7=`Z_ -M>A?KQ%Z!_X0A=`_K"@<&O\@0Z!H!<@[HF0`?B1;.$(D>S!#K(!\SP)F+#L80 -M"P[$$'02_W8&_Q[$$(/$`ID+P'0#Z7#_7UY=RP97B_@#^XE_!$]/@^@6C7<4 -MQP7^_XE_"DB)!(P?B\:,VH["C7\&_*NK1T<SP*NKJZM?!\,FBT4""\!U"2:, -M70(FB1WK%`8FQ'4()HQ<#B:)7`R,1Q*)=Q`')HQ="B:)70@FC%T&)HE=!,-! -M@.'^4_R+=PB+7PHS_^LCB\-;J`%U0E.+=P:+7P@[WG0V2S/_ZPR0C53^.]-S -MX0/P<B.MJ`%T\(O^2#O!<R,#\'(3B]"MJ`%TW@/"@\`"B_>)1/[KY(O`6XM' -M!HE'"/GK&5N)3/YT"0/Y*\%(B04K^0/YB7\(B\:,VOC#B]&#PB>`XO"+VO?; -M]]OUT=O1Z]'KT>NT2,TA<B8[!L(-=O0[!L`-=@.CP`V.V#/;)HM%#(E'`HO" -MZ-[^Z`__^.L!^<-5B^P>Q58&M$'-(1_ID^,`````````````````(`0````` -M````````````````````````35,@4G5N+51I;64@3&EB<F%R>2`M($-O<'ER -M:6=H="`H8RD@,3DY,BP@36EC<F]S;V9T($-O<G`:`$9R965"4T0@8F]O="!6 -M97)S:6]N("5D+B5D"@`H8RD@,3DY-"P@,3DY-2!#:')I<W1I86X@1W5S96YB -M875E<BP*("`@(&-G0&9I;7`P,2YF:6TN=6YI+6QI;GHN86,N870*"@!U<V%G -M93H@)7,@6R!O<'1I;VYS(%T@6R!K97)N96QN86UE(%T*`'=H97)E(&]P=&EO -M;G,@87)E.@H`"2UR("XN+B!U<V4@8V]M<&EL960M:6X@<F]O=&1E=@H`"2US -M("XN+B!R96)O;W0@=&\@<VEN9VQE('5S97(@;VYL>0H`"2UA("XN+B!A<VL@ -M9F]R(&9I;&4@;F%M92!T;R!R96)O;W0@9G)O;0H`"2UD("XN+B!G:79E(&-O -M;G1R;VP@=&\@:V5R;F5L(&1E8G5G9V5R"@`)+6,@+BXN(&EN=F]K92!U<V5R -M(&-O;F9I9W5R871I;VX@<F]U=&EN9PH`"2UV("XN+B!P<FEN="!A;&P@<&]T -M96YT:6%L;'D@=7-E9G5L(&EN9F\*``DM0R`N+BX@=7-E(&-D<F]M(&%S(')O -M;W0*``DM1"`N+BX@8F]O="!A(&ME<FYE;"!F<F]M(&$@1$]3(&UE9&EU;0H` -M"2`@("`@("`H9&5F875L=#H@8SI<:V5R;F5L*0H`+VME<FYE;`!C.EQK97)N -M96P````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M``````````````````````````````````````````````````````#__P`` -M`)_/`/__````D\\`__\```">0`#__P```))``/__````G@`````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M`````````````````````````````"\``````$<``````/\'`````')B`$5- -M35A86%@P`%9#4$D@<V5R=FEC97,@5F5R<VEO;B`E9"XE9"!D971E8W1E9"$* -M`$-A;B=T('-W:71C:"!T;R!P<F]T96-T960@;6]D92$*`$=I=FEN9R!U<"`Z -M+2@A"@!N;W0@96YO=6=H(&UE;6]R>2$*``````!);G9A;&ED(&9O<FUA="$* -M`$)O;W1I;F<@0"`P>"5L>`H`4W1A<G0@861D<F5S<R!T;V\@;&]W(0H`4V]R -M<GDL(&-A;B=T(&%L;&]C871E(&5N;W5G:"!M96UO<GDA"@!T97AT/3!X)6QX -M(````&1A=&$],'@E;'@@`&)S<STP>"5L>"``<WEM8F]L<SU;*S!X)6QX*S!X -M)6QX*S!X)6QX`"LP>"5X*S!X)6QX72``=&]T86P],'@E;'@@96YT<GD@<&]I -M;G0],'@E;'@*`$-A;B=T(&9I;F0@)7,*``!B860@9&ES:VQA8F5L`$)A9"!B -M861S96-T('1A8FQE"@!5<VEN9R!B860Q-#0@8F%D('-E8W1O<B!A="`E;&0* -M`$5R<F]R.B!#.B5D($@Z)60@4SHE9`H```````````!);G9A;&ED(&9O<FUA -M="$*`$)O;W1I;F<@0"`P>"5L>`H`4W1A<G0@861D<F5S<R!T;V\@;&]W(0H` -M4V]R<GDL(&-A;B=T(&%L;&]C871E(&5N;W5G:"!M96UO<GDA"@!T97AT/3!X -M)6QX(````&1A=&$],'@E;'@@`&)S<STP>"5L>"``<WEM8F]L<SU;*S!X)6QX -M*S!X)6QX*S!X)6QX`"LP>"5X*S!X)6QX72``=&]T86P],'@E;'@@96YT<GD@ -M<&]I;G0],'@E;'@*`')B`%-O<G)Y+"!C86XG="!O<&5N("5S(0H```#Z`0`` -M```%``````````````````````````````!?0U]&24Q%7TE.1D\]```````` -M`````````````````````````````````!0`@8&!`0$````````````````` -M````````````````%@X@!```````````````````_____^"^```````6`@(8 -M#0D,#`P'"!86_P(-$@+_7`!<``````````````````$```````````````(! -M``````````````("70\@!```70\@!(0#``````````````($```````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````!```````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M```````````````````````````````````````````````````````````` -M````````+`\@!`````````````````8```8``0``$``#!@`&`A`$145%!04% -M!04U,`!0`````"`@,%!8!P@`,#`P5U`'```@(```````"&!@8&!@8```<'!X -M>'AX"`<(```'``@("```"``(```(*&YU;&PI!@```````````"#(`OD!R`+Y -M`<@"^0'(`OD!R`+Y`<@"^0'(`OD!``````$!``````````````````````,` -M`````.P`[`#L`````````````````````````%0)^0$\/$Y-4T<^/@``4C8P -M,#`-"BT@<W1A8VL@;W9E<F9L;W<-"@`#`%(V,#`S#0HM(&EN=&5G97(@9&EV -M:61E(&)Y(#`-"@`)`%(V,#`Y#0HM(&YO="!E;F]U9V@@<W!A8V4@9F]R(&5N -M=FER;VYM96YT#0H`_``-"@#_`')U;BUT:6UE(&5R<F]R(``"`%(V,#`R#0HM -M(&9L;V%T:6YG+7!O:6YT('-U<'!O<G0@;F]T(&QO861E9`T*``$`4C8P,#$- -@"BT@;G5L;"!P;VEN=&5R(&%S<VEG;FUE;G0-"@#___]E -` -end diff --git a/sys/i386/boot/dosboot/fbsdboot.mak b/sys/i386/boot/dosboot/fbsdboot.mak deleted file mode 100644 index 31a86d4..0000000 --- a/sys/i386/boot/dosboot/fbsdboot.mak +++ /dev/null @@ -1,194 +0,0 @@ -# Microsoft Visual C++ generated build script - Do not modify
-# $FreeBSD$
-
-PROJ = FBSDBOOT
-DEBUG = 0
-PROGTYPE = 6
-CALLER =
-ARGS =
-DLLS =
-D_RCDEFINES = -d_DEBUG
-R_RCDEFINES = -dNDEBUG
-ORIGIN = MSVC
-ORIGIN_VER = 1.00
-PROJPATH = C:\SRC\FBSDBOOT\
-USEMFC = 0
-CC = cl
-CPP = cl
-CXX = cl
-CCREATEPCHFLAG =
-CPPCREATEPCHFLAG =
-CUSEPCHFLAG =
-CPPUSEPCHFLAG =
-FIRSTC = FBSDBOOT.C
-FIRSTCPP =
-RC = rc
-CFLAGS_D_DEXE = /nologo /Gs /G3 /Zp1 /W3 /Zi /AL /Oi /D "_DEBUG" /D "i386" /D "_DOS" /D "__i386__" /Fc /Fd"FBSDBOOT.PDB"
-CFLAGS_R_DEXE = /nologo /Gs /G3 /Zp1 /W3 /AL /Ox /D "NDEBUG" /D "i386" /D "_DOS" /D "__i386__" /D "DO_BAD144"
-LFLAGS_D_DEXE = /NOLOGO /NOI /STACK:6000 /ONERROR:NOEXE /CO /MAP /LINE
-LFLAGS_R_DEXE = /NOLOGO /NOI /STACK:5120 /ONERROR:NOEXE
-LIBS_D_DEXE = oldnames llibce
-LIBS_R_DEXE = oldnames llibce
-RCFLAGS = /nologo
-RESFLAGS = /nologo
-RUNFLAGS =
-OBJS_EXT =
-LIBS_EXT =
-!if "$(DEBUG)" == "1"
-CFLAGS = $(CFLAGS_D_DEXE)
-LFLAGS = $(LFLAGS_D_DEXE)
-LIBS = $(LIBS_D_DEXE)
-MAPFILE = nul
-RCDEFINES = $(D_RCDEFINES)
-!else
-CFLAGS = $(CFLAGS_R_DEXE)
-LFLAGS = $(LFLAGS_R_DEXE)
-LIBS = $(LIBS_R_DEXE)
-MAPFILE = nul
-RCDEFINES = $(R_RCDEFINES)
-!endif
-!if [if exist MSVC.BND del MSVC.BND]
-!endif
-SBRS = FBSDBOOT.SBR \
- PROTMOD.SBR \
- BOOT.SBR \
- DISK.SBR \
- SYS.SBR \
- DOSBOOT.SBR
-
-
-FBSDBOOT_DEP = c:\src\fbsdboot\reboot.h \
- c:\src\fbsdboot\boot.h \
- c:\src\fbsdboot\param.h \
- c:\src\fbsdboot\sysparam.h \
- c:\src\fbsdboot\syslimit.h \
- c:\src\fbsdboot\quota.h \
- c:\src\fbsdboot\cdefs.h \
- c:\src\fbsdboot\fs.h \
- c:\src\fbsdboot\inode.h \
- c:\src\fbsdboot\dinode.h \
- c:\src\fbsdboot\bootinfo.h \
- c:\src\fbsdboot\dosboot.h \
- c:\src\fbsdboot\protmod.h
-
-
-PROTMOD_DEP = c:\src\fbsdboot\boot.h \
- c:\src\fbsdboot\param.h \
- c:\src\fbsdboot\sysparam.h \
- c:\src\fbsdboot\syslimit.h \
- c:\src\fbsdboot\quota.h \
- c:\src\fbsdboot\cdefs.h \
- c:\src\fbsdboot\fs.h \
- c:\src\fbsdboot\inode.h \
- c:\src\fbsdboot\dinode.h \
- c:\src\fbsdboot\bootinfo.h \
- c:\src\fbsdboot\protmod.h
-
-
-BOOT_DEP = c:\src\fbsdboot\bootinfo.h \
- c:\src\fbsdboot\protmod.h \
- c:\src\fbsdboot\param.h \
- c:\src\fbsdboot\sysparam.h \
- c:\src\fbsdboot\syslimit.h \
- c:\src\fbsdboot\boot.h \
- c:\src\fbsdboot\quota.h \
- c:\src\fbsdboot\cdefs.h \
- c:\src\fbsdboot\fs.h \
- c:\src\fbsdboot\inode.h \
- c:\src\fbsdboot\dinode.h \
- c:\src\fbsdboot\reboot.h \
- c:\src\fbsdboot\exec.h \
- c:\src\fbsdboot\mexec.h \
- c:\src\fbsdboot\imgact.h
-
-
-DISK_DEP = c:\src\fbsdboot\boot.h \
- c:\src\fbsdboot\param.h \
- c:\src\fbsdboot\sysparam.h \
- c:\src\fbsdboot\syslimit.h \
- c:\src\fbsdboot\quota.h \
- c:\src\fbsdboot\cdefs.h \
- c:\src\fbsdboot\fs.h \
- c:\src\fbsdboot\inode.h \
- c:\src\fbsdboot\dinode.h \
- c:\src\fbsdboot\dkbad.h \
- c:\src\fbsdboot\disklabe.h
-
-
-SYS_DEP = c:\src\fbsdboot\protmod.h \
- c:\src\fbsdboot\boot.h \
- c:\src\fbsdboot\param.h \
- c:\src\fbsdboot\sysparam.h \
- c:\src\fbsdboot\syslimit.h \
- c:\src\fbsdboot\quota.h \
- c:\src\fbsdboot\cdefs.h \
- c:\src\fbsdboot\fs.h \
- c:\src\fbsdboot\inode.h \
- c:\src\fbsdboot\dinode.h \
- c:\src\fbsdboot\dir.h \
- c:\src\fbsdboot\dirent.h
-
-
-DOSBOOT_DEP = c:\src\fbsdboot\protmod.h \
- c:\src\fbsdboot\param.h \
- c:\src\fbsdboot\sysparam.h \
- c:\src\fbsdboot\syslimit.h \
- c:\src\fbsdboot\boot.h \
- c:\src\fbsdboot\quota.h \
- c:\src\fbsdboot\cdefs.h \
- c:\src\fbsdboot\fs.h \
- c:\src\fbsdboot\inode.h \
- c:\src\fbsdboot\dinode.h \
- c:\src\fbsdboot\bootinfo.h \
- c:\src\fbsdboot\reboot.h \
- c:\src\fbsdboot\exec.h \
- c:\src\fbsdboot\mexec.h \
- c:\src\fbsdboot\imgact.h
-
-
-all: $(PROJ).EXE
-
-FBSDBOOT.OBJ: FBSDBOOT.C $(FBSDBOOT_DEP)
- $(CC) $(CFLAGS) $(CCREATEPCHFLAG) /c FBSDBOOT.C
-
-PROTMOD.OBJ: PROTMOD.C $(PROTMOD_DEP)
- $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c PROTMOD.C
-
-BOOT.OBJ: BOOT.C $(BOOT_DEP)
- $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c BOOT.C
-
-DISK.OBJ: DISK.C $(DISK_DEP)
- $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c DISK.C
-
-SYS.OBJ: SYS.C $(SYS_DEP)
- $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c SYS.C
-
-DOSBOOT.OBJ: DOSBOOT.C $(DOSBOOT_DEP)
- $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c DOSBOOT.C
-
-$(PROJ).EXE:: FBSDBOOT.OBJ PROTMOD.OBJ BOOT.OBJ DISK.OBJ SYS.OBJ DOSBOOT.OBJ $(OBJS_EXT) $(DEFFILE)
- echo >NUL @<<$(PROJ).CRF
-FBSDBOOT.OBJ +
-PROTMOD.OBJ +
-BOOT.OBJ +
-DISK.OBJ +
-SYS.OBJ +
-DOSBOOT.OBJ +
-$(OBJS_EXT)
-$(PROJ).EXE
-$(MAPFILE)
-c:\msvc\lib\+
-c:\msvc\mfc\lib\+
-$(LIBS)
-$(DEFFILE);
-<<
- link $(LFLAGS) @$(PROJ).CRF
-
-run: $(PROJ).EXE
- $(PROJ) $(RUNFLAGS)
-
-
-$(PROJ).BSC: $(SBRS)
- bscmake @<<
-/o$@ $(SBRS)
-<<
diff --git a/sys/i386/boot/dosboot/fs.h b/sys/i386/boot/dosboot/fs.h deleted file mode 100644 index 8993dd2..0000000 --- a/sys/i386/boot/dosboot/fs.h +++ /dev/null @@ -1,465 +0,0 @@ -/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)fs.h 7.12 (Berkeley) 5/8/91
- * $FreeBSD$
- */
-
-#ifndef _UFS_FS_H_
-#define _UFS_FS_H_ 1
-
-#define MAXFRAG 8
-
-/*
- * Each disk drive contains some number of file systems.
- * A file system consists of a number of cylinder groups.
- * Each cylinder group has inodes and data.
- *
- * A file system is described by its super-block, which in turn
- * describes the cylinder groups. The super-block is critical
- * data and is replicated in each cylinder group to protect against
- * catastrophic loss. This is done at `newfs' time and the critical
- * super-block data does not change, so the copies need not be
- * referenced further unless disaster strikes.
- *
- * For file system fs, the offsets of the various blocks of interest
- * are given in the super block as:
- * [fs->fs_sblkno] Super-block
- * [fs->fs_cblkno] Cylinder group block
- * [fs->fs_iblkno] Inode blocks
- * [fs->fs_dblkno] Data blocks
- * The beginning of cylinder group cg in fs, is given by
- * the ``cgbase(fs, cg)'' macro.
- *
- * The first boot and super blocks are given in absolute disk addresses.
- * The byte-offset forms are preferred, as they don't imply a sector size.
- */
-#define BBSIZE 8192
-#define SBSIZE 8192
-#define BBOFF ((off_t)(0))
-#define SBOFF ((off_t)(BBOFF + BBSIZE))
-#define BBLOCK ((daddr_t)(0))
-#define SBLOCK ((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE))
-
-/*
- * Addresses stored in inodes are capable of addressing fragments
- * of `blocks'. File system blocks of at most size MAXBSIZE can
- * be optionally broken into 2, 4, or 8 pieces, each of which is
- * addressible; these pieces may be DEV_BSIZE, or some multiple of
- * a DEV_BSIZE unit.
- *
- * Large files consist of exclusively large data blocks. To avoid
- * undue wasted disk space, the last data block of a small file may be
- * allocated as only as many fragments of a large block as are
- * necessary. The file system format retains only a single pointer
- * to such a fragment, which is a piece of a single large block that
- * has been divided. The size of such a fragment is determinable from
- * information in the inode, using the ``blksize(fs, ip, lbn)'' macro.
- *
- * The file system records space availability at the fragment level;
- * to determine block availability, aligned fragments are examined.
- *
- * The root inode is the root of the file system.
- * Inode 0 can't be used for normal purposes and
- * historically bad blocks were linked to inode 1,
- * thus the root inode is 2. (inode 1 is no longer used for
- * this purpose, however numerous dump tapes make this
- * assumption, so we are stuck with it)
- */
-#define ROOTINO ((ino_t)2)
-
-/*
- * MINBSIZE is the smallest allowable block size.
- * In order to insure that it is possible to create files of size
- * 2^32 with only two levels of indirection, MINBSIZE is set to 4096.
- * MINBSIZE must be big enough to hold a cylinder group block,
- * thus changes to (struct cg) must keep its size within MINBSIZE.
- * Note that super blocks are always of size SBSIZE,
- * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE.
- */
-#define MINBSIZE 4096
-
-/*
- * The path name on which the file system is mounted is maintained
- * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
- * the super block for this name.
- * The limit on the amount of summary information per file system
- * is defined by MAXCSBUFS. It is currently parameterized for a
- * maximum of two million cylinders.
- */
-#define MAXMNTLEN 512
-#define MAXCSBUFS 32
-
-/*
- * Per cylinder group information; summarized in blocks allocated
- * from first cylinder group data blocks. These blocks have to be
- * read in from fs_csaddr (size fs_cssize) in addition to the
- * super block.
- *
- * N.B. sizeof(struct csum) must be a power of two in order for
- * the ``fs_cs'' macro to work (see below).
- */
-struct csum {
- long cs_ndir; /* number of directories */
- long cs_nbfree; /* number of free blocks */
- long cs_nifree; /* number of free inodes */
- long cs_nffree; /* number of free frags */
-};
-
-/*
- * Super block for a file system.
- */
-#define FS_MAGIC 0x011954
-#define FSOKAY 0x7c269d38
-struct fs
-{
- struct fs *fs_link; /* linked list of file systems */
- struct fs *fs_rlink; /* used for incore super blocks */
- daddr_t fs_sblkno; /* addr of super-block in filesys */
- daddr_t fs_cblkno; /* offset of cyl-block in filesys */
- daddr_t fs_iblkno; /* offset of inode-blocks in filesys */
- daddr_t fs_dblkno; /* offset of first data after cg */
- long fs_cgoffset; /* cylinder group offset in cylinder */
- long fs_cgmask; /* used to calc mod fs_ntrak */
- time_t fs_time; /* last time written */
- long fs_size; /* number of blocks in fs */
- long fs_dsize; /* number of data blocks in fs */
- long fs_ncg; /* number of cylinder groups */
- long fs_bsize; /* size of basic blocks in fs */
- long fs_fsize; /* size of frag blocks in fs */
- long fs_frag; /* number of frags in a block in fs */
-/* these are configuration parameters */
- long fs_minfree; /* minimum percentage of free blocks */
- long fs_rotdelay; /* num of ms for optimal next block */
- long fs_rps; /* disk revolutions per second */
-/* these fields can be computed from the others */
- long fs_bmask; /* ``blkoff'' calc of blk offsets */
- long fs_fmask; /* ``fragoff'' calc of frag offsets */
- long fs_bshift; /* ``lblkno'' calc of logical blkno */
- long fs_fshift; /* ``numfrags'' calc number of frags */
-/* these are configuration parameters */
- long fs_maxcontig; /* max number of contiguous blks */
- long fs_maxbpg; /* max number of blks per cyl group */
-/* these fields can be computed from the others */
- long fs_fragshift; /* block to frag shift */
- long fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
- long fs_sbsize; /* actual size of super block */
- long fs_csmask; /* csum block offset */
- long fs_csshift; /* csum block number */
- long fs_nindir; /* value of NINDIR */
- long fs_inopb; /* value of INOPB */
- long fs_nspf; /* value of NSPF */
-/* yet another configuration parameter */
- long fs_optim; /* optimization preference, see below */
-/* these fields are derived from the hardware */
- long fs_npsect; /* # sectors/track including spares */
- long fs_interleave; /* hardware sector interleave */
- long fs_trackskew; /* sector 0 skew, per track */
- long fs_headswitch; /* head switch time, usec */
- long fs_trkseek; /* track-to-track seek, usec */
-/* sizes determined by number of cylinder groups and their sizes */
- daddr_t fs_csaddr; /* blk addr of cyl grp summary area */
- long fs_cssize; /* size of cyl grp summary area */
- long fs_cgsize; /* cylinder group size */
-/* these fields are derived from the hardware */
- long fs_ntrak; /* tracks per cylinder */
- long fs_nsect; /* sectors per track */
- long fs_spc; /* sectors per cylinder */
-/* this comes from the disk driver partitioning */
- long fs_ncyl; /* cylinders in file system */
-/* these fields can be computed from the others */
- long fs_cpg; /* cylinders per group */
- long fs_ipg; /* inodes per group */
- long fs_fpg; /* blocks per group * fs_frag */
-/* this data must be re-computed after crashes */
- struct csum fs_cstotal; /* cylinder summary information */
-/* these fields are cleared at mount time */
- char fs_fmod; /* super block modified flag */
- char fs_clean; /* file system is clean flag */
- char fs_ronly; /* mounted read-only flag */
- char fs_flags; /* currently unused flag */
- char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
-/* these fields retain the current block allocation info */
- long fs_cgrotor; /* last cg searched */
- struct csum *fs_csp[MAXCSBUFS];/* list of fs_cs info buffers */
- long fs_cpc; /* cyl per cycle in postbl */
- short fs_opostbl[16][8]; /* old rotation block list head */
- long fs_sparecon[55]; /* reserved for future constants */
- long fs_state; /* validate fs_clean field */
- union {
-/* quad_t v;*/
- long val[2];
- } fs_qbmask; /* ~fs_bmask - for use with quad size */
- union {
-/* quad_t v;*/
- long val[2];
- } fs_qfmask; /* ~fs_fmask - for use with quad size */
- long fs_postblformat; /* format of positional layout tables */
- long fs_nrpos; /* number of rotaional positions */
- long fs_postbloff; /* (short) rotation block list head */
- long fs_rotbloff; /* (u_char) blocks for each rotation */
- long fs_magic; /* magic number */
- u_char fs_space[1]; /* list of blocks for each rotation */
-/* actually longer */
-};
-/*
- * Preference for optimization.
- */
-#define FS_OPTTIME 0 /* minimize allocation time */
-#define FS_OPTSPACE 1 /* minimize disk fragmentation */
-
-/*
- * Rotational layout table format types
- */
-#define FS_42POSTBLFMT -1 /* 4.2BSD rotational table format */
-#define FS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */
-/*
- * Macros for access to superblock array structures
- */
-#define fs_postbl(fs, cylno) \
- (((fs)->fs_postblformat == FS_42POSTBLFMT) \
- ? ((fs)->fs_opostbl[cylno]) \
- : ((short *)((char *)(fs) + (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos))
-#define fs_rotbl(fs) \
- (((fs)->fs_postblformat == FS_42POSTBLFMT) \
- ? ((fs)->fs_space) \
- : ((u_char *)((char *)(fs) + (fs)->fs_rotbloff)))
-
-/*
- * Convert cylinder group to base address of its global summary info.
- *
- * N.B. This macro assumes that sizeof(struct csum) is a power of two.
- */
-#define fs_cs(fs, indx) \
- fs_csp[(indx) >> (fs)->fs_csshift][(indx) & ~(fs)->fs_csmask]
-
-/*
- * Cylinder group block for a file system.
- */
-#define CG_MAGIC 0x090255
-struct cg {
- struct cg *cg_link; /* linked list of cyl groups */
- long cg_magic; /* magic number */
- time_t cg_time; /* time last written */
- long cg_cgx; /* we are the cgx'th cylinder group */
- short cg_ncyl; /* number of cyl's this cg */
- short cg_niblk; /* number of inode blocks this cg */
- long cg_ndblk; /* number of data blocks this cg */
- struct csum cg_cs; /* cylinder summary information */
- long cg_rotor; /* position of last used block */
- long cg_frotor; /* position of last used frag */
- long cg_irotor; /* position of last used inode */
- long cg_frsum[MAXFRAG]; /* counts of available frags */
- long cg_btotoff; /* (long) block totals per cylinder */
- long cg_boff; /* (short) free block positions */
- long cg_iusedoff; /* (char) used inode map */
- long cg_freeoff; /* (u_char) free block map */
- long cg_nextfreeoff; /* (u_char) next available space */
- long cg_sparecon[16]; /* reserved for future use */
- u_char cg_space[1]; /* space for cylinder group maps */
-/* actually longer */
-};
-/*
- * Macros for access to cylinder group array structures
- */
-#define cg_blktot(cgp) \
- (((cgp)->cg_magic != CG_MAGIC) \
- ? (((struct ocg *)(cgp))->cg_btot) \
- : ((long *)((char *)(cgp) + (cgp)->cg_btotoff)))
-#define cg_blks(fs, cgp, cylno) \
- (((cgp)->cg_magic != CG_MAGIC) \
- ? (((struct ocg *)(cgp))->cg_b[cylno]) \
- : ((short *)((char *)(cgp) + (cgp)->cg_boff) + (cylno) * (fs)->fs_nrpos))
-#define cg_inosused(cgp) \
- (((cgp)->cg_magic != CG_MAGIC) \
- ? (((struct ocg *)(cgp))->cg_iused) \
- : ((char *)((char *)(cgp) + (cgp)->cg_iusedoff)))
-#define cg_blksfree(cgp) \
- (((cgp)->cg_magic != CG_MAGIC) \
- ? (((struct ocg *)(cgp))->cg_free) \
- : ((u_char *)((char *)(cgp) + (cgp)->cg_freeoff)))
-#define cg_chkmagic(cgp) \
- ((cgp)->cg_magic == CG_MAGIC || ((struct ocg *)(cgp))->cg_magic == CG_MAGIC)
-
-/*
- * The following structure is defined
- * for compatibility with old file systems.
- */
-struct ocg {
- struct ocg *cg_link; /* linked list of cyl groups */
- struct ocg *cg_rlink; /* used for incore cyl groups */
- time_t cg_time; /* time last written */
- long cg_cgx; /* we are the cgx'th cylinder group */
- short cg_ncyl; /* number of cyl's this cg */
- short cg_niblk; /* number of inode blocks this cg */
- long cg_ndblk; /* number of data blocks this cg */
- struct csum cg_cs; /* cylinder summary information */
- long cg_rotor; /* position of last used block */
- long cg_frotor; /* position of last used frag */
- long cg_irotor; /* position of last used inode */
- long cg_frsum[8]; /* counts of available frags */
- long cg_btot[32]; /* block totals per cylinder */
- short cg_b[32][8]; /* positions of free blocks */
- char cg_iused[256]; /* used inode map */
- long cg_magic; /* magic number */
- u_char cg_free[1]; /* free block map */
-/* actually longer */
-};
-
-/*
- * Turn file system block numbers into disk block addresses.
- * This maps file system blocks to device size blocks.
- */
-#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb)
-#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
-
-/*
- * Cylinder group macros to locate things in cylinder groups.
- * They calc file system addresses of cylinder group data structures.
- */
-#define cgbase(fs, c) ((daddr_t)((fs)->fs_fpg * (c)))
-#define cgstart(fs, c) \
- (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask)))
-#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
-#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
-#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
-#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
-
-/*
- * Macros for handling inode numbers:
- * inode number to file system block offset.
- * inode number to cylinder group number.
- * inode number to file system block address.
- */
-#define itoo(fs, x) ((x) % INOPB(fs))
-#define itog(fs, x) ((x) / (fs)->fs_ipg)
-#define itod(fs, x) \
- ((daddr_t)(cgimin(fs, itog(fs, x)) + \
- (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
-
-/*
- * Give cylinder group number for a file system block.
- * Give cylinder group block number for a file system block.
- */
-#define dtog(fs, d) ((d) / (fs)->fs_fpg)
-#define dtogd(fs, d) ((d) % (fs)->fs_fpg)
-
-/*
- * Extract the bits for a block from a map.
- * Compute the cylinder and rotational position of a cyl block addr.
- */
-#define blkmap(fs, map, loc) \
- (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
-#define cbtocylno(fs, bno) \
- ((bno) * NSPF(fs) / (fs)->fs_spc)
-#define cbtorpos(fs, bno) \
- (((bno) * NSPF(fs) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \
- (bno) * NSPF(fs) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \
- (fs)->fs_nsect * (fs)->fs_nrpos / (fs)->fs_npsect)
-
-/*
- * The following macros optimize certain frequently calculated
- * quantities by using shifts and masks in place of divisions
- * modulos and multiplications.
- */
-#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
- ((loc) & ~(fs)->fs_bmask)
-#define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \
- ((loc) & ~(fs)->fs_fmask)
-#define lblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
- ((blk) << (fs)->fs_bshift)
-#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
- ((loc) >> (fs)->fs_bshift)
-#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
- ((loc) >> (fs)->fs_fshift)
-#define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
- (((size) + (fs)->fs_bsize - 1) & (fs)->fs_bmask)
-#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
- (((size) + (fs)->fs_fsize - 1) & (fs)->fs_fmask)
-#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
- ((frags) >> (fs)->fs_fragshift)
-#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
- ((blks) << (fs)->fs_fragshift)
-#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \
- ((fsb) & ((fs)->fs_frag - 1))
-#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \
- ((fsb) &~ ((fs)->fs_frag - 1))
-
-/*
- * Determine the number of available frags given a
- * percentage to hold in reserve
- */
-#define freespace(fs, percentreserved) \
- (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
- (fs)->fs_cstotal.cs_nffree - ((fs)->fs_dsize * (percentreserved) / 100))
-
-/*
- * Determining the size of a file block in the file system.
- */
-#define blksize(fs, ip, lbn) \
- (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \
- ? (fs)->fs_bsize \
- : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
-#define dblksize(fs, dip, lbn) \
- (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->fs_bshift) \
- ? (fs)->fs_bsize \
- : (fragroundup(fs, blkoff(fs, (dip)->di_size))))
-
-/*
- * Number of disk sectors per block; assumes DEV_BSIZE byte sector size.
- */
-#define NSPB(fs) ((fs)->fs_nspf << (fs)->fs_fragshift)
-#define NSPF(fs) ((fs)->fs_nspf)
-
-/*
- * INOPB is the number of inodes in a secondary storage block.
- */
-#define INOPB(fs) ((fs)->fs_inopb)
-#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift)
-
-/*
- * NINDIR is the number of indirects in a file system block.
- */
-#define NINDIR(fs) ((fs)->fs_nindir)
-
-#ifdef KERNEL
-
-extern void fserr(struct fs *, int /*uid_t*/, const char *);
-extern void fragacct(struct fs *, int, long *, int);
-extern int isblock(struct fs *, u_char *, daddr_t);
-extern void clrblock(struct fs *, u_char *, daddr_t);
-extern void setblock(struct fs *, u_char *, daddr_t);
-extern ino_t dirpref(struct fs *);
-extern daddr_t mapsearch(struct fs *, struct cg *, daddr_t, int);
-
-#endif /* _KERNEL */
-#endif /* _UFS_FS_H_ */
diff --git a/sys/i386/boot/dosboot/imgact.h b/sys/i386/boot/dosboot/imgact.h deleted file mode 100644 index f3ec557..0000000 --- a/sys/i386/boot/dosboot/imgact.h +++ /dev/null @@ -1,146 +0,0 @@ -/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)exec.h 8.1 (Berkeley) 6/11/93
- * $FreeBSD$
- */
-
-#ifndef _IMGACT_AOUT_H_
-#define _IMGACT_AOUT_H_
-
-#define N_GETMAGIC(ex) \
- ( (ex).a_midmag & 0xffff )
-#define N_GETMID(ex) \
- ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \
- ((ex).a_midmag >> 16) & 0x03ff )
-#define N_GETFLAG(ex) \
- ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \
- ((ex).a_midmag >> 26) & 0x3f )
-#define N_SETMAGIC(ex,mag,mid,flag) \
- ( (ex).a_midmag = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \
- ((mag) & 0xffff) )
-
-#define N_GETMAGIC_NET(ex) \
- (ntohl((ex).a_midmag) & 0xffff)
-#define N_GETMID_NET(ex) \
- ((ntohl((ex).a_midmag) >> 16) & 0x03ff)
-#define N_GETFLAG_NET(ex) \
- ((ntohl((ex).a_midmag) >> 26) & 0x3f)
-#define N_SETMAGIC_NET(ex,mag,mid,flag) \
- ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
- (((mag)&0xffff)) ) )
-
-#define N_ALIGN(ex,x) \
- (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \
- N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \
- ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x))
-
-/* Valid magic number check. */
-#define N_BADMAG(ex) \
- (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \
- N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC /*&& \
- N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \
- N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC*/)
-
-
-/* Address of the bottom of the text segment. */
-#define N_TXTADDR(ex) \
- ((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \
- N_GETMAGIC(ex) == ZMAGIC) ? 0 : __LDPGSZ)
-
-/* Address of the bottom of the data segment. */
-#define N_DATADDR(ex) \
- N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text)
-
-/* Text segment offset. */
-#define N_TXTOFF(ex) \
- (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC /*|| \
- N_GETMAGIC_NET(ex) == ZMAGIC*/) ? 0 : sizeof(struct exec))
-
-/* Data segment offset. */
-#define N_DATOFF(ex) \
- N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text)
-
-/* Relocation table offset. */
-#define N_RELOFF(ex) \
- N_ALIGN(ex, N_DATOFF(ex) + (ex).a_data)
-
-/* Symbol table offset. */
-#define N_SYMOFF(ex) \
- (N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize)
-
-/* String table offset. */
-#define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
-
-/*
- * Header prepended to each a.out file.
- * only manipulate the a_midmag field via the
- * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h
- */
-
-struct exec {
- unsigned long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */
- unsigned long a_text; /* text segment size */
- unsigned long a_data; /* initialized data size */
- unsigned long a_bss; /* uninitialized data size */
- unsigned long a_syms; /* symbol table size */
- unsigned long a_entry; /* entry point */
- unsigned long a_trsize; /* text relocation size */
- unsigned long a_drsize; /* data relocation size */
-};
-#define a_magic a_midmag /* XXX Hack to work with current kern_execve.c */
-
-/* a_magic */
-#define OMAGIC 0407 /* old impure format */
-#define NMAGIC 0410 /* read-only text */
-#define ZMAGIC 0413 /* demand load format */
-#define QMAGIC 0314 /* "compact" demand load format */
-
-/* a_mid */
-#define MID_ZERO 0 /* unknown - implementation dependent */
-#define MID_SUN010 1 /* sun 68010/68020 binary */
-#define MID_SUN020 2 /* sun 68020-only binary */
-#define MID_I386 134 /* i386 BSD binary */
-#define MID_SPARC 138 /* sparc */
-#define MID_HP200 200 /* hp200 (68010) BSD binary */
-#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */
-#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */
-#define MID_HPUX800 0x20B /* hp800 HP-UX binary */
-
-/*
- * a_flags
- */
-#define EX_PIC 0x10 /* contains position independant code */
-#define EX_DYNAMIC 0x20 /* contains run-time link-edit info */
-#define EX_DPMASK 0x30 /* mask for the above */
-
-#endif /* !_IMGACT_AOUT_H_ */
diff --git a/sys/i386/boot/dosboot/inode.h b/sys/i386/boot/dosboot/inode.h deleted file mode 100644 index a37bc49..0000000 --- a/sys/i386/boot/dosboot/inode.h +++ /dev/null @@ -1,268 +0,0 @@ -/*
- * Copyright (c) 1982, 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)inode.h 7.17 (Berkeley) 5/8/91
- * $FreeBSD$
- */
-
-#ifndef _UFS_INODE_H_
-#define _UFS_INODE_H_ 1
-
-#ifdef KERNEL
-include "../ufs/dinode.h"
-#else
-#include "dinode.h"
-#endif
-
-/*
- * The inode is used to describe each active (or recently active)
- * file in the UFS filesystem. It is composed of two types of
- * information. The first part is the information that is needed
- * only while the file is active (such as the identity of the file
- * and linkage to speed its lookup). The second part is the
- * permannent meta-data associated with the file which is read
- * in from the permanent dinode from long term storage when the
- * file becomes active, and is put back when the file is no longer
- * being used.
- */
-struct inode {
- struct inode *i_chain[2]; /* hash chain, MUST be first */
- struct vnode *i_vnode; /* vnode associated with this inode */
- struct vnode *i_devvp; /* vnode for block I/O */
- u_long i_flag; /* see below */
- dev_t i_dev; /* device where inode resides */
- ino_t i_number; /* the identity of the inode */
- struct fs *i_fs; /* filesystem associated with this inode */
- struct dquot *i_dquot[MAXQUOTAS]; /* pointer to dquot structures */
- struct lockf *i_lockf; /* head of byte-level lock list */
- long i_diroff; /* offset in dir, where we found last entry */
- off_t i_endoff; /* end of useful stuff in directory */
- long i_spare0;
- long i_spare1;
- struct dinode i_din; /* the on-disk dinode */
-};
-
-#define FASTLINK(ip) (DFASTLINK((ip)->i_din))
-#define i_symlink i_din.di_symlink
-#define i_mode i_din.di_mode
-#define i_nlink i_din.di_nlink
-#define i_uid i_din.di_uid
-#define i_gid i_din.di_gid
-#if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
-#define i_size i_din.di_qsize.val[0]
-#else /* BYTE_ORDER == BIG_ENDIAN */
-#define i_size i_din.di_qsize.val[1]
-#endif
-#define i_db i_din.di_db
-#define i_ib i_din.di_ib
-#define i_atime i_din.di_atime
-#define i_mtime i_din.di_mtime
-#define i_ctime i_din.di_ctime
-#define i_blocks i_din.di_blocks
-#define i_rdev i_din.di_db[0]
-#define i_flags i_din.di_flags
-#define i_gen i_din.di_gen
-#define i_forw i_chain[0]
-#define i_back i_chain[1]
-#define i_di_spare i_din.di_spare
-
-/* flags */
-#define ILOCKED 0x0001 /* inode is locked */
-#define IWANT 0x0002 /* some process waiting on lock */
-#define IRENAME 0x0004 /* inode is being renamed */
-#define IUPD 0x0010 /* file has been modified */
-#define IACC 0x0020 /* inode access time to be updated */
-#define ICHG 0x0040 /* inode has been changed */
-#define IMOD 0x0080 /* inode has been modified */
-#define ISHLOCK 0x0100 /* file has shared lock */
-#define IEXLOCK 0x0200 /* file has exclusive lock */
-#define ILWAIT 0x0400 /* someone waiting on file lock */
-
-#ifdef KERNEL
-/*
- * Convert between inode pointers and vnode pointers
- */
-#define VTOI(vp) ((struct inode *)(vp)->v_data)
-#define ITOV(ip) ((ip)->i_vnode)
-
-/*
- * Convert between vnode types and inode formats
- */
-extern enum vtype iftovt_tab[];
-extern int vttoif_tab[];
-#define IFTOVT(mode) (iftovt_tab[((mode) & IFMT) >> 12])
-#define VTTOIF(indx) (vttoif_tab[(int)(indx)])
-
-#define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode))
-
-extern u_long nextgennumber; /* next generation number to assign */
-
-extern ino_t dirpref();
-
-/*
- * Lock and unlock inodes.
- */
-#ifdef notdef
-#define ILOCK(ip) { \
- while ((ip)->i_flag & ILOCKED) { \
- (ip)->i_flag |= IWANT; \
- (void) sleep((caddr_t)(ip), PINOD); \
- } \
- (ip)->i_flag |= ILOCKED; \
-}
-
-#define IUNLOCK(ip) { \
- (ip)->i_flag &= ~ILOCKED; \
- if ((ip)->i_flag&IWANT) { \
- (ip)->i_flag &= ~IWANT; \
- wakeup((caddr_t)(ip)); \
- } \
-}
-#else
-#define ILOCK(ip) ilock(ip)
-#define IUNLOCK(ip) iunlock(ip)
-#endif
-
-#define IUPDAT(ip, t1, t2, waitfor) { \
- if (ip->i_flag&(IUPD|IACC|ICHG|IMOD)) \
- (void) iupdat(ip, t1, t2, waitfor); \
-}
-
-/*
- * This overlays the fid sturcture (see mount.h)
- */
-struct ufid {
- u_short ufid_len; /* length of structure */
- u_short ufid_pad; /* force long alignment */
- ino_t ufid_ino; /* file number (ino) */
- long ufid_gen; /* generation number */
-};
-
-/*
- * Prototypes for UFS vnode operations
- */
-int ufs_lookup __P((struct vnode *vp, struct nameidata *ndp, struct proc *p));
-int ufs_create __P((struct nameidata *ndp, struct vattr *vap, struct proc *p));
-int ufs_mknod __P((struct nameidata *ndp, struct vattr *vap, struct ucred *cred,
- struct proc *p));
-int ufs_open __P((struct vnode *vp, int mode, struct ucred *cred,
- struct proc *p));
-int ufs_close __P((struct vnode *vp, int fflag, struct ucred *cred,
- struct proc *p));
-int ufs_access __P((struct vnode *vp, int mode, struct ucred *cred,
- struct proc *p));
-int ufs_getattr __P((struct vnode *vp, struct vattr *vap, struct ucred *cred,
- struct proc *p));
-int ufs_setattr __P((struct vnode *vp, struct vattr *vap, struct ucred *cred,
- struct proc *p));
-int ufs_read __P((struct vnode *vp, struct uio *uio, int ioflag,
- struct ucred *cred));
-int ufs_write __P((struct vnode *vp, struct uio *uio, int ioflag,
- struct ucred *cred));
-int ufs_ioctl __P((struct vnode *vp, int command, caddr_t data, int fflag,
- struct ucred *cred, struct proc *p));
-int ufs_select __P((struct vnode *vp, int which, int fflags, struct ucred *cred,
- struct proc *p));
-int ufs_mmap __P((struct vnode *vp, int fflags, struct ucred *cred,
- struct proc *p));
-int ufs_fsync __P((struct vnode *vp, int fflags, struct ucred *cred,
- int waitfor, struct proc *p));
-int ufs_seek __P((struct vnode *vp, off_t oldoff, off_t newoff,
- struct ucred *cred));
-int ufs_remove __P((struct nameidata *ndp, struct proc *p));
-int ufs_link __P((struct vnode *vp, struct nameidata *ndp, struct proc *p));
-int ufs_rename __P((struct nameidata *fndp, struct nameidata *tdnp,
- struct proc *p));
-int ufs_mkdir __P((struct nameidata *ndp, struct vattr *vap, struct proc *p));
-int ufs_rmdir __P((struct nameidata *ndp, struct proc *p));
-int ufs_symlink __P((struct nameidata *ndp, struct vattr *vap, char *target,
- struct proc *p));
-int ufs_readdir __P((struct vnode *vp, struct uio *uio, struct ucred *cred,
- int *eofflagp));
-int ufs_readlink __P((struct vnode *vp, struct uio *uio, struct ucred *cred));
-int ufs_abortop __P((struct nameidata *ndp));
-int ufs_inactive __P((struct vnode *vp, struct proc *p));
-int ufs_reclaim __P((struct vnode *vp));
-int ufs_lock __P((struct vnode *vp));
-int ufs_unlock __P((struct vnode *vp));
-int ufs_bmap __P((struct vnode *vp, daddr_t bn, struct vnode **vpp,
- daddr_t *bnp));
-int ufs_strategy __P((struct buf *bp));
-void ufs_print __P((struct vnode *vp));
-int ufs_islocked __P((struct vnode *vp));
-int ufs_advlock __P((struct vnode *vp, caddr_t id, int op, struct flock *fl,
- int flags));
-
-extern void blkfree(struct inode *, daddr_t, off_t);
-extern void ifree(struct inode *, ino_t, int);
-extern void iput(struct inode *);
-extern void ilock(struct inode *);
-extern void iunlock(struct inode *);
-extern void dirbad(struct inode *, off_t, char *);
-
-extern int alloc(struct inode *, daddr_t, daddr_t, int, daddr_t *);
-extern int realloccg(struct inode *, off_t, daddr_t, int, int, struct buf **);
-extern int ialloc(struct inode *, ino_t, int, struct ucred *, struct inode **);
-extern daddr_t blkpref(struct inode *, daddr_t, int, daddr_t *);
-extern u_long hashalloc(struct inode *, int, long, int,
- u_long (*)(struct inode *, int, long, int));
-extern daddr_t fragextend(struct inode *, int, long, int, int);
-extern daddr_t alloccg(struct inode *, int, daddr_t, int);
-
-struct cg; /* I really don't want to know why */
-struct direct; /* this header is required by NFS... */
-
-extern daddr_t alloccgblk(struct fs *, struct cg *, daddr_t);
-extern ino_t ialloccg(struct inode *, int, daddr_t, int);
-extern int ufs_lookup(struct vnode *, struct nameidata *, struct proc *);
-extern int dirbadentry(struct direct *, int);
-extern int direnter(struct inode *, struct nameidata *);
-extern int dirremove(struct nameidata *);
-extern int dirrewrite(struct inode *, struct inode *, struct nameidata *);
-extern int blkatoff(struct inode *, off_t, char **, struct buf **);
-extern int dirempty(struct inode *, ino_t, struct ucred *);
-extern int checkpath(struct inode *, struct inode *, struct ucred *);
-
-extern void ufs_init(void);
-extern int iget(struct inode *, ino_t, struct inode **);
-extern int ufs_inactive(struct vnode *, struct proc *);
-extern int ufs_reclaim(struct vnode *);
-extern int iupdat(struct inode *, struct timeval *, struct timeval *,
- int);
-extern int itrunc(struct inode *, u_long, int);
-extern int indirtrunc(struct inode *, daddr_t, daddr_t, int, long *);
-
-extern int bmap(struct inode *, daddr_t, daddr_t *);
-extern int balloc(struct inode *, daddr_t, int, struct buf **, int);
-
-#endif /* _KERNEL */
-#endif /* _UFS_INODE_H_ */
diff --git a/sys/i386/boot/dosboot/mexec.h b/sys/i386/boot/dosboot/mexec.h deleted file mode 100644 index b045a23..0000000 --- a/sys/i386/boot/dosboot/mexec.h +++ /dev/null @@ -1,44 +0,0 @@ -/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)exec.h 8.1 (Berkeley) 6/11/93
- * $FreeBSD$
- */
-
-#ifndef _EXEC_H_
-#define _EXEC_H_
-
-#define __LDPGSZ 4096
-
-#include "imgact.h"
-
-#endif /* !_EXEC_H_ */
diff --git a/sys/i386/boot/dosboot/param.h b/sys/i386/boot/dosboot/param.h deleted file mode 100644 index 554a4cc..0000000 --- a/sys/i386/boot/dosboot/param.h +++ /dev/null @@ -1,162 +0,0 @@ -/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)param.h 5.8 (Berkeley) 6/28/91
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-/*
- * Machine dependent constants for Intel 386.
- */
-
-#define MACHINE "i386"
-#define MID_MACHINE MID_I386
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is unsigned int
- * and must be cast to any desired pointer type.
- */
-#define ALIGNBYTES (sizeof(long) - 1)
-#define ALIGN(p) (((unsigned long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
-
-/* XXX PGSHIFT and PG_SHIFT are two names for the same thing */
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define PAGE_SHIFT 12
-#define NBPG (1 << PAGE_SHIFT) /* bytes/page */
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE-1)
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
-
-/* XXX PDRSHIFT and PD_SHIFT are two names for the same thing */
-#define PDRSHIFT 22 /* LOG2(NBPDR) */
-#define NBPDR (1 << PDRSHIFT) /* bytes/page dir */
-#define PDROFSET (NBPDR-1) /* byte offset into page dir */
-
-/*
- * XXX This should really be KPTDPTDI << PDRSHIFT, but since KPTDPTDI is
- * defined in pmap.h which is included after this we can't do that
- * (YET!)
- */
-#define BTOPKERNBASE (KERNBASE >> PGSHIFT)
-
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZELOG2 0
-#define CLSIZE (1 << CLSIZELOG2)
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-
-#define UPAGES 2 /* pages of u-area */
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#ifndef MSIZE
-#define MSIZE 128 /* size of an mbuf */
-#endif /* MSIZE */
-
-#ifndef MCLSHIFT
-#define MCLSHIFT 12 /* convert bytes to m_buf clusters */
-#endif /* MCLSHIFT */
-#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
-#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
-
-#ifndef NMBCLUSTERS
-#ifdef GATEWAY
-#define NMBCLUSTERS 512 /* map size, max cluster allocation */
-#else
-#define NMBCLUSTERS 256 /* map size, max cluster allocation */
-#endif /* GATEWAY */
-#endif /* NMBCLUSTERS */
-
-/*
- * Some macros for units conversion
- */
-/* Core clicks (4096 bytes) to segments and vice versa */
-#define ctos(x) (x)
-#define stoc(x) (x)
-
-/* Core clicks (4096 bytes) to disk blocks */
-#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
-#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
-#define dtob(x) ((x)<<DEV_BSHIFT)
-
-/* clicks to bytes */
-#define ctob(x) ((x)<<PGSHIFT)
-
-/* bytes to clicks */
-#define btoc(x) (((unsigned long)(x)+(NBPG-1))>>PGSHIFT)
-
-#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
- ((unsigned long)(bytes) >> DEV_BSHIFT)
-#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
- ((unsigned long)(db) << DEV_BSHIFT)
-
-/*
- * Mach derived conversion macros
- */
-#define trunc_page(x) ((unsigned long)(x) & ~(NBPG-1))
-#define round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1))
-
-#define atop(x) ((unsigned long)(x) >> PG_SHIFT)
-#define ptoa(x) ((unsigned long)(x) << PG_SHIFT)
-
-#define i386_round_pdr(x) ((((unsigned long)(x)) + NBPDR - 1) & ~(NBPDR-1))
-#define i386_trunc_pdr(x) ((unsigned long)(x) & ~(NBPDR-1))
-#define i386_round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1))
-#define i386_trunc_page(x) ((unsigned long)(x) & ~(NBPG-1))
-#define i386_btod(x) ((unsigned long)(x) >> PDRSHIFT)
-#define i386_dtob(x) ((unsigned long)(x) << PDRSHIFT)
-#define i386_btop(x) ((unsigned long)(x) >> PGSHIFT)
-#define i386_ptob(x) ((unsigned long)(x) << PGSHIFT)
-
-#include "sysparam.h"
-
-#endif /* !_MACHINE_PARAM_H_ */
diff --git a/sys/i386/boot/dosboot/protmod.c b/sys/i386/boot/dosboot/protmod.c deleted file mode 100644 index 4dca18d..0000000 --- a/sys/i386/boot/dosboot/protmod.c +++ /dev/null @@ -1,595 +0,0 @@ -/*
- * protmod.c Protected Mode Utilities
- *
- * (C) 1994 by Christian Gusenbauer (cg@fimp01.fim.uni-linz.ac.at)
- * 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.
- *
- * I ALLOW YOU USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. I DISCLAIM
- * ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
- * USE OF THIS SOFTWARE.
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <dos.h>
-#include <memory.h>
-#include <process.h>
-#include "boot.h"
-#include "bootinfo.h"
-#include "protmod.h"
-
-#define data32 _emit 0x66
-#define addr32 _emit 0x67
-
-#define SEG(a) ((unsigned int)(((long)(a))>>16l))
-#define OFF(a) ((unsigned int)((long)(a)))
-#define ptr2lin(a) ((unsigned long)(SEG(a)*0x10l+(long)OFF(a)))
-
-typedef struct {
- unsigned short limit; /* Segment limit */
- unsigned long addr:24; /* address */
- unsigned long rights:8; /* access rights */
- unsigned short reserved; /* reserved on 80286 */
-} DTENTRY;
-
-struct dtr {
- unsigned short limit;
- unsigned long base;
-};
-
-struct {
- unsigned long cr3;
- unsigned long GdtrAddress;
- unsigned long IdtrAddress;
- unsigned short LDTR;
- unsigned short TR;
- unsigned long EIP;
- unsigned short CS;
-} VCPI;
-
-static DTENTRY gdt[] =
-{
- { 0, 0, 0, 0 }, /* Dummy */
- { 0, 0, 0, 0 }, /* GDT itself */
- { 0, 0, 0, 0 }, /* FROM */
- { 0, 0, 0, 0 }, /* TO */
- { 0, 0, 0, 0 }, /* BIOS CS */
- { 0, 0, 0, 0 } /* SS */
-};
-
-static DTENTRY gdt2[] =
-{
- { 0, 0, 0, 0 }, /* Dummy */
- { 0, 0, 0, 0 }, /* GDT itself */
- { 0, 0, 0, 0 }, /* IDT */
- { 0, 0, 0, 0 }, /* DS */
- { 0, 0, 0, 0 }, /* ES */
- { 0, 0, 0, 0 }, /* SS */
- { 0, 0, 0, 0 }, /* CS */
- { 0, 0, 0, 0 }, /* BIOS CS, uninitialized */
- { 0, 0, 0, 0 } /* VCPI: TSS */
-};
-
-static DTENTRY FreeBSDGdt[] = {
- { 0x0000, 0, 0x00, 0x0000 }, /* 0: empty */
- { 0xffff, 0, 0x9f, 0x00cf }, /* 1: kernel code */
- { 0xffff, 0, 0x93, 0x00cf }, /* 2: kernel data */
- { 0xffff, 0, 0x9e, 0x0040 }, /* 3: boot code */
- { 0xffff, 0, 0x92, 0x0040 }, /* 4: boot data */
- { 0xffff, 0, 0x9e, 0x0000 }, /* 5: 16bit boot code */
-};
-
-static DTENTRY Ldt[] = {
- { 0x0000, 0, 0x00, 0x0000 }, /* 0: empty */
-};
-
-static DTENTRY idt2[256] = { 0 };
-static unsigned char Tss[256];
-
-static struct dtr FreeBSDGdtr = { sizeof FreeBSDGdt - 1, 0 };
-static struct dtr Gdtr = { sizeof gdt2 - 1, 0 };
-static struct dtr Idtr = { sizeof idt2 - 1, 0 };
-
-struct bootinfo bootinfo;
-int VCPIboot;
-
-int pm_copy(char far *from, unsigned long to, unsigned long count)
-{
- unsigned char status;
- unsigned short cnt = (unsigned short) count;
-
- if (count == 0l) return -1; /* count has to be > 0!! */
- gdt[2].limit = cnt-1; /* so much bytes to receive */
- gdt[2].addr = _FP_SEG(from)*0x10l+_FP_OFF(from);
- gdt[2].rights = 0x92; /* Data Segment: r/w */
-
- gdt[3].limit = cnt-1; /* so much bytes to read */
- gdt[3].addr = to; /* from HiMem */
- gdt[3].rights = 0x92; /* Data Segment: r/w */
-
- cnt >>= 1;
-
- _asm {
- pusha
- mov ah,87h ; move words
- mov cx,cnt ; that many
- mov bx,seg gdt ; es:si points to the GDT
- mov es,bx
- mov si,offset gdt
- int 15h ; now move the memory block
- mov status,ah ; status is the return value:
- ; 0 .. no error,
- ; 1 .. parity error,
- ; 2 .. exception interrupt
- ; 3 .. gate A20 failed
- popa
- }
-
- return (int) status;
-}
-
-static int pm_enter(void)
-{
- unsigned char status;
- unsigned int segment;
-
- /* setup GDT entry 1: GDT */
- gdt2[1].limit = sizeof(gdt2)-1;
- gdt2[1].addr = ptr2lin(gdt2);
- gdt2[1].rights = 0x92; /* Data Segment: r/w */
-
- /* setup GDT entry 2: IDT */
- gdt2[2].limit = sizeof(idt2)-1;
- gdt2[2].addr = ptr2lin(idt2);
- gdt2[2].rights = 0x92; /* Data Segment: r/w */
-
- /* setup GDT entry 3: DS */
- _asm mov segment,ds
- gdt2[3].limit = 0xffff; /* max. offset */
- gdt2[3].addr = segment*0x10l; /* segment starts at */
- gdt2[3].rights = 0x92; /* Data Segment: r/w */
-
- /* setup GDT entry 4: ES */
- _asm mov segment,es
- gdt2[4].limit = 0xffff; /* max. offset */
- gdt2[4].addr = segment*0x10l; /* segment starts at */
- gdt2[4].rights = 0x92; /* Data Segment: r/w */
-
- /* setup GDT entry 5: SS */
- _asm mov segment,ss
- gdt2[5].limit = 0; /* max. offset = 64 K!! */
- gdt2[5].addr = segment*0x10l; /* segment starts at */
- gdt2[5].rights = 0x96; /* Stack Segment: r/w, expansion direction=down */
-
- /* setup GDT entry 7: uninitialized! */
-
- /* setup GDT entry 6: CS */
- _asm mov segment,cs
- gdt2[6].limit = 0xffff; /* max. offset */
- gdt2[6].addr = segment*0x10l; /* segment starts at */
- gdt2[6].rights = 0x9a; /* Code Segment: execute only */
-
- _asm {
- pusha
- mov ah,89h ; enter protected mode
- mov bx,seg gdt2 ; es:si points to the GDT
- mov es,bx
- mov si,offset gdt2
- mov bx,2820h ; setup Interrupt Levels
- int 15h ; now move the memory block
- mov status,ah ; status is the return value and 0 if no error occurred
- popa
- }
-
- if (status) return (int) status;/* no protected mode; return status */
-
- _asm {
- mov ax,30h
- mov word ptr ss:[bp+4],ax ; patch code selector
- }
- return 0;
-}
-
-static void setupVCPI(void)
-{
- unsigned int segment;
-
- /* setup GDT entry 1: VCPI 1 (code) */
- gdt2[1].limit = 0; /* max. offset */
- gdt2[1].addr = 0; /* segment starts at */
- gdt2[1].rights = 0; /* Data Segment: r/w */
-
- /* setup GDT entry 2: VCPI 2 */
- gdt2[2].limit = 0; /* max. offset */
- gdt2[2].addr = 0; /* segment starts at */
- gdt2[2].rights = 0; /* Data Segment: r/w */
-
- /* setup GDT entry 3: VCPI 3 */
- gdt2[3].limit = 0; /* max. offset */
- gdt2[3].addr = 0; /* segment starts at */
- gdt2[3].rights = 0; /* Data Segment: r/w */
-
- /* setup GDT entry 4: code segment (use16) */
- _asm mov segment,cs
- gdt2[4].limit = 0xffff; /* max. offset */
- gdt2[4].addr = segment*0x10l; /* segment starts at */
- gdt2[4].rights = 0x9a; /* Code Segment */
-
- /* setup GDT entry 5: data segment (use16) */
- _asm mov segment,ds
- gdt2[5].limit = 0xffff; /* max. offset */
- gdt2[5].addr = segment*0x10l; /* segment starts at */
- gdt2[5].rights = 0x92; /* Data Segment: r/w */
-
- /* setup GDT entry 6: stack segment */
- _asm mov segment,ss
- gdt2[6].limit = 0; /* max. offset */
- gdt2[6].addr = segment*0x10l; /* segment starts at */
- gdt2[6].rights = 0x96; /* Stack Segment: r/w */
-
- /* setup GDT entry 7: LDT selector */
- gdt2[7].limit = 7; /* max. offset */
- gdt2[7].addr = ptr2lin(Ldt); /* segment starts at */
- gdt2[7].rights = 0x82; /* Data Segment: r/w */
-
- /* setup GDT entry 8: 286-TSS */
- gdt2[8].limit = 43; /* max. offset */
- gdt2[8].addr = ptr2lin(Tss); /* segment starts at */
- gdt2[8].rights = 0x81; /* TSS */
-}
-
-long get_high_memory(long size)
-{
- int kb = ((int) (size/1024l)+3)&0xfffc; /* we need this much KB */
- int lo, hi, vcpiVer, vcpiStatus;
- int (far *xms_entry)();
- FILE *fp;
-
- /*
- * Let's check for VCPI services.
- */
-
- fp = fopen("EMMXXXX0", "rb");
- if (fp) {
- fclose(fp);
- _asm {
- pusha
- mov ax,0de00h
- int 67h
- mov vcpiVer,bx
- mov vcpiStatus,ax
- popa
- }
- if (!(vcpiStatus&0xff00)) {
- VCPIboot = 1;
- printf("VCPI services Version %d.%d detected!\n", vcpiVer>>8, vcpiVer&0xff);
- }
- }
-
- /*
- * I don't know why, but 386max seems to use the first 64 KB of that
- * XMS area?! So I allocate more ram than I need!
- */
- kb += 128;
-
- _asm {
- pusha
- mov ax,4300h
- int 2fh ; let's look if we have XMS
- cmp al,80h
- je wehaveit ; ok, we have it
- popa
- }
- return 0x110000l; /* default load address */
-
-no: _asm popa
- return 0l;
-
- _asm {
-wehaveit: mov ax,4310h
- int 2fh ; get xms entry point
- mov word ptr [xms_entry],bx
- mov word ptr [xms_entry+2],es
-
- mov ah,8h
- call [xms_entry]
-
- cmp ax,kb
- jb no
-
- mov dx,kb
- mov ah,9h
- call [xms_entry] ; get memory
- cmp ax,0
- je no ; sorry, no memory
-
- mov ah,0ch
- call [xms_entry] ; lock memory block (dx = handle)
- cmp ax,0
- je no
- mov lo,bx
- mov hi,dx
- popa
- }
- return (long)hi*0x10000l+(long)lo + 128l*1024l;
-}
-
-void startprog(long hmaddress, long hmsize, long startaddr, long loadflags,
- long bootdev)
-{
- long GDTaddr=ptr2lin(FreeBSDGdt);
- long *stack=_MK_FP(0x9f00, 0); /* prepare stack for starting the kernel */
- unsigned int pmseg, pmoff;
- unsigned int segment, pcxoff, psioff, pdioff;
- long h, BOOTaddr, ourret;
- unsigned char *page;
- int status;
-
- /*
- * The MSVC 1.5 inline assembler is not able to work with
- * 386 opcodes (ie. extended registers like eax). So we have
- * to use a workaround (god save Micro$oft and their customers ;)
- */
-
- _asm {
- mov segment,cs
- mov ax, offset our_return
- mov pmoff,ax
- }
- BOOTaddr = segment*0x10l;
- ourret = BOOTaddr + (long) pmoff;
-
- _asm {
- push ds
-
- mov ax,cs
- mov ds,ax
- mov bx,offset lab ; patch the far jump after
- mov byte ptr ds:[patch],bl ; switching gdt for FreeBSD
- mov byte ptr ds:[patch+1],bh
-
- mov bx,offset pcx
- mov pcxoff,bx
- mov bx,offset psi
- mov psioff,bx
- mov bx,offset pdi
- mov pdioff,bx
- mov segment,ds
-
- pop ds
- }
-
- *((long *)_MK_FP(segment, pcxoff+1)) = hmsize;
- *((long *)_MK_FP(segment, psioff+1)) = hmaddress;
- *((long *)_MK_FP(segment, pdioff+1)) = startaddr;
-
- h = ptr2lin(&VCPI);
-
- _asm {
- push ds
- mov ax,cs
- mov ds,ax
-
- mov bx,word ptr ss:[h]
- mov cx,word ptr ss:[h+2]
-
- mov byte ptr ds:[patch2+1],bl
- mov byte ptr ds:[patch2+2],bh
- mov byte ptr ds:[patch2+3],cl
- mov byte ptr ds:[patch2+4],ch
-
- pop ds
- }
-
- /*
- * Setup the stack for executing the kernel. These parameters are
- * put on the stack in reversed order (addresses are INCREMENTED)!
- */
-
- *stack++ = startaddr; /* that's the startaddress */
- *stack++ = 8l; /* new CS */
- *stack++ = ourret; /* ourreturn */
- *stack++ = loadflags; /* howto */
- *stack++ = bootdev; /* bootdev */
- *stack++ = 0l; /* Parameter 4 */
- *stack++ = 0l; /* Parameter 5 */
- *stack++ = 0l; /* Parameter 6 */
- *stack++ = ptr2lin(&bootinfo); /* bootinfo */
-
- /*
- * Initialize FreeBSD GDT and GDTR
- */
-
- FreeBSDGdtr.base = GDTaddr;
-
- FreeBSDGdt[3].addr = BOOTaddr;
-
- /*
- * Now, we have to start the kernel at the given startaddress. To do this, we must
- * switch to protected mode using INT15 with AH=0x89. This call uses its own layout
- * of the GDT, so we switch to our own GDT after we return from the INT15 call. But
- * before we do this, we must copy the 64 K which overwrites the HIMEM at 0x100000.
- */
-
- if (!VCPIboot) {
- if (!(status=pm_enter())) {
- _asm {
- cli
- mov ax,18h
- mov ds,ax
- }
- goto nowgo;
- }
- fprintf(stderr, "Can't switch to protected mode!\n");
- fprintf(stderr, "Giving up :-(!\n");
- exit(0);
- }
-
- /*
- * OK. Let's use VCPI services.
- */
-
- Gdtr.base = ptr2lin(gdt2);
- Idtr.base = ptr2lin(idt2);
- setupVCPI();
-
- page = malloc(8192); /* allocate 8 KB */
- if (!page) {
- fprintf(stderr, "not enough memory!\n");
- exit(0);
- }
- memset(page, 0, 8192);
-
- h = (ptr2lin(page)+4095l) & 0xfffff000l;
- pmseg = (unsigned short) (h>>4l);
-
- /*
- * We *do* have VCPI services, so let's get the protected mode
- * interface and page table 0 from the server.
- */
-
- _asm {
- push ds
- push si
- push di
- mov ax,seg gdt2
- mov ds,ax
- mov ax,offset gdt2
- add ax,8
- mov si,ax
- mov ax,pmseg
- mov es,ax
- xor di,di
- mov ax,0xde01
- int 0x67
- pop di
- pop si
- pop ds
- }
-
- /*
- * setup values for the mode change call
- */
-
- *((unsigned long *) MK_FP(pmseg,0x1000)) = h+3l;
-
- VCPI.cr3 = h+0x1000l; /* page dir is the next page */
- VCPI.GdtrAddress = ptr2lin(&Gdtr);
- VCPI.IdtrAddress = ptr2lin(&Idtr);
- VCPI.LDTR = 7*8;
- VCPI.TR = 8*8;
-
- _asm {
- mov ax,offset nowgoVCPI
- mov pmoff,ax
- }
-
- VCPI.EIP = (long) pmoff;
- VCPI.CS = 4*8;
-
- _asm {
- cli
- data32
-patch2: mov si,0
- _emit 0
- _emit 0
- mov ax,0de0ch
- int 67h
-
-nowgoVCPI: ; we are now executing in protected mode
- ; first, we turn paging off!
-
- data32
- _emit 0fh ; this is "mov eax,CR0"
- _emit 20h ;
- _emit 0c0h ;
-
- data32
- and ax,0ffffh
- _emit 0ffh
- _emit 7fh
-
- data32
- _emit 0fh ; this is "mov CR0,eax"
- _emit 22h ; and turns paging off
- _emit 0c0h ;
-
- data32
- xor ax,ax
-
- data32
- _emit 0fh ; this is "mov CR3,eax"
- _emit 22h ; and clears the page cache
- _emit 0d8h ;
-
- mov ax,28h
- mov ds,ax ; load new DS
- mov es,ax
- mov ax,6*8
- mov ss,ax
- }
-
-/*******************************************************************************
- * now this is all executed in protected mode!!!
- */
-
- /* setup new gdt for the FreeBSD kernel */
- _asm {
-nowgo: cli
- lgdt FreeBSDGdtr
-
- data32
- _emit 0eah ; far jump to "lab" (switch cs)
-patch: _emit 0 ; these two bytes are patched with the
- _emit 0 ; correct offset of "lab"
- _emit 0
- _emit 0
- _emit 18h
- _emit 0
-
- ; Setup SS, DS and ES registers with correct values, initialize the
- ; stackpointer to the correct value and execute kernel
-
-lab: mov bx,10h
- _emit 0
- _emit 0
- mov ds,bx
- mov es,bx
- mov ss,bx
-
- ; move kernel to its correct address
-
-pcx: _emit 0b9h ; Micro$oft knows, why "mov cx,0" does not
- _emit 0 ; work here
- _emit 0
- _emit 0
- _emit 0
-psi: _emit 0beh ; mov si,0
- _emit 0
- _emit 0
- _emit 0
- _emit 0
-pdi: _emit 0bfh ; mov di,0
- _emit 0
- _emit 0
- _emit 0x10
- _emit 0
-
- rep movsb
-
- ; MSVC is unable to assemble this instruction: mov esp,09f000h
-
- mov sp,0f000h
- _emit 9h
- _emit 0
- retf ; execute kernel
-our_return: jmp our_return
- }
- /* not reached */
-}
diff --git a/sys/i386/boot/dosboot/protmod.h b/sys/i386/boot/dosboot/protmod.h deleted file mode 100644 index 2faf975..0000000 --- a/sys/i386/boot/dosboot/protmod.h +++ /dev/null @@ -1,35 +0,0 @@ -/*
- * protmod.h Protected Mode Utilities
- *
- * (C) 1994 by Christian Gusenbauer (cg@fimp01.fim.uni-linz.ac.at)
- * 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.
- *
- * I ALLOW YOU USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. I DISCLAIM
- * ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
- * USE OF THIS SOFTWARE.
- *
- */
-extern struct bootinfo bootinfo;
-extern int VCPIboot;
-
-extern int pm_copy(char far *from, unsigned long to, unsigned long count);
-/* pm_copy copies "count" bytes from location "from" (valid C pointer) to the
- * address "to" in the high-memory space.
- */
-
-extern void startprog(long hmaddress, long size, long startaddr, long loadflags,
- long bootdev);
-/* startprog switches to protected mode, moves the kernel from hmaddress
- * to 0x100000l and finally starts the kernel.
- */
-
-extern long get_high_memory(long size);
-/* get_high_memory allocates size bytes from high memory (>1MB) and returns
- * the address of this area.
- */
diff --git a/sys/i386/boot/dosboot/quota.h b/sys/i386/boot/dosboot/quota.h deleted file mode 100644 index b309913..0000000 --- a/sys/i386/boot/dosboot/quota.h +++ /dev/null @@ -1,208 +0,0 @@ -/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Robert Elz at The University of Melbourne.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)quota.h 7.9 (Berkeley) 2/22/91
- * $FreeBSD$
- */
-
-#ifndef _QUOTA_
-#define _QUOTA_
-
-/*
- * Definitions for disk quotas imposed on the average user
- * (big brother finally hits UNIX).
- *
- * The following constants define the amount of time given a user
- * before the soft limits are treated as hard limits (usually resulting
- * in an allocation failure). The timer is started when the user crosses
- * their soft limit, it is reset when they go below their soft limit.
- */
-#define MAX_IQ_TIME (7*24*60*60) /* 1 week */
-#define MAX_DQ_TIME (7*24*60*60) /* 1 week */
-
-/*
- * The following constants define the usage of the quota file array
- * in the ufsmount structure and dquot array in the inode structure.
- * The semantics of the elements of these arrays are defined in the
- * routine getinoquota; the remainder of the quota code treats them
- * generically and need not be inspected when changing the size of
- * the array.
- */
-enum quotatype {
- USRQUOTA = 0, /* element used for user quotas */
- GRPQUOTA = 1, /* element used for group quotas */
- MAXQUOTAS = 2
-};
-
-/*
- * Definitions for the default names of the quotas files.
- */
-#define INITQFNAMES { \
- "user", /* USRQUOTA */ \
- "group", /* GRPQUOTA */ \
- "undefined", \
-};
-#define QUOTAFILENAME "quota"
-#define QUOTAGROUP "operator"
-
-/*
- * Command definitions for the 'quotactl' system call.
- * The commands are broken into a main command defined below
- * and a subcommand that is used to convey the type of
- * quota that is being manipulated (see above).
- */
-#define SUBCMDMASK 0x00ff
-#define SUBCMDSHIFT 8
-#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
-
-#define Q_QUOTAON 0x0100 /* enable quotas */
-#define Q_QUOTAOFF 0x0200 /* disable quotas */
-#define Q_GETQUOTA 0x0300 /* get limits and usage */
-#define Q_SETQUOTA 0x0400 /* set limits and usage */
-#define Q_SETUSE 0x0500 /* set usage */
-#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
-
-/*
- * The following structure defines the format of the disk quota file
- * (as it appears on disk) - the file is an array of these structures
- * indexed by user or group number. The setquota system call establishes
- * the vnode for each quota file (a pointer is retained in the ufsmount
- * structure).
- */
-struct dqblk {
- u_long dqb_bhardlimit; /* absolute limit on disk blks alloc */
- u_long dqb_bsoftlimit; /* preferred limit on disk blks */
- u_long dqb_curblocks; /* current block count */
- u_long dqb_ihardlimit; /* maximum # allocated inodes + 1 */
- u_long dqb_isoftlimit; /* preferred inode limit */
- u_long dqb_curinodes; /* current # allocated inodes */
- time_t dqb_btime; /* time limit for excessive disk use */
- time_t dqb_itime; /* time limit for excessive files */
-};
-
-#ifdef KERNEL
-/*
- * The following structure records disk usage for a user or group on a
- * filesystem. There is one allocated for each quota that exists on any
- * filesystem for the current user or group. A cache is kept of recently
- * used entries.
- */
-struct dquot {
- struct dquot *dq_forw, *dq_back;/* MUST be first entry */
- struct dquot *dq_freef, **dq_freeb; /* free list */
- short dq_flags; /* flags, see below */
- short dq_cnt; /* count of active references */
- short dq_spare; /* unused spare padding */
- short dq_type; /* quota type of this dquot */
- u_long dq_id; /* identifier this applies to */
- struct ufsmount *dq_ump; /* filesystem that this is taken from */
- struct dqblk dq_dqb; /* actual usage & quotas */
-};
-/*
- * Flag values.
- */
-#define DQ_LOCK 0x01 /* this quota locked (no MODS) */
-#define DQ_WANT 0x02 /* wakeup on unlock */
-#define DQ_MOD 0x04 /* this quota modified since read */
-#define DQ_FAKE 0x08 /* no limits here, just usage */
-#define DQ_BLKS 0x10 /* has been warned about blk limit */
-#define DQ_INODS 0x20 /* has been warned about inode limit */
-/*
- * Shorthand notation.
- */
-#define dq_bhardlimit dq_dqb.dqb_bhardlimit
-#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
-#define dq_curblocks dq_dqb.dqb_curblocks
-#define dq_ihardlimit dq_dqb.dqb_ihardlimit
-#define dq_isoftlimit dq_dqb.dqb_isoftlimit
-#define dq_curinodes dq_dqb.dqb_curinodes
-#define dq_btime dq_dqb.dqb_btime
-#define dq_itime dq_dqb.dqb_itime
-
-/*
- * If the system has never checked for a quota for this file,
- * then it is set to NODQUOT. Once a write attempt is made
- * the inode pointer is set to reference a dquot structure.
- */
-#define NODQUOT ((struct dquot *) 0)
-
-/*
- * Flags to chkdq() and chkiq()
- */
-#define FORCE 0x01 /* force usage changes independent of limits */
-#define CHOWN 0x02 /* (advisory) change initiated by chown */
-
-/*
- * Macros to avoid subroutine calls to trivial functions.
- */
-#ifndef DIAGNOSTIC
-#define DQREF(dq) (dq)->dq_cnt++
-#else
-#define DQREF(dq) dqref(dq)
-#endif /* DIAGNOSTIC */
-
-struct inode; struct ucred; struct mount; struct vnode;
-
-int getinoquota(struct inode *);
-int chkdq(struct inode *, long, struct ucred *, int);
-int chkdqchg(struct inode *, long, struct ucred *, enum quotatype);
-int chkiq(struct inode *, long, struct ucred *, int);
-int chkiqchg(struct inode *, long, struct ucred *, enum quotatype);
-#ifdef DIAGNOSTIC
-void chkdquot(struct inode *);
-#endif
-int quotaon(struct proc *, struct mount *, enum quotatype, caddr_t);
-int quotaoff(struct proc *, struct mount *, enum quotatype);
-int getquota(struct mount *, u_long, enum quotatype, caddr_t);
-int setquota(struct mount *, u_long, enum quotatype, caddr_t);
-int setuse(struct mount *, u_long, enum quotatype, caddr_t);
-int qsync(struct mount *);
-void dqinit(void);
-int dqget(struct vnode *, u_long, struct ufsmount *, enum quotatype, struct dquot **);
-void dqref(struct dquot *);
-void dqrele(struct vnode *, struct dquot *);
-int dqsync(struct vnode *, struct dquot *);
-void dqflush(struct vnode *);
-
-#else
-
-#include "cdefs.h"
-
-__BEGIN_DECLS
-int quotactl __P((const char *, int, int, void *));
-__END_DECLS
-
-#endif /* _KERNEL */
-#endif /* _QUOTA_ */
diff --git a/sys/i386/boot/dosboot/readme b/sys/i386/boot/dosboot/readme deleted file mode 100644 index f4e273f..0000000 --- a/sys/i386/boot/dosboot/readme +++ /dev/null @@ -1,41 +0,0 @@ -Hi Everybody!
-
-This is version 1.5 of "fbsdboot", a program that allows you to boot a kernel
-from a MS-DOS partition or a FreeBSD partition. This program runs using DOS.
-It works with various memory managers (like EMM386, 386MAX) under certain
-circumstances.
-
-First, a FreeBSD kernel is always loaded to memory starting at 0x100000. To
-assure that loading the kernel *does not* overwrite memory used by memory
-managers, high memory for the kernel is allocated and after loading the kernel
-it's moved to 0x100000.
-
-Second, there are many ways to switch to protected mode which is necessary to
-start the kernel. Each BIOS gives you the possibility to use INT15H (AH=89H)
-to do that. But some memory-managers like 386max does not allow you to use
-this method.
-
-An other way to do the switch is to use DPMI services, but they do not
-guarantee, that the protected mode application is executed with privilege
-level 0. Therefore this method is *not* used.
-
-VCPI services offer another way to switch to protected mode, and VCPI servers
-are built into "emm386.exe", "386max" and "qemm". That's why, this method is
-implemented in fbsdboot.exe.
-
-Fbsdboot.exe tries to switch to protected mode using VCPI services. If they're
-not available INT15H is used to do the switch. If that fails, it's not possible
-for this version of fbsdboot.exe to boot a kernel :-(.
-
-You can get commandline options of fbsdboot if you start it with "-?" as option!
-
-I don't know, if fbsdboot works with QEMM, as I don't have the possibility to
-test it.
-
-Enjoy and have fun!
-
-Christian.
-cg@fimp01.fim.uni-linz.ac.at
-
-
-PS: Many thanks to Bruce Evans for his assistance!
diff --git a/sys/i386/boot/dosboot/reboot.h b/sys/i386/boot/dosboot/reboot.h deleted file mode 100644 index 65453b0..0000000 --- a/sys/i386/boot/dosboot/reboot.h +++ /dev/null @@ -1,102 +0,0 @@ -/*
- * Copyright (c) 1982, 1986, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)reboot.h 8.1 (Berkeley) 6/2/93
- * $FreeBSD$
- */
-
-#ifndef _SYS_REBOOT_H_
-#define _SYS_REBOOT_H_
-
-/*
- * Arguments to reboot system call.
- * These are passed to boot program in r11,
- * and on to init.
- */
-#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */
-
-#define RB_ASKNAME 0x01 /* ask for file name to reboot from */
-#define RB_SINGLE 0x02 /* reboot to single user only */
-#define RB_NOSYNC 0x04 /* dont sync before reboot */
-#define RB_HALT 0x08 /* don't reboot, just halt */
-#define RB_INITNAME 0x10 /* name given for /etc/init (unused) */
-#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */
-#define RB_KDB 0x40 /* give control to kernel debugger */
-#define RB_RDONLY 0x80 /* mount root fs read-only */
-#define RB_DUMP 0x100 /* dump kernel memory before reboot */
-#define RB_MINIROOT 0x200 /* mini-root present in memory at boot time */
-#define RB_CONFIG 0x400 /* invoke user configuration routing */
-#define RB_VERBOSE 0x800 /* print all potentially useful info */
-#define RB_SERIAL 0x1000 /* user serial port as console */
-#define RB_CDROM 0x2000 /* use cdrom as root */
-#define RB_POWEROFF 0x4000 /* if you can, turn the power off */
-#define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */
-
-#define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */
-
-/*
- * Constants for converting boot-style device number to type,
- * adaptor (uba, mba, etc), unit number and partition number.
- * Type (== major device number) is in the low byte
- * for backward compatibility. Except for that of the "magic
- * number", each mask applies to the shifted value.
- * Format:
- * (4) (4) (4) (4) (8) (8)
- * --------------------------------
- * |MA | AD| CT| UN| PART | TYPE |
- * --------------------------------
- */
-#define B_ADAPTORSHIFT 24
-#define B_ADAPTORMASK 0x0f
-#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
-#define B_CONTROLLERSHIFT 20
-#define B_CONTROLLERMASK 0xf
-#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
-#define B_UNITSHIFT 16
-#define B_UNITMASK 0xf
-#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK)
-#define B_PARTITIONSHIFT 8
-#define B_PARTITIONMASK 0xff
-#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
-#define B_TYPESHIFT 0
-#define B_TYPEMASK 0xff
-#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK)
-
-#define B_MAGICMASK ((u_long)0xf0000000)
-#define B_DEVMAGIC ((u_long)0xa0000000)
-
-#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
- (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
- ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
- ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
-
-#endif
diff --git a/sys/i386/boot/dosboot/sys.c b/sys/i386/boot/dosboot/sys.c deleted file mode 100644 index 04a25af..0000000 --- a/sys/i386/boot/dosboot/sys.c +++ /dev/null @@ -1,173 +0,0 @@ -/*
- * 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.
- *
- * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd
- * $FreeBSD$
- */
-#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-
-#define bcopy(a,b,c) memcpy(b,a,c)
-
-#include "protmod.h"
-#include "boot.h"
-#include "dir.h"
-
-#define BUFSIZE 4096
-#undef MAXBSIZE
-#define MAXBSIZE 8192
-
-void ufs_read(char *buffer, long count);
-static long block_map(long file_block);
-
-char buf[BUFSIZE], fsbuf[SBSIZE], iobuf[MAXBSIZE];
-char mapbuf[MAXBSIZE];
-long mapblock = 0;
-
-void xread(unsigned long addr, long size)
-{
- long count = BUFSIZE;
- while (size > 0l) {
- if (BUFSIZE > size)
- count = size;
- ufs_read(buf, count);
- pm_copy(buf, addr, count);
- size -= count;
- addr += count;
- }
-}
-
-void ufs_read(char *buffer, long count)
-{
- long logno, off, size;
- long cnt2, bnum2;
-
- while (count) {
- off = blkoff(fs, poff);
- logno = lblkno(fs, poff);
- cnt2 = size = blksize(fs, &inode, logno);
- bnum2 = fsbtodb(fs, block_map(logno)) + boff;
- cnt = cnt2;
- bnum = bnum2;
- if ( (!off) && (size <= count))
- {
- iodest = buffer;
- devread();
- }
- else
- {
- iodest = iobuf;
- size -= off;
- if (size > count)
- size = count;
- devread();
- bcopy(iodest+off,buffer,size);
- }
- buffer += size;
- count -= size;
- poff += size;
- }
-}
-
-static int find(char *path)
-{
- char *rest, ch;
- long block, off, loc, ino = ROOTINO;
- struct direct *dp;
-loop: iodest = iobuf;
- cnt = fs->fs_bsize;
- bnum = fsbtodb(fs,itod(fs,ino)) + boff;
- devread();
- bcopy(&((struct dinode *)iodest)[ino % fs->fs_inopb],
- &inode.i_din,
- sizeof (struct dinode));
- if (!*path)
- return 1;
- while (*path == '/')
- path++;
- if (!inode.i_size || ((inode.i_mode&IFMT) != IFDIR))
- return 0;
- for (rest = path; (ch = *rest) && ch != '/'; rest++) ;
- *rest = 0;
- loc = 0;
- do {
- if (loc >= inode.i_size)
- return 0;
- if (!(off = blkoff(fs, loc))) {
- block = lblkno(fs, loc);
- cnt = blksize(fs, &inode, block);
- bnum = fsbtodb(fs, block_map(block)) + boff;
- iodest = iobuf;
- devread();
- }
- dp = (struct direct *)(iodest + off);
- loc += dp->d_reclen;
- } while (!dp->d_ino || strcmp(path, dp->d_name));
- ino = dp->d_ino;
- *(path = rest) = ch;
- goto loop;
-}
-
-static long block_map(long 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 (((long *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]);
-}
-
-int openrd(char *name)
-{
- char *cp = name;
-
- dosdev = 0x80; /* only 1st HD supported yet */
- 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();
- /***********************************************\
- * Find the actual FILE on the mounted device *
- \***********************************************/
- if (!find(cp)) return 1;
- poff = 0;
- name = cp;
- return 0;
-}
diff --git a/sys/i386/boot/dosboot/syslimit.h b/sys/i386/boot/dosboot/syslimit.h deleted file mode 100644 index 0d91423..0000000 --- a/sys/i386/boot/dosboot/syslimit.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)syslimits.h 7.4 (Berkeley) 2/4/91 - * $FreeBSD$ - */ - -#ifndef _SYS_SYSLIMITS_H_ -#define _SYS_SYSLIMITS_H_ 1 - -#define ARG_MAX 32768 /* max bytes for an exec function */ -#define CHILD_MAX 40 /* max simultaneous processes */ -#define LINK_MAX 32767 /* max file link count */ -#define MAX_CANON 255 /* max bytes in terminal canonical input line */ -#define MAX_INPUT 255 /* max bytes in terminal input */ -#define NAME_MAX 255 /* max number of bytes in a file name */ -#define NGROUPS_MAX 16 /* max number of supplemental group id's */ -#define OPEN_MAX 64 /* max open files per process */ -#define PATH_MAX 1024 /* max number of bytes in pathname */ -#define PIPE_BUF 512 /* max number of bytes for atomic pipe writes */ - -#define BC_BASE_MAX 99 /* max ibase/obase values allowed by bc(1) */ -#define BC_DIM_MAX 2048 /* max array elements allowed by bc(1) */ -#define BC_SCALE_MAX 99 /* max scale value allowed by bc(1) */ -#define BC_STRING_MAX 1000 /* max const string length allowed by bc(1) */ -#define EQUIV_CLASS_MAX 2 /* max weights for order keyword; see locale */ -#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ -#define LINE_MAX 2048 /* max length in bytes of an input line */ -#define RE_DUP_MAX 255 /* max repeated RE's using interval notation */ -#endif /* _SYS_SYSLIMITS_H_ */ diff --git a/sys/i386/boot/dosboot/sysparam.h b/sys/i386/boot/dosboot/sysparam.h deleted file mode 100644 index 4f93f2c..0000000 --- a/sys/i386/boot/dosboot/sysparam.h +++ /dev/null @@ -1,225 +0,0 @@ -/*-
- * Copyright (c) 1982, 1986, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)param.h 8.2 (Berkeley) 1/21/94
- * $FreeBSD$
- */
-
-#ifndef _SYS_PARAM_H_
-#define _SYS_PARAM_H_
-
-#define BSD 199306 /* System version (year & month). */
-#define BSD4_3 1
-#define BSD4_4 1
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef LOCORE
-#include "types.h"
-#endif
-
-/*
- * Machine-independent constants (some used in following include files).
- * Redefined constants are from POSIX 1003.1 limits file.
- *
- * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
- * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
- */
-#include "syslimits.h"
-
-#define MAXCOMLEN 16 /* max command name remembered */
-#define MAXINTERP 32 /* max interpreter file name length */
-#define MAXLOGNAME 12 /* max login name length */
-#define MAXUPRC CHILD_MAX /* max simultaneous processes */
-#define NCARGS ARG_MAX /* max bytes for an exec function */
-#define NGROUPS NGROUPS_MAX /* max number groups */
-#define NOFILE OPEN_MAX /* max open files per process */
-#define NOGROUP 65535 /* marker for empty group set member */
-#define MAXHOSTNAMELEN 256 /* max hostname size */
-
-/* More types and definitions used throughout the kernel. */
-#ifdef KERNEL
-/*
-include <sys/cdefs.h>
-include <sys/errno.h>
-include <sys/time.h>
-include <sys/resource.h>
-include <sys/ucred.h>
-include <sys/uio.h>
-include <sys/rtprio.h>
-*/
-#endif
-
-/* Signals. */
-/*#include <sys/signal.h>*/
-
-/* Machine type dependent parameters. */
-#include "param.h"
-#include "limits.h"
-
-/*
- * Priorities. Note that with 32 run queues, differences less than 4 are
- * insignificant.
- */
-#define PSWP 0
-#define PVM 4
-#define PINOD 8
-#define PRIBIO 16
-#define PVFS 20
-#define PZERO 22 /* No longer magic, shouldn't be here. XXX */
-#define PSOCK 24
-#define PWAIT 32
-#define PLOCK 36
-#define PPAUSE 40
-#define PUSER 50
-#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */
-
-#define PRIMASK 0x0ff
-#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
-
-#define NZERO 0 /* default "nice" */
-
-#define NBPW sizeof(long) /* number of bytes per word (integer) */
-
-#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
-#define NODEV (dev_t)(-1) /* non-existent device */
-
-/*
- * Clustering of hardware pages on machines with ridiculously small
- * page sizes is done here. The paging subsystem deals with units of
- * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each.
- */
-#define CLBYTES (CLSIZE*NBPG)
-#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
-#define claligned(x) ((((long)(x))&CLOFSET)==0)
-#define CLOFF CLOFSET
-#define CLSHIFT (PGSHIFT+CLSIZELOG2)
-
-#if CLSIZE==1
-#define clbase(i) (i)
-#define clrnd(i) (i)
-#else
-/* Give the base virtual address (first of CLSIZE). */
-#define clbase(i) ((i) &~ (CLSIZE-1))
-/* Round a number of clicks up to a whole cluster. */
-#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
-#endif
-
-#define CBLOCK 128 /* Clist block size, must be a power of 2. */
-#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */
- /* Data chars/clist. */
-#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE)
-#define CROUND (CBLOCK - 1) /* Clist rounding. */
-
-/*
- * File system parameters and macros.
- *
- * The file system is made out of blocks of at most MAXBSIZE units, with
- * smaller units (fragments) only in the last direct block. MAXBSIZE
- * primarily determines the size of buffers in the buffer pool. It may be
- * made larger without any effect on existing file systems; however making
- * it smaller make make some file systems unmountable.
- */
-#define MAXBSIZE MAXPHYS
-#define MAXFRAG 8
-
-/*
- * MAXPATHLEN defines the longest permissable path length after expanding
- * symbolic links. It is used to allocate a temporary buffer from the buffer
- * pool in which to do the name expansion, hence should be a power of two,
- * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
- * maximum number of symbolic links that may be expanded in a path name.
- * It should be set high enough to allow all legitimate uses, but halt
- * infinite loops reasonably quickly.
- */
-#define MAXPATHLEN PATH_MAX
-#define MAXSYMLINKS 8
-
-/* Bit map related macros. */
-#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
-#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
-#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
-#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
-
-/* Macros for counting and rounding. */
-#ifndef howmany
-#define howmany(x, y) (((x)+((y)-1))/(y))
-#endif
-#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
-#define powerof2(x) ((((x)-1)&(x))==0)
-
-/* Macros for min/max. */
-#ifndef KERNEL
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-/*
- * Constants for setting the parameters of the kernel memory allocator.
- *
- * 2 ** MINBUCKET is the smallest unit of memory that will be
- * allocated. It must be at least large enough to hold a pointer.
- *
- * Units of memory less or equal to MAXALLOCSAVE will permanently
- * allocate physical memory; requests for these size pieces of
- * memory are quite fast. Allocations greater than MAXALLOCSAVE must
- * always allocate and free physical memory; requests for these
- * size allocations should be done infrequently as they will be slow.
- *
- * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
- * MAXALLOCSIZE must be a power of two.
- */
-#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */
-#define MAXALLOCSAVE (2 * CLBYTES)
-
-/*
- * Scale factor for scaled integers used to count %cpu time and load avgs.
- *
- * The number of CPU `tick's that map to a unique `%age' can be expressed
- * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that
- * can be calculated (assuming 32 bits) can be closely approximated using
- * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
- *
- * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
- * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
- */
-#define FSHIFT 11 /* bits to right of fixed binary point */
-#define FSCALE (1<<FSHIFT)
-
-#endif
diff --git a/sys/i386/boot/dosboot/types.h b/sys/i386/boot/dosboot/types.h deleted file mode 100644 index fd767f8..0000000 --- a/sys/i386/boot/dosboot/types.h +++ /dev/null @@ -1,175 +0,0 @@ -/*-
- * Copyright (c) 1982, 1986, 1991, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)types.h 8.4 (Berkeley) 1/21/94
- * $FreeBSD$
- */
-
-#ifndef _SYS_TYPES_H_
-#define _SYS_TYPES_H_
-
-#include "cdefs.h"
-
-/* Machine type dependent parameters. */
-#include "endian.h"
-
-#ifndef _POSIX_SOURCE
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-typedef unsigned short ushort; /* Sys V compatibility */
-typedef unsigned int uint; /* Sys V compatibility */
-#endif
-
-struct __help__ {
- long a,b;
-};
-
-typedef struct __help__ u_quad_t; /* quads */
-typedef struct __help__ quad_t;
-typedef quad_t * qaddr_t;
-
-typedef char * caddr_t; /* core address */
-typedef long daddr_t; /* disk address */
-typedef unsigned short dev_t; /* device number (cg: was u_long) */
-typedef unsigned long fixpt_t; /* fixed point number */
-typedef unsigned short gid_t; /* group id */
-typedef unsigned long ino_t; /* inode number */
-typedef unsigned short mode_t; /* permissions */
-typedef unsigned short nlink_t; /* link count */
-typedef long off_t; /* file offset (cg: was quad) */
-typedef long pid_t; /* process id */
-typedef long segsz_t; /* segment size */
-typedef long swblk_t; /* swap offset */
-typedef unsigned short uid_t; /* user id */
-
-/*
- * This belongs in unistd.h, but is placed here to ensure that programs
- * casting the second parameter of lseek to off_t will get the correct
- * version of lseek.
- */
-#ifndef KERNEL
-__BEGIN_DECLS
-off_t lseek __P((int, off_t, int));
-__END_DECLS
-#endif
-
-#ifndef _POSIX_SOURCE
-/*
- * minor() gives a cookie instead of an index since we don't want to
- * change the meanings of bits 0-15 or waste time and space shifting
- * bits 16-31 for devices that don't use them.
- */
-#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
-#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
-#define makedev(x,y) ((dev_t)(((x)<<8) | (y))) /* create dev_t */
-#endif
-
-#include "ansi.h"
-/*#include <machine/types.h>*/
-
-#ifdef _BSD_CLOCK_T_
-typedef _BSD_CLOCK_T_ clock_t;
-#undef _BSD_CLOCK_T_
-#endif
-
-#ifdef _BSD_SIZE_T_
-typedef _BSD_SIZE_T_ size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#ifdef _BSD_SSIZE_T_
-typedef _BSD_SSIZE_T_ ssize_t;
-#undef _BSD_SSIZE_T_
-#endif
-
-#ifdef _BSD_TIME_T_
-typedef _BSD_TIME_T_ time_t;
-#undef _BSD_TIME_T_
-#endif
-
-#ifndef _POSIX_SOURCE
-#define NBBY 8 /* number of bits in a byte */
-
-/*
- * Select uses bit masks of file descriptors in longs. These macros
- * manipulate such bit fields (the filesystem macros use chars).
- * FD_SETSIZE may be defined by the user, but the default here should
- * be enough for most uses.
- */
-#ifndef FD_SETSIZE
-#define FD_SETSIZE 256
-#endif
-
-typedef long fd_mask;
-#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
-
-#ifndef howmany
-#define howmany(x, y) (((x)+((y)-1))/(y))
-#endif
-
-typedef struct fd_set {
- fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
-} fd_set;
-
-#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
-#define FD_ZERO(p) bzero(p, sizeof(*(p)))
-
-#if defined(__STDC__) && defined(_KERNEL)
-/*
- * Forward structure declarations for function prototypes. We include the
- * common structures that cross subsystem boundaries here; others are mostly
- * used in the same place that the structure is defined.
- */
-struct proc;
-struct pgrp;
-struct ucred;
-struct rusage;
-struct file;
-struct buf;
-struct tty;
-struct uio;
-#endif
-
-typedef long time_t;
-
-#endif /* !_POSIX_SOURCE */
-#endif /* !_SYS_TYPES_H_ */
diff --git a/sys/i386/boot/kzipboot/Makefile b/sys/i386/boot/kzipboot/Makefile deleted file mode 100644 index 1c37ac4..0000000 --- a/sys/i386/boot/kzipboot/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# $FreeBSD$ - -PROG= kztail.o kzhead.o -BINMODE = 444 # target is a relocatable object -SRCS= tail.S head.S boot.c unzip.c misc.c malloc.c inflate.c -OBJS_KZHEAD= head.o -OBJS_KZTAIL= tail.o boot.o unzip.o misc.o malloc.o inflate.o -BINDIR= /usr/lib/aout -.PATH: ${.CURDIR}/../../../kern -NOMAN= toobad - -# Where to load the kernel -KADDR = 0x100000 - -# What segment our code lives in -CSEG = 0x8 - -STRIP= # very important!! don't let kz*.o be stripped - -CFLAGS+= -DKADDR=$(KADDR) -DCSEG=$(CSEG) -CFLAGS+= -DKZIP -DCOMCONSOLE=0x3F8 - -kztail.o: ${OBJS_KZTAIL} - $(LD) -aout -r -x -o kztail.o $(OBJS_KZTAIL) - -kzhead.o: ${OBJS_KZHEAD} - $(LD) -aout -r -x -o kzhead.o $(OBJS_KZHEAD) - -.include <bsd.prog.mk> diff --git a/sys/i386/boot/kzipboot/README b/sys/i386/boot/kzipboot/README deleted file mode 100644 index 2845cbe..0000000 --- a/sys/i386/boot/kzipboot/README +++ /dev/null @@ -1,49 +0,0 @@ -/* Beware: mostly obsolete info */ - -This is the first (alpha) release of kernel packer/unpacker -for FreeBSD. It is based on xBoot from Linux, but -hardly rewritten. - -It assumes that: -1) The kernel should be loaded at 0x100000 phys address. -2) The CS selector is equal to 8, which is OK for all - current secondary boot programs. - -Run "make install" to install it. It will place -"kzip" shell script into /usr/sbin, and several files -into /usr/libexec/kzip directory. - -Then try to zip your kernel, for example: - - % kzip /kernel - System size is 462848 - Compressed size 247027 - -It will create file /kernel.kz: - - % ls -l /kernel /kernel.kz - -rwxr-xr-x 1 root 497297 Oct 8 12:41 /386bsd - -rwxrwxr-x 1 root 262144 Oct 8 13:37 /386bsd.kz - -Then rename /kernel.kz to /kernel and reboot. - - % mv /kernel /o3kernel - % mv /kernel.kz /kernel - % sync - % reboot - -During booting, you will see the message: - - Uncompressing kernel...done - Booting the kernel - -The packed kernel should load and run. - -The main problem with packed kernel is the lack of symbol table, -so all commands that require it, will not run. -Among them: ps, savecore, *stat, etc. - -Packed kernels are good for install and fixit floppies. - -Serge Vakulenko, <vak@zebub.msk.su> -Opdated for FreeBSD 2.1 by Gary Jennejohn 12FEB95 diff --git a/sys/i386/boot/kzipboot/boot.c b/sys/i386/boot/kzipboot/boot.c deleted file mode 100644 index 5cc843a..0000000 --- a/sys/i386/boot/kzipboot/boot.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * FreeBSD kernel unpacker. - * 1993 by Serge Vakulenko - * modified for FreeBSD 2.1 by Gary Jennejohn - 12FEB95 - */ - -#include <sys/types.h> -#include <sys/reboot.h> /* for RB_SERIAL */ - -#include <machine/cpufunc.h> /* for inb/outb */ - -short *videomem; -int curs; -int cols; -int lines; -unsigned int port; - -unsigned char bios[0x100]; - -extern int end, edata; -void *storage; -void *inbuf; -void *outbuf; -void *window; - -void decompress_kernel (void *dest); - -int memcmp (const void *arg1, const void *arg2, unsigned len) -{ - unsigned char *a = (unsigned char*) arg1; - unsigned char *b = (unsigned char*) arg2; - - for (; len-- > 0; ++a, ++b) - if (*a < *b) - return (-1); - else if (*a > *b) - return (1); - return (0); -} - -void *memcpy (void *to, const void *from, unsigned len) -{ - char *f = (char*) from; - char *t = (char*) to; - - while (len-- > 0) - *t++ = *f++; - return (to); -} - -void serial_putchar (unsigned char c) -{ - unsigned char stat; - - if (c == '\n') - serial_putchar('\r'); - do { - stat = inb (COMCONSOLE+5); - } while (!(stat & 0x20)); - - outb (COMCONSOLE, c); -} - -void putchar (unsigned char c) -{ - switch (c) { - case '\n': curs = (curs + cols) / cols * cols; break; - default: videomem[curs++] = 0x0700 | c; break; - } - while (curs >= cols*lines) { - int col; - - memcpy (videomem, videomem+cols, (lines-1) * cols * 2); - for (col = 0; col < cols; col++) - videomem[(lines - 1) * cols + col] = 0x720; - curs -= cols; - } - /* set cursor position */ - outb (port, 0x0e); outb (port+1, curs>>8); - outb (port, 0x0f); outb (port+1, curs); -} - -int use_serial; - -void putstr (char *s) -{ - while (*s) { - if (use_serial) - serial_putchar (*s++); - else - putchar (*s++); - } -} - -void error (char *s) -{ - putstr ("\n\n"); - putstr (s); - putstr ("\n\n -- System halted"); - while (1); /* Halt */ -} - -void boot (int howto) -{ - int l, c, *p; - - /* clear bss */ - for (p = &edata; p < &end; ++p) - *p = 0; - - inbuf = (void *)0x20000; - outbuf = (void *)0x30000; - window = (void *)0x40000; - storage = (void *)0x50000; - - if (!(use_serial = (howto & RB_SERIAL))) { - /* Test for monochrome video adapter */ - if ((*((unsigned char*) 0x410) & 0x30) == 0x30) - videomem = (void*) 0xb0000; /* monochrome */ - else - videomem = (void*) 0xb8000; /* color */ - - port = *(unsigned short*) 0x463; - cols = *(unsigned short*) 0x44a; - lines = 1 + *(unsigned char*) 0x484; - c = *(unsigned char*) 0x450; - l = *(unsigned char*) 0x451; - - if (lines < 25) - lines = 25; - curs = l*cols + c; - if (curs > lines*cols) - curs = (lines-1) * cols; - } - - putstr ("Uncompressing kernel..."); - decompress_kernel ((void*) KADDR); - putstr ("done\n"); - putstr ("Booting the kernel\n"); -} diff --git a/sys/i386/boot/kzipboot/gzip.h b/sys/i386/boot/kzipboot/gzip.h deleted file mode 100644 index e578532..0000000 --- a/sys/i386/boot/kzipboot/gzip.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * gzip.h -- common declarations for all gzip modules - * Copyright (C) 1992-1993 Jean-loup Gailly. - * Adapted for FreeBSD boot unpacker by Serge Vakulenko. - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - */ - -typedef unsigned char uchar; -typedef unsigned long ulong; - -#define NULL 0 - -#define STORED 0 /* Compression methods */ -#define COMPRESSED 1 -#define PACKED 2 -#define DEFLATED 8 /* methods 3 to 7 reserved */ - -#define INBUFSIZ 0x8000 /* input buffer size */ - -#define OUTBUFSIZ 16384 /* output buffer size */ -#define OUTBUF_EXTRA 2048 /* required by unlzw() */ - -#define GZIP_MAGIC "\037\213" /* gzip files, 1F 8B */ -#define OLD_GZIP_MAGIC "\037\236" /* gzip 0.5 = freeze 1.x */ -#define PKZIP_MAGIC "PK\003\004" /* pkzip files */ -#define PACK_MAGIC "\037\036" /* packed files */ -#define LZW_MAGIC "\037\235" /* lzw files, 1F 9D */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* file probably ascii text */ -#define CONTINUATION 0x02 /* cont. of multi-part gzip file */ -#define EXTRA_FIELD 0x04 /* extra field present */ -#define ORIG_NAME 0x08 /* original file name present */ -#define COMMENT 0x10 /* file comment present */ -#define ENCRYPTED 0x20 /* file is encrypted */ -#define RESERVED 0xC0 /* reserved */ - -/* window size--must be a power of two, and */ -/* at least 32K for zip's deflate method */ -#define WSIZE 0x8000 - -extern int method; /* compression method */ - -extern uchar *inbuf; /* input buffer */ -extern uchar *outbuf; /* output buffer */ -extern uchar *window; /* Sliding window and suffix table (unlzw) */ - -extern unsigned insize; /* valid bytes in inbuf */ -extern unsigned inptr; /* index of next byte to be processed in inbuf */ -extern unsigned outcnt; /* bytes in output buffer */ - -extern int pkzip; /* set for a pkzip file */ -extern int extended; /* set if extended local header */ -extern ulong crc; /* shift register contents */ -extern ulong output_ptr; /* total output bytes */ - -extern void unzip (void); -extern void check_zipfile (void); -extern void updcrc (uchar *s, unsigned n); -extern void clear_bufs (void); -extern void fill_inbuf (void); -extern void flush_window (void); -extern void error (char *m); - -static inline uchar get_byte () -{ - if (inptr >= insize) - fill_inbuf (); - return (inbuf[inptr++]); -} - -static inline void put_char (uchar c) -{ - window[outcnt++] = c; - if (outcnt == WSIZE) - flush_window(); -} diff --git a/sys/i386/boot/kzipboot/head.S b/sys/i386/boot/kzipboot/head.S deleted file mode 100644 index 914e5e2..0000000 --- a/sys/i386/boot/kzipboot/head.S +++ /dev/null @@ -1,11 +0,0 @@ -/* - * First module in a kzipped kernel. - * This needs to be at the beginning so that the boot loader calls it. - * It may be overwritten by uncompressing the kernel, so it transfers - * control to a higher address that won't be overwritten. - * - * Copyright (C) Serge Vakulenko - */ - .text -head: - jmp tail diff --git a/sys/i386/boot/kzipboot/malloc.c b/sys/i386/boot/kzipboot/malloc.c deleted file mode 100644 index 052e5e3..0000000 --- a/sys/i386/boot/kzipboot/malloc.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/types.h> - -extern unsigned char *storage; - -void * -kzipmalloc(nbytes) - size_t nbytes; -{ - unsigned char *p = storage; - storage += nbytes; - if (storage >= (unsigned char *) 0xa0000) { - putstr("warning: malloc wrapped\n"); - p = (unsigned char *) 0x50000; - storage = p + nbytes; - } - return p; -} - -void -kzipfree(cp) - void *cp; -{ -} diff --git a/sys/i386/boot/kzipboot/misc.c b/sys/i386/boot/kzipboot/misc.c deleted file mode 100644 index a971aee..0000000 --- a/sys/i386/boot/kzipboot/misc.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * misc.c - * - * This is a collection of several routines from gzip-1.0.3 - * adapted for Linux. - * - * Ported to 386bsd by Serge Vakulenko - */ - -#include "gzip.h" - -unsigned outcnt; -unsigned insize; -unsigned inptr; - -extern const char input_data[]; -extern const int input_len; - -int input_ptr; - -int method; - -char *output_data; -ulong output_ptr; - -void makecrc (void); -void putstr (char *c); -void *memcpy (void *to, const void *from, unsigned len); -int memcmp (const void *arg1, const void *arg2, unsigned len); - -ulong crc; /* shift register contents */ -ulong crc_32_tab[256]; /* crc table, defined below */ - -/* - * Run a set of bytes through the crc shift register. If s is a NULL - * pointer, then initialize the crc shift register contents instead. - * Return the current crc in either case. - */ -void updcrc(s, n) -uchar *s; /* pointer to bytes to pump through */ -unsigned n; /* number of bytes in s[] */ -{ - while (n--) - crc = crc_32_tab[(uchar)crc ^ (*s++)] ^ (crc >> 8); -} - -/* - * Clear input and output buffers - */ -void clear_bufs() -{ - outcnt = 0; - insize = inptr = 0; -} - -/* - * Fill the input buffer. This is called only when the buffer is empty - * and at least one byte is really needed. - */ -void fill_inbuf () -{ - int len, i; - - /* Read as much as possible */ - insize = 0; - do { - len = INBUFSIZ - insize; - if (len > input_len - input_ptr + 1) - len = input_len-input_ptr+1; - if (len <= 0) - break; - for (i=0; i<len; i++) - inbuf[insize+i] = input_data[input_ptr+i]; - insize += len; - input_ptr += len; - } while (insize < INBUFSIZ); - if (insize == 0) - error("unable to fill buffer"); - inptr = 0; -} - -/* - * Write the output window window[0..outcnt-1] and update crc and bytes_out. - * (Used for the decompressed data only.) - */ -void flush_window() -{ - if (outcnt == 0) return; - updcrc(window, outcnt); - - memcpy(&output_data[output_ptr], (char *)window, outcnt); - - output_ptr += outcnt; - outcnt = 0; -} - -/* - * Code to compute the CRC-32 table. Borrowed from - * gzip-1.0.3/makecrc.c. - * Not copyrighted 1990 Mark Adler - */ -void makecrc(void) -{ - ulong c; /* crc shift register */ - ulong e; /* polynomial exclusive-or pattern */ - int i; /* counter for all possible eight bit values */ - int k; /* byte being shifted into crc apparatus */ - - /* terms of polynomial defining this crc (except x^32): */ - static const uchar poly[] = { 0,1,2,4,5,7,8,10,11,12,16,22,23,26, }; - - /* Make exclusive-or pattern from polynomial */ - e = 0; - for (i = 0; i < sizeof(poly)/sizeof(*poly); i++) - e |= 1L << (31 - poly[i]); - - crc_32_tab[0] = 0; - - for (i = 1; i < 256; i++) { - c = 0; - for (k = i | 256; k != 1; k >>= 1) { - c = c & 1 ? (c >> 1) ^ e : c >> 1; - if (k & 1) - c ^= e; - } - crc_32_tab[i] = c; - } -} - -/* - * Check the magic number of the input file and update ofname if an - * original name was given and to_stdout is not set. - * Set inptr to the offset of the next byte to be processed. - */ -static void get_method() -{ - uchar flags; - char magic[2]; /* magic header */ - - magic[0] = get_byte(); - magic[1] = get_byte(); - - method = -1; /* unknown yet */ - extended = pkzip = 0; - /* assume multiple members in gzip file except for record oriented I/O */ - - if (memcmp(magic, GZIP_MAGIC, 2) == 0 - || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) { - method = get_byte(); - flags = get_byte(); - if (flags & ENCRYPTED) - error("Input is encrypted"); - if (flags & CONTINUATION) - error("Multi part input"); - if (flags & RESERVED) - error("Input has invalid flags"); - - (void) get_byte(); /* Get timestamp */ - (void) get_byte(); - (void) get_byte(); - (void) get_byte(); - - (void) get_byte(); /* Ignore extra flags for the moment */ - (void) get_byte(); /* Ignore OS type for the moment */ - - if (flags & EXTRA_FIELD) { - unsigned len = get_byte(); - len |= get_byte() << 8; - while (len--) - (void) get_byte(); - } - - /* Discard file comment if any */ - if (flags & COMMENT) - while (get_byte()) - continue; - - } else if (memcmp(magic, PKZIP_MAGIC, 2) == 0 && inptr == 2 - && memcmp(inbuf, PKZIP_MAGIC, 4) == 0) { - /* - * To simplify the code, we support a zip file when alone only. - * We are thus guaranteed that the entire local header fits in inbuf. - */ - inptr = 0; - check_zipfile(); - - } else if (memcmp(magic, PACK_MAGIC, 2) == 0) - error("packed input"); - else if (memcmp(magic, LZW_MAGIC, 2) == 0) - error("compressed input"); - if (method == -1) - error("Corrupted input"); -} - -void -decompress_kernel (void *dest) -{ - output_data = dest; - output_ptr = 0; - - input_ptr = 0; - - clear_bufs (); - makecrc (); - get_method (); - unzip (); -} diff --git a/sys/i386/boot/kzipboot/tail.S b/sys/i386/boot/kzipboot/tail.S deleted file mode 100644 index 5dcee9c..0000000 --- a/sys/i386/boot/kzipboot/tail.S +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Boot unpacker startup routine. - * Copyright (C) Serge Vakulenko - */ - .text - .globl tail -tail: - cli # disable interrupts - pushl 4(%esp) # pass howto arg - call _boot # unpack the kernel image - popl %eax # discard howto arg - ljmp $CSEG, $KADDR # jump to unpacked kernel diff --git a/sys/i386/boot/kzipboot/unzip.c b/sys/i386/boot/kzipboot/unzip.c deleted file mode 100644 index 93a2c8b..0000000 --- a/sys/i386/boot/kzipboot/unzip.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * unzip.c -- decompress files in gzip or pkzip format. - * Copyright (C) 1992-1993 Jean-loup Gailly - * - * Adapted for Linux booting by Hannu Savolainen 1993 - * Adapted for FreeBSD booting by Serge Vakulenko - * - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - * - * The code in this file is derived from the file funzip.c written - * and put in the public domain by Mark Adler. - */ - -/* - * This version can extract files in gzip or pkzip format. - * For the latter, only the first entry is extracted, and it has to be - * either deflated or stored. - */ - -#include "gzip.h" - -#include <sys/types.h> -#include <sys/inflate.h> - -/* PKZIP header definitions */ -#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ -#define LOCFLG 6 /* offset of bit flag */ -#define CRPFLG 1 /* bit for encrypted entry */ -#define EXTFLG 8 /* bit for extended local header */ -#define LOCHOW 8 /* offset of compression method */ -#define LOCTIM 10 /* file mod time (for decryption) */ -#define LOCCRC 14 /* offset of crc */ -#define LOCSIZ 18 /* offset of compressed size */ -#define LOCLEN 22 /* offset of uncompressed length */ -#define LOCFIL 26 /* offset of file name field length */ -#define LOCEXT 28 /* offset of extra field length */ -#define LOCHDR 30 /* size of local header, including sig */ -#define EXTHDR 16 /* size of extended local header, inc sig */ - -int pkzip; /* set for a pkzip file */ -int extended; /* set if extended local header */ - -/* Macros for getting two-byte and four-byte header values */ -#define SH(p) ((ushort)(uchar)((p)[0]) | ((ushort)(uchar)((p)[1]) << 8)) -#define LG(p) ((ulong)(SH(p)) | ((ulong)(SH((p)+2)) << 16)) - -/* - * Check zip file and advance inptr to the start of the compressed data. - * Get ofname from the local header if necessary. - */ -void check_zipfile() -{ - uchar *h = inbuf + inptr; /* first local header */ - - /* Check validity of local header, and skip name and extra fields */ - inptr += LOCHDR + SH(h + LOCFIL) + SH(h + LOCEXT); - - if (inptr > insize || LG(h) != LOCSIG) - error("input not a zip"); - - method = h[LOCHOW]; - if (method != STORED && method != DEFLATED) - error("first entry not deflated or stored--can't extract"); - - /* If entry encrypted, decrypt and validate encryption header */ - if (h[LOCFLG] & CRPFLG) - error("encrypted file"); - - /* Save flags for unzip() */ - extended = (h[LOCFLG] & EXTFLG) != 0; - pkzip = 1; -} - -int -Flush (void *nu, u_char *buf, u_long cnt) -{ - outcnt = cnt; - flush_window(); - return 0; -} - -int -NextByte (void *nu) -{ - return ((int) get_byte ()); -} - -struct inflate infl; /* put it into the BSS */ - -/* - * Unzip in to out. This routine works on both gzip and pkzip files. - * - * IN assertions: the buffer inbuf contains already the beginning of - * the compressed data, from offsets inptr to insize-1 included. - * The magic header has already been checked. The output buffer is cleared. - */ - -void unzip() -{ - ulong orig_crc = 0; /* original crc */ - ulong orig_len = 0; /* original uncompressed length */ - uchar buf[EXTHDR]; /* extended local header */ - int n, res; - - crc = 0xffffffffL; /* initialize crc */ - - if (pkzip && !extended) { /* crc and length at the end otherwise */ - orig_crc = LG(inbuf + LOCCRC); - orig_len = LG(inbuf + LOCLEN); - } - - if (method != DEFLATED) - error("internal error, invalid method"); - infl.gz_input = NextByte; - infl.gz_output = Flush; - infl.gz_slide = window; - res = inflate (&infl); - if (res == 3) - error("out of memory"); - else if (res != 0) - error("invalid compressed format"); - - /* Get the crc and original length */ - if (!pkzip) { - /* crc32 (see algorithm.doc) - * uncompressed input size modulo 2^32 - */ - for (n = 0; n < 8; n++) - buf[n] = get_byte(); /* may cause an error if EOF */ - orig_crc = LG(buf); - orig_len = LG(buf+4); - - } else if (extended) { /* If extended header, check it */ - /* signature - 4bytes: 0x50 0x4b 0x07 0x08 - * CRC-32 value - * compressed size 4-bytes - * uncompressed size 4-bytes - */ - for (n = 0; n < EXTHDR; n++) - buf[n] = get_byte(); /* may cause an error if EOF */ - orig_crc = LG(buf+4); - orig_len = LG(buf+12); - } - - /* Validate decompression */ - if (orig_crc != (crc ^ 0xffffffffL)) - error("crc error"); - if (orig_len != output_ptr) - error("length error"); - - /* Check if there are more entries in a pkzip file */ - if (pkzip && inptr+4 < insize && LG(inbuf+inptr) == LOCSIG) - error("zip file has more than one entry"); -} diff --git a/sys/i386/boot/netboot/3c509.c b/sys/i386/boot/netboot/3c509.c deleted file mode 100644 index accc948..0000000 --- a/sys/i386/boot/netboot/3c509.c +++ /dev/null @@ -1,602 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters. - Date: Mar 22 1995 - - This code is based heavily on David Greenman's if_ed.c driver and - Andres Vega Garcia's if_ep.c driver. - - Copyright (C) 1993-1994, David Greenman, Martin Renters. - Copyright (C) 1993-1995, Andres Vega Garcia. - Copyright (C) 1995, Serge Babkin. - This software may be used, modified, copied, distributed, and sold, in - both source and binary form provided that the above copyright and these - terms are retained. Under no circumstances are the authors responsible for - the proper functioning of this software, nor do the authors assume any - responsibility for damages incurred with its use. - -3c509 support added by Serge Babkin (babkin@hq.icb.chel.su) - -$FreeBSD$ - -***************************************************************************/ - -/* #define EDEBUG */ - -#include "netboot.h" -#include "3c509.h" - -short aui; -char bnc=0, utp=0; /* for 3C509 */ -unsigned short eth_nic_base; -unsigned short eth_asic_base; -unsigned short eth_base; -unsigned char eth_tx_start; -unsigned char eth_laar; -unsigned char eth_flags; -unsigned char eth_vendor; -unsigned char eth_memsize; -unsigned char *eth_bmem; -unsigned char *eth_rmem; -unsigned char *eth_node_addr; - -static send_ID_sequence(); -static get_eeprom_data(); -static get_e(); - -/************************************************************************** -The following two variables are used externally -***************************************************************************/ -char packet[ETHER_MAX_LEN]; -int packetlen; - -/*********************** Name of driver *********************************/ - -char eth_driver[]="ep0"; - -/************************************************************************** -ETH_PROBE - Look for an adapter -***************************************************************************/ -eth_probe() -{ - /* common variables */ - int i; - /* variables for 3C509 */ - int data, j, io_base, id_port = EP_ID_PORT; - int nisa = 0, neisa = 0; - u_short k; - int ep_current_tag = EP_LAST_TAG + 1; - short *p; - - eth_vendor = VENDOR_NONE; - - /********************************************************* - Search for 3Com 509 card - ***********************************************************/ - - /* Look for the EISA boards, leave them activated */ - /* search for the first card, ignore all others */ - for(j = 1; j < 16 && eth_vendor==VENDOR_NONE ; j++) { - io_base = (j * EP_EISA_START) | EP_EISA_W0; - if (inw(io_base + EP_W0_MFG_ID) != MFG_ID) - continue; - - /* we must found 0x1f if the board is EISA configurated */ - if ((inw(io_base + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f) - continue; - - /* Reset and Enable the card */ - outb(io_base + EP_W0_CONFIG_CTRL, W0_P4_CMD_RESET_ADAPTER); - DELAY(1000); /* we must wait at least 1 ms */ - outb(io_base + EP_W0_CONFIG_CTRL, W0_P4_CMD_ENABLE_ADAPTER); - - /* - * Once activated, all the registers are mapped in the range - * x000 - x00F, where x is the slot number. - */ - eth_base = j * EP_EISA_START; - eth_vendor = VENDOR_3C509; - } - ep_current_tag--; - - /* Look for the ISA boards. Init and leave them actived */ - /* search for the first card, ignore all others */ - outb(id_port, 0xc0); /* Global reset */ - DELAY(1000); - for (i = 0; i < EP_MAX_BOARDS && eth_vendor==VENDOR_NONE; i++) { - outb(id_port, 0); - outb(id_port, 0); - send_ID_sequence(id_port); - - data = get_eeprom_data(id_port, EEPROM_MFG_ID); - if (data != MFG_ID) - break; - - /* resolve contention using the Ethernet address */ - for (j = 0; j < 3; j++) - data = get_eeprom_data(id_port, j); - - eth_base = - (get_eeprom_data(id_port, EEPROM_ADDR_CFG) & 0x1f) * 0x10 + 0x200; - outb(id_port, ep_current_tag); /* tags board */ - outb(id_port, ACTIVATE_ADAPTER_TO_CONFIG); - eth_vendor = VENDOR_3C509; - ep_current_tag--; - } - - if(eth_vendor != VENDOR_3C509) - goto no3c509; - - /* - * The iobase was found and MFG_ID was 0x6d50. PROD_ID should be - * 0x9[0-f]50 - */ - GO_WINDOW(0); - k = get_e(EEPROM_PROD_ID); - if ((k & 0xf0ff) != (PROD_ID & 0xf0ff)) - goto no3c509; - - if(eth_base >= EP_EISA_START) { - printf("3C5x9 board on EISA at 0x%x - ",eth_base); - } else { - printf("3C5x9 board on ISA at 0x%x - ",eth_base); - } - - /* test for presence of connectors */ - i = inw(IS_BASE + EP_W0_CONFIG_CTRL); - j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> 14; - - switch(j) { - case 0: - if(i & IS_UTP) { - printf("10baseT\r\n"); - utp=1; - } - else { - printf("10baseT not present\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - - break; - case 1: - if(i & IS_AUI) - printf("10base5\r\n"); - else { - printf("10base5 not present\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - - break; - case 3: - if(i & IS_BNC) { - printf("10base2\r\n"); - bnc=1; - } - else { - printf("10base2 not present\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - - break; - default: - printf("unknown connector\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - /* - * Read the station address from the eeprom - */ - p = (u_short *) arptable[ARP_CLIENT].node; - for (i = 0; i < 3; i++) { - GO_WINDOW(0); - p[i] = htons(get_e(i)); - GO_WINDOW(2); - outw(BASE + EP_W2_ADDR_0 + (i * 2), ntohs(p[i])); - } - - printf("Ethernet address: "); - for(i=0; i<5; i++) { - printf("%b:",arptable[ARP_CLIENT].node[i]); - } - printf("%b\n",arptable[ARP_CLIENT].node[i]); - - eth_node_addr = arptable[ARP_CLIENT].node; - eth_reset(); - return eth_vendor; -no3c509: - eth_vendor = VENDOR_NONE; - - return VENDOR_NONE; -} - -/************************************************************************** -ETH_RESET - Reset adapter -***************************************************************************/ -eth_reset() -{ - int s, i; - - /*********************************************************** - Reset 3Com 509 card - *************************************************************/ - - if(eth_vendor != VENDOR_3C509) - goto no3c509; - - /* stop card */ - outw(BASE + EP_COMMAND, RX_DISABLE); - outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - outw(BASE + EP_COMMAND, TX_DISABLE); - outw(BASE + EP_COMMAND, STOP_TRANSCEIVER); - outw(BASE + EP_COMMAND, RX_RESET); - outw(BASE + EP_COMMAND, TX_RESET); - outw(BASE + EP_COMMAND, C_INTR_LATCH); - outw(BASE + EP_COMMAND, SET_RD_0_MASK); - outw(BASE + EP_COMMAND, SET_INTR_MASK); - outw(BASE + EP_COMMAND, SET_RX_FILTER); - - /* - /* initialize card - */ - while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - - GO_WINDOW(0); - - /* Disable the card */ - outw(BASE + EP_W0_CONFIG_CTRL, 0); - - /* Configure IRQ to none */ - outw(BASE + EP_W0_RESOURCE_CFG, SET_IRQ(0)); - - /* Enable the card */ - outw(BASE + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ); - - GO_WINDOW(2); - - /* Reload the ether_addr. */ - for (i = 0; i < 6; i++) - outb(BASE + EP_W2_ADDR_0 + i, arptable[ARP_CLIENT].node[i]); - - outw(BASE + EP_COMMAND, RX_RESET); - outw(BASE + EP_COMMAND, TX_RESET); - - /* Window 1 is operating window */ - GO_WINDOW(1); - for (i = 0; i < 31; i++) - inb(BASE + EP_W1_TX_STATUS); - - /* get rid of stray intr's */ - outw(BASE + EP_COMMAND, ACK_INTR | 0xff); - - outw(BASE + EP_COMMAND, SET_RD_0_MASK | S_5_INTS); - - outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); - - outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | - FIL_BRDCST); - - /* configure BNC */ - if(bnc) { - outw(BASE + EP_COMMAND, START_TRANSCEIVER); - DELAY(1000); - } - /* configure UTP */ - if(utp) { - GO_WINDOW(4); - outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP); - GO_WINDOW(1); - } - - /* start tranciever and receiver */ - outw(BASE + EP_COMMAND, RX_ENABLE); - outw(BASE + EP_COMMAND, TX_ENABLE); - - /* set early threshold for minimal packet length */ - outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | 64); - - outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16); - - return 1; -no3c509: - -} - -/************************************************************************** -ETH_TRANSMIT - Transmit a frame -***************************************************************************/ -static const char padmap[] = { - 0, 3, 2, 1}; - -eth_transmit(d,t,s,p) -char *d; /* Destination */ -unsigned short t; /* Type */ -unsigned short s; /* size */ -char *p; /* Packet */ -{ - register u_int len; - int pad; - int status; - unsigned char c; - - if(eth_vendor != VENDOR_3C509) - goto no3c509; - -#ifdef EDEBUG - printf("{l=%d,t=%x}",s+14,t); -#endif - - /* swap bytes of type */ - t=(( t&0xFF )<<8) | ((t>>8) & 0xFF); - - len=s+14; /* actual length of packet */ - pad = padmap[len & 3]; - - /* - * The 3c509 automatically pads short packets to minimum ethernet length, - * but we drop packets that are too large. Perhaps we should truncate - * them instead? - */ - if (len + pad > ETHER_MAX_LEN) { - return 0; - } - - /* drop acknowledgements */ - while(( status=inb(BASE + EP_W1_TX_STATUS) )& TXS_COMPLETE ) { - if(status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) { - outw(BASE + EP_COMMAND, TX_RESET); - outw(BASE + EP_COMMAND, TX_ENABLE); - } - - outb(BASE + EP_W1_TX_STATUS, 0x0); - } - - while (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { - /* no room in FIFO */ - } - - outw(BASE + EP_W1_TX_PIO_WR_1, len); - outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */ - - /* write packet */ - outsw(BASE + EP_W1_TX_PIO_WR_1, d, 3); - outsw(BASE + EP_W1_TX_PIO_WR_1, eth_node_addr, 3); - outw(BASE + EP_W1_TX_PIO_WR_1, t); - outsw(BASE + EP_W1_TX_PIO_WR_1, p, s / 2); - if (s & 1) - outb(BASE + EP_W1_TX_PIO_WR_1, *(p+s - 1)); - - while (pad--) - outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */ - - /* timeout after sending */ - DELAY(1000); - return 0; -no3c509: -} - -/************************************************************************** -ETH_POLL - Wait for a frame -***************************************************************************/ -eth_poll() -{ - /* common variables */ - unsigned short type = 0; - unsigned short len; - /* variables for 3C509 */ - struct ether_header *eh; - int lenthisone; - short rx_fifo2, status, cst; - register short rx_fifo; - - if(eth_vendor!=VENDOR_3C509) - goto no3c509; - - cst=inw(BASE + EP_STATUS); - -#ifdef EDEBUG - if(cst & 0x1FFF) - printf("-%x-",cst); -#endif - - if( (cst & (S_RX_COMPLETE|S_RX_EARLY) )==0 ) { - /* acknowledge everything */ - outw(BASE + EP_COMMAND, ACK_INTR| (cst & S_5_INTS)); - outw(BASE + EP_COMMAND, C_INTR_LATCH); - - return 0; - } - - status = inw(BASE + EP_W1_RX_STATUS); -#ifdef EDEBUG - printf("*%x*",status); -#endif - - if (status & ERR_RX) { - outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - return 0; - } - - rx_fifo = status & RX_BYTES_MASK; - if (rx_fifo==0) - return 0; - - /* read packet */ -#ifdef EDEBUG - printf("[l=%d",rx_fifo); -#endif - insw(BASE + EP_W1_RX_PIO_RD_1, packet, rx_fifo / 2); - if(rx_fifo & 1) - packet[rx_fifo-1]=inb(BASE + EP_W1_RX_PIO_RD_1); - packetlen=rx_fifo; - - while(1) { - status = inw(BASE + EP_W1_RX_STATUS); -#ifdef EDEBUG - printf("*%x*",status); -#endif - rx_fifo = status & RX_BYTES_MASK; - - if(rx_fifo>0) { - insw(BASE + EP_W1_RX_PIO_RD_1, packet+packetlen, rx_fifo / 2); - if(rx_fifo & 1) - packet[packetlen+rx_fifo-1]=inb(BASE + EP_W1_RX_PIO_RD_1); - packetlen+=rx_fifo; -#ifdef EDEBUG - printf("+%d",rx_fifo); -#endif - } - - if(( status & RX_INCOMPLETE )==0) { -#ifdef EDEBUG - printf("=%d",packetlen); -#endif - break; - } - - DELAY(1000); - } - - /* acknowledge reception of packet */ - outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - - type = (packet[12]<<8) | packet[13]; - -#ifdef EDEBUG - if(packet[0]+packet[1]+packet[2]+packet[3]+packet[4]+ - packet[5] == 0xFF*6) - printf(",t=0x%x,b]",type); - else - printf(",t=0x%x]",type); -#endif - - - if (type == ARP) { - struct arprequest *arpreq; - unsigned long reqip; - - arpreq = (struct arprequest *)&packet[ETHER_HDR_LEN]; - -#ifdef EDEBUG - printf("(ARP %I->%I)",ntohl(*(int*)arpreq->sipaddr), - ntohl(*(int*)arpreq->tipaddr)); -#endif - - convert_ipaddr(&reqip, arpreq->tipaddr); - if ((ntohs(arpreq->opcode) == ARP_REQUEST) && - (reqip == arptable[ARP_CLIENT].ipaddr)) { - arpreq->opcode = htons(ARP_REPLY); - bcopy(arpreq->sipaddr, arpreq->tipaddr, 4); - bcopy(arpreq->shwaddr, arpreq->thwaddr, 6); - bcopy(arptable[ARP_CLIENT].node, arpreq->shwaddr, 6); - convert_ipaddr(arpreq->sipaddr, &reqip); - eth_transmit(arpreq->thwaddr, ARP, sizeof(struct arprequest), - arpreq); - return(0); - } - } else if(type==IP) { - struct iphdr *iph; - - iph = (struct iphdr *)&packet[ETHER_HDR_LEN]; -#ifdef EDEBUG - printf("(IP %I-%d->%I)",ntohl(*(int*)iph->src), - ntohs(iph->protocol),ntohl(*(int*)iph->dest)); -#endif - } - - return 1; - -no3c509: -} - - -/************************************************************************* - 3Com 509 - specific routines -**************************************************************************/ - -static int -eeprom_rdy() -{ - int i; - - for (i = 0; is_eeprom_busy(IS_BASE) && i < MAX_EEPROMBUSY; i++); - if (i >= MAX_EEPROMBUSY) { - printf("3c509: eeprom failed to come ready.\r\n"); - return (0); - } - return (1); -} - -/* - * get_e: gets a 16 bits word from the EEPROM. we must have set the window - * before - */ -static int -get_e(offset) -int offset; -{ - if (!eeprom_rdy()) - return (0xffff); - outw(IS_BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset); - if (!eeprom_rdy()) - return (0xffff); - return (inw(IS_BASE + EP_W0_EEPROM_DATA)); -} - -static int -send_ID_sequence(port) -int port; -{ - int cx, al; - - for (al = 0xff, cx = 0; cx < 255; cx++) { - outb(port, al); - al <<= 1; - if (al & 0x100) - al ^= 0xcf; - } - return (1); -} - - -/* - * We get eeprom data from the id_port given an offset into the eeprom. - * Basically; after the ID_sequence is sent to all of the cards; they enter - * the ID_CMD state where they will accept command requests. 0x80-0xbf loads - * the eeprom data. We then read the port 16 times and with every read; the - * cards check for contention (ie: if one card writes a 0 bit and another - * writes a 1 bit then the host sees a 0. At the end of the cycle; each card - * compares the data on the bus; if there is a difference then that card goes - * into ID_WAIT state again). In the meantime; one bit of data is returned in - * the AX register which is conveniently returned to us by inb(). Hence; we - * read 16 times getting one bit of data with each read. - */ -static int -get_eeprom_data(id_port, offset) -int id_port; -int offset; -{ - int i, data = 0; - outb(id_port, 0x80 + offset); - DELAY(1000); - for (i = 0; i < 16; i++) - data = (data << 1) | (inw(id_port) & 1); - return (data); -} - -/* a surrogate */ - -DELAY(val) -{ - int c; - - for(c=0; c<val; c+=20) { - twiddle(); - } -} - diff --git a/sys/i386/boot/netboot/3c509.h b/sys/i386/boot/netboot/3c509.h deleted file mode 100644 index 19cc637..0000000 --- a/sys/i386/boot/netboot/3c509.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. 2. The name - * of the author may not be used to endorse or promote products derived from - * this software withough specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by: - * - October 2, 1994 - - Modified by: Andres Vega Garcia - - INRIA - Sophia Antipolis, France - e-mail: avega@sophia.inria.fr - finger: avega@pax.inria.fr - - */ - -/* - * Ethernet software status per interface. - */ -/* - * Some global constants - */ - -#define TX_INIT_RATE 16 -#define TX_INIT_MAX_RATE 64 -#define RX_INIT_LATENCY 64 -#define RX_INIT_EARLY_THRESH 64 -#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */ -#define MIN_RX_EARLY_THRESHL 4 - -#define EEPROMSIZE 0x40 -#define MAX_EEPROMBUSY 1000 -#define EP_LAST_TAG 0xd7 -#define EP_MAX_BOARDS 16 -#define EP_ID_PORT 0x110 - -/* - * some macros to acces long named fields - */ -#define IS_BASE (eth_base) -#define BASE (eth_base) - -/* - * Commands to read/write EEPROM trough EEPROM command register (Window 0, - * Offset 0xa) - */ -#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */ -#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */ -#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */ -#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */ - -#define EEPROM_BUSY (1<<15) -#define EEPROM_TST_MODE (1<<14) - -/* - * Some short functions, worth to let them be a macro - */ -#define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY) -#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|(x)) - -/************************************************************************** - * * - * These define the EEPROM data structure. They are used in the probe - * function to verify the existance of the adapter after having sent - * the ID_Sequence. - * - * There are others but only the ones we use are defined here. - * - **************************************************************************/ - -#define EEPROM_NODE_ADDR_0 0x0 /* Word */ -#define EEPROM_NODE_ADDR_1 0x1 /* Word */ -#define EEPROM_NODE_ADDR_2 0x2 /* Word */ -#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */ -#define EEPROM_MFG_ID 0x7 /* 0x6d50 */ -#define EEPROM_ADDR_CFG 0x8 /* Base addr */ -#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */ - -/************************************************************************** - * * - * These are the registers for the 3Com 3c509 and their bit patterns when * - * applicable. They have been taken out the the "EtherLink III Parallel * - * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual * - * from 3com. * - * * - **************************************************************************/ - -#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a - * command reg. */ -#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status - * reg. */ -#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window - * reg. */ -/* - * Window 0 registers. Setup. - */ -/* Write */ -#define EP_W0_EEPROM_DATA 0x0c -#define EP_W0_EEPROM_COMMAND 0x0a -#define EP_W0_RESOURCE_CFG 0x08 -#define EP_W0_ADDRESS_CFG 0x06 -#define EP_W0_CONFIG_CTRL 0x04 -/* Read */ -#define EP_W0_PRODUCT_ID 0x02 -#define EP_W0_MFG_ID 0x00 - -/* - * Window 1 registers. Operating Set. - */ -/* Write */ -#define EP_W1_TX_PIO_WR_2 0x02 -#define EP_W1_TX_PIO_WR_1 0x00 -/* Read */ -#define EP_W1_FREE_TX 0x0c -#define EP_W1_TX_STATUS 0x0b /* byte */ -#define EP_W1_TIMER 0x0a /* byte */ -#define EP_W1_RX_STATUS 0x08 -#define EP_W1_RX_PIO_RD_2 0x02 -#define EP_W1_RX_PIO_RD_1 0x00 - -/* - * Window 2 registers. Station Address Setup/Read - */ -/* Read/Write */ -#define EP_W2_ADDR_5 0x05 -#define EP_W2_ADDR_4 0x04 -#define EP_W2_ADDR_3 0x03 -#define EP_W2_ADDR_2 0x02 -#define EP_W2_ADDR_1 0x01 -#define EP_W2_ADDR_0 0x00 - -/* - * Window 3 registers. FIFO Management. - */ -/* Read */ -#define EP_W3_FREE_TX 0x0c -#define EP_W3_FREE_RX 0x0a - -/* - * Window 4 registers. Diagnostics. - */ -/* Read/Write */ -#define EP_W4_MEDIA_TYPE 0x0a -#define EP_W4_CTRLR_STATUS 0x08 -#define EP_W4_NET_DIAG 0x06 -#define EP_W4_FIFO_DIAG 0x04 -#define EP_W4_HOST_DIAG 0x02 -#define EP_W4_TX_DIAG 0x00 - -/* - * Window 5 Registers. Results and Internal status. - */ -/* Read */ -#define EP_W5_READ_0_MASK 0x0c -#define EP_W5_INTR_MASK 0x0a -#define EP_W5_RX_FILTER 0x08 -#define EP_W5_RX_EARLY_THRESH 0x06 -#define EP_W5_TX_AVAIL_THRESH 0x02 -#define EP_W5_TX_START_THRESH 0x00 - -/* - * Window 6 registers. Statistics. - */ -/* Read/Write */ -#define TX_TOTAL_OK 0x0c -#define RX_TOTAL_OK 0x0a -#define TX_DEFERRALS 0x08 -#define RX_FRAMES_OK 0x07 -#define TX_FRAMES_OK 0x06 -#define RX_OVERRUNS 0x05 -#define TX_COLLISIONS 0x04 -#define TX_AFTER_1_COLLISION 0x03 -#define TX_AFTER_X_COLLISIONS 0x02 -#define TX_NO_SQE 0x01 -#define TX_CD_LOST 0x00 - -/**************************************** - * - * Register definitions. - * - ****************************************/ - -/* - * Command register. All windows. - * - * 16 bit register. - * 15-11: 5-bit code for command to be executed. - * 10-0: 11-bit arg if any. For commands with no args; - * this can be set to anything. - */ -#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms - * after issuing */ -#define WINDOW_SELECT (u_short) (0x1<<11) -#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to - * determine whether - * this is needed. If - * so; wait 800 uSec - * before using trans- - * ceiver. */ -#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on - * power-up */ -#define RX_ENABLE (u_short) (0x4<<11) -#define RX_RESET (u_short) (0x5<<11) -#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11) -#define TX_ENABLE (u_short) (0x9<<11) -#define TX_DISABLE (u_short) (0xa<<11) -#define TX_RESET (u_short) (0xb<<11) -#define REQ_INTR (u_short) (0xc<<11) -#define SET_INTR_MASK (u_short) (0xe<<11) -#define SET_RD_0_MASK (u_short) (0xf<<11) -#define SET_RX_FILTER (u_short) (0x10<<11) -#define FIL_INDIVIDUAL (u_short) (0x1) -#define FIL_GROUP (u_short) (0x2) -#define FIL_BRDCST (u_short) (0x4) -#define FIL_ALL (u_short) (0x8) -#define SET_RX_EARLY_THRESH (u_short) (0x11<<11) -#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11) -#define SET_TX_START_THRESH (u_short) (0x13<<11) -#define STATS_ENABLE (u_short) (0x15<<11) -#define STATS_DISABLE (u_short) (0x16<<11) -#define STOP_TRANSCEIVER (u_short) (0x17<<11) -/* - * The following C_* acknowledge the various interrupts. Some of them don't - * do anything. See the manual. - */ -#define ACK_INTR (u_short) (0x6800) -#define C_INTR_LATCH (u_short) (ACK_INTR|0x1) -#define C_CARD_FAILURE (u_short) (ACK_INTR|0x2) -#define C_TX_COMPLETE (u_short) (ACK_INTR|0x4) -#define C_TX_AVAIL (u_short) (ACK_INTR|0x8) -#define C_RX_COMPLETE (u_short) (ACK_INTR|0x10) -#define C_RX_EARLY (u_short) (ACK_INTR|0x20) -#define C_INT_RQD (u_short) (ACK_INTR|0x40) -#define C_UPD_STATS (u_short) (ACK_INTR|0x80) - -/* - * Status register. All windows. - * - * 15-13: Window number(0-7). - * 12: Command_in_progress. - * 11: reserved. - * 10: reserved. - * 9: reserved. - * 8: reserved. - * 7: Update Statistics. - * 6: Interrupt Requested. - * 5: RX Early. - * 4: RX Complete. - * 3: TX Available. - * 2: TX Complete. - * 1: Adapter Failure. - * 0: Interrupt Latch. - */ -#define S_INTR_LATCH (u_short) (0x1) -#define S_CARD_FAILURE (u_short) (0x2) -#define S_TX_COMPLETE (u_short) (0x4) -#define S_TX_AVAIL (u_short) (0x8) -#define S_RX_COMPLETE (u_short) (0x10) -#define S_RX_EARLY (u_short) (0x20) -#define S_INT_RQD (u_short) (0x40) -#define S_UPD_STATS (u_short) (0x80) -#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\ - S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) -#define S_COMMAND_IN_PROGRESS (u_short) (0x1000) - -/* - * FIFO Registers. - * RX Status. Window 1/Port 08 - * - * 15: Incomplete or FIFO empty. - * 14: 1: Error in RX Packet 0: Incomplete or no error. - * 13-11: Type of error. - * 1000 = Overrun. - * 1011 = Run Packet Error. - * 1100 = Alignment Error. - * 1101 = CRC Error. - * 1001 = Oversize Packet Error (>1514 bytes) - * 0010 = Dribble Bits. - * (all other error codes, no errors.) - * - * 10-0: RX Bytes (0-1514) - */ -#define ERR_RX_INCOMPLETE (u_short) (0x1<<15) -#define ERR_RX (u_short) (0x1<<14) -#define ERR_RX_OVERRUN (u_short) (0x8<<11) -#define ERR_RX_RUN_PKT (u_short) (0xb<<11) -#define ERR_RX_ALIGN (u_short) (0xc<<11) -#define ERR_RX_CRC (u_short) (0xd<<11) -#define ERR_RX_OVERSIZE (u_short) (0x9<<11) -#define ERR_RX_DRIBBLE (u_short) (0x2<<11) - -/* - * FIFO Registers. - * TX Status. Window 1/Port 0B - * - * Reports the transmit status of a completed transmission. Writing this - * register pops the transmit completion stack. - * - * Window 1/Port 0x0b. - * - * 7: Complete - * 6: Interrupt on successful transmission requested. - * 5: Jabber Error (TP Only, TX Reset required. ) - * 4: Underrun (TX Reset required. ) - * 3: Maximum Collisions. - * 2: TX Status Overflow. - * 1-0: Undefined. - * - */ -#define TXS_COMPLETE 0x80 -#define TXS_SUCCES_INTR_REQ 0x40 -#define TXS_JABBER 0x20 -#define TXS_UNDERRUN 0x10 -#define TXS_MAX_COLLISION 0x8 -#define TXS_STATUS_OVERFLOW 0x4 - -/* - * Configuration control register. - * Window 0/Port 04 - */ -/* Read */ -#define IS_AUI (1<<13) -#define IS_BNC (1<<12) -#define IS_UTP (1<<9) -/* Write */ -#define ENABLE_DRQ_IRQ 0x0001 -#define W0_P4_CMD_RESET_ADAPTER 0x4 -#define W0_P4_CMD_ENABLE_ADAPTER 0x1 -/* - * Media type and status. - * Window 4/Port 0A - */ -#define ENABLE_UTP 0xc0 -#define DISABLE_UTP 0x0 - -/* - * Resource control register - */ - -#define SET_IRQ(i) ( ((i)<<12) | 0xF00) /* set IRQ i */ - -/* - * Receive status register - */ - -#define RX_BYTES_MASK (u_short) (0x07ff) -#define RX_ERROR 0x4000 -#define RX_INCOMPLETE 0x8000 - - -/* - * Misc defines for various things. - */ -#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */ -#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */ -#define PROD_ID 0x9150 - -#define AUI 0x1 -#define BNC 0x2 -#define UTP 0x4 - -#define RX_BYTES_MASK (u_short) (0x07ff) - - /* EISA support */ -#define EP_EISA_START 0x1000 -#define EP_EISA_W0 0x0c80 diff --git a/sys/i386/boot/netboot/Makefile b/sys/i386/boot/netboot/Makefile deleted file mode 100644 index 84d3d97..0000000 --- a/sys/i386/boot/netboot/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -# $FreeBSD$ -# -# Makefile for NETBOOT -# -# Basic Options: -# -DSECURE_BOOT - Disable 'boot>' prompt completely -# -DASK_BOOT - Ask "Boot from Network (Y/N) ?" at startup -# -DROMSIZE - Size of EPROM - Must be set (even for .COM files) -# -DRELOC - Relocation address (usually 0x90000) -# -# NS8390 Options: -# -DINCLUDE_WD - Include Western Digital/SMC support -# -DINCLUDE_NE - Include NE1000/NE2000 support -# -DINCLUDE_3COM - Include 3c503 support -# -D_3COM_USE_AUI - Disable transceiver on 3c503 by default -# -DNE_BASE - Base I/O address for NE1000/NE2000 -# -D_3COM_BASE - Base I/O address for 3c503 -# -DWD_DEFAULT_MEM- Default memory location for WD/SMC cards -# XXX nothing depends on this Makefile so you must run `make clean' after -# changing an option. -# - -### options for PCI cards -### -PCI_VENDOR=0x10ec -PCI_DEVICE=0x8029 -PCI_CLASS=0x02,0x00,0x00 - -PROG= nb8390.com nb3c509.com nb8390.rom nb3c509.rom -# Order is very important on the SRCS line for this prog -SRCS= start2.S main.c misc.c bootmenu.c rpc.c - -BINMODE= 555 -#CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} -DASK_BOOT -CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} # -DASK_BOOT -CFLAGS += -DPCI -DPCI_VENDOR=${PCI_VENDOR} -DPCI_DEVICE=${PCI_DEVICE} -CFLAGS += -DPCI_CLASS=${PCI_CLASS} -DASK_BOOT -#NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000 -NS8390= -DINCLUDE_NE -#NS8390+= -DINCLUDE_3COM -D_3COM_BASE=0x300 -CLEANFILES+= netboot.com -CLEANFILES+= makerom start2.ro 3c509.o ns8390.o -ROMLDFLAGS= ${LDFLAGS} -aout -N -T ${RELOCADDR} -e _start -nostdlib -NOSHARED= YES -MAN8= netboot.8 -SIZE= size -aout -STRIP= -STRIPCMD= strip -aout - -ROMSIZE=16384 -RELOCADDR=0x90000 - -.SUFFIXES: .ro - -.S.ro: - ${CC} ${CFLAGS} -DBOOTROM -o ${.TARGET} -c ${.IMPSRC} - -build-tools: makerom - -ns8390.o: ns8390.c - ${CC} ${CFLAGS} $(NS8390) -o ${.TARGET} -c $< - -makerom: makerom.c - ${CC} ${CFLAGS} -DROMSIZE=${ROMSIZE} ${LDFLAGS} -o ${.TARGET} \ - ${.CURDIR}/makerom.c - -nb8390.rom: makerom start2.ro ${SRCS:N*.h:R:S/$/.o/g} ns8390.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET} ${OBJS:S/start2.o/start2.ro/} ns8390.o - ${STRIPCMD} ${.TARGET} - ${SIZE} ${.TARGET} - ${.OBJDIR}/makerom ${.TARGET} - -nb3c509.rom: makerom start2.ro ${SRCS:N*.h:R:S/$/.o/g} 3c509.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET} ${OBJS:S/start2.o/start2.ro/} 3c509.o - ${STRIPCMD} ${.TARGET} - ${SIZE} ${.TARGET} - ${.OBJDIR}/makerom ${.TARGET} - -nb8390.com: makerom start2.ro ${SRCS:N*.h:R:S/$/.o/g} ns8390.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET}.tmp ${OBJS} ns8390.o - ${STRIPCMD} ${.TARGET}.tmp - ${SIZE} ${.TARGET}.tmp - dd ibs=32 skip=1 if=${.TARGET}.tmp of=${.TARGET} - rm -f ${.TARGET}.tmp - -nb3c509.com: start2.o ${SRCS:N*.h:R:S/$/.o/g} 3c509.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET}.tmp ${OBJS} 3c509.o - ${STRIPCMD} ${.TARGET}.tmp - ${SIZE} ${.TARGET}.tmp - dd ibs=32 skip=1 if=${.TARGET}.tmp of=${.TARGET} - rm -f ${.TARGET}.tmp - -# This force the creation of the "machine" symlink. These objects are -# specially handled in this file, and thus can't be taken care of in -# ../Makefile.inc -3c509.o makerom ns8390.o start2.ro: machine - -.include <bsd.prog.mk> diff --git a/sys/i386/boot/netboot/bootmenu.c b/sys/i386/boot/netboot/bootmenu.c deleted file mode 100644 index 71b350b..0000000 --- a/sys/i386/boot/netboot/bootmenu.c +++ /dev/null @@ -1,377 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ -#include "netboot.h" - -extern struct nfs_diskless nfsdiskless; -extern int hostnamelen; -extern unsigned long netmask; -extern eth_reset(); -extern short aui; -extern int howto; - -int cmd_ip(), cmd_server(), cmd_kernel(), cmd_help(), exit(); -int cmd_rootfs(), cmd_swapfs(), cmd_interface(), cmd_hostname(); -int cmd_netmask(), cmd_swapsize(), cmd_swapopts(), cmd_rootopts(); -int cmd_aui(), cmd_gateway(), cmd_flags(); - -struct bootcmds_t { - char *name; - int (*func)(); - char *help; -} bootcmds[] = { - {"?", cmd_help, " this list"}, - {"help", cmd_help, " this list"}, - {"ip", cmd_ip, "<addr> set my IP addr"}, - {"server", cmd_server, "<addr> set TFTP server IP addr"}, - {"gateway", cmd_gateway, "<addr> set default router"}, - {"netmask", cmd_netmask, "<addr> set network mask"}, - {"hostname", cmd_hostname, "<name> set hostname"}, - {"kernel", cmd_kernel, "<file> set boot filename"}, - {"rootfs", cmd_rootfs, "[ip:]/fs set root filesystem"}, - {"swapfs", cmd_swapfs, "[ip:]/fs set swap filesystem"}, - {"swapsize", cmd_swapsize, "<nblks> set swap size"}, - {"swapopts", cmd_swapopts, "<options> swap mount options"}, - {"rootopts", cmd_rootopts, "<options> root mount options"}, - {"diskboot", exit, " boot from disk"}, - {"autoboot", NULL, " continue"}, - {"trans", cmd_aui, "<on|off> turn transceiver on|off"}, - {"flags", cmd_flags, "[bcdghsv] set boot flags"}, - {NULL, NULL, NULL} -}; - -/************************************************************************** -CMD_HELP - Display help screen -**************************************************************************/ -cmd_help() -{ - struct bootcmds_t *cmd = bootcmds; - printf("\r\n"); - while (cmd->name) { - printf("%s %s\n\r",cmd->name,cmd->help); - cmd++; - } -} - -/************************************************************************** -CMD_IP - Set my IP address -**************************************************************************/ -cmd_ip(p) - char *p; -{ - int i; - if (!setip(p, &arptable[ARP_CLIENT].ipaddr)) { - printf("IP address is %I\r\n", - arptable[ARP_CLIENT].ipaddr); - } else default_netmask(); -} - -/************************************************************************** -CMD_AUI - Turn on-board transceiver on or off -**************************************************************************/ -cmd_aui(p) - char *p; -{ - if (*(p+1) == 'f') { - aui = 1; - eth_reset(); - return(0); - } - if (*(p+1) == 'n') { - aui = 0; - eth_reset(); - return(0); - } - printf ("Transceiver is %s\r\n",aui ? "off" : "on"); -} - -/************************************************************************** -CMD_GATEWAY - Set routers IP address -**************************************************************************/ -cmd_gateway(p) - char *p; -{ - int i; - if (!setip(p, &arptable[ARP_GATEWAY].ipaddr)) { - printf("Server IP address is %I\r\n", - arptable[ARP_GATEWAY].ipaddr); - } else /* Need to clear arp entry if we change IP address */ - for (i=0; i<6; i++) arptable[ARP_GATEWAY].node[i] = 0; -} - -/************************************************************************** -CMD_SERVER - Set server's IP address -**************************************************************************/ -cmd_server(p) - char *p; -{ - int i; - if (!setip(p, &arptable[ARP_SERVER].ipaddr)) { - printf("Server IP address is %I\r\n", - arptable[ARP_SERVER].ipaddr); - } else /* Need to clear arp entry if we change IP address */ - for (i=0; i<6; i++) arptable[ARP_SERVER].node[i] = 0; -} - -/************************************************************************** -CMD_NETMASK - Set network mask -**************************************************************************/ -cmd_netmask(p) - char *p; -{ - int i; - if (!setip(p, &netmask)) { - netmask = ntohl(netmask); - printf("netmask is %I\r\n", netmask); - } - netmask = htonl(netmask); -} - -/************************************************************************** -CMD_SWAPSIZE - Set number of blocks for swap -**************************************************************************/ -cmd_swapsize(p) - char *p; -{ - int blks = getdec(&p); - if (blks > 0) nfsdiskless.swap_nblks = blks; - else printf("Swap size is: %d blocks\r\n",nfsdiskless.swap_nblks); -} - -extern char kernel_buf[], *kernel; -/************************************************************************** -CMD_KERNEL - set kernel filename -**************************************************************************/ -cmd_kernel(p) - char *p; -{ - if (*p) sprintf(kernel = kernel_buf,"%s",p); - printf("Bootfile is: %s\r\n", kernel); -} - - -/************************************************************************** -CMD_ROOTFS - Set root filesystem name -**************************************************************************/ -cmd_rootfs(p) - char *p; -{ - if (*p == '/') { - bcopy(&arptable[ARP_SERVER].ipaddr, - &arptable[ARP_ROOTSERVER].ipaddr, 4); - } else if (!setip(p, &arptable[ARP_ROOTSERVER].ipaddr)) { - printf("Root filesystem is %I:%s\r\n", - nfsdiskless.root_saddr.sin_addr, - nfsdiskless.root_hostnam); - return; - } else { - while (*p && (*p != ':')) p++; - if (*p == ':') p++; - } - - bcopy(&arptable[ARP_ROOTSERVER].ipaddr, - &nfsdiskless.root_saddr.sin_addr, 4); - sprintf(&nfsdiskless.root_hostnam, "%s", p); -} - -/************************************************************************** -CMD_SWAPFS - Set swap filesystem name -**************************************************************************/ -cmd_swapfs(p) - char *p; -{ - if (*p == '/') { - bcopy(&arptable[ARP_SERVER].ipaddr, - &arptable[ARP_SWAPSERVER].ipaddr, 4); - } else if (!setip(p, &arptable[ARP_SWAPSERVER].ipaddr)) { - printf("Swap filesystem is %I:%s\r\n", - nfsdiskless.swap_saddr.sin_addr, - nfsdiskless.swap_hostnam); - return; - } else { - while (*p && (*p != ':')) p++; - if (*p == ':') p++; - } - - bcopy(&arptable[ARP_SWAPSERVER].ipaddr, - &nfsdiskless.swap_saddr.sin_addr, 4); - sprintf(&nfsdiskless.swap_hostnam, "%s", p); -} - -/************************************************************************** -CMD_HOSTNAME - Set my hostname -**************************************************************************/ -cmd_hostname(p) - char *p; -{ - if (*p) - hostnamelen = ((sprintf(&nfsdiskless.my_hostnam,"%s",p) - - (char*)&nfsdiskless.my_hostnam) + 3) & ~3; - else printf("Hostname is: %s\r\n",nfsdiskless.my_hostnam); -} - -static void mountopts(prefix,args,p) - char *prefix; - struct onfs_args *args; - char *p; -{ - char *tmp; - - if (*p) { - args->flags = NFSMNT_RSIZE | NFSMNT_WSIZE | NFSMNT_RESVPORT; - args->sotype = SOCK_DGRAM; - if ((tmp = (char *)substr(p,"rsize="))) - args->rsize=getdec(&tmp); - if ((tmp = (char *)substr(p,"wsize="))) - args->wsize=getdec(&tmp); - if ((tmp = (char *)substr(p,"intr"))) - args->flags |= NFSMNT_INT; - if ((tmp = (char *)substr(p,"soft"))) - args->flags |= NFSMNT_SOFT; - if ((tmp = (char *)substr(p,"noconn"))) - args->flags |= NFSMNT_NOCONN; - if ((tmp = (char *)substr(p, "tcp"))) - args->sotype = SOCK_STREAM; - } else { - printf("%s mount options: rsize=%d,wsize=%d,resvport", - prefix, - args->rsize, - args->wsize); - if (args->flags & NFSMNT_INT) - printf (",intr"); - if (args->flags & NFSMNT_SOFT) - printf (",soft"); - if (args->flags & NFSMNT_NOCONN) - printf (",noconn"); - if (args->sotype == SOCK_STREAM) - printf (",tcp"); - else - printf (",udp"); - printf ("\r\n"); - } -} - -/************************************************************************** -CMD_ROOTOPTS - Set root mount options -**************************************************************************/ -cmd_rootopts(p) - char *p; -{ - mountopts("Rootfs",&nfsdiskless.root_args,p); -} - -/************************************************************************** -CMD_SWAPOPTS - Set swap mount options -**************************************************************************/ -cmd_swapopts(p) - char *p; -{ - mountopts("Swapfs",&nfsdiskless.swap_args,p); -} - -/************************************************************************** -CMD_FLAGS - Set boot flags -**************************************************************************/ -cmd_flags(buf) - char *buf; -{ - char p; - int flags = 0; - - while ((p = *buf++)) - switch (p) { - case 'b': flags |= RB_HALT; break; - case 'c': flags |= RB_CONFIG; break; - case 'd': flags |= RB_KDB; break; - case 'g': flags |= RB_GDB; break; - case 'h': flags ^= RB_SERIAL; break; - case 's': flags |= RB_SINGLE; break; - case 'v': flags |= RB_VERBOSE; break; - case ' ': - case '\t': break; - default: printf("Unknown boot flag: %c\n", p); - } - - howto = flags; - return(0); -} - -/************************************************************************** -EXECUTE - Decode command -**************************************************************************/ -execute(buf) - char *buf; -{ - char *p, *q; - struct bootcmds_t *cmd = bootcmds; - while (*buf == ' ' || *buf == '\t') - buf++; - if ((!(*buf)) || (*buf == '#')) - return(0); - while(cmd->name) { - p = buf; - q = cmd->name; - while (*q && *q == *p++) - q++; - if ((!(*q)) && ((*p == ' ') || (*p == '\t') || (!(*p)))) { - if (!cmd->func) - return(1); - while (*p == ' ' || *p == '\t') - p++; - (cmd->func)(p); - return(0); - } else - cmd++; - } - printf("bad command - type 'help' for list\n\r"); - return(0); -} - -/************************************************************************** -BOOTMENU - Present boot options -**************************************************************************/ -bootmenu() -{ - char cmd[80]; - int ptr, c; -#ifdef SECURE_BOOT - char *p; - - printf("\r\n"); - - printf("Press any key to retry:"); - while (iskey()) - getchar(); - getchar(); - printf("\r\n"); - eth_probe(); -#else - printf("\r\n"); - while (1) { - ptr = 0; - printf("boot> "); - while (ptr < 80) { - c = getchar(); - if (c == '\r') - break; - else if (c == '\b') { - if (ptr > 0) { - ptr--; - printf("\b \b"); - } - } else { - cmd[ptr++] = c; - putchar(c); - } - } - cmd[ptr] = 0; - printf("\r\n"); - if (execute(cmd)) break; - } -#endif - eth_reset(); -} diff --git a/sys/i386/boot/netboot/main.c b/sys/i386/boot/netboot/main.c deleted file mode 100644 index ba8885c..0000000 --- a/sys/i386/boot/netboot/main.c +++ /dev/null @@ -1,715 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ - -/* #define MDEBUG */ - -#include "netboot.h" - -int jmp_bootmenu[10]; - -struct exec head; -char *loadpoint; -char *kernel; -char kernel_buf[128]; -void (*kernelentry)(); -struct nfs_diskless nfsdiskless; -int hostnamelen; -char config_buffer[512]; /* Max TFTP packet */ -struct bootinfo bootinfo; -int root_nfs_port; -unsigned long netmask; -char kernel_handle[32]; -int offset, howto; - -extern char eth_driver[]; -extern char packet[]; -extern int packetlen, rpc_id; -char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - -/************************************************************************** -MAIN - Kick off routine -**************************************************************************/ -main() -{ - int c; - extern char edata[], end[]; - bzero(edata,end-edata); /* Zero BSS */ -#ifdef ASK_BOOT - while (1) { - printf("\nBoot from Network (Y/N) ? "); - c = getchar(); - if ((c >= 'a') && (c <= 'z')) c &= 0x5F; - if (c == '\r') break; - putchar(c); - if (c == 'N') - exit(0); - if (c == 'Y') - break; - printf(" - bad response\n\r"); - } -#endif - - /* get the bios's idea about the disks geometry */ - for(c = 0; c < N_BIOS_GEOM; c ++) - bootinfo.bi_bios_geom[c] = get_diskinfo(c + 0x80); - - gateA20(); - printf("\nBOOTP/TFTP/NFS bootstrap loader ESC for menu\n" - "\nSearching for adapter..."); - if (!eth_probe()) { - printf("No adapter found.\n"); - exit(0); - } - kernel = DEFAULT_BOOTFILE; - while (1) { - if (setjmp(jmp_bootmenu)) - bootmenu(); - else - load(); - } -} - -void -nfsload(length) -{ - int err, read_size; - - while (length > 0) { - read_size = length > NFS_READ_SIZE ? - NFS_READ_SIZE : length; - if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, - &kernel_handle, offset, read_size, loadpoint)) != - read_size) { - if (err < 0) { - printf("Unable to read data: "); - nfs_err(err); - } - longjmp(jmp_bootmenu, 1); - } - loadpoint += err; - length -= err; - offset += err; - } -} - -/************************************************************************** -LOAD - Try to get booted -**************************************************************************/ -load() -{ - char *p,*q; - char cfg[64]; - int root_mount_port; - int swap_nfs_port; - int swap_mount_port; - char cmd_line[80]; - int err, read_size, i; - long addr, broadcast; - int swsize; - unsigned long pad; - - config_buffer[0]='\0'; /* clear; bootp might fill this up */ -/* Initialize this early on */ - - nfsdiskless.root_args.rsize = 8192; - nfsdiskless.root_args.wsize = 8192; - nfsdiskless.swap_args.rsize = 8192; - nfsdiskless.swap_args.wsize = 8192; - nfsdiskless.root_args.sotype = SOCK_DGRAM; - nfsdiskless.root_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE | - NFSMNT_RESVPORT); - nfsdiskless.swap_args.sotype = SOCK_DGRAM; - nfsdiskless.swap_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE | - NFSMNT_RESVPORT); - - - /* Find a server to get BOOTP reply from */ - if (!arptable[ARP_CLIENT].ipaddr || !arptable[ARP_SERVER].ipaddr) { - printf("\r\nSearching for server...\r\n"); - if (!bootp()) { - printf("No Server found.\r\n"); - longjmp(jmp_bootmenu,1); - } - } - printf("My IP %I, Server IP %I, GW IP %I\r\n", - arptable[ARP_CLIENT].ipaddr, - arptable[ARP_SERVER].ipaddr, - arptable[ARP_GATEWAY].ipaddr); - -#ifdef MDEBUG - printf("\n=>>"); getchar(); -#endif - - /*** check if have got info from bootp ***/ - if (config_buffer[0]) - goto cfg_done; -#ifndef NO_TFTP - /* Now use TFTP to load configuration file */ - sprintf(cfg,"/tftpboot/freebsd.%I",arptable[ARP_CLIENT].ipaddr); - if (tftp(cfg) || tftp(cfg+10)) - goto cfg_done; - cfg[17]='\0'; - if (tftp(cfg) || tftp(cfg+10)) - goto cfg_done; - sprintf(cfg,"/tftpboot/cfg.%I",arptable[ARP_CLIENT].ipaddr); - if (tftp(cfg) || tftp(cfg+10)) - goto cfg_done; -#endif - /* not found; using default values... */ - sprintf(config_buffer,"rootfs %I:/usr/diskless_root", - arptable[ARP_SERVER].ipaddr); - printf("Unable to load config file, guessing:\r\n\t%s\r\n", - config_buffer); - -cfg_done: -#ifdef MDEBUG - printf("\n=>>"); getchar(); -#endif - - p = config_buffer; - while(*p) { - q = cmd_line; - while ((*p != '\n') && (*p)) *(q++) = *(p++); - *q = 0; - printf("%s\r\n",cmd_line); - execute(cmd_line); - if (*p) p++; - } - -#ifdef MDEBUG - printf("\n=>>"); getchar(); -#endif - - /* Check to make sure we've got a rootfs */ - if (!arptable[ARP_ROOTSERVER].ipaddr) { - printf("No ROOT filesystem server!\r\n"); - longjmp(jmp_bootmenu,1); - } - - /* Fill in nfsdiskless.myif */ - sprintf(&nfsdiskless.myif.ifra_name,eth_driver); - nfsdiskless.myif.ifra_addr.sa_len = sizeof(struct sockaddr); - nfsdiskless.myif.ifra_addr.sa_family = AF_INET; - addr = htonl(arptable[ARP_CLIENT].ipaddr); - bcopy(&addr, &nfsdiskless.myif.ifra_addr.sa_data[2], 4); - broadcast = (addr & netmask) | ~netmask; - nfsdiskless.myif.ifra_broadaddr.sa_len = sizeof(struct sockaddr); - nfsdiskless.myif.ifra_broadaddr.sa_family = AF_INET; - bcopy(&broadcast, &nfsdiskless.myif.ifra_broadaddr.sa_data[2], 4); - addr = htonl(arptable[ARP_GATEWAY].ipaddr); - if (addr) { - nfsdiskless.mygateway.sin_len = sizeof(struct sockaddr); - nfsdiskless.mygateway.sin_family = AF_INET; - bcopy(&addr, &nfsdiskless.mygateway.sin_addr, 4); - } else { - nfsdiskless.mygateway.sin_len = 0; - } - nfsdiskless.myif.ifra_mask.sa_len = sizeof(struct sockaddr); - nfsdiskless.myif.ifra_mask.sa_family = AF_UNSPEC; - bcopy(&netmask, &nfsdiskless.myif.ifra_mask.sa_data[2], 4); - - rpc_id = currticks(); - - /* Lookup NFS/MOUNTD ports for SWAP using PORTMAP */ - if (arptable[ARP_SWAPSERVER].ipaddr) { - char swapfs_fh[32], swapfile[32]; - swap_nfs_port = rpclookup(ARP_SWAPSERVER, PROG_NFS, 2); - swap_mount_port = rpclookup(ARP_SWAPSERVER, PROG_MOUNT, 1); - if ((swap_nfs_port == -1) || (swap_mount_port == -1)) { - printf("Unable to get SWAP NFS/MOUNT ports\r\n"); - longjmp(jmp_bootmenu,1); - } - if (err = nfs_mount(ARP_SWAPSERVER, swap_mount_port, - nfsdiskless.swap_hostnam, &swapfs_fh)) { - printf("Unable to mount SWAP filesystem: "); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - sprintf(swapfile,"swap.%I",arptable[ARP_CLIENT].ipaddr); - if (err = nfs_lookup(ARP_SWAPSERVER, swap_nfs_port, - &swapfs_fh, swapfile, &nfsdiskless.swap_fh, &swsize)) { - printf("Unable to open %s: ",swapfile); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - if (!nfsdiskless.swap_nblks) { - nfsdiskless.swap_nblks = swsize / 1024; - printf("Swap size is: %d blocks\n",nfsdiskless.swap_nblks); - } - nfsdiskless.swap_saddr.sin_len = sizeof(struct sockaddr_in); - nfsdiskless.swap_saddr.sin_family = AF_INET; - nfsdiskless.swap_saddr.sin_port = htons(swap_nfs_port); - nfsdiskless.swap_saddr.sin_addr.s_addr = - htonl(arptable[ARP_SWAPSERVER].ipaddr); - nfsdiskless.swap_args.timeo = 10; - nfsdiskless.swap_args.retrans = 100; - } - - /* Lookup NFS/MOUNTD ports for ROOT using PORTMAP */ - root_nfs_port = rpclookup(ARP_ROOTSERVER, PROG_NFS, 2); - root_mount_port = rpclookup(ARP_ROOTSERVER, PROG_MOUNT, 1); - if ((root_nfs_port == -1) || (root_mount_port == -1)) { - printf("Unable to get ROOT NFS/MOUNT ports\r\n"); - longjmp(jmp_bootmenu,1); - } - if (err = nfs_mount(ARP_ROOTSERVER, root_mount_port, - nfsdiskless.root_hostnam, &nfsdiskless.root_fh)) { - printf("Unable to mount ROOT filesystem: "); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - nfsdiskless.root_saddr.sin_len = sizeof(struct sockaddr_in); - nfsdiskless.root_saddr.sin_family = AF_INET; - nfsdiskless.root_saddr.sin_port = htons(root_nfs_port); - nfsdiskless.root_saddr.sin_addr.s_addr = - htonl(arptable[ARP_ROOTSERVER].ipaddr); - nfsdiskless.root_args.timeo = 10; - nfsdiskless.root_args.retrans = 100; - nfsdiskless.root_time = 0; - - if (err = nfs_lookup(ARP_ROOTSERVER, root_nfs_port, - &nfsdiskless.root_fh, *kernel == '/' ? kernel+1 : kernel, - &kernel_handle, NULL)) { - printf("Unable to open %s: ",kernel); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - - /* Load the kernel using NFS */ - printf("Loading %s...\r\n",kernel); - if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, &kernel_handle, 0, - sizeof(struct exec), &head)) < 0) { - printf("Unable to read %s: ",kernel); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - if (N_BADMAG(head)) { - printf("Bad executable format!\r\n"); - longjmp(jmp_bootmenu, 1); - } - loadpoint = (char *)(head.a_entry & 0x00FFFFFF); - offset = N_TXTOFF(head); - printf("text=0x%X, ",head.a_text); - nfsload(head.a_text); - while (((int)loadpoint) & PAGE_MASK) - *(loadpoint++) = 0; - - printf("data=0x%X, ",head.a_data); - nfsload(head.a_data); - - printf("bss=0x%X, ",head.a_bss); - while(head.a_bss--) *(loadpoint++) = 0; - - while (((int)loadpoint) & PAGE_MASK) - *(loadpoint++) = 0; - - bootinfo.bi_symtab = (u_int32_t)loadpoint; - - p = (char*)&head.a_syms; - for (i=0;i<sizeof(head.a_syms);i++) - *loadpoint++ = *p++; - - printf("symbols=[+0x%x+0x%x", sizeof(head.a_syms), head.a_syms); - - nfsload(head.a_syms); - i = sizeof(int); - p = loadpoint; - nfsload(i); - i = *(int*)p; - printf("+0x%x]\n", i); - i -= sizeof(int); - nfsload(i); - bootinfo.bi_esymtab = (u_int32_t)loadpoint; - - printf("entry=0x%X.\n\r",head.a_entry); - - /* Jump to kernel */ - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_kernelname = (u_int32_t)kernel; - bootinfo.bi_nfs_diskless = (u_int32_t)&nfsdiskless; - bootinfo.bi_size = sizeof bootinfo; - kernelentry = (void *)(head.a_entry & 0x00FFFFFF); - (*kernelentry)(howto|RB_BOOTINFO,NODEV,0,0,0,&bootinfo,0,0,0); - printf("*** %s execute failure ***\n",kernel); -} - -/************************************************************************** -POLLKBD - Check for Interrupt from keyboard -**************************************************************************/ -pollkbd() -{ -#ifndef SECURE_BOOT - if (iskey() && (getchar() == ESC)) longjmp(jmp_bootmenu,1); -#endif -} - -/************************************************************************** -DEFAULT_NETMASK - Set a default netmask for IP address -**************************************************************************/ -default_netmask() -{ - int net = arptable[ARP_CLIENT].ipaddr >> 24; - if (net <= 127) - netmask = htonl(0xff000000); - else if (net < 192) - netmask = htonl(0xffff0000); - else - netmask = htonl(0xffffff00); -} -/************************************************************************** -UDP_TRANSMIT - Send a UDP datagram -**************************************************************************/ -udp_transmit(destip, srcsock, destsock, len, buf) - unsigned long destip; - unsigned short srcsock, destsock; - int len; - char *buf; -{ - struct iphdr *ip; - struct udphdr *udp; - struct arprequest arpreq; - int arpentry, i; - unsigned long time; - int retry = MAX_ARP_RETRIES; - - ip = (struct iphdr *)buf; - udp = (struct udphdr *)(buf + sizeof(struct iphdr)); - ip->verhdrlen = 0x45; - ip->service = 0; - ip->len = htons(len); - ip->ident = 0; - ip->frags = 0; - ip->ttl = 60; - ip->protocol = IP_UDP; - ip->chksum = 0; - convert_ipaddr(ip->src, &arptable[ARP_CLIENT].ipaddr); - convert_ipaddr(ip->dest, &destip); - ip->chksum = ipchksum(buf, sizeof(struct iphdr)); - udp->src = htons(srcsock); - udp->dest = htons(destsock); - udp->len = htons(len - sizeof(struct iphdr)); - udp->chksum = 0; - if (destip == IP_BROADCAST) { - eth_transmit(broadcast, IP, len, buf); - } else { - long h_netmask = ntohl(netmask); - /* Check to see if we need gateway */ - if (((destip & h_netmask) != - (arptable[ARP_CLIENT].ipaddr & h_netmask)) && - arptable[ARP_GATEWAY].ipaddr) - destip = arptable[ARP_GATEWAY].ipaddr; - for(arpentry = 0; arpentry<MAX_ARP; arpentry++) - if (arptable[arpentry].ipaddr == destip) break; - if (arpentry == MAX_ARP) { - printf("%I is not in my arp table!\n"); - return(0); - } - for (i = 0; i<ETHER_ADDR_LEN; i++) - if (arptable[arpentry].node[i]) break; - if (i == ETHER_ADDR_LEN) { /* Need to do arp request */ - arpreq.hwtype = htons(1); - arpreq.protocol = htons(IP); - arpreq.hwlen = ETHER_ADDR_LEN; - arpreq.protolen = 4; - arpreq.opcode = htons(ARP_REQUEST); - bcopy(arptable[ARP_CLIENT].node, arpreq.shwaddr, - ETHER_ADDR_LEN); - convert_ipaddr(arpreq.sipaddr, - &arptable[ARP_CLIENT].ipaddr); - bzero(arpreq.thwaddr, ETHER_ADDR_LEN); - convert_ipaddr(arpreq.tipaddr, &destip); - while (retry--) { - eth_transmit(broadcast, ARP, sizeof(arpreq), - &arpreq); - if (await_reply(AWAIT_ARP, arpentry, - arpreq.tipaddr)) goto xmit; - } - return(0); - } -xmit: eth_transmit(arptable[arpentry].node, IP, len, buf); - } - return(1); -} - -/************************************************************************** -TFTP - Try to load configuation file -**************************************************************************/ -tftp(name) - char *name; -{ - struct tftp_t *tr; - int retry = MAX_TFTP_RETRIES; - static unsigned short isocket = 2000; - unsigned short osocket = TFTP; - unsigned short len, block=1; - struct tftp_t tp; - int code; - printf("Loading %s...\r\n",name); - isocket++; - tp.opcode = htons(TFTP_RRQ); - len = (sprintf((char *)tp.u.rrq,"%s%c%s",name,0,"octet") - - ((char *)&tp)) + 1; - while(retry--) { - if (!udp_transmit(arptable[ARP_SERVER].ipaddr, isocket, osocket, - len, &tp)) return(0); - if (await_reply(AWAIT_TFTP, isocket, NULL)) { - tr = (struct tftp_t *)&packet[ETHER_HDR_LEN]; - if (tr->opcode == ntohs(TFTP_ERROR)) { - printf("TFTP error %d (%s)\r\n", - ntohs(tr->u.err.errcode), - tr->u.err.errmsg); - return(0); - } /* ACK PACKET */ - if (tr->opcode != ntohs(TFTP_DATA)) return(0); - osocket = ntohs(tr->udp.src); - tp.opcode = htons(TFTP_ACK); - tp.u.ack.block = tr->u.data.block; - udp_transmit(arptable[ARP_SERVER].ipaddr, isocket, - osocket, TFTP_MIN_PACKET_SIZE, &tp); - len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 4; - if (len >= 512) { - printf("Config file too large.\r\n"); - config_buffer[0] = 0; - return(0); - } else { - bcopy(tr->u.data.download, config_buffer, len); - config_buffer[len] = 0; - } - return(1); - } - } - return(0); -} - -/************************************************************************** -BOOTP - Get my IP address and load information -**************************************************************************/ -bootp() -{ - int retry = MAX_BOOTP_RETRIES; - struct bootp_t bp; - unsigned long starttime; - bzero(&bp, sizeof(struct bootp_t)); - bp.bp_op = BOOTP_REQUEST; - bp.bp_htype = 1; - bp.bp_hlen = ETHER_ADDR_LEN; - bp.bp_xid = starttime = currticks(); - bcopy(arptable[ARP_CLIENT].node, bp.bp_hwaddr, ETHER_ADDR_LEN); - while(retry--) { - udp_transmit(IP_BROADCAST, 0, BOOTP_SERVER, - sizeof(struct bootp_t), &bp); - if (await_reply(AWAIT_BOOTP, 0, NULL)) - return(1); - bp.bp_secs = htons((currticks()-starttime)/20); - } - return(0); -} - - -/************************************************************************** -AWAIT_REPLY - Wait until we get a response for our request -**************************************************************************/ -await_reply(type, ival, ptr) - int type, ival; - char *ptr; -{ - unsigned long time; - struct iphdr *ip; - struct udphdr *udp; - struct arprequest *arpreply; - struct bootp_t *bootpreply; - struct rpc_t *rpc; - - int protohdrlen = ETHER_HDR_LEN + sizeof(struct iphdr) + - sizeof(struct udphdr); - time = currticks() + TIMEOUT; - while(time > currticks()) { - pollkbd(); - if (eth_poll()) { /* We have something! */ - /* Check for ARP - No IP hdr */ - if ((type == AWAIT_ARP) && - (packetlen >= ETHER_HDR_LEN + - sizeof(struct arprequest)) && - (((packet[12] << 8) | packet[13]) == ARP)) { - arpreply = (struct arprequest *) - &packet[ETHER_HDR_LEN]; - if ((arpreply->opcode == ntohs(ARP_REPLY)) && - bcompare(arpreply->sipaddr, ptr, 4)) { - bcopy(arpreply->shwaddr, - arptable[ival].node, - ETHER_ADDR_LEN); - return(1); - } - continue; - } - - /* Anything else has IP header */ - if ((packetlen < protohdrlen) || - (((packet[12] << 8) | packet[13]) != IP)) continue; - ip = (struct iphdr *)&packet[ETHER_HDR_LEN]; - if ((ip->verhdrlen != 0x45) || - ipchksum(ip, sizeof(struct iphdr)) || - (ip->protocol != IP_UDP)) continue; - udp = (struct udphdr *)&packet[ETHER_HDR_LEN + - sizeof(struct iphdr)]; - - /* BOOTP ? */ - bootpreply = (struct bootp_t *)&packet[ETHER_HDR_LEN]; - if ((type == AWAIT_BOOTP) && - (packetlen >= (ETHER_HDR_LEN + - sizeof(struct iphdr) + - sizeof(struct udphdr) + - BOOTP_MIN_LEN)) && - (ntohs(udp->dest) == BOOTP_CLIENT) && - (bootpreply->bp_op == BOOTP_REPLY)) { - convert_ipaddr(&arptable[ARP_CLIENT].ipaddr, - bootpreply->bp_yiaddr); - default_netmask(); - convert_ipaddr(&arptable[ARP_SERVER].ipaddr, - bootpreply->bp_siaddr); - bzero(arptable[ARP_SERVER].node, - ETHER_ADDR_LEN); /* Kill arp */ - convert_ipaddr(&arptable[ARP_GATEWAY].ipaddr, - bootpreply->bp_giaddr); - bzero(arptable[ARP_GATEWAY].node, - ETHER_ADDR_LEN); /* Kill arp */ - if (bootpreply->bp_file[0]) { - bcopy(bootpreply->bp_file, - kernel_buf, 128); - kernel = kernel_buf; - } - decode_rfc1048(bootpreply->bp_vend); - return(1); - } - - /* TFTP ? */ - if ((type == AWAIT_TFTP) && - (ntohs(udp->dest) == ival)) return(1); - - /* RPC */ - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if ((type == AWAIT_RPC) && - (ntohs(udp->dest) == RPC_SOCKET) && - (ntohl(rpc->u.reply.id) == ival) && - (ntohl(rpc->u.reply.type) == MSG_REPLY)) { - rpc_id++; - return(1); - } - } - } - return(0); -} - -void -bootp_string(char *name, char *bootp_ptr) -{ - char tmp_buf[512]; /* oversized, but who cares ! */ - bzero(tmp_buf, sizeof(tmp_buf)); - bcopy(bootp_ptr+2, tmp_buf, TAG_LEN(bootp_ptr)); - sprintf(config_buffer+strlen(config_buffer), - "%s %s\n", name, tmp_buf); -} - - -/************************************************************************** -DECODE_RFC1048 - Decodes RFC1048 header -**************************************************************************/ -decode_rfc1048(p) - unsigned char *p; -{ - static char rfc1048_cookie[4] = RFC1048_COOKIE; - unsigned char *end = p + BOOTP_VENDOR_LEN,*q; - if (bcompare(p, rfc1048_cookie, 4)) { /* RFC 1048 header */ - p += 4; - while(p < end) { - switch (*p) { - case RFC1048_PAD: - p++; - continue; - case RFC1048_END: - p = end; - continue; - case RFC1048_GATEWAY: - convert_ipaddr(&arptable[ARP_GATEWAY].ipaddr, - p+2); - break; - case RFC1048_NETMASK: - bcopy(p+2,&netmask,4); - break; - case RFC1048_HOSTNAME: - bcopy(p+2, &nfsdiskless.my_hostnam, TAG_LEN(p)); - hostnamelen = (TAG_LEN(p) + 3) & ~3; - break; - case RFC1048_ROOT_PATH: /* XXX check len */ - bootp_string("rootfs", p); - break; - case RFC1048_SWAP_PATH: - bootp_string("swapfs", p); - break; - case RFC1048_SWAP_LEN: /* T129 */ - sprintf(config_buffer+strlen(config_buffer), - "swapsize %d\n", ntohl(*(long *)(p+2)) ); - break; - case 130: /* root mount options */ - bootp_string("rootopts", p); - break; - case 131: /* swap mount options */ - bootp_string("swapopts", p); - break; - case 132: /* any other options */ - case 133: - case 134: - case 135: - case 136: - case 137: - case 138: - case 139: - case 140: - case 141: - bootp_string("", p); - break; - default: - printf("Unknown RFC1048-tag "); - for(q=p;q<p+2+TAG_LEN(p);q++) - printf("%x ",*q); - printf("\n\r"); - } - p += TAG_LEN(p) + 2; - } - } -} - -/************************************************************************** -IPCHKSUM - Checksum IP Header -**************************************************************************/ -ipchksum(ip, len) - unsigned short *ip; - int len; -{ - unsigned long sum = 0; - len >>= 1; - while (len--) { - sum += *(ip++); - if (sum > 0xFFFF) - sum -= 0xFFFF; - } - return((~sum) & 0x0000FFFF); -} - - -/************************************************************************** -CONVERT_IPADDR - Convert IP address from net to machine order -**************************************************************************/ -convert_ipaddr(d, s) - char *d,*s; -{ - *(d+3) = *s; - *(d+2) = *(s+1); - *(d+1) = *(s+2); - *d = *(s+3); -} diff --git a/sys/i386/boot/netboot/makerom.c b/sys/i386/boot/netboot/makerom.c deleted file mode 100644 index 51b1c28..0000000 --- a/sys/i386/boot/netboot/makerom.c +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************ - -Program to put ROM checksum in ROM image. - -This program strips off the FreeBSD a.out header! - -************************************************************************/ -#include <stdio.h> -#include <sys/fcntl.h> - -unsigned char rom[ROMSIZE]; -unsigned int sum; - -main(argc,argv) - int argc; char *argv[]; -{ - int i, fd; - if (argc < 1) { - fprintf(stderr,"usage: %s rom-file\n",argv[0]); - exit(2); - } - if ((fd = open(argv[1], O_RDWR)) < 0) { - perror("unable to open file"); - exit(2); - } - bzero(rom, ROMSIZE); - if (lseek(fd, (off_t)32, SEEK_SET) < 0) { - perror("lseek error"); - exit(2); - } - if (read(fd, rom, ROMSIZE) < 0) { - perror("read error"); - exit(2); - } - rom[5] = 0; - for (i=0,sum=0; i<ROMSIZE; i++) - sum += rom[i]; - rom[5] = -sum; - for (i=0,sum=0; i<ROMSIZE; i++) - sum += rom[i]; - if (sum & 0x00FF) - printf("checksum fails.\n"); - if (lseek(fd, (off_t)0, SEEK_SET) < 0) { - perror("unable to seek"); - exit(2); - } - if (write(fd, rom, ROMSIZE) < 0) { - perror("unable to write"); - exit(2); - } - close(fd); - exit(0); -} diff --git a/sys/i386/boot/netboot/misc.c b/sys/i386/boot/netboot/misc.c deleted file mode 100644 index 5dc7f4e..0000000 --- a/sys/i386/boot/netboot/misc.c +++ /dev/null @@ -1,286 +0,0 @@ -/************************************************************************** -MISC Support Routines -**************************************************************************/ - -#include "netboot.h" - -#define NO_SWITCH /* saves space */ - -/************************************************************************** -TWIDDLE -**************************************************************************/ -twiddle() -{ - static int count=0; - char tiddles[]="-\\|/"; - putchar(tiddles[(count++)&3]); - putchar('\b'); -} - -/************************************************************************** -BCOPY -**************************************************************************/ -bcopy(s,d,n) - char *s, *d; - int n; -{ - while ((n--) > 0) { - *(d++) = *(s++); - } -} - -/************************************************************************** -BZERO -**************************************************************************/ -bzero(d,n) - char *d; - int n; -{ - while ((n--) > 0) { - *(d++) = 0; - } -} - -/************************************************************************** -BCOMPARE -**************************************************************************/ -bcompare(d,s,n) - char *d,*s; - int n; -{ - while ((n--) > 0) { - if (*(d++) != *(s++)) return(0); - } - return(1); -} - -/************************************************************************** -SUBSTR (slightly wacky but functional) -**************************************************************************/ -char *substr(a,b) -char *a,*b; -{ -char *loc1; -char *loc2; - - while (*a != '\0') { - loc1 = a; - loc2 = b; - while (*loc1 == *loc2++) { - if (*loc1 == '\0') return (0); - loc1++; - if (*loc2 == '\0') return (loc1); - } - a++; - } - return (0); -} - -/************************************************************************** -PRINTF and friends - - Formats: - %X - 4 byte ASCII (8 hex digits) - %x - 2 byte ASCII (4 hex digits) - %b - 1 byte ASCII (2 hex digits) - %d - decimal - %c - ASCII char - %s - ASCII string - %I - Internet address in x.x.x.x notation - %L - Binary long - %S - String (multiple of 4 bytes) preceded with 4 byte - binary length - %M - Copy memory. Takes two args, len and ptr -**************************************************************************/ -static char hex[]="0123456789ABCDEF"; -char *do_printf(buf, fmt, dp) - char *buf, *fmt; - int *dp; -{ - register char *p; - char tmp[16]; - while (*fmt) { - if (*fmt == '%') { /* switch() uses more space */ - fmt++; - if (*fmt == 'L') { - register int h = *(dp++); - *(buf++) = h>>24; - *(buf++) = h>>16; - *(buf++) = h>>8; - *(buf++) = h; - } - if (*fmt == 'S') { - register int len = 0; - char *lenptr = buf; - p = (char *)*dp++; - buf += 4; - while (*p) { - *(buf++) = *p++; - len ++; - } - *(lenptr++) = len>>24; - *(lenptr++) = len>>16; - *(lenptr++) = len>>8; - *lenptr = len; - while (len & 3) { - *(buf++) = 0; - len ++; - } - } - if (*fmt == 'M') { - register int len = *(dp++); - bcopy((char *)*dp++, buf, len); - buf += len; - } - if (*fmt == 'X') { - register int h = *(dp++); - *(buf++) = hex[(h>>28)& 0x0F]; - *(buf++) = hex[(h>>24)& 0x0F]; - *(buf++) = hex[(h>>20)& 0x0F]; - *(buf++) = hex[(h>>16)& 0x0F]; - *(buf++) = hex[(h>>12)& 0x0F]; - *(buf++) = hex[(h>>8)& 0x0F]; - *(buf++) = hex[(h>>4)& 0x0F]; - *(buf++) = hex[h& 0x0F]; - } - if (*fmt == 'x') { - register int h = *(dp++); - *(buf++) = hex[(h>>12)& 0x0F]; - *(buf++) = hex[(h>>8)& 0x0F]; - *(buf++) = hex[(h>>4)& 0x0F]; - *(buf++) = hex[h& 0x0F]; - } - if (*fmt == 'b') { - register int h = *(dp++); - *(buf++) = hex[(h>>4)& 0x0F]; - *(buf++) = hex[h& 0x0F]; - } - if (*fmt == 'd') { - register int dec = *(dp++); - p = tmp; - if (dec < 0) { - *(buf++) = '-'; - dec = -dec; - } - do { - *(p++) = '0' + (dec%10); - dec = dec/10; - } while(dec); - while ((--p) >= tmp) *(buf++) = *p; - } - if (*fmt == 'I') { - buf = sprintf(buf,"%d.%d.%d.%d", - (*(dp)>>24) & 0x00FF, - (*(dp)>>16) & 0x00FF, - (*(dp)>>8) & 0x00FF, - *dp & 0x00FF); - dp++; - } - if (*fmt == 'c') - *(buf++) = *(dp++); - if (*fmt == 's') { - p = (char *)*dp++; - while (*p) *(buf++) = *p++; - } - } else *(buf++) = *fmt; - fmt++; - } - *buf = 0; - return(buf); -} - -char *sprintf(buf, fmt, data) - char *fmt, *buf; - int data; -{ - return(do_printf(buf,fmt, &data)); -} - -printf(fmt,data) - char *fmt; - int data; -{ - char buf[1024],*p; - p = buf; - do_printf(buf,fmt,&data); - while (*p) { - if (*p=='\n') putchar('\r'); - putchar(*p++); - } -} - -/************************************************************************** -SETIP - Convert an ascii x.x.x.x to binary form -**************************************************************************/ -setip(p, i) - char *p; - unsigned *i; -{ - unsigned ip = 0; - int val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - if (*p != '.') return(0); - p++; - ip = val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - if (*p != '.') return(0); - p++; - ip = (ip << 8) | val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - if (*p != '.') return(0); - p++; - ip = (ip << 8) | val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - *i = (ip << 8) | val; - return(1); -} - -getdec(ptr) - char **ptr; -{ - char *p = *ptr; - int ret=0; - if ((*p < '0') || (*p > '9')) return(-1); - while ((*p >= '0') && (*p <= '9')) { - ret = ret*10 + (*p - '0'); - p++; - } - *ptr = p; - return(ret); -} - - -#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 0x9f /* enable A20, - enable output buffer full interrupt - enable data line - disable clock line */ - -/* - * Gate A20 for high memory - */ -unsigned char x_20 = KB_A20; -gateA20() -{ -#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); - outb(K_RDWR, x_20); - while (inb(K_STATUS) & K_IBUF_FUL); -#endif IBM_L40 -} - diff --git a/sys/i386/boot/netboot/netboot.8 b/sys/i386/boot/netboot/netboot.8 deleted file mode 100644 index 2717ec5..0000000 --- a/sys/i386/boot/netboot/netboot.8 +++ /dev/null @@ -1,101 +0,0 @@ -.\" $FreeBSD$ -.Dd May 15, 1997 -.Dt NETBOOT 8 -.\".Os BSD 4 -.Sh NAME -.Nm netboot -.Nd Allows remote booting of the operating system -.Sh SYNOPSIS -.Nm -.Bl -tag -width Ds -is used for booting the operating system over a network card. The -program is either loaded into a ROM, or run from DOS. -.Pp -.Sh DESCRIPTION -.Nm -loads parameters such as IP addresses, kernel name and filesystem -names from a bootp server, tries to mount the specified root and -swap filesystems, loads the specified kernel from the root filesystem -using NFSv2, and then gives control to the kernel. -.Pp -The bootp server must be configured appropriately. An example -configuration for /etc/bootptab is the following: -.Bd -literal - .default:\\ - :sm=255.255.255.0:\\ - :gw=your.gateway.ip:\\ - :hn:ht=ether:vm=rfc1048:\\ - :rp="rootfs.ip:/rootfs/path":\\ - :T128="swapfs.ip:/swapfs/path":\\ - :T129=swapsize:\\ - :T130="root,mount,options":\\ - :T131="swap,mount,options":\\ - :ra=255.255.255.255: - client01:bf="kernel.300":ha=00400530d6d9:tc=.default: - client02:bf="kernel.280":ha=00400530d6d3:tc=.default: - ... -.Ed -.Pp -For a precise description of the bootptab parameters, see -bootptab (5) . -.Pp -The -.Nm -code uses options as follows. -.Bl -tag -width indent -.It Cm sm -indicates the subnet mask. -.It Cm gw -is the ip address of the gateway. -.It Cm hn -instructs the bootp server to send the hostname in the reply. -.It Cm ht= Ns Ar ether -.\.It ht=ether -indicates that the hardware is ethernet. -.It Cm vm= Ns Ar rfc1048 -indicates the use of rfc1048 extensions. -.It Cm rp -specifies where the directory mounted as the root filesystem is located. -The IP address of the server must be specified, followed by a : and the -directory pathname. -.It Cm T128 -specifies where the directory containing the swap file is located. -The IP address of the server must be specified, followed by a : and the -directory pathname. -The actual swapfile is a file named swap.X.Y.Z.T where X.Y.Z.T is the -IP address of the client. If this argument is given, the swap file must exist. -.It Cm T129 -specifies the size of the swap file, in KB. Must be specified as -a 8 digits long hexadecimal number. 16 MB swap thus becomes -T129=00004000. This argument is optional; if missing, the size of the -swap file is read from the server. -.It Cm T130 -specifies root mount options, such as soft, intr, tcp, etc. -This argument is optional. The default is to use UDP. -.It Cm T131 -specifies swap mount options. -This argument is optional. -.It Cm bf -is the name of the kernel. If not specified, it defaults to -"kernel". -.It Cm ra -is used to override the reply address. - -.Sh FILES -.Bl -tag -width /usr/mdec/nb3c509.rom -compact -.It Pa /usr/mdec/nb8390.rom -rom image for NE1000/NE2000 cards -.It Pa /usr/mdec/nb8390.com -DOS executable for NE1000/NE2000 cards -.It Pa /usr/mdec/nb3c509.rom -rom image for 3C509 cards -.It Pa /usr/mdec/nb3c509.com -DOS executable for 3C509 cards - -.Sh SEE ALSO -.Xr bootptab 5 , -.Xr bootpd 8 - -.Sh BUGS -To use netboot with Western Digital/SMC cards or 3C503 cards, a recompile -is needed after a little Makefile tweaking. diff --git a/sys/i386/boot/netboot/netboot.h b/sys/i386/boot/netboot/netboot.h deleted file mode 100644 index 37883b4..0000000 --- a/sys/i386/boot/netboot/netboot.h +++ /dev/null @@ -1,258 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ - -#include <sys/types.h> -#include <sys/reboot.h> -#include <a.out.h> -#include <netdb.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <sys/time.h> -#include <net/ethernet.h> -#include <net/if.h> -#include <netinet/in.h> -#include <nfs/nfsv2.h> -#include <nfs/rpcv2.h> -#include <nfs/nfs.h> -#include <nfs/nfsdiskless.h> -#include <machine/bootinfo.h> -#include <machine/cpufunc.h> - -#define ESC 0x1B - -#ifndef DEFAULT_BOOTFILE -#define DEFAULT_BOOTFILE "/kernel" -#endif - -#ifndef MAX_TFTP_RETRIES -#define MAX_TFTP_RETRIES 20 -#endif - -#ifndef MAX_BOOTP_RETRIES -#define MAX_BOOTP_RETRIES 20 -#endif - -#ifndef MAX_ARP_RETRIES -#define MAX_ARP_RETRIES 20 -#endif - -#ifndef MAX_RPC_RETRIES -#define MAX_RPC_RETRIES 20 -#endif - -#ifndef TIMEOUT /* Inter-packet retry in ticks 18/sec */ -#define TIMEOUT 20 -#endif - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#define TRUE 1 -#define FALSE 0 - -#define VENDOR_NONE 0 -#define VENDOR_WD 1 -#define VENDOR_NOVELL 2 -#define VENDOR_3COM 3 -#define VENDOR_3C509 4 - -#define FLAG_PIO 0x01 -#define FLAG_16BIT 0x02 -#define FLAG_790 0x04 - -#define ARP_CLIENT 0 -#define ARP_SERVER 1 -#define ARP_GATEWAY 2 -#define ARP_NS 3 -#define ARP_ROOTSERVER 4 -#define ARP_SWAPSERVER 5 -#define MAX_ARP ARP_SWAPSERVER+1 - -#define IP 0x0800 -#define ARP 0x0806 - -#define BOOTP_SERVER 67 -#define BOOTP_CLIENT 68 -#define TFTP 69 -#define SUNRPC 111 - -#define RPC_SOCKET 620 /* Arbitrary */ - -#define IP_UDP 17 -#define IP_BROADCAST 0xFFFFFFFF - -#define ARP_REQUEST 1 -#define ARP_REPLY 2 - -#define BOOTP_REQUEST 1 -#define BOOTP_REPLY 2 - -#define TAG_LEN(p) (*((p)+1)) -#define RFC1048_COOKIE { 99, 130, 83, 99 } -#define RFC1048_PAD 0 -#define RFC1048_NETMASK 1 -#define RFC1048_TIME_OFFSET 2 -#define RFC1048_GATEWAY 3 -#define RFC1048_TIME_SERVER 4 -#define RFC1048_NAME_SERVER 5 -#define RFC1048_DOMAIN_SERVER 6 -#define RFC1048_HOSTNAME 12 -#define RFC1048_BOOT_SIZE 12 /* XXX */ -#define RFC1048_SWAP_SERVER 16 -#define RFC1048_ROOT_PATH 17 -#define RFC1048_SWAP_PATH 128 /* T128 */ -#define RFC1048_SWAP_LEN 129 /* T129 */ - -#define RFC1048_END 255 -#define BOOTP_VENDOR_LEN 256 /* Extended vendor field */ - -#define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */ - -#define TFTP_RRQ 1 -#define TFTP_WRQ 2 -#define TFTP_DATA 3 -#define TFTP_ACK 4 -#define TFTP_ERROR 5 - -#define TFTP_CODE_EOF 1 -#define TFTP_CODE_MORE 2 -#define TFTP_CODE_ERROR 3 -#define TFTP_CODE_BOOT 4 -#define TFTP_CODE_CFG 5 - -#define PROG_PORTMAP 100000 -#define PROG_NFS 100003 -#define PROG_MOUNT 100005 - -#define MSG_CALL 0 -#define MSG_REPLY 1 - -#define PORTMAP_LOOKUP 3 - -#define MOUNT_ADDENTRY 1 -#define NFS_LOOKUP 4 -#define NFS_READ 6 - -#define NFS_READ_SIZE 1024 - - -#define AWAIT_ARP 0 -#define AWAIT_BOOTP 1 -#define AWAIT_TFTP 2 -#define AWAIT_RPC 3 - -struct arptable_t { - unsigned long ipaddr; - unsigned char node[6]; -} arptable[MAX_ARP]; - -struct arprequest { - unsigned short hwtype; - unsigned short protocol; - char hwlen; - char protolen; - unsigned short opcode; - char shwaddr[6]; - char sipaddr[4]; - char thwaddr[6]; - char tipaddr[4]; -}; - -struct iphdr { - char verhdrlen; - char service; - unsigned short len; - unsigned short ident; - unsigned short frags; - char ttl; - char protocol; - unsigned short chksum; - char src[4]; - char dest[4]; -}; - -struct udphdr { - unsigned short src; - unsigned short dest; - unsigned short len; - unsigned short chksum; -}; - -struct bootp_t { - struct iphdr ip; - struct udphdr udp; - char bp_op; - char bp_htype; - char bp_hlen; - char bp_hops; - unsigned long bp_xid; - unsigned short bp_secs; - unsigned short unused; - char bp_ciaddr[4]; - char bp_yiaddr[4]; - char bp_siaddr[4]; - char bp_giaddr[4]; - char bp_hwaddr[16]; - char bp_sname[64]; - char bp_file[128]; - char bp_vend[BOOTP_VENDOR_LEN]; -}; - -struct tftp_t { - struct iphdr ip; - struct udphdr udp; - unsigned short opcode; - union { - char rrq[512]; - struct { - unsigned short block; - char download[512]; - } data; - struct { - unsigned short block; - } ack; - struct { - unsigned short errcode; - char errmsg[512]; - } err; - } u; -}; - -struct rpc_t { - struct iphdr ip; - struct udphdr udp; - union { - char data[1400]; - struct { - long id; - long type; - long rstatus; - long verifier; - long v2; - long astatus; - long data[1]; - } reply; - } u; -}; - -#define TFTP_MIN_PACKET_SIZE (sizeof(struct iphdr) + sizeof(struct udphdr) + 4) - -/*************************************************************************** -RPC Functions -***************************************************************************/ -#define PUTLONG(val) {\ - register int lval = val; \ - *(rpcptr++) = ((lval) >> 24); \ - *(rpcptr++) = ((lval) >> 16); \ - *(rpcptr++) = ((lval) >> 8); \ - *(rpcptr++) = (lval); \ - rpclen+=4; } - -char *sprintf(); diff --git a/sys/i386/boot/netboot/ns8390.c b/sys/i386/boot/netboot/ns8390.c deleted file mode 100644 index c495d5a..0000000 --- a/sys/i386/boot/netboot/ns8390.c +++ /dev/null @@ -1,668 +0,0 @@ - -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: May/94 - - This code is based heavily on David Greenman's if_ed.c driver - - Copyright (C) 1993-1994, David Greenman, Martin Renters. - This software may be used, modified, copied, distributed, and sold, in - both source and binary form provided that the above copyright and these - terms are retained. Under no circumstances are the authors responsible for - the proper functioning of this software, nor do the authors assume any - responsibility for damages incurred with its use. - -3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94 -SMC8416 support added by Bill Paul (wpaul@ctr.columbia.edu) on 12/25/94 - -**************************************************************************/ - -DELAY(int x) -{ volatile long a, b, l; - for (x; x>0; x--) b=a; -} - -#include "netboot.h" -#include "ns8390.h" - -#ifdef _3COM_USE_AUI -short aui=1; -#else -short aui=0; -#endif - -unsigned short eth_nic_base; -unsigned short eth_asic_base; -unsigned char eth_tx_start; -unsigned char eth_laar; -unsigned char eth_flags; -unsigned char eth_vendor; -unsigned char eth_memsize; -unsigned char *eth_bmem; -unsigned char *eth_rmem; -unsigned char *eth_node_addr; - -/************************************************************************** -The following two variables are used externally -**************************************************************************/ -char eth_driver[] = "ed0"; -char packet[ETHER_MAX_LEN]; -int packetlen; - -#ifdef INCLUDE_NE -static unsigned short ne_base_list[]= { -#ifdef NE_BASE - NE_BASE, -#endif - 0xff80, 0xff40, 0xff00, 0xfec0, - 0x280, 0x300, 0 -}; -#endif -/************************************************************************** -ETH_PROBE - Look for an adapter -**************************************************************************/ -eth_probe() -{ - int i; - struct wd_board *brd; - char *name; - unsigned short chksum; - unsigned char c; - - eth_vendor = VENDOR_NONE; - -#ifdef INCLUDE_WD - /****************************************************************** - Search for WD/SMC cards - ******************************************************************/ - for (eth_asic_base = WD_LOW_BASE; eth_asic_base <= WD_HIGH_BASE; - eth_asic_base += 0x20) { - chksum = 0; - /* Check for WD/SMC card by checking ethernet address */ - if (inb(eth_asic_base+8) != 0) continue; - if (inb(eth_asic_base+9) != 0xE0) { - if (inb(eth_asic_base+9) != 0) continue; - if (inb(eth_asic_base+10) != 0xC0) continue; - } - for (i=8; i<16; i++) - chksum += inb(i+eth_asic_base); - if ((chksum & 0x00FF) == 0x00FF) - break; - } - if (eth_asic_base <= WD_HIGH_BASE) { /* We've found a board */ - eth_vendor = VENDOR_WD; - eth_nic_base = eth_asic_base + WD_NIC_ADDR; - c = inb(eth_asic_base+WD_BID); /* Get board id */ - for (brd = wd_boards; brd->name; brd++) - if (brd->id == c) break; - if (!brd->name) { - printf("\r\nUnknown Ethernet type %x\r\n", c); - return(0); /* Unknown type */ - } - eth_flags = brd->flags; - eth_memsize = brd->memsize; - eth_tx_start = 0; - if ((c == TYPE_WD8013EP) && - (inb(eth_asic_base + WD_ICR) & WD_ICR_16BIT)) { - eth_flags = FLAG_16BIT; - eth_memsize = MEM_16384; - } - if ((c & WD_SOFTCONFIG) && (!(eth_flags & FLAG_790))) { - eth_bmem = (char *)(0x80000 | - ((inb(eth_asic_base + WD_MSR) & 0x3F) << 13)); - } else - eth_bmem = (char *)WD_DEFAULT_MEM; - if (brd->id == TYPE_SMC8216T || brd->id == TYPE_SMC8216C) { - (unsigned int) *(eth_bmem + 8192) = (unsigned int)0; - if ((unsigned int) *(eth_bmem + 8192)) { - brd += 2; - eth_memsize = brd->memsize; - } - } - outb(eth_asic_base + WD_MSR, 0x80); /* Reset */ - printf("\r\n%s base 0x%x, memory 0x%X, addr ", - brd->name, eth_asic_base, eth_bmem); - for (i=0; i<6; i++) { - printf("%b",(int)(arptable[ARP_CLIENT].node[i] = - inb(i+eth_asic_base+WD_LAR))); - if (i < 5) printf (":"); - } - if (eth_flags & FLAG_790) { - outb(eth_asic_base+WD_MSR, WD_MSR_MENB); - outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) | - 0x80)); - outb(eth_asic_base+0x0B, - (((unsigned)eth_bmem >> 13) & 0x0F) | - (((unsigned)eth_bmem >> 11) & 0x40) | - (inb(eth_asic_base+0x0B) & 0xB0)); - outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) & - ~0x80)); - } else { - outb(eth_asic_base+WD_MSR, - (((unsigned)eth_bmem >> 13) & 0x3F) | 0x40); - } - if (eth_flags & FLAG_16BIT) { - if (eth_flags & FLAG_790) { - eth_laar = inb(eth_asic_base + WD_LAAR); - outb(eth_asic_base + WD_LAAR, WD_LAAR_M16EN); - inb(0x84); - } else { - outb(eth_asic_base + WD_LAAR, (eth_laar = - WD_LAAR_M16EN | WD_LAAR_L16EN | 1)); - } - } - goto found_board; - } -#endif -#ifdef INCLUDE_3COM - /****************************************************************** - Search for 3Com 3c503 if no WD/SMC cards - ******************************************************************/ - if (eth_vendor == VENDOR_NONE) { - eth_asic_base = _3COM_BASE + _3COM_ASIC_OFFSET; - eth_nic_base = _3COM_BASE; - eth_vendor = VENDOR_3COM; - /* - * Note that we use the same settings for both 8 and 16 bit cards: - * both have an 8K bank of memory at page 1 while only the 16 bit - * cards have a bank at page 0. - */ - eth_memsize = MEM_16384; - eth_tx_start = 32; - - /* Check our base address */ - - switch(inb(eth_asic_base + _3COM_BCFR)) { - case _3COM_BCFR_300: - if ((int)eth_nic_base != 0x300) - return(0); - break; - case _3COM_BCFR_310: - if ((int)eth_nic_base != 0x310) - return(0); - break; - case _3COM_BCFR_330: - if ((int)eth_nic_base != 0x330) - return(0); - break; - case _3COM_BCFR_350: - if ((int)eth_nic_base != 0x350) - return(0); - break; - case _3COM_BCFR_250: - if ((int)eth_nic_base != 0x250) - return(0); - break; - case _3COM_BCFR_280: - if ((int)eth_nic_base != 0x280) - return(0); - break; - case _3COM_BCFR_2A0: - if ((int)eth_nic_base != 0x2a0) - return(0); - break; - case _3COM_BCFR_2E0: - if ((int)eth_nic_base != 0x2e0) - return(0); - break; - default: - return (0); - } - - /* Now get the shared memory address */ - - switch (inb(eth_asic_base + _3COM_PCFR)) { - case _3COM_PCFR_DC000: - eth_bmem = (char *)0xdc000; - break; - case _3COM_PCFR_D8000: - eth_bmem = (char *)0xd8000; - break; - case _3COM_PCFR_CC000: - eth_bmem = (char *)0xcc000; - break; - case _3COM_PCFR_C8000: - eth_bmem = (char *)0xc8000; - break; - default: - return (0); - } - - /* Need this to make eth_poll() happy. */ - - eth_rmem = eth_bmem - 0x2000; - - /* Reset NIC and ASIC */ - - outb (eth_asic_base + _3COM_CR , _3COM_CR_RST | _3COM_CR_XSEL); - outb (eth_asic_base + _3COM_CR , _3COM_CR_XSEL); - - /* Get our ethernet address */ - - outb(eth_asic_base + _3COM_CR, _3COM_CR_EALO | _3COM_CR_XSEL); - printf("\r\n3Com 3c503 base 0x%x, memory 0x%X addr ", - eth_nic_base, eth_bmem); - for (i=0; i<6; i++) { - printf("%b",(int)(arptable[ARP_CLIENT].node[i] = - inb(eth_nic_base+i))); - if (i < 5) printf (":"); - } - outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL); - /* - * Initialize GA configuration register. Set bank and enable shared - * mem. We always use bank 1. - */ - outb(eth_asic_base + _3COM_GACFR, _3COM_GACFR_RSEL | - _3COM_GACFR_MBS0); - - outb(eth_asic_base + _3COM_VPTR2, 0xff); - outb(eth_asic_base + _3COM_VPTR1, 0xff); - outb(eth_asic_base + _3COM_VPTR0, 0x00); - /* - * Clear memory and verify that it worked (we use only 8K) - */ - bzero(eth_bmem, 0x2000); - for(i = 0; i < 0x2000; ++i) - if (*((eth_bmem)+i)) { - printf ("Failed to clear 3c503 shared mem.\r\n"); - return (0); - } - /* - * Initialize GA page/start/stop registers. - */ - outb(eth_asic_base + _3COM_PSTR, eth_tx_start); - outb(eth_asic_base + _3COM_PSPR, eth_memsize); - - goto found_board; - - } -#endif -#ifdef INCLUDE_NE - /****************************************************************** - Search for NE1000/2000 if no WD/SMC or 3com cards - ******************************************************************/ - if (eth_vendor == VENDOR_NONE) { - char romdata[16], testbuf[32]; - char test[] = "NE1000/2000 memory"; - unsigned short *tent_base=ne_base_list; - eth_bmem = (char *)0; /* No shared memory */ -ne_again: - eth_asic_base = *tent_base + NE_ASIC_OFFSET; - eth_nic_base = *tent_base; - printf("Looking for NE1000/NE2000 at 0x%x\n", eth_nic_base); - - eth_vendor = VENDOR_NOVELL; - eth_flags = FLAG_PIO; - eth_memsize = MEM_16384; - eth_tx_start = 32; -#ifdef GWETHER - outb(eth_asic_base + NE_RESET, 0); - DELAY(200); -#endif - c = inb(eth_asic_base + NE_RESET); - outb(eth_asic_base + NE_RESET, c); - DELAY(5000); - inb(0x84); - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_STP | - D8390_COMMAND_RD2); - outb(eth_nic_base + D8390_P0_RCR, D8390_RCR_MON); - outb(eth_nic_base + D8390_P0_DCR, D8390_DCR_FT1 | D8390_DCR_LS); - outb(eth_nic_base + D8390_P0_PSTART, MEM_8192); - outb(eth_nic_base + D8390_P0_PSTOP, MEM_16384); - eth_pio_write(test, 8192, sizeof(test)); - eth_pio_read(8192, testbuf, sizeof(test)); - if (!bcompare(test, testbuf, sizeof(test))) { - eth_flags |= FLAG_16BIT; - eth_memsize = MEM_32768; - eth_tx_start = 64; - outb(eth_nic_base + D8390_P0_DCR, D8390_DCR_WTS | - D8390_DCR_FT1 | D8390_DCR_LS); - outb(eth_nic_base + D8390_P0_PSTART, MEM_16384); - outb(eth_nic_base + D8390_P0_PSTOP, MEM_32768); - eth_pio_write(test, 16384, sizeof(test)); - eth_pio_read(16384, testbuf, sizeof(test)); - if (!bcompare(testbuf, test, sizeof(test))) - if (*++tent_base) - goto ne_again; - else - return (0); - } - eth_pio_read(0, romdata, 16); - printf("\nNE1000/NE2000 (%d bit) base 0x%x, addr ", - eth_flags & FLAG_16BIT ? 16:8, eth_nic_base); - for (i=0; i<6; i++) { - printf("%b",(int)(arptable[ARP_CLIENT].node[i] = romdata[i - + ((eth_flags & FLAG_16BIT) ? i : 0)])); - if (i < 5) printf (":"); - } - goto found_board; - } -#endif -found_board: - printf("\r\n"); - if (eth_vendor == VENDOR_NONE) return(0); - - if (eth_vendor != VENDOR_3COM) eth_rmem = eth_bmem; - eth_node_addr = arptable[ARP_CLIENT].node; - eth_reset(); - return(eth_vendor); -} - -/************************************************************************** -ETH_RESET - Reset adapter -**************************************************************************/ -eth_reset() -{ - int i; - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, - D8390_COMMAND_PS0 | D8390_COMMAND_STP); - else - outb(eth_nic_base+D8390_P0_COMMAND, - D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | - D8390_COMMAND_STP); - if (eth_flags & FLAG_16BIT) - outb(eth_nic_base+D8390_P0_DCR, 0x49); - else - outb(eth_nic_base+D8390_P0_DCR, 0x48); - outb(eth_nic_base+D8390_P0_RBCR0, 0); - outb(eth_nic_base+D8390_P0_RBCR1, 0); - outb(eth_nic_base+D8390_P0_RCR, 4); /* allow broadcast frames */ - outb(eth_nic_base+D8390_P0_TCR, 2); - outb(eth_nic_base+D8390_P0_TPSR, eth_tx_start); - outb(eth_nic_base+D8390_P0_PSTART, eth_tx_start + D8390_TXBUF_SIZE); - if (eth_flags & FLAG_790) outb(eth_nic_base + 0x09, 0); - outb(eth_nic_base+D8390_P0_PSTOP, eth_memsize); - outb(eth_nic_base+D8390_P0_BOUND, eth_tx_start + D8390_TXBUF_SIZE); - outb(eth_nic_base+D8390_P0_ISR, 0xFF); - outb(eth_nic_base+D8390_P0_IMR, 0); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1 | - D8390_COMMAND_STP); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1 | - D8390_COMMAND_RD2 | D8390_COMMAND_STP); - for (i=0; i<6; i++) - outb(eth_nic_base+D8390_P1_PAR0+i, eth_node_addr[i]); - for (i=0; i<6; i++) - outb(eth_nic_base+D8390_P1_MAR0+i, 0xFF); - outb(eth_nic_base+D8390_P1_CURR, eth_tx_start + D8390_TXBUF_SIZE+1); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_STA); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_RD2 | D8390_COMMAND_STA); - outb(eth_nic_base+D8390_P0_ISR, 0xFF); - outb(eth_nic_base+D8390_P0_TCR, 0); -#ifdef INCLUDE_3COM - if (eth_vendor == VENDOR_3COM) { - /* - * No way to tell whether or not we're supposed to use - * the 3Com's transceiver unless the user tells us. - * 'aui' should have some compile time default value - * which can be changed from the command menu. - */ - if (aui) - outb(eth_asic_base + _3COM_CR, 0); - else - outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL); - } -#endif - return(1); -} - -/************************************************************************** -ETH_TRANSMIT - Transmit a frame -**************************************************************************/ -eth_transmit(d,t,s,p) - char *d; /* Destination */ - unsigned short t; /* Type */ - unsigned short s; /* size */ - char *p; /* Packet */ -{ - unsigned char c; -#ifdef INCLUDE_3COM - if (eth_vendor == VENDOR_3COM) { - bcopy(d, eth_bmem, 6); /* dst */ - bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_LEN); /* src */ - *(eth_bmem+12) = t>>8; /* type */ - *(eth_bmem+13) = t; - bcopy(p, eth_bmem+14, s); - s += 14; - while (s < ETHER_MIN_LEN) *(eth_bmem+(s++)) = 0; - } -#endif -#ifdef INCLUDE_WD - if (eth_vendor == VENDOR_WD) { /* Memory interface */ - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar | WD_LAAR_M16EN); - inb(0x84); - } - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, WD_MSR_MENB); - inb(0x84); - } - inb(0x84); - bcopy(d, eth_bmem, 6); /* dst */ - bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_LEN); /* src */ - *(eth_bmem+12) = t>>8; /* type */ - *(eth_bmem+13) = t; - bcopy(p, eth_bmem+14, s); - s += 14; - while (s < ETHER_MIN_LEN) *(eth_bmem+(s++)) = 0; - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, 0); - inb(0x84); - } - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar & ~WD_LAAR_M16EN); - inb(0x84); - } - } -#endif -#ifdef INCLUDE_NE - if (eth_vendor == VENDOR_NOVELL) { /* Programmed I/O */ - unsigned short type; - type = (t >> 8) | (t << 8); - eth_pio_write(d, eth_tx_start<<8, 6); - eth_pio_write(eth_node_addr, (eth_tx_start<<8)+6, 6); - eth_pio_write(&type, (eth_tx_start<<8)+12, 2); - eth_pio_write(p, (eth_tx_start<<8)+14, s); - s += 14; - if (s < ETHER_MIN_LEN) s = ETHER_MIN_LEN; - } -#endif - twiddle(); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_STA); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_RD2 | D8390_COMMAND_STA); - outb(eth_nic_base+D8390_P0_TPSR, eth_tx_start); - outb(eth_nic_base+D8390_P0_TBCR0, s); - outb(eth_nic_base+D8390_P0_TBCR1, s>>8); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_TXP | D8390_COMMAND_STA); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_TXP | D8390_COMMAND_RD2 | - D8390_COMMAND_STA); - return(0); -} - -/************************************************************************** -ETH_POLL - Wait for a frame -**************************************************************************/ -eth_poll() -{ - int ret = 0; - unsigned short type = 0; - unsigned char bound,curr,rstat; - unsigned short len, copylen; - unsigned short pktoff; - unsigned char *p; - struct ringbuffer pkthdr; - rstat = inb(eth_nic_base+D8390_P0_RSR); - if (rstat & D8390_RSTAT_OVER) { - eth_reset(); - return(0); - } - if (!(rstat & D8390_RSTAT_PRX)) return(0); - bound = inb(eth_nic_base+D8390_P0_BOUND)+1; - if (bound == eth_memsize) bound = eth_tx_start + D8390_TXBUF_SIZE; - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1); - curr = inb(eth_nic_base+D8390_P1_CURR); - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0); - if (curr == eth_memsize) curr=eth_tx_start + D8390_TXBUF_SIZE; - if (curr == bound) return(0); - if (eth_vendor == VENDOR_WD) { - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar | WD_LAAR_M16EN); - inb(0x84); - } - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, WD_MSR_MENB); - inb(0x84); - } - inb(0x84); - } - pktoff = (bound << 8); - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, &pkthdr, 4); - else - bcopy(eth_rmem + pktoff, &pkthdr, 4); - len = pkthdr.len - 4; /* sub CRC */ - pktoff += 4; - if (len > 1514) len = 1514; - bound = pkthdr.bound; /* New bound ptr */ - if ( (pkthdr.status & D8390_RSTAT_PRX) && (len > 14) && (len < 1518)) { - p = packet; - packetlen = copylen = len; - len = (eth_memsize << 8) - pktoff; - if (packetlen > len) { /* We have a wrap-around */ - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, p, len); - else - bcopy(eth_rmem + pktoff, p, len); - pktoff = (eth_tx_start + D8390_TXBUF_SIZE) << 8; - p += len; - copylen -= len; - } - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, p, copylen); - else - bcopy(eth_rmem + pktoff, p, copylen); - - type = (packet[12]<<8) | packet[13]; - ret = 1; - } - if (eth_vendor == VENDOR_WD) { - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, 0); - inb(0x84); - } - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar & - ~WD_LAAR_M16EN); - inb(0x84); - } - inb(0x84); - } - if (bound == (eth_tx_start + D8390_TXBUF_SIZE)) - bound = eth_memsize; - outb(eth_nic_base+D8390_P0_BOUND, bound-1); - if (ret && (type == ARP)) { - struct arprequest *arpreq; - unsigned long reqip; - arpreq = (struct arprequest *)&packet[ETHER_HDR_LEN]; - convert_ipaddr(&reqip, arpreq->tipaddr); - if ((ntohs(arpreq->opcode) == ARP_REQUEST) && - (reqip == arptable[ARP_CLIENT].ipaddr)) { - arpreq->opcode = htons(ARP_REPLY); - bcopy(arpreq->sipaddr, arpreq->tipaddr, 4); - bcopy(arpreq->shwaddr, arpreq->thwaddr, 6); - bcopy(arptable[ARP_CLIENT].node, arpreq->shwaddr, 6); - convert_ipaddr(arpreq->sipaddr, &reqip); - eth_transmit(arpreq->thwaddr, ARP, sizeof(struct arprequest), - arpreq); - return(0); - } - } - return(ret); -} - -#ifdef INCLUDE_NE -/************************************************************************** -ETH_PIO_READ - Read a frame via Programmed I/O -**************************************************************************/ -eth_pio_read(src, dst, cnt) - unsigned short src; - unsigned char *dst; - unsigned short cnt; -{ - if (cnt & 1) cnt++; - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD2 | - D8390_COMMAND_STA); - outb(eth_nic_base + D8390_P0_RBCR0, cnt); - outb(eth_nic_base + D8390_P0_RBCR1, cnt>>8); - outb(eth_nic_base + D8390_P0_RSAR0, src); - outb(eth_nic_base + D8390_P0_RSAR1, src>>8); - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD0 | - D8390_COMMAND_STA); - if (eth_flags & FLAG_16BIT) { - while (cnt) { - *((unsigned short *)dst) = inw(eth_asic_base + NE_DATA); - dst += 2; - cnt -= 2; - } - } - else { - while (cnt--) - *(dst++) = inb(eth_asic_base + NE_DATA); - } -} - -/************************************************************************** -ETH_PIO_WRITE - Write a frame via Programmed I/O -**************************************************************************/ -eth_pio_write(src, dst, cnt) - unsigned char *src; - unsigned short dst; - unsigned short cnt; -{ - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD2 | - D8390_COMMAND_STA); - outb(eth_nic_base + D8390_P0_ISR, D8390_ISR_RDC); - outb(eth_nic_base + D8390_P0_RBCR0, cnt); - outb(eth_nic_base + D8390_P0_RBCR1, cnt>>8); - outb(eth_nic_base + D8390_P0_RSAR0, dst); - outb(eth_nic_base + D8390_P0_RSAR1, dst>>8); - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD1 | - D8390_COMMAND_STA); - if (eth_flags & FLAG_16BIT) { - if (cnt & 1) cnt++; /* Round up */ - while (cnt) { - outw(eth_asic_base + NE_DATA, *((unsigned short *)src)); - src += 2; - cnt -= 2; - } - } - else { - while (cnt--) - outb(eth_asic_base + NE_DATA, *(src++)); - } - cnt = 200; - while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) - != D8390_ISR_RDC && --cnt); -} -#else -/************************************************************************** -ETH_PIO_READ - Dummy routine when NE2000 not compiled in -**************************************************************************/ -eth_pio_read() {} -#endif diff --git a/sys/i386/boot/netboot/ns8390.h b/sys/i386/boot/netboot/ns8390.h deleted file mode 100644 index 094cbae..0000000 --- a/sys/i386/boot/netboot/ns8390.h +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Jun/94 - -**************************************************************************/ - -#define MEM_8192 32 -#define MEM_16384 64 -#define MEM_32768 128 - -/************************************************************************** -Western Digital/SMC Board Definitions -**************************************************************************/ -#define WD_LOW_BASE 0x200 -#define WD_HIGH_BASE 0x3e0 -#ifndef WD_DEFAULT_MEM -#define WD_DEFAULT_MEM 0xD0000 -#endif -#define WD_NIC_ADDR 0x10 - -/************************************************************************** -Western Digital/SMC ASIC Addresses -**************************************************************************/ -#define WD_MSR 0x00 -#define WD_ICR 0x01 -#define WD_IAR 0x02 -#define WD_BIO 0x03 -#define WD_IRR 0x04 -#define WD_LAAR 0x05 -#define WD_IJR 0x06 -#define WD_GP2 0x07 -#define WD_LAR 0x08 -#define WD_BID 0x0E - -#define WD_ICR_16BIT 0x01 - -#define WD_MSR_MENB 0x40 - -#define WD_LAAR_L16EN 0x40 -#define WD_LAAR_M16EN 0x80 - -#define WD_SOFTCONFIG 0x20 - -/************************************************************************** -Western Digital/SMC Board Types -**************************************************************************/ -#define TYPE_WD8003S 0x02 -#define TYPE_WD8003E 0x03 -#define TYPE_WD8013EBT 0x05 -#define TYPE_WD8003W 0x24 -#define TYPE_WD8003EB 0x25 -#define TYPE_WD8013W 0x26 -#define TYPE_WD8013EP 0x27 -#define TYPE_WD8013WC 0x28 -#define TYPE_WD8013EPC 0x29 -#define TYPE_SMC8216T 0x2a -#define TYPE_SMC8216C 0x2b -#define TYPE_SMC8416T 0x00 /* Bogus entries: the 8416 generates the */ -#define TYPE_SMC8416C 0x00 /* the same codes as the 8216. */ -#define TYPE_SMC8013EBP 0x2c - -#ifdef INCLUDE_WD -struct wd_board { - char *name; - char id; - char flags; - char memsize; -} wd_boards[] = { - {"WD8003S", TYPE_WD8003S, 0, MEM_8192}, - {"WD8003E", TYPE_WD8003E, 0, MEM_8192}, - {"WD8013EBT", TYPE_WD8013EBT, FLAG_16BIT, MEM_16384}, - {"WD8003W", TYPE_WD8003W, 0, MEM_8192}, - {"WD8003EB", TYPE_WD8003EB, 0, MEM_8192}, - {"WD8013W", TYPE_WD8013W, FLAG_16BIT, MEM_16384}, - {"WD8003EP/WD8013EP", - TYPE_WD8013EP, 0, MEM_8192}, - {"WD8013WC", TYPE_WD8013WC, FLAG_16BIT, MEM_16384}, - {"WD8013EPC", TYPE_WD8013EPC, FLAG_16BIT, MEM_16384}, - {"SMC8216T", TYPE_SMC8216T, FLAG_16BIT | FLAG_790, MEM_16384}, - {"SMC8216C", TYPE_SMC8216C, FLAG_16BIT | FLAG_790, MEM_16384}, - {"SMC8416T", TYPE_SMC8416T, FLAG_16BIT | FLAG_790, MEM_8192}, - {"SMC8416C/BT", TYPE_SMC8416C, FLAG_16BIT | FLAG_790, MEM_8192}, - {"SMC8013EBP", TYPE_SMC8013EBP,FLAG_16BIT, MEM_16384}, - {NULL, 0, 0} -}; -#endif -/************************************************************************** -3com 3c503 definitions -**************************************************************************/ - -#ifndef _3COM_BASE -#define _3COM_BASE 0x300 -#endif - -#define _3COM_TX_PAGE_OFFSET_8BIT 0x20 -#define _3COM_TX_PAGE_OFFSET_16BIT 0x0 -#define _3COM_RX_PAGE_OFFSET_16BIT 0x20 - -#define _3COM_ASIC_OFFSET 0x400 -#define _3COM_NIC_OFFSET 0x0 - -#define _3COM_PSTR 0 -#define _3COM_PSPR 1 - -#define _3COM_BCFR 3 -#define _3COM_BCFR_2E0 0x01 -#define _3COM_BCFR_2A0 0x02 -#define _3COM_BCFR_280 0x04 -#define _3COM_BCFR_250 0x08 -#define _3COM_BCFR_350 0x10 -#define _3COM_BCFR_330 0x20 -#define _3COM_BCFR_310 0x40 -#define _3COM_BCFR_300 0x80 -#define _3COM_PCFR 4 -#define _3COM_PCFR_C8000 0x10 -#define _3COM_PCFR_CC000 0x20 -#define _3COM_PCFR_D8000 0x40 -#define _3COM_PCFR_DC000 0x80 -#define _3COM_CR 6 -#define _3COM_CR_RST 0x01 /* Reset GA and NIC */ -#define _3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */ -#define _3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */ -#define _3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */ -#define _3COM_CR_SHARE 0x10 /* select interrupt sharing option */ -#define _3COM_CR_DBSEL 0x20 /* Double buffer select */ -#define _3COM_CR_DDIR 0x40 /* DMA direction select */ -#define _3COM_CR_START 0x80 /* Start DMA controller */ -#define _3COM_GACFR 5 -#define _3COM_GACFR_MBS0 0x01 -#define _3COM_GACFR_MBS1 0x02 -#define _3COM_GACFR_MBS2 0x04 -#define _3COM_GACFR_RSEL 0x08 /* enable shared memory */ -#define _3COM_GACFR_TEST 0x10 /* for GA testing */ -#define _3COM_GACFR_OWS 0x20 /* select 0WS access to GA */ -#define _3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */ -#define _3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */ -#define _3COM_STREG 7 -#define _3COM_STREG_REV 0x07 /* GA revision */ -#define _3COM_STREG_DIP 0x08 /* DMA in progress */ -#define _3COM_STREG_DTC 0x10 /* DMA terminal count */ -#define _3COM_STREG_OFLW 0x20 /* Overflow */ -#define _3COM_STREG_UFLW 0x40 /* Underflow */ -#define _3COM_STREG_DPRDY 0x80 /* Data port ready */ -#define _3COM_IDCFR 8 -#define _3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */ -#define _3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */ -#define _3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */ -#define _3COM_IDCFR_UNUSED 0x08 /* not used */ -#define _3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */ -#define _3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */ -#define _3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */ -#define _3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */ -#define _3COM_IRQ2 2 -#define _3COM_IRQ3 3 -#define _3COM_IRQ4 4 -#define _3COM_IRQ5 5 -#define _3COM_DAMSB 9 -#define _3COM_DALSB 0x0a -#define _3COM_VPTR2 0x0b -#define _3COM_VPTR1 0x0c -#define _3COM_VPTR0 0x0d -#define _3COM_RFMSB 0x0e -#define _3COM_RFLSB 0x0f - -/************************************************************************** -NE1000/2000 definitions -**************************************************************************/ -#ifndef NE_BASE -#define NE_BASE 0x320 -#endif -#define NE_ASIC_OFFSET 0x10 -#define NE_RESET 0x0F /* Used to reset card */ -#define NE_DATA 0x00 /* Used to read/write NIC mem */ - -/************************************************************************** -8390 Register Definitions -**************************************************************************/ -#define D8390_P0_COMMAND 0x00 -#define D8390_P0_PSTART 0x01 -#define D8390_P0_PSTOP 0x02 -#define D8390_P0_BOUND 0x03 -#define D8390_P0_TSR 0x04 -#define D8390_P0_TPSR 0x04 -#define D8390_P0_TBCR0 0x05 -#define D8390_P0_TBCR1 0x06 -#define D8390_P0_ISR 0x07 -#define D8390_P0_RSAR0 0x08 -#define D8390_P0_RSAR1 0x09 -#define D8390_P0_RBCR0 0x0A -#define D8390_P0_RBCR1 0x0B -#define D8390_P0_RSR 0x0C -#define D8390_P0_RCR 0x0C -#define D8390_P0_TCR 0x0D -#define D8390_P0_DCR 0x0E -#define D8390_P0_IMR 0x0F -#define D8390_P1_COMMAND 0x00 -#define D8390_P1_PAR0 0x01 -#define D8390_P1_PAR1 0x02 -#define D8390_P1_PAR2 0x03 -#define D8390_P1_PAR3 0x04 -#define D8390_P1_PAR4 0x05 -#define D8390_P1_PAR5 0x06 -#define D8390_P1_CURR 0x07 -#define D8390_P1_MAR0 0x08 - -#define D8390_COMMAND_PS0 0x0 /* Page 0 select */ -#define D8390_COMMAND_PS1 0x40 /* Page 1 select */ -#define D8390_COMMAND_PS2 0x80 /* Page 2 select */ -#define D8390_COMMAND_RD2 0x20 /* Remote DMA control */ -#define D8390_COMMAND_RD1 0x10 -#define D8390_COMMAND_RD0 0x08 -#define D8390_COMMAND_TXP 0x04 /* transmit packet */ -#define D8390_COMMAND_STA 0x02 /* start */ -#define D8390_COMMAND_STP 0x01 /* stop */ - -#define D8390_RCR_MON 0x20 /* monitor mode */ - -#define D8390_DCR_FT1 0x40 -#define D8390_DCR_LS 0x08 /* Loopback select */ -#define D8390_DCR_WTS 0x01 /* Word transfer select */ - -#define D8390_ISR_PRX 0x01 /* successful recv */ -#define D8390_ISR_PTX 0x02 /* successful xmit */ -#define D8390_ISR_RXE 0x04 /* receive error */ -#define D8390_ISR_TXE 0x08 /* transmit error */ -#define D8390_ISR_OVW 0x10 /* Overflow */ -#define D8390_ISR_CNT 0x20 /* Counter overflow */ -#define D8390_ISR_RDC 0x40 /* Remote DMA complete */ -#define D8390_ISR_RST 0x80 /* reset */ - -#define D8390_RSTAT_PRX 0x01 /* successful recv */ -#define D8390_RSTAT_CRC 0x02 /* CRC error */ -#define D8390_RSTAT_FAE 0x04 /* Frame alignment error */ -#define D8390_RSTAT_OVER 0x08 /* overflow */ - -#define D8390_TXBUF_SIZE 6 -#define D8390_RXBUF_END 32 -#define D8390_PAGE_SIZE 256 - -struct ringbuffer { - unsigned char status; - unsigned char bound; - unsigned short len; -}; diff --git a/sys/i386/boot/netboot/opt_nfs.h b/sys/i386/boot/netboot/opt_nfs.h deleted file mode 100644 index 7cec462..0000000 --- a/sys/i386/boot/netboot/opt_nfs.h +++ /dev/null @@ -1 +0,0 @@ -#define NFS 1 diff --git a/sys/i386/boot/netboot/rpc.c b/sys/i386/boot/netboot/rpc.c deleted file mode 100644 index dd3186f..0000000 --- a/sys/i386/boot/netboot/rpc.c +++ /dev/null @@ -1,190 +0,0 @@ -/*********************************************************************** - -Remote Procedure Call Support Routines - -Author: Martin Renters - Date: Oct/1994 - -***********************************************************************/ - -#include "netboot.h" - -int rpc_id; -extern char packet[]; -extern struct nfs_diskless nfsdiskless; -extern int hostnamelen; -/*************************************************************************** - -RPCLOOKUP: Lookup RPC Port numbers - -***************************************************************************/ -rpclookup(addr, prog, ver) - int addr, prog, ver; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - rpcptr = sprintf(&buf.u.data,"%L%L%L%L%L%L%L%L%L%L%L%L%L%L", - rpc_id, MSG_CALL, 2, PROG_PORTMAP, 2, PORTMAP_LOOKUP, - 0, 0, 0, 0, prog, ver, IP_UDP, 0); - while(retries--) { - udp_transmit(arptable[addr].ipaddr, RPC_SOCKET, - SUNRPC, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus == rpc->u.reply.verifier == - rpc->u.reply.astatus == 0) - return(ntohl(rpc->u.reply.data[0])); - else { - rpc_err(rpc); - return(-1); - } - } - } - return(-1); -} - -/*************************************************************************** - -NFS_MOUNT: Mount an NFS Filesystem - -***************************************************************************/ -nfs_mount(server, port, path, fh) - int server; - int port; - char *path; - char *fh; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - rpcptr = sprintf(&buf.u.data,"%L%L%L%L%L%L%L%L%L%S%L%L%L%L%L%L%L%S", - rpc_id, MSG_CALL, 2, PROG_MOUNT, 1, MOUNT_ADDENTRY, - 1, hostnamelen + 28,0,&nfsdiskless.my_hostnam,0,0,2,0,0,0,0, - path); - while(retries--) { - udp_transmit(arptable[server].ipaddr, RPC_SOCKET, - port, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus || rpc->u.reply.verifier || - rpc->u.reply.astatus || rpc->u.reply.data[0]) { - rpc_err(rpc); - return(-(ntohl(rpc->u.reply.data[0]))); - } else { - bcopy(&rpc->u.reply.data[1],fh, 32); - return(0); - } - } - } - return(-1); -} - - -/*************************************************************************** - -NFS_LOOKUP: Lookup Pathname - -***************************************************************************/ -nfs_lookup(server, port, fh, path, file_fh, sizep) - int server; - int port; - char *fh; - char *path; - char *file_fh; - int *sizep; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - rpcptr = sprintf(&buf.u.data,"%L%L%L%L%L%L%L%L%L%S%L%L%L%L%L%L%L%M%S", - rpc_id, MSG_CALL, 2, PROG_NFS, 2, NFS_LOOKUP, - 1, hostnamelen + 28,0,&nfsdiskless.my_hostnam,0,0,2,0,0,0,0, - 32, fh, path); - while(retries--) { - udp_transmit(arptable[server].ipaddr, RPC_SOCKET, - port, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus || rpc->u.reply.verifier || - rpc->u.reply.astatus || rpc->u.reply.data[0]) { - rpc_err(rpc); - return(-(ntohl(rpc->u.reply.data[0]))); - } else { - bcopy(&rpc->u.reply.data[1],file_fh, 32); - if (sizep) - *sizep = ntohl(rpc->u.reply.data[14]); - return(0); - } - } - } - return(-1); -} - -/*************************************************************************** - -NFS_READ: Read File - -***************************************************************************/ -nfs_read(server, port, fh, offset, len, buffer) - int server; - int port; - char *fh; - int offset, len; - char *buffer; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - int rlen; - rpcptr = sprintf(&buf.u.data, - "%L%L%L%L%L%L%L%L%L%S%L%L%L%L%L%L%L%M%L%L%L", - rpc_id, MSG_CALL, 2, PROG_NFS, 2, NFS_READ, - 1, hostnamelen + 28,0,&nfsdiskless.my_hostnam,0,0,2,0,0,0,0, - 32, fh, offset, len, 0); - while(retries--) { - udp_transmit(arptable[server].ipaddr, RPC_SOCKET, - port, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus || rpc->u.reply.verifier || - rpc->u.reply.astatus || rpc->u.reply.data[0]) { - rpc_err(rpc); - return(-(ntohl(rpc->u.reply.data[0]))); - } else { - rlen = ntohl(rpc->u.reply.data[18]); - if (len < rlen) rlen = len; - if (len > rlen) printf("short read\r\n"); - bcopy(&rpc->u.reply.data[19], buffer, rlen); - return(rlen); - } - } - } - return(-1); -} - -/*************************************************************************** - -RPC_ERR - Print RPC Errors - -***************************************************************************/ -rpc_err(rpc) - struct rpc_t *rpc; -{ - int err = ntohl(rpc->u.reply.data[0]); - printf("***RPC Error: (%d,%d,%d):\r\n ", - ntohl(rpc->u.reply.rstatus), - ntohl(rpc->u.reply.verifier), - ntohl(rpc->u.reply.astatus)); -} - -nfs_err(err) - int err; -{ - err = -err; - if (err == NFSERR_PERM) printf("Not owner"); - else if (err == NFSERR_NOENT) printf("No such file or directory"); - else if (err == NFSERR_ACCES) printf("Permission denied"); - else printf("Error %d",err); - printf("\r\n"); -} diff --git a/sys/i386/boot/netboot/start2.S b/sys/i386/boot/netboot/start2.S deleted file mode 100644 index f59516e..0000000 --- a/sys/i386/boot/netboot/start2.S +++ /dev/null @@ -1,447 +0,0 @@ - -#define STACKADDR 0xe000 /* Needs to be end of bss + stacksize */ -#define KERN_CODE_SEG 0x08 -#define KERN_DATA_SEG 0x10 -#define REAL_MODE_CSEG 0x18 -#define REAL_MODE_DSEG 0x20 -#define CR0_PE 1 - -#define opsize .byte 0x66 -#define addrsize .byte 0x67 - -/* At entry, the processor is in 16 bit real mode and the code is being - * executed from an address it was not linked to. Code must be pic and - * 32 bit sensitive until things are fixed up. - */ -#ifdef BOOTROM - .word 0xaa55 /* bios extension signature */ - .byte (ROMSIZE>>9) /* no. of 512B blocks */ - jmp 1f /* enter from bios here */ - .byte 0 /* checksum */ -#ifdef PCI - .ascii "FreeBSD boot ROM.." /* 18 bytes total */ - .word 0x1a -/* PCI rom data structure format */ - .ascii "PCIR" /* signature */ - .word PCI_VENDOR /* vendor ID */ - .word PCI_DEVICE /* device ID */ - .word 0 /* vital product data */ - .word 0x0018 /* PCI data structure */ - .byte 0 /* PCI data struct. rev -- 0 */ - .byte PCI_CLASS /* Class code */ - .word (ROMSIZE>>9) /* no. of 512B blocks */ - .byte 0,0 /* rev. level */ - .byte 0 /* code type - 0 =x86 */ - .byte 0x80 /* indicator of last block */ - .word 0 /* reserved */ -#endif -1: push %eax - push %ds - xor %eax,%eax - mov %ax,%ds - .byte 0xa1 /* MOV 0x304,%ax */ - .word 0x304 - .byte 0x3d /* CMP $0x4d52, %ax == 'MR' */ - .word 0x4d52 - jz 2f - .byte 0xa1 /* MOV 0x64, %ax */ - .word 0x64 - .byte 0xa3 /* MOV %ax, 0x300 */ - .word 0x300 - .byte 0xa1 /* MOV 0x66, %ax */ - .word 0x66 - .byte 0xa3 /* MOV %ax, 0x302 */ - .word 0x302 - .byte 0xb8 /* MOV $_start-RELOCADDR, %ax */ - .word (_start-RELOC) - .byte 0xa3 /* MOV %ax, 0x64 */ - .word 0x64 - mov %cs,%ax - .byte 0xa3 /* MOV %ax, 0x66 */ - .word 0x66 - .byte 0xb8 /* MOV 'MR',%ax */ - .word 0x4d52 - .byte 0xa3 /* MOV %ax, 0x304 */ - .word 0x304 -2: pop %ds - pop %eax - lret -#endif - -/************************************************************************** -START - Where all the fun begins.... -**************************************************************************/ - .globl _start -_start: - cli - cld -#ifdef BOOTROM /* relocate ourselves */ - xor %esi, %esi /* zero for ROMs */ -#else - .byte 0xbe /* MOV $0x100,%si -- 100h for .COM */ - .word 0x100 -#endif - xor %edi,%edi - .byte 0xb8 /* MOV $RELOCADDR>>4, %ax */ - .word (RELOC>>4) - mov %ax, %es - .byte 0xb9 /* MOV $ROMSIZE, %cx */ - .word ROMSIZE - cs - rep - movsb - opsize - ljmp $(RELOC>>4),$1f-RELOC /* Jmp to RELOC:1f */ -1: - nop - mov %cs,%ax - mov %ax,%ds - mov %ax,%es - mov %ax,%ss - .byte 0xb8 /* MOV $STACKADDR, %ax */ - .word STACKADDR - mov %eax,%esp - opsize - call _real_to_prot - call _main - .globl _exit -_exit: - call _prot_to_real -#ifdef BOOTROM - xor %eax,%eax - mov %ax,%ds - .byte 0xa1 /* MOV 0x302, %ax */ - .word 0x302 - push %eax - .byte 0xa1 /* MOV 0x300, %ax */ - .word 0x300 - push %eax - lret -#else - int $0x19 -#endif - -/************************************************************************** -CURRTICKS - Get Time -**************************************************************************/ - .globl _currticks -_currticks: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - xor %edx,%edx - call _prot_to_real - xor %eax,%eax - int $0x1a - opsize - call _real_to_prot - xor %eax,%eax - shl $16,%ecx - mov %edx,%eax - or %ecx,%eax - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -PUTCHAR - Print a character -**************************************************************************/ - .globl _putchar -_putchar: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - movb 8(%ebp),%cl - call _prot_to_real - opsize - mov $1,%ebx - movb $0x0e,%ah - movb %cl,%al - int $0x10 - opsize - call _real_to_prot - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -GETCHAR - Get a character -**************************************************************************/ - .globl _getchar -_getchar: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - call _prot_to_real - movb $0x0,%ah - int $0x16 - movb %al,%bl - opsize - call _real_to_prot - xor %eax,%eax - movb %bl,%al - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -ISKEY - Check for keyboard interrupt -**************************************************************************/ - .globl _iskey -_iskey: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - call _prot_to_real - xor %ebx,%ebx - movb $0x1,%ah - int $0x16 - opsize - jz 1f - movb %al,%bl -1: - opsize - call _real_to_prot - xor %eax,%eax - movb %bl,%al - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - - -/* - * C library -- _setjmp, _longjmp - * - * longjmp(a,v) - * will generate a "return(v)" from the last call to - * setjmp(a) - * by restoring registers from the stack. - * The previous signal state is restored. - */ - - .globl _setjmp -_setjmp: - movl 4(%esp),%ecx - movl 0(%esp),%edx - movl %edx, 0(%ecx) - movl %ebx, 4(%ecx) - movl %esp, 8(%ecx) - movl %ebp,12(%ecx) - movl %esi,16(%ecx) - movl %edi,20(%ecx) - movl %eax,24(%ecx) - movl $0,%eax - ret - - .globl _longjmp -_longjmp: - movl 4(%esp),%edx - movl 8(%esp),%eax - movl 0(%edx),%ecx - movl 4(%edx),%ebx - movl 8(%edx),%esp - movl 12(%edx),%ebp - movl 16(%edx),%esi - movl 20(%edx),%edi - cmpl $0,%eax - jne 1f - movl $1,%eax -1: movl %ecx,0(%esp) - ret - -/************************************************************************** -___MAIN - Dummy to keep GCC happy -**************************************************************************/ - .globl ___main -___main: - ret - -/************************************************************************** -REAL_TO_PROT - Go from REAL mode to Protected Mode -**************************************************************************/ - .globl _real_to_prot -_real_to_prot: - cli - cs - addrsize - lgdt gdtarg-RELOC - mov %cr0, %eax - opsize - or $CR0_PE, %eax - mov %eax, %cr0 /* turn on protected mode */ - - /* jump to relocation, flush prefetch queue, and reload %cs */ - opsize - ljmp $KERN_CODE_SEG, $1f -1: - /* reload other segment registers */ - movl $KERN_DATA_SEG, %eax - movl %ax, %ds - movl %ax, %es - movl %ax, %ss - add $RELOC,%esp /* Fix up stack pointer */ - pop %eax /* Fix up return Address */ - add $RELOC,%eax - push %eax - ret - - -/************************************************************************** -PROT_TO_REAL - Go from Protected Mode to REAL Mode -**************************************************************************/ - .globl _prot_to_real -_prot_to_real: - pop %eax - sub $RELOC,%eax /* Adjust return address */ - push %eax - sub $RELOC,%esp /* Adjust stack pointer */ - - /* Prepare %ax while we're still in a mode that gas understands. */ - movw $REAL_MODE_DSEG, %ax - - ljmp $REAL_MODE_CSEG, $1f-RELOC /* jump to a 16 bit segment */ -1: - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - - /* clear the PE bit of CR0 */ - mov %cr0, %eax - opsize - andl $0!CR0_PE, %eax - mov %eax, %cr0 - - /* make intersegment jmp to flush the processor pipeline - * and reload CS register - */ - opsize - ljmp $(RELOC)>>4, $2f-RELOC -2: - /* we are in real mode now - * set up the real mode segment registers : DS, SS, ES - */ - mov %cs, %ax - mov %ax, %ds - mov %ax, %es - mov %ax, %ss - sti - opsize - ret - -/************************************************************************** -GET DISK GEOMETRY INFO -**************************************************************************/ - -/* - * - * get_diskinfo(): return a word that represents the - * max number of sectors and heads and drives for this device - * - */ - - .globl _get_diskinfo -_get_diskinfo: - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - movb 0x8(%ebp), %dl /* diskinfo(drive #) */ - call _prot_to_real /* enter real mode */ - - movb $0x8, %ah /* ask for disk info */ - - sti - int $0x13 - cli - - jnc ok - /* - * Urk. Call failed. It is not supported for floppies by old BIOS's. - * Guess it's a 15-sector floppy. - */ - subb %ah, %ah /* %ax = 0 */ - movb %al, %al - movb %ah, %bh /* %bh = 0 */ - movb $2, %bl /* %bl bits 0-3 = drive type, - bit 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: - - opsize - call _real_to_prot /* back to protected mode */ - - /* - * form a longword representing all this gunk: - * 6 bit zero - * 10 bit max cylinder (0 based) - * 8 bit max head (0 based) - * 2 bit zero - * 6 bit max sector (1 based) = # sectors - */ - movb %cl, %al /* Upper two bits of cylinder count */ - andl $192,%eax - leal 0(,%eax,4),%eax /* << 2 */ - movb %ch, %al /* Lower 8 bits */ - sall $16,%eax /* << 16 */ - movb %dh, %ah /* max head */ - andb $0x3f, %cl /* mask of cylinder gunk */ - movb %cl, %al /* max sector (and # sectors) */ - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -GLOBAL DESCRIPTOR TABLE -**************************************************************************/ - .align 4 -gdt: - .word 0, 0 - .byte 0, 0x00, 0x00, 0 - - /* code segment */ - .word 0xffff, 0 - .byte 0, 0x9f, 0xcf, 0 - - /* data segment */ - .word 0xffff, 0 - .byte 0, 0x93, 0xcf, 0 - - /* 16 bit real mode code segment */ - .word 0xffff, RELOC & 0xffff - .byte (RELOC>>16), 0x9b, 0x00, (RELOC>>24) - - /* 16 bit real mode data segment */ - .word 0xffff, RELOC & 0xffff - .byte (RELOC>>16), 0x93, 0x00, (RELOC>>24) - - .align 4 -gdtarg: - .word 0x27 /* limit */ - .long gdt /* addr */ diff --git a/sys/i386/boot/rawboot/Makefile b/sys/i386/boot/rawboot/Makefile deleted file mode 100644 index 474788b..0000000 --- a/sys/i386/boot/rawboot/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# $FreeBSD$ -# - -PROG= boot - -# Order is very important on the SRCS line for this prog -SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S -SRCS+= probe_keyboard.c io.c disk.c sys.c - -.PATH: ${.CURDIR}/../biosboot - -BINMODE= 444 -CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ - -DRAWBOOT \ - -I${.CURDIR}/../biosboot \ - -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} -CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} -CFLAGS+= ${CWARNFLAGS} - -# By default, if a serial port is going to be used as console, use COM1 -# (aka /dev/ttyd0). -BOOT_COMCONSOLE_PORT?=0x3F8 -CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} - -BOOT_COMCONSOLE_SPEED?=9600 -CFLAGS+= -DCONSPEED=${BOOT_COMCONSOLE_SPEED} - -# Enable code to take the default boot string from a fixed location on the -# disk. See nextboot(8) and README.386BSD for more info. -#CFLAGS+= -DNAMEBLOCK -#CFLAGS+= -DNAMEBLOCK_WRITEBACK - -# Bias the conversion from the BIOS drive number to the FreeBSD unit number -# for hard disks. This may be useful for people booting in a mixed IDE/SCSI -# environment (set BOOT_HD_BIAS to the number of IDE drives). -#CFLAGS+= -DBOOT_HD_BIAS=1 -# -# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number -# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to -# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:sd(0,a) instead of -# 1:wd(1,a). If `sd' is given explicitly, then the drive is assumed to be -# SCSI and have BIOS drive number (sd_unit_number + BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes sd(0,a) correspond to 1:sd(0,a) instead of 0:sd(0,a). - -CLEANFILES+= boot.nohdr boot.strip rawboot sizetest -LDFLAGS+= -N -T 0 -nostdlib -NOSHARED= YES -NOMAN= -STRIP= - -# tunable timeout parameter, waiting for keypress, calibrated in ms -BOOTWAIT?= 5000 -# tunable timeout during string input, calibrated in ms -#TIMEOUT?= 30000 - -# Location that boot2 is loaded at -BOOTSEG= 0x1000 - -# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned -BOOTSTACK= 0xFFF0 - -boot.strip: boot - cp -p boot boot.strip - strip -aout boot.strip - size -aout boot.strip - -boot.nohdr: boot.strip - dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b - ls -l boot.nohdr - -rawboot: boot.nohdr - dd if=boot.nohdr of=rawboot bs=8k count=1 conv=sync - -all: rawboot - -install: - ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}\ - rawboot ${DESTDIR}${BINDIR}/rawboot - -.include <bsd.kern.mk> -.include <bsd.prog.mk> diff --git a/sys/i386/boot/rawboot/README b/sys/i386/boot/rawboot/README deleted file mode 100644 index 4cf51f0..0000000 --- a/sys/i386/boot/rawboot/README +++ /dev/null @@ -1,17 +0,0 @@ -RAWboot readme. - -This is a dumber version of the code in biosboot. - -The intended usage is: - - cat /usr/mdec/rawboot /sys/compile/FOO/kernel | fdwrite - -This makes it a lot easier to make a bootable floppy, and saves space -on the floppy to boot. - -Of course the name you enter for the kernel isn't used... Then again -if you know how to make two kernels fit a floppy and have a use for -it, you don't need this bootblock. - -Poul-Henning Kamp -phk@FreeBSD.org |