From owner-svn-soc-all@FreeBSD.ORG Wed Jul 18 10:04:42 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 147E61065686 for ; Wed, 18 Jul 2012 10:04:40 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 Jul 2012 10:04:40 +0000 Date: Wed, 18 Jul 2012 10:04:40 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120718100440.147E61065686@hub.freebsd.org> Cc: Subject: socsvn commit: r239530 - soc2012/syuu/bhyve-bios/lib/libbiosemul X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 10:04:42 -0000 Author: syuu Date: Wed Jul 18 10:04:39 2012 New Revision: 239530 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239530 Log: import doscmd source code to libbiosemul, cannnot compile for now Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/ soc2012/syuu/bhyve-bios/lib/libbiosemul/AsyncIO.c soc2012/syuu/bhyve-bios/lib/libbiosemul/AsyncIO.h soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile.dos soc2012/syuu/bhyve-bios/lib/libbiosemul/PROBLEMS soc2012/syuu/bhyve-bios/lib/libbiosemul/ParseBuffer.c soc2012/syuu/bhyve-bios/lib/libbiosemul/README soc2012/syuu/bhyve-bios/lib/libbiosemul/README.booting_dos soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.h soc2012/syuu/bhyve-bios/lib/libbiosemul/cmos.c soc2012/syuu/bhyve-bios/lib/libbiosemul/com.h soc2012/syuu/bhyve-bios/lib/libbiosemul/config.c soc2012/syuu/bhyve-bios/lib/libbiosemul/cp437-8x14.fnt.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/cp437-8x14.pcf.gz.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/cp437-8x16.fnt.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/cp437-8x16.pcf.gz.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/cp437-8x8.fnt.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/cp437-8x8.pcf.gz.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c soc2012/syuu/bhyve-bios/lib/libbiosemul/crt0.c soc2012/syuu/bhyve-bios/lib/libbiosemul/cwd.c soc2012/syuu/bhyve-bios/lib/libbiosemul/cwd.h soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c soc2012/syuu/bhyve-bios/lib/libbiosemul/disktab.c soc2012/syuu/bhyve-bios/lib/libbiosemul/dispatch.h soc2012/syuu/bhyve-bios/lib/libbiosemul/dos.c soc2012/syuu/bhyve-bios/lib/libbiosemul/dos.h soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.1 soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.c soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd_loader.c soc2012/syuu/bhyve-bios/lib/libbiosemul/ems.c soc2012/syuu/bhyve-bios/lib/libbiosemul/ems.h soc2012/syuu/bhyve-bios/lib/libbiosemul/emsdriv.S soc2012/syuu/bhyve-bios/lib/libbiosemul/emsdriv.sys.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/emuint.c soc2012/syuu/bhyve-bios/lib/libbiosemul/emuint.h soc2012/syuu/bhyve-bios/lib/libbiosemul/exe.c soc2012/syuu/bhyve-bios/lib/libbiosemul/fonts.dir soc2012/syuu/bhyve-bios/lib/libbiosemul/i386-pinsn.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int10.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int14.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int16.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int17.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int1a.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int2f.c soc2012/syuu/bhyve-bios/lib/libbiosemul/intff.c soc2012/syuu/bhyve-bios/lib/libbiosemul/mem.c soc2012/syuu/bhyve-bios/lib/libbiosemul/mouse.c soc2012/syuu/bhyve-bios/lib/libbiosemul/mouse.h soc2012/syuu/bhyve-bios/lib/libbiosemul/net.c soc2012/syuu/bhyve-bios/lib/libbiosemul/port.c soc2012/syuu/bhyve-bios/lib/libbiosemul/redir.S soc2012/syuu/bhyve-bios/lib/libbiosemul/redir.com.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h soc2012/syuu/bhyve-bios/lib/libbiosemul/setver.c soc2012/syuu/bhyve-bios/lib/libbiosemul/signal.c soc2012/syuu/bhyve-bios/lib/libbiosemul/timer.c soc2012/syuu/bhyve-bios/lib/libbiosemul/trace.c soc2012/syuu/bhyve-bios/lib/libbiosemul/trap.c soc2012/syuu/bhyve-bios/lib/libbiosemul/trap.h soc2012/syuu/bhyve-bios/lib/libbiosemul/tty.c soc2012/syuu/bhyve-bios/lib/libbiosemul/tty.h soc2012/syuu/bhyve-bios/lib/libbiosemul/video.c soc2012/syuu/bhyve-bios/lib/libbiosemul/video.h soc2012/syuu/bhyve-bios/lib/libbiosemul/vparams.h soc2012/syuu/bhyve-bios/lib/libbiosemul/xms.c soc2012/syuu/bhyve-bios/lib/libbiosemul/xms.h Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/AsyncIO.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/AsyncIO.c Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,263 @@ +/* + * Copyright (c) 1992, 1993, 1996 + * Berkeley Software Design, Inc. 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 Berkeley Software + * Design, Inc. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. + * + * BSDI AsyncIO.c,v 2.2 1996/04/08 19:32:10 bostic Exp + */ + +#include +__FBSDID("$FreeBSD: projects/doscmd/AsyncIO.c,v 1.9 2002/05/10 10:40:46 tg Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "doscmd.h" +#include "AsyncIO.h" + +#define FD_ISZERO(p) ((p)->fds_bits[0] == 0) + +/* + * Set or Clear the Async nature of an FD + */ + +#define SETASYNC(fd) fcntl(fd, F_SETFL, handlers[fd].flag | FASYNC) +#define CLRASYNC(fd) fcntl(fd, F_SETFL, handlers[fd].flag & ~FASYNC) + +/* + * Request that ``func'' be called everytime data is available on ``fd'' + */ + +static fd_set fdset; /* File Descriptors to select on */ + +typedef struct { + void (*func)(int, int, void *, regcontext_t *); + /* Function to call on data arrival */ + void (*failure)(void *); /* Function to call on failure */ + void *arg; /* Argument to above functions */ + int lockcnt; /* Nested level of lock */ + fd_set members; /* Set of FD's to disable on SIGIO */ + int flag; /* The flag from F_GETFL (we own it) */ +} Async; + +static Async handlers[OPEN_MAX]; + +static void CleanIO(void); +static void HandleIO(struct sigframe *sf); + +void +_RegisterIO(int fd, void (*func)(int, int, void *, regcontext_t *), + void *arg, void (*failure)(void *)) +{ + static int firsttime = 1; + Async *as; + + if (fd < 0 || fd > OPEN_MAX) { +printf("%d: Invalid FD\n", fd); + return; + } + + as = &handlers[fd]; + + if ((as->flag = fcntl(fd, F_GETFL, 0)) == -1) { + if (func) { +/*@*/ perror("get fcntl"); +/*@*/ abort(); + return; + } + } + + if (firsttime) { + firsttime = 0; + setsignal(SIGIO, HandleIO); + } + + if ((handlers[fd].func = func) != 0) { + as->lockcnt = 0; + as->arg = arg; + as->failure = failure; + + FD_SET(fd, &fdset); + FD_ZERO(&handlers[fd].members); + FD_SET(fd, &handlers[fd].members); + if (fcntl(fd, F_SETOWN, getpid()) < 0) { +/*@*/ perror("SETOWN"); + } + SETASYNC(fd); + } else { + as->arg = 0; + as->failure = 0; + as->lockcnt = 0; + + CLRASYNC(fd); + FD_CLR(fd, &fdset); + } +} + +static void +CleanIO() +{ + int x; + static struct timeval tv; + + /* + * For every file des in fd_set, we check to see if it + * causes a fault on select(). If so, we unregister it + * for the user. + */ + for (x = 0; x < OPEN_MAX; ++x) { + fd_set set; + + if (!FD_ISSET(x, &fdset)) + continue; + + FD_ZERO(&set); + FD_SET(x, &set); + errno = 0; + if (select(FD_SETSIZE, &set, 0, 0, &tv) < 0 && + errno == EBADF) { + void (*f)(void *); + void *a; +printf("Closed file descriptor %d\n", x); + + f = handlers[x].failure; + a = handlers[x].arg; + handlers[x].failure = 0; + handlers[x].func = 0; + handlers[x].arg = 0; + handlers[x].lockcnt = 0; + FD_CLR(x, &fdset); + if (f) + (*f)(a); + } + } +} + +static void +HandleIO(struct sigframe *sf) +{ + static struct timeval tv; + fd_set readset, writeset; + int x, fd; + +again: + readset = writeset = fdset; + if ((x = select(FD_SETSIZE, &readset, &writeset, 0, &tv)) < 0) { + /* + * If we failed because of a BADFiledes, go find + * which one(s), fail them out and then try a + * new select to see if any of the good ones are + * okay. + */ + if (errno == EBADF) { + CleanIO(); + if (FD_ISZERO(&fdset)) + return; + goto again; + } + perror("select"); + return; + } + + /* + * If we run out of fds to look at, break out of the loop + * and exit the handler. + */ + if (x == 0) + return; + + /* + * If there is at least 1 fd saying it has something for + * us, then loop through the sets looking for those + * bits, stopping when we have handleed the number it has + * asked for. + */ + for (fd = 0; x && fd < OPEN_MAX; fd ++) { + Async *as; + int cond; + + cond = 0; + + if (FD_ISSET(fd, &readset)) { + cond |= AS_RD; + x --; + } + if (FD_ISSET(fd, &writeset)) { + cond |= AS_WR; + x --; + } + + if (cond == 0) + continue; + + /* + * Is suppose it is possible that one of the previous + * I/O requests changed the fdset. + * We do know that SIGIO is turned off right now, + * so it is safe to checkit. + */ + if (!FD_ISSET(fd, &fdset)) { + continue; + } + as = &handlers[fd]; + + /* + * as in above, maybe someone locked us... + * we are in dangerous water now if we are + * multi-tasked + */ + if (as->lockcnt) { + fprintf(stderr, "Selected IO on locked %d\n",fd); + continue; + } + /* + * Okay, now if there exists a handler, we should + * call it. We must turn back on SIGIO if there + * are possibly other people waiting for it. + */ + if (as->func) { + (*handlers[fd].func)(fd, cond, handlers[fd].arg, + (regcontext_t *)&sf->sf_uc.uc_mcontext); + } else { + /* + * Otherwise deregister this guy. + */ + _RegisterIO(fd, 0, 0, 0); + } + } + /* + * If we did not process all the fd's, then we should + * break out of the probable infinite loop. + */ +} Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/AsyncIO.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/AsyncIO.h Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1992, 1993, 1996 + * Berkeley Software Design, Inc. 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 Berkeley Software + * Design, Inc. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. + * + * BSDI AsyncIO.h,v 2.2 1996/04/08 19:32:12 bostic Exp + * + * $FreeBSD: projects/doscmd/AsyncIO.h,v 1.4 2001/10/02 11:28:59 tg Exp $ + */ + +#if defined(__cplusplus) +extern "C" { +#endif +enum { + AS_RD = 1, + AS_WR = 2 +}; + +void _RegisterIO(int, void (*)(int, int, void *, regcontext_t *), + void *, void (*)(void *)); +#if defined(__cplusplus) +} +#endif + +#define _Un_RegisterIO(x) _RegisterIO((x), (void (*))0, (void *)0, (void (*))0) Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,80 @@ +# from BSDI Makefile,v 2.6 1996/04/08 20:06:40 bostic Exp +# +# $FreeBSD: projects/doscmd/Makefile,v 1.39 2004/03/30 17:10:01 des Exp $ + +PROG= doscmd +WARNS?= 2 +SRCS= AsyncIO.c ParseBuffer.c bios.c callback.c cmos.c config.c cpu.c cwd.c \ + debug.c disktab.c dos.c doscmd.c ems.c emuint.c exe.c i386-pinsn.c \ + int.c int10.c int13.c int14.c int16.c int17.c int1a.c int2f.c intff.c \ + mem.c mouse.c net.c port.c setver.c signal.c timer.c trace.c trap.c \ + tty.c video.c xms.c ${FONTHDRS} +CFLAGS+= -I. -DDISASSEMBLER +FONTFILES= cp437-8x8.pcf.gz cp437-8x14.pcf.gz cp437-8x16.pcf.gz +FONTHDRS= font8x8.h font8x14.h font8x16.h +CLEANFILES= ${FONTFILES} ${FONTHDRS} emsdriv.sys redir.com + +PREFIX?= /usr/local +BINDIR?= ${PREFIX}/bin +DATADIR?= ${PREFIX}/share/doscmd +DOCSDIR?= ${PREFIX}/share/doc/doscmd +FONTDIR?= ${DATADIR}/fonts + +X11BASE?= /usr/X11R6 +XINCDIR?= ${X11BASE}/include +XLIBDIR?= ${X11BASE}/lib + +DIRMODE?= 0755 + +.if !defined(NO_X) +CFLAGS+= -I${XINCDIR} +LDFLAGS= -L${XLIBDIR} +LDADD= -lX11 +DPADD= ${XLIBDIR}/libX11.a +.else +CFLAGS+= -DNO_X +.endif + +beforeinstall: + ${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${DIRMODE} ${DATADIR} + ${INSTALL} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ + emsdriv.sys redir.com ${DATADIR} + ${INSTALL} -d -o ${DOCOWN} -g ${DOCGRP} -m ${DIRMODE} ${DOCSDIR} + ${INSTALL} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} \ + ${.CURDIR}/README* ${.CURDIR}/PROBLEMS ${DOCSDIR} +.if !defined(NO_X) + ${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${DIRMODE} ${FONTDIR} + ${INSTALL} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ + ${FONTFILES} ${.CURDIR}/fonts.dir ${FONTDIR} +.endif + +doscmd: ${FONTFILES} ${FONTHDRS} emsdriv.sys redir.com + +cp437-8x8.pcf.gz: cp437-8x8.pcf.gz.uu + uudecode ${.CURDIR}/cp437-8x8.pcf.gz.uu + +cp437-8x14.pcf.gz: cp437-8x14.pcf.gz.uu + uudecode ${.CURDIR}/cp437-8x14.pcf.gz.uu + +cp437-8x16.pcf.gz: cp437-8x16.pcf.gz.uu + uudecode ${.CURDIR}/cp437-8x16.pcf.gz.uu + +emsdriv.sys: emsdriv.sys.uu + uudecode ${.CURDIR}/emsdriv.sys.uu + +font8x8.h: cp437-8x8.fnt.uu + uudecode -p ${.ALLSRC} | \ + file2c 'u_int8_t font8x8[] = {' '};' > ${.TARGET} + +font8x14.h: cp437-8x14.fnt.uu + uudecode -p ${.ALLSRC} | \ + file2c 'u_int8_t font8x14[] = {' '};' > ${.TARGET} + +font8x16.h: cp437-8x16.fnt.uu + uudecode -p ${.ALLSRC} | \ + file2c 'u_int8_t font8x16[] = {' '};' > ${.TARGET} + +redir.com: redir.com.uu + uudecode ${.CURDIR}/redir.com.uu + +.include Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile.dos ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile.dos Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,48 @@ +# Special makefile for the as86/ld86 tools +# +# This is used only to make the dos tools. It is not used in the normal +# build process, except one of the *.S files is changed. The ready to +# use tools are included as uuencoded files. +# To use this makefile you must have Bruce Evans bcc package installed +# +# $FreeBSD: projects/doscmd/Makefile.dos,v 1.2 2001/07/24 11:50:23 tg Exp $ + +AS86 = as86 +LD86 = ld86 + +OBJS = redir.o emsdriv.o +DOSPROG = redir.com emsdriv.sys +DOSDIST = redir.com.uu emsdriv.sys.uu + +all: ${DOSPROG} ${DOSDIST} + +redir.com: redir.o + $(LD86) -T 0 -s -o ${.PREFIX}.tmp ${.ALLSRC} + dd if=${.PREFIX}.tmp of=${.TARGET} bs=1 skip=288 + rm -f ${.PREFIX}.tmp + +emsdriv.sys: emsdriv.o + $(LD86) -T 0 -s -o ${.PREFIX}.tmp ${.ALLSRC} + dd if=${.PREFIX}.tmp of=${.TARGET} bs=1 skip=32 + rm -f ${.PREFIX}.tmp + +redir.com.uu: redir.com + uuencode redir.com redir.com > redir.com.uu + +emsdriv.sys.uu: emsdriv.sys + uuencode emsdriv.sys emsdriv.sys > emsdriv.sys.uu + +clean: + rm -f ${DOSPROG} ${OBJS} + +allclean: + rm -f ${DOSPROG} ${DOSDIST} ${OBJS} + + +# Rule for as86 +.S.o: + $(AS86) -0 -o ${.TARGET} ${.IMPSRC} + + + + Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/PROBLEMS ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/PROBLEMS Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,21 @@ +trailing \ missing in tempname (affects PKZIP) + +FCB find routines don't store the state correctly (affects DIR, NUSQ, GET) +support for non-extended FCBs is broken (affects LAR) +wrong device attributes reported after redirection (affects GZIP) +REP IN/OUT not implemented +find_next may not close fd +tty modes wrong when running in terminal session +devices not really implemented + +keyboard queue not fully implemented (affects VSAFE) +several ioctl request not implemented (affects PKZOOM) +no font file +int 0x28 not implemented +timer chip not implemented +country info needs localization + +specific programs: +charc crashes with a segment overrun +sqwez gets a fault while exiting +jrc outputs its banner again on exit, and sometimes complains about aa.aaa Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/ParseBuffer.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/ParseBuffer.c Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1992, 1993, 1996 + * Berkeley Software Design, Inc. 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 Berkeley Software + * Design, Inc. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. + * + * BSDI ParseBuffer.c,v 2.2 1996/04/08 19:32:15 bostic Exp + */ + +#include +__FBSDID("$FreeBSD: projects/doscmd/ParseBuffer.c,v 1.5 2002/03/07 12:52:26 obrien Exp $"); + +#include +#include + +#include "doscmd.h" +int +ParseBuffer(obuf, av, mac) +char *obuf; +char **av; +int mac; +{ + static char *_buf; + char *buf; + static int buflen = 0; + int len; + + register char *b = buf; + register char *p; + register char **a; + register char **e; + + len = strlen(obuf) + 1; + if (len > buflen) { + if (buflen) + free(_buf); + buflen = (len + 1023) & ~1023; + _buf = malloc(buflen); + } + buf = _buf; + strcpy(buf, obuf); + + a = av; + e = &av[mac]; + + while (*buf) { + while (*buf == ' ' || *buf == '\t' || *buf == '\n') + ++buf; + if (*buf) { + p = b = buf; + + *a++ = buf; + if (a == e) { + a[-1] = (char *)0; + return(mac - 1); + } + + while (*p && !(*p == ' ' || *p == '\t' || *p == '\n')) { + *b++ = *p++ & 0177; + } + if (*p) + ++p; + *b = 0; + buf = p; + } + } + *a = (char *)0; + return(a - av); +} Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/README Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,37 @@ +/* BSDI README,v 2.2 1996/04/08 19:32:16 bostic Exp*/ +/* $FreeBSD: projects/doscmd/README,v 1.4 2002/05/16 02:18:59 trhodes Exp $ */ + +This is the merged doscmd/rundos project. Please read the man +page for help on configuring doscmd. + +Things known not to work: + * No mouse support (yet) + * No raw VGA support (yet) + * Printer support (yet) + * COM ports (being worked on) + * redirected filesystem only supported for DOS 4.0 and above + (3.3 will be supported in a future version) + * Graphics in an X window (only 16 colors, very few programs) + +Even with this, I think it is actually a much better product. There have +been problems reported with the ibmpc font and the distributed X server. +If you have that problem, try setting + + X11_FONT=fixed + +in your .doscmdrc. Be aware that graphics characters will not print correctly +if you do this. + +You will need to patch your kernel. Diffs are provided against the CD-ROM. +Please let me know if there are a problem with them (I am running a pre 1.1 +kernel now). + +It is possible there are some problems in the floppy code due to the fact +that I am not set up to test under 1.0 at this point. I will be in a few +days I hope. + +Please send all bug reports to prb@BSDI.COM. + + -Paul Borman + prb@BSDI.COM + Jan 4 1994 Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/README.booting_dos ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/README.booting_dos Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,98 @@ +/* BSDI README.booting_dos,v 2.2 1996/04/08 19:32:18 bostic Exp*/ +/* $FreeBSD: projects/doscmd/README.booting_dos,v 1.5 2002/05/16 02:18:59 trhodes Exp $ */ + +To install DOS on a pseudo hard disk under doscmd: + + 1) Create a .doscmdrc with at least the following: + + assign A: /dev/fd0.1440 1440 + assign A: /dev/fd0.720 720 + assign hard boot_drive 80 2 2 + + You may need to adjust the raw files for the A: drive to match + your system. This example will cause the HD drive to be tried + first and the DD drive second. + + Note that you should only use raw devices or files at this point, + do not use a cooked device! (Well, it would probably be okay + for a hard disk, but certainly not the floppy) + + boot_drive should be the file name of where you want your bootable + image to be. The three numbers which follow "80 2 2" say that the + drive will have 80 cylinders, 2 heads and 2 sectors per track. + This is the smallest drive possible which still can have MS DOS + 5.0 installed on it along with a config.sys and autoexec.bat file. + + You might want to create a larger boot drive. + + The file boot_drive must exist, so use the command touch to create + it. + + 2) Insert a floppy disk into the A: drive which is bootable to MS-DOS + and has the commands fdisk, format and sys on it. You should also + copy the file redir.com onto the floppy by either mounting it + with the msdos filesystem type or by using mtools. + + (i.e. mwrite redir.com a:) + + 3) run doscmd. + + 4) At the > prompt type "fdisk" + + 5) Select "Create DOS partition or Logical Drive" + + 6) Select "Create Primary DOS Partition" + + 7) Tell it how big to make it (I say use the whole drive. + It is pretty tiny after all.) + + 8) Get out of FDISK by hitting a few times. + + 9) doscmd will now abort (will try and fix this in a future version) + + 10) start up doscmd again, leaving the floppy in the drive. + + 11) At the > prompt, type "format c:" and follow the instructions. + + 12) At the > prompt type "sys c:" + + 13) Get out of doscmd. + + 14) Either remove the floppy from the drive or add the line + + boot C: + + to your .doscmdrc + + 15) You should now be running DOS off of your new disk. You will + probably want both config.sys and an autoexec.bat file. To + start with, you can say: + + > copy con: config.sys + LASTDRIVE=Z + ^Z + > copy con: autoexec.bat + @echo off + redir.com + ^Z + + + 16) Quit doscmd. + + 17) You now have a bootable pseudo disk which will automatically call + the magic "redir" program, which installs FreeBSD disks. To use + them add lines to your .doscmdrc such as: + + assign D: /usr/dos + assign P: -ro /usr/prb + + Note that you will not always be able to access every file due to + naming problems. + + 18) To use the new EMS memory you need to copy the file emsdriv.sys + to your DOS boot disk (disk image) in the same way you copied + redir.com. The use it in your "config.sys" from DOS: + device=C:\emsdriv.sys + where C: is your boot drive (supply the correct letter, if needed) + and emsdriv.sys is the driver. You could load it high. It should + report "Doscmd EMS 4.0 driver installed". Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c Wed Jul 18 10:04:39 2012 (r239530) @@ -0,0 +1,322 @@ +/* + * Copyright (c) 1992, 1993, 1996 + * Berkeley Software Design, Inc. 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 Berkeley Software + * Design, Inc. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. + * + * BSDI bios.c,v 2.3 1996/04/08 19:32:19 bostic Exp + */ + +#include +#include +__FBSDID("$FreeBSD: projects/doscmd/bios.c,v 1.9 2002/03/07 12:52:26 obrien Exp $"); + +#include "doscmd.h" +#include "mouse.h" +#include "com.h" + +#define BIOS_copyright 0xfe000 +#define BIOS_reset 0xfe05b +#define BIOS_nmi 0xfe2c3 +#define BIOS_hdisk_table 0xfe401 +#define BIOS_boot 0xfe6f2 +#define BIOS_comm_table 0xfe729 +#define BIOS_comm_io 0xfe739 +#define BIOS_keyboard_io 0xfe82e +#define BIOS_keyboard_isr 0xfe987 +#define BIOS_fdisk_io 0xfec59 +#define BIOS_fdisk_isr 0xfef57 +#define BIOS_disk_parms 0xfefc7 +#define BIOS_printer_io 0xfefd2 +#define BIOS_video_io 0xff065 +#define BIOS_video_parms 0xff0a4 +#define BIOS_mem_size 0xff841 +#define BIOS_equipment 0xff84d +#define BIOS_cassette_io 0xff859 +#define BIOS_video_font 0xffa6e +#define BIOS_time_of_day 0xffe6e +#define BIOS_timer_int 0xffea5 +#define BIOS_vector 0xffef3 +#define BIOS_dummy_iret 0xfff53 +#define BIOS_print_screen 0xfff54 +#define BIOS_hard_reset 0xffff0 +#define BIOS_date_stamp 0xffff5 +#define BIOS_hardware_id 0xffffe + +static u_char disk_params[] = { + 0xdf, 2, 0x25, 2, 0x0f, 0x1b, 0xff, 0x54, 0xf6, 0x0f, 8, +}; + +static u_short comm_table[] = { + 1047, 768, 384, 192, 96, 48, 24, 12, +}; + +/* exports */ + +int nfloppies = 0; +int ndisks = 0; +int nserial = 0; +int nparallel = 0; +unsigned long rom_config; + +/* +** BIOS equipment list +*/ +static void +int11(regcontext_t *REGS) +{ + R_AX = + (nfloppies ? 1:0) | /* do we have any floppydisks? */ + (0x2 << 4) | /* 80x25 colour */ + ((nfloppies-1) << 6) | /* how many floppies? */ + (nserial << 9) | /* serial ports? */ + (nparallel << 14); /* parallel ports? */ +} + +/* +** get installed memory +*/ +static void +int12(regcontext_t *REGS) +{ + R_AX = 640; +} + +/* +** assorted oddments +*/ +static void +int15(regcontext_t *REGS) +{ + const struct timespec rqtp={0,1}; + R_FLAGS &= ~PSL_C; + + switch (R_AH) { + case 0x00: /* Get Cassette Status */ + R_AH = 0x86; + R_FLAGS |= PSL_C; /* We don't support a cassette */ + break; + case 0x04: /* Set ABIOS table */ + R_FLAGS |= PSL_C; /* We don't support it */ + break; + case 0x10: /* DesqView */ + switch (R_AL) { + case 0x00: /* Give up CPU time */ + nanosleep(&rqtp, NULL); + break; + case 0x22: /* Get version */ + R_BH = 0x0a; /* Use v2.0 for timeslice support */ + R_BL = 0x01; + break; + } + break; + case 0x4f: /* Keyboard intercept */ + debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n"); + /* Don't translate scan code. */ + break; + case 0x88: + get_raw_extmemory_info(REGS); + break; + case 0xc0: /* Get configuration */ + debug(D_TRAPS | 0x15, "BIOS: Get configuration\n"); + PUTVEC(R_ES, R_BX, rom_config); + R_AH = 0; + break; + case 0xc1: /* Get extended BIOS data area */ + R_FLAGS |= PSL_C; + break; + case 0xc2: /* Pointing device */ + debug(D_TRAPS | 0x15, "BIOS: Pointing device?\n"); + R_FLAGS |= PSL_C; + R_AH = 5; /* No pointer */ + break; + default: + unknown_int2(0x15, R_AX, REGS); + break; + } +} + +void +bios_init(void) +{ + int i, j, k; + u_char *jtab; + struct timeval tv; + time_t tv_sec; + struct timezone tz; + struct tm tm; + u_long vec; + + strcpy((char *)BIOS_copyright, + "Copyright (C) 1993 Krystal Technologies/BSDI"); + + *(u_short *)BIOS_reset = 0xffcd; + *(u_short *)BIOS_nmi = 0xffcd; + *(u_short *)BIOS_boot = 0xffcd; + *(u_short *)BIOS_comm_io = 0xffcd; + *(u_short *)BIOS_keyboard_io = 0xffcd; + *(u_short *)BIOS_keyboard_isr = 0xffcd; + *(u_short *)BIOS_fdisk_io = 0xffcd; + *(u_short *)BIOS_fdisk_isr = 0xffcd; + *(u_short *)BIOS_printer_io = 0xffcd; + *(u_short *)BIOS_video_io = 0xffcd; + *(u_short *)BIOS_cassette_io = 0xffcd; + *(u_short *)BIOS_time_of_day = 0xffcd; + *(u_short *)BIOS_timer_int = 0xffcd; + *(u_short *)BIOS_dummy_iret = 0xffcd; + *(u_short *)BIOS_print_screen = 0xffcd; + *(u_short *)BIOS_hard_reset = 0xffcd; + *(u_short *)BIOS_mem_size = 0xffcd; + *(u_short *)BIOS_equipment = 0xffcd; + *(u_short *)BIOS_vector = 0xffcd; + *(u_char *)0xffff2 = 0xcf; /* IRET */ + + memcpy((u_char *)BIOS_disk_parms, disk_params, sizeof(disk_params)); + memcpy((u_char *)BIOS_comm_table, comm_table, sizeof(comm_table)); + + *(u_short *)BIOS_video_font = 0xffcd; + + jtab = (u_char *)BIOS_date_stamp; + *jtab++ = '1'; + *jtab++ = '0'; + *jtab++ = '/'; + *jtab++ = '3'; + *jtab++ = '1'; + *jtab++ = '/'; + *jtab++ = '9'; + *jtab++ = '3'; + + *(u_char *)BIOS_hardware_id = 0xfc; /* Identify as a PC/AT */ + + /* + * Interrupt revectors F000:0000 - F000:03ff + */ + for (i = 0, j = 0, k = 0; i < 0x100; ++i) { + if ((i >= 0x60 && i < 0x68) || + (i >= 0x78 && i < 0xe2)) + continue; + if ((i >= 0x00 && i < 0x2f) || + (i >= 0x30 && i < 0xfe)) { + ivec[i] = 0xF0300000L | (k * 1); + jtab = (u_char *)VECPTR(ivec[i]); + *jtab++ = 0xf4; /* HLT */ + ++k; + } else { + ivec[i] = 0xF0000000L | (j * 6); + jtab = (u_char *)VECPTR(ivec[i]); + *jtab++ = 0xcd; /* INT i */ + *jtab++ = i; + *jtab++ = 0xca; /* RETF 2 */ + *jtab++ = 2; + *jtab++ = 0; + ++j; + } + } + + /* + * Misc variables from F000:0400 - F000:0fff + */ + rom_config = 0xF0000400; + jtab = (u_char *)VECPTR(rom_config); + *jtab++ = 20; /* length of entry */ + *jtab++ = 0; + *jtab++ = *(u_char *)BIOS_hardware_id; + *jtab++ = 0x00; /* Sub model */ + *jtab++ = 0x01; /* Bios Rev Enhanced kbd w/3.5" floppy */ + *jtab++ = 0x20; /* real time clock present */ + *jtab++ = 0; /* Reserved */ + *jtab++ = 0; + *jtab++ = 0; + *jtab++ = 0; + strcpy((char *)jtab, "BSDI BIOS"); + *jtab += 10; + + InDOS = jtab++; + *InDOS = 0; + + mouse_area = jtab; + jtab += 0x10; + + *(u_short *)&BIOSDATA[0x10] = + (1 << 0) | /* Diskette avail for boot */ + (1 << 1) | /* Math co-processor */ + (nmice << 2) | /* No pointing device */ + (2 << 4) | /* Initial video (80 x 25 C) */ + ((nfloppies - 1) << 6) | /* Number of floppies - 1 */ + (nserial << 9) | /* Number of serial devices */ + (nparallel << 14); /* Number of parallel devices */ + + + *(u_short *)&BIOSDATA[0x13] = 640; /* Amount of memory */ + BIOSDATA[0x75] = ndisks; /* number of fixed disks */ + + BIOSDATA[0x8F] = 0; + if (nfloppies >= 1) { + BIOSDATA[0x8F] |= 0x04; + BIOSDATA[0x90] = 0x40; + } + if (nfloppies >= 2) { + BIOSDATA[0x8F] |= 0x40; + BIOSDATA[0x91] = 0x40; + } + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***