Index: head/sys/boot/i386/zfsboot/Makefile =================================================================== --- head/sys/boot/i386/zfsboot/Makefile (revision 219701) +++ head/sys/boot/i386/zfsboot/Makefile (working copy) @@ -17,6 +17,11 @@ REL1= 0x700 ORG1= 0x7c00 ORG2= 0x2000 +.if defined(USE_XREAD) +XREAD_FLAGS= -DUSE_XREAD +XREAD_FILE= xreadorg.h +.endif + CFLAGS= -DBOOTPROG=\"zfsboot\" \ -Os -g \ -fno-guess-branch-probability \ @@ -24,7 +29,7 @@ CFLAGS= -DBOOTPROG=\"zfsboot\" \ -fno-unit-at-a-time \ -mno-align-long-strings \ -mrtd \ - -DBOOT2 \ + -DBOOT2 ${XREAD_FLAGS} \ -DFLAGS=${BOOT_BOOT1_FLAGS} \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ @@ -64,9 +69,9 @@ zfsldr.out: zfsldr.o ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ - zfsboot.o zfsboot.s zfsboot.s.tmp xreadorg.h sio.o + zfsboot.o zfsboot.s zfsboot.s.tmp sio.o ${XREAD_FILE} -# We currently allow 32768 bytes for zfsboot - in practice it could be +# We currently allow 65536 bytes for zfsboot - in practice it could be # any size up to 3.5Mb but keeping it fixed size simplifies zfsldr. # BOOT2SIZE= 65536 @@ -76,6 +81,8 @@ zfsboot2: zfsboot.ld echo "$$x bytes available"; test $$x -ge 0 dd if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync +CLEANFILES+= util.o cons.o drv.o + zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN} btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \ -o ${.TARGET} -P 1 zfsboot.bin @@ -91,9 +98,9 @@ zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons. zfsboot.o: zfsboot.s -SRCS= zfsboot.c xreadorg.h +SRCS= zfsboot.c ${XREAD_FILE} -zfsboot.s: zfsboot.c xreadorg.h ${.CURDIR}/../../zfs/zfsimpl.c +zfsboot.s: zfsboot.c ${XREAD_FILE} ${.CURDIR}/../../zfs/zfsimpl.c ${CC} ${CFLAGS} -S -o zfsboot.s.tmp ${.CURDIR}/zfsboot.c sed -e '/align/d' -e '/nop/d' < zfsboot.s.tmp > zfsboot.s rm -f zfsboot.s.tmp Index: head/sys/boot/i386/common/cons.c =================================================================== --- head/sys/boot/i386/common/cons.c (revision 219701) +++ head/sys/boot/i386/common/cons.c (working copy) @@ -37,6 +37,7 @@ void putc(int c) { + v86.ctl = V86_FLAGS; v86.addr = 0x10; v86.eax = 0xe00 | (c & 0xff); v86.ebx = 0x7; Index: head/sys/boot/i386/common/drv.c =================================================================== --- head/sys/boot/i386/common/drv.c (revision 219701) +++ head/sys/boot/i386/common/drv.c (working copy) @@ -26,7 +26,7 @@ __FBSDID("$FreeBSD$"); #include "rbx.h" #include "util.h" #include "drv.h" -#ifndef GPT +#ifdef USE_XREAD #include "xreadorg.h" #endif @@ -58,7 +58,7 @@ drvsize(struct dsk *dskp) } #endif /* GPT */ -#ifdef GPT +#ifndef USE_XREAD static struct { uint16_t len; uint16_t count; @@ -66,7 +66,7 @@ static struct { uint16_t seg; uint64_t lba; } packet; -#endif /* GPT */ +#endif /* !USE_XREAD */ int drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) @@ -75,7 +75,8 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, if (!OPT_CHECK(RBX_QUIET)) printf("%c\b", c = c << 8 | c >> 24); -#ifdef GPT + +#ifndef USE_XREAD packet.len = 0x10; packet.count = nblk; packet.off = VTOPOFF(buf); @@ -87,7 +88,7 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, v86.edx = dskp->drive; v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); -#else /* !GPT */ +#else /* USE_XREAD */ v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; v86.addr = XREADORG; /* call to xread in boot1 */ v86.es = VTOPSEG(buf); @@ -95,7 +96,7 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, v86.ebx = VTOPOFF(buf); v86.ecx = lba >> 32; v86.edx = nblk << 8 | dskp->drive; -#endif /* !GPT */ +#endif /* USE_XREAD */ v86int(); if (V86_CY(v86.efl)) { printf("%s: error %u lba %u\n",