Add #ifdef for RAWBOOT.

remove some #if 0 stuff.
This commit is contained in:
Poul-Henning Kamp 1996-09-11 19:23:11 +00:00
parent 8b5d3828b2
commit b679d552d3
2 changed files with 54 additions and 27 deletions
sys/i386/boot/biosboot

View File

@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
* $Id: disk.c,v 1.17 1996/07/12 05:35:47 bde Exp $
* $Id: disk.c,v 1.18 1996/09/10 21:18:39 phk Exp $
*/
/*
@ -83,9 +83,6 @@ devopen(void)
struct disklabel *dl;
char *p;
int i, sector = 0, di;
#if 0 /* Save space, already have hard error for cyl > 1023 in Bread */
u_long bend;
#endif
di = get_diskinfo(dosdev);
spt = SPT(di);
@ -96,14 +93,7 @@ devopen(void)
spc = spt * HEADS(di);
#if 0 /* save a little more space and avoid surprises when booting from fd2 */
if (dosdev == 2)
{
boff = 0;
part = (spt == 15 ? 3 : 1);
}
else
#endif
#ifndef RAWBOOT
{
#ifdef EMBEDDED_DISKLABEL
dl = &disklabel;
@ -142,11 +132,6 @@ devopen(void)
/* This is a good idea for all disks */
bsize = dl->d_partitions[part].p_size;
#if 0 /* Save space, already have hard error for cyl > 1023 in Bread */
bend = boff + bsize - 1 ;
if (bend / spc >= 1024) {
printf("boot partition end >= cyl 1024, BIOS can't load kernel stored beyond this limit\n");
#endif
#ifdef DO_BAD144
do_bad144 = 0;
if (dl->d_flags & D_BADSECT) {
@ -194,12 +179,16 @@ devopen(void)
else
printf("Using bad sector table at %d\n", dkbbnum+i);
}
#endif DO_BAD144
#endif /* DO_BAD144 */
}
#endif /* RAWBOOT */
return 0;
}
/*
* Be aware that cnt is rounded up to N*BPS
*/
void
devread(char *iodest, int sector, int cnt)
{
@ -251,8 +240,8 @@ Bread(int dosdev, int sector)
int
badsect(int dosdev, int sector)
{
#if defined(DO_BAD144) && !defined(RAWBOOT)
int i;
#ifdef DO_BAD144
if (do_bad144) {
u_short cyl;
u_short head;
@ -301,7 +290,7 @@ badsect(int dosdev, int sector)
newsec -= dl->d_nsectors + i + 1;
return newsec;
}
#endif DO_BAD144
no_remap:
#endif
return sector;
}

View File

@ -5,7 +5,7 @@
*
* 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
e* 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.
*
@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:36:34 rpd
* $Id: sys.c,v 1.12 1996/09/07 21:06:43 bde Exp $
* $Id: sys.c,v 1.13 1996/09/10 21:18:40 phk Exp $
*/
#include "boot.h"
@ -47,6 +47,10 @@ char buf[BUFSIZE], fsbuf[BUFSIZE], iobuf[BUFSIZE];
char mapbuf[MAPBUFSIZE];
int mapblock;
#ifdef RAWBOOT
#define STARTBYTE 8192 /* Where on the media the kernel starts */
#endif
void
xread(char *addr, int size)
{
@ -61,6 +65,7 @@ xread(char *addr, int size)
}
}
#ifndef RAWBOOT
void
read(char *buffer, int count)
{
@ -72,12 +77,9 @@ read(char *buffer, int count)
logno = lblkno(fs, poff);
cnt2 = size = blksize(fs, &inode, logno);
bnum2 = fsbtodb(fs, block_map(logno)) + boff;
if ( (!off) && (size <= count))
{
if ( (!off) && (size <= count)) {
devread(buffer, bnum2, cnt2);
}
else
{
} else {
size -= off;
if (size > count)
size = count;
@ -89,7 +91,41 @@ read(char *buffer, int count)
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
int
find(char *path)
{
@ -245,6 +281,7 @@ openrd(void)
if (devopen())
return 1;
#ifndef RAWBOOT
/***********************************************\
* Load Filesystem info (mount the device) *
\***********************************************/
@ -259,5 +296,6 @@ openrd(void)
return -1;
poff = 0;
name = cp;
#endif /* RAWBOOT */
return 0;
}