Date: Wed, 18 Jul 2012 15:50:57 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r239547 - soc2012/syuu/bhyve-bios/lib/libbiosemul Message-ID: <20120718155057.D1774106564A@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: syuu Date: Wed Jul 18 15:50:56 2012 New Revision: 239547 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239547 Log: refactoring doscmd program to library. only provides int13h handling for now. Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c - copied, changed from r239530, soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.c soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h Replaced: soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h - copied, changed from r239530, soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h Deleted: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile.dos 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/config.c soc2012/syuu/bhyve-bios/lib/libbiosemul/crt0.c 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/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/exe.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int2f.c soc2012/syuu/bhyve-bios/lib/libbiosemul/intff.c soc2012/syuu/bhyve-bios/lib/libbiosemul/net.c soc2012/syuu/bhyve-bios/lib/libbiosemul/redir.S soc2012/syuu/bhyve-bios/lib/libbiosemul/redir.com.uu soc2012/syuu/bhyve-bios/lib/libbiosemul/setver.c soc2012/syuu/bhyve-bios/lib/libbiosemul/xms.c soc2012/syuu/bhyve-bios/lib/libbiosemul/xms.h Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile 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/cpu.c soc2012/syuu/bhyve-bios/lib/libbiosemul/cwd.c soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int14.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/port.c soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h soc2012/syuu/bhyve-bios/lib/libbiosemul/signal.c soc2012/syuu/bhyve-bios/lib/libbiosemul/timer.c soc2012/syuu/bhyve-bios/lib/libbiosemul/trap.c soc2012/syuu/bhyve-bios/lib/libbiosemul/tty.c soc2012/syuu/bhyve-bios/lib/libbiosemul/video.c Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile Wed Jul 18 15:50:56 2012 (r239547) @@ -2,53 +2,19 @@ # # $FreeBSD: projects/doscmd/Makefile,v 1.39 2004/03/30 17:10:01 des Exp $ -PROG= doscmd +LIB= biosemul 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} +SRCS= biosemul.c \ + bios.c callback.c \ + debug.c i386-pinsn.c \ + int13.c +INCS= biosemul.h 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 +CLEANFILES= ${FONTFILES} ${FONTHDRS} -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 @@ -59,9 +25,6 @@ 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} @@ -74,7 +37,4 @@ uudecode -p ${.ALLSRC} | \ file2c 'u_int8_t font8x16[] = {' '};' > ${.TARGET} -redir.com: redir.com.uu - uudecode ${.CURDIR}/redir.com.uu - -.include <bsd.prog.mk> +.include <bsd.lib.mk> Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c Wed Jul 18 15:50:56 2012 (r239547) @@ -80,8 +80,9 @@ int ndisks = 0; int nserial = 0; int nparallel = 0; -unsigned long rom_config; +u_int32_t rom_config; +#if 0 /* ** BIOS equipment list */ @@ -137,9 +138,11 @@ debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n"); /* Don't translate scan code. */ break; +#if 0 case 0x88: get_raw_extmemory_info(REGS); break; +#endif case 0xc0: /* Get configuration */ debug(D_TRAPS | 0x15, "BIOS: Get configuration\n"); PUTVEC(R_ES, R_BX, rom_config); @@ -158,17 +161,20 @@ break; } } +#endif void bios_init(void) { int i, j, k; u_char *jtab; +#if 0 struct timeval tv; time_t tv_sec; struct timezone tz; struct tm tm; - u_long vec; + u_int32_t vec; +#endif strcpy((char *)BIOS_copyright, "Copyright (C) 1993 Krystal Technologies/BSDI"); @@ -254,16 +260,21 @@ strcpy((char *)jtab, "BSDI BIOS"); *jtab += 10; +#if 0 InDOS = jtab++; *InDOS = 0; mouse_area = jtab; +#endif jtab += 0x10; *(u_short *)&BIOSDATA[0x10] = (1 << 0) | /* Diskette avail for boot */ (1 << 1) | /* Math co-processor */ +#if 0 (nmice << 2) | /* No pointing device */ +#endif + (0 << 2) | (2 << 4) | /* Initial video (80 x 25 C) */ ((nfloppies - 1) << 6) | /* Number of floppies - 1 */ (nserial << 9) | /* Number of serial devices */ @@ -283,10 +294,11 @@ BIOSDATA[0x91] = 0x40; } +#if 0 gettimeofday(&tv, &tz); tv_sec = tv.tv_sec; tm = *localtime(&tv_sec); - *(u_long *)&BIOSDATA[0x6c] = + *(u_int32_t *)&BIOSDATA[0x6c] = (((tm.tm_hour * 60 + tm.tm_min) * 60) + tm.tm_sec) * 182 / 10; vec = insert_softint_trampoline(); @@ -319,4 +331,5 @@ vec = insert_softint_trampoline(); ivec[0x1a] = vec; register_callback(vec, int1a, "int 1a"); +#endif } Copied and modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c (from r239530, soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.c) ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.c Wed Jul 18 10:04:39 2012 (r239530, copy source) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c Wed Jul 18 15:50:56 2012 (r239547) @@ -52,11 +52,11 @@ #include <sys/proc.h> #include <machine/sysarch.h> +#if 0 #include <machine/vm86.h> +#endif #include "doscmd.h" -#include "cwd.h" -#include "trap.h" #include "tty.h" #include "video.h" @@ -69,7 +69,8 @@ int raw_kbd = 0; int timer_disable = 0; struct timeval boot_time; -unsigned long *ivec = (unsigned long *)0; +u_int32_t *ivec = (u_int32_t *)0; +char *lomem_addr = NULL; #ifndef USE_VM86 #define PRB_V86_FORMAT 0x4242 @@ -82,6 +83,7 @@ }; #endif +#if 0 /* local prototypes */ static void setup_boot(regcontext_t *REGS); static int try_boot(int); @@ -103,128 +105,30 @@ char cmdname[256]; /* referenced from dos.c */ static struct vm86_init_args kargs; - -/* lobotomise */ -int -main(int argc, char **argv) -{ -#ifndef USE_VM86 - ucontext_t uc; -#else - struct vm86_struct vm86s; -#define sc vm86s.substr.regs.vmsc #endif - regcontext_t *REGS = (regcontext_t *)&uc.uc_mcontext; - int fd; - int i; - sigset_t sigset; - - sigemptyset(&sigset); - sigaddset(&sigset, SIGIO); - sigaddset(&sigset, SIGALRM); - sigprocmask(SIG_BLOCK, &sigset, 0); - init_ints(); +#define HDISK_CYL 0 +#define HDISK_HEAD 0 +#define HDISK_TRACK 0 +#define HDISK_FILE "diskdev" +/* lobotomise */ +void biosemul_init(char *lomem) +{ + lomem_addr = lomem; debugf = stderr; - /* XXX should only be for tty mode */ - fd = open (_PATH_DEVNULL, O_RDWR); - if (fd != 3) - dup2 (fd, 3); /* stdaux */ - if (fd != 4) - dup2 (fd, 4); /* stdprt */ - if (fd != 3 && fd != 4) - close (fd); - fd = -1; debug_set(0); /* debug any D_TRAPS without intnum */ - - /* perform option argument processing */ - do_args(argc, argv); - argc -= optind; - argv += optind; - - if (vflag && debugf == stderr) { - debugf = stdout; - setbuf (stdout, NULL); - } - - if (!initHMA()) { - return 1; - } - - /* This needs to happen before the executable is loaded */ - mem_init(); - -#ifdef USE_VM86 - memset(&vm86s, 0, sizeof(vm86s)); -#endif - - /* - * With no other arguments we will assume we must boot DOS - */ - if (argc <= 0) - booting = 1; - -#if 1 - /* - * Nominate interrupts to handle here when the kernel is - * performing interrupt handling. - * - * I would like to let INT 2F pass through as well, but I - * need to get my hands on INT 2F:11 to do file redirection. - */ - for (i = 0; i <= 0xff; ++i) { - switch (i) { - case 0x2f: - case 0xff: -#if 1 - kargs.int_map[i >> 3] |= (1 << (i & 7)); -#ifndef USE_VM86 - vconnect_area.passthru[i >> 5] &= ~(1 << (i & 0x1f)); -#else - vm86s.int_byuser[i >> 3] |= (1 << (i & 0x07)); -#endif -#endif - break; - default: -#if 1 - kargs.int_map[i >> 3] &= ~(1 << (i & 7)); -#ifndef USE_VM86 - vconnect_area.passthru[i >> 5] |= (1 << (i & 0x1f)); -#else - vm86s.int_byuser[i >> 3] |= (1 << (i & 0x07)); -#endif -#endif - break; - } - } -#endif - - if (booting) { /* are we booting? */ - setup_boot(REGS); - } else { /* no, load a command */ - setup_command(argc, argv, REGS); - } - - /* install signal handlers */ - setsignal(SIGFPE, sigfpe); /* */ - setsignal(SIGALRM, sigalrm); /* */ - setsignal(SIGILL, sigill); /* */ - setsignal(SIGTRAP, sigtrap); /* */ - setsignal(SIGUSR2, sigtrace); /* */ - setsignal(SIGINFO, sigtrace); /* */ -#ifdef USE_VM86 - setsignal(SIGURG, sigurg); /* entry from NetBSD vm86 */ -#else - setsignal(SIGBUS, sigbus); /* entry from FreeBSD, BSD/OS vm86 */ -#endif +#if 0 /* Call init functions */ if (raw_kbd) console_init(); init_io_port_handlers(); +#endif bios_init(); + init_hdisk(3, HDISK_CYL, HDISK_HEAD, HDISK_TRACK, HDISK_FILE, NULL); +#if 0 cpu_init(); kbd_init(); kbd_bios_init(); @@ -234,69 +138,16 @@ video_bios_init(); disk_bios_init(); cmos_init(); - xms_init(); - dos_init(); - net_init(); - speaker_init(); +#endif +#if 0 timer_init(); /* iomap_init(); */ gettimeofday(&boot_time, 0); - - if (zflag) for (;;) pause(); /* spin if requested */ - - if (raw_kbd) { - /* - * If we have a raw keyboard, and hence, video, - * sneak in a call to the video BIOS to reinit the - * the video display. - */ - u_long video_vector; - static u_char video_trampoline[] = { - 0x60, /* pusha */ - 0xB8, 0x03, 0x00, /* mov ax,00003h */ - 0xCD, 0x10, /* int 010h */ - 0x61, /* popa */ - 0xCF, /* iret */ - }; - - video_vector = insert_generic_trampoline( - sizeof(video_trampoline), video_trampoline); - - PUSH(R_FLAGS, REGS); - PUSH(R_CS, REGS); - PUSH(R_IP, REGS); - PUTVEC(R_CS, R_IP, video_vector); - } - - sigemptyset(&uc.uc_sigmask); - sigaltstack(NULL, &uc.uc_stack); - uc.uc_mcontext.mc_onstack = 0; - - if (tmode) - tracetrap(REGS); - -#ifndef USE_VM86 - R_EAX = (booting || raw_kbd) ? (int)&vconnect_area : -1; - R_EFLAGS |= PSL_VM | PSL_VIF; /* request VM86 mode */ - - i386_vm86(VM86_INIT, &kargs); - - sigreturn(&uc); - debug(D_ALWAYS,"sigreturn failed : %s\n", strerror(errno)); -#else - vm86s.cpu_type = VCPU_586; - i386_vm86(&vm86s); #endif - - /* shouldn't get here */ - if (vflag) dump_regs(REGS); - fatal ("vm86 returned (no kernel support?)\n"); -#undef sc - /* quiet -Wall */ - return 0; } +#if 0 /* ** setup_boot ** @@ -305,27 +156,6 @@ static void setup_boot(regcontext_t *REGS) { - FILE *fp; /* doscmdrc handle */ - int fd; /* don't close this! */ - - fp = find_doscmdrc(); /* get doscmdrc */ - if (!fp) { - fprintf(stderr, "You must have a doscmdrc to boot\n"); - quit(1); - } - - booting = read_config(fp); /* where to boot from? */ - fclose(fp); - if (booting < 0) { /* not specified */ - if ((fd = try_boot(booting = 0)) < 0) /* try A: */ - fd = try_boot(booting = 2); /* try C: */ - } else { - fd = try_boot(booting); /* do like the man says */ - } - - if (fd < 0) - errx(1, "Failed to boot"); - /* initialise registers for entry to bootblock */ R_EFLAGS = 0x20202; R_CS = 0x0000; @@ -797,6 +627,7 @@ fprintf(stderr, "Environment full, ignoring %s\n", value); } } +#endif /* ** replicate a fd up at the top of the range @@ -819,6 +650,7 @@ return(fd); } +#if 0 /* ** Exit-time stuff */ @@ -850,6 +682,7 @@ } exec_return(REGS, val); } +#endif typedef struct COQ { void (*func)(void *); @@ -920,6 +753,7 @@ } #endif +#if 0 /* This is used to map in only the specified port range, instead of all the ports or only certain port ranges. */ @@ -931,3 +765,4 @@ debug(D_PORT,"mapped I/O port: port=%#x count=%d\n", port, count); } +#endif Added: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h ============================================================================== Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c Wed Jul 18 15:50:56 2012 (r239547) @@ -13,7 +13,7 @@ struct callback { LIST_ENTRY(callback) chain; - u_long vec; + u_int32_t vec; callback_t func; const char *name; }; @@ -26,7 +26,7 @@ ** Register (func) as a handler for (vec) */ void -register_callback(u_long vec, callback_t func, const char *name) +register_callback(u_int32_t vec, callback_t func, const char *name) { struct cbhead *head; struct callback *elm; @@ -44,7 +44,7 @@ ** Find a handler for (vec) */ callback_t -find_callback(u_long vec) +find_callback(u_int32_t vec) { struct cbhead *head; struct callback *elm; @@ -60,7 +60,7 @@ return ((callback_t)0); } -u_long trampoline_rover = 0xF1000000; +u_int32_t trampoline_rover = 0xF1000000; /* * Interrupts are disabled on an INTn call, so we must restore interrupts @@ -103,11 +103,11 @@ 0xcf, /* IRET */ }; -u_long +u_int32_t insert_generic_trampoline(size_t len, u_char *p) { u_char *q; - u_long where; + u_int32_t where; where = trampoline_rover; q = (u_char *)VECPTR(where); @@ -116,28 +116,28 @@ return (where); } -u_long +u_int32_t insert_softint_trampoline(void) { return (insert_generic_trampoline( sizeof(softint_trampoline), softint_trampoline)); } -u_long +u_int32_t insert_fossil_softint_trampoline(void) { return (insert_generic_trampoline( sizeof(fossil_softint_trampoline), fossil_softint_trampoline)); } -u_long +u_int32_t insert_hardint_trampoline(void) { return (insert_generic_trampoline( sizeof(hardint_trampoline), hardint_trampoline)); } -u_long +u_int32_t insert_null_trampoline(void) { return (insert_generic_trampoline( Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.h ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.h Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.h Wed Jul 18 15:50:56 2012 (r239547) @@ -5,10 +5,10 @@ */ typedef void (*callback_t)(regcontext_t *); -void register_callback(u_long, callback_t, const char *); -callback_t find_callback(u_long); -u_long insert_generic_trampoline(size_t, u_char *); -u_long insert_softint_trampoline(void); -u_long insert_fossil_softint_trampoline(void); -u_long insert_hardint_trampoline(void); -u_long insert_null_trampoline(void); +void register_callback(u_int32_t, callback_t, const char *); +callback_t find_callback(u_int32_t); +u_int32_t insert_generic_trampoline(size_t, u_char *); +u_int32_t insert_softint_trampoline(void); +u_int32_t insert_fossil_softint_trampoline(void); +u_int32_t insert_hardint_trampoline(void); +u_int32_t insert_null_trampoline(void); Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c Wed Jul 18 15:50:56 2012 (r239547) @@ -72,7 +72,7 @@ void cpu_init(void) { - u_long vec; + u_int32_t vec; vec = insert_hardint_trampoline(); ivec[0x00] = vec; @@ -121,7 +121,7 @@ emu_instr(regcontext_t *REGS) { int prefix = 1; - u_int8_t *cs = (u_int8_t *)(R_CS << 4); + u_int8_t *cs = (u_int8_t *)(uintptr_t)(R_CS << 4); int ip = R_IP; int dir, i, instrlen; u_int8_t *r8; @@ -400,7 +400,7 @@ if (addr >= 0xa0000 && addr < 0xb0000) return vga_read(addr); else - return *(u_int8_t *)addr; + return *(u_int8_t *)(uintptr_t)addr; } /* Write an 8-bit value to the location specified by 'addr'. If 'addr' lies @@ -411,7 +411,7 @@ if (addr >= 0xa0000 && addr < 0xb0000) vga_write(addr, val); else - *(u_int8_t *)addr = val; + *(u_int8_t *)(uintptr_t)addr = val; return; } @@ -425,7 +425,7 @@ vga_write(addr, (u_int8_t)(val & 0xff)); vga_write(addr + 1, (u_int8_t)((val & 0xff00) >> 8)); } else - *(u_int16_t *)addr = val; + *(u_int16_t *)(uintptr_t)addr = val; return; } Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/cwd.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/cwd.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/cwd.c Wed Jul 18 15:50:56 2012 (r239547) @@ -854,7 +854,7 @@ int error; search_t *search = &dir_search; - debug(D_REDIR, "find_first(%s, %x, %x)\n", path, attr, (int)dta); + debug(D_REDIR, "find_first(%s, %x, %p)\n", path, attr, dta); error = dos_makepath(path, new_path); if (error) Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c Wed Jul 18 15:50:56 2012 (r239547) @@ -36,9 +36,12 @@ __FBSDID("$FreeBSD: projects/doscmd/debug.c,v 1.8 2002/03/07 12:52:26 obrien Exp $"); #include <stdarg.h> +#include <inttypes.h> #include "doscmd.h" +#if 0 #include "tty.h" +#endif /* debug output goes here */ FILE *debugf; @@ -50,8 +53,8 @@ int vflag = 0; /* interrupts to trace */ -#define BPW (sizeof(u_long) << 3) -u_long debug_ints[256/BPW]; +#define BPW (sizeof(u_int32_t) << 3) +u_int32_t debug_ints[256/BPW]; /* Debug flag manipulation */ void @@ -68,7 +71,7 @@ debug_ints[x/BPW] &= ~(1 << (x & (BPW - 1))); } -u_long +u_int32_t debug_isset(int x) { x &= 0xff; @@ -104,6 +107,7 @@ { va_list args; +#if 0 dead = 1; if (xmode && !quietmode) { @@ -126,12 +130,16 @@ for (;;) tty_pause(); } +#endif va_start (args, fmt); fprintf (debugf, "doscmd: fatal error "); vfprintf (debugf, fmt, args); va_end (args); +#if 0 quit (1); +#endif + exit (1); } /* @@ -148,7 +156,7 @@ debug (D_ALWAYS, "ax=%04x bx=%04x cx=%04x dx=%04x\n", R_AX, R_BX, R_CX, R_DX); debug (D_ALWAYS, "si=%04x di=%04x sp=%04x bp=%04x\n", R_SI, R_DI, R_SP, R_BP); debug (D_ALWAYS, "cs=%04x ss=%04x ds=%04x es=%04x\n", R_CS, R_SS, R_DS, R_ES); - debug (D_ALWAYS, "ip=%x eflags=%lx\n", R_IP, R_EFLAGS); + debug (D_ALWAYS, "ip=%x eflags=%"PRIx32"\n", R_IP, R_EFLAGS); addr = (u_char *)MAKEPTR(R_CS, R_IP); Copied and modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h (from r239530, soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h) ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h Wed Jul 18 10:04:39 2012 (r239530, copy source) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h Wed Jul 18 15:50:56 2012 (r239547) @@ -62,7 +62,6 @@ #endif #include "register.h" -#include "dos.h" #include "callback.h" #define drlton(a) ((islower((a)) ? toupper((a)) : (a)) - 'A') @@ -82,25 +81,23 @@ struct vconnect_area { int int_state; int magic; /* 0x4242 -> PRB format */ - u_long passthru[256>>5]; /* bitmap of INTs to handle */ - u_long magiciret[2]; /* Bounds of "magic" IRET */ + u_int32_t passthru[256>>5]; /* bitmap of INTs to handle */ + u_int32_t magiciret[2]; /* Bounds of "magic" IRET */ }; extern struct vconnect_area vconnect_area; #define IntState vconnect_area.int_state -/* ParseBuffer.c */ -int ParseBuffer(char *, char **, int); - /* bios.c */ -#define BIOSDATA ((u_char *)0x400) -extern unsigned long rom_config; +#define BIOSDATA ((u_char *)(0x400 + lomem_addr)) +extern u_int32_t rom_config; extern int nfloppies; extern int ndisks; extern int nserial; extern int nparallel; -extern volatile int poll_cnt; void bios_init(void); +#if 0 +extern volatile int poll_cnt; void wakeup_poll(void); void reset_poll(void); void sleep_poll(void); @@ -108,11 +105,6 @@ /* cmos.c */ extern time_t delta_clock; -void cmos_init(void); - -/* config.c */ -int read_config(FILE *fp); - /* cpu.c */ void cpu_init(void); int emu_instr(regcontext_t *); @@ -120,6 +112,7 @@ void int01(regcontext_t *); void int03(regcontext_t *); void int0d(regcontext_t *); +#endif /* debug.c */ extern int vflag; @@ -166,10 +159,12 @@ void dump_regs(regcontext_t *); void debug_set(int); void debug_unset(int); -u_long debug_isset(int); +u_int32_t debug_isset(int); +#if 0 /* disktab.c */ int map_type(int, int *, int *, int *); +#endif /* doscmd.c */ extern int capture_fd; @@ -181,7 +176,7 @@ extern int timer_disable; extern char cmdname[]; extern struct timeval boot_time; -extern unsigned long *ivec; +extern u_int32_t *ivec; int _prog(char *); void call_on_quit(void (*)(void *), void *); @@ -192,17 +187,20 @@ void quit(int); int squirrel_fd(int); +#if 0 /* ems.c */ int ems_init(void); void ems_entry(regcontext_t *); /* emuint.c */ extern void emuint(regcontext_t *REGS); +#endif /* i386-pinsn.c */ extern int i386dis(unsigned short, unsigned short, unsigned char *, char *, int); +#if 0 /* int.c */ void init_ints(void); int isinhardint(int); @@ -215,6 +213,7 @@ /* int10.c */ extern void int10(regcontext_t *); +#endif /* int13.c */ extern int init_hdisk(int drive, int cyl, int head, int tracksize, @@ -223,8 +222,11 @@ extern int disk_fd(int drive); extern void make_readonly(int drive); extern int search_floppy(int i); +#if 0 extern void disk_bios_init(void); +#endif +#if 0 /* int14.c */ extern int fossil; @@ -241,35 +243,24 @@ /* int1a.c */ void int1a(regcontext_t *); -/* int2f.c */ -extern void int2f(regcontext_t *); - -/* intff.c */ -extern int int2f_11(regcontext_t *REGS); -extern void intff(regcontext_t *REGS); - /* mem.c */ extern char *dosmem; extern void mem_init(void); extern int mem_alloc(int size, int owner, int *biggestp); -extern int mem_adjust(int addr, int size, int *availp); +extern int mem_adjust(long addr, int size, int *availp); extern void mem_free_owner(int owner); -extern void mem_change_owner(int addr, int owner); +extern void mem_change_owner(long addr, int owner); /* mouse.c */ void int33(regcontext_t *); void mouse_init(void); -/* net.c */ -void net_init(void); - /* port.c */ void define_input_port_handler(int, unsigned char (*)(int)); void define_output_port_handler(int, void (*)(int, unsigned char)); void inb(regcontext_t *, int); unsigned char inb_port(int); -unsigned char inb_speaker(int); unsigned char inb_traceport(int); void init_io_port_handlers(void); void insb(regcontext_t *, int); @@ -277,12 +268,10 @@ void inx(regcontext_t *, int); void outb(regcontext_t *, int); void outb_port(int, unsigned char); -void outb_speaker(int, unsigned char); void outb_traceport(int, unsigned char); void outsb(regcontext_t *, int); void outsx(regcontext_t *, int); void outx(regcontext_t *, int); -void speaker_init(void); /* setver.c */ extern void setver(char *, short); @@ -306,6 +295,7 @@ extern int int2f_43(regcontext_t *REGS); extern int initHMA(void); extern void xms_init(void); -extern u_long xms_maxsize; +extern u_int32_t xms_maxsize; +#endif /****************************** dirty below here *****************************/extern int nmice; Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c Wed Jul 18 15:50:56 2012 (r239547) @@ -23,6 +23,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: projects/doscmd/int.c,v 1.8 2002/03/30 13:51:40 dwmalone Exp $"); +#include <inttypes.h> + #include "doscmd.h" struct IRQ { @@ -52,6 +54,7 @@ return Irqs[irql].within; } +#if 0 static void set_vip(void) { @@ -71,10 +74,12 @@ R_EFLAGS &= ~PSL_VIP; } +#endif void resume_interrupt(void) { +#if 0 regcontext_t *REGS = saved_regcontext; int irql; @@ -94,6 +99,7 @@ } } set_vip(); +#endif } void @@ -118,8 +124,9 @@ void hardint(int irql) { +#if 0 regcontext_t *REGS = saved_regcontext; - u_long vec = ivec[8 + irql]; + u_int32_t vec = ivec[8 + irql]; /* ** if we're dead, or there's no vector, or the saved registers @@ -146,7 +153,7 @@ return; } - debug(D_TRAPS | (8 + irql), "Int%02x [%04lx:%04lx]\n", + debug(D_TRAPS | (8 + irql), "Int%02x [%04"PRIx32":%04"PRIx32"]\n", 8 + irql, vec >> 16, vec & 0xffff); Irql = irql; @@ -159,15 +166,18 @@ PUSH(R_IP, REGS); R_EFLAGS &= ~PSL_VIF; /* XXX disable interrupts */ PUTVEC(R_CS, R_IP, vec); +#endif } void unpend(int irql) { +#if 0 if (!Irqs[irql].pending) return; Irqs[irql].pending = 0; set_vip(); +#endif } static unsigned char @@ -204,7 +214,7 @@ softint(int intnum) { regcontext_t *REGS = saved_regcontext; - u_long vec = ivec[intnum]; + u_int32_t vec = ivec[intnum]; /* ** if we're dead, or there's no vector or the saved registers are @@ -220,7 +230,7 @@ if ((vec >> 16) == 0xf000 || *(u_char *)VECPTR(vec) == 0xcf) return; - debug(D_TRAPS | intnum, "INT %02x [%04lx:%04lx]\n", + debug(D_TRAPS | intnum, "INT %02x [%04"PRIx32":%04"PRIx32"]\n", intnum, vec >> 16, vec & 0xffff); PUSH((R_FLAGS & ~PSL_I) | (R_EFLAGS & PSL_VIF ? PSL_I : 0), REGS); Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Wed Jul 18 15:16:07 2012 (r239546) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Wed Jul 18 15:50:56 2012 (r239547) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120718155057.D1774106564A>