From owner-cvs-all@FreeBSD.ORG Tue Apr 27 12:41:30 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC1C516A4CE; Tue, 27 Apr 2004 12:41:29 -0700 (PDT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8F1843D58; Tue, 27 Apr 2004 12:41:17 -0700 (PDT) (envelope-from ru@ip.net.ua) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i3RJkVx8068040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Apr 2004 22:46:33 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.12.11/8.12.11) id i3RJfDAQ076348; Tue, 27 Apr 2004 22:41:13 +0300 (EEST) (envelope-from ru) Date: Tue, 27 Apr 2004 22:41:13 +0300 From: Ruslan Ermilov To: Poul-Henning Kamp Message-ID: <20040427194113.GE75827@ip.net.ua> References: <200404271907.i3RJ7ZkI028848@repoman.freebsd.org> <20040427192403.GC75827@ip.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FoLtEtfbNGMjfgrs" Content-Disposition: inline In-Reply-To: <20040427192403.GC75827@ip.net.ua> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/boot/i386/boot0 Makefile boot0.s boot0_512.s boot0sio.s X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2004 19:41:30 -0000 --FoLtEtfbNGMjfgrs Content-Type: multipart/mixed; boundary="hwvH6HDNit2nSK4j" Content-Disposition: inline --hwvH6HDNit2nSK4j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 27, 2004 at 10:24:03PM +0300, Ruslan Ermilov wrote: > On Tue, Apr 27, 2004 at 12:07:35PM -0700, Poul-Henning Kamp wrote: > > phk 2004/04/27 12:07:35 PDT > >=20 > > FreeBSD src repository > >=20 > > Modified files: > > sys/boot/i386/boot0 Makefile=20 > > Added files: > > sys/boot/i386/boot0 boot0_512.s=20 > > Removed files: > > sys/boot/i386/boot0 boot0.s boot0sio.s=20 > > Log: > > Change from '#' to "//" comment character to allow CPP preprocessing. > > =20 > This is backwards, please fix. Also, the preprocessed files > should have the .S extension, and then they don't require the > special hacks in makefiles. >=20 Attached is the patch that does this, with these changes backed out, and boot0.S quickly produced as the result of ``diff --ifdef=3DSIO''. The generated boot0 and boot0sio (the latter is only installed as boot0sio) are identical to the old ones. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --hwvH6HDNit2nSK4j Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: boot0/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/i386/boot0/Makefile,v retrieving revision 1.25 diff -u -p -r1.25 Makefile --- boot0/Makefile 25 Apr 2004 20:36:43 -0000 1.25 +++ boot0/Makefile 27 Apr 2004 19:30:54 -0000 @@ -4,7 +4,7 @@ PROG=3D ${BOOT} INTERNALPROG=3D FILES=3D ${BOOT} NOMAN=3D -SRCS=3D ${BOOT}.s +SRCS=3D ${BOOT}.S =20 BOOT?=3D boot0 =20 @@ -29,9 +29,9 @@ BOOT_BOOT0_ORG?=3D 0x600 # command line BOOT_BOOT0_COMCONSOLE_SPEED?=3D 0xE3 =20 -AFLAGS+=3D--defsym FLAGS=3D${BOOT_BOOT0_FLAGS} \ - --defsym TICKS=3D${BOOT_BOOT0_TICKS} \ - --defsym COMSPEED=3D${BOOT_BOOT0_COMCONSOLE_SPEED} +CFLAGS+=3D-DFLAGS=3D${BOOT_BOOT0_FLAGS} \ + -DTICKS=3D${BOOT_BOOT0_TICKS} \ + -DCOMSPEED=3D${BOOT_BOOT0_COMCONSOLE_SPEED} =20 LDFLAGS=3D-N -e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-S,--oformat,binary =20 Index: boot0/boot0.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: boot0/boot0.S diff -N boot0/boot0.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ boot0/boot0.S 27 Apr 2004 19:28:17 -0000 @@ -0,0 +1,529 @@ +# +#ifdef SIO +# Copyright (c) 2002 Bruce M. Simpson +#endif /* SIO */ +# Copyright (c) 1998 Robert Nordier +# All rights reserved. +# +# Redistribution and use in source and binary forms are freely +# permitted provided that the above copyright notice and this +# paragraph and the following disclaimer are duplicated in all +# such forms. +# +# This software is provided "AS IS" and without any express or +# implied warranties, including, without limitation, the implied +# warranties of merchantability and fitness for a particular +# purpose. +# + +#ifndef SIO +# $FreeBSD: src/sys/boot/i386/boot0/boot0.s,v 1.30 2004/04/20 03:15:59 obr= ien Exp $ +#else /* SIO */ +# $FreeBSD: src/sys/boot/i386/boot0/boot0sio.s,v 1.4 2004/04/20 03:15:59 o= brien Exp $ +#endif /* SIO */ + +#ifndef SIO +# A 512-byte boot manager. +#else /* SIO */ +# A 512-byte boot manager which uses a serial console on COM1. +#endif /* SIO */ + + .set NHRDRV,0x475 # Number of hard drives + .set ORIGIN,0x600 # Execution address + .set FAKE,0x800 # Partition entry + .set LOAD,0x7c00 # Load address + + .set PRT_OFF,0x1be # Partition table + + .set TBL0SZ,0x3 # Table 0 size + .set TBL1SZ,0xb # Table 1 size + + .set MAGIC,0xaa55 # Magic: bootable + .set B0MAGIC,0xbb66 # Identification + + .set KEY_ENTER,0x1c # Enter key scan code + .set KEY_F1,0x3b # F1 key scan code + .set KEY_1,0x02 # #1 key scan code + +#ifdef SIO + .set ASCII_BEL,0x07 # ASCII code for + .set ASCII_CR,0x0D # ASCII code for + .set ASCII_1,0x31 # ASCII code for '1' + +#endif /* SIO */ +# +# Addresses in the sector of embedded data values. +# Accessed with negative offsets from the end of the relocated sector (%eb= p). +# + .set _NXTDRV,-0x48 # Next drive + .set _OPT,-0x47 # Default option + .set _SETDRV,-0x46 # Drive to force + .set _FLAGS,-0x45 # Flags + .set _TICKS,-0x44 # Timeout ticks + .set _FAKE,0x0 # Fake partition entry + .set _MNUOPT,0xc # Menu options + + .globl start # Entry point + .code16 # This runs in real mode + +# +# Initialise segments and registers to known values. +# segments start at 0. +# The stack is immediately below the address we were loaded to. +# +start: cld # String ops inc + xorw %ax,%ax # Zero + movw %ax,%es # Address + movw %ax,%ds # data + movw %ax,%ss # Set up + movw $LOAD,%sp # stack + +# +# Copy this code to the address it was linked for +# + movw %sp,%si # Source + movw $start,%di # Destination + movw $0x100,%cx # Word count + rep # Relocate + movsw # code +# +# Set address for variable space beyond code, and clear it. +# Notice that this is also used to point to the values embedded in the blo= ck, +# by using negative offsets. +# + movw %di,%bp # Address variables + movb $0x8,%cl # Words to clear + rep # Zero + stosw # them +# +# Relocate to the new copy of the code. +# + incb -0xe(%di) # Sector number + jmp main-LOAD+ORIGIN # To relocated code +#ifdef SIO + +# +# Initialize the serial port. +# Must save DX (contains drive number) +# +main: pushw %dx # Save + xorw %dx,%dx # Port: COM1 + movb COMSPEED,%al # defined by Makefile + movb $0x00,%ah # BIOS: Set COM Port + int $0x14 # Parameters + popw %dx # Restore +#endif /* SIO */ +# +# Check what flags were loaded with us, specifically, Use a predefined Dri= ve. +# If what the bios gives us is bad, use the '0' in the block instead, as w= ell. +# +#ifndef SIO +main: testb $0x20,_FLAGS(%bp) # Set number drive? +#else /* SIO */ + testb $0x20,_FLAGS(%bp) # Set number drive? +#endif /* SIO */ + jnz main.1 # Yes + testb %dl,%dl # Drive number valid? + js main.2 # Possibly (0x80 set) +main.1: movb _SETDRV(%bp),%dl # Drive number to use +# +# Whatever we decided to use, now store it into the fake +# partition entry that lives in the data space above us. +# +main.2: movb %dl,_FAKE(%bp) # Save drive number + callw putn # To new line + pushw %dx # Save drive number +# +# Start out with a pointer to the 4th byte of the first table entry +# so that after 4 iterations it's beyond the end of the sector. +# and beyond a 256 byte boundary and has overflowed 8 bits (see next comme= nt). +# (remember that the table starts 2 bytes earlier than you would expect +# as the bootable flag is after it in the block) +# + movw $(partbl+0x4),%bx # Partition table (+4) + xorw %dx,%dx # Item number +# +# Loop around on the partition table, printing values until we +# pass a 256 byte boundary. The end of loop test is at main.5. +# +main.3: movb %ch,-0x4(%bx) # Zero active flag (ch =3D=3D 0) + btw %dx,_FLAGS(%bp) # Entry enabled? + jnc main.5 # No +# +# If any of the entries in the table are +# the same as the 'type' in the slice table entry, +# then this is an empty or non bootable partition. Skip it. +# + movb (%bx),%al # Load type + movw $tables,%di # Lookup tables + movb $TBL0SZ,%cl # Number of entries + repne # Exclude + scasb # partition? + je main.5 # Yes +# +# Now scan the table of known types +# + movb $TBL1SZ,%cl # Number of entries + repne # Known + scasb # type? + jne main.4 # No +# +# If it matches get the matching element in the +# next array. if it doesn't, we are already +# pointing at its first element which points to a "?". +# + addw $TBL1SZ,%di # Adjust +main.4: movb (%di),%cl # Partition + addw %cx,%di # description + callw putx # Display it +main.5: incw %dx # Next item + addb $0x10,%bl # Next entry + jnc main.3 # Till done +# +# Passed a 256 byte boundary.. +# table is finished. +# Add one to the drive number and check it is valid, +# + popw %ax # Drive number + subb $0x80-0x1,%al # Does next + cmpb NHRDRV,%al # drive exist? (from BIOS?) + jb main.6 # Yes +# If not then if there is only one drive, +# Don't display drive as an option. +# + decw %ax # Already drive 0? + jz main.7 # Yes +# If it was illegal or we cycled through them, +# then go back to drive 0. +# + xorb %al,%al # Drive 0 +# +# Whatever drive we selected, make it an ascii digit and save it back +# to the "next drive" location in the loaded block in case we +# want to save it for next time. +# This also is part of the printed drive string so add 0x80 to indicate +# end of string. +# +main.6: addb $'0'|0x80,%al # Save next + movb %al,_NXTDRV(%bp) # drive number + movw $drive,%di # Display + callw putx # item +# +# Now that we've printed the drive (if we needed to), display a prompt. +#ifndef SIO +# Get ready for the input by noting the time. +#else /* SIO */ +# Get ready for the input byte noting the time. +#endif /* SIO */ +# +main.7: movw $prompt,%si # Display + callw putstr # prompt + movb _OPT(%bp),%dl # Display + decw %si # default + callw putkey # key +#ifdef SIO +main.7_1: +#endif /* SIO */ + xorb %ah,%ah # BIOS: Get + int $0x1a # system time +#ifndef SIO + movw %dx,%di # Ticks when + addw _TICKS(%bp),%di # timeout +#else /* SIO */ + movw %dx,%si # Ticks when + addw _TICKS(%bp),%si # timeout + +#endif /* SIO */ +# +#ifndef SIO +# Busy loop, looking for keystrokes but +#else /* SIO */ +# Busy loop, checking for a character on the serial port, but +#endif /* SIO */ +# keeping one eye on the time. +# +#ifndef SIO +main.8: movb $0x1,%ah # BIOS: Check + int $0x16 # for keypress + jnz main.11 # Have one +#else /* SIO */ + +main.8: xorw %dx,%dx # Use COM1 + movb $0x03,%ah # BIOS: Read COM + int $0x14 # Status + testb $0x01,%ah # Check line status + jnz main.11 # (bit 1 indicates input) + +#endif /* SIO */ + xorb %ah,%ah # BIOS: Get + int $0x1a # system time +#ifndef SIO + cmpw %di,%dx # Timeout? +#else /* SIO */ + cmpw %si,%dx # Timeout? +#endif /* SIO */ + jb main.8 # No +#ifdef SIO + +#endif /* SIO */ +# +# If timed out or defaulting, come here. +# +main.9: movb _OPT(%bp),%al # Load default + jmp main.12 # Join common code +# +# User's last try was bad, beep in displeasure. +# Since nothing was printed, just continue on as if the user +# hadn't done anything. This gives the effect of the user getting a beep +# for all bad keystrokes but no action until either the timeout +# occurs or the user hits a good key. +# +#ifndef SIO +main.10: movb $0x7,%al # Signal +#else /* SIO */ +main.10: movb $ASCII_BEL,%al # Signal +#endif /* SIO */ + callw putchr # error +#ifdef SIO + jmp main.7_1 # Go back +#endif /* SIO */ +# +#ifndef SIO +# Get the keystroke. +#else /* SIO */ +# Check the character we just got on the serial port. +#endif /* SIO */ +# +#ifndef SIO +main.11: xorb %ah,%ah # BIOS: Get + int $0x16 # keypress + movb %ah,%al # Scan code +#else /* SIO */ +main.11: movb $0x02,%ah # BIOS: Receive + int $0x14 # COM Byte +#endif /* SIO */ +# +# If it's CR act as if timed out. +# +#ifndef SIO + cmpb $KEY_ENTER,%al # Enter pressed? +#else /* SIO */ + cmpb $ASCII_CR,%al # Enter pressed? +#endif /* SIO */ + je main.9 # Yes +# +# Otherwise check if legal +# If not ask again. +# +#ifndef SIO + subb $KEY_F1,%al # Less F1 scan code + cmpb $0x4,%al # F1..F5? + jna main.12 # Yes + subb $(KEY_1 - KEY_F1),%al # Less #1 scan code +#else /* SIO */ + subb $ASCII_1,%al # Less '1' ascii character +#endif /* SIO */ + cmpb $0x4,%al # #1..#5? + ja main.10 # No +# +# We have a selection. +# but if it's a bad selection go back to complain. +# The bits in MNUOPT were set when the options were printed. +# Anything not printed is not an option. +# +main.12: cbtw # Option + btw %ax,_MNUOPT(%bp) # enabled? + jnc main.10 # No +# +# Save the info in the original tables +# for rewriting to the disk. +# + movb %al,_OPT(%bp) # Save option + movw $FAKE,%si # Partition for write + movb (%si),%dl # Drive number + movw %si,%bx # Partition for read + cmpb $0x4,%al # F5/#5 pressed? + pushf # Save + je main.13 # Yes + shlb $0x4,%al # Point to + addw $partbl,%ax # selected + xchgw %bx,%ax # partition + movb $0x80,(%bx) # Flag active +# +# If not asked to do a write-back (flags 0x40) don't do one. +# +main.13: pushw %bx # Save + testb $0x40,_FLAGS(%bp) # No updates? + jnz main.14 # Yes + movw $start,%bx # Data to write + movb $0x3,%ah # Write sector + callw intx13 # to disk +main.14: popw %si # Restore + popf # Restore +# +# If going to next drive, replace drive with selected one. +# Remember to un-ascii it. Hey 0x80 is already set, cool! +# + jne main.15 # If not F5/#5 + movb _NXTDRV(%bp),%dl # Next drive + subb $'0',%dl # number +# +# load selected bootsector to the LOAD location in RAM. +# If it fails to read or isn't marked bootable, treat it +# as a bad selection. +# XXX what does %si carry? +# +main.15: movw $LOAD,%bx # Address for read + movb $0x2,%ah # Read sector + callw intx13 # from disk + jc main.10 # If error + cmpw $MAGIC,0x1fe(%bx) # Bootable? + jne main.10 # No + pushw %si # Save + movw $crlf,%si # Leave some + callw puts # space + popw %si # Restore + jmp *%bx # Invoke bootstrap +# +# Display routines +# + +#ifndef SIO +putkey: movb $'F',%al # Display + callw putchr # 'F' + movb $'1',%al # Prepare +#else /* SIO */ +putkey: movb $ASCII_1,%al # Prepare +#endif /* SIO */ + addb %dl,%al # digit + jmp putstr.1 # Display the rest + +# +# Display the option and note that it is a valid option. +# That last point is a bit tricky.. +# +putx: btsw %dx,_MNUOPT(%bp) # Enable menu option + movw $item,%si # Display + callw putkey # key + movw %di,%si # Display the rest + +puts: callw putstr # Display string + +putn: movw $crlf,%si # To next line + +putstr: lodsb # Get byte + testb $0x80,%al # End of string? + jnz putstr.2 # Yes +putstr.1: callw putchr # Display char + jmp putstr # Continue +putstr.2: andb $~0x80,%al # Clear MSB + +#ifndef SIO +putchr: pushw %bx # Save + movw $0x7,%bx # Page:attribute + movb $0xe,%ah # BIOS: Display + int $0x10 # character + popw %bx # Restore +#else /* SIO */ +putchr: pushw %dx # Save + xorw %dx,%dx # Use COM1 + xorw %cx,%cx # No timeout + movb $0x01,%ah # BIOS: Send + int $0x14 # Character + popw %dx # Restore +#endif /* SIO */ + retw # To caller + +# One-sector disk I/O routine + +intx13: movb 0x1(%si),%dh # Load head + movw 0x2(%si),%cx # Load cylinder:sector + movb $0x1,%al # Sector count + pushw %si # Save + movw %sp,%di # Save + testb $0x80,_FLAGS(%bp) # Use packet interface? + jz intx13.1 # No + pushl $0x0 # Set the + pushl 0x8(%si) # LBA address + pushw %es # Set the transfer + pushw %bx # buffer address + push $0x1 # Block count + push $0x10 # Packet size + movw %sp,%si # Packet pointer + decw %ax # Verify off + orb $0x40,%ah # Use disk packet +intx13.1: int $0x13 # BIOS: Disk I/O + movw %di,%sp # Restore + popw %si # Restore + retw # To caller + +# Menu strings + +#ifndef SIO +item: .ascii " "; .byte ' '|0x80 +prompt: .ascii "\nDefault:"; .byte ' '|0x80 +#else /* SIO */ +item: .ascii " "; .byte ' '|0x80 +prompt: .ascii "\nDef:"; .byte ' '|0x80 +#endif /* SIO */ +crlf: .ascii "\r"; .byte '\n'|0x80 + +# Partition type tables + +tables: +# +# These entries identify invalid or NON BOOT types and partitions. +# + .byte 0x0, 0x5, 0xf +# +# These values indicate bootable types we know the names of +# + .byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83 + .byte 0x9f, 0xa5, 0xa6, 0xa9 +# +# These are offsets that match the known names above and point to the stri= ngs +# that will be printed. +# + .byte os_misc-. # Unknown + .byte os_dos-. # DOS + .byte os_dos-. # DOS + .byte os_dos-. # DOS + .byte os_dos-. # Windows + .byte os_dos-. # Windows + .byte os_dos-. # Windows + .byte os_linux-. # Linux + .byte os_bsd-. # BSD/OS + .byte os_freebsd-. # FreeBSD + .byte os_bsd-. # OpenBSD + .byte os_bsd-. # NetBSD +# +# And here are the strings themselves. 0x80 or'd into a byte indicates +# the end of the string. (not so great for Russians but...) +# +os_misc: .ascii "?"; .byte '?'|0x80 +os_dos: .ascii "DO"; .byte 'S'|0x80 +os_linux: .ascii "Linu"; .byte 'x'|0x80 +os_freebsd: .ascii "Free" +os_bsd: .ascii "BS"; .byte 'D'|0x80 + + .org PRT_OFF-0xe,0x90 + + .word B0MAGIC # Magic number + +# +# These values are sometimes changed before writing back to the drive +# Be especially careful that nxtdrv: must come after drive:, as it +# is part of the same string. +# +drive: .ascii "Drive " +nxtdrv: .byte 0x0 # Next drive number +opt: .byte 0x0 # Option +setdrv: .byte 0x80 # Drive to force +flags: .byte FLAGS # Flags +ticks: .word TICKS # Delay + +# +# here is the 64 byte partition table that fdisk would fiddle with. +# +partbl: .fill 0x40,0x1,0x0 # Partition table + .word MAGIC # Magic number Index: boot0/boot0.s =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: boot0/boot0.s diff -N boot0/boot0.s --- boot0/boot0.s 20 Apr 2004 03:15:59 -0000 1.30 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,419 +0,0 @@ -# -# Copyright (c) 1998 Robert Nordier -# All rights reserved. -# -# Redistribution and use in source and binary forms are freely -# permitted provided that the above copyright notice and this -# paragraph and the following disclaimer are duplicated in all -# such forms. -# -# This software is provided "AS IS" and without any express or -# implied warranties, including, without limitation, the implied -# warranties of merchantability and fitness for a particular -# purpose. -# - -# $FreeBSD: src/sys/boot/i386/boot0/boot0.s,v 1.30 2004/04/20 03:15:59 obr= ien Exp $ - -# A 512-byte boot manager. - - .set NHRDRV,0x475 # Number of hard drives - .set ORIGIN,0x600 # Execution address - .set FAKE,0x800 # Partition entry - .set LOAD,0x7c00 # Load address - - .set PRT_OFF,0x1be # Partition table - - .set TBL0SZ,0x3 # Table 0 size - .set TBL1SZ,0xb # Table 1 size - - .set MAGIC,0xaa55 # Magic: bootable - .set B0MAGIC,0xbb66 # Identification - - .set KEY_ENTER,0x1c # Enter key scan code - .set KEY_F1,0x3b # F1 key scan code - .set KEY_1,0x02 # #1 key scan code - -# -# Addresses in the sector of embedded data values. -# Accessed with negative offsets from the end of the relocated sector (%eb= p). -# - .set _NXTDRV,-0x48 # Next drive - .set _OPT,-0x47 # Default option - .set _SETDRV,-0x46 # Drive to force - .set _FLAGS,-0x45 # Flags - .set _TICKS,-0x44 # Timeout ticks - .set _FAKE,0x0 # Fake partition entry - .set _MNUOPT,0xc # Menu options - - .globl start # Entry point - .code16 # This runs in real mode - -# -# Initialise segments and registers to known values. -# segments start at 0. -# The stack is immediately below the address we were loaded to. -# -start: cld # String ops inc - xorw %ax,%ax # Zero - movw %ax,%es # Address - movw %ax,%ds # data - movw %ax,%ss # Set up - movw $LOAD,%sp # stack - -# -# Copy this code to the address it was linked for -# - movw %sp,%si # Source - movw $start,%di # Destination - movw $0x100,%cx # Word count - rep # Relocate - movsw # code -# -# Set address for variable space beyond code, and clear it. -# Notice that this is also used to point to the values embedded in the blo= ck, -# by using negative offsets. -# - movw %di,%bp # Address variables - movb $0x8,%cl # Words to clear - rep # Zero - stosw # them -# -# Relocate to the new copy of the code. -# - incb -0xe(%di) # Sector number - jmp main-LOAD+ORIGIN # To relocated code -# -# Check what flags were loaded with us, specifically, Use a predefined Dri= ve. -# If what the bios gives us is bad, use the '0' in the block instead, as w= ell. -# -main: testb $0x20,_FLAGS(%bp) # Set number drive? - jnz main.1 # Yes - testb %dl,%dl # Drive number valid? - js main.2 # Possibly (0x80 set) -main.1: movb _SETDRV(%bp),%dl # Drive number to use -# -# Whatever we decided to use, now store it into the fake -# partition entry that lives in the data space above us. -# -main.2: movb %dl,_FAKE(%bp) # Save drive number - callw putn # To new line - pushw %dx # Save drive number -# -# Start out with a pointer to the 4th byte of the first table entry -# so that after 4 iterations it's beyond the end of the sector. -# and beyond a 256 byte boundary and has overflowed 8 bits (see next comme= nt). -# (remember that the table starts 2 bytes earlier than you would expect -# as the bootable flag is after it in the block) -# - movw $(partbl+0x4),%bx # Partition table (+4) - xorw %dx,%dx # Item number -# -# Loop around on the partition table, printing values until we -# pass a 256 byte boundary. The end of loop test is at main.5. -# -main.3: movb %ch,-0x4(%bx) # Zero active flag (ch =3D=3D 0) - btw %dx,_FLAGS(%bp) # Entry enabled? - jnc main.5 # No -# -# If any of the entries in the table are -# the same as the 'type' in the slice table entry, -# then this is an empty or non bootable partition. Skip it. -# - movb (%bx),%al # Load type - movw $tables,%di # Lookup tables - movb $TBL0SZ,%cl # Number of entries - repne # Exclude - scasb # partition? - je main.5 # Yes -# -# Now scan the table of known types -# - movb $TBL1SZ,%cl # Number of entries - repne # Known - scasb # type? - jne main.4 # No -# -# If it matches get the matching element in the -# next array. if it doesn't, we are already -# pointing at its first element which points to a "?". -# - addw $TBL1SZ,%di # Adjust -main.4: movb (%di),%cl # Partition - addw %cx,%di # description - callw putx # Display it -main.5: incw %dx # Next item - addb $0x10,%bl # Next entry - jnc main.3 # Till done -# -# Passed a 256 byte boundary.. -# table is finished. -# Add one to the drive number and check it is valid, -# - popw %ax # Drive number - subb $0x80-0x1,%al # Does next - cmpb NHRDRV,%al # drive exist? (from BIOS?) - jb main.6 # Yes -# If not then if there is only one drive, -# Don't display drive as an option. -# - decw %ax # Already drive 0? - jz main.7 # Yes -# If it was illegal or we cycled through them, -# then go back to drive 0. -# - xorb %al,%al # Drive 0 -# -# Whatever drive we selected, make it an ascii digit and save it back -# to the "next drive" location in the loaded block in case we -# want to save it for next time. -# This also is part of the printed drive string so add 0x80 to indicate -# end of string. -# -main.6: addb $'0'|0x80,%al # Save next - movb %al,_NXTDRV(%bp) # drive number - movw $drive,%di # Display - callw putx # item -# -# Now that we've printed the drive (if we needed to), display a prompt. -# Get ready for the input by noting the time. -# -main.7: movw $prompt,%si # Display - callw putstr # prompt - movb _OPT(%bp),%dl # Display - decw %si # default - callw putkey # key - xorb %ah,%ah # BIOS: Get - int $0x1a # system time - movw %dx,%di # Ticks when - addw _TICKS(%bp),%di # timeout -# -# Busy loop, looking for keystrokes but -# keeping one eye on the time. -# -main.8: movb $0x1,%ah # BIOS: Check - int $0x16 # for keypress - jnz main.11 # Have one - xorb %ah,%ah # BIOS: Get - int $0x1a # system time - cmpw %di,%dx # Timeout? - jb main.8 # No -# -# If timed out or defaulting, come here. -# -main.9: movb _OPT(%bp),%al # Load default - jmp main.12 # Join common code -# -# User's last try was bad, beep in displeasure. -# Since nothing was printed, just continue on as if the user -# hadn't done anything. This gives the effect of the user getting a beep -# for all bad keystrokes but no action until either the timeout -# occurs or the user hits a good key. -# -main.10: movb $0x7,%al # Signal - callw putchr # error -# -# Get the keystroke. -# -main.11: xorb %ah,%ah # BIOS: Get - int $0x16 # keypress - movb %ah,%al # Scan code -# -# If it's CR act as if timed out. -# - cmpb $KEY_ENTER,%al # Enter pressed? - je main.9 # Yes -# -# Otherwise check if legal -# If not ask again. -# - subb $KEY_F1,%al # Less F1 scan code - cmpb $0x4,%al # F1..F5? - jna main.12 # Yes - subb $(KEY_1 - KEY_F1),%al # Less #1 scan code - cmpb $0x4,%al # #1..#5? - ja main.10 # No -# -# We have a selection. -# but if it's a bad selection go back to complain. -# The bits in MNUOPT were set when the options were printed. -# Anything not printed is not an option. -# -main.12: cbtw # Option - btw %ax,_MNUOPT(%bp) # enabled? - jnc main.10 # No -# -# Save the info in the original tables -# for rewriting to the disk. -# - movb %al,_OPT(%bp) # Save option - movw $FAKE,%si # Partition for write - movb (%si),%dl # Drive number - movw %si,%bx # Partition for read - cmpb $0x4,%al # F5/#5 pressed? - pushf # Save - je main.13 # Yes - shlb $0x4,%al # Point to - addw $partbl,%ax # selected - xchgw %bx,%ax # partition - movb $0x80,(%bx) # Flag active -# -# If not asked to do a write-back (flags 0x40) don't do one. -# -main.13: pushw %bx # Save - testb $0x40,_FLAGS(%bp) # No updates? - jnz main.14 # Yes - movw $start,%bx # Data to write - movb $0x3,%ah # Write sector - callw intx13 # to disk -main.14: popw %si # Restore - popf # Restore -# -# If going to next drive, replace drive with selected one. -# Remember to un-ascii it. Hey 0x80 is already set, cool! -# - jne main.15 # If not F5/#5 - movb _NXTDRV(%bp),%dl # Next drive - subb $'0',%dl # number -# -# load selected bootsector to the LOAD location in RAM. -# If it fails to read or isn't marked bootable, treat it -# as a bad selection. -# XXX what does %si carry? -# -main.15: movw $LOAD,%bx # Address for read - movb $0x2,%ah # Read sector - callw intx13 # from disk - jc main.10 # If error - cmpw $MAGIC,0x1fe(%bx) # Bootable? - jne main.10 # No - pushw %si # Save - movw $crlf,%si # Leave some - callw puts # space - popw %si # Restore - jmp *%bx # Invoke bootstrap -# -# Display routines -# - -putkey: movb $'F',%al # Display - callw putchr # 'F' - movb $'1',%al # Prepare - addb %dl,%al # digit - jmp putstr.1 # Display the rest - -# -# Display the option and note that it is a valid option. -# That last point is a bit tricky.. -# -putx: btsw %dx,_MNUOPT(%bp) # Enable menu option - movw $item,%si # Display - callw putkey # key - movw %di,%si # Display the rest - -puts: callw putstr # Display string - -putn: movw $crlf,%si # To next line - -putstr: lodsb # Get byte - testb $0x80,%al # End of string? - jnz putstr.2 # Yes -putstr.1: callw putchr # Display char - jmp putstr # Continue -putstr.2: andb $~0x80,%al # Clear MSB - -putchr: pushw %bx # Save - movw $0x7,%bx # Page:attribute - movb $0xe,%ah # BIOS: Display - int $0x10 # character - popw %bx # Restore - retw # To caller - -# One-sector disk I/O routine - -intx13: movb 0x1(%si),%dh # Load head - movw 0x2(%si),%cx # Load cylinder:sector - movb $0x1,%al # Sector count - pushw %si # Save - movw %sp,%di # Save - testb $0x80,_FLAGS(%bp) # Use packet interface? - jz intx13.1 # No - pushl $0x0 # Set the - pushl 0x8(%si) # LBA address - pushw %es # Set the transfer - pushw %bx # buffer address - push $0x1 # Block count - push $0x10 # Packet size - movw %sp,%si # Packet pointer - decw %ax # Verify off - orb $0x40,%ah # Use disk packet -intx13.1: int $0x13 # BIOS: Disk I/O - movw %di,%sp # Restore - popw %si # Restore - retw # To caller - -# Menu strings - -item: .ascii " "; .byte ' '|0x80 -prompt: .ascii "\nDefault:"; .byte ' '|0x80 -crlf: .ascii "\r"; .byte '\n'|0x80 - -# Partition type tables - -tables: -# -# These entries identify invalid or NON BOOT types and partitions. -# - .byte 0x0, 0x5, 0xf -# -# These values indicate bootable types we know the names of -# - .byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83 - .byte 0x9f, 0xa5, 0xa6, 0xa9 -# -# These are offsets that match the known names above and point to the stri= ngs -# that will be printed. -# - .byte os_misc-. # Unknown - .byte os_dos-. # DOS - .byte os_dos-. # DOS - .byte os_dos-. # DOS - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_linux-. # Linux - .byte os_bsd-. # BSD/OS - .byte os_freebsd-. # FreeBSD - .byte os_bsd-. # OpenBSD - .byte os_bsd-. # NetBSD -# -# And here are the strings themselves. 0x80 or'd into a byte indicates -# the end of the string. (not so great for Russians but...) -# -os_misc: .ascii "?"; .byte '?'|0x80 -os_dos: .ascii "DO"; .byte 'S'|0x80 -os_linux: .ascii "Linu"; .byte 'x'|0x80 -os_freebsd: .ascii "Free" -os_bsd: .ascii "BS"; .byte 'D'|0x80 - - .org PRT_OFF-0xe,0x90 - - .word B0MAGIC # Magic number - -# -# These values are sometimes changed before writing back to the drive -# Be especially careful that nxtdrv: must come after drive:, as it -# is part of the same string. -# -drive: .ascii "Drive " -nxtdrv: .byte 0x0 # Next drive number -opt: .byte 0x0 # Option -setdrv: .byte 0x80 # Drive to force -flags: .byte FLAGS # Flags -ticks: .word TICKS # Delay - -# -# here is the 64 byte partition table that fdisk would fiddle with. -# -partbl: .fill 0x40,0x1,0x0 # Partition table - .word MAGIC # Magic number Index: boot0/boot0sio.s =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: boot0/boot0sio.s diff -N boot0/boot0sio.s --- boot0/boot0sio.s 20 Apr 2004 03:15:59 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,438 +0,0 @@ -# -# Copyright (c) 2002 Bruce M. Simpson -# Copyright (c) 1998 Robert Nordier -# All rights reserved. -# -# Redistribution and use in source and binary forms are freely -# permitted provided that the above copyright notice and this -# paragraph and the following disclaimer are duplicated in all -# such forms. -# -# This software is provided "AS IS" and without any express or -# implied warranties, including, without limitation, the implied -# warranties of merchantability and fitness for a particular -# purpose. -# - -# $FreeBSD: src/sys/boot/i386/boot0/boot0sio.s,v 1.4 2004/04/20 03:15:59 o= brien Exp $ - -# A 512-byte boot manager which uses a serial console on COM1. - - .set NHRDRV,0x475 # Number of hard drives - .set ORIGIN,0x600 # Execution address - .set FAKE,0x800 # Partition entry - .set LOAD,0x7c00 # Load address - - .set PRT_OFF,0x1be # Partition table - - .set TBL0SZ,0x3 # Table 0 size - .set TBL1SZ,0xb # Table 1 size - - .set MAGIC,0xaa55 # Magic: bootable - .set B0MAGIC,0xbb66 # Identification - - .set KEY_ENTER,0x1c # Enter key scan code - .set KEY_F1,0x3b # F1 key scan code - .set KEY_1,0x02 # #1 key scan code - - .set ASCII_BEL,0x07 # ASCII code for - .set ASCII_CR,0x0D # ASCII code for - .set ASCII_1,0x31 # ASCII code for '1' - -# -# Addresses in the sector of embedded data values. -# Accessed with negative offsets from the end of the relocated sector (%eb= p). -# - .set _NXTDRV,-0x48 # Next drive - .set _OPT,-0x47 # Default option - .set _SETDRV,-0x46 # Drive to force - .set _FLAGS,-0x45 # Flags - .set _TICKS,-0x44 # Timeout ticks - .set _FAKE,0x0 # Fake partition entry - .set _MNUOPT,0xc # Menu options - - .globl start # Entry point - .code16 # This runs in real mode - -# -# Initialise segments and registers to known values. -# segments start at 0. -# The stack is immediately below the address we were loaded to. -# -start: cld # String ops inc - xorw %ax,%ax # Zero - movw %ax,%es # Address - movw %ax,%ds # data - movw %ax,%ss # Set up - movw $LOAD,%sp # stack - -# -# Copy this code to the address it was linked for -# - movw %sp,%si # Source - movw $start,%di # Destination - movw $0x100,%cx # Word count - rep # Relocate - movsw # code -# -# Set address for variable space beyond code, and clear it. -# Notice that this is also used to point to the values embedded in the blo= ck, -# by using negative offsets. -# - movw %di,%bp # Address variables - movb $0x8,%cl # Words to clear - rep # Zero - stosw # them -# -# Relocate to the new copy of the code. -# - incb -0xe(%di) # Sector number - jmp main-LOAD+ORIGIN # To relocated code - -# -# Initialize the serial port. -# Must save DX (contains drive number) -# -main: pushw %dx # Save - xorw %dx,%dx # Port: COM1 - movb COMSPEED,%al # defined by Makefile - movb $0x00,%ah # BIOS: Set COM Port - int $0x14 # Parameters - popw %dx # Restore -# -# Check what flags were loaded with us, specifically, Use a predefined Dri= ve. -# If what the bios gives us is bad, use the '0' in the block instead, as w= ell. -# - testb $0x20,_FLAGS(%bp) # Set number drive? - jnz main.1 # Yes - testb %dl,%dl # Drive number valid? - js main.2 # Possibly (0x80 set) -main.1: movb _SETDRV(%bp),%dl # Drive number to use -# -# Whatever we decided to use, now store it into the fake -# partition entry that lives in the data space above us. -# -main.2: movb %dl,_FAKE(%bp) # Save drive number - callw putn # To new line - pushw %dx # Save drive number -# -# Start out with a pointer to the 4th byte of the first table entry -# so that after 4 iterations it's beyond the end of the sector. -# and beyond a 256 byte boundary and has overflowed 8 bits (see next comme= nt). -# (remember that the table starts 2 bytes earlier than you would expect -# as the bootable flag is after it in the block) -# - movw $(partbl+0x4),%bx # Partition table (+4) - xorw %dx,%dx # Item number -# -# Loop around on the partition table, printing values until we -# pass a 256 byte boundary. The end of loop test is at main.5. -# -main.3: movb %ch,-0x4(%bx) # Zero active flag (ch =3D=3D 0) - btw %dx,_FLAGS(%bp) # Entry enabled? - jnc main.5 # No -# -# If any of the entries in the table are -# the same as the 'type' in the slice table entry, -# then this is an empty or non bootable partition. Skip it. -# - movb (%bx),%al # Load type - movw $tables,%di # Lookup tables - movb $TBL0SZ,%cl # Number of entries - repne # Exclude - scasb # partition? - je main.5 # Yes -# -# Now scan the table of known types -# - movb $TBL1SZ,%cl # Number of entries - repne # Known - scasb # type? - jne main.4 # No -# -# If it matches get the matching element in the -# next array. if it doesn't, we are already -# pointing at its first element which points to a "?". -# - addw $TBL1SZ,%di # Adjust -main.4: movb (%di),%cl # Partition - addw %cx,%di # description - callw putx # Display it -main.5: incw %dx # Next item - addb $0x10,%bl # Next entry - jnc main.3 # Till done -# -# Passed a 256 byte boundary.. -# table is finished. -# Add one to the drive number and check it is valid, -# - popw %ax # Drive number - subb $0x80-0x1,%al # Does next - cmpb NHRDRV,%al # drive exist? (from BIOS?) - jb main.6 # Yes -# If not then if there is only one drive, -# Don't display drive as an option. -# - decw %ax # Already drive 0? - jz main.7 # Yes -# If it was illegal or we cycled through them, -# then go back to drive 0. -# - xorb %al,%al # Drive 0 -# -# Whatever drive we selected, make it an ascii digit and save it back -# to the "next drive" location in the loaded block in case we -# want to save it for next time. -# This also is part of the printed drive string so add 0x80 to indicate -# end of string. -# -main.6: addb $'0'|0x80,%al # Save next - movb %al,_NXTDRV(%bp) # drive number - movw $drive,%di # Display - callw putx # item -# -# Now that we've printed the drive (if we needed to), display a prompt. -# Get ready for the input byte noting the time. -# -main.7: movw $prompt,%si # Display - callw putstr # prompt - movb _OPT(%bp),%dl # Display - decw %si # default - callw putkey # key -main.7_1: - xorb %ah,%ah # BIOS: Get - int $0x1a # system time - movw %dx,%si # Ticks when - addw _TICKS(%bp),%si # timeout - -# -# Busy loop, checking for a character on the serial port, but -# keeping one eye on the time. -# - -main.8: xorw %dx,%dx # Use COM1 - movb $0x03,%ah # BIOS: Read COM - int $0x14 # Status - testb $0x01,%ah # Check line status - jnz main.11 # (bit 1 indicates input) - - xorb %ah,%ah # BIOS: Get - int $0x1a # system time - cmpw %si,%dx # Timeout? - jb main.8 # No - -# -# If timed out or defaulting, come here. -# -main.9: movb _OPT(%bp),%al # Load default - jmp main.12 # Join common code -# -# User's last try was bad, beep in displeasure. -# Since nothing was printed, just continue on as if the user -# hadn't done anything. This gives the effect of the user getting a beep -# for all bad keystrokes but no action until either the timeout -# occurs or the user hits a good key. -# -main.10: movb $ASCII_BEL,%al # Signal - callw putchr # error - jmp main.7_1 # Go back -# -# Check the character we just got on the serial port. -# -main.11: movb $0x02,%ah # BIOS: Receive - int $0x14 # COM Byte -# -# If it's CR act as if timed out. -# - cmpb $ASCII_CR,%al # Enter pressed? - je main.9 # Yes -# -# Otherwise check if legal -# If not ask again. -# - subb $ASCII_1,%al # Less '1' ascii character - cmpb $0x4,%al # #1..#5? - ja main.10 # No -# -# We have a selection. -# but if it's a bad selection go back to complain. -# The bits in MNUOPT were set when the options were printed. -# Anything not printed is not an option. -# -main.12: cbtw # Option - btw %ax,_MNUOPT(%bp) # enabled? - jnc main.10 # No -# -# Save the info in the original tables -# for rewriting to the disk. -# - movb %al,_OPT(%bp) # Save option - movw $FAKE,%si # Partition for write - movb (%si),%dl # Drive number - movw %si,%bx # Partition for read - cmpb $0x4,%al # F5/#5 pressed? - pushf # Save - je main.13 # Yes - shlb $0x4,%al # Point to - addw $partbl,%ax # selected - xchgw %bx,%ax # partition - movb $0x80,(%bx) # Flag active -# -# If not asked to do a write-back (flags 0x40) don't do one. -# -main.13: pushw %bx # Save - testb $0x40,_FLAGS(%bp) # No updates? - jnz main.14 # Yes - movw $start,%bx # Data to write - movb $0x3,%ah # Write sector - callw intx13 # to disk -main.14: popw %si # Restore - popf # Restore -# -# If going to next drive, replace drive with selected one. -# Remember to un-ascii it. Hey 0x80 is already set, cool! -# - jne main.15 # If not F5/#5 - movb _NXTDRV(%bp),%dl # Next drive - subb $'0',%dl # number -# -# load selected bootsector to the LOAD location in RAM. -# If it fails to read or isn't marked bootable, treat it -# as a bad selection. -# XXX what does %si carry? -# -main.15: movw $LOAD,%bx # Address for read - movb $0x2,%ah # Read sector - callw intx13 # from disk - jc main.10 # If error - cmpw $MAGIC,0x1fe(%bx) # Bootable? - jne main.10 # No - pushw %si # Save - movw $crlf,%si # Leave some - callw puts # space - popw %si # Restore - jmp *%bx # Invoke bootstrap -# -# Display routines -# - -putkey: movb $ASCII_1,%al # Prepare - addb %dl,%al # digit - jmp putstr.1 # Display the rest - -# -# Display the option and note that it is a valid option. -# That last point is a bit tricky.. -# -putx: btsw %dx,_MNUOPT(%bp) # Enable menu option - movw $item,%si # Display - callw putkey # key - movw %di,%si # Display the rest - -puts: callw putstr # Display string - -putn: movw $crlf,%si # To next line - -putstr: lodsb # Get byte - testb $0x80,%al # End of string? - jnz putstr.2 # Yes -putstr.1: callw putchr # Display char - jmp putstr # Continue -putstr.2: andb $~0x80,%al # Clear MSB - -putchr: pushw %dx # Save - xorw %dx,%dx # Use COM1 - xorw %cx,%cx # No timeout - movb $0x01,%ah # BIOS: Send - int $0x14 # Character - popw %dx # Restore - retw # To caller - -# One-sector disk I/O routine - -intx13: movb 0x1(%si),%dh # Load head - movw 0x2(%si),%cx # Load cylinder:sector - movb $0x1,%al # Sector count - pushw %si # Save - movw %sp,%di # Save - testb $0x80,_FLAGS(%bp) # Use packet interface? - jz intx13.1 # No - pushl $0x0 # Set the - pushl 0x8(%si) # LBA address - pushw %es # Set the transfer - pushw %bx # buffer address - push $0x1 # Block count - push $0x10 # Packet size - movw %sp,%si # Packet pointer - decw %ax # Verify off - orb $0x40,%ah # Use disk packet -intx13.1: int $0x13 # BIOS: Disk I/O - movw %di,%sp # Restore - popw %si # Restore - retw # To caller - -# Menu strings - -item: .ascii " "; .byte ' '|0x80 -prompt: .ascii "\nDef:"; .byte ' '|0x80 -crlf: .ascii "\r"; .byte '\n'|0x80 - -# Partition type tables - -tables: -# -# These entries identify invalid or NON BOOT types and partitions. -# - .byte 0x0, 0x5, 0xf -# -# These values indicate bootable types we know the names of -# - .byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83 - .byte 0x9f, 0xa5, 0xa6, 0xa9 -# -# These are offsets that match the known names above and point to the stri= ngs -# that will be printed. -# - .byte os_misc-. # Unknown - .byte os_dos-. # DOS - .byte os_dos-. # DOS - .byte os_dos-. # DOS - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_linux-. # Linux - .byte os_bsd-. # BSD/OS - .byte os_freebsd-. # FreeBSD - .byte os_bsd-. # OpenBSD - .byte os_bsd-. # NetBSD -# -# And here are the strings themselves. 0x80 or'd into a byte indicates -# the end of the string. (not so great for Russians but...) -# -os_misc: .ascii "?"; .byte '?'|0x80 -os_dos: .ascii "DO"; .byte 'S'|0x80 -os_linux: .ascii "Linu"; .byte 'x'|0x80 -os_freebsd: .ascii "Free" -os_bsd: .ascii "BS"; .byte 'D'|0x80 - - .org PRT_OFF-0xe,0x90 - - .word B0MAGIC # Magic number - -# -# These values are sometimes changed before writing back to the drive -# Be especially careful that nxtdrv: must come after drive:, as it -# is part of the same string. -# -drive: .ascii "Drive " -nxtdrv: .byte 0x0 # Next drive number -opt: .byte 0x0 # Option -setdrv: .byte 0x80 # Drive to force -flags: .byte FLAGS # Flags -ticks: .word TICKS # Delay - -# -# here is the 64 byte partition table that fdisk would fiddle with. -# -partbl: .fill 0x40,0x1,0x0 # Partition table - .word MAGIC # Magic number Index: boot0sio/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/boot/i386/boot0sio/Makefile,v retrieving revision 1.2 diff -u -p -r1.2 Makefile --- boot0sio/Makefile 6 Feb 2004 21:58:31 -0000 1.2 +++ boot0sio/Makefile 27 Apr 2004 19:34:19 -0000 @@ -2,6 +2,7 @@ =20 .PATH: ${.CURDIR}/../boot0 =20 -BOOT=3D boot0sio +FILESNAME=3D boot0sio +CFLAGS+=3D -DSIO =20 .include "${.CURDIR}/../boot0/Makefile" --hwvH6HDNit2nSK4j-- --FoLtEtfbNGMjfgrs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAjrdZUkv4P6juNwoRApqrAJ0VA2eyHNDRzLc2T0uKKXiRl2xJOwCfToCI FUS2y5e7hbZycyOP1m6km08= =gOQF -----END PGP SIGNATURE----- --FoLtEtfbNGMjfgrs--