o take over maintainership

o too many changes to mention specifically, but amongst them:
	- better error reporting
	- openbsd boots, freebsd boots
	- new 'term' flavor, I added a textmode interface, the only drawback
	  is that control-c is intercepted, and you must kill -9 it from
	  another tty if it doesn't exit normally
	- new flavors:
		- debugger -> debug (for shortness)
		- i386
		- pci
		- smp
		- net (compiles, does not yet provide networking, if anyone
			wants to help, I'd be ELATED to have this fixed!)
		- no_x11 (made it actually work)
		- term (make sure to use 'log: /dev/null' or something else
		  on the cmdline, otherwise, debugging and the screen will
		  start getting quite confusing!)
	- better error reporting (and no error reporting where it is not
	  necessary; a typicall boot of cdrom28.fs is a screenful of output now)
	- in general, if the hardware reaches an unknown state, fail
	  gracefully instead of calling exit(1) .. are we trying to work or
	  are we trying to .. fail?  I like working myself.
This commit is contained in:
todd 2001-02-02 16:59:05 +00:00
parent 4caa06ae70
commit 923f7975fe
87 changed files with 16993 additions and 18 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.9 2000/07/22 09:09:23 brad Exp $
# $OpenBSD: Makefile,v 1.10 2001/02/02 16:59:05 todd Exp $
SUBDIR += bochs
SUBDIR += bochs:debugger
SUBDIR += bochs:debug
SUBDIR += frodo
SUBDIR += freebsd_lib
SUBDIR += linux_lib

View File

@ -1,14 +1,14 @@
# $OpenBSD: Makefile,v 1.15 2000/07/18 05:16:58 brad Exp $
# $OpenBSD: Makefile,v 1.16 2001/02/02 16:59:06 todd Exp $
# $NetBSD: Makefile,v 1.2 1998/09/22 06:11:36 garbled Exp $
DISTNAME= bochs-2000_0325a
CATEGORIES= emulators
NEED_VERSION= 1.310
MASTER_SITES= ftp://ftp.bochs.com/pub/
MASTER_SITES= ftp://ftp.bochs.com/bochs/
HOMEPAGE= http://www.bochs.com/
MAINTAINER= ports@openbsd.org
MAINTAINER= Todd T. Fries <todd@OpenBSD.org>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
@ -16,14 +16,46 @@ PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS= --with-x11 --enable-vga --enable-cpu-level="4" \
CONFIGURE_ARGS= --enable-vga \
--enable-fpu --enable-cdrom
FLAVORS= debugger
FLAVORS= debug i386 i586 pci smp net no_x11 term
FLAVOR?=
.if ${FLAVOR:L} == "debugger"
CONFIGURE_ARGS+= --enable-debugger --enable-disasm
.if ${FLAVOR:L:Mdebug}
CONFIGURE_ARGS+= --enable-debugger --enable-disasm --enable-x86-debugger
.endif
.if ${FLAVOR:L:Mno_x11}
CONFIGURE_ARGS+= --with-nogui
.else
.if ${FLAVOR:L:Mterm}
CONFIGURE_ARGS+= --with-term
.else
CONFIGURE_ARGS+= --with-x11
.endif
.endif
.if ${FLAVOR:L:Mi386}
CONFIGURE_ARGS+= --enable-cpu-level="3"
.else
. if ${FLAVOR:L:Mi586}
CONFIGURE_ARGS+= --enable-cpu-level="5"
. else
CONFIGURE_ARGS+= --enable-cpu-level="4"
. endif
.endif
.if ${FLAVOR:L:Mpci}
CONFIGURE_ARGS+= --enable-pci
.endif
.if ${FLAVOR:L:Msmp}
CONFIGURE_ARGS+= --enable-num-sim=2
.endif
.if ${FLAVOR:L:Mnet}
CONFIGURE_ARGS+= --enable-ne2000
.endif
post-extract:

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-Makefile_in,v 1.1 2001/02/02 16:59:06 todd Exp $
--- Makefile.in.orig Sat Mar 25 21:47:45 2000
+++ Makefile.in Thu Oct 19 18:52:44 2000
@@ -45,6 +45,7 @@ GUI_LINK_OPTS_WIN32_VCPP = user32.lib gd
comdlg32.lib comctl32.lib wsock32.lib
GUI_LINK_OPTS_MACOS =
GUI_LINK_OPTS_NOGUI =
+GUI_LINK_OPTS_TERM = -ltermlib
GUI_LINK_OPTS = @GUI_LINK_OPTS@
RANLIB = @RANLIB@

View File

@ -0,0 +1,142 @@
$OpenBSD: patch-bochs_h,v 1.1 2001/02/02 16:59:06 todd Exp $
--- bochs.h.orig Sat Mar 25 21:24:57 2000
+++ bochs.h Mon Oct 23 22:12:42 2000
@@ -69,6 +69,10 @@ extern "C" {
#include "config.h"
#include "debug/debug.h"
+
+#include "bxio.h"
+
+void bx_signal_handler(int signum);
//
// some macros to interface the CPU and memory to external environment
// so that these functions can be redirected to the debugger when
@@ -77,20 +81,20 @@ extern "C" {
#if ((BX_DEBUGGER == 1) && (BX_NUM_SIMULATORS >= 2))
// =-=-=-=-=-=-=- Redirected to cosimulation debugger -=-=-=-=-=-=-=
-#define BX_VGA_MEM_READ(addr) bx_dbg_ucmem_read(addr)
-#define BX_VGA_MEM_WRITE(addr, val) bx_dbg_ucmem_write(addr, val)
+#define BX_VGA_MEM_READ(addr) bio->getdbg()_ucmem_read(addr)
+#define BX_VGA_MEM_WRITE(addr, val) bio->getdbg()_ucmem_write(addr, val)
#if BX_SUPPORT_A20
# define A20ADDR(x) ( (x) & bx_pc_system.a20_mask )
#else
# define A20ADDR(x) (x)
#endif
-#define BX_INP(addr, len) bx_dbg_inp(addr, len)
-#define BX_OUTP(addr, val, len) bx_dbg_outp(addr, val, len)
+#define BX_INP(addr, len) bio->getdbg()_inp(addr, len)
+#define BX_OUTP(addr, val, len) bio->getdbg()_outp(addr, val, len)
#define BX_HRQ (bx_pc_system.HRQ)
-#define BX_RAISE_HLDA() bx_dbg_raise_HLDA()
+#define BX_RAISE_HLDA() bio->getdbg()_raise_HLDA()
#define BX_TICK1()
#define BX_INTR bx_pc_system.INTR
-#define BX_SET_INTR(b) bx_dbg_set_INTR(b)
+#define BX_SET_INTR(b) bio->getdbg()_set_INTR(b)
#if BX_SIM_ID == 0
# define BX_CPU_C bx_cpu0_c
# define BX_CPU bx_cpu0
@@ -102,7 +106,7 @@ extern "C" {
# define BX_MEM_C bx_mem1_c
# define BX_MEM bx_mem1
#endif
-#define BX_SET_ENABLE_A20(enabled) bx_dbg_async_pin_request(BX_DBG_ASYNC_PENDING_A20, \
+#define BX_SET_ENABLE_A20(enabled) bio->getdbg()_async_pin_request(BX_DBG_ASYNC_PENDING_A20, \
enabled)
#define BX_GET_ENABLE_A20() bx_pc_system.get_enable_a20()
@@ -139,7 +143,7 @@ extern "C" {
// #define BX_IAC() bx_pc_system.IAC()
#define BX_IAC() bx_devices.pic->IAC()
-//#define BX_IAC() bx_dbg_IAC()
+//#define BX_IAC() bio->getdbg()_IAC()
//
// Ways for the the external environment to report back information
@@ -153,28 +157,28 @@ extern "C" {
// for multiple simulators, we always need this info, since we're
// going to replay it.
# define BX_DBG_DMA_REPORT(addr, len, what, val) \
- bx_dbg_dma_report(addr, len, what, val)
+ bio->getdbg()_dma_report(addr, len, what, val)
# define BX_DBG_IAC_REPORT(vector, irq) \
- bx_dbg_iac_report(vector, irq)
+ bio->getdbg()_iac_report(vector, irq)
# define BX_DBG_A20_REPORT(val) \
- bx_dbg_a20_report(val)
+ bio->getdbg()_a20_report(val)
# define BX_DBG_IO_REPORT(addr, size, op, val) \
- bx_dbg_io_report(addr, size, op, val)
+ bio->getdbg()_io_report(addr, size, op, val)
# define BX_DBG_UCMEM_REPORT(addr, size, op, val)
#else
// for a single simulator debug environment, we can optimize a little
// by conditionally calling, as per requested.
# define BX_DBG_DMA_REPORT(addr, len, what, val) \
- if (bx_guard.report.dma) bx_dbg_dma_report(addr, len, what, val)
+ if (bx_guard.report.dma) bio->getdbg()_dma_report(addr, len, what, val)
# define BX_DBG_IAC_REPORT(vector, irq) \
- if (bx_guard.report.irq) bx_dbg_iac_report(vector, irq)
+ if (bx_guard.report.irq) bio->getdbg()_iac_report(vector, irq)
# define BX_DBG_A20_REPORT(val) \
- if (bx_guard.report.a20) bx_dbg_a20_report(val)
+ if (bx_guard.report.a20) bio->getdbg()_a20_report(val)
# define BX_DBG_IO_REPORT(addr, size, op, val) \
- if (bx_guard.report.io) bx_dbg_io_report(addr, size, op, val)
+ if (bx_guard.report.io) bio->getdbg()_io_report(addr, size, op, val)
# define BX_DBG_UCMEM_REPORT(addr, size, op, val) \
- if (bx_guard.report.ucmem) bx_dbg_ucmem_report(addr, size, op, val)
+ if (bx_guard.report.ucmem) bio->getdbg()_ucmem_report(addr, size, op, val)
#endif // #if (BX_NUM_SIMULATORS > 1)
#else // #if BX_DEBUGGER
@@ -219,44 +223,6 @@ extern Bit8u DTPageDirty[];
# include "dynamic/dynamic.h"
#endif
-
-typedef struct {
- Boolean floppy;
- Boolean keyboard;
- Boolean video;
- Boolean disk;
- Boolean pit;
- Boolean pic;
- Boolean bios;
- Boolean cmos;
- Boolean a20;
- Boolean interrupts;
- Boolean exceptions;
- Boolean unsupported;
- Boolean temp;
- Boolean reset;
- Boolean debugger;
- Boolean mouse;
- Boolean io;
- Boolean xms;
- Boolean v8086;
- Boolean paging;
- Boolean creg;
- Boolean dreg;
- Boolean dma;
- Boolean unsupported_io;
- Boolean serial;
- Boolean cdrom;
-#ifdef MAGIC_BREAKPOINT
- Boolean magic_break_enabled;
-#endif /* MAGIC_BREAKPOINT */
- void* record_io;
- } bx_debug_t;
-
-void bx_printf(char *fmt, ...);
-void bx_panic(char *fmt, ...);
-void bx_atexit(void);
-extern bx_debug_t bx_dbg;

View File

@ -1,5 +1,5 @@
--- .bochsrc.orig Mon Nov 1 20:17:08 1999
+++ .bochsrc Sun Jul 9 01:36:35 2000
--- .bochsrc.orig Mon Nov 1 19:17:08 1999
+++ .bochsrc Tue Oct 3 13:18:08 2000
@@ -2,8 +2,8 @@
megs: 32
#megs: 16
@ -11,7 +11,7 @@
# You many now use double quotes around pathnames, in case
# your pathname includes spaces.
@@ -33,7 +33,7 @@
@@ -33,7 +33,7 @@ vgaromimage: bios/VGABIOS-elpin-2.20
#diskc: file=../528M, cyl=1024, heads=16, spt=63
#diskc: file=../62M.980115, cyl=940, heads=8, spt=17
@ -20,7 +20,7 @@
#diskc: file=../10M.dos622, cyl=306, heads=4, spt=17
#diskc: file=../30M.freebsd, cyl=615, heads=6, spt=17
#diskc: file=../126M.freeBSD_2.2.8, cyl=256, heads=16, spt=63
@@ -58,7 +58,7 @@
@@ -58,7 +58,7 @@ diskc: file="../10M.vga", cyl=306, heads
#floppya: 1_44=../1.44.freebsd, status=inserted
#floppya: 720k=../720k.dos33, status=inserted
@ -29,7 +29,7 @@
#floppyb: 1_44=../1.44b, status=inserted
#floppya: 1_44=/dev/fd0, status=inserted
#floppyb: 1_44=../1.44b, status=inserted
@@ -68,7 +68,7 @@
@@ -68,7 +68,7 @@ floppya: 1_44=../1.44a, status=inserted
#floppya: 1_2=../1.2
#floppyb: 1_44=../1.680
@ -38,7 +38,7 @@
#romimage: file=bios/rombios.bin, address=0xf0000
#romimage: file=../cbios961203
@@ -82,8 +82,8 @@
@@ -82,8 +82,8 @@ romimage: file=bios/BIOS-bochs-990925a,
#vgaromimage: ../vgacbios961111
#romimage: ../cbios961203

View File

@ -0,0 +1,126 @@
$OpenBSD: patch-bxio_h,v 1.1 2001/02/02 16:59:06 todd Exp $
--- bxio.h.orig Mon Oct 23 22:25:25 2000
+++ bxio.h Tue Oct 31 13:13:50 2000
@@ -0,0 +1,122 @@
+// Copyright (C) 2000 MandrakeSoft S.A.
+//
+// MandrakeSoft S.A.
+// 43, rue d'Aboukir
+// 75002 Paris - France
+// http://www.linux-mandrake.com/
+// http://www.mandrakesoft.com/
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+#ifndef BXIO_H
+# define BXIO_H 1
+
+extern "C" {
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef WIN32
+# include <unistd.h>
+#else
+# include <io.h>
+#endif
+#include <time.h>
+#ifdef macintosh
+# include <types.h>
+# include <stat.h>
+# include <utime.h>
+#else
+# ifndef WIN32
+# include <sys/time.h>
+# endif
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+#include <ctype.h>
+#include <string.h>
+#include <fcntl.h>
+#ifdef macintosh
+# include "macutils.h"
+# define SuperDrive "[fd:]"
+#endif
+}
+
+typedef struct bx_debug {
+ Boolean cpu;
+ Boolean floppy;
+ Boolean keyboard;
+ Boolean video;
+ Boolean disk;
+ Boolean pit;
+ Boolean pic;
+ Boolean bios;
+ Boolean cmos;
+ Boolean a20;
+ Boolean interrupts;
+ Boolean exceptions;
+ Boolean unsupported;
+ Boolean temp;
+ Boolean reset;
+ Boolean debugger;
+ Boolean mouse;
+ Boolean io;
+ Boolean xms;
+ Boolean v8086;
+ Boolean paging;
+ Boolean creg;
+ Boolean dreg;
+ Boolean dma;
+ Boolean unsupported_io;
+ Boolean serial;
+ Boolean cdrom;
+ Boolean network;
+#ifdef MAGIC_BREAKPOINT
+ Boolean magic_break_enabled;
+#endif /* MAGIC_BREAKPOINT */
+ void* record_io;
+ } bx_debug_t;
+
+class bxio {
+ void init_debug(void);
+ void init(void);
+public:
+ bxio(int fd);
+ bxio(char *fn);
+ bxio(FILE *fs);
+ bxio(void);
+ ~bxio(void);
+ void set_attribs(int attr);
+ void init_log(FILE *fs);
+ void init_log(int fd);
+ void init_log(char *fn);
+ void panic(char *fmt, ...);
+ void printf(char *fmt, ...);
+ void atexit(void);
+ bx_debug_t getdbg(void);
+ void setdbg(bx_debug_t dbg);
+ void flush(void);
+protected:
+ bx_debug_t dbg;
+ FILE *logfd;
+ char *logfn;
+ int status;
+ int showtick;
+};
+
+typedef class bxio bxio_t;
+extern bxio_t *bio;
+
+#endif /* BXIO_H */

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-config_h_in,v 1.1 2001/02/02 16:59:06 todd Exp $
--- config.h.in.orig Tue Jan 4 14:35:34 2000
+++ config.h.in Thu Oct 19 18:33:34 2000
@@ -166,6 +166,8 @@
#define BX_USE_DEV_SMF 1 // System Devices (port92)
#define BX_USE_PCI_SMF 1 // PCI
+#define BX_NE2K_SUPPORT 0 // ne2000 support
+
#define BX_SUPPORT_SB16 0
#if BX_SUPPORT_SB16
@@ -253,6 +255,7 @@
#define BX_WITH_WIN32 0
#define BX_WITH_MACOS 0
#define BX_WITH_NOGUI 0
+#define BX_WITH_TERM 0
#define WORDS_BIGENDIAN 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-configure_in,v 1.1 2001/02/02 16:59:06 todd Exp $
--- configure.in.orig Thu Oct 19 18:30:05 2000
+++ configure.in Thu Oct 19 18:38:13 2000
@@ -539,12 +539,17 @@ AC_ARG_WITH(nogui,
[ --with-nogui no native GUI, just use blank stubs],
)
+AC_ARG_WITH(term,
+ [ --with-term textmode terminal environment],
+ )
+
dnl // make sure X Windows is default if no other chosen
if (test "$with_x11" != yes) && \
(test "$with_beos" != yes) && \
(test "$with_win32" != yes) && \
(test "$with_nogui" != yes) && \
(test "$with_win32_vcpp" != yes) && \
+ (test "$with_term" != yes) && \
(test "$with_macos" != yes); then
with_x11=yes
fi
@@ -609,6 +614,10 @@ elif test "$with_macos" = yes; then
AC_DEFINE(BX_WITH_MACOS, 1)
GUI_OBJS='$(GUI_OBJS_MACOS)'
GUI_LINK_OPTS='$(GUI_LINK_OPTS_MACOS)'
+elif test "$with_term" = yes; then
+ AC_DEFINE(BX_WITH_TERM, 1)
+ GUI_OBJS='$(GUI_OBJS_TERM)'
+ GUI_LINK_OPTS='$(GUI_LINK_OPTS_TERM)'
else
AC_DEFINE(BX_WITH_NOGUI, 1)
GUI_OBJS='$(GUI_OBJS_NOGUI)'

View File

@ -0,0 +1,151 @@
$OpenBSD: patch-cpu_access_cc,v 1.1 2001/02/02 16:59:06 todd Exp $
--- cpu/access.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/access.cc Tue Oct 31 12:48:34 2000
@@ -39,18 +39,18 @@ BX_CPU_C::write_virtual_checks(bx_segmen
if ( protected_mode() ) {
if ( seg->cache.valid==0 ) {
- bx_printf("seg = %s\n", BX_CPU_THIS_PTR strseg(seg));
- bx_printf("seg->selector.value = %04x\n", (unsigned) seg->selector.value);
- bx_printf("write_virtual_checks: valid bit = 0\n");
-bx_printf("CS: %04x\n", (unsigned) BX_CPU_THIS_PTR sregs[1].selector.value);
-bx_printf("IP: %04x\n", (unsigned) BX_CPU_THIS_PTR prev_eip);
+ bio->printf("[CPU%u] seg = %s\n", BX_CPU_THIS_PTR strseg(seg), BX_SIM_ID);
+ bio->printf("[CPU%u] seg->selector.value = %04x\n", BX_SIM_ID, (unsigned) seg->selector.value);
+ bio->printf("[CPU%u] write_virtual_checks: valid bit = 0\n", BX_SIM_ID);
+bio->printf("[CPU%u] CS: %04x\n", BX_SIM_ID, (unsigned) BX_CPU_THIS_PTR sregs[1].selector.value);
+bio->printf("[CPU%u] IP: %04x\n", BX_SIM_ID, (unsigned) BX_CPU_THIS_PTR prev_eip);
debug(BX_CPU_THIS_PTR eip);
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
if (seg->cache.p == 0) { /* not present */
-bx_printf("write_virtual_checks(): segment not present\n");
+bio->printf("[CPU%u] write_virtual_checks(): segment not present\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -62,13 +62,13 @@ bx_printf("write_virtual_checks(): segme
case 10: case 11: // execute/read
case 12: case 13: // execute only, conforming
case 14: case 15: // execute/read-only, conforming
-bx_printf("write_virtual_checks(): no write access to seg\n");
+bio->printf("[CPU%u] write_virtual_checks(): no write access to seg\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
case 2: case 3: /* read/write */
if ( (offset+length-1) > seg->cache.u.segment.limit_scaled ) {
-bx_printf("write_virtual_checks(): write beyond limit, r/w\n");
+bio->printf("[CPU%u] write_virtual_checks(): write beyond limit, r/w\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -82,7 +82,7 @@ bx_printf("write_virtual_checks(): write
if ( (offset <= seg->cache.u.segment.limit_scaled) ||
(offset > upper_limit) ||
((upper_limit - offset) < (length - 1)) ) {
-bx_printf("write_virtual_checks(): write beyond limit, r/w ED\n");
+bio->printf("[CPU%] write_virtual_checks(): write beyond limit, r/w ED\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -94,7 +94,7 @@ bx_printf("write_virtual_checks(): write
else { /* real mode */
if ( (offset + length - 1) > seg->cache.u.segment.limit_scaled) {
- //bx_printf("write_virtual_checks() SEG EXCEPTION: %x:%x + %x\n",
+ //bio->printf("[CPU%u] write_virtual_checks() SEG EXCEPTION: %x:%x + %x\n", BX_SIM_ID,
// (unsigned) seg->selector.value, (unsigned) offset, (unsigned) length);
if (seg == & BX_CPU_THIS_PTR sregs[2]) exception(BX_SS_EXCEPTION, 0, 0);
else exception(BX_GP_EXCEPTION, 0, 0);
@@ -111,19 +111,19 @@ BX_CPU_C::read_virtual_checks(bx_segment
if ( protected_mode() ) {
if ( seg->cache.valid==0 ) {
- bx_printf("seg = %s\n", BX_CPU_THIS_PTR strseg(seg));
- bx_printf("seg->selector.value = %04x\n", (unsigned) seg->selector.value);
- //bx_printf("read_virtual_checks: valid bit = 0\n");
- //bx_printf("CS: %04x\n", (unsigned)
+ bio->printf("[CPU%u] seg = %s\n", BX_CPU_THIS_PTR strseg(seg), BX_SIM_ID);
+ bio->printf("[CPU%u] seg->selector.value = %04x\n", BX_SIM_ID, (unsigned) seg->selector.value);
+ //bio->printf("[CPU%u] read_virtual_checks: valid bit = 0\n", BX_SIM_ID);
+ //bio->printf("[CPU%u] CS: %04x\n", BX_SIM_ID, (unsigned)
// BX_CPU_THIS_PTR sregs[1].selector.value);
- //bx_printf("IP: %04x\n", (unsigned) BX_CPU_THIS_PTR prev_eip);
+ //bio->printf("[CPU%u] IP: %04x\n", BX_SIM_ID, (unsigned) BX_CPU_THIS_PTR prev_eip);
//debug(BX_CPU_THIS_PTR eip);
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
if (seg->cache.p == 0) { /* not present */
-bx_printf("read_virtual_checks(): segment not present\n");
+bio->printf("[CPU%u] read_virtual_checks(): segment not present\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -133,7 +133,7 @@ bx_printf("read_virtual_checks(): segmen
case 10: case 11: /* execute/read */
case 14: case 15: /* execute/read-only, conforming */
if ( (offset+length-1) > seg->cache.u.segment.limit_scaled ) {
-bx_printf("read_virtual_checks(): write beyond limit\n");
+bio->printf("[CPU%u] read_virtual_checks(): write beyond limit\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -141,7 +141,7 @@ bx_printf("read_virtual_checks(): write
case 2: case 3: /* read/write */
if ( (offset+length-1) > seg->cache.u.segment.limit_scaled ) {
-bx_printf("read_virtual_checks(): write beyond limit\n");
+bio->printf("[CPU%u] read_virtual_checks(): write beyond limit\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -155,7 +155,7 @@ bx_printf("read_virtual_checks(): write
if ( (offset <= seg->cache.u.segment.limit_scaled) ||
(offset > upper_limit) ||
((upper_limit - offset) < (length - 1)) ) {
-bx_printf("read_virtual_checks(): write beyond limit\n");
+bio->printf("[CPU%u] read_virtual_checks(): write beyond limit\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -169,7 +169,7 @@ bx_printf("read_virtual_checks(): write
if ( (offset <= seg->cache.u.segment.limit_scaled) ||
(offset > upper_limit) ||
((upper_limit - offset) < (length - 1)) ) {
-bx_printf("read_virtual_checks(): write beyond limit\n");
+bio->printf("[CPU%u] read_virtual_checks(): write beyond limit\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
}
@@ -178,7 +178,7 @@ bx_printf("read_virtual_checks(): write
case 8: case 9: /* execute only */
case 12: case 13: /* execute only, conforming */
/* can't read or write an execute-only segment */
-bx_printf("read_virtual_checks(): execute only\n");
+bio->printf("[CPU%u] read_virtual_checks(): execute only\n", BX_SIM_ID);
exception(int_number(seg), 0, 0);
return;
break;
@@ -188,7 +188,7 @@ bx_printf("read_virtual_checks(): execut
else { /* real mode */
if ( (offset + length - 1) > seg->cache.u.segment.limit_scaled) {
- //bx_printf("read_virtual_checks() SEG EXCEPTION: %x:%x + %x\n",
+ //bio->printf("[CPU%u] read_virtual_checks() SEG EXCEPTION: %x:%x + %x\n", BX_SIM_ID,
// (unsigned) seg->selector.value, (unsigned) offset, (unsigned) length);
if (seg == & BX_CPU_THIS_PTR sregs[2]) exception(BX_SS_EXCEPTION, 0, 0);
else exception(BX_GP_EXCEPTION, 0, 0);
@@ -210,7 +210,7 @@ BX_CPU_C::strseg(bx_segment_reg_t *seg)
else if (seg == &BX_CPU_THIS_PTR sregs[4]) return("FS");
else if (seg == &BX_CPU_THIS_PTR sregs[5]) return("GS");
else {
- bx_printf("undefined segment passed to strseg()!\n");
+ bio->printf("[CPU%u] undefined segment passed to strseg()!\n", BX_SIM_ID);
return("??");
}
}

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-cpu_arith16_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/arith16.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/arith16.cc Tue Oct 17 12:04:00 2000
@@ -553,7 +553,7 @@ BX_CPU_C::XADD_EwGw(BxInstruction_t *i)
SET_FLAGS_OSZAPC_16(op1_16, op2_16, sum_16, BX_INSTR_XADD16);
#else
- bx_panic("XADD_EvGv: not supported on < 80486\n");
+ bio->panic("XADD_EvGv: not supported on < 80486\n");
#endif
}
@@ -804,6 +804,6 @@ BX_CPU_C::CMPXCHG_EwGw(BxInstruction_t *
}
#else
- bx_panic("CMPXCHG_EwGw:\n");
+ bio->panic("CMPXCHG_EwGw:\n");
#endif
}

View File

@ -0,0 +1,54 @@
$OpenBSD: patch-cpu_arith32_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/arith32.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/arith32.cc Tue Oct 31 12:49:53 2000
@@ -533,14 +533,14 @@ BX_CPU_C::CDQ(BxInstruction_t *i)
void
BX_CPU_C::CMPXCHG_XBTS(BxInstruction_t *i)
{
- bx_printf("CMPXCHG_XBTS:\n");
+ bio->printf("[CPU%u] CMPXCHG_XBTS:\n", BX_SIM_ID);
UndefinedOpcode(i);
}
void
BX_CPU_C::CMPXCHG_IBTS(BxInstruction_t *i)
{
- bx_printf("CMPXCHG_IBTS:\n");
+ bio->printf("[CPU%u] CMPXCHG_IBTS:\n", BX_SIM_ID);
UndefinedOpcode(i);
}
@@ -590,7 +590,7 @@ BX_CPU_C::XADD_EdGd(BxInstruction_t *i)
SET_FLAGS_OSZAPC_32(op1_32, op2_32, sum_32, BX_INSTR_XADD32);
#else
- bx_panic("XADD_EdGd: not supported on < 80486\n");
+ bio->panic("XADD_EdGd: not supported on < 80486\n");
#endif
}
@@ -842,7 +842,7 @@ BX_CPU_C::CMPXCHG_EdGd(BxInstruction_t *
EAX = op1_32;
}
#else
- bx_panic("CMPXCHG_EdGd:\n");
+ bio->panic("CMPXCHG_EdGd:\n");
#endif
}
@@ -851,12 +851,12 @@ BX_CPU_C::CMPXCHG8B(BxInstruction_t *i)
{
#if (BX_CPU_LEVEL >= 5) || (BX_CPU_LEVEL_HACKED >= 5)
if (i->mod != 0xc0) {
- bx_printf("CMPXCHG8B: dest is reg: #UD\n");
+ bio->printf("[CPU%u] CMPXCHG8B: dest is reg: #UD\n", BX_SIM_ID);
UndefinedOpcode(i);
}
- bx_panic("CMPXCHG8B: not implemented yet\n");
+ bio->panic("[CPU%u] CMPXCHG8B: not implemented yet\n", BX_SIM_ID);
#else
- bx_printf("CMPXCHG8B: not implemented yet\n");
+ bio->printf("[CPU%u] CMPXCHG8B: not implemented yet\n", BX_SIM_ID);
UndefinedOpcode(i);
#endif
}

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-cpu_arith8_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/arith8.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/arith8.cc Tue Oct 17 12:04:00 2000
@@ -509,7 +509,7 @@ BX_CPU_C::XADD_EbGb(BxInstruction_t *i)
SET_FLAGS_OSZAPC_8(op1, op2, sum, BX_INSTR_XADD8);
#else
- bx_panic("XADD_EbGb: not supported on < 80486\n");
+ bio->panic("XADD_EbGb: not supported on < 80486\n");
#endif
}
@@ -756,6 +756,6 @@ BX_CPU_C::CMPXCHG_EbGb(BxInstruction_t *
}
#else
- bx_panic("CMPXCHG_EbGb:\n");
+ bio->panic("CMPXCHG_EbGb:\n");
#endif
}

View File

@ -0,0 +1,309 @@
$OpenBSD: patch-cpu_bit_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/bit.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/bit.cc Tue Oct 17 12:04:00 2000
@@ -32,7 +32,7 @@
BX_CPU_C::SETO_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETO: not available on < 386\n");
+ bio->panic("SETO: not available on < 386\n");
#else
Bit8u result_8;
@@ -56,7 +56,7 @@ BX_CPU_C::SETO_Eb(BxInstruction_t *i)
BX_CPU_C::SETNO_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNO: not available on < 386\n");
+ bio->panic("SETNO: not available on < 386\n");
#else
Bit8u result_8;
@@ -80,7 +80,7 @@ BX_CPU_C::SETNO_Eb(BxInstruction_t *i)
BX_CPU_C::SETB_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETB: not available on < 386\n");
+ bio->panic("SETB: not available on < 386\n");
#else
Bit8u result_8;
@@ -104,7 +104,7 @@ BX_CPU_C::SETB_Eb(BxInstruction_t *i)
BX_CPU_C::SETNB_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNB: not available on < 386\n");
+ bio->panic("SETNB: not available on < 386\n");
#else
Bit8u result_8;
@@ -128,7 +128,7 @@ BX_CPU_C::SETNB_Eb(BxInstruction_t *i)
BX_CPU_C::SETZ_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETZ: not available on < 386\n");
+ bio->panic("SETZ: not available on < 386\n");
#else
Bit8u result_8;
@@ -152,7 +152,7 @@ BX_CPU_C::SETZ_Eb(BxInstruction_t *i)
BX_CPU_C::SETNZ_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNZ: not available on < 386\n");
+ bio->panic("SETNZ: not available on < 386\n");
#else
Bit8u result_8;
@@ -176,7 +176,7 @@ BX_CPU_C::SETNZ_Eb(BxInstruction_t *i)
BX_CPU_C::SETBE_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETBE: not available on < 386\n");
+ bio->panic("SETBE: not available on < 386\n");
#else
Bit8u result_8;
@@ -200,7 +200,7 @@ BX_CPU_C::SETBE_Eb(BxInstruction_t *i)
BX_CPU_C::SETNBE_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNBE: not available on < 386\n");
+ bio->panic("SETNBE: not available on < 386\n");
#else
Bit8u result_8;
@@ -224,7 +224,7 @@ BX_CPU_C::SETNBE_Eb(BxInstruction_t *i)
BX_CPU_C::SETS_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETS: not available on < 386\n");
+ bio->panic("SETS: not available on < 386\n");
#else
Bit8u result_8;
@@ -248,7 +248,7 @@ BX_CPU_C::SETS_Eb(BxInstruction_t *i)
BX_CPU_C::SETNS_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNL: not available on < 386\n");
+ bio->panic("SETNL: not available on < 386\n");
#else
Bit8u result_8;
@@ -272,7 +272,7 @@ BX_CPU_C::SETNS_Eb(BxInstruction_t *i)
BX_CPU_C::SETP_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETP: not available on < 386\n");
+ bio->panic("SETP: not available on < 386\n");
#else
Bit8u result_8;
@@ -296,7 +296,7 @@ BX_CPU_C::SETP_Eb(BxInstruction_t *i)
BX_CPU_C::SETNP_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNP: not available on < 386\n");
+ bio->panic("SETNP: not available on < 386\n");
#else
Bit8u result_8;
@@ -320,7 +320,7 @@ BX_CPU_C::SETNP_Eb(BxInstruction_t *i)
BX_CPU_C::SETL_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETL: not available on < 386\n");
+ bio->panic("SETL: not available on < 386\n");
#else
Bit8u result_8;
@@ -344,7 +344,7 @@ BX_CPU_C::SETL_Eb(BxInstruction_t *i)
BX_CPU_C::SETNL_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNL: not available on < 386\n");
+ bio->panic("SETNL: not available on < 386\n");
#else
Bit8u result_8;
@@ -368,7 +368,7 @@ BX_CPU_C::SETNL_Eb(BxInstruction_t *i)
BX_CPU_C::SETLE_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETLE: not available on < 386\n");
+ bio->panic("SETLE: not available on < 386\n");
#else
Bit8u result_8;
@@ -392,7 +392,7 @@ BX_CPU_C::SETLE_Eb(BxInstruction_t *i)
BX_CPU_C::SETNLE_Eb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("SETNLE: not available on < 386\n");
+ bio->panic("SETNLE: not available on < 386\n");
#else
Bit8u result_8;
@@ -417,7 +417,7 @@ BX_CPU_C::SETNLE_Eb(BxInstruction_t *i)
BX_CPU_C::BSF_GvEv(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BSF_GvEv(): not supported on < 386\n");
+ bio->panic("BSF_GvEv(): not supported on < 386\n");
#else
@@ -485,7 +485,7 @@ BX_CPU_C::BSF_GvEv(BxInstruction_t *i)
BX_CPU_C::BSR_GvEv(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BSR_GvEv(): not supported on < 386\n");
+ bio->panic("BSR_GvEv(): not supported on < 386\n");
#else
@@ -565,7 +565,7 @@ BX_CPU_C::BSWAP_EAX(BxInstruction_t *i)
EAX = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_EAX: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_EAX: not implemented CPU <= 3\n");
#endif
}
@@ -584,7 +584,7 @@ BX_CPU_C::BSWAP_ECX(BxInstruction_t *i)
ECX = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_ECX: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_ECX: not implemented CPU <= 3\n");
#endif
}
void
@@ -602,7 +602,7 @@ BX_CPU_C::BSWAP_EDX(BxInstruction_t *i)
EDX = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_EDX: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_EDX: not implemented CPU <= 3\n");
#endif
}
void
@@ -620,7 +620,7 @@ BX_CPU_C::BSWAP_EBX(BxInstruction_t *i)
EBX = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_EBX: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_EBX: not implemented CPU <= 3\n");
#endif
}
void
@@ -638,7 +638,7 @@ BX_CPU_C::BSWAP_ESP(BxInstruction_t *i)
ESP = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_ESP: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_ESP: not implemented CPU <= 3\n");
#endif
}
void
@@ -656,7 +656,7 @@ BX_CPU_C::BSWAP_EBP(BxInstruction_t *i)
EBP = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_EBP: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_EBP: not implemented CPU <= 3\n");
#endif
}
void
@@ -674,7 +674,7 @@ BX_CPU_C::BSWAP_ESI(BxInstruction_t *i)
ESI = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_ESI: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_ESI: not implemented CPU <= 3\n");
#endif
}
void
@@ -692,7 +692,7 @@ BX_CPU_C::BSWAP_EDI(BxInstruction_t *i)
EDI = (b0<<24) | (b1<<16) | (b2<<8) | b3;
#else
- bx_panic("BSWAP_EDI: not implemented CPU <= 3\n");
+ bio->panic("BSWAP_EDI: not implemented CPU <= 3\n");
#endif
}
@@ -701,7 +701,7 @@ BX_CPU_C::BSWAP_EDI(BxInstruction_t *i)
BX_CPU_C::BT_EvGv(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BT_EvGv: not available on <386\n");
+ bio->panic("BT_EvGv: not available on <386\n");
#else
Bit32u op1_addr;
@@ -761,7 +761,7 @@ BX_CPU_C::BT_EvGv(BxInstruction_t *i)
BX_CPU_C::BTS_EvGv(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BTS_EvGv: not available on <386\n");
+ bio->panic("BTS_EvGv: not available on <386\n");
#else
Bit32u op1_addr;
@@ -839,7 +839,7 @@ BX_CPU_C::BTS_EvGv(BxInstruction_t *i)
BX_CPU_C::BTR_EvGv(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BTR_EvGv: not available on <386\n");
+ bio->panic("BTR_EvGv: not available on <386\n");
#else
Bit32u op1_addr;
@@ -920,7 +920,7 @@ BX_CPU_C::BTR_EvGv(BxInstruction_t *i)
BX_CPU_C::BTC_EvGv(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BTC_EvGv: not available on <386\n");
+ bio->panic("BTC_EvGv: not available on <386\n");
#else
Bit32u op1_addr;
@@ -994,7 +994,7 @@ BX_CPU_C::BTC_EvGv(BxInstruction_t *i)
BX_CPU_C::BT_EvIb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BT_EvIb: not available on <386\n");
+ bio->panic("BT_EvIb: not available on <386\n");
#else
if (i->os_32) { /* 32 bit operand size mode */
@@ -1042,7 +1042,7 @@ BX_CPU_C::BT_EvIb(BxInstruction_t *i)
BX_CPU_C::BTS_EvIb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BTS_EvIb: not available on <386\n");
+ bio->panic("BTS_EvIb: not available on <386\n");
#else
if (i->os_32) { /* 32 bit operand size mode */
@@ -1110,7 +1110,7 @@ BX_CPU_C::BTS_EvIb(BxInstruction_t *i)
BX_CPU_C::BTC_EvIb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BTC_EvIb: not available on <386\n");
+ bio->panic("BTC_EvIb: not available on <386\n");
#else
if (i->os_32) { /* 32 bit operand size mode */
@@ -1181,7 +1181,7 @@ BX_CPU_C::BTC_EvIb(BxInstruction_t *i)
BX_CPU_C::BTR_EvIb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("BTR_EvIb: not available on <386\n");
+ bio->panic("BTR_EvIb: not available on <386\n");
#else
if (i->os_32) { /* 32 bit operand size mode */

View File

@ -0,0 +1,119 @@
$OpenBSD: patch-cpu_cpu_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/cpu.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/cpu.cc Tue Oct 31 12:51:30 2000
@@ -259,32 +259,32 @@ debugger_check:
if (BX_CPU_THIS_PTR break_point) {
switch (BX_CPU_THIS_PTR break_point) {
case BREAK_POINT_TIME:
- bx_printf("[%lld] Caught time breakpoint\n", bx_pc_system.time_ticks());
+ bio->printf("[CPU%u] [%lld] Caught time breakpoint\n", BX_SIM_ID, bx_pc_system.time_ticks());
BX_CPU_THIS_PTR stop_reason = STOP_TIME_BREAK_POINT;
return;
case BREAK_POINT_READ:
- bx_printf("[%lld] Caught read watch point\n", bx_pc_system.time_ticks());
+ bio->printf("[CPU%u] [%lld] Caught read watch point\n", bx_pc_system.time_ticks(), BX_SIM_ID);
BX_CPU_THIS_PTR stop_reason = STOP_READ_WATCH_POINT;
return;
case BREAK_POINT_WRITE:
- bx_printf("[%lld] Caught write watch point\n", bx_pc_system.time_ticks());
+ bio->printf("[CPU%u] [%lld] Caught write watch point\n", bx_pc_system.time_ticks(), BX_SIM_ID);
BX_CPU_THIS_PTR stop_reason = STOP_WRITE_WATCH_POINT;
return;
default:
- bx_panic("Weird break point condition");
+ bio->panic("Weird break point condition");
}
}
#ifdef MAGIC_BREAKPOINT
// (mch) Magic break point support
if (BX_CPU_THIS_PTR magic_break) {
- if (bx_dbg.magic_break_enabled) {
- bx_printf("Stopped on MAGIC BREAKPOINT\n");
+ if (bio->getdbg().magic_break_enabled) {
+ bio->printf("[CPU%u] Stopped on MAGIC BREAKPOINT\n", BX_SIM_ID);
BX_CPU_THIS_PTR stop_reason = STOP_MAGIC_BREAK_POINT;
return;
} else {
BX_CPU_THIS_PTR magic_break = 0;
BX_CPU_THIS_PTR stop_reason = STOP_NO_REASON;
- bx_printf("Ignoring MAGIC BREAKPOINT\n");
+ bio->printf("[CPU%u] Ignoring MAGIC BREAKPOINT\n", BX_SIM_ID);
}
}
#endif
@@ -326,7 +326,7 @@ static Bit8u FetchBuffer[16];
if (BX_CPU_THIS_PTR bytesleft < 16) {
// make sure (bytesleft - remain) below doesn't go negative
- bx_panic("fetch_decode: bytesleft==0 after prefetch\n");
+ bio->panic("fetch_decode: bytesleft==0 after prefetch\n");
}
temp_ptr = fetch_ptr = BX_CPU_THIS_PTR fetch_ptr;
@@ -336,7 +336,7 @@ static Bit8u FetchBuffer[16];
}
ret = FetchDecode(FetchBuffer, &i, 16, is_32);
if (ret==0)
- bx_panic("fetchdecode: cross boundary: ret==0\n");
+ bio->panic("fetchdecode: cross boundary: ret==0\n");
if (i.ResolveModrm) {
i.ResolveModrm(&i);
}
@@ -418,7 +418,7 @@ handle_async_event:
// NOTE: similar code in ::take_irq()
vector = BX_IAC(); // may set INTR with next interrupt
- //if (bx_dbg.interrupts) bx_printf("decode: interrupt %u\n",
+ //if (bio->getdbg().interrupts) bio->printf("[CPU%u] decode: interrupt %u\n", BX_SIM_ID,
// (unsigned) vector);
BX_CPU_THIS_PTR errorno = 0;
BX_CPU_THIS_PTR EXT = 1; /* external event */
@@ -500,7 +500,7 @@ BX_CPU_C::prefetch(void)
new_linear_addr = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.base + temp_eip;
BX_CPU_THIS_PTR prev_linear_page = new_linear_addr & 0xfffff000;
if (temp_eip > temp_limit) {
- bx_panic("prefetch: EIP > CS.limit\n");
+ bio->printf("[CPU%u] prefetch: EIP > CS.limit\n", BX_SIM_ID);
}
if (BX_CPU_THIS_PTR cr0.pg) {
@@ -516,7 +516,7 @@ BX_CPU_C::prefetch(void)
// don't take this out if dynamic translation enabled,
// otherwise you must make a check to see if bytesleft is 0 after
// a call to prefetch() in the dynamic code.
- bx_panic("prefetch: running in bogus memory\n");
+ bio->panic("prefetch: running in bogus memory\n");
}
// max physical address as confined by page boundary
@@ -584,7 +584,7 @@ BX_CPU_C::dbg_is_begin_instr_bpoint(Bit3
// (not the one generating the mode switch).
if (BX_CPU_THIS_PTR mode_break &&
(BX_CPU_THIS_PTR debug_vm != BX_CPU_THIS_PTR eflags.vm)) {
- bx_printf("Caught vm mode switch breakpoint\n");
+ bio->printf("[CPU%u] Caught vm mode switch breakpoint\n", BX_SIM_ID);
BX_CPU_THIS_PTR debug_vm = BX_CPU_THIS_PTR eflags.vm;
BX_CPU_THIS_PTR stop_reason = STOP_MODE_BREAK_POINT;
return 1;
@@ -592,7 +592,7 @@ BX_CPU_C::dbg_is_begin_instr_bpoint(Bit3
if( (BX_CPU_THIS_PTR show_flag) & (dbg_show_mask)) {
int rv;
- if((rv = bx_dbg_symbolic_output()))
+ if((rv = bio->getdbg()_symbolic_output()))
return rv;
}
@@ -676,10 +676,10 @@ BX_CPU_C::dbg_is_end_instr_bpoint(Bit32u
// if async event pending, acknowlege them
if (bx_guard.async_changes_pending.which) {
if (bx_guard.async_changes_pending.which & BX_DBG_ASYNC_PENDING_A20)
- bx_dbg_async_pin_ack(BX_DBG_ASYNC_PENDING_A20,
+ bio->getdbg()_async_pin_ack(BX_DBG_ASYNC_PENDING_A20,
bx_guard.async_changes_pending.a20);
if (bx_guard.async_changes_pending.which) {
- bx_panic("decode: async pending unrecognized.\n");
+ bio->panic("decode: async pending unrecognized.\n");
}
}
#endif

View File

@ -0,0 +1,112 @@
$OpenBSD: patch-cpu_ctrl_xfer16_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/ctrl_xfer16.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/ctrl_xfer16.cc Tue Oct 17 12:04:00 2000
@@ -52,7 +52,7 @@ BX_CPU_C::RETnear16_Iw(BxInstruction_t *
if (protected_mode()) {
if ( !can_pop(2) ) {
- bx_panic("retnear_iw: can't pop IP\n");
+ bio->panic("retnear_iw: can't pop IP\n");
/* ??? #SS(0) -or #GP(0) */
}
@@ -60,11 +60,11 @@ BX_CPU_C::RETnear16_Iw(BxInstruction_t *
2, CPL==3, BX_READ, &return_IP);
if ( return_IP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("retnear_iw: IP > limit\n");
+ bio->panic("retnear_iw: IP > limit\n");
}
if ( !can_pop(2 + imm16) ) {
- bx_panic("retnear_iw: can't release bytes from stack\n");
+ bio->panic("retnear_iw: can't release bytes from stack\n");
/* #GP(0) -or #SS(0) ??? */
}
@@ -106,7 +106,7 @@ BX_CPU_C::RETnear16(BxInstruction_t *i)
if (protected_mode()) {
if ( !can_pop(2) ) {
- bx_panic("retnear: can't pop IP\n");
+ bio->panic("retnear: can't pop IP\n");
/* ??? #SS(0) -or #GP(0) */
}
@@ -114,7 +114,7 @@ BX_CPU_C::RETnear16(BxInstruction_t *i)
2, CPL==3, BX_READ, &return_IP);
if ( return_IP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("retnear: IP > limit\n");
+ bio->panic("retnear: IP > limit\n");
}
BX_CPU_THIS_PTR eip = return_IP;
@@ -217,7 +217,7 @@ BX_CPU_C::CALL_Aw(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if ( protected_mode() &&
(new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) ) {
- bx_panic("call_av: new_IP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].limit\n");
+ bio->panic("call_av: new_IP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].limit\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
#endif
@@ -290,11 +290,11 @@ BX_CPU_C::CALL_Ew(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if (op1_16 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("call_ev: IP out of CS limits!\n");
+ bio->panic("call_ev: IP out of CS limits!\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
if ( !can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 2) ) {
- bx_panic("call_ev: can't push IP\n");
+ bio->panic("call_ev: can't push IP\n");
}
}
#endif
@@ -318,7 +318,7 @@ BX_CPU_C::CALL16_Ep(BxInstruction_t *i)
/* op1_16 is a register or memory reference */
if (i->mod == 0xc0) {
- bx_panic("CALL_Ep: op1 is a register");
+ bio->panic("CALL_Ep: op1 is a register");
}
/* pointer, segment address pair */
@@ -358,7 +358,7 @@ BX_CPU_C::JMP_Jw(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("jmp_jv: offset outside of CS limits\n");
+ bio->panic("jmp_jv: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -403,7 +403,7 @@ BX_CPU_C::JCC_Jw(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("jo_routine: offset outside of CS limits\n");
+ bio->panic("jo_routine: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -443,7 +443,7 @@ BX_CPU_C::JMP_Ew(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if (new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("jmp_ev: IP out of CS limits!\n");
+ bio->panic("jmp_ev: IP out of CS limits!\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -465,7 +465,7 @@ BX_CPU_C::JMP16_Ep(BxInstruction_t *i)
/* op1_16 is a register or memory reference */
if (i->mod == 0xc0) {
/* far indirect must specify a memory address */
- bx_panic("JMP_Ep(): op1 is a register\n");
+ bio->panic("JMP_Ep(): op1 is a register\n");
}
/* pointer, segment address pair */

View File

@ -0,0 +1,121 @@
$OpenBSD: patch-cpu_ctrl_xfer32_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/ctrl_xfer32.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/ctrl_xfer32.cc Tue Oct 31 12:52:03 2000
@@ -52,7 +52,7 @@ BX_CPU_C::RETnear32_Iw(BxInstruction_t *
if (protected_mode()) {
if ( !can_pop(4) ) {
- bx_panic("retnear_iw: can't pop EIP\n");
+ bio->panic("retnear_iw: can't pop EIP\n");
/* ??? #SS(0) -or #GP(0) */
}
@@ -61,12 +61,14 @@ BX_CPU_C::RETnear32_Iw(BxInstruction_t *
if (protected_mode() &&
(return_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) ) {
- bx_panic("retnear_iw: EIP > limit\n");
+ bio->printf("[CPU%u] retnear_iw: EIP(0x%x) > limit(0x%x)\n", BX_SIM_ID,
+ return_EIP, BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled);
+ exception(BX_GP_EXCEPTION, 0, 0);
}
/* Pentium book says imm16 is number of words ??? */
if ( !can_pop(4 + imm16) ) {
- bx_panic("retnear_iw: can't release bytes from stack\n");
+ bio->panic("retnear_iw: can't release bytes from stack\n");
/* #GP(0) -or #SS(0) ??? */
}
@@ -108,7 +110,7 @@ BX_CPU_C::RETnear32(BxInstruction_t *i)
if (protected_mode()) {
if ( !can_pop(4) ) {
- bx_panic("retnear: can't pop EIP\n");
+ bio->panic("retnear: can't pop EIP\n");
/* ??? #SS(0) -or #GP(0) */
}
@@ -116,8 +118,10 @@ BX_CPU_C::RETnear32(BxInstruction_t *i)
4, CPL==3, BX_READ, &return_EIP);
if ( return_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("retnear: EIP > limit\n");
- //exception(BX_GP_EXCEPTION, 0, 0);
+ bio->printf("[CPU%u] retnear: EIP(0x%x) > limit(0x%x)\n", BX_SIM_ID,
+ return_EIP,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled);
+ exception(BX_GP_EXCEPTION, 0, 0);
}
BX_CPU_THIS_PTR eip = return_EIP;
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) /* 32bit stack */
@@ -220,7 +224,7 @@ BX_CPU_C::CALL_Ad(BxInstruction_t *i)
if ( protected_mode() ) {
if ( new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("call_av: offset outside of CS limits\n");
+ bio->panic("call_av: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -288,11 +292,13 @@ BX_CPU_C::CALL_Ed(BxInstruction_t *i)
if (protected_mode()) {
if (op1_32 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("call_ev: EIP out of CS limits!\n");
+ bio->printf("[CPU%u] call_ev: EIP(0x%x) out of CS limits(0x%x)!\n", BX_SIM_ID,
+ op1_32,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled);
exception(BX_GP_EXCEPTION, 0, 0);
}
if ( !can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 4) ) {
- bx_panic("call_ev: can't push EIP\n");
+ bio->panic("call_ev: can't push EIP\n");
}
}
@@ -315,7 +321,7 @@ BX_CPU_C::CALL32_Ep(BxInstruction_t *i)
/* op1_32 is a register or memory reference */
if (i->mod == 0xc0) {
- bx_panic("CALL_Ep: op1 is a register\n");
+ bio->panic("CALL_Ep: op1 is a register\n");
}
/* pointer, segment address pair */
@@ -353,7 +359,7 @@ BX_CPU_C::JMP_Jd(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("jmp_jv: offset outside of CS limits\n");
+ bio->panic("jmp_jv: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -397,7 +403,7 @@ BX_CPU_C::JCC_Jd(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("jo_routine: offset outside of CS limits\n");
+ bio->panic("jo_routine: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -469,7 +475,7 @@ BX_CPU_C::JMP_Ed(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if (new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("jmp_ev: IP out of CS limits!\n");
+ bio->panic("jmp_ev: IP out of CS limits!\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -491,7 +497,7 @@ BX_CPU_C::JMP32_Ep(BxInstruction_t *i)
/* op1_32 is a register or memory reference */
if (i->mod == 0xc0) {
/* far indirect must specify a memory address */
- bx_panic("JMP_Ep(): op1 is a register\n");
+ bio->panic("JMP_Ep(): op1 is a register\n");
}
/* pointer, segment address pair */

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-cpu_ctrl_xfer8_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/ctrl_xfer8.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/ctrl_xfer8.cc Tue Oct 17 12:04:00 2000
@@ -47,7 +47,7 @@ BX_CPU_C::JCXZ_Jb(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled ) {
- bx_panic("jcxz_jb: offset outside of CS limits\n");
+ bio->panic("jcxz_jb: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -85,7 +85,7 @@ BX_CPU_C::LOOPNE_Jb(BxInstruction_t *i)
new_EIP &= 0x0000ffff;
if (protected_mode()) {
if (new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("loopne_jb: offset outside of CS limits\n");
+ bio->panic("loopne_jb: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -125,7 +125,7 @@ BX_CPU_C::LOOPE_Jb(BxInstruction_t *i)
new_EIP &= 0x0000ffff;
if (protected_mode()) {
if (new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("loope_jb: offset outside of CS limits\n");
+ bio->panic("loope_jb: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -165,7 +165,7 @@ BX_CPU_C::LOOP_Jb(BxInstruction_t *i)
new_EIP &= 0x0000ffff;
if (protected_mode()) {
if (new_EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("loop_jb: offset outside of CS limits\n");
+ bio->panic("loop_jb: offset outside of CS limits\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
$OpenBSD: patch-cpu_data_xfer16_cc,v 1.1 2001/02/02 16:59:07 todd Exp $
--- cpu/data_xfer16.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/data_xfer16.cc Tue Oct 17 12:04:00 2000
@@ -86,7 +86,7 @@ BX_CPU_C::MOV_EwSw(BxInstruction_t *i)
Bit16u seg_reg;
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_EwSw: incomplete for CPU < 3\n");
+ bio->panic("MOV_EwSw: incomplete for CPU < 3\n");
#endif
seg_reg = BX_CPU_THIS_PTR sregs[i->nnn].selector.value;
@@ -111,7 +111,7 @@ BX_CPU_C::MOV_SwEw(BxInstruction_t *i)
Bit16u op2_16;
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_SwEw: incomplete for CPU < 3\n");
+ bio->panic("MOV_SwEw: incomplete for CPU < 3\n");
#endif
if (i->mod == 0xc0) {
@@ -138,7 +138,7 @@ BX_CPU_C::MOV_SwEw(BxInstruction_t *i)
BX_CPU_C::LEA_GwM(BxInstruction_t *i)
{
if (i->mod == 0xc0) {
- bx_panic("LEA_GvM: op2 is a register");
+ bio->panic("LEA_GvM: op2 is a register");
UndefinedOpcode(i);
return;
}
@@ -212,7 +212,7 @@ BX_CPU_C::MOV_EwIw(BxInstruction_t *i)
BX_CPU_C::MOVZX_GwEb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVZX_GvEb: not supported on < 386\n");
+ bio->panic("MOVZX_GvEb: not supported on < 386\n");
#else
Bit8u op2_8;
@@ -233,7 +233,7 @@ BX_CPU_C::MOVZX_GwEb(BxInstruction_t *i)
BX_CPU_C::MOVZX_GwEw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVZX_GvEw: not supported on < 386\n");
+ bio->panic("MOVZX_GvEw: not supported on < 386\n");
#else
Bit16u op2_16;
@@ -254,7 +254,7 @@ BX_CPU_C::MOVZX_GwEw(BxInstruction_t *i)
BX_CPU_C::MOVSX_GwEb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVSX_GvEb: not supported on < 386\n");
+ bio->panic("MOVSX_GvEb: not supported on < 386\n");
#else
Bit8u op2_8;
@@ -275,7 +275,7 @@ BX_CPU_C::MOVSX_GwEb(BxInstruction_t *i)
BX_CPU_C::MOVSX_GwEw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVSX_GvEw: not supported on < 386\n");
+ bio->panic("MOVSX_GvEw: not supported on < 386\n");
#else
Bit16u op2_16;
@@ -356,7 +356,7 @@ BX_CPU_C::CMOV_GwEw(BxInstruction_t *i)
case 0x14F: condition = !get_ZF() && (get_SF() == get_OF()); break;
default:
condition = 0;
- bx_panic("CMOV_GwEw: default case\n");
+ bio->panic("CMOV_GwEw: default case\n");
}
if (i->mod == 0xc0) {
@@ -371,6 +371,6 @@ BX_CPU_C::CMOV_GwEw(BxInstruction_t *i)
BX_WRITE_16BIT_REG(i->nnn, op2_16);
}
#else
- bx_panic("cmov_gwew called\n");
+ bio->panic("cmov_gwew called\n");
#endif
}

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-cpu_data_xfer32_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/data_xfer32.cc.orig Sat Mar 25 21:39:07 2000
+++ cpu/data_xfer32.cc Tue Oct 17 12:04:00 2000
@@ -85,7 +85,7 @@ BX_CPU_C::MOV_GdEd(BxInstruction_t *i)
BX_CPU_C::LEA_GdM(BxInstruction_t *i)
{
if (i->mod == 0xc0) {
- bx_panic("LEA_GvM: op2 is a register");
+ bio->panic("LEA_GvM: op2 is a register");
UndefinedOpcode(i);
return;
}
@@ -160,7 +160,7 @@ BX_CPU_C::MOV_EdId(BxInstruction_t *i)
BX_CPU_C::MOVZX_GdEb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVZX_GvEb: not supported on < 386\n");
+ bio->panic("MOVZX_GvEb: not supported on < 386\n");
#else
Bit8u op2_8;
@@ -181,7 +181,7 @@ BX_CPU_C::MOVZX_GdEb(BxInstruction_t *i)
BX_CPU_C::MOVZX_GdEw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVZX_GvEw: not supported on < 386\n");
+ bio->panic("MOVZX_GvEw: not supported on < 386\n");
#else
Bit16u op2_16;
@@ -202,7 +202,7 @@ BX_CPU_C::MOVZX_GdEw(BxInstruction_t *i)
BX_CPU_C::MOVSX_GdEb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVSX_GvEb: not supported on < 386\n");
+ bio->panic("MOVSX_GvEb: not supported on < 386\n");
#else
Bit8u op2_8;
@@ -223,7 +223,7 @@ BX_CPU_C::MOVSX_GdEb(BxInstruction_t *i)
BX_CPU_C::MOVSX_GdEw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOVSX_GvEw: not supported on < 386\n");
+ bio->panic("MOVSX_GvEw: not supported on < 386\n");
#else
Bit16u op2_16;
@@ -296,7 +296,7 @@ BX_CPU_C::CMOV_GdEd(BxInstruction_t *i)
case 0x14F: condition = !get_ZF() && (get_SF() == get_OF()); break;
default:
condition = 0;
- bx_panic("CMOV_GdEd: default case\n");
+ bio->panic("CMOV_GdEd: default case\n");
}
if (i->mod == 0xc0) {
@@ -311,6 +311,6 @@ BX_CPU_C::CMOV_GdEd(BxInstruction_t *i)
BX_WRITE_32BIT_REG(i->nnn, op2_32);
}
#else
- bx_panic("cmov_gded called\n");
+ bio->panic("cmov_gded called\n");
#endif
}

View File

@ -0,0 +1,369 @@
$OpenBSD: patch-cpu_debugstuff_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/debugstuff.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/debugstuff.cc Tue Oct 31 12:33:21 2000
@@ -29,11 +29,11 @@
void
BX_CPU_C::debug(Bit32u offset)
{
- bx_printf("| EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n",
+ bio->printf("[CPU%u] EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n",BX_SIM_ID,
(unsigned) EAX, (unsigned) EBX, (unsigned) ECX, (unsigned) EDX);
- bx_printf("| ESP=%08x EBP=%08x ESI=%08x EDI=%08x\n",
+ bio->printf("[CPU%u] ESP=%08x EBP=%08x ESI=%08x EDI=%08x\n",BX_SIM_ID,
(unsigned) ESP, (unsigned) EBP, (unsigned) ESI, (unsigned) EDI);
- bx_printf("| IOPL=%1u %s %s %s %s %s %s %s %s\n",
+ bio->printf("[CPU%u] IOPL=%1u %s %s %s %s %s %s %s %s\n",BX_SIM_ID,
BX_CPU_THIS_PTR eflags.iopl,
BX_CPU_THIS_PTR get_OF() ? "OV" : "NV",
BX_CPU_THIS_PTR eflags.df ? "DW" : "UP",
@@ -43,9 +43,9 @@ BX_CPU_C::debug(Bit32u offset)
BX_CPU_THIS_PTR get_AF() ? "AC" : "NA",
BX_CPU_THIS_PTR get_PF() ? "PE" : "PO",
BX_CPU_THIS_PTR get_CF() ? "CY" : "NC");
- bx_printf("| SEG selector base limit G D\n");
- bx_printf("| SEG sltr(index|ti|rpl) base limit G D\n");
- bx_printf("| DS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",
+ bio->printf("[CPU%u] SEG selector base limit G D\n",BX_SIM_ID);
+ bio->printf("[CPU%u] SEG sltr(index|ti|rpl) base limit G D\n",BX_SIM_ID);
+ bio->printf("[CPU%u] DS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",BX_SIM_ID,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.value,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.index,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.ti,
@@ -54,7 +54,7 @@ BX_CPU_C::debug(Bit32u offset)
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.limit,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.g,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.u.segment.d_b);
- bx_printf("| ES:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",
+ bio->printf("[CPU%u] ES:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",BX_SIM_ID,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.value,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.index,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.ti,
@@ -63,7 +63,7 @@ BX_CPU_C::debug(Bit32u offset)
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.limit,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.g,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.d_b);
- bx_printf("| FS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",
+ bio->printf("[CPU%u] FS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",BX_SIM_ID,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.index,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.ti,
@@ -72,7 +72,7 @@ BX_CPU_C::debug(Bit32u offset)
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.limit,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.g,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.d_b);
- bx_printf("| GS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",
+ bio->printf("[CPU%u] GS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",BX_SIM_ID,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.index,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.ti,
@@ -81,7 +81,7 @@ BX_CPU_C::debug(Bit32u offset)
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.limit,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.g,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].cache.u.segment.d_b);
- bx_printf("| SS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",
+ bio->printf("[CPU%u] SS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",BX_SIM_ID,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.index,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.ti,
@@ -90,7 +90,7 @@ BX_CPU_C::debug(Bit32u offset)
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.g,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b);
- bx_printf("| CS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",
+ bio->printf("[CPU%u] CS:%04x( %04x| %01u| %1u) %08x %08x %1u %1u\n",BX_SIM_ID,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.index,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.ti,
@@ -99,7 +99,7 @@ BX_CPU_C::debug(Bit32u offset)
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.g,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b);
- bx_printf("| EIP=%08x (%08x)\n", (unsigned) BX_CPU_THIS_PTR eip,
+ bio->printf("[CPU%u] EIP=%08x (%08x)\n",BX_SIM_ID, (unsigned) BX_CPU_THIS_PTR eip,
(unsigned) BX_CPU_THIS_PTR prev_eip);
#if 0
@@ -112,7 +112,7 @@ BX_CPU_C::debug(Bit32u offset)
sprintf(buf+strlen(buf), "%02x ", data);
}
sprintf(buf+strlen(buf), "\n");
- bx_printf(buf);
+ bio->printf(buf);
sprintf(buf, "%04x:%08x ", BX_CPU_THIS_PTR sregs[BX_SREG_CS].selector.value, BX_CPU_THIS_PTR prev_eip);
for (int i = 0; i < 8; i++) {
@@ -121,10 +121,10 @@ BX_CPU_C::debug(Bit32u offset)
sprintf(buf+strlen(buf), "%02x ", data);
}
sprintf(buf+strlen(buf), "\n");
- bx_printf(buf);
+ bio->printf(buf);
#endif
- bx_printf(">> ");
+ bio->printf(">> ");
#if BX_DISASM
@@ -141,11 +141,11 @@ BX_CPU_C::debug(Bit32u offset)
isize = bx_disassemble.disasm(BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b,
instr_buf, char_buf);
for (unsigned j=0; j<isize; j++)
- bx_printf("%02x", (unsigned) instr_buf[j]);
- bx_printf(": %s\n", char_buf);
+ bio->printf("%02x", (unsigned) instr_buf[j]);
+ bio->printf(": %s\n", char_buf);
}
else {
- bx_printf("(instruction unavailable) page not present\n");
+ bio->printf("(instruction unavailable) page not present\n");
}
#else
UNUSED(offset);
@@ -179,7 +179,7 @@ BX_CPU_C::dbg_get_reg(unsigned reg)
case BX_DBG_REG_FS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value);
case BX_DBG_REG_GS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value);
default:
- bx_panic("get_reg: request for unknown register\n");
+ bio->panic("get_reg: request for unknown register\n");
return(0);
}
}
@@ -202,9 +202,9 @@ BX_CPU_C::dbg_set_reg(unsigned reg, Bit3
case BX_DBG_REG_EDI: EDI = val; return(1);
case BX_DBG_REG_EIP: EIP = val; return(1);
case BX_DBG_REG_EFLAGS:
- bx_printf("dbg_set_reg: can not handle eflags yet.\n");
+ bio->printf("[CPU%u] dbg_set_reg: can not handle eflags yet.\n",BX_SIM_ID);
if ( val & 0xffff0000 ) {
- bx_printf("dbg_set_reg: can not set upper 16 bits of eflags.\n");
+ bio->printf("[CPU%u] dbg_set_reg: can not set upper 16 bits of eflags.\n",BX_SIM_ID);
return(0);
}
// make sure none of the system bits are being changed
@@ -212,7 +212,7 @@ BX_CPU_C::dbg_set_reg(unsigned reg, Bit3
(BX_CPU_THIS_PTR eflags.iopl << 12) |
(BX_CPU_THIS_PTR eflags.tf << 8);
if ( current_sys_bits != (val & 0x0000f100) ) {
- bx_printf("dbg_set_reg: can not modify NT, IOPL, or TF.\n");
+ bio->printf("[CPU%u] dbg_set_reg: can not modify NT, IOPL, or TF.\n",BX_SIM_ID);
return(0);
}
BX_CPU_THIS_PTR set_CF(val & 0x01); val >>= 2;
@@ -245,7 +245,7 @@ BX_CPU_C::dbg_set_reg(unsigned reg, Bit3
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS];
break;
default:
- bx_panic("dbg_set_reg: unrecognized register ID (%u)\n", reg);
+ bio->panic("dbg_set_reg: unrecognized register ID (%u)\n", reg);
return(0);
}
@@ -344,7 +344,7 @@ BX_CPU_C::dbg_get_descriptor_l(bx_descri
else {
switch (d->type) {
case 0: // Reserved (not yet defined)
- fprintf(stderr, "#get_descriptor_l(): type %d not finished\n",
+ bio->printf("#get_descriptor_l(): type %d not finished\n",
d->type);
return(0);
@@ -364,7 +364,7 @@ BX_CPU_C::dbg_get_descriptor_l(bx_descri
return(val);
default:
- fprintf(stderr, "#get_descriptor_l(): type %d not finished\n",
+ bio->printf("#get_descriptor_l(): type %d not finished\n",
d->type);
return(0);
}
@@ -399,7 +399,7 @@ BX_CPU_C::dbg_get_descriptor_h(bx_descri
else {
switch (d->type) {
case 0: // Reserved (not yet defined)
- fprintf(stderr, "#get_descriptor_h(): type %d not finished\n",
+ bio->printf("#get_descriptor_h(): type %d not finished\n",
d->type);
return(0);
@@ -430,7 +430,7 @@ BX_CPU_C::dbg_get_descriptor_h(bx_descri
return(val);
default:
- fprintf(stderr, "#get_descriptor_h(): type %d not finished\n",
+ bio->printf("#get_descriptor_h(): type %d not finished\n",
d->type);
return(0);
}
@@ -438,7 +438,7 @@ BX_CPU_C::dbg_get_descriptor_h(bx_descri
}
Boolean
-BX_CPU_C::dbg_get_sreg(bx_dbg_sreg_t *sreg, unsigned sreg_no)
+BX_CPU_C::dbg_get_sreg(bio->getdbg()_sreg_t *sreg, unsigned sreg_no)
{
if (sreg_no > 5)
return(0);
@@ -450,7 +450,7 @@ BX_CPU_C::dbg_get_sreg(bx_dbg_sreg_t *sr
}
Boolean
-BX_CPU_C::dbg_get_cpu(bx_dbg_cpu_t *cpu)
+BX_CPU_C::dbg_get_cpu(bio->getdbg()_cpu_t *cpu)
{
cpu->eax = EAX;
cpu->ebx = EBX;
@@ -538,7 +538,7 @@ BX_CPU_C::dbg_get_cpu(bx_dbg_cpu_t *cpu)
}
Boolean
-BX_CPU_C::dbg_set_cpu(bx_dbg_cpu_t *cpu)
+BX_CPU_C::dbg_set_cpu(bio->getdbg()_cpu_t *cpu)
{
// returns 1=OK, 0=Error
Bit32u val;
@@ -550,75 +550,75 @@ BX_CPU_C::dbg_set_cpu(bx_dbg_cpu_t *cpu)
// CS, SS, DS, ES, FS, GS descriptor checks
if (!cpu->cs.valid) {
- fprintf(stderr, "Error: CS not valid\n");
+ bio->printf("Error: CS not valid\n");
return(0); // error
}
if ( (cpu->cs.des_h & 0x1000) == 0 ) {
- fprintf(stderr, "Error: CS not application type\n");
+ bio->printf("Error: CS not application type\n");
return(0); // error
}
if ( (cpu->cs.des_h & 0x0800) == 0 ) {
- fprintf(stderr, "Error: CS not executable\n");
+ bio->printf("Error: CS not executable\n");
return(0); // error
}
if (!cpu->ss.valid) {
- fprintf(stderr, "Error: SS not valid\n");
+ bio->printf("Error: SS not valid\n");
return(0); // error
}
if ( (cpu->ss.des_h & 0x1000) == 0 ) {
- fprintf(stderr, "Error: SS not application type\n");
+ bio->printf("Error: SS not application type\n");
return(0); // error
}
if (cpu->ds.valid) {
if ( (cpu->ds.des_h & 0x1000) == 0 ) {
- fprintf(stderr, "Error: DS not application type\n");
+ bio->printf("Error: DS not application type\n");
return(0); // error
}
}
if (cpu->es.valid) {
if ( (cpu->es.des_h & 0x1000) == 0 ) {
- fprintf(stderr, "Error: ES not application type\n");
+ bio->printf("Error: ES not application type\n");
return(0); // error
}
}
if (cpu->fs.valid) {
if ( (cpu->fs.des_h & 0x1000) == 0 ) {
- fprintf(stderr, "Error: FS not application type\n");
+ bio->printf("Error: FS not application type\n");
return(0); // error
}
}
if (cpu->gs.valid) {
if ( (cpu->gs.des_h & 0x1000) == 0 ) {
- fprintf(stderr, "Error: GS not application type\n");
+ bio->printf("Error: GS not application type\n");
return(0); // error
}
}
if (cpu->ldtr.valid) {
if ( cpu->ldtr.des_h & 0x1000 ) {
- fprintf(stderr, "Error: LDTR not system type\n");
+ bio->printf("Error: LDTR not system type\n");
return(0); // error
}
if ( ((cpu->ldtr.des_h >> 8) & 0x0f) != 2 ) {
- fprintf(stderr, "Error: LDTR descriptor type not LDT\n");
+ bio->printf("Error: LDTR descriptor type not LDT\n");
return(0); // error
}
}
if (cpu->tr.valid) {
if ( cpu->tr.des_h & 0x1000 ) {
- fprintf(stderr, "Error: TR not system type\n");
+ bio->printf("Error: TR not system type\n");
return(0); // error
}
type = (cpu->tr.des_h >> 8) & 0x0f;
if ( (type != 1) && (type != 9) ) {
- fprintf(stderr, "Error: TR descriptor type not TSS\n");
+ bio->printf("Error: TR descriptor type not TSS\n");
return(0); // error
}
}
@@ -939,9 +939,9 @@ BX_CPU_C::dbg_set_cpu(bx_dbg_cpu_t *cpu)
}
#if BX_SIM_ID == 0
-# define BX_DBG_NULL_CALLBACK bx_dbg_null_callback0
+# define BX_DBG_NULL_CALLBACK bio->getdbg()_null_callback0
#else
-# define BX_DBG_NULL_CALLBACK bx_dbg_null_callback1
+# define BX_DBG_NULL_CALLBACK bio->getdbg()_null_callback1
#endif
void
BX_DBG_NULL_CALLBACK(unsigned val)
@@ -954,9 +954,9 @@ BX_DBG_NULL_CALLBACK(unsigned val)
void
#if BX_SIM_ID == 0
-bx_dbg_init_cpu_mem_env0(bx_dbg_callback_t *callback, int argc, char *argv[])
+bio->getdbg()_init_cpu_mem_env0(bio->getdbg()_callback_t *callback, int argc, char *argv[])
#else
-bx_dbg_init_cpu_mem_env1(bx_dbg_callback_t *callback, int argc, char *argv[])
+bio->getdbg()_init_cpu_mem_env1(bio->getdbg()_callback_t *callback, int argc, char *argv[])
#endif
{
UNUSED(argc);
@@ -993,7 +993,7 @@ bx_dbg_init_cpu_mem_env1(bx_dbg_callback
callback->instr_print = bx_instr_print;
#endif
#if BX_USE_LOADER
- callback->loader = bx_dbg_loader;
+ callback->loader = bio->getdbg()_loader;
#endif
callback->crc32 = BX_MEM.dbg_crc32;
}
@@ -1003,13 +1003,16 @@ bx_dbg_init_cpu_mem_env1(bx_dbg_callback
void
BX_CPU_C::atexit(void)
{
- bx_printf("\nCPU:%u\n", BX_SIM_ID);
- if (BX_CPU.protected_mode()) bx_printf("protected mode\n");
- else if (BX_CPU.v8086_mode()) bx_printf("v8086 mode\n");
- else bx_printf("real mode\n");
- bx_printf("CS.d_b = %u bit\n",
+ bio->printf("[CPU%u] State dump:\n", BX_SIM_ID);
+ if (BX_CPU.protected_mode())
+ bio->printf("[CPU%u] protected mode\n",BX_SIM_ID);
+ else if (BX_CPU.v8086_mode())
+ bio->printf("[CPU%u] v8086 mode\n",BX_SIM_ID);
+ else
+ bio->printf("[CPU%u] real mode\n",BX_SIM_ID);
+ bio->printf("[CPU%u] CS.d_b = %u bit\n",BX_SIM_ID,
BX_CPU.sregs[BX_SREG_CS].cache.u.segment.d_b ? 32 : 16);
- bx_printf("SS.d_b = %u bit\n",
+ bio->printf("[CPU%u] SS.d_b = %u bit\n",BX_SIM_ID,
BX_CPU.sregs[BX_SREG_SS].cache.u.segment.d_b ? 32 : 16);
BX_CPU.debug(BX_CPU.prev_eip);

View File

@ -0,0 +1,397 @@
$OpenBSD: patch-cpu_exception_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/exception.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/exception.cc Tue Oct 31 12:32:01 2000
@@ -52,7 +52,7 @@ BX_CPU_C::interrupt(Bit8u vector, Boolea
BX_CPU_THIS_PTR show_flag |= Flag_intsig;
#endif
-//fprintf(stderr, "::interrupt(%u)\n", vector);
+//bio->printf("[CPU%d] interrupt(%u)\n", BX_SIM_ID, vector);
BX_INSTR_INTERRUPT(vector);
invalidate_prefetch_q();
@@ -65,8 +65,9 @@ BX_CPU_C::interrupt(Bit8u vector, Boolea
#if BX_CPU_LEVEL >= 2
// unsigned prev_errno;
- if (bx_dbg.interrupts)
- bx_printf("interrupt(): vector = %u, INT = %u, EXT = %u\n",
+ if (bio->getdbg().interrupts)
+ bio->printf("[CPU%u] interrupt(): vector = %u, INT = %u, EXT = %u\n",
+ BX_SIM_ID,
(unsigned) vector, (unsigned) is_INT, (unsigned) BX_CPU_THIS_PTR EXT);
BX_CPU_THIS_PTR save_cs = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS];
@@ -92,13 +93,13 @@ BX_CPU_THIS_PTR save_esp = ESP;
// interrupt vector must be within IDT table limits,
// else #GP(vector number*8 + 2 + EXT)
if ( (vector*8 + 7) > BX_CPU_THIS_PTR idtr.limit) {
- if (bx_dbg.interrupts) {
- bx_printf("IDT.limit = %04x\n", (unsigned) BX_CPU_THIS_PTR idtr.limit);
- bx_printf("IDT.base = %06x\n", (unsigned) BX_CPU_THIS_PTR idtr.base);
- bx_printf("interrupt vector must be within IDT table limits\n");
- bx_printf("bailing\n");
+ if (bio->getdbg().interrupts) {
+ bio->printf("[CPU%u] IDT.limit = %04x\n", BX_SIM_ID, (unsigned) BX_CPU_THIS_PTR idtr.limit);
+ bio->printf("[CPU%u] IDT.base = %06x\n", BX_SIM_ID, (unsigned) BX_CPU_THIS_PTR idtr.base);
+ bio->printf("[CPU%u] interrupt vector must be within IDT table limits\n",BX_SIM_ID);
+ bio->printf("[CPU%u] bailing\n",BX_SIM_ID);
}
- bx_printf("interrupt(): vector > idtr.limit\n");
+ bio->printf("[CPU%u] interrupt(): vector > idtr.limit\n",BX_SIM_ID);
exception(BX_GP_EXCEPTION, vector*8 + 2, 0);
}
@@ -113,7 +114,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
parse_descriptor(dword1, dword2, &gate_descriptor);
if ( (gate_descriptor.valid==0) || gate_descriptor.segment) {
- bx_panic("interrupt(): gate descriptor is not valid sys seg\n");
+ bio->panic("[CPU%u] interrupt(): gate descriptor is not valid sys seg\n",BX_SIM_ID);
exception(BX_GP_EXCEPTION, vector*8 + 2, 0);
}
@@ -125,8 +126,8 @@ BX_CPU_THIS_PTR save_esp = ESP;
case 15: // 386 trap gate
break;
default:
- bx_printf("interrupt(): gate.type(%u) != {5,6,7,14,15}\n",
- (unsigned) gate_descriptor.type);
+ bio->printf("[CPU%u] interrupt(): gate.type(%u) != {5,6,7,14,15}\n",
+ BX_SIM_ID, (unsigned) gate_descriptor.type);
exception(BX_GP_EXCEPTION, vector*8 + 2, 0);
return;
}
@@ -135,14 +136,14 @@ BX_CPU_THIS_PTR save_esp = ESP;
// else #GP(vector * 8 + 2 + EXT)
if (is_INT && (gate_descriptor.dpl < CPL)) {
/* ??? */
- bx_printf("interrupt(): is_INT && (dpl < CPL)\n");
+ bio->printf("[CPU%u] interrupt(): is_INT && (dpl < CPL)\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, vector*8 + 2, 0);
return;
}
// Gate must be present, else #NP(vector * 8 + 2 + EXT)
if (gate_descriptor.p == 0) {
- bx_printf("interrupt(): p == 0\n");
+ bio->printf("[CPU%u] interrupt(): p == 0\n", BX_SIM_ID);
exception(BX_NP_EXCEPTION, vector*8 + 2, 0);
}
@@ -158,7 +159,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
// 486/Pent books say #TSS(selector)
// PPro+ says #GP(selector)
if (tss_selector.ti) {
- bx_panic("interrupt: tss_selector.ti=1\n");
+ bio->printf("[CPU%u] interrupt: tss_selector.ti=1\n",BX_SIM_ID);
exception(BX_TS_EXCEPTION, raw_tss_selector & 0xfffc, 0);
return;
}
@@ -171,12 +172,12 @@ BX_CPU_THIS_PTR save_esp = ESP;
// else #TS(TSS selector)
parse_descriptor(dword1, dword2, &tss_descriptor);
if (tss_descriptor.valid==0 || tss_descriptor.segment) {
- bx_panic("exception: TSS selector points to bad TSS\n");
+ bio->printf("[CPU%u] exception: TSS selector points to bad TSS\n",BX_SIM_ID);
exception(BX_TS_EXCEPTION, raw_tss_selector & 0xfffc, 0);
return;
}
if (tss_descriptor.type!=9 && tss_descriptor.type!=1) {
- bx_panic("exception: TSS selector points to bad TSS\n");
+ bio->panic("[CPU%u] exception: TSS selector points to bad TSS\n",BX_SIM_ID);
exception(BX_TS_EXCEPTION, raw_tss_selector & 0xfffc, 0);
return;
}
@@ -205,7 +206,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
// instruction pointer must be in CS limit, else #GP(0)
//if (EIP > cs_descriptor.u.segment.limit_scaled) {}
if (EIP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled) {
- bx_panic("exception(): eIP > CS.limit\n");
+ bio->panic("[CPU%u] exception(): eIP > CS.limit\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0x0000, 0);
}
return;
@@ -227,7 +228,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
// examine CS selector and descriptor given in gate descriptor
// selector must be non-null else #GP(EXT)
if ( (gate_dest_selector & 0xfffc) == 0 ) {
- bx_panic("int_trap_gate(): selector null\n");
+ bio->panic("[CPU%u] int_trap_gate(): selector null\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
}
@@ -245,13 +246,13 @@ BX_CPU_THIS_PTR save_esp = ESP;
cs_descriptor.segment==0 ||
cs_descriptor.u.segment.executable==0 ||
cs_descriptor.dpl>CPL ) {
- bx_printf("interrupt(): not code segment\n");
+ bio->printf("[CPU%u] interrupt(): not code segment\n",BX_SIM_ID);
exception(BX_GP_EXCEPTION, cs_selector.value & 0xfffc, 0);
}
// segment must be present, else #NP(selector + EXT)
if ( cs_descriptor.p==0 ) {
- bx_panic("interrupt(): segment not present\n");
+ bio->panic("[CPU%u] interrupt(): segment not present\n",BX_SIM_ID);
exception(BX_NP_EXCEPTION, cs_selector.value & 0xfffc, 0);
}
@@ -264,8 +265,8 @@ BX_CPU_THIS_PTR save_esp = ESP;
bx_selector_t ss_selector;
int bytes;
- if (bx_dbg.interrupts)
- bx_printf("interrupt(): INTERRUPT TO INNER PRIVILEGE\n");
+ if (bio->getdbg().interrupts)
+ bio->printf("[CPU%u] interrupt(): INTERRUPT TO INNER PRIVILEGE\n",BX_SIM_ID);
// check selector and descriptor for new stack in current TSS
get_SS_ESP_from_TSS(cs_descriptor.dpl,
@@ -273,7 +274,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
// Selector must be non-null else #TS(EXT)
if ( (SS_for_cpl_x & 0xfffc) == 0 ) {
- bx_panic("interrupt(): SS selector null\n");
+ bio->panic("[CPU%u] interrupt(): SS selector null\n",BX_SIM_ID);
/* TS(ext) */
exception(BX_TS_EXCEPTION, 0, 0);
}
@@ -289,14 +290,14 @@ BX_CPU_THIS_PTR save_esp = ESP;
// selector rpl must = dpl of code segment,
// else #TS(SS selector + ext)
if (ss_selector.rpl != cs_descriptor.dpl) {
- bx_panic("interrupt(): SS.rpl != CS.dpl\n");
+ bio->panic("[CPU%u] interrupt(): SS.rpl != CS.dpl\n",BX_SIM_ID);
exception(BX_TS_EXCEPTION, SS_for_cpl_x & 0xfffc, 0);
}
// stack seg DPL must = DPL of code segment,
// else #TS(SS selector + ext)
if (ss_descriptor.dpl != cs_descriptor.dpl) {
- bx_panic("interrupt(): SS.dpl != CS.dpl\n");
+ bio->panic("[CPU%u] interrupt(): SS.dpl != CS.dpl\n",BX_SIM_ID);
exception(BX_TS_EXCEPTION, SS_for_cpl_x & 0xfffc, 0);
}
@@ -306,13 +307,13 @@ BX_CPU_THIS_PTR save_esp = ESP;
ss_descriptor.segment==0 ||
ss_descriptor.u.segment.executable==1 ||
ss_descriptor.u.segment.r_w==0) {
- bx_panic("interrupt(): SS not writable data segment\n");
+ bio->panic("[CPU%u] interrupt(): SS not writable data segment\n", BX_SIM_ID);
exception(BX_TS_EXCEPTION, SS_for_cpl_x & 0xfffc, 0);
}
// seg must be present, else #SS(SS selector + ext)
if (ss_descriptor.p==0) {
- bx_panic("interrupt(): SS not present\n");
+ bio->panic("[CPU%u] interrupt(): SS not present\n", BX_SIM_ID);
exception(BX_SS_EXCEPTION, SS_for_cpl_x & 0xfffc, 0);
}
@@ -334,7 +335,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
bytes = 10;
if (v8086_mode()) {
bytes += 8;
- bx_panic("interrupt: int/trap gate VM\n");
+ bio->panic("[CPU%u] interrupt: int/trap gate VM\n",BX_SIM_ID);
}
}
@@ -343,14 +344,14 @@ BX_CPU_THIS_PTR save_esp = ESP;
// PPro+
// new stack must have room for 10/12 bytes, else #SS(seg selector)
if ( !can_push(&ss_descriptor, ESP_for_cpl_x, bytes) ) {
- bx_panic("interrupt(): new stack doesn't have room for %u bytes\n",
- (unsigned) bytes);
+ bio->panic("[CPU%u] interrupt(): new stack doesn't have room for %u bytes\n",
+ BX_SIM_ID, (unsigned) bytes);
// SS(???)
}
// IP must be within CS segment boundaries, else #GP(0)
if (gate_dest_offset > cs_descriptor.u.segment.limit_scaled) {
- bx_panic("interrupt(): gate eIP > CS.limit\n");
+ bio->panic("[CPU%u] interrupt(): gate eIP > CS.limit\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
}
@@ -404,7 +405,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
}
else { // 286 int/trap gate
if (v8086_mode()) {
- bx_panic("286 int/trap gate, VM\n");
+ bio->panic("[CPU%u] 286 int/trap gate, VM\n", BX_SIM_ID);
}
// push long pointer to old stack onto new stack
push_16(old_SS);
@@ -446,8 +447,8 @@ BX_CPU_THIS_PTR save_esp = ESP;
else
temp_ESP = SP;
- if (bx_dbg.interrupts)
- bx_printf("int_trap_gate286(): INTERRUPT TO SAME PRIVILEGE\n");
+ if (bio->getdbg().interrupts)
+ bio->printf("[CPU%u] int_trap_gate286(): INTERRUPT TO SAME PRIVILEGE\n",BX_SIM_ID);
// Current stack limits must allow pushing 6|8 bytes, else #SS(0)
if (gate_descriptor.type >= 14) { // 386 gate
@@ -465,13 +466,13 @@ BX_CPU_THIS_PTR save_esp = ESP;
if ( !can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache,
temp_ESP, bytes) ) {
- bx_printf("interrupt(): stack doesn't have room\n");
+ bio->printf("[CPU%u] interrupt(): stack doesn't have room\n",BX_SIM_ID);
exception(BX_SS_EXCEPTION, 0, 0);
}
// eIP must be in CS limit else #GP(0)
if (gate_dest_offset > cs_descriptor.u.segment.limit_scaled) {
- bx_panic("interrupt(): IP > cs descriptor limit\n");
+ bio->panic("[CPU%u] interrupt(): IP > cs descriptor limit\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
}
@@ -510,17 +511,17 @@ BX_CPU_THIS_PTR save_esp = ESP;
}
// else #GP(CS selector + ext)
- bx_printf("interrupt: bad descriptor\n");
- bx_printf("c_ed=%u, descriptor.dpl=%u, CPL=%u\n",
+ bio->printf("[CPU%u] interrupt: bad descriptor\n", BX_SIM_ID);
+ bio->printf("[CPU%u] c_ed=%u, descriptor.dpl=%u, CPL=%u\n", BX_SIM_ID,
(unsigned) cs_descriptor.u.segment.c_ed,
(unsigned) cs_descriptor.dpl,
(unsigned) CPL);
- bx_printf("cs.segment = %u\n", (unsigned) cs_descriptor.segment);
+ bio->printf("[CPU%u] cs.segment = %u\n", BX_SIM_ID, (unsigned) cs_descriptor.segment);
exception(BX_GP_EXCEPTION, cs_selector.value & 0xfffc, 0);
break;
default:
- bx_panic("bad descriptor type in interrupt()!\n");
+ bio->panic("[CPU%u] bad descriptor type in interrupt()!\n");
break;
}
}
@@ -530,7 +531,7 @@ BX_CPU_THIS_PTR save_esp = ESP;
Bit16u cs_selector, ip;
if ( (vector*4+3) > BX_CPU_THIS_PTR idtr.limit )
- bx_panic("interrupt(real mode) vector > limit\n");
+ bio->panic("[CPU%u] interrupt(real mode) vector > limit\n");
push_16(read_flags());
@@ -566,15 +567,15 @@ BX_CPU_C::exception(unsigned vector, Bit
Bit8u exception_type;
unsigned prev_errno;
-//fprintf(stderr, "::exception(%u)\n", vector);
+//bio->printf("::exception(%u)\n", vector);
BX_INSTR_EXCEPTION(vector);
invalidate_prefetch_q();
UNUSED(is_INT);
- if (bx_dbg.exceptions)
- bx_printf("exception(%02x h)\n", (unsigned) vector);
+ if (bio->getdbg().exceptions)
+ bio->printf("[CPU%u] exception(%02x h)\n", (unsigned) vector);
// if not initial error, restore previous register values from
// previous attempt to handle exception
@@ -587,7 +588,7 @@ BX_CPU_C::exception(unsigned vector, Bit
BX_CPU_THIS_PTR errorno++;
if (BX_CPU_THIS_PTR errorno >= 3) {
- bx_panic("exception(): 3rd exception with no resolution\n");
+ bio->panic("[CPU%u] exception(): 3rd exception with no resolution\n");
}
/* careful not to get here with curr_exception[1]==DOUBLE_FAULT */
@@ -595,7 +596,7 @@ BX_CPU_C::exception(unsigned vector, Bit
/* if 1st was a double fault (software INT?), then shutdown */
if ( (BX_CPU_THIS_PTR errorno==2) && (BX_CPU_THIS_PTR curr_exception[0]==BX_ET_DOUBLE_FAULT) ) {
- bx_panic("exception(): tripple fault encountered\n");
+ bio->panic("[CPU%u] exception(): tripple fault encountered\n");
}
/* ??? this is not totally correct, should be done depending on
@@ -652,7 +653,7 @@ BX_CPU_C::exception(unsigned vector, Bit
push_error = 0;
exception_type = BX_ET_CONTRIBUTORY;
BX_CPU_THIS_PTR eflags.rf = 1;
- bx_panic("exception(9): unfinished\n");
+ bio->panic("[CPU%u] exception(9): unfinished\n", BX_SIM_ID);
break;
case 10: // invalid TSS
push_error = 1;
@@ -685,7 +686,7 @@ BX_CPU_C::exception(unsigned vector, Bit
BX_CPU_THIS_PTR eflags.rf = 1;
break;
case 15: // reserved
- bx_panic("exception(15): reserved\n");
+ bio->panic("[CPU%u] exception(15): reserved\n",BX_SIM_ID);
push_error = 0; // keep compiler happy for now
exception_type = 0; // keep compiler happy for now
break;
@@ -696,7 +697,7 @@ BX_CPU_C::exception(unsigned vector, Bit
break;
#if BX_CPU_LEVEL >= 4
case 17: // alignment check
- bx_panic("exception(): alignment-check, vector 17 unimplemented\n");
+ bio->panic("[CPU%u] exception(): alignment-check, vector 17 unimplemented\n", BX_SIM_ID);
push_error = 0; // keep compiler happy for now
exception_type = 0; // keep compiler happy for now
BX_CPU_THIS_PTR eflags.rf = 1;
@@ -704,13 +705,13 @@ BX_CPU_C::exception(unsigned vector, Bit
#endif
#if BX_CPU_LEVEL >= 5
case 18: // machine check
- bx_panic("exception(): machine-check, vector 18 unimplemented\n");
+ bio->panic("[CPU%u] exception(): machine-check, vector 18 unimplemented\n", BX_SIM_ID);
push_error = 0; // keep compiler happy for now
exception_type = 0; // keep compiler happy for now
break;
#endif
default:
- bx_panic("exception(%u): bad vector\n", (unsigned) vector);
+ bio->panic("[CPU%u] exception(%u): bad vector\n", BX_SIM_ID, (unsigned) vector);
push_error = 0; // keep compiler happy for now
exception_type = 0; // keep compiler happy for now
break;
@@ -741,7 +742,7 @@ BX_CPU_C::exception(unsigned vector, Bit
prev_errno = BX_CPU_THIS_PTR errorno;
BX_CPU_THIS_PTR interrupt(vector, 0, push_error, error_code);
// if (BX_CPU_THIS_PTR errorno > prev_errno) {
-// bx_printf("segment_exception(): errorno changed\n");
+// bio->printf("[CPU%u] segment_exception(): errorno changed\n", BX_SIM_ID);
// longjmp(jmp_buf_env, 1); // go back to main decode loop
// return;
// }
@@ -754,7 +755,7 @@ BX_CPU_C::exception(unsigned vector, Bit
// else
// push_16(error_code);
// if (BX_CPU_THIS_PTR errorno > prev_errno) {
-// bx_panic("segment_exception(): errorno changed\n");
+// bio->panic("[CPU%u] segment_exception(): errorno changed\n", BX_SIM_ID);
// return;
// }
// }
@@ -786,10 +787,10 @@ BX_CPU_C::shutdown_cpu(void)
{
#if BX_CPU_LEVEL > 2
- bx_panic("shutdown_cpu(): not implemented for 386\n");
+ bio->panic("[CPU%u] shutdown_cpu(): not implemented for 386\n", BX_SIM_ID);
#endif
invalidate_prefetch_q();
- bx_panic("shutdown_cpu(): not finished\n");
+ bio->panic("[CPU%u] shutdown_cpu(): not finished\n", BX_SIM_ID);
}

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-cpu_fetchdecode_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/fetchdecode.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/fetchdecode.cc Tue Oct 17 12:04:01 2000
@@ -1458,7 +1458,7 @@ another_byte:
break;
default:
-bx_panic("fetch_decode: prefix default = 0x%02x\n", b1);
+bio->panic("fetch_decode: prefix default = 0x%02x\n", b1);
}
}
// opcode requires another byte
@@ -1867,8 +1867,8 @@ modrm_done:
}
break;
default:
-bx_printf("b1 was %x\n", b1);
- bx_panic("fetchdecode: imm_mode = %u\n", imm_mode);
+bio->printf("b1 was %x\n", b1);
+ bio->panic("fetchdecode: imm_mode = %u\n", imm_mode);
}
}
@@ -1884,10 +1884,7 @@ bx_printf("b1 was %x\n", b1);
BxError(BxInstruction_t *i)
{
// extern void dump_core();
- bx_printf("BxError: instruction with op1=0x%x\n", i->b1);
- bx_printf("nnn was %u\n", i->nnn);
-
- bx_printf("WARNING: Encountered an unknown instruction (signalling illegal instruction):\n");
+ bio->printf("BxError: instruction with op1=0x%x, nnn = %u, unknown instruction\n", i->b1, i->nnn);
// dump_core();
BX_CPU_THIS_PTR UndefinedOpcode(i);
@@ -1896,5 +1893,5 @@ BxError(BxInstruction_t *i)
void
BxResolveError(BxInstruction_t *i)
{
- bx_panic("BxResolveError: instruction with op1=0x%x\n", i->b1);
+ bio->panic("BxResolveError: instruction with op1=0x%x\n", i->b1);
}

View File

@ -0,0 +1,54 @@
$OpenBSD: patch-cpu_flag_ctrl_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/flag_ctrl.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/flag_ctrl.cc Tue Oct 17 12:04:01 2000
@@ -70,7 +70,7 @@ BX_CPU_C::CLI(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if (CPL > IOPL) {
- //bx_printf("CLI: CPL > IOPL\n"); /* ??? */
+ //bio->printf("CLI: CPL > IOPL\n"); /* ??? */
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -78,7 +78,7 @@ BX_CPU_C::CLI(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 3
else if (v8086_mode()) {
if (IOPL != 3) {
- //bx_printf("CLI: IOPL != 3\n"); /* ??? */
+ //bio->printf("CLI: IOPL != 3\n"); /* ??? */
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -95,7 +95,7 @@ BX_CPU_C::STI(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if (CPL > IOPL) {
- //bx_printf("STI: CPL > IOPL\n"); /* ??? */
+ //bio->printf("STI: CPL > IOPL\n"); /* ??? */
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -103,7 +103,7 @@ BX_CPU_C::STI(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 3
else if (v8086_mode()) {
if (IOPL != 3) {
- //bx_printf("STI: IOPL != 3\n"); /* ??? */
+ //bio->printf("STI: IOPL != 3\n"); /* ??? */
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -163,12 +163,12 @@ BX_CPU_C::POPF_Fv(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 3
if (v8086_mode()) {
if (IOPL < 3) {
- //bx_printf("popf_fv: IOPL < 3\n");
+ //bio->printf("popf_fv: IOPL < 3\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
if (i->os_32) {
- bx_panic("POPFD(): not supported in virtual mode\n");
+ bio->panic("POPFD(): not supported in virtual mode\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-cpu_flag_ctrl_pro_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/flag_ctrl_pro.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/flag_ctrl_pro.cc Tue Oct 31 12:30:40 2000
@@ -40,11 +40,11 @@ BX_CPU_C::write_flags(Bit16u flags, Bool
#if 0
// +++
if (BX_CPU_THIS_PTR eflags.tf==0 && (flags&0x0100))
- fprintf(stderr, "TF 0->1\n");
+ bio->printf("TF 0->1\n");
else if (BX_CPU_THIS_PTR eflags.tf && !(flags&0x0100))
- fprintf(stderr, "TF 1->0\n");
+ bio->printf("TF 1->0\n");
else if (BX_CPU_THIS_PTR eflags.tf && (flags&0x0100))
- fprintf(stderr, "TF 1->1\n");
+ bio->printf("TF 1->1\n");
#endif
BX_CPU_THIS_PTR eflags.tf = (flags >> 8) & 0x01;
@@ -84,11 +84,11 @@ BX_CPU_C::write_eflags(Bit32u eflags_raw
#if 0
// +++
if (BX_CPU_THIS_PTR eflags.tf==0 && (eflags_raw&0x0100))
- fprintf(stderr, "TF 0->1\n");
+ bio->printf("TF 0->1\n");
else if (BX_CPU_THIS_PTR eflags.tf && !(eflags_raw&0x0100))
- fprintf(stderr, "TF 1->0\n");
+ bio->printf("TF 1->0\n");
else if (BX_CPU_THIS_PTR eflags.tf && (eflags_raw&0x0100))
- fprintf(stderr, "TF 1->1\n");
+ bio->printf("TF 1->1\n");
#endif
BX_CPU_THIS_PTR eflags.tf = (eflags_raw >> 8) & 0x01;
@@ -110,7 +110,7 @@ else if (BX_CPU_THIS_PTR eflags.tf && (e
BX_CPU_THIS_PTR eflags.vm = (eflags_raw >> 17) & 0x01;
#if BX_SUPPORT_V8086_MODE == 0
if (BX_CPU_THIS_PTR eflags.vm)
- bx_panic("write_eflags: VM bit set: BX_SUPPORT_V8086_MODE==0\n");
+ bio->panic("write_eflags: VM bit set: BX_SUPPORT_V8086_MODE==0\n");
#endif
}
if (change_RF) {

View File

@ -0,0 +1,68 @@
$OpenBSD: patch-cpu_init_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/init.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/init.cc Thu Oct 19 10:56:32 2000
@@ -36,7 +36,7 @@ BX_CPU_C::BX_CPU_C(void)
{
// BX_CPU_C constructor
- bx_printf("(%u)BX_CPU_C::BX_CPU_C(void) called\n", BX_SIM_ID);
+ bio->printf("[CPU%u] BX_CPU_C::BX_CPU_C(void) called\n", BX_SIM_ID);
/* hack for the following fields. Its easier to decode mod-rm bytes if
you can assume there's always a base & index register used. For
@@ -153,8 +153,8 @@ BX_CPU_C::BX_CPU_C(void)
DTRead16vShim = NULL;
DTRead32vShim = NULL;
DTReadRMW8vShim = (BxDTShim_t) DTASReadRMW8vShim;
-fprintf(stderr, "DTReadRMW8vShim is %x\n", (unsigned) DTReadRMW8vShim);
-fprintf(stderr, "&DTReadRMW8vShim is %x\n", (unsigned) &DTReadRMW8vShim);
+bio->printf("[CPU%u] DTReadRMW8vShim is %x\n", BX_SIM_ID, (unsigned) DTReadRMW8vShim);
+bio->printf("[CPU%u] &DTReadRMW8vShim is %x\n", BX_SIM_ID, (unsigned) &DTReadRMW8vShim);
DTReadRMW16vShim = NULL;
DTReadRMW32vShim = NULL;
DTWriteRMW8vShim = (BxDTShim_t) DTASWriteRMW8vShim;
@@ -171,7 +171,7 @@ fprintf(stderr, "&DTReadRMW8vShim is %x\
BX_CPU_C::~BX_CPU_C(void)
{
- bx_printf("(%u)BX_CPU_C::~BX_CPU_C(void) called\n", BX_SIM_ID);
+ bio->printf("[CPU%u] BX_CPU_C::~BX_CPU_C(void) called\n", BX_SIM_ID);
BX_INSTR_SHUTDOWN();
}
@@ -590,7 +590,7 @@ BX_CPU_C::sanity_checks(void)
ch != ((ECX >> 8) & 0xFF) ||
dh != ((EDX >> 8) & 0xFF) ||
bh != ((EBX >> 8) & 0xFF) ) {
- bx_panic("problems using BX_READ_8BIT_REG()!\n");
+ bio->panic("problems using BX_READ_8BIT_REG()!\n");
}
ax = AX;
@@ -610,7 +610,7 @@ BX_CPU_C::sanity_checks(void)
bp != (EBP & 0xFFFF) ||
si != (ESI & 0xFFFF) ||
di != (EDI & 0xFFFF) ) {
- bx_panic("problems using BX_READ_16BIT_REG()!\n");
+ bio->panic("problems using BX_READ_16BIT_REG()!\n");
}
@@ -625,13 +625,13 @@ BX_CPU_C::sanity_checks(void)
if (sizeof(Bit8u) != 1 || sizeof(Bit8s) != 1)
- bx_panic("data type Bit8u or Bit8s is not of length 1 byte!\n");
+ bio->panic("data type Bit8u or Bit8s is not of length 1 byte!\n");
if (sizeof(Bit16u) != 2 || sizeof(Bit16s) != 2)
- bx_panic("data type Bit16u or Bit16s is not of length 2 bytes!\n");
+ bio->panic("data type Bit16u or Bit16s is not of length 2 bytes!\n");
if (sizeof(Bit32u) != 4 || sizeof(Bit32s) != 4)
- bx_panic("data type Bit32u or Bit32s is not of length 4 bytes!\n");
+ bio->panic("data type Bit32u or Bit32s is not of length 4 bytes!\n");
- fprintf(stderr, "#(%u)all sanity checks passed!\n", BX_SIM_ID);
+ bio->printf("#CPU%u] all sanity checks passed!\n", BX_SIM_ID);
}

View File

@ -0,0 +1,96 @@
$OpenBSD: patch-cpu_io_pro_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/io_pro.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/io_pro.cc Tue Oct 17 12:04:01 2000
@@ -38,7 +38,7 @@ BX_CPU_C::inp16(Bit16u addr)
if (BX_CPU_THIS_PTR cr0.pe && (BX_CPU_THIS_PTR eflags.vm || (CPL>IOPL))) {
if ( !BX_CPU_THIS_PTR allow_io(addr, 2) ) {
- // bx_printf("cpu_inp16: GP0()!\n");
+ // bio->printf("cpu_inp16: GP0()!\n");
exception(BX_GP_EXCEPTION, 0, 0);
return(0);
}
@@ -57,7 +57,7 @@ BX_CPU_C::outp16(Bit16u addr, Bit16u val
if (BX_CPU_THIS_PTR cr0.pe && (BX_CPU_THIS_PTR eflags.vm || (CPL>IOPL))) {
if ( !BX_CPU_THIS_PTR allow_io(addr, 2) ) {
- // bx_printf("cpu_outp16: GP0()!\n");
+ // bio->printf("cpu_outp16: GP0()!\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -73,7 +73,7 @@ BX_CPU_C::inp32(Bit16u addr)
if (BX_CPU_THIS_PTR cr0.pe && (BX_CPU_THIS_PTR eflags.vm || (CPL>IOPL))) {
if ( !BX_CPU_THIS_PTR allow_io(addr, 4) ) {
- // bx_printf("cpu_inp32: GP0()!\n");
+ // bio->printf("cpu_inp32: GP0()!\n");
exception(BX_GP_EXCEPTION, 0, 0);
return(0);
}
@@ -92,7 +92,7 @@ BX_CPU_C::outp32(Bit16u addr, Bit32u val
if (BX_CPU_THIS_PTR cr0.pe && (BX_CPU_THIS_PTR eflags.vm || (CPL>IOPL))) {
if ( !BX_CPU_THIS_PTR allow_io(addr, 4) ) {
- // bx_printf("cpu_outp32: GP0()!\n");
+ // bio->printf("cpu_outp32: GP0()!\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -108,7 +108,7 @@ BX_CPU_C::inp8(Bit16u addr)
if (BX_CPU_THIS_PTR cr0.pe && (BX_CPU_THIS_PTR eflags.vm || (CPL>IOPL))) {
if ( !BX_CPU_THIS_PTR allow_io(addr, 1) ) {
- // bx_printf("cpu_inp8: GP0()!\n");
+ // bio->printf("cpu_inp8: GP0()!\n");
exception(BX_GP_EXCEPTION, 0, 0);
return(0);
}
@@ -128,7 +128,7 @@ BX_CPU_C::outp8(Bit16u addr, Bit8u value
if (BX_CPU_THIS_PTR cr0.pe && (BX_CPU_THIS_PTR eflags.vm || (CPL>IOPL))) {
if ( !BX_CPU_THIS_PTR allow_io(addr, 1) ) {
- // bx_printf("cpu_outp8: GP0()!\n");
+ // bio->printf("cpu_outp8: GP0()!\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -145,28 +145,28 @@ BX_CPU_C::allow_io(Bit16u addr, unsigned
unsigned bit_index, i;
if (BX_CPU_THIS_PTR tr.cache.valid==0 || BX_CPU_THIS_PTR tr.cache.type!=9) {
- bx_printf("allow_io(): TR doesn't point to a valid 32bit TSS\n");
+ bio->printf("allow_io(): TR doesn't point to a valid 32bit TSS\n");
return(0);
}
if (BX_CPU_THIS_PTR tr.cache.u.tss386.limit_scaled < 103) {
- bx_panic("allow_io(): TR.limit < 103\n");
+ bio->panic("allow_io(): TR.limit < 103\n");
}
access_linear(BX_CPU_THIS_PTR tr.cache.u.tss386.base + 102, 2, 0, BX_READ,
&io_base);
if (io_base <= 103) {
-bx_printf("PE is %u\n", BX_CPU_THIS_PTR cr0.pe);
-bx_printf("VM is %u\n", BX_CPU_THIS_PTR eflags.vm);
-bx_printf("CPL is %u\n", CPL);
-bx_printf("IOPL is %u\n", IOPL);
-bx_printf("addr is %u\n", addr);
-bx_printf("len is %u\n", len);
- bx_panic("allow_io(): TR:io_base <= 103\n");
+bio->printf("PE is %u\n", BX_CPU_THIS_PTR cr0.pe);
+bio->printf("VM is %u\n", BX_CPU_THIS_PTR eflags.vm);
+bio->printf("CPL is %u\n", CPL);
+bio->printf("IOPL is %u\n", IOPL);
+bio->printf("addr is %u\n", addr);
+bio->printf("len is %u\n", len);
+ bio->panic("allow_io(): TR:io_base <= 103\n");
}
if (io_base > BX_CPU_THIS_PTR tr.cache.u.tss386.limit_scaled) {
- bx_printf("allow_io(): CPL > IOPL: no IO bitmap defined #GP(0)\n");
+ bio->printf("allow_io(): CPL > IOPL: no IO bitmap defined #GP(0)\n");
return(0);
}

View File

@ -0,0 +1,148 @@
$OpenBSD: patch-cpu_lazy_flags_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/lazy_flags.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/lazy_flags.cc Tue Oct 17 12:04:01 2000
@@ -188,14 +188,14 @@ BX_CPU_C::get_CF(void)
(32 - BX_CPU_THIS_PTR oszapc.op2_32)) & 0x01;
break;
default:
- bx_panic("get_CF: OSZAPC: unknown instr %u\n",
+ bio->panic("get_CF: OSZAPC: unknown instr %u\n",
(unsigned) BX_CPU_THIS_PTR oszapc.instr);
}
BX_CPU_THIS_PTR lf_flags_status &= 0xfffff0;
return(BX_CPU_THIS_PTR eflags.cf);
default:
- bx_panic("get_CF: unknown case\n");
+ bio->panic("get_CF: unknown case\n");
return(0);
}
}
@@ -283,7 +283,7 @@ BX_CPU_C::get_AF(void)
/* undefined */
break;
default:
- bx_panic("get_AF: OSZAPC: unknown instr %u\n",
+ bio->panic("get_AF: OSZAPC: unknown instr %u\n",
(unsigned) BX_CPU_THIS_PTR oszapc.instr);
}
BX_CPU_THIS_PTR lf_flags_status &= 0xfff0ff;
@@ -316,14 +316,14 @@ BX_CPU_C::get_AF(void)
(BX_CPU_THIS_PTR oszap.result_32 & 0x0f) == 0x0f;
break;
default:
- bx_panic("get_AF: OSZAP: unknown instr %u\n",
+ bio->panic("get_AF: OSZAP: unknown instr %u\n",
(unsigned) BX_CPU_THIS_PTR oszap.instr);
}
BX_CPU_THIS_PTR lf_flags_status &= 0xfff0ff;
return(BX_CPU_THIS_PTR eflags.af);
default:
- bx_panic("get_AF: unknown case\n");
+ bio->panic("get_AF: unknown case\n");
return(0);
}
}
@@ -390,7 +390,7 @@ BX_CPU_C::get_ZF(void)
BX_CPU_THIS_PTR eflags.zf = (BX_CPU_THIS_PTR oszapc.result_32 == 0);
break;
default:
- bx_panic("get_ZF: OSZAPC: unknown instr\n");
+ bio->panic("get_ZF: OSZAPC: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0xff0fff;
return(BX_CPU_THIS_PTR eflags.zf);
@@ -410,13 +410,13 @@ BX_CPU_C::get_ZF(void)
BX_CPU_THIS_PTR eflags.zf = (BX_CPU_THIS_PTR oszap.result_32 == 0);
break;
default:
- bx_panic("get_ZF: OSZAP: unknown instr\n");
+ bio->panic("get_ZF: OSZAP: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0xff0fff;
return(BX_CPU_THIS_PTR eflags.zf);
default:
- bx_panic("get_ZF: unknown case\n");
+ bio->panic("get_ZF: unknown case\n");
return(0);
}
}
@@ -486,7 +486,7 @@ BX_CPU_C::get_SF(void)
(BX_CPU_THIS_PTR oszapc.result_32 >= 0x80000000);
break;
default:
- bx_panic("get_SF: OSZAPC: unknown instr\n");
+ bio->panic("get_SF: OSZAPC: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0xf0ffff;
return(BX_CPU_THIS_PTR eflags.sf);
@@ -509,13 +509,13 @@ BX_CPU_C::get_SF(void)
(BX_CPU_THIS_PTR oszap.result_32 >= 0x80000000);
break;
default:
- bx_panic("get_SF: OSZAP: unknown instr\n");
+ bio->panic("get_SF: OSZAP: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0xf0ffff;
return(BX_CPU_THIS_PTR eflags.sf);
default:
- bx_panic("get_SF: unknown case\n");
+ bio->panic("get_SF: unknown case\n");
return(0);
}
}
@@ -653,7 +653,7 @@ BX_CPU_C::get_OF(void)
BX_CPU_THIS_PTR oszapc.result_32) & 0x80000000) > 0;
break;
default:
- bx_panic("get_OF: OSZAPC: unknown instr\n");
+ bio->panic("get_OF: OSZAPC: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0x0fffff;
return(BX_CPU_THIS_PTR eflags.of);
@@ -685,13 +685,13 @@ BX_CPU_C::get_OF(void)
BX_CPU_THIS_PTR oszap.result_32 == 0x7FFFFFFF;
break;
default:
- bx_panic("get_OF: OSZAP: unknown instr\n");
+ bio->panic("get_OF: OSZAP: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0x0fffff;
return(BX_CPU_THIS_PTR eflags.of);
default:
- bx_panic("get_OF: unknown case\n");
+ bio->panic("get_OF: unknown case\n");
return(0);
}
}
@@ -759,7 +759,7 @@ BX_CPU_C::get_PF(void)
bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.result_32];
break;
default:
- bx_panic("get_PF: OSZAPC: unknown instr\n");
+ bio->panic("get_PF: OSZAPC: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0xffff0f;
return(BX_CPU_THIS_PTR lf_pf);
@@ -782,7 +782,7 @@ BX_CPU_C::get_PF(void)
bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszap.result_32];
break;
default:
- bx_panic("get_PF: OSZAP: unknown instr\n");
+ bio->panic("get_PF: OSZAP: unknown instr\n");
}
BX_CPU_THIS_PTR lf_flags_status &= 0xffff0f;
return(BX_CPU_THIS_PTR lf_pf);
@@ -793,7 +793,7 @@ BX_CPU_C::get_PF(void)
return(BX_CPU_THIS_PTR lf_pf);
default:
- bx_panic("get_PF: unknown case\n");
+ bio->panic("get_PF: unknown case\n");
return(0);
}
}

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-cpu_mult16_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/mult16.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/mult16.cc Tue Oct 17 12:04:01 2000
@@ -204,7 +204,7 @@ BX_CPU_C::IDIV_AXEw(BxInstruction_t *i)
BX_CPU_C::IMUL_GwEwIw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("IMUL_GvEvIv() unsupported on 8086!\n");
+ bio->panic("IMUL_GvEvIv() unsupported on 8086!\n");
#else
@@ -249,7 +249,7 @@ BX_CPU_C::IMUL_GwEwIw(BxInstruction_t *i
BX_CPU_C::IMUL_GwEw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("IMUL_GvEv() unsupported on 8086!\n");
+ bio->panic("IMUL_GvEv() unsupported on 8086!\n");
#else
Bit16u product_16l;

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-cpu_mult32_cc,v 1.1 2001/02/02 16:59:08 todd Exp $
--- cpu/mult32.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/mult32.cc Tue Oct 17 12:04:01 2000
@@ -196,7 +196,7 @@ BX_CPU_C::IDIV_EAXEd(BxInstruction_t *i)
BX_CPU_C::IMUL_GdEdId(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("IMUL_GdEdId() unsupported on 8086!\n");
+ bio->panic("IMUL_GdEdId() unsupported on 8086!\n");
#else
@@ -240,7 +240,7 @@ BX_CPU_C::IMUL_GdEdId(BxInstruction_t *i
BX_CPU_C::IMUL_GdEd(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("IMUL_GvEv() unsupported on 8086!\n");
+ bio->panic("IMUL_GvEv() unsupported on 8086!\n");
#else
Bit32s op1_32, op2_32, product_32;

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-cpu_mult8_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/mult8.cc.orig Sat Mar 25 21:39:08 2000
+++ cpu/mult8.cc Tue Oct 17 12:04:01 2000
@@ -175,11 +175,11 @@ BX_CPU_C::IDIV_ALEb(BxInstruction_t *i)
quotient_8l = quotient_16 & 0xFF;
if (quotient_16 != quotient_8l) {
-bx_printf("quotient_16: %04x, remainder_8: %02x, quotient_8l: %02x\n",
+bio->printf("quotient_16: %04x, remainder_8: %02x, quotient_8l: %02x\n",
(unsigned) quotient_16, (unsigned) remainder_8, (unsigned) quotient_8l);
AL = quotient_8l;
AH = remainder_8;
-bx_printf("AH: %02x, AL: %02x\n", (unsigned) AH, (unsigned) AL);
+bio->printf("AH: %02x, AL: %02x\n", (unsigned) AH, (unsigned) AL);
exception(BX_DE_EXCEPTION, 0, 0);
}

View File

@ -0,0 +1,85 @@
$OpenBSD: patch-cpu_paging_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/paging.cc.orig Sat Mar 25 21:39:26 2000
+++ cpu/paging.cc Tue Oct 31 12:30:12 2000
@@ -315,23 +315,23 @@ static unsigned priv_check[BX_PRIV_CHECK
BX_CPU_C::enable_paging(void)
{
TLB_flush();
- if (bx_dbg.paging) bx_printf("enable_paging():\n");
-//fprintf(stderr, "#(%u)enable_paging():-------------------------\n", BX_SIM_ID);
+ if (bio->getdbg().paging) bio->printf("enable_paging():\n");
+//bio->printf("#(%u)enable_paging():-------------------------\n", BX_SIM_ID);
}
void
BX_CPU_C::disable_paging(void)
{
TLB_flush();
- if (bx_dbg.paging) bx_printf("disable_paging():\n");
+ if (bio->getdbg().paging) bio->printf("disable_paging():\n");
}
void
BX_CPU_C::CR3_change(Bit32u value32)
{
- if (bx_dbg.paging) {
- bx_printf("CR3_change(): flush TLB cache\n");
- bx_printf("Page Directory Base %08x\n", (unsigned) value32);
+ if (bio->getdbg().paging) {
+ bio->printf("CR3_change(): flush TLB cache\n");
+ bio->printf("Page Directory Base %08x\n", (unsigned) value32);
}
// flush TLB even if value does not change
@@ -419,7 +419,7 @@ BX_CPU_C::INVLPG(BxInstruction_t* i)
// Operand must not be a register
if (i->mod == 0xc0) {
- bx_printf("INVLPG: op is a register");
+ bio->printf("INVLPG: op is a register");
UndefinedOpcode(i);
}
// Can not be executed in v8086 mode
@@ -429,7 +429,7 @@ BX_CPU_C::INVLPG(BxInstruction_t* i)
// Protected instruction: CPL0 only
if (BX_CPU_THIS_PTR cr0.pe) {
if (CPL!=0) {
- bx_printf("INVLPG: CPL!=0\n");
+ bio->printf("INVLPG: CPL!=0\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -912,20 +912,20 @@ BX_CPU_C::access_linear(Bit32u laddress,
void
BX_CPU_C::enable_paging(void)
{
- bx_panic("enable_paging(): not implemented\n");
+ bio->panic("enable_paging(): not implemented\n");
}
void
BX_CPU_C::disable_paging(void)
{
- bx_panic("disable_paging() called\n");
+ bio->panic("disable_paging() called\n");
}
void
BX_CPU_C::CR3_change(Bit32u value32)
{
- bx_printf("CR3_change(): flush TLB cache\n");
- bx_printf("Page Directory Base %08x\n", (unsigned) value32);
+ bio->printf("CR3_change(): flush TLB cache\n");
+ bio->printf("Page Directory Base %08x\n", (unsigned) value32);
}
@@ -944,7 +944,7 @@ BX_CPU_C::access_linear(Bit32u laddress,
return;
}
- bx_panic("access_linear: paging not supported\n");
+ bio->panic("access_linear: paging not supported\n");
}

View File

@ -0,0 +1,724 @@
$OpenBSD: patch-cpu_proc_ctrl_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/proc_ctrl.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/proc_ctrl.cc Thu Oct 19 17:34:18 2000
@@ -35,7 +35,7 @@ BX_CPU_C::UndefinedOpcode(BxInstruction_
if (i->b1 != 0x63) {
// Windows hits the ARPL command a bunch of times.
// Too much spew...
- bx_printf("UndefinedOpcode: %02x causes exception 6\n",
+ bio->printf("UndefinedOpcode: %02x causes exception 6\n",
(unsigned) i->b1);
}
exception(BX_UD_EXCEPTION, 0, 0);
@@ -52,17 +52,17 @@ BX_CPU_C::HLT(BxInstruction_t *i)
{
// hack to panic if HLT comes from BIOS
if ( BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value == 0xf000 )
- bx_panic("HALT instruction encountered\n");
+ bio->panic("CPU%u HALT instruction encountered\n",BX_SIM_ID);
if (CPL!=0) {
- bx_printf("HLT(): CPL!=0\n");
+ if(bio->getdbg().exceptions)
+ bio->printf("[CPU%n] HLT(): CPL!=0\n",BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
if ( ! BX_CPU_THIS_PTR eflags.if_ ) {
- fprintf(stderr, "WARNING: HLT instruction with IF=0!\n");
- bx_printf("WARNING: HLT instruction with IF=0!\n");
+ bio->printf("WARNING: HLT instruction with IF=0!\n");
}
// stops instruction execution and places the processor in a
@@ -102,17 +102,17 @@ BX_CPU_C::wait_for_interrupt()
BX_CPU_C::CLTS(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("CLTS: not implemented for < 286\n");
+ bio->panic("[CPU%u] CLTS: not implemented for < 286\n",BX_SIM_ID);
#else
- if (v8086_mode()) bx_panic("clts: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("clts: v8086 mode unsupported\n");
/* read errata file */
// does CLTS also clear NT flag???
// #GP(0) if CPL is not 0
if (CPL!=0) {
- bx_printf("CLTS(): CPL!=0\n");
+ bio->printf("CLTS(): CPL!=0\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -125,16 +125,16 @@ BX_CPU_C::CLTS(BxInstruction_t *i)
void
BX_CPU_C::INVD(BxInstruction_t *i)
{
- bx_printf("---------------\n");
- bx_printf("- INVD called -\n");
- bx_printf("---------------\n");
+ bio->printf("---------------\n");
+ bio->printf("- INVD called -\n");
+ bio->printf("---------------\n");
#if BX_CPU_LEVEL >= 4
invalidate_prefetch_q();
if (BX_CPU_THIS_PTR cr0.pe) {
if (CPL!=0) {
- bx_printf("INVD: CPL!=0\n");
+ bio->printf("INVD: CPL!=0\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -147,14 +147,14 @@ BX_CPU_C::INVD(BxInstruction_t *i)
void
BX_CPU_C::WBINVD(BxInstruction_t *i)
{
- bx_printf("WBINVD: (ignoring)\n");
+ bio->printf("WBINVD: (ignoring)\n");
#if BX_CPU_LEVEL >= 4
invalidate_prefetch_q();
if (BX_CPU_THIS_PTR cr0.pe) {
if (CPL!=0) {
- bx_printf("WBINVD: CPL!=0\n");
+ bio->printf("WBINVD: CPL!=0\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
}
@@ -168,11 +168,11 @@ BX_CPU_C::WBINVD(BxInstruction_t *i)
BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_DdRd: not supported on < 386\n");
+ bio->panic("MOV_DdRd: not supported on < 386\n");
#else
Bit32u val_32;
- if (v8086_mode()) bx_panic("MOV_DdRd: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("MOV_DdRd: v8086 mode unsupported\n");
/* NOTES:
* 32bit operands always used
@@ -182,20 +182,20 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
*/
if (i->mod != 0xc0) {
- bx_panic("MOV_DdRd(): rm field not a register!\n");
+ bio->panic("MOV_DdRd(): rm field not a register!\n");
}
invalidate_prefetch_q();
if (protected_mode() && CPL!=0) {
- bx_panic("MOV_DdRd: CPL!=0\n");
+ bio->panic("MOV_DdRd: CPL!=0\n");
/* #GP(0) if CPL is not 0 */
exception(BX_GP_EXCEPTION, 0, 0);
}
val_32 = BX_READ_32BIT_REG(i->rm);
- if (bx_dbg.dreg)
- bx_printf("MOV_DdRd: DR[%u]=%08xh unhandled\n",
+ if (bio->getdbg().dreg)
+ bio->printf("MOV_DdRd: DR[%u]=%08xh unhandled\n",
(unsigned) i->nnn, (unsigned) val_32);
switch (i->nnn) {
@@ -219,7 +219,7 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 4
if ( (i->nnn == 4) && (BX_CPU_THIS_PTR cr4 & 0x00000008) ) {
// Debug extensions on
- bx_printf("MOV_DdRd: access to DR4 causes #UD\n");
+ bio->printf("MOV_DdRd: access to DR4 causes #UD\n");
UndefinedOpcode(i);
}
#endif
@@ -245,13 +245,13 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 4
if ( (i->nnn == 5) && (BX_CPU_THIS_PTR cr4 & 0x00000008) ) {
// Debug extensions (CR4.DE) on
- bx_printf("MOV_DdRd: access to DR5 causes #UD\n");
+ bio->printf("MOV_DdRd: access to DR5 causes #UD\n");
UndefinedOpcode(i);
}
#endif
// Some sanity checks...
if ( val_32 & 0x00002000 ) {
- bx_panic("MOV_DdRd: GD bit not supported yet\n");
+ bio->panic("MOV_DdRd: GD bit not supported yet\n");
// Note: processor clears GD upon entering debug exception
// handler, to allow access to the debug registers
}
@@ -260,7 +260,7 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
(((val_32>>24) & 3)==2) ||
(((val_32>>28) & 3)==2) ) {
// IO breakpoints (10b) are not yet supported.
- bx_panic("MOV_DdRd: write of %08x contains IO breakpoint\n",
+ bio->panic("MOV_DdRd: write of %08x contains IO breakpoint\n",
val_32);
}
if ( (((val_32>>18) & 3)==2) ||
@@ -268,7 +268,7 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
(((val_32>>26) & 3)==2) ||
(((val_32>>30) & 3)==2) ) {
// LEN0..3 contains undefined length specifier (10b)
- bx_panic("MOV_DdRd: write of %08x contains undefined LENx\n",
+ bio->panic("MOV_DdRd: write of %08x contains undefined LENx\n",
val_32);
}
if ( ((((val_32>>16) & 3)==0) && (((val_32>>18) & 3)!=0)) ||
@@ -276,7 +276,7 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
((((val_32>>24) & 3)==0) && (((val_32>>26) & 3)!=0)) ||
((((val_32>>28) & 3)==0) && (((val_32>>30) & 3)!=0)) ) {
// Instruction breakpoint with LENx not 00b (1-byte length)
- bx_panic("MOV_DdRd: write of %08x, R/W=00b LEN!=00b\n",
+ bio->panic("MOV_DdRd: write of %08x, R/W=00b LEN!=00b\n",
val_32);
}
#if BX_CPU_LEVEL <= 4
@@ -289,7 +289,7 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
#endif
break;
default:
- bx_panic("MOV_DdRd: control register index out of range\n");
+ bio->panic("MOV_DdRd: control register index out of range\n");
break;
}
#endif
@@ -299,28 +299,28 @@ BX_CPU_C::MOV_DdRd(BxInstruction_t *i)
BX_CPU_C::MOV_RdDd(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_RdDd: not supported on < 386\n");
+ bio->panic("MOV_RdDd: not supported on < 386\n");
#else
Bit32u val_32;
if (v8086_mode()) {
- bx_printf("MOV_RdDd: v8086 mode causes #GP\n");
+ bio->printf("MOV_RdDd: v8086 mode causes #GP\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
if (i->mod != 0xc0) {
- bx_panic("MOV_RdDd(): rm field not a register!\n");
+ bio->panic("MOV_RdDd(): rm field not a register!\n");
UndefinedOpcode(i);
}
if (protected_mode() && (CPL!=0)) {
- bx_printf("MOV_RdDd: CPL!=0 causes #GP\n");
+ bio->printf("MOV_RdDd: CPL!=0 causes #GP\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
- if (bx_dbg.dreg)
- bx_printf("MOV_RdDd: DR%u not implemented yet\n", i->nnn);
+ if (bio->getdbg().dreg)
+ bio->printf("MOV_RdDd: DR%u not implemented yet\n", i->nnn);
switch (i->nnn) {
case 0: // DR0
@@ -343,7 +343,7 @@ BX_CPU_C::MOV_RdDd(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 4
if ( (i->nnn == 4) && (BX_CPU_THIS_PTR cr4 & 0x00000008) ) {
// Debug extensions on
- bx_printf("MOV_RdDd: access to DR4 causes #UD\n");
+ bio->printf("MOV_RdDd: access to DR4 causes #UD\n");
UndefinedOpcode(i);
}
#endif
@@ -357,7 +357,7 @@ BX_CPU_C::MOV_RdDd(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 4
if ( (i->nnn == 5) && (BX_CPU_THIS_PTR cr4 & 0x00000008) ) {
// Debug extensions on
- bx_printf("MOV_RdDd: access to DR5 causes #UD\n");
+ bio->printf("MOV_RdDd: access to DR5 causes #UD\n");
UndefinedOpcode(i);
}
#endif
@@ -365,7 +365,7 @@ BX_CPU_C::MOV_RdDd(BxInstruction_t *i)
break;
default:
- bx_panic("MOV_RdDd: control register index out of range\n");
+ bio->panic("MOV_RdDd: control register index out of range\n");
val_32 = 0;
}
BX_WRITE_32BIT_REG(i->rm, val_32);
@@ -377,16 +377,16 @@ BX_CPU_C::MOV_RdDd(BxInstruction_t *i)
BX_CPU_C::LMSW_Ew(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("LMSW_Ew(): not supported on 8086!\n");
+ bio->panic("LMSW_Ew(): not supported on 8086!\n");
#else
Bit16u msw;
Bit32u cr0;
- if (v8086_mode()) bx_panic("proc_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("proc_ctrl: v8086 mode unsupported\n");
if ( protected_mode() ) {
if ( CPL != 0 ) {
- bx_printf("LMSW: CPL != 0, CPL=%u\n", (unsigned) CPL);
+ bio->printf("LMSW: CPL != 0, CPL=%u\n", (unsigned) CPL);
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -416,7 +416,7 @@ BX_CPU_C::LMSW_Ew(BxInstruction_t *i)
BX_CPU_C::SMSW_Ew(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("SMSW_Ew: not supported yet!\n");
+ bio->panic("SMSW_Ew: not supported yet!\n");
#else
Bit16u msw;
@@ -459,12 +459,14 @@ BX_CPU_C::MOV_CdRd(BxInstruction_t *i)
{
// mov general register data to control register
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_CdRd: not supported on < 386\n");
+ bio->printf("MOV_CdRd: not supported on < 386\n");
+ exception(BX_GP_EXCEPTION, 0, 0);
+ return;
#else
Bit32u val_32;
- if (v8086_mode()) bx_panic("proc_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("proc_ctrl: v8086 mode unsupported\n");
/* NOTES:
* 32bit operands always used
@@ -474,13 +476,15 @@ BX_CPU_C::MOV_CdRd(BxInstruction_t *i)
*/
if (i->mod != 0xc0) {
- bx_panic("MOV_CdRd(): rm field not a register!\n");
- }
+ bio->printf("MOV_CdRd(): rm field not a register!\n");
+ exception(BX_GP_EXCEPTION, 0, 0);
+ return;
+ }
invalidate_prefetch_q();
if (protected_mode() && CPL!=0) {
- bx_panic("MOV_CdRd: CPL!=0\n");
+ bio->printf("MOV_CdRd: CPL!=0\n");
/* #GP(0) if CPL is not 0 */
exception(BX_GP_EXCEPTION, 0, 0);
return;
@@ -490,7 +494,7 @@ BX_CPU_C::MOV_CdRd(BxInstruction_t *i)
switch (i->nnn) {
case 0: // CR0 (MSW)
- // bx_printf("MOV_CdRd:CR0: R32 = %08x\n @CS:EIP %04x:%04x ",
+ // bio->printf("MOV_CdRd:CR0: R32 = %08x\n @CS:EIP %04x:%04x ",
// (unsigned) val_32,
// (unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
// (unsigned) BX_CPU_THIS_PTR eip);
@@ -498,36 +502,34 @@ BX_CPU_C::MOV_CdRd(BxInstruction_t *i)
break;
case 1: /* CR1 */
- bx_panic("MOV_CdRd: CR1 not implemented yet\n");
+ bio->panic("MOV_CdRd: CR1 not implemented yet\n");
break;
case 2: /* CR2 */
- bx_printf("MOV_CdRd: CR2 not implemented yet\n");
- if (bx_dbg.creg)
- bx_printf("MOV_CdRd: CR2 = reg\n");
+ bio->printf("MOV_CdRd: CR2 not implemented yet\n");
+ if (bio->getdbg().creg)
+ bio->printf("MOV_CdRd: CR2 = reg\n");
BX_CPU_THIS_PTR cr2 = val_32;
break;
case 3: // CR3
- if (bx_dbg.creg)
- bx_printf("MOV_CdRd:(%08x)\n", (unsigned) val_32);
+ if (bio->getdbg().creg)
+ bio->printf("MOV_CdRd:(%08x)\n", (unsigned) val_32);
// Reserved bits take on value of MOV instruction
CR3_change(val_32);
BX_INSTR_TLB_CNTRL(BX_INSTR_MOV_CR3, val_32);
break;
case 4: // CR4
#if BX_CPU_LEVEL == 3
- bx_panic("MOV_CdRd: write to CR4 of 0x%08x on 386\n",
- val_32);
+ bio->printf("[CPU%u] MOV_CdRd: write to CR4 of 0x%08x on 386\n",
+ BX_SIM_ID, val_32);
UndefinedOpcode(i);
#else
// Protected mode: #GP(0) if attempt to write a 1 to
// any reserved bit of CR4
- bx_printf("MOV_CdRd: ignoring write to CR4 of 0x%08x\n",
+ bio->printf("MOV_CdRd: ignoring write to CR4 of 0x%08x\n",
val_32);
- if (val_32) {
- bx_panic("MOV_CdRd: (CR4) write of 0x%08x\n",
- val_32);
- }
+ //if (val_32) {
+ //}
// Only allow writes of 0 to CR4 for now.
// Writes to bits in CR4 should not be 1s as CPUID
// returns not-supported for all of these features.
@@ -535,7 +537,7 @@ BX_CPU_C::MOV_CdRd(BxInstruction_t *i)
#endif
break;
default:
- bx_panic("MOV_CdRd: control register index out of range\n");
+ bio->panic("MOV_CdRd: control register index out of range\n");
break;
}
#endif
@@ -546,11 +548,13 @@ BX_CPU_C::MOV_RdCd(BxInstruction_t *i)
{
// mov control register data to register
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_RdCd: not supported on < 386\n");
+ bio->printf("[CPU%u] MOV_RdCd: not supported on < 386\n",BX_SIM_ID);
+ exception(BX_GP_EXCEPTION, 0, 0);
+ return;
#else
Bit32u val_32;
- if (v8086_mode()) bx_panic("proc_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("proc_ctrl: v8086 mode unsupported\n");
/* NOTES:
* 32bit operands always used
@@ -560,11 +564,13 @@ BX_CPU_C::MOV_RdCd(BxInstruction_t *i)
*/
if (i->mod != 0xc0) {
- bx_panic("MOV_RdCd(): rm field not a register!\n");
+ bio->printf("MOV_RdCd(): rm field not a register!\n");
+ exception(BX_GP_EXCEPTION, 0, 0);
+ return;
}
if (protected_mode() && CPL!=0) {
- bx_panic("MOV_RdCd: CPL!=0\n");
+ bio->printf("MOV_RdCd: CPL!=0\n");
/* #GP(0) if CPL is not 0 */
exception(BX_GP_EXCEPTION, 0, 0);
return;
@@ -574,38 +580,38 @@ BX_CPU_C::MOV_RdCd(BxInstruction_t *i)
case 0: // CR0 (MSW)
val_32 = BX_CPU_THIS_PTR cr0.val32;
#if 0
- bx_printf("MOV_RdCd:CR0: R32 = %08x\n @CS:EIP %04x:%04x\n",
+ bio->printf("MOV_RdCd:CR0: R32 = %08x\n @CS:EIP %04x:%04x\n",
(unsigned) val_32,
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
(unsigned) BX_CPU_THIS_PTR eip);
#endif
break;
case 1: /* CR1 */
- bx_panic("MOV_RdCd: CR1 not implemented yet\n");
+ bio->printf("MOV_RdCd: CR1 not implemented yet\n");
val_32 = 0;
break;
case 2: /* CR2 */
- if (bx_dbg.creg)
- bx_printf("MOV_RdCd: CR2\n");
+ if (bio->getdbg().creg)
+ bio->printf("MOV_RdCd: CR2\n");
val_32 = BX_CPU_THIS_PTR cr2;
break;
case 3: // CR3
- if (bx_dbg.creg)
- bx_printf("MOV_RdCd: reading CR3\n");
+ if (bio->getdbg().creg)
+ bio->printf("MOV_RdCd: reading CR3\n");
val_32 = BX_CPU_THIS_PTR cr3;
break;
case 4: // CR4
#if BX_CPU_LEVEL == 3
val_32 = 0;
- bx_printf("MOV_RdCd: read of CR4 causes #UD\n");
+ bio->printf("MOV_RdCd: read of CR4 causes #UD\n");
UndefinedOpcode(i);
#else
- bx_printf("MOV_RdCd: read of CR4\n");
+ bio->printf("MOV_RdCd: read of CR4\n");
val_32 = BX_CPU_THIS_PTR cr4;
#endif
break;
default:
- bx_panic("MOV_RdCd: control register index out of range\n");
+ bio->printf("MOV_RdCd: control register index out of range\n");
val_32 = 0;
}
BX_WRITE_32BIT_REG(i->rm, val_32);
@@ -616,12 +622,12 @@ BX_CPU_C::MOV_RdCd(BxInstruction_t *i)
BX_CPU_C::MOV_TdRd(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_TdRd:\n");
+ bio->panic("MOV_TdRd:\n");
#elif BX_CPU_LEVEL <= 4
- bx_panic("MOV_TdRd:\n");
+ bio->panic("MOV_TdRd:\n");
#else
// Pentium+ does not have TRx. They were redesigned using the MSRs.
- bx_printf("MOV_TdRd: causes #UD\n");
+ bio->printf("MOV_TdRd: causes #UD\n");
UndefinedOpcode(i);
#endif
}
@@ -630,12 +636,12 @@ BX_CPU_C::MOV_TdRd(BxInstruction_t *i)
BX_CPU_C::MOV_RdTd(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("MOV_RdTd:\n");
+ bio->panic("MOV_RdTd:\n");
#elif BX_CPU_LEVEL <= 4
- bx_panic("MOV_RdTd:\n");
+ bio->panic("MOV_RdTd:\n");
#else
// Pentium+ does not have TRx. They were redesigned using the MSRs.
- bx_printf("MOV_RdTd: causes #UD\n");
+ bio->printf("MOV_RdTd: causes #UD\n");
UndefinedOpcode(i);
#endif
}
@@ -644,7 +650,7 @@ BX_CPU_C::MOV_RdTd(BxInstruction_t *i)
BX_CPU_C::LOADALL(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("undocumented LOADALL instruction not supported on 8086\n");
+ bio->panic("undocumented LOADALL instruction not supported on 8086\n");
#else
Bit16u msw, tr, flags, ip, ldtr;
Bit16u ds_raw, ss_raw, cs_raw, es_raw;
@@ -652,20 +658,20 @@ BX_CPU_C::LOADALL(BxInstruction_t *i)
Bit16u base_15_0, limit;
Bit8u base_23_16, access;
- if (v8086_mode()) bx_panic("proc_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("proc_ctrl: v8086 mode unsupported\n");
#if BX_CPU_LEVEL > 2
- bx_panic("loadall: not implemented for 386\n");
+ bio->panic("loadall: not implemented for 386\n");
/* ??? need to set G and other bits, and compute .limit_scaled also */
/* for all segments CS,DS,SS,... */
#endif
if (BX_CPU_THIS_PTR cr0.pe) {
- bx_panic(
+ bio->panic(
"LOADALL not yet supported for protected mode\n");
}
-bx_panic("LOADALL: handle CR0.val32\n");
+bio->panic("LOADALL: handle CR0.val32\n");
/* MSW */
BX_MEM.read_physical(0x806, 2, &msw);
BX_CPU_THIS_PTR cr0.pe = (msw & 0x01); msw >>= 1;
@@ -673,12 +679,12 @@ bx_panic("LOADALL: handle CR0.val32\n");
BX_CPU_THIS_PTR cr0.em = (msw & 0x01); msw >>= 1;
BX_CPU_THIS_PTR cr0.ts = (msw & 0x01);
- //bx_printf("LOADALL: pe=%u, mp=%u, em=%u, ts=%u\n",
+ //bio->printf("LOADALL: pe=%u, mp=%u, em=%u, ts=%u\n",
// (unsigned) BX_CPU_THIS_PTR cr0.pe, (unsigned) BX_CPU_THIS_PTR cr0.mp,
// (unsigned) BX_CPU_THIS_PTR cr0.em, (unsigned) BX_CPU_THIS_PTR cr0.ts);
if (BX_CPU_THIS_PTR cr0.pe || BX_CPU_THIS_PTR cr0.mp || BX_CPU_THIS_PTR cr0.em || BX_CPU_THIS_PTR cr0.ts)
- bx_panic("LOADALL set PE, MP, EM or TS bits in MSW!\n");
+ bio->panic("LOADALL set PE, MP, EM or TS bits in MSW!\n");
/* TR */
BX_MEM.read_physical(0x816, 2, &tr);
@@ -764,17 +770,17 @@ bx_panic("LOADALL: handle CR0.val32\n");
BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit = limit;
if (access == 0) {
- bx_panic("loadall: LDTR case access byte=0.\n");
+ bio->panic("loadall: LDTR case access byte=0.\n");
}
if ( BX_CPU_THIS_PTR ldtr.cache.valid==0 ) {
- bx_panic("loadall: ldtr.valid=0\n");
+ bio->panic("loadall: ldtr.valid=0\n");
}
if (BX_CPU_THIS_PTR ldtr.cache.segment) { /* not a system segment */
- bx_printf(" AR byte = %02x\n", (unsigned) access);
- bx_panic("loadall: LDTR descriptor cache loaded with non system segment\n");
+ bio->printf(" AR byte = %02x\n", (unsigned) access);
+ bio->panic("loadall: LDTR descriptor cache loaded with non system segment\n");
}
if ( BX_CPU_THIS_PTR ldtr.cache.type != 2 ) {
- bx_panic("loadall: LDTR.type(%u) != 2\n", (unsigned) (access & 0x0f));
+ bio->panic("loadall: LDTR.type(%u) != 2\n", (unsigned) (access & 0x0f));
}
}
@@ -804,7 +810,7 @@ bx_panic("LOADALL: handle CR0.val32\n");
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.valid==0 ||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].cache.segment==0) {
- bx_panic("loadall: DS invalid\n");
+ bio->panic("loadall: DS invalid\n");
}
/* SS */
@@ -832,7 +838,7 @@ bx_panic("LOADALL: handle CR0.val32\n");
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid==0 ||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.segment==0) {
- bx_panic("loadall: SS invalid\n");
+ bio->panic("loadall: SS invalid\n");
}
@@ -841,7 +847,7 @@ bx_panic("LOADALL: handle CR0.val32\n");
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value = cs_raw;
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl = (cs_raw & 0x03); cs_raw >>= 2;
- //bx_printf("LOADALL: setting cs.selector.rpl to %u\n",
+ //bio->printf("LOADALL: setting cs.selector.rpl to %u\n",
// (unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl);
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.ti = (cs_raw & 0x01); cs_raw >>= 1;
@@ -865,7 +871,7 @@ bx_panic("LOADALL: handle CR0.val32\n");
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.valid==0 ||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.segment==0) {
- bx_panic("loadall: CS invalid\n");
+ bio->panic("loadall: CS invalid\n");
}
/* ES */
@@ -889,17 +895,17 @@ bx_panic("LOADALL: handle CR0.val32\n");
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.p = (access & 0x01);
#if 0
- bx_printf("cs.dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl);
- bx_printf("ss.dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl);
- bx_printf("BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR ds.cache.dpl);
- bx_printf("BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR es.cache.dpl);
- bx_printf("LOADALL: setting cs.selector.rpl to %u\n",
+ bio->printf("cs.dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.dpl);
+ bio->printf("ss.dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.dpl);
+ bio->printf("BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR ds.cache.dpl);
+ bio->printf("BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].dpl = %02x\n", (unsigned) BX_CPU_THIS_PTR es.cache.dpl);
+ bio->printf("LOADALL: setting cs.selector.rpl to %u\n",
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl);
- bx_printf("LOADALL: setting ss.selector.rpl to %u\n",
+ bio->printf("LOADALL: setting ss.selector.rpl to %u\n",
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.rpl);
- bx_printf("LOADALL: setting ds.selector.rpl to %u\n",
+ bio->printf("LOADALL: setting ds.selector.rpl to %u\n",
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.rpl);
- bx_printf("LOADALL: setting es.selector.rpl to %u\n",
+ bio->printf("LOADALL: setting es.selector.rpl to %u\n",
(unsigned) BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.rpl);
#endif
@@ -908,7 +914,7 @@ bx_panic("LOADALL: handle CR0.val32\n");
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.valid==0 ||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.segment==0) {
- bx_panic("loadall: ES invalid\n");
+ bio->panic("loadall: ES invalid\n");
}
/* DI */
@@ -953,7 +959,7 @@ bx_panic("LOADALL: handle CR0.val32\n");
#if 0
if (access)
- bx_printf("LOADALL: GDTR access bits not 0 (%02x).\n",
+ bio->printf("LOADALL: GDTR access bits not 0 (%02x).\n",
(unsigned) access);
#endif
@@ -1042,14 +1048,13 @@ BX_CPU_C::CPUID(BxInstruction_t *i)
features |= 0x01;
# endif
-#else
- family = 6;
- bx_panic("CPUID: not implemented for > 5\n");
-#endif
-
EAX = (family <<8) | (model<<4) | stepping;
EBX = ECX = 0; // reserved
EDX = features;
+#else
+ family = 6;
+ bio->printf("CPUID: not implemented for > 5\n");
+#endif
break;
default:
@@ -1057,7 +1062,7 @@ BX_CPU_C::CPUID(BxInstruction_t *i)
break;
}
#else
- bx_panic("CPUID: not available on < late 486\n");
+ bio->panic("CPUID: not available on < late 486\n");
#endif
}
@@ -1099,7 +1104,7 @@ BX_CPU_C::SetCR0(Bit32u val_32)
#endif
//if (BX_CPU_THIS_PTR cr0.ts)
- // bx_printf("MOV_CdRd:CR0.TS set 0x%x\n", (unsigned) val_32);
+ // bio->printf("MOV_CdRd:CR0.TS set 0x%x\n", (unsigned) val_32);
if (prev_pe==0 && BX_CPU_THIS_PTR cr0.pe) {
enter_protected_mode();
@@ -1121,7 +1126,7 @@ BX_CPU_C::RSM(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 4
invalidate_prefetch_q();
- bx_panic("RSM: System Management Mode not implemented yet\n");
+ bio->panic("RSM: System Management Mode not implemented yet\n");
#else
UndefinedOpcode(i);
#endif
@@ -1131,7 +1136,7 @@ BX_CPU_C::RSM(BxInstruction_t *i)
BX_CPU_C::RDTSC(BxInstruction_t *i)
{
#if BX_CPU_LEVEL >= 5
- bx_panic("RDTSC: not implemented yet\n");
+ bio->panic("RDTSC: not implemented yet\n");
#else
UndefinedOpcode(i);
#endif
@@ -1141,7 +1146,8 @@ BX_CPU_C::RDTSC(BxInstruction_t *i)
BX_CPU_C::RDMSR(BxInstruction_t *i)
{
#if BX_CPU_LEVEL >= 5
- bx_panic("RDMSR: not implemented yet\n");
+ bio->printf("[CPU%u] RDMSR: not implemented yet\n",BX_SIM_ID);
+ UndefinedOpcode(i);
#else
UndefinedOpcode(i);
#endif
@@ -1153,7 +1159,7 @@ BX_CPU_C::WRMSR(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 5
invalidate_prefetch_q();
- bx_panic("WRMSR: not implemented yet\n");
+ bio->panic("WRMSR: not implemented yet\n");
#else
UndefinedOpcode(i);
#endif

View File

@ -0,0 +1,504 @@
$OpenBSD: patch-cpu_protect_ctrl_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/protect_ctrl.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/protect_ctrl.cc Tue Oct 31 13:12:54 2000
@@ -35,7 +35,7 @@
BX_CPU_C::ARPL_EwGw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("ARPL_EwRw: not supported on 8086!\n");
+ bio->panic("ARPL_EwRw: not supported on 8086!\n");
#else /* 286+ */
Bit16u op2_16, op1_16;
@@ -98,10 +98,10 @@ BX_CPU_C::LAR_GvEw(BxInstruction_t *i)
Bit32u dword1, dword2;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
if (real_mode()) {
- bx_panic("LAR_GvEw: not recognized in real mode\n");
+ bio->panic("LAR_GvEw: not recognized in real mode\n");
UndefinedOpcode(i);
return;
}
@@ -133,7 +133,7 @@ BX_CPU_C::LAR_GvEw(BxInstruction_t *i)
if (descriptor.valid==0) {
set_ZF(0);
- //bx_printf("lar(): descriptor valid bit cleared\n");
+ //bio->printf("[CPU%u] lar(): descriptor valid bit cleared\n", BX_SIM_ID);
return;
}
@@ -177,7 +177,8 @@ BX_CPU_C::LAR_GvEw(BxInstruction_t *i)
break;
default: /* rest not accepted types to LAR */
set_ZF(0);
- bx_printf("lar(): not accepted type\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] lar(): not accepted type\n", BX_SIM_ID);
return;
break;
}
@@ -209,11 +210,11 @@ BX_CPU_C::LSL_GvEw(BxInstruction_t *i)
Bit32u dword1, dword2;
Bit32u descriptor_dpl;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
if (real_mode()) {
- bx_panic("LSL_GvEw: not recognized in real mode\n");
+ bio->panic("LSL_GvEw: not recognized in real mode\n");
UndefinedOpcode(i);
return;
}
@@ -300,13 +301,13 @@ lsl_ok:
BX_CPU_C::SLDT_Ew(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("SLDT_Ew: not supported on 8086!\n");
+ bio->panic("SLDT_Ew: not supported on 8086!\n");
#else
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
if (real_mode()) {
/* not recognized in real address mode */
- bx_panic("SLDT_Ew: encountered in real mode.\n");
+ bio->panic("SLDT_Ew: encountered in real mode.\n");
UndefinedOpcode(i);
}
else {
@@ -326,11 +327,11 @@ BX_CPU_C::SLDT_Ew(BxInstruction_t *i)
void
BX_CPU_C::STR_Ew(BxInstruction_t *i)
{
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
if (real_mode()) {
// not recognized in real address mode
- bx_panic("STR_Ew: encountered in real mode.\n");
+ bio->panic("STR_Ew: encountered in real mode.\n");
UndefinedOpcode(i);
}
else {
@@ -350,14 +351,14 @@ BX_CPU_C::STR_Ew(BxInstruction_t *i)
BX_CPU_C::LLDT_Ew(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("LLDT_Ew: not supported on 8086!\n");
+ bio->panic("LLDT_Ew: not supported on 8086!\n");
#else
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
invalidate_prefetch_q();
if (real_mode()) {
- bx_panic("lldt: not recognized in real mode\n");
+ bio->panic("lldt: not recognized in real mode\n");
UndefinedOpcode(i);
return;
}
@@ -370,7 +371,7 @@ BX_CPU_C::LLDT_Ew(BxInstruction_t *i)
/* #GP(0) if the current privilege level is not 0 */
if (CPL != 0) {
- bx_panic("LLDT: CPL != 0\n");
+ bio->panic("LLDT: CPL != 0\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -394,12 +395,13 @@ BX_CPU_C::LLDT_Ew(BxInstruction_t *i)
// #GP(selector) if the selector operand does not point into GDT
if (selector.ti != 0) {
- bx_printf("LLDT: selector.ti != 0\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] LLDT: selector.ti != 0\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, raw_selector & 0xfffc, 0);
}
if ((selector.index*8 + 7) > BX_CPU_THIS_PTR gdtr.limit) {
- bx_panic("lldt: GDT: index > limit\n");
+ bio->panic("lldt: GDT: index > limit\n");
exception(BX_GP_EXCEPTION, raw_selector & 0xfffc, 0);
return;
}
@@ -415,18 +417,20 @@ BX_CPU_C::LLDT_Ew(BxInstruction_t *i)
if ( (descriptor.valid==0) ||
descriptor.segment ||
(descriptor.type!=2) ) {
- bx_printf("lldt: doesn't point to an LDT descriptor!\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] lldt: doesn't point to an LDT descriptor!\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, raw_selector & 0xfffc, 0);
}
/* #NP(selector) if LDT descriptor is not present */
if (descriptor.p==0) {
- bx_printf("lldt: LDT descriptor not present!\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] lldt: LDT descriptor not present!\n", BX_SIM_ID);
exception(BX_NP_EXCEPTION, raw_selector & 0xfffc, 0);
}
if (descriptor.u.ldt.limit < 7) {
- bx_printf("lldt: ldtr.limit < 7\n");
+ bio->printf("[CPU%u] lldt: ldtr.limit < 7\n", BX_SIM_ID);
}
BX_CPU_THIS_PTR ldtr.selector = selector;
@@ -442,9 +446,9 @@ BX_CPU_C::LLDT_Ew(BxInstruction_t *i)
BX_CPU_C::LTR_Ew(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("LTR_Ew: not supported on 8086!\n");
+ bio->panic("LTR_Ew: not supported on 8086!\n");
#else
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
invalidate_prefetch_q();
@@ -458,7 +462,7 @@ BX_CPU_C::LTR_Ew(BxInstruction_t *i)
/* #GP(0) if the current privilege level is not 0 */
if (CPL != 0) {
- bx_panic("LTR: CPL != 0\n");
+ bio->panic("LTR: CPL != 0\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -472,7 +476,7 @@ BX_CPU_C::LTR_Ew(BxInstruction_t *i)
/* if selector is NULL, invalidate and done */
if ((raw_selector & 0xfffc) == 0) {
- bx_panic("ltr: loading with NULL selector!\n");
+ bio->panic("ltr: loading with NULL selector!\n");
/* if this is OK, then invalidate and load selector & descriptor cache */
/* load here */
BX_CPU_THIS_PTR tr.selector.value = raw_selector;
@@ -484,7 +488,7 @@ BX_CPU_C::LTR_Ew(BxInstruction_t *i)
parse_selector(raw_selector, &selector);
if (selector.ti) {
- bx_panic("ltr: selector.ti != 0\n");
+ bio->panic("ltr: selector.ti != 0\n");
return;
}
@@ -496,23 +500,23 @@ BX_CPU_C::LTR_Ew(BxInstruction_t *i)
/* #GP(selector) if object is not a TSS or is already busy */
if ( (descriptor.valid==0) || descriptor.segment ||
(descriptor.type!=1 && descriptor.type!=9) ) {
- bx_panic("ltr: doesn't point to an available TSS descriptor!\n");
+ bio->panic("ltr: doesn't point to an available TSS descriptor!\n");
exception(BX_GP_EXCEPTION, raw_selector & 0xfffc, 0); /* 0 ??? */
return;
}
/* #NP(selector) if TSS descriptor is not present */
if (descriptor.p==0) {
- bx_panic("ltr: LDT descriptor not present!\n");
+ bio->panic("ltr: LDT descriptor not present!\n");
exception(BX_NP_EXCEPTION, raw_selector & 0xfffc, 0); /* 0 ??? */
return;
}
if (descriptor.type==1 && descriptor.u.tss286.limit<43) {
- bx_panic("ltr:286TSS: loading tr.limit < 43\n");
+ bio->panic("ltr:286TSS: loading tr.limit < 43\n");
}
else if (descriptor.type==9 && descriptor.u.tss386.limit_scaled<103) {
- bx_panic("ltr:386TSS: loading tr.limit < 103\n");
+ bio->panic("ltr:386TSS: loading tr.limit < 103\n");
}
BX_CPU_THIS_PTR tr.selector = selector;
@@ -527,7 +531,7 @@ BX_CPU_C::LTR_Ew(BxInstruction_t *i)
return;
}
else {
- bx_panic("ltr_ew: not recognized in real-mode!\n");
+ bio->panic("ltr_ew: not recognized in real-mode!\n");
UndefinedOpcode(i);
return;
}
@@ -543,11 +547,11 @@ BX_CPU_C::VERR_Ew(BxInstruction_t *i)
bx_selector_t selector;
Bit32u dword1, dword2;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
if (real_mode()) {
- bx_panic("VERR_Ew: not recognized in real mode\n");
+ bio->panic("VERR_Ew: not recognized in real mode\n");
UndefinedOpcode(i);
return;
}
@@ -563,7 +567,8 @@ BX_CPU_C::VERR_Ew(BxInstruction_t *i)
/* if selector null, clear ZF and done */
if ( (raw_selector & 0xfffc) == 0 ) {
set_ZF(0);
- bx_printf("VERR: null selector\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: null selector\n", BX_SIM_ID);
return;
}
@@ -575,7 +580,8 @@ BX_CPU_C::VERR_Ew(BxInstruction_t *i)
if ( !fetch_raw_descriptor2(&selector, &dword1, &dword2) ) {
/* not within descriptor table */
set_ZF(0);
- bx_printf("VERR: not in table\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: not in table\n", BX_SIM_ID);
return;
}
@@ -583,13 +589,15 @@ BX_CPU_C::VERR_Ew(BxInstruction_t *i)
if ( descriptor.segment==0 ) { /* system or gate descriptor */
set_ZF(0); /* inaccessible */
- bx_printf("VERR: system descriptor\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: system descriptor\n", BX_SIM_ID);
return;
}
if ( descriptor.valid==0 ) {
set_ZF(0);
- bx_printf("VERR: valid bit cleared\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: valid bit cleared\n", BX_SIM_ID);
return;
}
@@ -599,32 +607,38 @@ BX_CPU_C::VERR_Ew(BxInstruction_t *i)
if ( descriptor.u.segment.c_ed &&
descriptor.u.segment.r_w) {
set_ZF(1); /* accessible */
- bx_printf("VERR: conforming code, OK\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: conforming code, OK\n", BX_SIM_ID);
return;
}
if ( descriptor.u.segment.r_w==0 ) {
set_ZF(0); /* inaccessible */
- bx_printf("VERR: code not readable\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: code not readable\n", BX_SIM_ID);
return;
}
/* readable, non-conforming code segment */
if ( (descriptor.dpl<CPL) || (descriptor.dpl<selector.rpl) ) {
set_ZF(0); /* inaccessible */
- bx_printf("VERR: non-coforming code not withing priv level\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: non-coforming code not withing priv level\n", BX_SIM_ID);
return;
}
set_ZF(1); /* accessible */
- bx_printf("VERR: code seg readable\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: code seg readable\n", BX_SIM_ID);
return;
}
else { /* data segment */
if ( (descriptor.dpl<CPL) || (descriptor.dpl<selector.rpl) ) {
set_ZF(0); /* not accessible */
- bx_printf("VERR: data seg not withing priv level\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: data seg not withing priv level\n", BX_SIM_ID);
return;
}
set_ZF(1); /* accessible */
- bx_printf("VERR: data segment OK\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERR: data segment OK\n", BX_SIM_ID);
return;
}
}
@@ -638,11 +652,11 @@ BX_CPU_C::VERW_Ew(BxInstruction_t *i)
bx_selector_t selector;
Bit32u dword1, dword2;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
if (real_mode()) {
- bx_panic("VERW_Ew: not recognized in real mode\n");
+ bio->panic("VERW_Ew: not recognized in real mode\n");
UndefinedOpcode(i);
return;
}
@@ -658,7 +672,8 @@ BX_CPU_C::VERW_Ew(BxInstruction_t *i)
/* if selector null, clear ZF and done */
if ( (raw_selector & 0xfffc) == 0 ) {
set_ZF(0);
- bx_printf("VERW: null selector\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERW: null selector\n", BX_SIM_ID);
return;
}
@@ -670,7 +685,8 @@ BX_CPU_C::VERW_Ew(BxInstruction_t *i)
if ( !fetch_raw_descriptor2(&selector, &dword1, &dword2) ) {
/* not within descriptor table */
set_ZF(0);
- bx_printf("VERW: not in table\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERW: not in table\n", BX_SIM_ID);
return;
}
@@ -679,13 +695,15 @@ BX_CPU_C::VERW_Ew(BxInstruction_t *i)
/* rule out system segments & code segments */
if ( descriptor.segment==0 || descriptor.u.segment.executable ) {
set_ZF(0);
- bx_printf("VERW: system seg or code\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERW: system seg or code\n", BX_SIM_ID);
return;
}
if ( descriptor.valid==0 ) {
set_ZF(0);
- bx_printf("VERW: valid bit cleared\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERW: valid bit cleared\n", BX_SIM_ID);
return;
}
@@ -693,16 +711,17 @@ BX_CPU_C::VERW_Ew(BxInstruction_t *i)
if ( descriptor.u.segment.r_w ) { /* writable */
if ( (descriptor.dpl<CPL) || (descriptor.dpl<selector.rpl) ) {
set_ZF(0); /* not accessible */
- bx_printf("VERW: writable data seg not within priv level\n");
+ if(bio->getdbg().cpu)
+ bio->printf("[CPU%u] VERW: writable data seg not within priv level\n", BX_SIM_ID);
return;
}
set_ZF(1); /* accessible */
- bx_printf("VERW: data seg writable\n");
+ bio->printf("[CPU%u] VERW: data seg writable\n", BX_SIM_ID);
return;
}
set_ZF(0); /* not accessible */
- bx_printf("VERW: data seg not writable\n");
+ bio->printf("[CPU%u] VERW: data seg not writable\n", BX_SIM_ID);
return;
}
@@ -710,18 +729,18 @@ BX_CPU_C::VERW_Ew(BxInstruction_t *i)
BX_CPU_C::SGDT_Ms(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("SGDT_Ms: not supported on 8086!\n");
+ bio->panic("SGDT_Ms: not supported on 8086!\n");
#else
Bit16u limit_16;
Bit32u base_32;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
/* op1 is a register or memory reference */
if (i->mod == 0xc0) {
/* undefined opcode exception */
- bx_panic("SGDT_Ms: use of register is undefined opcode.\n");
+ bio->panic("SGDT_Ms: use of register is undefined opcode.\n");
UndefinedOpcode(i);
return;
}
@@ -744,17 +763,17 @@ BX_CPU_C::SGDT_Ms(BxInstruction_t *i)
BX_CPU_C::SIDT_Ms(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("SIDT_Ms: not supported on 8086!\n");
+ bio->panic("SIDT_Ms: not supported on 8086!\n");
#else
Bit16u limit_16;
Bit32u base_32;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
/* op1 is a register or memory reference */
if (i->mod == 0xc0) {
/* undefined opcode exception */
- bx_panic("SIDT: use of register is undefined opcode.\n");
+ bio->panic("SIDT: use of register is undefined opcode.\n");
UndefinedOpcode(i);
return;
}
@@ -779,22 +798,22 @@ BX_CPU_C::SIDT_Ms(BxInstruction_t *i)
BX_CPU_C::LGDT_Ms(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("LGDT_Ms: not supported on 8086!\n");
+ bio->panic("LGDT_Ms: not supported on 8086!\n");
#else
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
invalidate_prefetch_q();
if (protected_mode() && (CPL!=0)) {
- bx_panic("LGDT: protected mode: CPL!=0\n");
+ bio->panic("LGDT: protected mode: CPL!=0\n");
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
/* op1 is a register or memory reference */
if (i->mod == 0xc0) {
- bx_panic("LGDT generating exception 6\n");
+ bio->panic("LGDT generating exception 6\n");
UndefinedOpcode(i);
return;
}
@@ -835,19 +854,19 @@ BX_CPU_C::LGDT_Ms(BxInstruction_t *i)
BX_CPU_C::LIDT_Ms(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("LIDT_Ms: not supported on 8086!\n");
+ bio->panic("LIDT_Ms: not supported on 8086!\n");
#else
Bit16u limit_16;
Bit32u base_32;
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
invalidate_prefetch_q();
if (protected_mode()) {
if (CPL != 0) {
- bx_panic("LIDT(): CPL(%u) != 0\n", (unsigned) CPL);
+ bio->panic("LIDT(): CPL(%u) != 0\n", (unsigned) CPL);
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -856,7 +875,7 @@ BX_CPU_C::LIDT_Ms(BxInstruction_t *i)
/* op1 is a register or memory reference */
if (i->mod == 0xc0) {
/* undefined opcode exception */
- bx_panic("LIDT generating exception 6\n");
+ bio->panic("LIDT generating exception 6\n");
UndefinedOpcode(i);
return;
}

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-cpu_protect_ctrl_pro_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/protect_ctrl_pro.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/protect_ctrl_pro.cc Tue Oct 17 12:04:01 2000
@@ -34,15 +34,15 @@
void
BX_CPU_C::enter_protected_mode(void)
{
-// bx_printf("processor switching into PROTECTED mode!!!\n");
+// bio->printf("processor switching into PROTECTED mode!!!\n");
// debug(BX_CPU_THIS_PTR prev_eip);
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
- if (bx_dbg.reset)
- bx_printf("processor switching into PROTECTED mode!!!\n");
+ if (bio->getdbg().reset)
+ bio->printf("processor switching into PROTECTED mode!!!\n");
if ( BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl!=0 || BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.rpl!=0 )
- bx_panic("enter_protected_mode: CS or SS rpl != 0\n");
+ bio->panic("enter_protected_mode: CS or SS rpl != 0\n");
}
@@ -50,13 +50,13 @@ if ( BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS
BX_CPU_C::enter_real_mode(void)
{
// ???
-// bx_printf("processor switching into REAL mode!!!\n");
+// bio->printf("processor switching into REAL mode!!!\n");
// debug(BX_CPU_THIS_PTR prev_eip);
- if (v8086_mode()) bx_panic("protect_ctrl: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("protect_ctrl: v8086 mode unsupported\n");
- if (bx_dbg.reset)
- bx_printf("processor switching into REAL mode!!!\n");
+ if (bio->getdbg().reset)
+ bio->printf("processor switching into REAL mode!!!\n");
if ( BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl!=0 || BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.rpl!=0 )
- bx_panic("enter_real_mode: CS or SS rpl != 0\n");
+ bio->panic("enter_real_mode: CS or SS rpl != 0\n");
}

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-cpu_segment_ctrl_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/segment_ctrl.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/segment_ctrl.cc Tue Oct 17 12:04:01 2000
@@ -40,7 +40,7 @@ BX_CPU_C::LES_GvMp(BxInstruction_t *i)
{
if (i->mod == 0xc0) {
// (BW) NT seems to use this when booting.
- bx_printf("invalid use of LES, must use memory reference!\n");
+ bio->printf("invalid use of LES, must use memory reference!\n");
UndefinedOpcode(i);
}
@@ -74,7 +74,7 @@ BX_CPU_C::LES_GvMp(BxInstruction_t *i)
BX_CPU_C::LDS_GvMp(BxInstruction_t *i)
{
if (i->mod == 0xc0) {
- bx_panic("invalid use of LDS, must use memory reference!\n");
+ bio->panic("invalid use of LDS, must use memory reference!\n");
UndefinedOpcode(i);
}
@@ -108,11 +108,11 @@ BX_CPU_C::LDS_GvMp(BxInstruction_t *i)
BX_CPU_C::LFS_GvMp(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("lfs_gvmp: not supported on 8086\n");
+ bio->panic("lfs_gvmp: not supported on 8086\n");
#else /* 386+ */
if (i->mod == 0xc0) {
- bx_panic("invalid use of LFS, must use memory reference!\n");
+ bio->panic("invalid use of LFS, must use memory reference!\n");
UndefinedOpcode(i);
}
@@ -145,11 +145,11 @@ BX_CPU_C::LFS_GvMp(BxInstruction_t *i)
BX_CPU_C::LGS_GvMp(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("lgs_gvmp: not supported on 8086\n");
+ bio->panic("lgs_gvmp: not supported on 8086\n");
#else /* 386+ */
if (i->mod == 0xc0) {
- bx_panic("invalid use of LGS, must use memory reference!\n");
+ bio->panic("invalid use of LGS, must use memory reference!\n");
UndefinedOpcode(i);
}
@@ -182,11 +182,11 @@ BX_CPU_C::LGS_GvMp(BxInstruction_t *i)
BX_CPU_C::LSS_GvMp(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("lss_gvmp: not supported on 8086\n");
+ bio->panic("lss_gvmp: not supported on 8086\n");
#else /* 386+ */
if (i->mod == 0xc0) {
- bx_panic("invalid use of LSS, must use memory reference!\n");
+ bio->panic("invalid use of LSS, must use memory reference!\n");
UndefinedOpcode(i);
}

View File

@ -0,0 +1,219 @@
$OpenBSD: patch-cpu_segment_ctrl_pro_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/segment_ctrl_pro.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/segment_ctrl_pro.cc Tue Oct 31 12:21:32 2000
@@ -70,7 +70,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
Bit32u dword1, dword2;
if ((new_value & 0xfffc) == 0) { /* null selector */
- bx_panic("load_seg_reg: SS: new_value == 0\n");
+ bio->panic("[CPU%u] load_seg_reg: SS: new_value == 0\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
@@ -83,8 +83,8 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
if (ti == 0) { /* GDT */
if ((index*8 + 7) > BX_CPU_THIS_PTR gdtr.limit) {
- bx_panic("load_seg_reg: GDT: %s: index(%04x) > limit(%06x)\n",
- BX_CPU_THIS_PTR strseg(seg), (unsigned) index, (unsigned) BX_CPU_THIS_PTR gdtr.limit);
+ bio->panic("[CPU%u] load_seg_reg: GDT: %s: index(%04x) > limit(%06x)\n",
+ BX_SIM_ID, BX_CPU_THIS_PTR strseg(seg), (unsigned) index, (unsigned) BX_CPU_THIS_PTR gdtr.limit);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -95,12 +95,12 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
}
else { /* LDT */
if (BX_CPU_THIS_PTR ldtr.cache.valid==0) { /* ??? */
- bx_printf("load_seg_reg: LDT invalid\n");
+ bio->printf("[CPU%u] load_seg_reg: LDT invalid\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
if ((index*8 + 7) > BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit) {
- bx_printf("load_seg_reg ss: LDT: index > limit\n");
+ bio->printf("[CPU%u] load_seg_reg ss: LDT: index > limit\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -112,7 +112,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
/* selector's RPL must = CPL, else #GP(selector) */
if (rpl != CPL) {
- bx_printf("load_seg_reg(): rpl != CPL\n");
+ bio->printf("[CPU%u] load_seg_reg(): rpl != CPL\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -120,7 +120,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
parse_descriptor(dword1, dword2, &descriptor);
if (descriptor.valid==0) {
- bx_printf("load_seg_reg(): valid bit cleared\n");
+ bio->printf("[CPU%u] load_seg_reg(): valid bit cleared\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -129,19 +129,19 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
if ( (descriptor.segment==0) ||
descriptor.u.segment.executable ||
descriptor.u.segment.r_w==0 ) {
- bx_printf("load_seg_reg(): not writable data segment\n");
+ bio->printf("[CPU%u] load_seg_reg(): not writable data segment\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
}
/* DPL in the AR byte must equal CPL else #GP(selector) */
if (descriptor.dpl != CPL) {
- bx_printf("load_seg_reg(): dpl != CPL\n");
+ bio->printf("[CPU%u] load_seg_reg(): dpl != CPL\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
}
/* segment must be marked PRESENT else #SS(selector) */
if (descriptor.p == 0) {
- bx_printf("load_seg_reg(): not present\n");
+ bio->printf("[CPU%u] load_seg_reg(): not present\n", BX_SIM_ID);
exception(BX_SS_EXCEPTION, new_value & 0xfffc, 0);
}
@@ -197,8 +197,8 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
if (ti == 0) { /* GDT */
if ((index*8 + 7) > BX_CPU_THIS_PTR gdtr.limit) {
- bx_printf("load_seg_reg: GDT: %s: index(%04x) > limit(%06x)\n",
- BX_CPU_THIS_PTR strseg(seg), (unsigned) index, (unsigned) BX_CPU_THIS_PTR gdtr.limit);
+ bio->printf("[CPU%u] load_seg_reg: GDT: %s: index(%04x) > limit(%06x)\n",
+ BX_SIM_ID, BX_CPU_THIS_PTR strseg(seg), (unsigned) index, (unsigned) BX_CPU_THIS_PTR gdtr.limit);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -209,12 +209,12 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
}
else { /* LDT */
if (BX_CPU_THIS_PTR ldtr.cache.valid==0) {
- bx_printf("load_seg_reg: LDT invalid\n");
+ bio->printf("[CPU%u] load_seg_reg: LDT invalid\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
if ((index*8 + 7) > BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit) {
- bx_printf("load_seg_reg ds,es: LDT: index > limit\n");
+ bio->printf("[CPU%u] load_seg_reg ds,es: LDT: index > limit\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -227,7 +227,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
parse_descriptor(dword1, dword2, &descriptor);
if (descriptor.valid==0) {
- bx_printf("load_seg_reg(): valid bit cleared\n");
+ bio->printf("[CPU%u] load_seg_reg(): valid bit cleared\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -236,7 +236,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
if ( descriptor.segment==0 ||
(descriptor.u.segment.executable==1 &&
descriptor.u.segment.r_w==0) ) {
- bx_printf("load_seg_reg(): not data or readable code\n");
+ bio->printf("[CPU%u] load_seg_reg(): not data or readable code\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -246,7 +246,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
if ( descriptor.u.segment.executable==0 ||
descriptor.u.segment.c_ed==0 ) {
if ((rpl > descriptor.dpl) || (CPL > descriptor.dpl)) {
- bx_printf("load_seg_reg: RPL & CPL must be <= DPL\n");
+ bio->printf("[CPU%u] load_seg_reg: RPL & CPL must be <= DPL\n", BX_SIM_ID);
exception(BX_GP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -254,7 +254,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
/* segment must be marked PRESENT else #NP(selector) */
if (descriptor.p == 0) {
- bx_printf("load_seg_reg: segment not present\n");
+ bio->printf("[CPU%u] load_seg_reg: segment not present\n", BX_SIM_ID);
exception(BX_NP_EXCEPTION, new_value & 0xfffc, 0);
return;
}
@@ -281,7 +281,7 @@ BX_CPU_C::load_seg_reg(bx_segment_reg_t
return;
}
else {
- bx_panic("load_seg_reg(): invalid segment register passed!\n");
+ bio->panic("[CPU%u] load_seg_reg(): invalid segment register passed!\n", BX_SIM_ID);
return;
}
}
@@ -447,7 +447,7 @@ BX_CPU_C::parse_descriptor(Bit32u dword1
temp->valid = 1;
break;
#endif
- default: bx_panic("parse_descriptor(): case %d unfinished\n",
+ default: bio->panic("parse_descriptor(): case %d unfinished\n",
(unsigned) temp->type);
temp->valid = 0;
}
@@ -465,13 +465,13 @@ BX_CPU_C::load_ldtr(bx_selector_t *selec
}
if (!descriptor)
- bx_panic("load_ldtr(): descriptor == NULL!\n");
+ bio->panic("load_ldtr(): descriptor == NULL!\n");
BX_CPU_THIS_PTR ldtr.cache = *descriptor; /* whole structure copy */
BX_CPU_THIS_PTR ldtr.selector = *selector;
if (BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit < 7) {
- bx_panic("load_ldtr(): ldtr.limit < 7\n");
+ bio->panic("load_ldtr(): ldtr.limit < 7\n");
}
BX_CPU_THIS_PTR ldtr.cache.valid = 1;
@@ -500,10 +500,10 @@ BX_CPU_C::load_ss(bx_selector_t *selecto
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.rpl = cpl;
if ( (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value & 0xfffc) == 0 )
- bx_panic("load_ss(): null selector passed\n");
+ bio->panic("load_ss(): null selector passed\n");
if ( !BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid ) {
- bx_panic("load_ss(): invalid selector/descriptor passed.\n");
+ bio->panic("load_ss(): invalid selector/descriptor passed.\n");
}
}
@@ -516,12 +516,12 @@ BX_CPU_C::fetch_raw_descriptor(bx_select
{
if (selector->ti == 0) { /* GDT */
if ((selector->index*8 + 7) > BX_CPU_THIS_PTR gdtr.limit) {
-bx_printf("-----------------------------------\n");
-bx_printf("selector->index*8 + 7 = %u\n", (unsigned) selector->index*8 + 7);
-bx_printf("gdtr.limit = %u\n", (unsigned) BX_CPU_THIS_PTR gdtr.limit);
- bx_printf("fetch_raw_descriptor: GDT: index > limit\n");
+bio->printf("-----------------------------------\n");
+bio->printf("selector->index*8 + 7 = %u\n", (unsigned) selector->index*8 + 7);
+bio->printf("gdtr.limit = %u\n", (unsigned) BX_CPU_THIS_PTR gdtr.limit);
+ bio->printf("fetch_raw_descriptor: GDT: index > limit\n");
debug(BX_CPU_THIS_PTR prev_eip);
-bx_printf("-----------------------------------\n");
+bio->printf("-----------------------------------\n");
exception(exception_no, selector->value & 0xfffc, 0);
return;
}
@@ -532,10 +532,10 @@ bx_printf("-----------------------------
}
else { /* LDT */
if (BX_CPU_THIS_PTR ldtr.cache.valid==0) {
- bx_panic("fetch_raw_descriptor: LDTR.valid=0\n");
+ bio->panic("fetch_raw_descriptor: LDTR.valid=0\n");
}
if ((selector->index*8 + 7) > BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit) {
- bx_panic("fetch_raw_descriptor: LDT: index > limit\n");
+ bio->panic("fetch_raw_descriptor: LDT: index > limit\n");
exception(exception_no, selector->value & 0xfffc, 0);
return;
}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-cpu_shift16_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/shift16.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/shift16.cc Tue Oct 17 12:04:01 2000
@@ -91,7 +91,7 @@ BX_CPU_C::SHLD_EwGw(BxInstruction_t *i)
BX_CPU_C::SHRD_EwGw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("shrd_evgvib: not supported on < 386\n");
+ bio->panic("shrd_evgvib: not supported on < 386\n");
#else
Bit16u op1_16, op2_16, result_16;
Bit32u temp_32, result_32;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-cpu_shift32_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/shift32.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/shift32.cc Tue Oct 17 12:04:01 2000
@@ -79,7 +79,7 @@ BX_CPU_C::SHLD_EdGd(BxInstruction_t *i)
BX_CPU_C::SHRD_EdGd(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 3
- bx_panic("shrd_evgvib: not supported on < 386\n");
+ bio->panic("shrd_evgvib: not supported on < 386\n");
#else
Bit32u op1_32, op2_32, result_32;
unsigned count;

View File

@ -0,0 +1,73 @@
$OpenBSD: patch-cpu_soft_int_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/soft_int.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/soft_int.cc Tue Oct 31 12:28:56 2000
@@ -37,12 +37,12 @@
BX_CPU_C::BOUND_GvMa(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("BOUND_GvMa: not supported on 8086!\n");
+ bio->panic("BOUND_GvMa: not supported on 8086!\n");
#else
if (i->mod == 0xc0) {
/* undefined opcode exception */
- bx_panic("bound: op2 must be mem ref\n");
+ bio->panic("bound: op2 must be mem ref\n");
UndefinedOpcode(i);
}
@@ -57,7 +57,7 @@ BX_CPU_C::BOUND_GvMa(BxInstruction_t *i)
/* ??? */
if ( (op1_32 < bound_min) || (op1_32 > bound_max) ) {
- bx_printf("BOUND: fails bounds test\n");
+ bio->printf("BOUND: fails bounds test\n");
exception(5, 0, 0);
}
}
@@ -72,7 +72,7 @@ BX_CPU_C::BOUND_GvMa(BxInstruction_t *i)
/* ??? */
if ( (op1_16 < bound_min) || (op1_16 > bound_max) ) {
- bx_printf("BOUND: fails bounds test\n");
+ bio->printf("BOUND: fails bounds test\n");
exception(5, 0, 0);
}
}
@@ -105,7 +105,7 @@ BX_CPU_C::INT3(BxInstruction_t *i)
BX_CPU_THIS_PTR show_flag |= Flag_int;
#endif
-//bx_panic("INT3: bailing\n");
+//bio->panic("INT3: bailing\n");
interrupt(3, 1, 0, 0);
BX_INSTR_FAR_BRANCH(BX_INSTR_IS_INT,
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value,
@@ -125,15 +125,15 @@ BX_CPU_C::INT_Ib(BxInstruction_t *i)
imm8 = i->Ib;
if (v8086_mode() && (IOPL<3)) {
- //bx_printf("int_ib: v8086: IOPL<3\n");
+ //bio->printf("int_ib: v8086: IOPL<3\n");
exception(BX_GP_EXCEPTION, 0, 0);
}
#ifdef SHOW_EXIT_STATUS
if ( (imm8 == 0x21) && (AH == 0x4c) ) {
- fprintf(stderr, "#(%u) INT 21/4C called AL=0x%02x, BX=0x%04x\n", BX_SIM_ID,
+ bio->printf("#(%u) INT 21/4C called AL=0x%02x, BX=0x%04x\n", BX_SIM_ID,
(unsigned) AL, (unsigned) BX);
- bx_printf("INT 21/4C called AL=0x%02x, BX=0x%04x\n", (unsigned) AL, (unsigned) BX);
+ bio->printf("INT 21/4C called AL=0x%02x, BX=0x%04x\n", (unsigned) AL, (unsigned) BX);
}
#endif
@@ -153,7 +153,7 @@ BX_CPU_C::INTO(BxInstruction_t *i)
#endif
/* ??? is this IOPL sensitive ? */
- if (v8086_mode()) bx_panic("soft_int: v8086 mode unsupported\n");
+ if (v8086_mode()) bio->panic("soft_int: v8086 mode unsupported\n");
if (get_OF()) {
interrupt(4, 1, 0, 0);

View File

@ -0,0 +1,56 @@
$OpenBSD: patch-cpu_stack16_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/stack16.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/stack16.cc Tue Oct 17 12:04:01 2000
@@ -71,7 +71,7 @@ BX_CPU_C::POP_Ew(BxInstruction_t *i)
BX_CPU_C::PUSHAD16(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("PUSHAD: not supported on an 8086\n");
+ bio->panic("PUSHAD: not supported on an 8086\n");
#else
Bit32u temp_ESP;
Bit16u sp;
@@ -85,7 +85,7 @@ BX_CPU_C::PUSHAD16(BxInstruction_t *i)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( !can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 16) ) {
- bx_panic("PUSHA(): stack doesn't have enough room!\n");
+ bio->panic("PUSHA(): stack doesn't have enough room!\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@@ -94,7 +94,7 @@ BX_CPU_C::PUSHAD16(BxInstruction_t *i)
#endif
{
if (temp_ESP < 16)
- bx_panic("pushad: eSP < 16\n");
+ bio->panic("pushad: eSP < 16\n");
}
sp = SP;
@@ -115,14 +115,14 @@ BX_CPU_C::PUSHAD16(BxInstruction_t *i)
BX_CPU_C::POPAD16(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("POPAD not supported on an 8086\n");
+ bio->panic("POPAD not supported on an 8086\n");
#else /* 286+ */
Bit16u di, si, bp, tmp, bx, dx, cx, ax;
if (protected_mode()) {
if ( !can_pop(16) ) {
- bx_panic("pop_a: not enough bytes on stack\n");
+ bio->panic("pop_a: not enough bytes on stack\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@@ -152,7 +152,7 @@ BX_CPU_C::POPAD16(BxInstruction_t *i)
BX_CPU_C::PUSH_Iw(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("PUSH_Iv: not supported on 8086!\n");
+ bio->panic("PUSH_Iv: not supported on 8086!\n");
#else
Bit16u imm16;

View File

@ -0,0 +1,112 @@
$OpenBSD: patch-cpu_stack32_cc,v 1.1 2001/02/02 16:59:09 todd Exp $
--- cpu/stack32.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/stack32.cc Tue Oct 17 12:04:01 2000
@@ -200,7 +200,7 @@ BX_CPU_C::POP_SS(BxInstruction_t *i)
BX_CPU_C::PUSHAD32(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("PUSHAD: not supported on an 8086\n");
+ bio->panic("PUSHAD: not supported on an 8086\n");
#else
Bit32u temp_ESP;
Bit32u esp;
@@ -213,14 +213,14 @@ BX_CPU_C::PUSHAD32(BxInstruction_t *i)
if (protected_mode()) {
if ( !can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 32) ) {
- bx_panic("PUSHAD(): stack doesn't have enough room!\n");
+ bio->panic("PUSHAD(): stack doesn't have enough room!\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
}
else {
if (temp_ESP < 32)
- bx_panic("pushad: eSP < 32\n");
+ bio->panic("pushad: eSP < 32\n");
}
esp = ESP;
@@ -241,13 +241,13 @@ BX_CPU_C::PUSHAD32(BxInstruction_t *i)
BX_CPU_C::POPAD32(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("POPAD not supported on an 8086\n");
+ bio->panic("POPAD not supported on an 8086\n");
#else /* 286+ */
Bit32u edi, esi, ebp, etmp, ebx, edx, ecx, eax;
if (protected_mode()) {
if ( !can_pop(32) ) {
- bx_panic("pop_ad: not enough bytes on stack\n");
+ bio->panic("pop_ad: not enough bytes on stack\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@@ -277,7 +277,7 @@ BX_CPU_C::POPAD32(BxInstruction_t *i)
BX_CPU_C::PUSH_Id(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("PUSH_Iv: not supported on 8086!\n");
+ bio->panic("PUSH_Iv: not supported on 8086!\n");
#else
Bit32u imm32;
@@ -310,7 +310,7 @@ BX_CPU_C::PUSH_Ed(BxInstruction_t *i)
BX_CPU_C::ENTER_IwIb(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("ENTER_IwIb: not supported by 8086!\n");
+ bio->panic("ENTER_IwIb: not supported by 8086!\n");
#else
Bit32u frame_ptr32;
Bit16u frame_ptr16;
@@ -322,10 +322,10 @@ BX_CPU_C::ENTER_IwIb(BxInstruction_t *i)
level %= 32;
/* ??? */
-if (level) bx_panic("enter(): level > 0\n");
+if (level) bio->panic("enter(): level > 0\n");
//if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b && i->os_32==0) {
-// bx_printf("enter(): stacksize!=opsize: I'm unsure of the code for this\n");
-// bx_panic(" The Intel manuals are a mess on this one!\n");
+// bio->printf("enter(): stacksize!=opsize: I'm unsure of the code for this\n");
+// bio->panic(" The Intel manuals are a mess on this one!\n");
// }
if ( protected_mode() ) {
@@ -348,7 +348,7 @@ if (level) bx_panic("enter(): level > 0\
else
temp_ESP = SP;
if ( !can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, bytes_to_push) ) {
- bx_panic("ENTER: not enough room on stack!\n");
+ bio->panic("ENTER: not enough room on stack!\n");
exception(BX_SS_EXCEPTION, 0, 0);
}
}
@@ -444,7 +444,7 @@ if (level) bx_panic("enter(): level > 0\
BX_CPU_C::LEAVE(BxInstruction_t *i)
{
#if BX_CPU_LEVEL < 2
- bx_panic("LEAVE: not supported by 8086!\n");
+ bio->panic("LEAVE: not supported by 8086!\n");
#else
Bit32u temp_EBP;
@@ -461,14 +461,14 @@ BX_CPU_C::LEAVE(BxInstruction_t *i)
if ( protected_mode() ) {
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.c_ed) { /* expand up */
if (temp_EBP <= BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled) {
- bx_panic("LEAVE: BP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].limit\n");
+ bio->panic("LEAVE: BP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].limit\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
}
else { /* normal */
if (temp_EBP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled) {
- bx_panic("LEAVE: BP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].limit\n");
+ bio->panic("LEAVE: BP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].limit\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}

View File

@ -0,0 +1,206 @@
$OpenBSD: patch-cpu_stack_pro_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- cpu/stack_pro.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/stack_pro.cc Tue Oct 17 12:04:01 2000
@@ -45,7 +45,7 @@ BX_CPU_C::push_16(Bit16u value16)
#endif
temp_ESP = SP;
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 2)) {
- bx_panic("push_16(): can't push on stack\n");
+ bio->panic("push_16(): can't push on stack\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@@ -63,13 +63,13 @@ BX_CPU_C::push_16(Bit16u value16)
{ /* real mode */
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) {
if (ESP == 1)
- bx_panic("CPU shutting down due to lack of stack space, ESP==1\n");
+ bio->panic("CPU shutting down due to lack of stack space, ESP==1\n");
ESP -= 2;
temp_ESP = ESP;
}
else {
if (SP == 1)
- bx_panic("CPU shutting down due to lack of stack space, SP==1\n");
+ bio->panic("CPU shutting down due to lack of stack space, SP==1\n");
SP -= 2;
temp_ESP = SP;
}
@@ -89,13 +89,13 @@ BX_CPU_C::push_32(Bit32u value32)
/* 32bit stack size: pushes use SS:ESP */
if (protected_mode()) {
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, ESP, 4)) {
- bx_panic("push_32(): push outside stack limits\n");
+ bio->panic("push_32(): push outside stack limits\n");
/* #SS(0) */
}
}
else { /* real mode */
if ((ESP>=1) && (ESP<=3)) {
- bx_panic("push_32: ESP=%08x\n", (unsigned) ESP);
+ bio->panic("push_32: ESP=%08x\n", (unsigned) ESP);
}
}
@@ -107,13 +107,13 @@ BX_CPU_C::push_32(Bit32u value32)
else { /* 16bit stack size: pushes use SS:SP */
if (protected_mode()) {
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, SP, 4)) {
- bx_panic("push_32(): push outside stack limits\n");
+ bio->panic("push_32(): push outside stack limits\n");
/* #SS(0) */
}
}
else { /* real mode */
if ((SP>=1) && (SP<=3)) {
- bx_panic("push_32: SP=%08x\n", (unsigned) SP);
+ bio->panic("push_32: SP=%08x\n", (unsigned) SP);
}
}
@@ -140,7 +140,7 @@ BX_CPU_C::pop_16(Bit16u *value16_ptr)
#if BX_CPU_LEVEL >= 2
if (protected_mode()) {
if ( !can_pop(2) ) {
- bx_printf("pop_16(): can't pop from stack\n");
+ bio->printf("pop_16(): can't pop from stack\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@@ -172,7 +172,7 @@ BX_CPU_C::pop_32(Bit32u *value32_ptr)
/* 16 bit stack mode: use SS:SP */
if (protected_mode()) {
if ( !can_pop(4) ) {
- bx_panic("pop_32(): can't pop from stack\n");
+ bio->panic("pop_32(): can't pop from stack\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@@ -195,7 +195,7 @@ BX_CPU_C::pop_32(Bit32u *value32_ptr)
BX_CPU_C::can_push(bx_descriptor_t *descriptor, Bit32u esp, Bit32u bytes)
{
if ( real_mode() ) { /* code not needed ??? */
- bx_panic("can_push(): called in real mode\n");
+ bio->panic("can_push(): called in real mode\n");
return(0); /* never gets here */
}
@@ -205,12 +205,12 @@ BX_CPU_C::can_push(bx_descriptor_t *desc
if (descriptor->valid==0) {
- bx_panic("can_push(): SS invalidated.\n");
+ bio->panic("can_push(): SS invalidated.\n");
return(0);
}
if (descriptor->p==0) {
- bx_panic("can_push(): not present\n");
+ bio->panic("can_push(): not present\n");
return(0);
}
@@ -224,27 +224,27 @@ BX_CPU_C::can_push(bx_descriptor_t *desc
expand_down_limit = 0x0000ffff;
if (esp==0) {
- bx_panic("can_push(): esp=0, wraparound?\n");
+ bio->panic("can_push(): esp=0, wraparound?\n");
return(0);
}
if (esp < bytes) {
- bx_panic("can_push(): expand-down: esp < N\n");
+ bio->panic("can_push(): expand-down: esp < N\n");
return(0);
}
if ( (esp - bytes) <= descriptor->u.segment.limit_scaled ) {
- bx_panic("can_push(): expand-down: esp-N < limit\n");
+ bio->panic("can_push(): expand-down: esp-N < limit\n");
return(0);
}
if ( esp > expand_down_limit ) {
- bx_panic("can_push(): esp > expand-down-limit\n");
+ bio->panic("can_push(): esp > expand-down-limit\n");
return(0);
}
return(1);
}
else { /* normal (expand-up) segment */
if (descriptor->u.segment.limit_scaled==0) {
- bx_panic("can_push(): found limit of 0\n");
+ bio->panic("can_push(): found limit of 0\n");
return(0);
}
@@ -255,17 +255,17 @@ BX_CPU_C::can_push(bx_descriptor_t *desc
return(1);
if ((descriptor->u.segment.d_b==0) && (descriptor->u.segment.limit_scaled>=0xffff))
return(1);
- bx_panic("can_push(): esp=0, normal, wraparound? limit=%08x\n",
+ bio->panic("can_push(): esp=0, normal, wraparound? limit=%08x\n",
descriptor->u.segment.limit_scaled);
return(0);
}
if (esp < bytes) {
- bx_printf("can_push(): expand-up: esp < N\n");
+ bio->printf("can_push(): expand-up: esp < N\n");
return(0);
}
if ((esp-1) > descriptor->u.segment.limit_scaled) {
- bx_printf("can_push(): expand-up: SP > limit\n");
+ bio->printf("can_push(): expand-up: SP > limit\n");
return(0);
}
/* all checks pass */
@@ -282,7 +282,7 @@ BX_CPU_C::can_pop(Bit32u bytes)
Bit32u temp_ESP, expand_down_limit;
/* ??? */
- if (real_mode()) bx_panic("can_pop(): called in real mode?\n");
+ if (real_mode()) bio->panic("can_pop(): called in real mode?\n");
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) { /* Big bit set: use ESP */
temp_ESP = ESP;
@@ -294,19 +294,19 @@ BX_CPU_C::can_pop(Bit32u bytes)
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid==0) {
- bx_panic("can_pop(): SS invalidated.\n");
+ bio->panic("can_pop(): SS invalidated.\n");
return(0); /* never gets here */
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p==0) { /* ??? */
- bx_panic("can_pop(): SS.p = 0\n");
+ bio->panic("can_pop(): SS.p = 0\n");
return(0);
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.c_ed) { /* expand down segment */
if ( temp_ESP == expand_down_limit ) {
- bx_panic("can_pop(): found SP=ffff\n");
+ bio->panic("can_pop(): found SP=ffff\n");
return(0);
}
if ( ((expand_down_limit - temp_ESP) + 1) >= bytes )
@@ -315,14 +315,14 @@ BX_CPU_C::can_pop(Bit32u bytes)
}
else { /* normal (expand-up) segment */
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled==0) {
- bx_panic("can_pop(): SS.limit = 0\n");
+ bio->panic("can_pop(): SS.limit = 0\n");
}
if ( temp_ESP == expand_down_limit ) {
- bx_panic("can_pop(): found SP=ffff\n");
+ bio->panic("can_pop(): found SP=ffff\n");
return(0);
}
if ( temp_ESP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled ) {
- bx_panic("can_pop(): eSP > SS.limit\n");
+ bio->panic("can_pop(): eSP > SS.limit\n");
return(0);
}
if ( ((BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled - temp_ESP) + 1) >= bytes )

View File

@ -0,0 +1,370 @@
$OpenBSD: patch-cpu_tasking_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- cpu/tasking.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/tasking.cc Tue Oct 31 12:28:32 2000
@@ -147,7 +147,7 @@ BX_CPU_C::task_switch(bx_selector_t *tss
unsigned exception_no;
Bit16u error_code;
-//fprintf(stderr, "TASKING: ENTER\n");
+//bio->printf("TASKING: ENTER\n");
invalidate_prefetch_q();
@@ -198,7 +198,7 @@ BX_CPU_C::task_switch(bx_selector_t *tss
// Task State Seg must be present, else #NP(TSS selector)
if (tss_descriptor->p==0) {
- bx_printf("task_switch: TSS.p == 0\n");
+ bio->printf("task_switch: TSS.p == 0\n");
exception(BX_NP_EXCEPTION, tss_selector->value & 0xfffc, 0);
}
@@ -206,7 +206,7 @@ BX_CPU_C::task_switch(bx_selector_t *tss
if (tss_selector->ti ||
tss_descriptor->valid==0 ||
new_TSS_limit < new_TSS_max) {
- bx_panic("task_switch(): TR not valid\n");
+ bio->panic("task_switch(): TR not valid\n");
exception(BX_TS_EXCEPTION, tss_selector->value & 0xfffc, 0);
}
@@ -293,7 +293,7 @@ BX_CPU_C::task_switch(bx_selector_t *tss
#if 0
if (ss_descriptor.u.segment.d_b && (tss_descriptor->type<9)) {
- fprintf(stderr, "++++++++++++++++++++++++++\n");
+ bio->printf("++++++++++++++++++++++++++\n");
BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = 0;
exception(BX_SS_EXCEPTION, raw_ss_selector & 0xfffc, 0);
//exception(BX_TS_EXCEPTION, tss_selector->value & 0xfffc, 0);
@@ -510,7 +510,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// LDTR
if (ldt_selector.ti) {
// LDT selector must be in GDT
- bx_printf("task_switch: bad LDT selector TI=1\n");
+ bio->printf("task_switch: bad LDT selector TI=1\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ldt_selector & 0xfffc;
goto post_exception;
@@ -521,7 +521,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&ldt_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad LDT fetch\n");
+ bio->printf("task_switch: bad LDT fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ldt_selector & 0xfffc;
goto post_exception;
@@ -534,7 +534,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
ldt_descriptor.type!=2 ||
ldt_descriptor.segment ||
ldt_descriptor.u.ldt.limit<7) {
- bx_printf("task_switch: bad LDT segment\n");
+ bio->printf("task_switch: bad LDT segment\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ldt_selector & 0xfffc;
goto post_exception;
@@ -569,7 +569,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&cs_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad CS fetch\n");
+ bio->printf("task_switch: bad CS fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_cs_selector & 0xfffc;
goto post_exception;
@@ -580,7 +580,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// CS descriptor AR byte must indicate code segment else #TS(CS)
if (cs_descriptor.valid==0 || cs_descriptor.segment==0 ||
cs_descriptor.u.segment.executable==0) {
- bx_panic("task_switch: CS not valid executable seg\n");
+ bio->panic("task_switch: CS not valid executable seg\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_cs_selector & 0xfffc;
goto post_exception;
@@ -588,7 +588,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// if non-conforming then DPL must equal selector RPL else #TS(CS)
else if (cs_descriptor.u.segment.c_ed==0 &&
cs_descriptor.dpl!=cs_selector.rpl) {
- bx_printf("task_switch: non-conforming: CS.dpl!=CS.RPL\n");
+ bio->printf("task_switch: non-conforming: CS.dpl!=CS.RPL\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_cs_selector & 0xfffc;
goto post_exception;
@@ -596,14 +596,14 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// if conforming then DPL must be <= selector RPL else #TS(CS)
else if (cs_descriptor.u.segment.c_ed &&
cs_descriptor.dpl>cs_selector.rpl) {
- bx_printf("task_switch: conforming: CS.dpl>RPL\n");
+ bio->printf("task_switch: conforming: CS.dpl>RPL\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_cs_selector & 0xfffc;
goto post_exception;
}
// Code segment is present in memory, else #NP(new code segment)
else if (cs_descriptor.p==0) {
- bx_panic("task_switch: CS.p==0\n");
+ bio->panic("task_switch: CS.p==0\n");
exception_no = BX_NP_EXCEPTION;
error_code = raw_cs_selector & 0xfffc;
goto post_exception;
@@ -613,7 +613,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
}
else {
// If new cs selector is null #TS(CS)
- bx_panic("task_switch: CS NULL\n");
+ bio->panic("task_switch: CS NULL\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_cs_selector & 0xfffc;
goto post_exception;
@@ -625,7 +625,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&ss_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad SS fetch\n");
+ bio->printf("task_switch: bad SS fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -639,7 +639,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
ss_descriptor.segment==0 ||
ss_descriptor.u.segment.executable ||
ss_descriptor.u.segment.r_w==0) {
- bx_printf("task_switch: SS not valid\n");
+ bio->printf("task_switch: SS not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -649,7 +649,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// Stack segment is present in memory, else #SF(new stack segment)
//
else if (ss_descriptor.p==0) {
- bx_panic("task_switch: SS not present\n");
+ bio->panic("task_switch: SS not present\n");
exception_no = BX_SS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -657,7 +657,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// Stack segment DPL matches CS.RPL, else #TS(new stack segment)
else if (ss_descriptor.dpl != cs_selector.rpl) {
- bx_panic("task_switch: SS.rpl != CS.RPL\n");
+ bio->panic("task_switch: SS.rpl != CS.RPL\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -665,7 +665,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
// Stack segment DPL matches selector RPL, else #TS(new stack segment)
else if (ss_descriptor.dpl != ss_selector.rpl) {
- bx_panic("task_switch: SS.dpl != SS.rpl\n");
+ bio->panic("task_switch: SS.dpl != SS.rpl\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -674,7 +674,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
#if 0
// +++
else if (ss_descriptor.u.segment.d_b && (tss_descriptor->type<9)) {
- fprintf(stderr, "++++++++++++++++++++++++++\n");
+ bio->printf("++++++++++++++++++++++++++\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -685,7 +685,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
}
else {
// SS selector is valid, else #TS(new stack segment)
- bx_panic("task_switch: SS NULL\n");
+ bio->panic("task_switch: SS NULL\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ss_selector & 0xfffc;
goto post_exception;
@@ -708,7 +708,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&ds_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad DS fetch\n");
+ bio->printf("task_switch: bad DS fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ds_selector & 0xfffc;
goto post_exception;
@@ -718,7 +718,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
if (ds_descriptor.valid==0 || ds_descriptor.segment==0 ||
(ds_descriptor.u.segment.executable &&
ds_descriptor.u.segment.r_w==0)) {
- bx_panic("task_switch: DS not valid\n");
+ bio->panic("task_switch: DS not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ds_selector & 0xfffc;
goto post_exception;
@@ -727,13 +727,13 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
else if (ds_descriptor.type<12 &&
(ds_descriptor.dpl<cs_selector.rpl ||
ds_descriptor.dpl<ds_selector.rpl)) {
- bx_panic("task_switch: DS.dpl not valid\n");
+ bio->panic("task_switch: DS.dpl not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_ds_selector & 0xfffc;
goto post_exception;
}
else if (ds_descriptor.p==0) {
- bx_panic("task_switch: DS.p==0\n");
+ bio->panic("task_switch: DS.p==0\n");
exception_no = BX_NP_EXCEPTION;
error_code = raw_ds_selector & 0xfffc;
goto post_exception;
@@ -750,7 +750,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&es_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad ES fetch\n");
+ bio->printf("task_switch: bad ES fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_es_selector & 0xfffc;
goto post_exception;
@@ -760,7 +760,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
if (es_descriptor.valid==0 || es_descriptor.segment==0 ||
(es_descriptor.u.segment.executable &&
es_descriptor.u.segment.r_w==0)) {
- bx_panic("task_switch: ES not valid\n");
+ bio->panic("task_switch: ES not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_es_selector & 0xfffc;
goto post_exception;
@@ -769,13 +769,13 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
else if (es_descriptor.type<12 &&
(es_descriptor.dpl<cs_selector.rpl ||
es_descriptor.dpl<es_selector.rpl)) {
- bx_panic("task_switch: ES.dpl not valid\n");
+ bio->panic("task_switch: ES.dpl not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_es_selector & 0xfffc;
goto post_exception;
}
else if (es_descriptor.p==0) {
- bx_panic("task_switch: ES.p==0\n");
+ bio->panic("task_switch: ES.p==0\n");
exception_no = BX_NP_EXCEPTION;
error_code = raw_es_selector & 0xfffc;
goto post_exception;
@@ -793,7 +793,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&fs_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad FS fetch\n");
+ bio->printf("task_switch: bad FS fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_fs_selector & 0xfffc;
goto post_exception;
@@ -803,7 +803,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
if (fs_descriptor.valid==0 || fs_descriptor.segment==0 ||
(fs_descriptor.u.segment.executable &&
fs_descriptor.u.segment.r_w==0)) {
- bx_panic("task_switch: FS not valid\n");
+ bio->panic("task_switch: FS not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_fs_selector & 0xfffc;
goto post_exception;
@@ -812,13 +812,13 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
else if (fs_descriptor.type<12 &&
(fs_descriptor.dpl<cs_selector.rpl ||
fs_descriptor.dpl<fs_selector.rpl)) {
- bx_panic("task_switch: FS.dpl not valid\n");
+ bio->panic("task_switch: FS.dpl not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_fs_selector & 0xfffc;
goto post_exception;
}
else if (fs_descriptor.p==0) {
- bx_panic("task_switch: FS.p==0\n");
+ bio->panic("task_switch: FS.p==0\n");
exception_no = BX_NP_EXCEPTION;
error_code = raw_fs_selector & 0xfffc;
goto post_exception;
@@ -835,7 +835,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
Boolean good;
good = fetch_raw_descriptor2(&gs_selector, &dword1, &dword2);
if (!good) {
- bx_printf("task_switch: bad GS fetch\n");
+ bio->printf("task_switch: bad GS fetch\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_gs_selector & 0xfffc;
goto post_exception;
@@ -845,7 +845,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
if (gs_descriptor.valid==0 || gs_descriptor.segment==0 ||
(gs_descriptor.u.segment.executable &&
gs_descriptor.u.segment.r_w==0)) {
- bx_panic("task_switch: GS not valid\n");
+ bio->panic("task_switch: GS not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_gs_selector & 0xfffc;
goto post_exception;
@@ -854,13 +854,13 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
else if (gs_descriptor.type<12 &&
(gs_descriptor.dpl<cs_selector.rpl ||
gs_descriptor.dpl<gs_selector.rpl)) {
- bx_panic("task_switch: GS.dpl not valid\n");
+ bio->panic("task_switch: GS.dpl not valid\n");
exception_no = BX_TS_EXCEPTION;
error_code = raw_gs_selector & 0xfffc;
goto post_exception;
}
else if (gs_descriptor.p==0) {
- bx_panic("task_switch: GS.p==0\n");
+ bio->panic("task_switch: GS.p==0\n");
//exception(BX_NP_EXCEPTION, raw_gs_selector & 0xfffc, 0);
exception_no = BX_NP_EXCEPTION;
error_code = raw_gs_selector & 0xfffc;
@@ -879,7 +879,7 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
if ((tss_descriptor->type>=9) && (trap_word & 0x0001)) {
BX_CPU_THIS_PTR debug_trap |= 0x00008000; // BT flag in DR6
BX_CPU_THIS_PTR async_event = 1; // so processor knows to check
- bx_printf("task_switch: T bit set in new TSS.\n");
+ bio->printf("task_switch: T bit set in new TSS.\n");
}
@@ -887,13 +887,13 @@ BX_CPU_THIS_PTR ldtr.cache.u.ldt.limit =
//
// Step 14: Begin execution of new task.
//
-//fprintf(stderr, "TASKING: LEAVE\n");
+//bio->printf("TASKING: LEAVE\n");
return;
post_exception:
BX_CPU_THIS_PTR debug_trap = 0;
BX_CPU_THIS_PTR inhibit_mask = 0;
- bx_printf("task switch: posting exception %u after commit point\n",
+ bio->printf("task switch: posting exception %u after commit point\n",
exception_no);
exception(exception_no, error_code, 0);
return;
@@ -904,7 +904,7 @@ post_exception:
BX_CPU_C::get_SS_ESP_from_TSS(unsigned pl, Bit16u *ss, Bit32u *esp)
{
if (BX_CPU_THIS_PTR tr.cache.valid==0)
- bx_panic("get_SS_ESP_from_TSS: TR.cache invalid\n");
+ bio->panic("get_SS_ESP_from_TSS: TR.cache invalid\n");
if (BX_CPU_THIS_PTR tr.cache.type==9) {
// 32-bit TSS
@@ -938,7 +938,7 @@ BX_CPU_C::get_SS_ESP_from_TSS(unsigned p
*esp = temp16; // truncate
}
else {
- bx_panic("get_SS_ESP_from_TSS: TR is bogus type (%u)\n",
+ bio->panic("get_SS_ESP_from_TSS: TR is bogus type (%u)\n",
(unsigned) BX_CPU_THIS_PTR tr.cache.type);
}
}
@@ -964,7 +964,7 @@ BX_CPU_C::task_switch(bx_selector_t *sel
UNUSED(dword1);
UNUSED(dword2);
- bx_printf("task_switch(): not complete\n");
+ bio->printf("task_switch(): not complete\n");
}
#endif

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-cpu_vm8086_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- cpu/vm8086.cc.orig Sat Mar 25 21:39:09 2000
+++ cpu/vm8086.cc Thu Oct 19 10:59:03 2000
@@ -75,13 +75,13 @@ BX_CPU_C::stack_return_to_v86(Bit32u new
// top 36 bytes of stack must be within stack limits, else #GP(0)
if ( !can_pop(36) ) {
- bx_panic("iret: VM: top 36 bytes not within limits\n");
+ bio->panic("iret: VM: top 36 bytes not within limits\n");
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
if ( new_eip & 0xffff0000 ) {
- bx_printf("IRET to V86-mode: ignoring upper 16-bits\n");
+ bio->printf("[CPU%u] IRET to V86-mode: ignoring upper 16-bits\n",BX_SIM_ID);
new_eip = new_eip & 0xffff;
}
@@ -119,13 +119,13 @@ BX_CPU_C::stack_return_to_v86(Bit32u new
void
BX_CPU_C::stack_return_from_v86(BxInstruction_t *i)
{
- //bx_printf("stack_return_from_v86:\n");
+ //bio->printf("[CPU%u] stack_return_from_v86:\n",BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
#if 0
if (IOPL != 3) {
// trap to virtual 8086 monitor
- bx_printf("stack_return_from_v86: IOPL != 3\n");
+ bio->printf("[CPU0] stack_return_from_v86: IOPL != 3\n",BX_SIM_ID);
exception(BX_GP_EXCEPTION, 0, 0);
}
@@ -277,23 +277,23 @@ BX_CPU_C::init_v8086_mode(void)
void
BX_CPU_C::stack_return_to_v86(Bit32u new_eip, Bit32u raw_cs_selector, Bit32u flags32)
{
- bx_printf("stack_return_to_v86: VM bit set in EFLAGS stack image\n");
+ bio->printf("[CPU%u] stack_return_to_v86: VM bit set in EFLAGS stack image\n",BX_SIM_ID);
v8086_message();
}
void
BX_CPU_C::stack_return_from_v86(void)
{
- bx_printf("stack_return_from_v86:\n");
+ bio->printf("[CPU%u] stack_return_from_v86:\n",BX_SIM_ID);
v8086_message();
}
void
BX_CPU_C::v8086_message(void)
{
- bx_printf("Program compiled with BX_SUPPORT_V8086_MODE = 0\n");
- bx_printf("You need to rerun the configure script and recompile\n");
- bx_printf(" to use virtual-8086 mode features.\n");
- bx_panic("Bummer!\n");
+ bio->printf("[CPU%u] Program compiled with BX_SUPPORT_V8086_MODE = 0\n",BX_SIM_ID);
+ bio->printf("[CPU%u] You need to rerun the configure script and recompile\n",BX_SIM_ID);
+ bio->printf("[CPU%u] to use virtual-8086 mode features.\n",BX_SIM_ID);
+ bio->printf("[CPU%u] Bummer!\n",BX_SIM_ID);
}
#endif // BX_SUPPORT_V8086_MODE

View File

@ -1,6 +1,6 @@
--- debug/lexer.l.orig Tue Jul 18 00:05:31 2000
+++ debug/lexer.l Tue Jul 18 00:05:42 2000
@@ -105,7 +105,7 @@
--- debug/lexer.l.orig Mon Nov 1 19:17:09 1999
+++ debug/lexer.l Tue Oct 3 13:18:08 2000
@@ -105,7 +105,7 @@ v2l { bxlval.sval = strdup(b
\/[0-9]+ { bxlval.sval = strdup(bxtext); return(BX_TOKEN_XFORMAT); }
0x[0-9a-fA-F]+ { bxlval.uval = strtoul(bxtext+2, NULL, 16); return(BX_TOKEN_NUMERIC); }
0[0-7]+ { bxlval.uval = strtoul(bxtext+1, NULL, 8); return(BX_TOKEN_NUMERIC); }

View File

@ -0,0 +1,93 @@
$OpenBSD: patch-fpu_fpu_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- fpu/fpu.cc.orig Sat Mar 25 21:57:16 2000
+++ fpu/fpu.cc Tue Oct 17 12:04:03 2000
@@ -46,7 +46,7 @@ BX_CPU_C::ESC0(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC0 not implemented\n");
+ bio->printf("ESC0 not implemented\n");
#endif
}
@@ -59,7 +59,7 @@ BX_CPU_C::ESC1(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC1 not implemented\n");
+ bio->printf("ESC1 not implemented\n");
#endif
}
@@ -72,7 +72,7 @@ BX_CPU_C::ESC2(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC2 not implemented\n");
+ bio->printf("ESC2 not implemented\n");
#endif
}
@@ -89,7 +89,7 @@ BX_CPU_C::ESC3(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC3 not implemented\n");
+ bio->printf("ESC3 not implemented\n");
#endif
}
@@ -102,7 +102,7 @@ BX_CPU_C::ESC4(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC4 not implemented\n");
+ bio->printf("ESC4 not implemented\n");
#endif
}
@@ -115,7 +115,7 @@ BX_CPU_C::ESC5(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC5 not implemented\n");
+ bio->printf("ESC5 not implemented\n");
#endif
}
@@ -128,7 +128,7 @@ BX_CPU_C::ESC6(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC6 not implemented\n");
+ bio->printf("ESC6 not implemented\n");
#endif
}
@@ -141,7 +141,7 @@ BX_CPU_C::ESC7(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("ESC7 not implemented\n");
+ bio->printf("ESC7 not implemented\n");
#endif
}
@@ -153,7 +153,7 @@ BX_CPU_C::FWAIT(BxInstruction_t *i)
// The same goes for prefix instructions, and instructions which
// modify segment registers. (pg4-16)
// BX_CPU_THIS_PTR single_step_event = 0;
- bx_panic("WAIT: not implemented for < 386\n");
+ bio->panic("WAIT: not implemented for < 386\n");
#else // BX_CPU_LEVEL >= 3
if ( BX_CPU_THIS_PTR cr0.ts && BX_CPU_THIS_PTR cr0.mp ) {
@@ -162,7 +162,7 @@ BX_CPU_C::FWAIT(BxInstruction_t *i)
#if BX_SUPPORT_FPU
fpu_execute(i);
#else
- bx_printf("FWAIT: no FPU\n");
+ bio->printf("FWAIT: no FPU\n");
#endif
#endif

View File

@ -0,0 +1,64 @@
$OpenBSD: patch-fpu_wmFPUemu_glue_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- fpu/wmFPUemu_glue.cc.orig Sat Mar 25 21:57:00 2000
+++ fpu/wmFPUemu_glue.cc Tue Oct 17 12:04:03 2000
@@ -155,7 +155,7 @@ fpu_verify_area(unsigned what, void *ptr
void
FPU_printall(void)
{
- bx_panic("FPU_printall\n");
+ bio->panic("FPU_printall\n");
}
@@ -179,7 +179,7 @@ fpu_get_user(void *ptr, unsigned len)
BX_CPU.read_virtual_dword(fpu_iptr->seg, (Bit32u) ptr, &val32);
break;
default:
- bx_panic("fpu_get_user: len=%u\n", len);
+ bio->panic("fpu_get_user: len=%u\n", len);
}
return(val32);
}
@@ -205,7 +205,7 @@ fpu_put_user(unsigned val, void *ptr, un
BX_CPU.write_virtual_dword(fpu_iptr->seg, (Bit32u) ptr, &val32);
break;
default:
- bx_panic("fpu_put_user: len=%u\n", len);
+ bio->panic("fpu_put_user: len=%u\n", len);
}
}
@@ -223,28 +223,28 @@ math_abort(struct info *info, unsigned i
case SIGFPE:
if (BX_CPU.cr0.ne == 0) {
// MSDOS compatibility external interrupt (IRQ13)
- bx_panic("math_abort: MSDOS compatibility not supported yet\n");
+ bio->panic("math_abort: MSDOS compatibility not supported yet\n");
}
BX_CPU.exception(BX_MF_EXCEPTION, 0, 0);
// execution does not reach here
case SIGILL:
- bx_panic("math_abort: SIGILL not implemented yet.\n");
+ bio->panic("math_abort: SIGILL not implemented yet.\n");
break;
case SIGSEGV:
- bx_panic("math_abort: SIGSEGV not implemented yet.\n");
+ bio->panic("math_abort: SIGSEGV not implemented yet.\n");
break;
}
#else
UNUSED(signal);
- bx_panic("math_abort: CPU<4 not supported yet\n");
+ bio->panic("math_abort: CPU<4 not supported yet\n");
#endif
}
int
printk(const char * fmt, ...)
{
- bx_printf("printk not complete: %s\n", fmt);
+ bio->printf("printk not complete: %s\n", fmt);
return(0); // for now
}

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-gui_Makefile_in,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/Makefile.in.orig Thu Oct 19 18:36:22 2000
+++ gui/Makefile.in Thu Oct 19 18:36:45 2000
@@ -44,6 +44,7 @@ GUI_OBJS_BEOS = beos.o
GUI_OBJS_WIN32 = win32.o
GUI_OBJS_MACOS = macintosh.o
GUI_OBJS_NOGUI = nogui.o
+GUI_OBJS_TERM = term.o
GUI_OBJS = gui.o @GUI_OBJS@
BX_INCDIRS = -I.. -I../iodev -I../@INSTRUMENT_DIR@

View File

@ -0,0 +1,180 @@
$OpenBSD: patch-gui_beos_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/beos.cc.orig Sat Mar 25 21:45:08 2000
+++ gui/beos.cc Fri Oct 20 11:36:03 2000
@@ -195,13 +195,20 @@ bx_gui_c::specific_init(bx_gui_c *th, in
char *window_name = "Bochs 80386+ emulator, http://world.std.com/~bochs";
#endif
+// if not using debugger, then we can take control of SIGINT.
+// If using debugger, it needs control of this.
+#if BX_DEBUGGER==0
+ signal(SIGINT, bx_signal_handler);
+#endif
+
+
bx_gui_c_ptr = th;
UNUSED(argc);
UNUSED(argv);
UNUSED(window_name);
if (bx_options.private_colormap) {
- fprintf(stderr, "#WARNING: BeOS: private_colormap option not handled yet.\n");
+ bio->printf("#WARNING: BeOS: private_colormap option not handled yet.\n");
}
x_tilesize = tilewidth;
@@ -219,8 +226,8 @@ if (bx_options.private_colormap) {
// width = columns * font_width;
// height = rows * font_height;
-bx_printf("font_width = %u\n", (unsigned) font_width);
-bx_printf("font_height = %u\n", (unsigned) font_height);
+bio->printf("font_width = %u\n", (unsigned) font_width);
+bio->printf("font_height = %u\n", (unsigned) font_height);
// Create pixmap of depth 1 (bitmap) for icon
// icon_pixmap = XCreateBitmapFromData(bx_x_display, win,
@@ -502,14 +509,14 @@ void BochsView::MouseDown(BPoint point)
headerbar_click(int(point.x), int(point.y));
return;
}
- fprintf(stderr, "# mousedown()\n");
+ bio->printf("# mousedown()\n");
}
void BochsView::MouseUp(BPoint point)
{
UNUSED(point);
// currently a place holder function
- fprintf(stderr, "# mouseup()\n");
+ bio->printf("# mouseup()\n");
}
void BochsView::MouseMoved(BPoint point,
@@ -518,7 +525,7 @@ void BochsView::MouseMoved(BPoint point
UNUSED(point);
UNUSED(transit);
UNUSED(message);
- fprintf(stderr, "# mousemoved()\n");
+ bio->printf("# mousemoved()\n");
}
void BochsView::KeyDown(const char *bytes, int32 numBytes)
@@ -531,7 +538,7 @@ void BochsView::KeyDown(const char *byte
msg = Window()->CurrentMessage();
if ( !msg ) {
- fprintf(stderr, "# keydown() msg NULL\n");
+ bio->printf("# keydown() msg NULL\n");
return;
}
modifiers = msg->FindInt32("modifiers");
@@ -554,11 +561,11 @@ void BochsView::KeyDown(const char *byte
B_RIGHT_OPTION_KEY = 0x00008000
#endif
//if (modifiers) {
-// fprintf(stderr, "# modifiers = %08x\n", (unsigned) modifiers);
+// bio->printf("# modifiers = %08x\n", (unsigned) modifiers);
// }
if (numBytes == 1) {
- //fprintf(stderr, "# down: char %02xh\n", (unsigned) bytes[0]);
+ //bio->printf("# down: char %02xh\n", (unsigned) bytes[0]);
byte = bytes[0];
if ( byte == 0x00 ) {
// Ctrl-Space
@@ -828,7 +835,7 @@ void BochsView::KeyDown(const char *byte
case B_SCROLL_KEY: break;
case B_PAUSE_KEY: break;
default:
- fprintf(stderr, "# keydown() unknown function key %08xh\n",
+ bio->printf("# keydown() unknown function key %08xh\n",
(unsigned) key);
}
#endif
@@ -868,7 +875,7 @@ void BochsView::KeyDown(const char *byte
enq_key_event(BX_KEY_CTRL_L, BX_KEY_RELEASED);
return;
}
- fprintf(stderr, "# keydown: char %02xh unhandled\n",
+ bio->printf("# keydown: char %02xh unhandled\n",
(unsigned) bytes[0]);
return;
}
@@ -876,7 +883,7 @@ void BochsView::KeyDown(const char *byte
}
else {
// ignore for now
- fprintf(stderr, "# keydown() ignoring multibyte key\n");
+ bio->printf("# keydown() ignoring multibyte key\n");
}
}
@@ -947,7 +954,7 @@ BochsView::FillRect(BRect r, pattern p)
enq_key_event(Bit32u key, Bit32u press_release)
{
if ( ((tail+1) % SCANCODE_BUFSIZE) == head ) {
- fprintf(stderr, "# enq_key_event: buffer full\n");
+ bio->printf("# enq_key_event: buffer full\n");
return;
}
keyevents[tail] = key | press_release;
@@ -960,7 +967,7 @@ deq_key_event(void)
Bit32u key;
if ( head == tail ) {
- fprintf(stderr, "# deq_key_event: buffer empty\n");
+ bio->printf("# deq_key_event: buffer empty\n");
return(0);
}
key = keyevents[head];
@@ -989,7 +996,7 @@ bx_gui_c::create_bitmap(const unsigned c
unsigned char *data;
if (bx_bitmap_entries >= BX_MAX_PIXMAPS) {
- bx_panic("beos: too many pixmaps, increase BX_MAX_PIXMAPS\n");
+ bio->panic("beos: too many pixmaps, increase BX_MAX_PIXMAPS\n");
}
bx_bitmaps[bx_bitmap_entries].bmap =
@@ -1005,7 +1012,7 @@ bx_gui_c::create_bitmap(const unsigned c
bx_bitmaps[bx_bitmap_entries].xdim = xdim;
bx_bitmaps[bx_bitmap_entries].ydim = ydim;
if (!bx_bitmaps[bx_bitmap_entries].bmap) {
- bx_panic("beos: could not create bitmap\n");
+ bio->panic("beos: could not create bitmap\n");
}
bx_bitmap_entries++;
return(bx_bitmap_entries-1); // return index as handle
@@ -1018,7 +1025,7 @@ bx_gui_c::headerbar_bitmap(unsigned bmap
unsigned hb_index;
if ( (bx_headerbar_entries+1) > BX_MAX_HEADERBAR_ENTRIES )
- bx_panic("beos: too many headerbar entries, increase BX_MAX_HEADERBAR_ENTRIES\n");
+ bio->panic("beos: too many headerbar entries, increase BX_MAX_HEADERBAR_ENTRIES\n");
bx_headerbar_entries++;
hb_index = bx_headerbar_entries - 1;
@@ -1111,13 +1118,13 @@ create_vga_font(void)
unsigned char *data;
BRect brect(0,0, 7,15);
- fprintf(stderr, "# BeOS: creating VGA font from bitmaps\n");
+ bio->printf("# BeOS: creating VGA font from bitmaps\n");
// VGA font is 8wide x 16high
for (unsigned c=0; c<256; c++) {
vgafont[c] = new BBitmap(brect, B_MONOCHROME_1_BIT);
if (!vgafont[c]) {
- bx_panic("beos: could not create bitmap\n");
+ bio->panic("beos: could not create bitmap\n");
}
bitslength = vgafont[c]->BitsLength();
@@ -1134,5 +1141,5 @@ create_vga_font(void)
void
bx_gui_c::exit(void)
{
- fprintf(stderr, "# WARNING: BEOS: bx_gui_c::exit() not implemented yet.\n");
+ bio->printf("# WARNING: BEOS: bx_gui_c::exit() not implemented yet.\n");
}

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-gui_gui_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/gui.cc.orig Sat Mar 25 21:43:36 2000
+++ gui/gui.cc Fri Oct 20 16:53:18 2000
@@ -151,19 +151,19 @@ bx_gui_c::floppyB_handler(void)
void
bx_gui_c::reset_handler(void)
{
- fprintf(stderr, "# RESET callback (unimplemented).\n");
+ bio->printf("#GUI] RESET callback (unimplemented).\n");
}
void
bx_gui_c::power_handler(void)
{
- bx_panic("POWER button turned off.\n");
+ bio->panic("gui POWER button turned off.\n");
}
void
bx_gui_c::snapshot_handler(void)
{
- fprintf(stderr, "# SNAPSHOT callback (unimplemented).\n");
+ bio->printf("#GUI] SNAPSHOT callback (unimplemented).\n");
}
void

View File

@ -0,0 +1,98 @@
$OpenBSD: patch-gui_macintosh_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/macintosh.cc.orig Sat Mar 25 21:45:26 2000
+++ gui/macintosh.cc Fri Oct 20 11:38:32 2000
@@ -221,7 +221,7 @@ void CreateTile(void)
err = NewGWorld(&gOffWorld, 8,
&srcTileRect, gCTable, NULL, useTempMem);
if (err != noErr)
- bx_panic("mac: can't create gOffWorld");
+ bio->panic("mac: can't create gOffWorld");
SetGWorld(gOffWorld, NULL);
@@ -236,7 +236,7 @@ void CreateTile(void)
(**gTile).pmTable = gCTable;
}
else
- bx_panic("mac: can't create gTile");
+ bio->panic("mac: can't create gTile");
SetGWorld(savePort, saveDevice);
}
@@ -244,7 +244,7 @@ void CreateTile(void)
{
gTile = CreatePixMap(0, 0, srcTileRect.right, srcTileRect.bottom, 8, gCTable);
if (gTile == NULL)
- bx_panic("mac: can't create gTile");
+ bio->panic("mac: can't create gTile");
}
}
@@ -282,7 +282,7 @@ void CreateWindows(void)
toolwin = NewCWindow(NULL, &winRect, "\pMacBochs 586", true, floatProc,
(WindowPtr)-1, false, 0);
if (toolwin == NULL)
- bx_panic("mac: can't create tool window");
+ bio->panic("mac: can't create tool window");
// Create a moveable tool window for the "headerbar"
SetRect(&winRect, l, t, r, b);
@@ -292,7 +292,7 @@ void CreateWindows(void)
win = NewCWindow(NULL, &winRect, "\pMacBochs 586", true, documentProc,
(WindowPtr)-1, true, 1);
if (win == NULL)
- bx_panic("mac: can't create emulator window");
+ bio->panic("mac: can't create emulator window");
FixWindow();
@@ -324,6 +324,13 @@ void CreateWindows(void)
void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y)
{
+
+// if not using debugger, then we can take control of SIGINT.
+// If using debugger, it needs control of this.
+#if BX_DEBUGGER==0
+ signal(SIGINT, bx_signal_handler);
+#endif
+
InitToolbox();
//SouixWin = FrontWindow();
@@ -495,7 +502,7 @@ void HandleMenuChoice(long menuChoice)
switch(item)
{
case iQuit:
- bx_panic("User terminated");
+ bio->panic("User terminated");
break;
default:
@@ -1429,7 +1436,7 @@ void CreateKeyMap(void)
KCHR = NewPtrClear(390);
if (KCHR == NULL)
- bx_panic("mac: can't allocate memory for key map");
+ bio->panic("mac: can't allocate memory for key map");
BlockMove(KCHRHeader, KCHR, sizeof(KCHRHeader));
BlockMove(KCHRTable, Ptr(KCHR + sizeof(KCHRHeader)), sizeof(KCHRTable));
}
@@ -1473,7 +1480,7 @@ BitMap *CreateBitMap(unsigned width, uns
row_bytes = (( width + 31) >> 5) << 2;
bm = (BitMap *)calloc(1, sizeof(BitMap));
if (bm == NULL)
- bx_panic("mac: can't allocate memory for pixmap");
+ bio->panic("mac: can't allocate memory for pixmap");
SetRect(&bm->bounds, 0, 0, width, height);
bm->rowBytes = row_bytes;
// Quickdraw allocates a new color table by default, but we want to
@@ -1495,7 +1502,7 @@ PixMapHandle CreatePixMap(unsigned left,
row_bytes = (((long) depth * ((long) width) + 31) >> 5) << 2;
pm = NewPixMap();
if (pm == NULL)
- bx_panic("mac: can't allocate memory for pixmap");
+ bio->panic("mac: can't allocate memory for pixmap");
(**pm).bounds.left = left;
(**pm).bounds.top = top;
(**pm).bounds.right = left+width;

View File

@ -0,0 +1,56 @@
$OpenBSD: patch-gui_nogui_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/nogui.cc.orig Sat Mar 25 21:43:36 2000
+++ gui/nogui.cc Fri Oct 20 11:37:22 2000
@@ -25,7 +25,6 @@
#include "bochs.h"
#include "icon_bochs.h"
-
// This file defines stubs for the GUI interface, which is a
// place to start if you want to port bochs to a platform, for
// which there is no support for your native GUI, or if you want to compile
@@ -66,9 +65,15 @@ bx_gui_c::specific_init(bx_gui_c *th, in
UNUSED(headerbar_y);
UNUSED(bochs_icon_bits); // global variable
+// if not using debugger, then we can take control of SIGINT.
+// If using debugger, it needs control of this.
+#if BX_DEBUGGER==0
+ signal(SIGINT, bx_signal_handler);
+#endif
+
if (bx_options.private_colormap) {
- fprintf(stderr, "# WARNING: NOGUI: private_colormap option ignored.\n");
+ bio->printf("#NOGUI] WARNING: private_colormap option ignored.\n");
}
}
@@ -126,10 +131,9 @@ bx_gui_c::clear_screen(void)
//
// cursor_x: new x location of cursor
// cursor_y: new y location of cursor
-
void
bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
- unsigned long cursor_x, unsigned long cursor_y
+ unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows)
{
UNUSED(old_text);
@@ -150,6 +154,8 @@ bx_gui_c::text_update(Bit8u *old_text, B
Boolean
bx_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned blue)
{
+ bio->printf("[NOGUI] color pallete request (%d,%d,%d,%d) ignored\n",
+ index,red,green,blue);
UNUSED(index);
UNUSED(red);
UNUSED(green);
@@ -285,5 +291,5 @@ bx_gui_c::replace_bitmap(unsigned hbar_i
void
bx_gui_c::exit(void)
{
- fprintf(stderr, "# WARNING: win32: bx_gui_c::exit() not implemented yet.\n");
+ bio->printf("[NOGUI] exiting\n");
}

View File

@ -0,0 +1,570 @@
$OpenBSD: patch-gui_term_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/term.cc.orig Fri Oct 20 09:20:43 2000
+++ gui/term.cc Fri Oct 20 15:52:26 2000
@@ -0,0 +1,566 @@
+// Copyright (C) 2000 MandrakeSoft S.A.
+//
+// MandrakeSoft S.A.
+// 43, rue d'Aboukir
+// 75002 Paris - France
+// http://www.linux-mandrake.com/
+// http://www.mandrakesoft.com/
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+
+#include "bochs.h"
+#include "icon_bochs.h"
+
+extern "C" {
+#include <curses.h>
+#include <signal.h>
+};
+
+// This file defines stubs for the GUI interface, which is a
+// place to start if you want to port bochs to a platform, for
+// which there is no support for your native GUI, or if you want to compile
+// bochs without any native GUI support (no output window or
+// keyboard input will be possible).
+// Look in 'x.cc', 'beos.cc', and 'win32.cc' for specific
+// implementations of this interface. -Kevin
+
+
+static void
+do_scan(int key_event, int shift, int ctrl, int alt)
+{
+ /* XXX At some point, cache alt/ctrl/shift so only when the state
+ changes do we simulate a press or release, to cut down on
+ keyboard input to the simulated machine */
+
+ if(bio->getdbg().keyboard)
+ bio->printf("[TERM] key_event %d/0x%x %s%s%s\n",
+ key_event,key_event,
+ shift?"(shift)":"",
+ ctrl?"(ctrl)":"",
+ alt?"(alt)":"");
+ if(shift)
+ bx_devices.keyboard->gen_scancode(BX_KEY_SHIFT_L);
+ if(ctrl)
+ bx_devices.keyboard->gen_scancode(BX_KEY_CTRL_L);
+ if(alt)
+ bx_devices.keyboard->gen_scancode(BX_KEY_ALT_L);
+ bx_devices.keyboard->gen_scancode(key_event);
+ key_event |= BX_KEY_RELEASED;
+
+ bx_devices.keyboard->gen_scancode(key_event);
+ if(alt)
+ bx_devices.keyboard->gen_scancode(BX_KEY_ALT_L|BX_KEY_RELEASED);
+ if(ctrl)
+ bx_devices.keyboard->gen_scancode(BX_KEY_CTRL_L|BX_KEY_RELEASED);
+ if(shift)
+ bx_devices.keyboard->gen_scancode(BX_KEY_SHIFT_L|BX_KEY_RELEASED);
+}
+
+// ::SPECIFIC_INIT()
+//
+// Called from gui.cc, once upon program startup, to allow for the
+// specific GUI code (X11, BeOS, ...) to be initialized.
+//
+// th: a 'this' pointer to the gui class. If a function external to the
+// class needs access, store this pointer and use later.
+// argc, argv: not used right now, but the intention is to pass native GUI
+// specific options from the command line. (X11 options, BeOS options,...)
+//
+// tilewidth, tileheight: for optimization, graphics_tile_update() passes
+// only updated regions of the screen to the gui code to be redrawn.
+// These define the dimensions of a region (tile).
+// headerbar_y: A headerbar (toolbar) is display on the top of the
+// VGA window, showing floppy status, and other information. It
+// always assumes the width of the current VGA mode width, but
+// it's height is defined by this parameter.
+
+static void
+guisig(int signo)
+{
+ switch(signo) {
+ case SIGINT:
+ do_scan(BX_KEY_C,0,1,0);
+ break;
+ case SIGSTOP:
+ do_scan(BX_KEY_S,0,1,0);
+ break;
+ case SIGTSTP:
+ do_scan(BX_KEY_Z,0,1,0);
+ break;
+ default:
+ bio->printf("sig %d caught\n",signo);
+ break;
+ }
+}
+
+ void
+bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
+ unsigned headerbar_y)
+{
+ UNUSED(th);
+ UNUSED(argc);
+ UNUSED(argv);
+ UNUSED(tilewidth);
+ UNUSED(tileheight);
+ UNUSED(headerbar_y);
+
+ UNUSED(bochs_icon_bits); // global variable
+
+ // XXX log should be different from stderr, otherwise terminal mode really
+ // ends up having fun
+ //bio->printf("[TERM] Moving Log to another tty\n");
+ //bio->init_log("/dev/ttyp5");
+ //bio->printf("[TERM] Moved Log to another tty\n");
+
+ initscr();
+ cbreak();
+ curs_set(2);
+ keypad(stdscr,TRUE);
+ nodelay(stdscr, TRUE);
+ noecho();
+
+ (void)signal(SIGHUP, guisig);
+ (void)signal(SIGINT, guisig);
+ (void)signal(SIGQUIT, guisig);
+ (void)signal(SIGSTOP, guisig);
+ (void)signal(SIGTSTP, guisig);
+ (void)signal(SIGTERM, guisig);
+
+ if (bx_options.private_colormap)
+ if(bio->getdbg().video)
+ bio->printf("#TERM] WARNING: private_colormap option ignored.\n");
+}
+
+
+
+void
+do_char(int character,int alt)
+{
+ switch (character) {
+ case 0x9: do_scan(BX_KEY_TAB,0,0,alt); break;
+ case 0xa: do_scan(BX_KEY_KP_ENTER,0,0,alt); break;
+ case 0xd: do_scan(BX_KEY_KP_DELETE,0,0,alt); break;
+ //case '-': do_scan(BX_KEY_KP_SUBTRACT,0,0,alt); break;
+ //case '+': do_scan(BX_KEY_KP_ADD,0,0,alt); break;
+ //case '*': do_scan(BX_KEY_KP_MULTIPLY,0,0,alt); break;
+ //case '/': do_scan(BX_KEY_KP_DIVIDE,0,0,alt); break;
+ case 0x1: do_scan(BX_KEY_A,0,1,alt); break;
+ case 0x2: do_scan(BX_KEY_B,0,1,alt); break;
+ case 0x3: do_scan(BX_KEY_C,0,1,alt); break;
+ case 0x4: do_scan(BX_KEY_D,0,1,alt); break;
+ case 0x5: do_scan(BX_KEY_E,0,1,alt); break;
+ case 0x6: do_scan(BX_KEY_F,0,1,alt); break;
+ case 0x7: do_scan(BX_KEY_G,0,1,alt); break;
+ case 0x8: do_scan(BX_KEY_H,0,1,alt); break;
+// case 0x9: do_scan(BX_KEY_I,0,1,alt); break;
+// case 0xa: do_scan(BX_KEY_J,0,1,alt); break;
+ case 0xb: do_scan(BX_KEY_K,0,1,alt); break;
+ case 0xc: do_scan(BX_KEY_L,0,1,alt); break;
+// case 0xd: do_scan(BX_KEY_M,0,1,alt); break;
+ case 0xe: do_scan(BX_KEY_N,0,1,alt); break;
+ case 0xf: do_scan(BX_KEY_O,0,1,alt); break;
+ case 0x10: do_scan(BX_KEY_P,0,1,alt); break;
+ case 0x11: do_scan(BX_KEY_Q,0,1,alt); break;
+ case 0x12: do_scan(BX_KEY_R,0,1,alt); break;
+ case 0x13: do_scan(BX_KEY_S,0,1,alt); break;
+ case 0x14: do_scan(BX_KEY_T,0,1,alt); break;
+ case 0x15: do_scan(BX_KEY_U,0,1,alt); break;
+ case 0x16: do_scan(BX_KEY_V,0,1,alt); break;
+ case 0x17: do_scan(BX_KEY_W,0,1,alt); break;
+ case 0x18: do_scan(BX_KEY_X,0,1,alt); break;
+ case 0x19: do_scan(BX_KEY_Y,0,1,alt); break;
+ case 0x1a: do_scan(BX_KEY_Z,0,1,alt); break;
+ case 0x20: do_scan(BX_KEY_SPACE,0,0,alt); break;
+ case 0x107: do_scan(BX_KEY_BACKSPACE,0,0,alt); break;
+ case 0x102: do_scan(BX_KEY_DOWN,0,0,alt); break;
+ case 0x103: do_scan(BX_KEY_UP,0,0,alt); break;
+ case 0x104: do_scan(BX_KEY_LEFT,0,0,alt); break;
+ case 0x105: do_scan(BX_KEY_RIGHT,0,0,alt); break;
+ case 0x152: do_scan(BX_KEY_PAGE_DOWN,0,0,alt); break;
+ case 0x153: do_scan(BX_KEY_PAGE_UP,0,0,alt); break;
+ case 0x106: do_scan(BX_KEY_HOME,0,0,alt); break;
+ case 0x168: do_scan(BX_KEY_END,0,0,alt); break;
+ case 0x14b: do_scan(BX_KEY_INSERT,0,0,alt); break;
+ case 0x7f: do_scan(BX_KEY_DELETE,0,0,alt); break;
+ case 0x1b: do_scan(BX_KEY_ESC,0,0,alt); break;
+ case '!': do_scan(BX_KEY_1,1,0,alt); break;
+ case '\'': do_scan(BX_KEY_SINGLE_QUOTE,0,0,alt); break;
+ case '#': do_scan(BX_KEY_3,1,0,alt); break;
+ case '$': do_scan(BX_KEY_4,1,0,alt); break;
+ case '%': do_scan(BX_KEY_5,1,0,alt); break;
+ case '^': do_scan(BX_KEY_6,1,0,alt); break;
+ case '&': do_scan(BX_KEY_7,1,0,alt); break;
+ case '"': do_scan(BX_KEY_SINGLE_QUOTE,1,0,alt); break;
+
+ // ()*+,-./
+ case '(': do_scan(BX_KEY_9,1,0,alt); break;
+ case ')': do_scan(BX_KEY_0,1,0,alt); break;
+ case '*': do_scan(BX_KEY_8,1,0,alt); break;
+ case '+': do_scan(BX_KEY_EQUALS,1,0,alt); break;
+ case ',': do_scan(BX_KEY_COMMA,0,0,alt); break;
+ case '-': do_scan(BX_KEY_MINUS,0,0,alt); break;
+ case '.': do_scan(BX_KEY_PERIOD,0,0,alt); break;
+ case '/': do_scan(BX_KEY_SLASH,0,0,alt); break;
+
+ // 01234567
+ case '0': do_scan(BX_KEY_0,0,0,alt); break;
+ case '1': do_scan(BX_KEY_1,0,0,alt); break;
+ case '2': do_scan(BX_KEY_2,0,0,alt); break;
+ case '3': do_scan(BX_KEY_3,0,0,alt); break;
+ case '4': do_scan(BX_KEY_4,0,0,alt); break;
+ case '5': do_scan(BX_KEY_5,0,0,alt); break;
+ case '6': do_scan(BX_KEY_6,0,0,alt); break;
+ case '7': do_scan(BX_KEY_7,0,0,alt); break;
+
+ // 89:;<=>?
+ case '8': do_scan(BX_KEY_8,0,0,alt); break;
+ case '9': do_scan(BX_KEY_9,0,0,alt); break;
+ case ':': do_scan(BX_KEY_SEMICOLON,1,0,alt); break;
+ case ';': do_scan(BX_KEY_SEMICOLON,0,0,alt); break;
+ case '<': do_scan(BX_KEY_COMMA,1,0,alt); break;
+ case '=': do_scan(BX_KEY_EQUALS,0,0,alt); break;
+ case '>': do_scan(BX_KEY_PERIOD,1,0,alt); break;
+ case '?': do_scan(BX_KEY_SLASH,1,0,alt); break;
+
+ // @ABCDEFG
+ case '@': do_scan(BX_KEY_2,1,0,alt); break;
+ case 'A': do_scan(BX_KEY_A,1,0,alt); break;
+ case 'B': do_scan(BX_KEY_B,1,0,alt); break;
+ case 'C': do_scan(BX_KEY_C,1,0,alt); break;
+ case 'D': do_scan(BX_KEY_D,1,0,alt); break;
+ case 'E': do_scan(BX_KEY_E,1,0,alt); break;
+ case 'F': do_scan(BX_KEY_F,1,0,alt); break;
+ case 'G': do_scan(BX_KEY_G,1,0,alt); break;
+
+
+ // HIJKLMNO
+ case 'H': do_scan(BX_KEY_H,1,0,alt); break;
+ case 'I': do_scan(BX_KEY_I,1,0,alt); break;
+ case 'J': do_scan(BX_KEY_J,1,0,alt); break;
+ case 'K': do_scan(BX_KEY_K,1,0,alt); break;
+ case 'L': do_scan(BX_KEY_L,1,0,alt); break;
+ case 'M': do_scan(BX_KEY_M,1,0,alt); break;
+ case 'N': do_scan(BX_KEY_N,1,0,alt); break;
+ case 'O': do_scan(BX_KEY_O,1,0,alt); break;
+
+
+ // PQRSTUVW
+ case 'P': do_scan(BX_KEY_P,1,0,alt); break;
+ case 'Q': do_scan(BX_KEY_Q,1,0,alt); break;
+ case 'R': do_scan(BX_KEY_R,1,0,alt); break;
+ case 'S': do_scan(BX_KEY_S,1,0,alt); break;
+ case 'T': do_scan(BX_KEY_T,1,0,alt); break;
+ case 'U': do_scan(BX_KEY_U,1,0,alt); break;
+ case 'V': do_scan(BX_KEY_V,1,0,alt); break;
+ case 'W': do_scan(BX_KEY_W,1,0,alt); break;
+
+ // XYZ[\]^_
+ case 'X': do_scan(BX_KEY_X,1,0,alt); break;
+ case 'Y': do_scan(BX_KEY_Y,1,0,alt); break;
+ case 'Z': do_scan(BX_KEY_Z,1,0,alt); break;
+ case '{': do_scan(BX_KEY_LEFT_BRACKET,1,0,alt); break;
+ case '|': do_scan(BX_KEY_BACKSLASH,1,0,alt); break;
+ case '}': do_scan(BX_KEY_RIGHT_BRACKET,1,0,alt); break;
+ case '_': do_scan(BX_KEY_MINUS,1,0,alt); break;
+
+ // `abcdefg
+ case '`': do_scan(BX_KEY_GRAVE,0,0,alt); break;
+ case 'a': do_scan(BX_KEY_A,0,0,alt); break;
+ case 'b': do_scan(BX_KEY_B,0,0,alt); break;
+ case 'c': do_scan(BX_KEY_C,0,0,alt); break;
+ case 'd': do_scan(BX_KEY_D,0,0,alt); break;
+ case 'e': do_scan(BX_KEY_E,0,0,alt); break;
+ case 'f': do_scan(BX_KEY_F,0,0,alt); break;
+ case 'g': do_scan(BX_KEY_G,0,0,alt); break;
+
+ // hijklmno
+ case 'h': do_scan(BX_KEY_H,0,0,alt); break;
+ case 'i': do_scan(BX_KEY_I,0,0,alt); break;
+ case 'j': do_scan(BX_KEY_J,0,0,alt); break;
+ case 'k': do_scan(BX_KEY_K,0,0,alt); break;
+ case 'l': do_scan(BX_KEY_L,0,0,alt); break;
+ case 'm': do_scan(BX_KEY_M,0,0,alt); break;
+ case 'n': do_scan(BX_KEY_N,0,0,alt); break;
+ case 'o': do_scan(BX_KEY_O,0,0,alt); break;
+
+ // pqrstuvw
+ case 'p': do_scan(BX_KEY_P,0,0,alt); break;
+ case 'q': do_scan(BX_KEY_Q,0,0,alt); break;
+ case 'r': do_scan(BX_KEY_R,0,0,alt); break;
+ case 's': do_scan(BX_KEY_S,0,0,alt); break;
+ case 't': do_scan(BX_KEY_T,0,0,alt); break;
+ case 'u': do_scan(BX_KEY_U,0,0,alt); break;
+ case 'v': do_scan(BX_KEY_V,0,0,alt); break;
+ case 'w': do_scan(BX_KEY_W,0,0,alt); break;
+
+ // xyz{|}~
+ case 'x': do_scan(BX_KEY_X,0,0,alt); break;
+ case 'y': do_scan(BX_KEY_Y,0,0,alt); break;
+ case 'z': do_scan(BX_KEY_Z,0,0,alt); break;
+ case '[': do_scan(BX_KEY_LEFT_BRACKET,0,0,alt); break;
+ case '\\': do_scan(BX_KEY_BACKSLASH,0,0,alt); break;
+ case ']': do_scan(BX_KEY_RIGHT_BRACKET,0,0,alt); break;
+ case '~': do_scan(BX_KEY_GRAVE,1,0,alt); break;
+ default:
+ if(character > 0x79) {
+ do_char(character - 0x80,1);
+ break;
+ }
+
+ bio->printf("[TERM] character unhandled: 0x%x\n",character);
+ break;
+ }
+}
+
+
+// ::HANDLE_EVENTS()
+//
+// Called periodically (vga_update_interval in .bochsrc) so the
+// the gui code can poll for keyboard, mouse, and other
+// relevant events.
+
+ void
+bx_gui_c::handle_events(void)
+{
+ unsigned int character;
+ while((character = getch()) != ERR) {
+ if(bio->getdbg().keyboard)
+ bio->printf("[TERM] scancode(0x%x)\n",character);
+ do_char(character,0);
+ }
+}
+
+
+
+// ::FLUSH()
+//
+// Called periodically, requesting that the gui code flush all pending
+// screen update requests.
+
+ void
+bx_gui_c::flush(void)
+{
+ refresh();
+}
+
+
+// ::CLEAR_SCREEN()
+//
+// Called to request that the VGA region is cleared. Don't
+// clear the area that defines the headerbar.
+
+ void
+bx_gui_c::clear_screen(void)
+{
+ if(bio->getdbg().video)
+ bio->printf("[TERM] Ignored clear_screeen()\n");
+}
+
+// ::TEXT_UPDATE()
+//
+// Called in a VGA text mode, to update the screen with
+// new content.
+//
+// old_text: array of character/attributes making up the contents
+// of the screen from the last call. See below
+// new_text: array of character/attributes making up the current
+// contents, which should now be displayed. See below
+//
+// format of old_text & new_text: each is 4000 bytes long.
+// This represents 80 characters wide by 25 high, with
+// each character being 2 bytes. The first by is the
+// character value, the second is the attribute byte.
+// I currently don't handle the attribute byte.
+//
+// cursor_x: new x location of cursor
+// cursor_y: new y location of cursor
+
+ void
+bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
+ unsigned long cursor_x, unsigned long cursor_y,
+ unsigned nrows)
+{
+ unsigned ncols = 4000/nrows/2;
+ // XXX There has GOT to be a better way of doing this
+ for(int i=0;i<4001;i+=2) {
+ if( old_text[i] != new_text[i] ) {
+ mvaddch((i/2)/ncols,(i/2)%ncols,new_text[i]);
+ }
+ }
+
+ //mvcur(0,0,cursor_y,cursor_x);
+
+ if(cursor_x>0)
+ cursor_x--;
+ else {
+ cursor_x=79;
+ cursor_y--;
+ }
+ mvaddch(cursor_y,cursor_x,new_text[(cursor_y*80+cursor_x)*2]);
+}
+
+
+// ::PALETTE_CHANGE()
+//
+// Allocate a color in the native GUI, for this color, and put
+// it in the colormap location 'index'.
+// returns: 0=no screen update needed (color map change has direct effect)
+// 1=screen updated needed (redraw using current colormap)
+
+ Boolean
+bx_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned blue)
+{
+ if(bio->getdbg().video)
+ bio->printf("[TERM] color pallete request (%d,%d,%d,%d) ignored\n",
+ index,red,green,blue);
+ return(0);
+}
+
+
+// ::GRAPHICS_TILE_UPDATE()
+//
+// Called to request that a tile of graphics be drawn to the
+// screen, since info in this region has changed.
+//
+// tile: array of 8bit values representing a block of pixels with
+// dimension equal to the 'tilewidth' & 'tileheight' parameters to
+// ::specific_init(). Each value specifies an index into the
+// array of colors you allocated for ::palette_change()
+// x0: x origin of tile
+// y0: y origin of tile
+//
+// note: origin of tile and of window based on (0,0) being in the upper
+// left of the window.
+
+ void
+bx_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
+{
+ UNUSED(tile);
+ UNUSED(x0);
+ UNUSED(y0);
+}
+
+
+
+// ::DIMENSION_UPDATE()
+//
+// Called when the VGA mode changes it's X,Y dimensions.
+// Resize the window to this size, but you need to add on
+// the height of the headerbar to the Y value.
+//
+// x: new VGA x size
+// y: new VGA y size (add headerbar_y parameter from ::specific_init().
+
+ void
+bx_gui_c::dimension_update(unsigned x, unsigned y)
+{
+ UNUSED(x);
+ UNUSED(y);
+}
+
+
+// ::CREATE_BITMAP()
+//
+// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
+// be drawn in the headerbar. Return an integer ID to the bitmap,
+// with which the bitmap can be referenced later.
+//
+// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
+// bit0 is the left most pixel, bit7 is the right most pixel.
+// xdim: x dimension of bitmap
+// ydim: y dimension of bitmap
+
+ unsigned
+bx_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
+{
+ UNUSED(bmap);
+ UNUSED(xdim);
+ UNUSED(ydim);
+ return(0);
+}
+
+
+// ::HEADERBAR_BITMAP()
+//
+// Called to install a bitmap in the bochs headerbar (toolbar).
+//
+// bmap_id: will correspond to an ID returned from
+// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
+// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
+// available leftmost or rightmost space.
+// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
+// meaning install the bitmap in the next
+// available leftmost or rightmost space.
+// f: a 'C' function pointer to callback when the mouse is clicked in
+// the boundaries of this bitmap.
+
+ unsigned
+bx_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
+{
+ UNUSED(bmap_id);
+ UNUSED(alignment);
+ UNUSED(f);
+ return(0);
+}
+
+
+// ::SHOW_HEADERBAR()
+//
+// Show (redraw) the current headerbar, which is composed of
+// currently installed bitmaps.
+
+ void
+bx_gui_c::show_headerbar(void)
+{
+}
+
+
+// ::REPLACE_BITMAP()
+//
+// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
+// with the one specified by 'bmap_id'. 'bmap_id' will have
+// been generated by ::create_bitmap(). The old and new bitmap
+// must be of the same size. This allows the bitmap the user
+// sees to change, when some action occurs. For example when
+// the user presses on the floppy icon, it then displays
+// the ejected status.
+//
+// hbar_id: headerbar slot ID
+// bmap_id: bitmap ID
+
+ void
+bx_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
+{
+ UNUSED(hbar_id);
+ UNUSED(bmap_id);
+}
+
+
+// ::EXIT()
+//
+// Called before bochs terminates, to allow for a graceful
+// exit from the native GUI mechanism.
+
+ void
+bx_gui_c::exit(void)
+{
+ flush();
+ echo();
+ nocbreak();
+ if(bio->getdbg().video)
+ bio->printf("[TERM] exiting\n");
+}

View File

@ -0,0 +1,46 @@
$OpenBSD: patch-gui_win32_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/win32.cc.orig Sat Mar 25 21:43:36 2000
+++ gui/win32.cc Fri Oct 20 11:37:48 2000
@@ -157,7 +157,7 @@ static void processMouseXY( int x, int y
if ( old_bx_state!=mouse_button_state)
{
/* Make up for missing message */
- bx_printf( "&&&missing mouse state change\r\n");
+ bio->printf( "&&&missing mouse state change\r\n");
EnterCriticalSection( &stInfo.keyCS);
enq_mouse_event();
mouse_button_state=old_bx_state;
@@ -204,6 +204,12 @@ static void cursorWarped()
// GUI thread must be dead/done in order to call terminateEmul
void terminateEmul(int reason) {
+// if not using debugger, then we can take control of SIGINT.
+// If using debugger, it needs control of this.
+#if BX_DEBUGGER==0
+ signal(SIGINT, bx_signal_handler);
+#endif
+
// We know that Critical Sections were inited when x_tilesize has been set
// See bx_gui_c::specific_init
if (x_tilesize != 0) {
@@ -222,16 +228,16 @@ void terminateEmul(int reason) {
switch (reason) {
case EXIT_GUI_SHUTDOWN:
- bx_panic("Window closed, exiting!\n");
+ bio->panic("Window closed, exiting!\n");
break;
case EXIT_GMH_FAILURE:
- bx_panic("GetModuleHandle failure!\n");
+ bio->panic("GetModuleHandle failure!\n");
break;
case EXIT_FONT_BITMAP_ERROR:
- bx_panic("Font bitmap creation failure!\n");
+ bio->panic("Font bitmap creation failure!\n");
break;
case EXIT_HEADER_BITMAP_ERROR:
- bx_panic("Header bitmap creation failure!\n");
+ bio->panic("Header bitmap creation failure!\n");
break;
case EXIT_NORMAL:
break;

View File

@ -0,0 +1,376 @@
$OpenBSD: patch-gui_x_cc,v 1.1 2001/02/02 16:59:10 todd Exp $
--- gui/x.cc.orig Sat Mar 25 21:43:36 2000
+++ gui/x.cc Mon Oct 23 22:11:14 2000
@@ -27,6 +27,7 @@ extern "C" {
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
+#include <signal.h>
}
#include "bochs.h"
@@ -279,11 +280,16 @@ bx_gui_c::specific_init(bx_gui_c *th, in
unsigned long plane_masks_return[1];
XColor color;
+// if not using debugger, then we can take control of SIGINT.
+// If using debugger, it needs control of this.
+#if BX_DEBUGGER==0
+ signal(SIGINT, bx_signal_handler);
+#endif
UNUSED(th);
if (bx_options.private_colormap) {
- fprintf(stderr, "# WARNING: X11: private_colormap option not handled yet.\n");
+ bio->printf("#X] WARNING: X11: private_colormap option not handled yet.\n");
}
x_tilesize = tilewidth;
@@ -299,7 +305,7 @@ if (bx_options.private_colormap) {
/* connect to X server */
if ( (bx_x_display=XOpenDisplay(display_name)) == NULL )
{
- bx_panic("%s: cannot connect to X server %s\n",
+ bio->panic("%s: cannot connect to X server %s\n",
progname, XDisplayName(display_name));
}
@@ -321,8 +327,8 @@ if (bx_options.private_colormap) {
dimension_x = columns * font_width;
dimension_y = rows * font_height + headerbar_y;
-bx_printf("font_width = %u\n", (unsigned) font_width);
-bx_printf("font_height = %u\n", (unsigned) font_height);
+bio->printf("[X] font_width = %u\n", (unsigned) font_width);
+bio->printf("[X] font_height = %u\n", (unsigned) font_height);
/* create opaque window */
win = XCreateSimpleWindow(bx_x_display, RootWindow(bx_x_display,bx_x_screen_num),
@@ -346,7 +352,7 @@ bx_printf("font_height = %u\n", (unsigne
default_visual, AllocNone);
if (XAllocColorCells(bx_x_display, default_cmap, False,
plane_masks_return, 0, col_vals, 256) == 0) {
- bx_panic("XAllocColorCells returns error.\n");
+ bio->panic("XAllocColorCells returns error.\n");
}
win_attr.colormap = default_cmap;
@@ -383,7 +389,7 @@ bx_printf("font_height = %u\n", (unsigne
black_pixel = col_vals[0];
white_pixel = col_vals[15];
- bx_printf("default_depth = %d\n", default_depth);
+ bio->printf("[X] default_depth = %d\n", default_depth);
//select_visual();
@@ -419,12 +425,12 @@ bx_printf("font_height = %u\n", (unsigne
* XTextProperty structures and set their other
* fields properly. */
if (XStringListToTextProperty(&window_name, 1, &windowName) == 0) {
- bx_panic("%s: structure allocation for windowName failed.\n",
+ bio->panic("%s: structure allocation for windowName failed.\n",
progname);
}
if (XStringListToTextProperty(&icon_name, 1, &iconName) == 0) {
- bx_panic("%s: structure allocation for iconName failed.\n",
+ bio->panic("%s: structure allocation for iconName failed.\n",
progname);
}
@@ -469,12 +475,12 @@ bx_printf("font_height = %u\n", (unsigne
XMapWindow(bx_x_display, win);
XSync(bx_x_display, /* no discard */ 0);
- bx_printf("waiting for MapNotify\n");
+ bio->printf("[X] waiting for MapNotify\n");
while (1) {
XNextEvent(bx_x_display, &report);
if (report.type == MapNotify) break;
}
- bx_printf("MapNotify found.\n");
+ bio->printf("[X] MapNotify found.\n");
{
char *imagedata;
@@ -488,19 +494,19 @@ bx_printf("font_height = %u\n", (unsigne
32, // # bits of padding
0 ); // bytes_per_line, let X11 calculate
if (!ximage)
- bx_panic("vga: couldn't XCreateImage()\n");
+ bio->panic("vga: couldn't XCreateImage()\n");
imDepth = default_depth;
imWide = ximage->bytes_per_line;
imBPP = ximage->bits_per_pixel;
imagedata = (char *) malloc( (size_t) (ximage->bytes_per_line * y_tilesize) );
- if (!imagedata) bx_panic("imagedata: malloc returned error\n");
+ if (!imagedata) bio->panic("imagedata: malloc returned error\n");
ximage->data = imagedata;
if (imBPP < imDepth) {
- bx_panic("vga_x: bits_per_pixel < depth ?\n");
+ bio->panic("vga_x: bits_per_pixel < depth ?\n");
}
}
@@ -523,8 +529,8 @@ load_font(void)
/* Load font and get font information structure. */
if ((font_info = XLoadQueryFont(bx_x_display,"vga")) == NULL) {
- fprintf(stderr, "# %s: Cannot open vga font\n", progname);
- bx_panic("Could not open vga font\n");
+ bio->printf("#X] %s: Cannot open vga font\n", progname);
+ bio->panic("X Could not open vga font\n");
}
}
@@ -577,17 +583,17 @@ bx_gui_c::handle_events(void)
break;
case ConfigureNotify:
-//bx_printf("ConfigureNotify Xevent\n");
+//bio->printf("[X] ConfigureNotify Xevent\n");
show_headerbar();
break;
case ButtonPress:
button_event = (XButtonEvent *) &report;
-//bx_printf("xxx: buttonpress\n");
+//bio->printf("[X] xxx: buttonpress\n");
if (button_event->y < BX_HEADER_BAR_Y) {
-//bx_printf("xxx: in headerbar\n");
+//bio->printf("[X] xxx: in headerbar\n");
if (mouse_update) {
-//bx_printf("xxx: mouse_update=1\n");
+//bio->printf("[X] xxx: mouse_update=1\n");
send_keyboard_mouse_status();
mouse_update = 0;
}
@@ -599,28 +605,28 @@ bx_gui_c::handle_events(void)
current_x = button_event->x;
current_y = button_event->y;
mouse_update = 1;
-//bx_printf("xxx: x,y=(%d,%d)\n", current_x, current_y);
+//bio->printf("[X] xxx: x,y=(%d,%d)\n", current_x, current_y);
switch (button_event->button) {
case Button1:
-//bx_printf("xxx: button1\n");
+//bio->printf("[X] xxx: button1\n");
mouse_button_state |= 0x01;
send_keyboard_mouse_status();
mouse_update = 0;
break;
case Button2:
-//bx_printf("xxx: button2\n");
+//bio->printf("[X] xxx: button2\n");
// (mch) Hack for easier mouse handling (toggle mouse enable)
mouse_handler();
if (bx_options.mouse_enabled) {
- bx_printf("[x] Mouse enabled\n");
+ bio->printf("[x] Mouse enabled\n");
mouse_enable_x = current_x;
mouse_enable_y = current_y;
disable_cursor();
// Move the cursor to a 'safe' place
warp_cursor(warp_home_x-current_x, warp_home_y-current_y);
} else {
- bx_printf("[x] Mouse disabled\n");
+ bio->printf("[x] Mouse disabled\n");
enable_cursor();
warp_cursor(mouse_enable_x-current_x, mouse_enable_y-current_y);
}
@@ -630,7 +636,7 @@ bx_gui_c::handle_events(void)
//mouse_update = 0;
break;
case Button3:
-//bx_printf("xxx: button3\n");
+//bio->printf("[X] xxx: button3\n");
mouse_button_state |= 0x02;
send_keyboard_mouse_status();
mouse_update = 0;
@@ -640,11 +646,11 @@ bx_gui_c::handle_events(void)
case ButtonRelease:
button_event = (XButtonEvent *) &report;
-//bx_printf("xxx: buttonrelease\n");
+//bio->printf("[X] xxx: buttonrelease\n");
if (button_event->y < BX_HEADER_BAR_Y) {
-//bx_printf("xxx: in headerbar\n");
+//bio->printf("[X] xxx: in headerbar\n");
if (mouse_update) {
-//bx_printf("xxx: mouse_update=1\n");
+//bio->printf("[X] xxx: mouse_update=1\n");
send_keyboard_mouse_status();
mouse_update = 0;
}
@@ -656,22 +662,22 @@ bx_gui_c::handle_events(void)
current_x = button_event->x;
current_y = button_event->y;
mouse_update = 1;
-//bx_printf("xxx: x,y=(%d,%d)\n", current_x, current_y);
+//bio->printf("[X] xxx: x,y=(%d,%d)\n", current_x, current_y);
switch (button_event->button) {
case Button1:
-//bx_printf("xxx: button1\n");
+//bio->printf("[X] xxx: button1\n");
mouse_button_state &= ~0x01;
send_keyboard_mouse_status();
mouse_update = 0;
break;
case Button2:
-//bx_printf("xxx: button2\n");
+//bio->printf("[X] xxx: button2\n");
//mouse_button_state &= ~;
//send_keyboard_mouse_status();
//mouse_update = 0;
break;
case Button3:
-//bx_printf("xxx: button3\n");
+//bio->printf("[X] xxx: button3\n");
mouse_button_state &= ~0x02;
send_keyboard_mouse_status();
mouse_update = 0;
@@ -682,14 +688,14 @@ bx_gui_c::handle_events(void)
case KeyPress:
key_event = (XKeyEvent *) &report;
charcount = XLookupString(key_event, buffer, bufsize, &keysym, &compose);
-/*fprintf(stderr, "# >>> %s\n", XKeysymToString(keysym));*/
+/*bio->printf("#X] >>> %s\n", XKeysymToString(keysym));*/
xkeypress(keysym, 0);
break;
case KeyRelease:
key_event = (XKeyEvent *) &report;
charcount = XLookupString(key_event, buffer, bufsize, &keysym, &compose);
-/*fprintf(stderr, "# <<< %s\n", XKeysymToString(keysym));*/
+/*bio->printf("#X] <<< %s\n", XKeysymToString(keysym));*/
xkeypress(keysym, 1);
break;
@@ -698,34 +704,34 @@ bx_gui_c::handle_events(void)
current_x = pointer_event->x;
current_y = pointer_event->y;
mouse_update = 1;
-//bx_printf("xxx: motionNotify x,y=(%d,%d)\n", current_x, current_y);
+//bio->printf("[X] xxx: motionNotify x,y=(%d,%d)\n", current_x, current_y);
break;
case EnterNotify:
enter_event = (XEnterWindowEvent *) &report;
prev_x = current_x = enter_event->x;
prev_y = current_y = enter_event->y;
-//bx_printf("xxx: enterNotify x,y=(%d,%d)\n", current_x, current_y);
+//bio->printf("[X] xxx: enterNotify x,y=(%d,%d)\n", current_x, current_y);
break;
case LeaveNotify:
leave_event = (XLeaveWindowEvent *) &report;
prev_x = current_x = -1;
prev_y = current_y = -1;
-//bx_printf("xxx: LeaveNotify x,y set to -1\n");
+//bio->printf("[X] xxx: LeaveNotify x,y set to -1\n");
break;
case MapNotify:
/* screen needs redraw, since X would have tossed previous
* requests before window mapped
*/
-//bx_printf("xxx: mapnotify: found\n");
+//bio->printf("[X] xxx: mapnotify: found\n");
//retval = 1;
break;
default:
// (mch) Ignore...
- // bx_printf("xxx: default Xevent type\n");
+ // bio->printf("[X] xxx: default Xevent type\n");
/* all events selected by StructureNotifyMask are thrown away here,
* since nothing is done with them */
break;
@@ -733,7 +739,7 @@ bx_gui_c::handle_events(void)
} /* end while */
if (mouse_update) {
- //bx_printf("xxx: bottom, send status\n");
+ //bio->printf("[X] xxx: bottom, send status\n");
send_keyboard_mouse_status();
}
}
@@ -742,7 +748,7 @@ bx_gui_c::handle_events(void)
void
send_keyboard_mouse_status(void)
{
-//bx_printf("xxx: prev=(%d,%d) curr=(%d,%d)\n",
+//bio->printf("[X] xxx: prev=(%d,%d) curr=(%d,%d)\n",
// prev_x, prev_y, current_x, current_y);
if ( (prev_x!=-1) && (current_x!=-1) && (prev_y!=-1) && (current_y!=-1)) {
@@ -753,7 +759,7 @@ send_keyboard_mouse_status(void)
dy = -(current_y - prev_y - warp_dy);
warp_cursor(warp_home_x-current_x, warp_home_y-current_y);
-//bx_printf("xxx: MOUSE_MOTION: dx=%d, dy=%d\n", (int) dx, (int) dy);
+//bio->printf("[X] xxx: MOUSE_MOTION: dx=%d, dy=%d\n", (int) dx, (int) dy);
bx_devices.keyboard->mouse_motion( dx, dy, mouse_button_state);
//if (warped) {
// prev_x = current_x = -1;
@@ -911,7 +917,7 @@ xkeypress(KeySym keysym, int press_relea
case XK_Page_Down: key_event = BX_KEY_PAGE_DOWN; break;
default:
- fprintf(stderr, "# xkeypress(): keysym %x unhandled!\n", (unsigned) keysym);
+ bio->printf("#X] xkeypress(): keysym %x unhandled!\n", (unsigned) keysym);
return;
break;
}
@@ -1076,7 +1082,7 @@ bx_gui_c::graphics_tile_update(Bit8u *ti
}
break;
default:
- bx_panic("X_graphics_tile_update: bits_per_pixel %u not implemented\n",
+ bio->panic("X_graphics_tile_update: bits_per_pixel %u not implemented\n",
(unsigned) imBPP);
break;
}
@@ -1157,7 +1163,7 @@ bx_gui_c::show_headerbar(void)
bx_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
{
if (bx_bitmap_entries >= BX_MAX_PIXMAPS) {
- bx_panic("x: too many pixmaps, increase BX_MAX_PIXMAPS\n");
+ bio->panic("x: too many pixmaps, increase BX_MAX_PIXMAPS\n");
}
bx_bitmaps[bx_bitmap_entries].bmap =
@@ -1165,7 +1171,7 @@ bx_gui_c::create_bitmap(const unsigned c
bx_bitmaps[bx_bitmap_entries].xdim = xdim;
bx_bitmaps[bx_bitmap_entries].ydim = ydim;
if (!bx_bitmaps[bx_bitmap_entries].bmap) {
- bx_panic("x: could not create bitmap\n");
+ bio->panic("x: could not create bitmap\n");
}
bx_bitmap_entries++;
return(bx_bitmap_entries-1); // return index as handle
@@ -1178,7 +1184,7 @@ bx_gui_c::headerbar_bitmap(unsigned bmap
unsigned hb_index;
if ( (bx_headerbar_entries+1) > BX_MAX_HEADERBAR_ENTRIES )
- bx_panic("x: too many headerbar entries, increase BX_MAX_HEADERBAR_ENTRIES\n");
+ bio->panic("x: too many headerbar entries, increase BX_MAX_HEADERBAR_ENTRIES\n");
bx_headerbar_entries++;
hb_index = bx_headerbar_entries - 1;
@@ -1240,7 +1246,7 @@ headerbar_click(int x, int y)
void
bx_gui_c::exit(void)
{
- bx_printf("Note: X11: bx_gui_c::exit() not implemented yet.\n");
+ bio->printf("[X] Note: bx_gui_c::exit() not implemented yet.\n");
}
static void warp_cursor (int dx, int dy)

View File

@ -0,0 +1,10 @@
--- iodev/Makefile.in.orig Wed Oct 4 11:12:01 2000
+++ iodev/Makefile.in Wed Oct 4 11:12:22 2000
@@ -62,6 +62,7 @@ BX_HW_IODEV_OBJS = \
keyboard.o \
parallel.o \
serial.o \
+ serial_raw.o \
$(VIDEO_OBJS) \
@PCI_OBJ@ \
@NE2K_OBJS@ \

View File

@ -0,0 +1,136 @@
$OpenBSD: patch-iodev_cdrom_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/cdrom.cc.orig Sat Mar 25 21:32:13 2000
+++ iodev/cdrom.cc Tue Oct 17 12:04:02 2000
@@ -42,11 +42,6 @@ extern "C" {
#ifdef __OpenBSD__
// Here is a diff for cdrom.cc which adds support for OpenBSD.
-//
-// Note that since the i386 sys/disklabel.h contains code which c++ considers
-// invalid, it will not work with a default release until OpenBSD 2.7.
-// (I will fix disklabel.h as soon as 2.6 is done and the tree is unlocked.)
-extern "C" {
#include <sys/types.h>
#include <sys/param.h>
#include <sys/file.h>
@@ -57,7 +52,6 @@ extern "C" {
// XXX
#define BX_CD_FRAMESIZE 2048
#define CD_FRAMESIZE 2048
-}
#endif
#ifdef WIN32
@@ -163,7 +157,7 @@ cdrom_interface::read_toc(uint8* buf, in
// Read CD TOC. Returns false if start track is out of bounds.
if (fd < 0) {
- bx_panic("cdrom: read_toc: file not open.\n");
+ bio->panic("cdrom: read_toc: file not open.\n");
}
#ifdef WIN32
@@ -178,7 +172,7 @@ cdrom_interface::read_toc(uint8* buf, in
{
struct cdrom_tochdr tochdr;
if (ioctl(fd, CDROMREADTOCHDR, &tochdr))
- bx_panic("cdrom: read_toc: READTOCHDR failed.\n");
+ bio->panic("cdrom: read_toc: READTOCHDR failed.\n");
if (start_track > tochdr.cdth_trk1)
return false;
@@ -195,7 +189,7 @@ cdrom_interface::read_toc(uint8* buf, in
tocentry.cdte_format = (msf) ? CDROM_MSF : CDROM_LBA;
tocentry.cdte_track = i;
if (ioctl(fd, CDROMREADTOCENTRY, &tocentry))
- bx_panic("cdrom: read_toc: READTOCENTRY failed.\n");
+ bio->panic("cdrom: read_toc: READTOCENTRY failed.\n");
buf[len++] = 0; // Reserved
buf[len++] = (tocentry.cdte_adr << 4) | tocentry.cdte_ctrl ; // ADR, control
buf[len++] = i; // Track number
@@ -220,7 +214,7 @@ cdrom_interface::read_toc(uint8* buf, in
tocentry.cdte_format = (msf) ? CDROM_MSF : CDROM_LBA;
tocentry.cdte_track = 0xaa;
if (ioctl(fd, CDROMREADTOCENTRY, &tocentry))
- bx_panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
+ bio->panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
buf[len++] = 0; // Reserved
buf[len++] = (tocentry.cdte_adr << 4) | tocentry.cdte_ctrl ; // ADR, control
buf[len++] = 0xaa; // Track number
@@ -252,7 +246,7 @@ cdrom_interface::read_toc(uint8* buf, in
struct ioc_read_toc_entry t;
if (ioctl (fd, CDIOREADTOCHEADER, &h) < 0)
- bx_panic("cdrom: read_toc: READTOCHDR failed.\n");
+ bio->panic("cdrom: read_toc: READTOCHDR failed.\n");
if (start_track > h.ending_track)
return false;
@@ -272,7 +266,7 @@ cdrom_interface::read_toc(uint8* buf, in
t.data = &tocentry;
if (ioctl (fd, CDIOREADTOCENTRYS, &tocentry) < 0)
- bx_panic("cdrom: read_toc: READTOCENTRY failed.\n");
+ bio->panic("cdrom: read_toc: READTOCENTRY failed.\n");
buf[len++] = 0; // Reserved
buf[len++] = (tocentry.addr_type << 4) | tocentry.control ; // ADR, control
@@ -301,7 +295,7 @@ cdrom_interface::read_toc(uint8* buf, in
t.data = &tocentry;
if (ioctl (fd, CDIOREADTOCENTRYS, &tocentry) < 0)
- bx_panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
+ bio->panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
buf[len++] = 0; // Reserved
buf[len++] = (tocentry.addr_type << 4) | tocentry.control ; // ADR, control
@@ -349,10 +343,10 @@ cdrom_interface::capacity()
uint32 nr_sects;
if (fd < 0) {
- bx_panic("cdrom: capacity: file not open.\n");
+ bio->panic("cdrom: capacity: file not open.\n");
}
if (ioctl(fd, BLKGETSIZE, &nr_sects) != 0) {
- bx_panic("cdrom: ioctl(BLKGETSIZE) failed\n");
+ bio->panic("cdrom: ioctl(BLKGETSIZE) failed\n");
}
nr_sects /= (CD_FRAMESIZE / 512);
@@ -365,10 +359,10 @@ cdrom_interface::capacity()
struct disklabel lp;
if (fd < 0)
- bx_panic("cdrom: capacity: file not open.\n");
+ bio->panic("cdrom: capacity: file not open.\n");
if (ioctl(fd, DIOCGDINFO, &lp) < 0)
- bx_panic("cdrom: ioctl(DIOCGDINFO) failed\n");
+ bio->panic("cdrom: ioctl(DIOCGDINFO) failed\n");
fprintf(stderr, "#cdrom: capacity: %u\n", lp.d_secperunit);
return(lp.d_secperunit);
@@ -397,12 +391,12 @@ cdrom_interface::read_block(uint8* buf,
#ifdef WIN32
pos = SetFilePointer(hFile, lba*BX_CD_FRAMESIZE, NULL, SEEK_SET);
if (pos == 0xffffffff) {
- bx_panic("cdrom: read_block: lseek returned error.\n");
+ bio->panic("cdrom: read_block: lseek returned error.\n");
}
#else
pos = lseek(fd, lba*BX_CD_FRAMESIZE, SEEK_SET);
if (pos < 0) {
- bx_panic("cdrom: read_block: lseek returned error.\n");
+ bio->panic("cdrom: read_block: lseek returned error.\n");
}
#endif
@@ -413,7 +407,7 @@ cdrom_interface::read_block(uint8* buf,
#endif
if (n != BX_CD_FRAMESIZE) {
- bx_panic("cdrom: read_block: read returned %d\n",
+ bio->panic("cdrom: read_block: read returned %d\n",
(int) n);
}
}

View File

@ -0,0 +1,202 @@
$OpenBSD: patch-iodev_cmos_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/cmos.cc.orig Sat Mar 25 21:28:48 2000
+++ iodev/cmos.cc Fri Oct 20 19:00:32 2000
@@ -100,7 +100,7 @@ bx_cmos_c::init(bx_devices_c *d)
else if (bx_options.cmos.time0 != 0)
BX_CMOS_THIS s.timeval = bx_options.cmos.time0;
- bx_printf("[cmos] Setting initial clock to: %s",
+ bio->printf("[CMOS] Setting initial clock to: %s",
ctime(&(BX_CMOS_THIS s.timeval)));
update_clock();
@@ -117,24 +117,24 @@ bx_cmos_c::init(bx_devices_c *d)
#endif
);
if (fd < 0) {
- perror("trying to open cmos image file.\n");
- bx_panic("trying to open cmos image file '%s'\n",
+ perror("[CMOS] trying to open cmos image file.\n");
+ bio->panic("CMOS trying to open cmos image file '%s'\n",
bx_options.cmos.path);
}
ret = fstat(fd, &stat_buf);
if (ret) {
- bx_panic("CMOS: could not fstat() image file.\n");
+ bio->panic("CMOS: could not fstat() image file.\n");
}
if (stat_buf.st_size != BX_NUM_CMOS_REGS) {
- bx_panic("CMOS: image file not same size as BX_NUM_CMOS_REGS.\n");
+ bio->panic("CMOS: image file not same size as BX_NUM_CMOS_REGS.\n");
}
ret = read(fd, (bx_ptr_t) BX_CMOS_THIS s.reg, BX_NUM_CMOS_REGS);
if (ret != BX_NUM_CMOS_REGS) {
- bx_panic("CMOS: error reading cmos file.\n");
+ bio->panic("CMOS: error reading cmos file.\n");
}
close(fd);
- bx_printf("CMOS: successfuly read from image file '%s'.\n",
+ bio->printf("[CMOS] loaded from '%s'.\n",
bx_options.cmos.path);
}
else {
@@ -217,18 +217,18 @@ bx_cmos_c::read(Bit32u address, unsigned
Bit8u ret8;
if (io_len > 1)
- bx_panic("cmos: io read from address %08x len=%u\n",
+ bio->panic("[CMOS] io read from address %08x len=%u\n",
(unsigned) address, (unsigned) io_len);
- if (bx_dbg.cmos)
- bx_printf("CMOS read of CMOS register 0x%x\n",
+ if (bio->getdbg().cmos)
+ bio->printf("[CMOS] read of CMOS register 0x%x\n",
(unsigned) BX_CMOS_THIS s.cmos_mem_address);
switch (address) {
case 0x0071:
if (BX_CMOS_THIS s.cmos_mem_address >= BX_NUM_CMOS_REGS) {
- bx_panic("unsupported cmos io read, register(0x%02x)!\n",
+ bio->panic("unsupported cmos io read, register(0x%02x)!\n",
(unsigned) BX_CMOS_THIS s.cmos_mem_address);
}
@@ -240,7 +240,7 @@ bx_cmos_c::read(Bit32u address, unsigned
break;
default:
- bx_panic("unsupported cmos read, address=%0x%x!\n",
+ bio->panic("unsupported cmos read, address=%0x%x!\n",
(unsigned) address);
return(0);
break;
@@ -268,11 +268,11 @@ bx_cmos_c::write(Bit32u address, Bit32u
#endif // !BX_USE_CMOS_SMF
if (io_len > 1)
- bx_panic("cmos: io write to address %08x len=%u\n",
+ bio->panic("[CMOS] io write to address %08x len=%u\n",
(unsigned) address, (unsigned) io_len);
- if (bx_dbg.cmos)
- bx_printf("CMOS write to address: 0x%x = 0x%x\n",
+ if (bio->getdbg().cmos)
+ bio->printf("[CMOS] write to address: 0x%x = 0x%x\n",
(unsigned) address, (unsigned) value);
@@ -287,7 +287,7 @@ bx_cmos_c::write(Bit32u address, Bit32u
case 0x0071:
if (BX_CMOS_THIS s.cmos_mem_address >= BX_NUM_CMOS_REGS) {
- bx_panic("unsupported cmos io write, register(0x%02x)=%02x!\n",
+ bio->panic("unsupported cmos io write, register(0x%02x)=%02x!\n",
(unsigned) BX_CMOS_THIS s.cmos_mem_address, (unsigned) value);
return;
}
@@ -302,8 +302,6 @@ bx_cmos_c::write(Bit32u address, Bit32u
case 0x07: // day of the month
case 0x08: // month
case 0x09: // year
- //bx_printf("CMOS: write reg %02xh: value = %02xh\n",
- // (unsigned) BX_CMOS_THIS s.cmos_mem_address, (unsigned) value);
BX_CMOS_THIS s.reg[BX_CMOS_THIS s.cmos_mem_address] = value;
return;
break;
@@ -343,7 +341,7 @@ bx_cmos_c::write(Bit32u address, Bit32u
unsigned dcc;
dcc = (value >> 4) & 0x07;
if (dcc != 0x02) {
- bx_panic("cmos: CRA: divider chain control 0x%x\n", dcc);
+ bio->panic("[CMOS] CRA: divider chain control 0x%x\n", dcc);
}
BX_CMOS_THIS s.reg[0x0a] = value & 0x7f;
BX_CMOS_THIS CRA_change();
@@ -378,9 +376,9 @@ bx_cmos_c::write(Bit32u address, Bit32u
// can not handle binary or 12-hour mode yet.
if (value & 0x04)
- bx_panic("cmos: write status reg B, binary format enabled.\n");
+ bio->panic("[CMOS] write status reg B, binary format enabled.\n");
if ( !(value & 0x02) )
- bx_panic("cmos: write status reg B, 12 hour mode enabled.\n");
+ bio->panic("[CMOS] write status reg B, 12 hour mode enabled.\n");
value &= 0xf7; // bit3 always 0
// Note: setting bit 7 clears bit 4
@@ -412,55 +410,57 @@ bx_cmos_c::write(Bit32u address, Bit32u
case 0x0c: // Control Register C
case 0x0d: // Control Register D
- bx_panic("cmos: write to control register 0x%x (read-only)\n",
+ bio->panic("[CMOS] write to control register 0x%x (read-only)\n",
BX_CMOS_THIS s.cmos_mem_address);
break;
case 0x0e: // diagnostic status
- bx_printf("CMOS: write register 0Eh: %02x\n", (unsigned) value);
+ bio->printf("[CMOS] write register 0Eh: %02x\n", (unsigned) value);
break;
case 0x0f: // shutdown status
switch (value) {
case 0x00: /* proceed with normal POST (soft reset) */
- if (bx_dbg.reset)
- bx_printf("CMOS: Reg 0F set to 0: shutdown action = normal POST\n");
+ if (bio->getdbg().reset)
+ bio->printf("[CMOS] Reg 0F set to 0: shutdown action = normal POST\n");
break;
case 0x02: /* shutdown after memory test */
- if (bx_dbg.reset)
- bx_printf("CMOS: Reg 0Fh: request to change shutdown action"
+ if (bio->getdbg().reset)
+ bio->printf("[CMOS] Reg 0Fh: request to change shutdown action"
" to shutdown after memory test\n");
break;
case 0x03:
- bx_printf ("CMOS: Reg 0Fh(03) : Shutdown after memory test !\n");
+ bio->printf ("[CMOS] Reg 0Fh(03) : Shutdown after memory test !\n");
break;
case 0x04: /* jump to disk bootstrap routine */
- bx_printf("CMOS: Reg 0Fh: request to change shutdown action "
+ bio->printf("[CMOS] Reg 0Fh: request to change shutdown action "
"to jump to disk bootstrap routine.\n");
break;
case 0x06:
- bx_printf ("CMOS: Reg 0Fh(06) : Shutdown after memory test !\n");
+ bio->printf ("[CMOS] Reg 0Fh(06) : Shutdown after memory test !\n");
break;
case 0x09: /* return to BIOS extended memory block move
(interrupt 15h, func 87h was in progress) */
- if (bx_dbg.reset)
- bx_printf("CMOS: Reg 0Fh: request to change shutdown action "
+ if (bio->getdbg().reset)
+ bio->printf("[CMOS] Reg 0Fh: request to change shutdown action "
"to return to BIOS extended memory block move.\n");
break;
case 0x0a: /* jump to DWORD pointer at 40:67 */
- if (bx_dbg.reset)
- bx_printf("CMOS: Reg 0Fh: request to change shutdown action"
+ if (bio->getdbg().reset)
+ bio->printf("[CMOS] Reg 0Fh: request to change shutdown action"
" to jump to DWORD at 40:67\n");
break;
default:
- bx_panic("unsupported cmos io write to reg F, case %x!\n",
+ if(bio->getdbg().unsupported_io)
+ bio->printf("[CMOS] cmos io write to reg F, case %x\n",
(unsigned) value);
break;
}
break;
default:
- bx_printf("CMOS: write reg %02xh: value = %02xh\n",
+ if(bio->getdbg().cmos)
+ bio->printf("[CMOS] write reg %02xh: value = %02xh\n",
(unsigned) BX_CMOS_THIS s.cmos_mem_address, (unsigned) value);
break;
}

View File

@ -0,0 +1,134 @@
$OpenBSD: patch-iodev_devices_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/devices.cc.orig Sat Mar 25 21:32:21 2000
+++ iodev/devices.cc Tue Oct 17 12:04:02 2000
@@ -273,11 +273,11 @@ bx_devices_c::port92_read(Bit32u address
UNUSED(this_ptr);
#endif // !BX_USE_DEV_SMF
if (io_len > 1)
- bx_panic("devices.c: port 92h: io read from address %08x, len=%u\n",
+ bio->panic("devices.c: port 92h: io read from address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
- bx_printf("devices: port92h read partially supported!!!\n");
- bx_printf("devices: returning %02x\n", (unsigned) (BX_GET_ENABLE_A20() << 1));
+ bio->printf("devices: port92h read partially supported!!!\n");
+ bio->printf("devices: returning %02x\n", (unsigned) (BX_GET_ENABLE_A20() << 1));
return(BX_GET_ENABLE_A20() << 1);
}
@@ -300,17 +300,17 @@ bx_devices_c::port92_write(Bit32u addres
Boolean bx_cpu_reset;
if (io_len > 1)
- bx_panic("devices.c: port 92h: io read from address %08x, len=%u\n",
+ bio->panic("devices.c: port 92h: io read from address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
- bx_printf("devices: port92h write of %02x partially supported!!!\n",
+ bio->printf("devices: port92h write of %02x partially supported!!!\n",
(unsigned) value);
-bx_printf("devices: A20: set_enable_a20() called\n");
+bio->printf("devices: A20: set_enable_a20() called\n");
BX_SET_ENABLE_A20( (value & 0x02) >> 1 );
- bx_printf("A20: now %u\n", (unsigned) BX_GET_ENABLE_A20());
+ bio->printf("A20: now %u\n", (unsigned) BX_GET_ENABLE_A20());
bx_cpu_reset = (value & 0x01); /* high speed reset */
if (bx_cpu_reset) {
- bx_panic("PORT 92h write: CPU reset requested!\n");
+ bio->panic("PORT 92h write: CPU reset requested!\n");
}
}
@@ -333,8 +333,8 @@ bx_devices_c::timer()
retval = keyboard->periodic( TIMER_DELTA );
if (retval & 0x01) {
- if (bx_dbg.keyboard)
- bx_printf("keyboard: interrupt(1)\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("keyboard: interrupt(1)\n");
pic->trigger_irq(1);
}
if (retval & 0x02)
@@ -382,11 +382,11 @@ bx_devices_c::dma_write8(unsigned channe
bx_devices_c::register_irq(unsigned irq, const char *name)
{
if (irq >= BX_MAX_IRQS) {
- bx_panic("IO device %s registered with IRQ=%d above %u\n",
+ bio->panic("IO device %s registered with IRQ=%d above %u\n",
name, irq, (unsigned) BX_MAX_IRQS-1);
}
if (irq_handler_name[irq]) {
- bx_panic("IRQ %u conflict, %s with %s\n", irq,
+ bio->panic("IRQ %u conflict, %s with %s\n", irq,
irq_handler_name[irq], name);
}
irq_handler_name[irq] = name;
@@ -396,18 +396,18 @@ bx_devices_c::register_irq(unsigned irq,
bx_devices_c::unregister_irq(unsigned irq, const char *name)
{
if (irq >= BX_MAX_IRQS) {
- bx_panic("IO device %s tried to unregister IRQ %d above %u\n",
+ bio->panic("IO device %s tried to unregister IRQ %d above %u\n",
name, irq, (unsigned) BX_MAX_IRQS-1);
}
if (!irq_handler_name[irq]) {
- bx_printf("IO device %s tried to unregister IRQ %d, not registered\n",
+ bio->printf("IO device %s tried to unregister IRQ %d, not registered\n",
name, irq);
return;
}
if (strcmp(irq_handler_name[irq], name)) {
- bx_printf("IRQ %u not registered to %s but to %s\n", irq,
+ bio->printf("IRQ %u not registered to %s but to %s\n", irq,
name, irq_handler_name[irq]);
return;
}
@@ -430,8 +430,8 @@ bx_devices_c::register_io_read_handler(
if (handle >= num_read_handles) {
/* no existing handle found, create new one */
if (num_read_handles >= BX_MAX_IO_DEVICES) {
- bx_printf("too many IO devices installed.\n");
- bx_panic(" try increasing BX_MAX_IO_DEVICES\n");
+ bio->printf("too many IO devices installed.\n");
+ bio->panic(" try increasing BX_MAX_IO_DEVICES\n");
}
num_read_handles++;
io_read_handler[handle].funct = f;
@@ -444,9 +444,9 @@ bx_devices_c::register_io_read_handler(
// another handler is already registered for that address
// if it is not the Unmapped port handler, bail
if ( strcmp( io_read_handler[read_handler_id[addr]].handler_name, "Unmapped" ) ) {
- bx_printf("IO device address conflict(read) at IO address %Xh\n",
+ bio->printf("IO device address conflict(read) at IO address %Xh\n",
(unsigned) addr);
- bx_panic(" conflicting devices: %s & %s\n",
+ bio->panic(" conflicting devices: %s & %s\n",
io_read_handler[handle].handler_name, io_read_handler[read_handler_id[addr]].handler_name);
}
}
@@ -471,8 +471,8 @@ bx_devices_c::register_io_write_handler(
if (handle >= num_write_handles) {
/* no existing handle found, create new one */
if (num_write_handles >= BX_MAX_IO_DEVICES) {
- bx_printf("too many IO devices installed.\n");
- bx_panic(" try increasing BX_MAX_IO_DEVICES\n");
+ bio->printf("too many IO devices installed.\n");
+ bio->panic(" try increasing BX_MAX_IO_DEVICES\n");
}
num_write_handles++;
io_write_handler[handle].funct = f;
@@ -485,9 +485,9 @@ bx_devices_c::register_io_write_handler(
// another handler is already registered for that address
// if it is not the Unmapped port handler, bail
if ( strcmp( io_write_handler[write_handler_id[addr]].handler_name, "Unmapped" ) ) {
- bx_printf("IO device address conflict(write) at IO address %Xh\n",
+ bio->printf("IO device address conflict(write) at IO address %Xh\n",
(unsigned) addr);
- bx_panic(" conflicting devices: %s & %s\n",
+ bio->panic(" conflicting devices: %s & %s\n",
io_write_handler[handle].handler_name, io_write_handler[write_handler_id[addr]].handler_name);
}
}

View File

@ -0,0 +1,363 @@
$OpenBSD: patch-iodev_dma_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/dma.cc.orig Sat Mar 25 21:28:48 2000
+++ iodev/dma.cc Tue Oct 31 12:16:53 2000
@@ -140,12 +140,12 @@ bx_dma_c::read( Bit32u address, unsign
Bit8u channel;
if (io_len > 1) {
- bx_panic("dma: io read from address %08x, len=%u\n",
+ bio->panic("[DMA] io read from address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
}
- if (bx_dbg.dma)
- bx_printf("dma: read addr=%04x\n", (unsigned) address);
+ if (bio->getdbg().dma)
+ bio->printf("[DMA] read addr=%04x\n", (unsigned) address);
#if BX_DMA_FLOPPY_IO < 1
/* if we're not supporting DMA/floppy IO just return a bogus value */
@@ -196,7 +196,7 @@ bx_dma_c::read( Bit32u address, unsign
return(retval);
break;
case 0x0d: // dma-1: temporary register
- bx_panic("dma-1: read of temporary register\n");
+ bio->panic("[DMA1] read of temporary register\n");
// Note: write to 0x0D clears temporary register
return(0);
break;
@@ -216,7 +216,8 @@ bx_dma_c::read( Bit32u address, unsign
case 0x008b: // DMA-2 page register, channel 5
case 0x008f: // DMA-2 page register, channel 4
channel = channelindex[address - 0x89] + 4;
- bx_printf("dma: read: unsupported address=%04x (channel %d)\n",
+ if(bio->getdbg().dma)
+ bio->printf("[DMA] read: unsupported address=%04x (channel %d)\n",
(unsigned) address, channel);
return( 0x00 );
@@ -236,12 +237,14 @@ bx_dma_c::read( Bit32u address, unsign
case 0x00da:
case 0x00dc:
case 0x00de:
- bx_printf("dma: read: unsupported address=%04x\n", (unsigned) address);
+ if(bio->getdbg().dma)
+ bio->printf("[DMA] read: unsupported address=%04x\n", (unsigned) address);
return(0x0000);
break;
default:
- bx_panic("dma: read: unsupported address=%04x\n", (unsigned) address);
+ if(bio->getdbg().dma)
+ bio->panic("[DMA] read: unsupported address=%04x\n", (unsigned) address);
return(0);
}
}
@@ -282,12 +285,12 @@ bx_dma_c::write(Bit32u address, Bit32u
return;
}
- bx_panic("dma: io write to address %08x, len=%u\n",
+ bio->panic("[DMA] io write to address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
}
- if (bx_dbg.dma)
- bx_printf("\ndma: write: address=%04x value=%02x\n",
+ if (bio->getdbg().dma)
+ bio->printf("[DMA] write: address=%04x value=%02x\n",
(unsigned) address, (unsigned) value);
#if BX_DMA_FLOPPY_IO < 1
@@ -301,8 +304,8 @@ bx_dma_c::write(Bit32u address, Bit32u
case 0x04:
case 0x06:
channel = address >> 1;
- if (bx_dbg.dma)
- bx_printf(" DMA-1 base and current address, channel %d\n", channel);
+ if (bio->getdbg().dma)
+ bio->printf("[DMA1] base and current address, channel %d\n", channel);
if (BX_DMA_THIS s.flip_flop==0) { /* 1st byte */
BX_DMA_THIS s.chan[channel].base_address = value;
BX_DMA_THIS s.chan[channel].current_address = value;
@@ -310,10 +313,10 @@ bx_dma_c::write(Bit32u address, Bit32u
else { /* 2nd byte */
BX_DMA_THIS s.chan[channel].base_address |= (value << 8);
BX_DMA_THIS s.chan[channel].current_address |= (value << 8);
- if (bx_dbg.dma) {
- bx_printf(" base = %04x\n",
+ if (bio->getdbg().dma) {
+ bio->printf("[DMA] base = %04x\n",
(unsigned) BX_DMA_THIS s.chan[channel].base_address);
- bx_printf(" curr = %04x\n",
+ bio->printf("[DMA] curr = %04x\n",
(unsigned) BX_DMA_THIS s.chan[channel].current_address);
}
}
@@ -326,8 +329,8 @@ bx_dma_c::write(Bit32u address, Bit32u
case 0x05:
case 0x07:
channel = address >> 1;
- if (bx_dbg.dma)
- bx_printf(" DMA-1 base and current count, channel %d\n", channel);
+ if (bio->getdbg().dma)
+ bio->printf("[DMA1] base and current count, channel %d\n", channel);
if (BX_DMA_THIS s.flip_flop==0) { /* 1st byte */
BX_DMA_THIS s.chan[channel].base_count = value;
BX_DMA_THIS s.chan[channel].current_count = value;
@@ -335,10 +338,10 @@ bx_dma_c::write(Bit32u address, Bit32u
else { /* 2nd byte */
BX_DMA_THIS s.chan[channel].base_count |= (value << 8);
BX_DMA_THIS s.chan[channel].current_count |= (value << 8);
- if (bx_dbg.dma) {
- bx_printf(" base = %04x\n",
+ if (bio->getdbg().dma) {
+ bio->printf("[DMA] base = %04x\n",
(unsigned) BX_DMA_THIS s.chan[channel].base_count);
- bx_printf(" curr = %04x\n",
+ bio->printf("[DMA] curr = %04x\n",
(unsigned) BX_DMA_THIS s.chan[channel].current_count);
}
}
@@ -348,14 +351,14 @@ bx_dma_c::write(Bit32u address, Bit32u
case 0x08: /* DMA-1: command register */
if (value != 0x04)
- bx_printf("DMA: write to 0008: value(%02xh) not 04h\n",
+ bio->printf("[DMA1] write to 0008: value(%02xh) not 04h\n",
(unsigned) value);
BX_DMA_THIS s.command_reg = value;
return;
break;
case 0x09: // DMA-1: request register
- bx_printf("DMA-1: write to request register (%02x)\n", (unsigned) value);
+ bio->printf("[DMA1] write to request register (%02x)\n", (unsigned) value);
// note: write to 0x0d clears this register
if (value & 0x04) {
// set request bit
@@ -366,7 +369,7 @@ bx_dma_c::write(Bit32u address, Bit32u
// clear request bit
channel = value & 0x03;
BX_DMA_THIS s.status_reg &= ~(1 << (channel+4));
- bx_printf("dma-1: cleared request bit for channel %u\n", (unsigned) channel);
+ bio->printf("[DMA1] cleared request bit for channel %u\n", (unsigned) channel);
}
return;
break;
@@ -375,8 +378,8 @@ bx_dma_c::write(Bit32u address, Bit32u
set_mask_bit = value & 0x04;
channel = value & 0x03;
BX_DMA_THIS s.mask[channel] = (set_mask_bit > 0);
- if (bx_dbg.dma)
- bx_printf("DMA1: set_mask_bit=%u, channel=%u, mask now=%02xh\n",
+ if (bio->getdbg().dma)
+ bio->printf("[DMA1] set_mask_bit=%u, channel=%u, mask now=%02xh\n",
(unsigned) set_mask_bit, (unsigned) channel, (unsigned) BX_DMA_THIS s.mask[channel]);
return;
break;
@@ -387,24 +390,24 @@ bx_dma_c::write(Bit32u address, Bit32u
BX_DMA_THIS s.chan[channel].mode.address_decrement = (value >> 5) & 0x01;
BX_DMA_THIS s.chan[channel].mode.autoinit_enable = (value >> 4) & 0x01;
BX_DMA_THIS s.chan[channel].mode.transfer_type = (value >> 2) & 0x03;
-//bx_printf("DMA1: mode register[%u] = %02x\n",
+//bio->printf("[DMA1] mode register[%u] = %02x\n",
//(unsigned) channel, (unsigned) value);
- if (bx_dbg.dma)
- bx_printf("DMA1: mode register[%u] = %02x\n",
+ if (bio->getdbg().dma)
+ bio->printf("[DMA1] mode register[%u] = %02x\n",
(unsigned) channel, (unsigned) value);
return;
break;
case 0x0c: /* dma-1 clear byte flip/flop */
- if (bx_dbg.dma)
- bx_printf("DMA1: clear flip/flop\n");
+ if (bio->getdbg().dma)
+ bio->printf("[DMA1] clear flip/flop\n");
BX_DMA_THIS s.flip_flop = 0;
return;
break;
case 0x0d: // dma-1: master disable
/* ??? */
- bx_printf("dma: master disable\n");
+ bio->printf("[DMA] master disable\n");
// writing any value to this port resets DMA controller 1
// same action as a hardware reset
// mask register is set (chan 0..3 disabled)
@@ -422,7 +425,7 @@ bx_dma_c::write(Bit32u address, Bit32u
break;
case 0x0e: // dma-1: clear mask register
- bx_printf("dma-1: clear mask register\n");
+ bio->printf("[DMA1] clear mask register\n");
BX_DMA_THIS s.mask[0] = 0;
BX_DMA_THIS s.mask[1] = 0;
BX_DMA_THIS s.mask[2] = 0;
@@ -431,7 +434,7 @@ bx_dma_c::write(Bit32u address, Bit32u
break;
case 0x0f: // dma-1: write all mask bits
- bx_printf("dma-1: write all mask bits\n");
+ bio->printf("[DMA1] write all mask bits\n");
BX_DMA_THIS s.mask[0] = value & 0x01; value >>= 1;
BX_DMA_THIS s.mask[1] = value & 0x01; value >>= 1;
BX_DMA_THIS s.mask[2] = value & 0x01; value >>= 1;
@@ -446,8 +449,8 @@ bx_dma_c::write(Bit32u address, Bit32u
/* address bits A16-A23 for DMA channel */
channel = channelindex[address - 0x81];
BX_DMA_THIS s.chan[channel].page_reg = value;
- if (bx_dbg.dma)
- bx_printf("DMA1: page register %d = %02x\n", channel, (unsigned) value);
+ if (bio->getdbg().dma)
+ bio->printf("[DMA1] page register %d = %02x\n", channel, (unsigned) value);
return;
break;
@@ -457,7 +460,7 @@ bx_dma_c::write(Bit32u address, Bit32u
//case 0xd0: /* DMA-2 command register */
// if (value != 0x04)
- // bx_printf("DMA2: write command register: value(%02xh)!=04h\n",
+ // bio->printf("[DMA2] write command register: value(%02xh)!=04h\n",
// (unsigned) value);
// return;
// break;
@@ -478,14 +481,14 @@ bx_dma_c::write(Bit32u address, Bit32u
case 0x00da:
case 0x00dc:
case 0x00de:
- bx_printf("DMA(ignored): write: %04xh = %04xh\n",
+ bio->printf("[DMA] write: %04xh = %04xh (ignored)\n",
(unsigned) address, (unsigned) value);
return;
break;
default:
- bx_printf("DMA(ignored): write: %04xh = %02xh\n",
+ bio->printf("[DMA] write: %04xh = %02xh (ignored)\n",
(unsigned) address, (unsigned) value);
}
}
@@ -497,15 +500,15 @@ bx_dma_c::DRQ(unsigned channel, Boolean
#if BX_SUPPORT_SB16
if ( (channel != 2) && (channel != (unsigned) BX_SB16_DMAL) )
- bx_panic("bx_dma_c::DRQ(): channel %d != 2 or %d (SB16) (\n",
+ bio->panic("[DMA] bx_dma_c::DRQ(): channel %d != 2 or %d (SB16) (\n",
channel, BX_SB16_DMAL);
#else
if ( channel != 2 )
- bx_panic("bx_dma_c::DRQ(): channel %d != 2\n",
+ bio->panic("[DMA] bx_dma_c::DRQ(): channel %d != 2\n",
channel);
#endif
if (!val) {
- //bx_printf("bx_dma_c::DRQ(): val == 0\n");
+ //bio->printf("[DMA] bx_dma_c::DRQ(): val == 0\n");
// clear bit in status reg
// deassert HRQ if not pending DRQ's ?
// etc.
@@ -514,46 +517,46 @@ bx_dma_c::DRQ(unsigned channel, Boolean
}
#if 0
- bx_printf("BX_DMA_THIS s.mask[2]: %02x\n", (unsigned) BX_DMA_THIS s.mask[2]);
- bx_printf("BX_DMA_THIS s.flip_flop: %u\n", (unsigned) BX_DMA_THIS s.flip_flop);
- bx_printf("BX_DMA_THIS s.status_reg: %02x\n", (unsigned) BX_DMA_THIS s.status_reg);
- bx_printf("mode_type: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.mode_type);
- bx_printf("address_decrement: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.address_decrement);
- bx_printf("autoinit_enable: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.autoinit_enable);
- bx_printf("transfer_type: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.transfer_type);
- bx_printf(".base_address: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].base_address);
- bx_printf(".current_address: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].current_address);
- bx_printf(".base_count: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].base_count);
- bx_printf(".current_count: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].current_count);
- bx_printf(".page_reg: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].page_reg);
+ bio->printf("[DMA] BX_DMA_THIS s.mask[2]: %02x\n", (unsigned) BX_DMA_THIS s.mask[2]);
+ bio->printf("[DMA] BX_DMA_THIS s.flip_flop: %u\n", (unsigned) BX_DMA_THIS s.flip_flop);
+ bio->printf("[DMA] BX_DMA_THIS s.status_reg: %02x\n", (unsigned) BX_DMA_THIS s.status_reg);
+ bio->printf("[DMA] mode_type: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.mode_type);
+ bio->printf("[DMA] address_decrement: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.address_decrement);
+ bio->printf("[DMA] autoinit_enable: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.autoinit_enable);
+ bio->printf("[DMA] transfer_type: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].mode.transfer_type);
+ bio->printf("[DMA] .base_address: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].base_address);
+ bio->printf("[DMA] .current_address: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].current_address);
+ bio->printf("[DMA] .base_count: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].base_count);
+ bio->printf("[DMA] .current_count: %04x\n", (unsigned) BX_DMA_THIS s.chan[channel].current_count);
+ bio->printf("[DMA] .page_reg: %02x\n", (unsigned) BX_DMA_THIS s.chan[channel].page_reg);
#endif
BX_DMA_THIS s.status_reg |= (1 << (channel+4));
// if (BX_DMA_THIS s.mask[channel])
- // bx_panic("bx_dma_c::DRQ(): BX_DMA_THIS s.mask[] is set\n");
+ // bio->panic("[DMA] bx_dma_c::DRQ(): BX_DMA_THIS s.mask[] is set\n");
if ( (BX_DMA_THIS s.chan[channel].mode.mode_type != DMA_MODE_SINGLE) &&
(BX_DMA_THIS s.chan[channel].mode.mode_type != DMA_MODE_DEMAND) )
- bx_panic("bx_dma_c::DRQ: mode_type(%02x) not handled\n",
+ bio->panic("[DMA] bx_dma_c::DRQ: mode_type(%02x) not handled\n",
(unsigned) BX_DMA_THIS s.chan[channel].mode.mode_type);
if (BX_DMA_THIS s.chan[channel].mode.address_decrement != 0)
- bx_panic("bx_dma_c::DRQ: address_decrement != 0\n");
+ bio->panic("[DMA] bx_dma_c::DRQ: address_decrement != 0\n");
//if (BX_DMA_THIS s.chan[channel].mode.autoinit_enable != 0)
- // bx_panic("bx_dma_c::DRQ: autoinit_enable != 0\n");
+ // bio->panic("[DMA] bx_dma_c::DRQ: autoinit_enable != 0\n");
dma_base = (BX_DMA_THIS s.chan[channel].page_reg << 16) | BX_DMA_THIS s.chan[channel].base_address;
dma_roof = dma_base + BX_DMA_THIS s.chan[channel].base_count;
if ( (dma_base & 0xffff0000) != (dma_roof & 0xffff0000) ) {
-bx_printf("dma_base = %08x\n", (unsigned) dma_base);
-bx_printf("dma_base_count = %08x\n", (unsigned) BX_DMA_THIS s.chan[channel].base_count);
-bx_printf("dma_roof = %08x\n", (unsigned) dma_roof);
- bx_panic("dma: DMA request outside 64k boundary\n");
+bio->printf("[DMA] dma_base = %08x\n", (unsigned) dma_base);
+bio->printf("[DMA] dma_base_count = %08x\n", (unsigned) BX_DMA_THIS s.chan[channel].base_count);
+bio->printf("[DMA] dma_roof = %08x\n", (unsigned) dma_roof);
+ bio->panic("[DMA] DMA request outside 64k boundary\n");
}
- //bx_printf("DRQ set up for single mode, increment, auto-init disabled, write\n");
+ //bio->printf("[DMA] DRQ set up for single mode, increment, auto-init disabled, write\n");
// should check mask register VS DREQ's in status register here?
// assert Hold ReQuest line to CPU
bx_pc_system.set_HRQ(1);
@@ -575,11 +578,11 @@ bx_dma_c::raise_HLDA(bx_pc_system_c *pc_
}
if (channel >= 4) {
// don't panic, just wait till they're unmasked
- // bx_panic("hlda: no unmasked requests\n");
+ // bio->panic("[DMA] hlda: no unmasked requests\n");
return;
}
- //bx_printf("hlda: OK in response to DRQ(%u)\n", (unsigned) channel);
+ //bio->printf("[DMA] hlda: OK in response to DRQ(%u)\n", (unsigned) channel);
phy_addr = (BX_DMA_THIS s.chan[channel].page_reg << 16) |
BX_DMA_THIS s.chan[channel].current_address;
@@ -609,7 +612,7 @@ bx_dma_c::raise_HLDA(bx_pc_system_c *pc_
}
else {
// address decrement
- bx_panic("hlda: decrement not implemented\n");
+ bio->panic("[DMA] hlda: decrement not implemented\n");
}
if (BX_DMA_THIS s.chan[channel].mode.transfer_type == 1) { // write
@@ -621,7 +624,7 @@ bx_dma_c::raise_HLDA(bx_pc_system_c *pc_
pc_sys->dma_read8(phy_addr, channel);
}
else {
- bx_panic("hlda: transfer_type of %u not handled\n",
+ bio->panic("[DMA] hlda: transfer_type of %u not handled\n",
(unsigned) BX_DMA_THIS s.chan[channel].mode.transfer_type);
}

View File

@ -0,0 +1,19 @@
--- iodev/eth.cc.orig Sat Mar 25 21:28:48 2000
+++ iodev/eth.cc Tue Oct 17 12:04:02 2000
@@ -49,6 +49,7 @@ eth_locator_c::create(const char *type,
const char *macaddr,
eth_rx_handler_t rxh, void *rxarg)
{
+ bio->printf("eth: create '%s' '%s' '%s'\n",type,netif,macaddr);
#ifdef eth_static_constructors
for (eth_locator_c *p = all; p != NULL; p = p->next) {
if (strcmp(type, p->type) == 0)
@@ -59,7 +60,7 @@ eth_locator_c::create(const char *type,
#ifdef ETH_NULL
{
- extern bx_null_match;
+ extern eth_locator_c *bx_null_match;
if (!strcmp(type, "null"))
ptr = (eth_locator_c *) &bx_null_match;
}

View File

@ -0,0 +1,86 @@
$OpenBSD: patch-iodev_eth_fbsd_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/eth_fbsd.cc.orig Sat Mar 25 21:28:48 2000
+++ iodev/eth_fbsd.cc Tue Oct 17 12:04:02 2000
@@ -146,19 +146,19 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(c
} while (this->bpf_fd < 0);
if (this->bpf_fd < 0) {
- bx_printf ("eth_freebsd: could not open packet filter\n");
+ bio->printf ("eth_freebsd: could not open packet filter\n");
return;
}
if (ioctl(this->bpf_fd, BIOCVERSION, (caddr_t)&bv) < 0) {
- bx_printf("eth_freebsd: could not retrieve bpf version\n");
+ bio->printf("eth_freebsd: could not retrieve bpf version\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;
}
if (bv.bv_major != BPF_MAJOR_VERSION ||
bv.bv_minor < BPF_MINOR_VERSION) {
- bx_printf("eth_freebsd: bpf version mismatch\n");
+ bio->printf("eth_freebsd: bpf version mismatch\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;
@@ -167,7 +167,7 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(c
// Set buffer size
v = BX_BPF_BUFSIZ;
if (ioctl(this->bpf_fd, BIOCSBLEN, (caddr_t)&v) < 0) {
- bx_printf("eth_freebsd: could not set buffer size\n");
+ bio->printf("eth_freebsd: could not set buffer size\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;
@@ -175,20 +175,20 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(c
(void)strncpy(ifr.ifr_name, netif, sizeof(ifr.ifr_name));
if (ioctl(this->bpf_fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
- bx_printf("eth_freebsd: could not enable interface %s\n", netif);
+ bio->printf("eth_freebsd: could not enable interface %s\n", netif);
close(this->bpf_fd);
this->bpf_fd == -1;
}
// Verify that the device is an ethernet.
if (ioctl(this->bpf_fd, BIOCGDLT, (caddr_t)&v) < 0) {
- bx_printf("eth_freebsd: could not retrieve datalink type\n");
+ bio->printf("eth_freebsd: could not retrieve datalink type\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;
}
if (v != DLT_EN10MB) {
- bx_printf("eth_freebsd: incorrect datalink type %d\n", v);
+ bio->printf("eth_freebsd: incorrect datalink type %d\n", v);
close(this->bpf_fd);
this->bpf_fd = -1;
return;
@@ -199,7 +199,7 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(c
// but this will do for now.
//
if (ioctl(this->bpf_fd, BIOCPROMISC, NULL) < 0) {
- bx_printf("eth_freebsd: could not enable promisc mode\n");
+ bio->printf("eth_freebsd: could not enable promisc mode\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;
@@ -208,7 +208,7 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(c
// Set up non-blocking i/o
v = 1;
if (ioctl(this->bpf_fd, FIONBIO, &v) < 0) {
- bx_printf("eth_freebsd: could not enable non-blocking i/o\n");
+ bio->printf("eth_freebsd: could not enable non-blocking i/o\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;
@@ -229,7 +229,7 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(c
bp.bf_len = 8;
bp.bf_insns = &this->filter[0];
if (ioctl(this->bpf_fd, BIOCSETF, &bp) < 0) {
- bx_printf("eth_freebsd: could not set filter\n");
+ bio->printf("eth_freebsd: could not set filter\n");
close(this->bpf_fd);
this->bpf_fd = -1;
return;

View File

@ -0,0 +1,100 @@
$OpenBSD: patch-iodev_eth_obsd_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/eth_obsd.cc.orig Wed Oct 18 20:20:38 2000
+++ iodev/eth_obsd.cc Wed Oct 18 20:27:29 2000
@@ -0,0 +1,96 @@
+// Copyright (C) 2000 MandrakeSoft S.A.
+//
+// MandrakeSoft S.A.
+// 43, rue d'Aboukir
+// 75002 Paris - France
+// http://www.linux-mandrake.com/
+// http://www.mandrakesoft.com/
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+#include "bochs.h"
+
+extern "C" {
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <net/if_types.h>
+#include <net/if_tun.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <sys/un.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+
+};
+
+//
+// Define the class. This is private to this module
+//
+class bx_obsd_pktmover_c : public eth_pktmover_c {
+public:
+ bx_obsd_pktmover_c(const char *netif, const char *macaddr,
+ eth_rx_handler_t rxh,
+ void *rxarg);
+ void sendpkt(void *buf, unsigned io_len);
+};
+
+
+//
+// Define the static class that registers the derived pktmover class,
+// and allocates one on request.
+//
+class bx_obsd_locator_c : public eth_locator_c {
+public:
+ bx_obsd_locator_c(void) : eth_locator_c("obsd") {}
+protected:
+ eth_pktmover_c *allocate(const char *netif, const char *macaddr,
+ eth_rx_handler_t rxh,
+ void *rxarg) {
+ struct tuninfo info;
+ memset(&info, '\0', sizeof info);
+ info.type = IFT_PPP;
+ info.mtu = mtu;
+
+ info.baudrate = bundle->bandwidth;
+ info.flags = IFF_UP|IFF_POINTOPOINT;
+ if (ioctl(bundle->dev.fd, TUNSIFINFO, &info) < 0)
+ bio->printf("ioctl(TUNSIFINFO): %s\n",
+ strerror(errno));
+
+ return (new bx_obsd_pktmover_c(netif, macaddr, rxh, rxarg));
+ }
+} bx_obsd_match;
+
+
+//
+// Define the methods for the bx_obsd_pktmover derived class
+//
+
+// the constructor
+bx_obsd_pktmover_c::bx_obsd_pktmover_c(const char *netif,
+ const char *macaddr,
+ eth_rx_handler_t rxh,
+ void *rxarg)
+{
+ // Nothing here.
+}
+
+// the output routine - called with pre-formatted ethernet frame.
+void
+bx_obsd_pktmover_c::sendpkt(void *buf, unsigned io_len)
+{
+ // silent discard.
+}
+

View File

@ -0,0 +1,664 @@
$OpenBSD: patch-iodev_floppy_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/floppy.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/floppy.cc Fri Oct 20 16:24:08 2000
@@ -95,21 +95,26 @@ bx_floppy_ctrl_c::init(bx_devices_c *d,
switch (bx_options.floppya.type) {
case BX_FLOPPY_NONE:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x00;
+ bio->printf("[FDD] fda: none\n");
break;
case BX_FLOPPY_1_2:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x20;
+ bio->printf("[FDD] fda: 1.2mb\n");
break;
case BX_FLOPPY_720K:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x30;
+ bio->printf("[FDD] fda: 720k\n");
break;
case BX_FLOPPY_1_44:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x40;
+ bio->printf("[FDD] fda: 1.44mb\n");
break;
case BX_FLOPPY_2_88:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x50;
+ bio->printf("[FDD] fda: 2.88mb\n");
break;
default:
- bx_panic("floppy: unknown floppya type\n");
+ bio->panic("[FDD] unknown floppya type\n");
}
if (bx_options.floppya.type != BX_FLOPPY_NONE) {
@@ -150,7 +155,7 @@ bx_floppy_ctrl_c::init(bx_devices_c *d,
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0xf0) | 0x05;
break;
default:
- bx_panic("floppy: unknown floppyb type\n");
+ bio->panic("[FDD] unknown floppyb type\n");
}
if (bx_options.floppyb.type != BX_FLOPPY_NONE) {
@@ -176,9 +181,9 @@ bx_floppy_ctrl_c::init(bx_devices_c *d,
BX_FD_THIS s.floppy_timer_index =
bx_pc_system.register_timer( this, timer_handler,
bx_options.floppy_command_delay, 0,0);
-
- bx_printf("bx_options.floppy_command_delay = %u\n",
- (unsigned) bx_options.floppy_command_delay);
+ if(bio->getdbg().floppy)
+ bio->printf("[FDD] delay = %u\n",
+ (unsigned) bx_options.floppy_command_delay);
}
@@ -251,16 +256,16 @@ bx_floppy_ctrl_c::read(Bit32u address, u
Bit8u status, value;
if (io_len > 1)
- bx_panic("floppy: io read from address %08x, len=%u\n",
+ bio->panic("[FDD] io read from address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
// ???
//if (bx_cpu.cs.selector.value != 0xf000) {
-// bx_printf("BIOS: floppy: read access to port %04x\n", (unsigned) address);
+// bio->printf("[BIOS] floppy: read access to port %04x\n", (unsigned) address);
// }
- if (bx_dbg.floppy)
- bx_printf("floppy: read access to port %04x\n", (unsigned) address);
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] read access to port %04x\n", (unsigned) address);
switch (address) {
#if BX_DMA_FLOPPY_IO
@@ -276,7 +281,7 @@ bx_floppy_ctrl_c::read(Bit32u address, u
case 0x3F5: /* diskette controller data */
if (BX_FD_THIS s.result_size == 0) {
- bx_panic("floppy: diskette controller:port3f5: no results to read\n");
+ bio->panic("[FDD] diskette controller:port3f5: no results to read\n");
}
value = BX_FD_THIS s.result[BX_FD_THIS s.result_index++];
@@ -308,7 +313,7 @@ bx_floppy_ctrl_c::read(Bit32u address, u
}
#if BX_DMA_FLOPPY_IO
- bx_panic("floppy: io_read: bailing\n");
+ bio->panic("[FDD] io_read: bailing\n");
return(0);
#endif // #if BX_DMA_FLOPPY_IO
}
@@ -339,17 +344,17 @@ bx_floppy_ctrl_c::write(Bit32u address,
Bit8u motor_on_drive0, motor_on_drive1;
if (io_len > 1)
- bx_panic("floppy: io write to address %08x, len=%u\n",
+ bio->panic("[FDD] io write to address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
// ???
//if (bx_cpu.cs.selector.value != 0xf000) {
-// bx_printf("BIOS: floppy: write access to port %04x, value=%02x\n",
+// bio->printf("[BIOS] floppy: write access to port %04x, value=%02x\n",
// (unsigned) address, (unsigned) value);
// }
- if (bx_dbg.floppy)
- bx_printf("floppy: write access to port %04x, value=%02x\n",
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] write access to port %04x, value=%02x\n",
(unsigned) address, (unsigned) value);
switch (address) {
@@ -358,8 +363,8 @@ bx_floppy_ctrl_c::write(Bit32u address,
motor_on_drive1 = value & 0x20;
motor_on_drive0 = value & 0x10;
dma_and_interrupt_enable = value & 0x08;
- if (!dma_and_interrupt_enable)
- bx_printf("floppy: DMA and interrupt capabilities disabled\n");
+ if (!dma_and_interrupt_enable && bio->getdbg().floppy)
+ bio->printf("[FDD] DMA and interrupt capabilities disabled\n");
normal_operation = value & 0x04;
drive_select = value & 0x03;
@@ -385,33 +390,36 @@ bx_floppy_ctrl_c::write(Bit32u address,
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
bx_options.floppy_command_delay, 0 );
}
- if (bx_dbg.floppy) {
- bx_printf("floppy: io_write: digital output register\n");
- bx_printf(" motor on, drive1 = %d\n", motor_on_drive1 > 0);
- bx_printf(" motor on, drive0 = %d\n", motor_on_drive0 > 0);
- bx_printf(" dma_and_interrupt_enable=%02x\n",
+ if (bio->getdbg().floppy) {
+ bio->printf("[FDD] io_write: digital output register\n");
+ bio->printf("[FDD] motor on, drive1 = %d\n", motor_on_drive1 > 0);
+ bio->printf("[FDD] motor on, drive0 = %d\n", motor_on_drive0 > 0);
+ bio->printf("[FDD] dma_and_interrupt_enable=%02x\n",
(unsigned) dma_and_interrupt_enable);
- bx_printf(" normal_operation=%02x\n",
+ bio->printf("[FDD] normal_operation=%02x\n",
(unsigned) normal_operation);
- bx_printf(" drive_select=%02x\n",
+ bio->printf("[FDD] drive_select=%02x\n",
(unsigned) drive_select);
}
- if (drive_select>1) {
- bx_panic("floppy: io_write: drive_select>1\n");
+ if (drive_select>1 && bio->getdbg().floppy) {
+ bio->printf("[FDD] io_write: drive_select>1\n");
}
break;
case 0x3f4: /* diskette controller data rate select register */
- bx_panic("floppy: io_write: data rate select register\n");
+ bio->printf("[FDD] io_write: data rate select register (unhandled)\n");
break;
case 0x3F5: /* diskette controller data */
- if (bx_dbg.floppy)
- bx_printf("floppy: command = %02x\n", (unsigned) value);
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] command = %02x\n", (unsigned) value);
if (BX_FD_THIS s.command_complete) {
- if (BX_FD_THIS s.pending_command!=0)
- bx_panic("floppy: io: 3f5: receiving new comm, old one (%02x) pending\n",
- (unsigned) BX_FD_THIS s.pending_command);
+ if (BX_FD_THIS s.pending_command!=0) {
+ if(bio->getdbg().floppy)
+ bio->printf("[FDD] io: 3f5: receiving new comm, old one (%02x) pending\n",
+ (unsigned) BX_FD_THIS s.pending_command);
+ break;
+ }
BX_FD_THIS s.command[0] = value;
BX_FD_THIS s.command_complete = 0;
BX_FD_THIS s.command_index = 1;
@@ -464,8 +472,9 @@ bx_floppy_ctrl_c::write(Bit32u address,
break;
default:
- bx_panic("floppy: io write:3f5: unsupported case 0x%02x\n",
- (unsigned) value);
+ if(bio->getdbg().floppy)
+ bio->printf("[FDD] io write:3f5: unsupported case 0x%02x\n",
+ (unsigned) value);
break;
}
}
@@ -479,36 +488,36 @@ bx_floppy_ctrl_c::write(Bit32u address,
BX_FD_THIS s.command_complete = 1;
}
}
- if (bx_dbg.floppy)
- bx_printf("floppy: io_write: diskette controller data\n");
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] io_write: diskette controller data\n");
return;
break;
#endif // #if BX_DMA_FLOPPY_IO
case 0x3F6: /* diskette controller (reserved) */
- if (bx_dbg.floppy)
- bx_printf("floppy: io_write: reserved register unsupported\n");
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] io_write: reserved register unsupported\n");
// this address shared with the hard drive controller
BX_FD_THIS devices->hard_drive->write_handler(BX_FD_THIS devices->hard_drive, address, value, io_len);
break;
#if BX_DMA_FLOPPY_IO
case 0x3F7: /* diskette controller configuration control register */
- if (bx_dbg.floppy)
- bx_printf("floppy: io_write: config control register\n");
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] io_write: config control register\n");
BX_FD_THIS s.data_rate = value & 0x03;
- if (bx_dbg.floppy)
+ if (bio->getdbg().floppy)
switch (BX_FD_THIS s.data_rate) {
- case 0: bx_printf(" 500 Kbps\n"); break;
- case 1: bx_printf(" 300 Kbps\n"); break;
- case 2: bx_printf(" 250 Kbps\n"); break;
- case 3: bx_printf(" 1 Mbps\n"); break;
+ case 0: bio->printf("[FDD] 500 Kbps\n"); break;
+ case 1: bio->printf("[FDD] 300 Kbps\n"); break;
+ case 2: bio->printf("[FDD] 250 Kbps\n"); break;
+ case 3: bio->printf("[FDD] 1 Mbps\n"); break;
}
return;
break;
default:
- bx_panic("floppy: io_write: unknown port %04h\n", (unsigned) address);
+ bio->panic("[FDD] io_write: unknown port %04h\n", (unsigned) address);
break;
#endif // #if BX_DMA_FLOPPY_IO
}
@@ -520,7 +529,7 @@ bx_floppy_ctrl_c::write(Bit32u address,
bx_floppy_ctrl_c::floppy_command(void)
{
#if BX_PROVIDE_CPU_MEMORY==0
- bx_panic("floppy_command(): uses DMA: not supported for"
+ bio->panic("floppy_command(): uses DMA: not supported for"
" external environment\n");
#else
unsigned i;
@@ -533,11 +542,11 @@ bx_floppy_ctrl_c::floppy_command(void)
Bit32u logical_sector;
- if (bx_dbg.floppy) {
- bx_printf("FLOPPY COMMAND: ");
+ if (bio->getdbg().floppy) {
+ bio->printf("[FDD] FLOPPY COMMAND: ");
for (i=0; i<BX_FD_THIS s.command_size; i++)
- bx_printf("[%02x] ", (unsigned) BX_FD_THIS s.command[i]);
- bx_printf("\n");
+ bio->printf("[%02x] ", (unsigned) BX_FD_THIS s.command[i]);
+ bio->printf("\n");
}
#if 0
@@ -547,7 +556,7 @@ bx_floppy_ctrl_c::floppy_command(void)
switch (BX_FD_THIS s.command[0]) {
case 0x03: // specify
-//bx_printf("floppy_command specify\n");
+//bio->printf("[FDD] floppy_command specify\n");
// execution: specified parameters are loaded
// result: no result bytes, no interrupt
step_rate_time = BX_FD_THIS s.command[1] >> 4;
@@ -566,20 +575,20 @@ bx_floppy_ctrl_c::floppy_command(void)
break;
case 0x07: // recalibrate
-//bx_printf("floppy_command recalibrate\n");
+//bio->printf("[FDD] floppy_command recalibrate\n");
drive = (BX_FD_THIS s.command[1] & 0x03);
BX_FD_THIS s.DOR &= 0xfc;
BX_FD_THIS s.DOR |= drive;
- if (bx_dbg.floppy)
- bx_printf("floppy_command(): recalibrate drive %u\n",
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] floppy_command(): recalibrate drive %u\n",
(unsigned) drive);
if (drive > 1)
- bx_panic("floppy_command(): drive > 1\n");
+ bio->panic("[FDD] floppy_command(): drive > 1\n");
//motor_on = BX_FD_THIS s.DOR & 0xf0;
motor_on = ( (BX_FD_THIS s.DOR>>(drive+4))
& 0x01 );
if (motor_on == 0) {
- bx_printf("floppy_command(): recal drive with motor off\n");
+ bio->printf("[FDD] floppy_command(): recal drive with motor off\n");
}
if (drive==0)
BX_FD_THIS s.DOR |= 0x10; // turn on MOTA
@@ -600,7 +609,7 @@ bx_floppy_ctrl_c::floppy_command(void)
break;
case 0x08: /* sense interrupt status */
-//bx_printf("floppy_command sense interrupt status\n");
+//bio->printf("[FDD] floppy_command sense interrupt status\n");
/* execution:
* get status
* result:
@@ -617,13 +626,13 @@ bx_floppy_ctrl_c::floppy_command(void)
/* read ready */
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY;
- if (bx_dbg.floppy)
- bx_printf("sense interrupt status\n");
+ if (bio->getdbg().floppy)
+ bio->printf("[FDD] sense interrupt status\n");
return;
break;
case 0x0f: /* seek */
-//bx_printf("floppy_command seek\n");
+//bio->printf("[FDD] floppy_command seek\n");
/* command:
* byte0 = 0F
* byte1 = drive & head select
@@ -640,7 +649,7 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.head[drive] = (BX_FD_THIS s.command[1] >> 2) & 0x01;
BX_FD_THIS s.cylinder[drive] = BX_FD_THIS s.command[2];
if (drive > 1)
- bx_panic("floppy_command(): seek: drive>1\n");
+ bio->panic("[FDD] floppy_command(): seek: drive>1\n");
/* ??? should also check cylinder validity */
bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index,
bx_options.floppy_command_delay, 0 );
@@ -651,7 +660,7 @@ bx_floppy_ctrl_c::floppy_command(void)
break;
case 0x13: // Configure
- bx_printf("floppy io: configure (mode=%02xh, pretrack=%02xh)\n",
+ bio->printf("[FDD] floppy io: configure (mode=%02xh, pretrack=%02xh)\n",
(unsigned)(BX_FD_THIS s.command[2]), (unsigned)(BX_FD_THIS s.command[3]));
BX_FD_THIS s.result_size = 0;
BX_FD_THIS s.result_index = 0;
@@ -661,16 +670,16 @@ bx_floppy_ctrl_c::floppy_command(void)
break;
case 0x4a: // read ID
-//bx_printf("floppy_command read ID\n"); // ???
+//bio->printf("[FDD] floppy_command read ID\n"); // ???
drive = BX_FD_THIS s.command[1] & 0x03;
BX_FD_THIS s.DOR &= 0xfc;
BX_FD_THIS s.DOR |= drive;
motor_on = (BX_FD_THIS s.DOR>>(drive+4)) & 0x01;
if (motor_on == 0)
- bx_panic("floppy_command(): 4a: motor not on\n");
+ bio->panic("[FDD] floppy_command(): 4a: motor not on\n");
if (drive > 1)
- bx_panic("floppy io: 4a: bad drive #\n");
+ bio->panic("[FDD] floppy io: 4a: bad drive #\n");
BX_FD_THIS s.result_size = 7;
BX_FD_THIS s.result_index = 0;
BX_FD_THIS s.result[0] = 0; /* ??? */
@@ -690,42 +699,42 @@ bx_floppy_ctrl_c::floppy_command(void)
case 0xe6: // read normal data
-//bx_printf("floppy_command read normal data\n");
+//bio->printf("[FDD] floppy_command read normal data\n");
case 0xc5: // write normal data
-//bx_printf("floppy_command write normal data\n");
+//bio->printf("[FDD] floppy_command write normal data\n");
if ( (BX_FD_THIS s.DOR & 0x08) == 0 )
- bx_panic("floppy: read/write command with DMA and int disabled\n");
+ bio->panic("[FDD] read/write command with DMA and int disabled\n");
drive = BX_FD_THIS s.command[1] & 0x03;
BX_FD_THIS s.DOR &= 0xfc;
BX_FD_THIS s.DOR |= drive;
motor_on = (BX_FD_THIS s.DOR>>(drive+4)) & 0x01;
if (motor_on == 0)
- bx_panic("floppy_command(): read/write: motor not on\n");
+ bio->panic("[FDD] floppy_command(): read/write: motor not on\n");
head = BX_FD_THIS s.command[3] & 0x01;
cylinder = BX_FD_THIS s.command[2]; /* 0..79 depending */
sector = BX_FD_THIS s.command[4]; /* 1..36 depending */
eot = BX_FD_THIS s.command[6]; /* 1..36 depending */
sector_size = BX_FD_THIS s.command[5];
data_length = BX_FD_THIS s.command[8];
- if (bx_dbg.floppy) {
- bx_printf("\n\nread/write normal data\n");
- bx_printf("BEFORE\n");
- bx_printf(" drive = %u\n", (unsigned) drive);
- bx_printf(" head = %u\n", (unsigned) head);
- bx_printf(" cylinder = %u\n", (unsigned) cylinder);
- bx_printf(" sector = %u\n", (unsigned) sector);
- bx_printf(" eot = %u\n", (unsigned) eot);
+ if (bio->getdbg().floppy) {
+ bio->printf("\n\nread/write normal data\n");
+ bio->printf("[FDD] BEFORE\n");
+ bio->printf("[FDD] drive = %u\n", (unsigned) drive);
+ bio->printf("[FDD] head = %u\n", (unsigned) head);
+ bio->printf("[FDD] cylinder = %u\n", (unsigned) cylinder);
+ bio->printf("[FDD] sector = %u\n", (unsigned) sector);
+ bio->printf("[FDD] eot = %u\n", (unsigned) eot);
}
if (drive > 1)
- bx_panic("floppy io: bad drive #\n");
+ bio->panic("floppy io: bad drive #\n");
if (head > 1)
- bx_panic("floppy io: bad head #\n");
+ bio->panic("floppy io: bad head #\n");
if ( BX_FD_THIS s.media_present[drive] == 0 ) {
// media not in drive, return error
- bx_printf("floppy_command: attempt to read/write sector %u,"
+ bio->printf("[FDD] floppy_command: attempt to read/write sector %u,"
" sectors/track=%u\n", (unsigned) sector,
(unsigned) BX_FD_THIS s.media[drive].sectors_per_track);
BX_FD_THIS s.result_size = 7;
@@ -745,21 +754,21 @@ bx_floppy_ctrl_c::floppy_command(void)
}
if (sector_size != 0x02) { // 512 bytes
- bx_panic("floppy: sector_size not 512\n");
+ bio->panic("[FDD] sector_size not 512\n");
}
if ( cylinder >= BX_FD_THIS s.media[drive].tracks ) {
- bx_printf("\nfloppy io: normal read/write: params out of range\n");
- bx_printf("*** sector # %02xh\n", (unsigned) sector);
- bx_printf("*** cylinder #%02xh\n", (unsigned) cylinder);
- bx_printf("*** eot #%02xh\n", (unsigned) eot);
- bx_printf("*** head #%02xh\n", (unsigned) head);
- bx_panic("bailing\n");
+ bio->printf("[FDD] floppy io: normal read/write: params out of range\n");
+ bio->printf("[FDD] *** sector # %02xh\n", (unsigned) sector);
+ bio->printf("[FDD] *** cylinder #%02xh\n", (unsigned) cylinder);
+ bio->printf("[FDD] *** eot #%02xh\n", (unsigned) eot);
+ bio->printf("[FDD] *** head #%02xh\n", (unsigned) head);
+ bio->panic("bailing\n");
return;
}
if (sector > BX_FD_THIS s.media[drive].sectors_per_track) {
// requested sector > last sector on track
- bx_printf("floppy_command: attempt to read/write sector %u,"
+ bio->printf("[FDD] floppy_command: attempt to read/write sector %u,"
" sectors/track=%u\n", (unsigned) sector,
(unsigned) BX_FD_THIS s.media[drive].sectors_per_track);
// set controller to where drive would have left off
@@ -792,18 +801,18 @@ bx_floppy_ctrl_c::floppy_command(void)
#if 0
if (eot != BX_FD_THIS s.media[drive].sectors_per_track)
- bx_printf("floppy io: bad eot #%02xh\n", (unsigned) eot);
+ bio->printf("[FDD] floppy io: bad eot #%02xh\n", (unsigned) eot);
#endif
- if (cylinder != BX_FD_THIS s.cylinder[drive])
- bx_printf("floppy io: cylinder request != current cylinder\n");
+ if (cylinder != BX_FD_THIS s.cylinder[drive] && bio->getdbg().floppy)
+ bio->printf("[FDD] floppy io: cylinder request != current cylinder\n");
logical_sector = (cylinder * 2 * BX_FD_THIS s.media[drive].sectors_per_track) +
(head * BX_FD_THIS s.media[drive].sectors_per_track) +
(sector - 1);
if (logical_sector >= BX_FD_THIS s.media[drive].sectors) {
- bx_panic("floppy io: logical sector out of bounds\n");
+ bio->panic("[FDD] floppy io: logical sector out of bounds\n");
}
BX_FD_THIS s.cylinder[drive] = cylinder;
@@ -833,15 +842,15 @@ bx_floppy_ctrl_c::floppy_command(void)
return;
}
else
- bx_panic("floppy_command(): unknown read/write command\n");
+ bio->panic("[FDD] floppy_command(): unknown read/write command\n");
return;
break;
default:
- bx_panic("floppy_command(): unknown function\n");
+ bio->panic("[FDD] floppy_command(): unknown function\n");
}
- bx_panic("\nfloppy_command()\n");
+ bio->panic("\nfloppy_command()\n");
#endif
}
@@ -852,13 +861,13 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u driv
int ret;
if (drive > 1)
- bx_panic("floppy_xfer: drive > 1\n");
+ bio->panic("floppy_xfer: drive > 1\n");
- if (bx_dbg.floppy) {
- bx_printf("drive=%u\n", (unsigned) drive);
- bx_printf("offset=%u\n", (unsigned) offset);
- bx_printf("bytes=%u\n", (unsigned) bytes);
- bx_printf("direction=%s\n", (direction==FROM_FLOPPY)? "from" : "to");
+ if (bio->getdbg().floppy) {
+ bio->printf("[FDD] drive=%u\n", (unsigned) drive);
+ bio->printf("[FDD] offset=%u\n", (unsigned) offset);
+ bio->printf("[FDD] bytes=%u\n", (unsigned) bytes);
+ bio->printf("[FDD] direction=%s\n", (direction==FROM_FLOPPY)? "from" : "to");
}
#ifdef macintosh
@@ -867,7 +876,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u driv
{
ret = lseek(BX_FD_THIS s.media[drive].fd, offset, SEEK_SET);
if (ret < 0) {
- bx_panic("could not perform lseek() on floppy image file\n");
+ bio->panic("could not perform lseek() on floppy image file\n");
}
}
@@ -881,12 +890,12 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u driv
if (ret < int(bytes)) {
/* ??? */
if (ret > 0) {
- bx_printf("floppy: partial read() on floppy image returns %u/%u\n",
+ bio->printf("[FDD] partial read() on floppy image returns %u/%u\n",
(unsigned) ret, (unsigned) bytes);
memset(buffer + ret, 0, bytes - ret);
}
else {
- bx_printf("floppy: read() on floppy image returns 0\n");
+ bio->printf("[FDD] read() on floppy image returns 0\n");
memset(buffer, 0, bytes);
}
}
@@ -900,7 +909,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u driv
#endif
ret = ::write(BX_FD_THIS s.media[drive].fd, (bx_ptr_t) buffer, bytes);
if (ret < int(bytes)) {
- bx_panic("could not perform write() on floppy image file\n");
+ bio->panic("could not perform write() on floppy image file\n");
}
}
}
@@ -911,7 +920,7 @@ bx_floppy_ctrl_c::floppy_xfer(Bit8u driv
bx_floppy_ctrl_c::timer_handler(void *this_ptr)
{
#if defined(SIMX86)
- printf("Floppy timer\n");
+ printf("[FDD] Floppy timer\n");
#endif
bx_floppy_ctrl_c *class_ptr = (bx_floppy_ctrl_c *) this_ptr;
@@ -957,7 +966,7 @@ bx_floppy_ctrl_c::timer()
break;
default:
- bx_panic("floppy:timer(): unknown case %02x\n",
+ bio->panic("[FDD]timer(): unknown case %02x\n",
(unsigned) BX_FD_THIS s.pending_command);
}
return;
@@ -998,13 +1007,13 @@ bx_floppy_ctrl_c::dma_write(Bit8u *data_
BX_FD_THIS s.result[5] = BX_FD_THIS s.sector[drive];
BX_FD_THIS s.result[6] = 2;
- if (bx_dbg.floppy) {
- bx_printf("<<READ DONE>>\n");
- bx_printf("AFTER\n");
- bx_printf(" drive = %u\n", (unsigned) drive);
- bx_printf(" head = %u\n", (unsigned) BX_FD_THIS s.head[drive]);
- bx_printf(" cylinder = %u\n", (unsigned) BX_FD_THIS s.cylinder[drive]);
- bx_printf(" sector = %u\n", (unsigned) BX_FD_THIS s.sector[drive]);
+ if (bio->getdbg().floppy) {
+ bio->printf("[FDD] <<READ DONE>>\n");
+ bio->printf("[FDD] AFTER\n");
+ bio->printf("[FDD] drive = %u\n", (unsigned) drive);
+ bio->printf("[FDD] head = %u\n", (unsigned) BX_FD_THIS s.head[drive]);
+ bio->printf("[FDD] cylinder = %u\n", (unsigned) BX_FD_THIS s.cylinder[drive]);
+ bio->printf("[FDD] sector = %u\n", (unsigned) BX_FD_THIS s.sector[drive]);
}
BX_FD_THIS devices->pic->trigger_irq(6);
@@ -1056,13 +1065,13 @@ bx_floppy_ctrl_c::dma_read(Bit8u *data_b
BX_FD_THIS s.result[4] = BX_FD_THIS s.head[drive];
BX_FD_THIS s.result[5] = BX_FD_THIS s.sector[drive];
BX_FD_THIS s.result[6] = 2;
- if (bx_dbg.floppy) {
- bx_printf("<<WRITE DONE>>\n");
- bx_printf("AFTER\n");
- bx_printf(" drive = %u\n", (unsigned) drive);
- bx_printf(" head = %u\n", (unsigned) BX_FD_THIS s.head[drive]);
- bx_printf(" cylinder = %u\n", (unsigned) BX_FD_THIS s.cylinder[drive]);
- bx_printf(" sector = %u\n", (unsigned) BX_FD_THIS s.sector[drive]);
+ if (bio->getdbg().floppy) {
+ bio->printf("[FDD] <<WRITE DONE>>\n");
+ bio->printf("[FDD] AFTER\n");
+ bio->printf("[FDD] drive = %u\n", (unsigned) drive);
+ bio->printf("[FDD] head = %u\n", (unsigned) BX_FD_THIS s.head[drive]);
+ bio->printf("[FDD] cylinder = %u\n", (unsigned) BX_FD_THIS s.cylinder[drive]);
+ bio->printf("[FDD] sector = %u\n", (unsigned) BX_FD_THIS s.sector[drive]);
}
BX_FD_THIS devices->pic->trigger_irq(6);
@@ -1095,7 +1104,7 @@ bx_floppy_ctrl_c::increment_sector(void)
// Set to 1 past last possible cylinder value.
// I notice if I set it to tracks-1, prama linux won't boot.
BX_FD_THIS s.cylinder[drive] = BX_FD_THIS s.media[drive].tracks;
- bx_printf("increment_sector: clamping cylinder to max\n");
+ bio->printf("[FDD] increment_sector: clamping cylinder to max\n");
}
}
}
@@ -1184,8 +1193,8 @@ bx_floppy_ctrl_c::evaluate_media(unsigne
#endif
ret = fstat(media->fd, &stat_buf);
if (ret) {
- perror("fstat'ing floppy 0 drive image file");
- bx_panic("fstat() returns error!\n");
+ perror("[FDD] fstat'ing floppy 0 drive image file");
+ bio->panic("floppy fstat() returns error!\n");
return(0);
}
@@ -1222,9 +1231,7 @@ bx_floppy_ctrl_c::evaluate_media(unsigne
media->heads = 2;
}
else {
- fprintf(stderr, "# floppy: evaluate_media: file '%s' of unknown size %lu\n",
- path, (unsigned long) stat_buf.st_size);
- bx_printf("floppy: evaluate_media: file '%s' of unknown size %lu\n",
+ bio->printf("[FDD] evaluate_media: file '%s' of unknown size %lu\n",
path, (unsigned long) stat_buf.st_size);
return(0);
}
@@ -1236,7 +1243,7 @@ bx_floppy_ctrl_c::evaluate_media(unsigne
media->heads = 2;
break;
default:
- bx_panic("floppy: evaluate_media: unknown media type\n");
+ bio->panic("[FDD] evaluate_media: unknown media type\n");
}
media->sectors = media->heads * media->tracks * media->sectors_per_track;
return(1); // success
@@ -1277,15 +1284,15 @@ bx_floppy_ctrl_c::evaluate_media(unsigne
media->heads = 2;
break;
default:
- bx_panic("floppy: evaluate_media: unknown media type\n");
+ bio->printf("[FDD] evaluate_media: unknown media type\n");
+ return 0;
}
media->sectors = media->heads * media->tracks * media->sectors_per_track;
return(1); // success
}
else {
// unknown file type
- fprintf(stderr, "# floppy: unknown mode type\n");
- bx_printf("floppy: unknown mode type\n");
+ bio->printf("[FDD] unknown mode type\n");
return(0);
}
}

View File

@ -0,0 +1,65 @@
$OpenBSD: patch-iodev_guest2host_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/guest2host.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/guest2host.cc Tue Oct 17 12:04:02 2000
@@ -72,7 +72,7 @@ bx_g2h_c::aquire_channel(bx_g2h_callback
}
}
- bx_printf("g2h: attempt to aquire channel: maxed out\n");
+ bio->printf("g2h: attempt to aquire channel: maxed out\n");
return(BX_G2H_ERROR); // No more free channels
}
@@ -81,7 +81,7 @@ bx_g2h_c::deaquire_channel(unsigned chan
{
if ( (channel >= BX_MAX_G2H_CHANNELS) ||
(bx_g2h.s.callback[channel].used==0) ) {
- bx_panic("g2h: attempt to deaquire channel %u: not aquired\n",
+ bio->panic("g2h: attempt to deaquire channel %u: not aquired\n",
channel);
}
bx_g2h.s.callback[channel].used = 0;
@@ -99,11 +99,11 @@ bx_g2h_c::inp_handler(void *this_ptr, Bi
UNUSED(this_ptr);
if (addr != BX_G2H_PORT)
- bx_panic("g2h: IO read not aligned on dword boundary.\n");
+ bio->panic("g2h: IO read not aligned on dword boundary.\n");
if (io_len != 4)
- bx_panic("g2h: IO read not dword.\n");
+ bio->panic("g2h: IO read not dword.\n");
- bx_panic("g2h: IO read not complete.\n");
+ bio->panic("g2h: IO read not complete.\n");
return(0);
}
@@ -116,12 +116,12 @@ bx_g2h_c::outp_handler(void *this_ptr, B
UNUSED(this_ptr);
if (addr != BX_G2H_PORT)
- bx_panic("g2h: IO write not aligned on dword boundary.\n");
+ bio->panic("g2h: IO write not aligned on dword boundary.\n");
if (io_len != 4)
- bx_panic("g2h: IO write not dword.\n");
+ bio->panic("g2h: IO write not dword.\n");
if ( (bx_g2h.s.packet_count==0) && (val32!=BX_G2H_MAGIC) ) {
- bx_printf("g2h: IO W: Not magic header.\n");
+ bio->printf("g2h: IO W: Not magic header.\n");
return;
}
bx_g2h.s.guest_packet[bx_g2h.s.packet_count++] = val32;
@@ -131,10 +131,10 @@ bx_g2h_c::outp_handler(void *this_ptr, B
// Full packet received from guest. Pass on to the host code.
channel = bx_g2h.s.guest_packet[1];
if (channel >= BX_MAX_G2H_CHANNELS) {
- bx_panic("g2h: channel (%u) out of bounds\n", channel);
+ bio->panic("g2h: channel (%u) out of bounds\n", channel);
}
if (bx_g2h.s.callback[channel].used==0) {
- bx_panic("g2h: channel (%u) not active\n", channel);
+ bio->panic("g2h: channel (%u) not active\n", channel);
}
bx_g2h.s.callback[channel].f(&bx_g2h.s.guest_packet);
bx_g2h.s.packet_count = 0; // Ready for next packet

View File

@ -0,0 +1,964 @@
--- iodev/harddrv.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/harddrv.cc Thu Oct 19 10:25:12 2000
@@ -103,10 +103,11 @@ bx_hard_drive_c::init(bx_devices_c *d, b
BX_HD_THIS s[1].hard_drive->cylinders = bx_options.diskd.cylinders;
BX_HD_THIS s[1].hard_drive->heads = bx_options.diskd.heads;
BX_HD_THIS s[1].hard_drive->sectors = bx_options.diskd.spt;
+ BX_HD_THIS s[1].device_type = IDE_DISK;
if (bx_options.cdromd.present) {
bx_options.diskd.present = 1;
- fprintf(stderr, "disk: Experimental CDROM on target 1\n");
+ bio->printf("[HDD] Experimental CDROM on target 1\n");
BX_HD_THIS s[1].device_type = IDE_CDROM;
BX_HD_THIS s[1].cdrom.locked = 0;
BX_HD_THIS s[1].sense.sense_key = SENSE_NONE;
@@ -116,22 +117,22 @@ bx_hard_drive_c::init(bx_devices_c *d, b
BX_CONTROLLER(1).sector_count = 0;
BX_CONTROLLER(1).interrupt_reason.c_d = 1;
if (BX_CONTROLLER(1).sector_count != 0x01)
- bx_panic("disk: interrupt reason bit field error\n");
+ bio->panic("[HDD] interrupt reason bit field error\n");
BX_CONTROLLER(1).sector_count = 0;
BX_CONTROLLER(1).interrupt_reason.i_o = 1;
if (BX_CONTROLLER(1).sector_count != 0x02)
- bx_panic("disk: interrupt reason bit field error\n");
+ bio->panic("[HDD] interrupt reason bit field error\n");
BX_CONTROLLER(1).sector_count = 0;
BX_CONTROLLER(1).interrupt_reason.rel = 1;
if (BX_CONTROLLER(1).sector_count != 0x04)
- bx_panic("disk: interrupt reason bit field error\n");
+ bio->panic("[HDD] interrupt reason bit field error\n");
BX_CONTROLLER(1).sector_count = 0;
BX_CONTROLLER(1).interrupt_reason.tag = 3;
if (BX_CONTROLLER(1).sector_count != 0x18)
- bx_panic("disk: interrupt reason bit field error\n");
+ bio->panic("[HDD] interrupt reason bit field error\n");
BX_CONTROLLER(1).sector_count = 0;
// allocate low level driver
@@ -142,36 +143,34 @@ bx_hard_drive_c::init(bx_devices_c *d, b
#ifdef LOWLEVEL_CDROM
if (bx_options.cdromd.inserted) {
if (BX_HD_THIS s[1].cdrom.cd->insert_cdrom()) {
- fprintf(stderr, "disk: Media present in CD-ROM drive\n");
+ bio->printf("[HDD] Media present in CD-ROM drive\n");
BX_HD_THIS s[1].cdrom.ready = 1;
BX_HD_THIS s[1].cdrom.capacity = BX_HD_THIS s[1].cdrom.cd->capacity();
} else {
- fprintf(stderr, "disk: Could not locate CD-ROM, continuing with media not present\n");
+ bio->printf("[HDD] Could not locate CD-ROM, continuing with media not present\n");
BX_HD_THIS s[1].cdrom.ready = 0;
}
} else {
#endif
- fprintf(stderr, "disk: Media not present in CD-ROM drive\n");
+ bio->printf("[HDD] Media not present in CD-ROM drive\n");
BX_HD_THIS s[1].cdrom.ready = 0;
#ifdef LOWLEVEL_CDROM
}
#endif
- } else {
- BX_HD_THIS s[1].device_type = IDE_DISK;
}
/* open hard drive image file */
if (bx_options.diskc.present) {
- bx_printf("Opening image for device 0\n");
+ bio->printf("[HDD] Opening image for device 0: '%s'\n",bx_options.diskc.path);
if ((BX_HD_THIS s[0].hard_drive->open(bx_options.diskc.path)) < 0) {
- bx_panic("could not open hard drive image file '%s'\n",
+ bio->panic("could not open hard drive image file '%s'\n",
bx_options.diskc.path);
}
}
if (bx_options.diskd.present && !bx_options.cdromd.present) {
- bx_printf("Opening image for device 1\n");
+ bio->printf("[HDD] Opening image for device 1: '%s'\n",bx_options.diskd.path);
if ((BX_HD_THIS s[1].hard_drive->open(bx_options.diskd.path)) < 0) {
- bx_panic("could not open hard drive image file '%s'\n",
+ bio->panic("could not open hard drive image file '%s'\n",
bx_options.diskd.path);
}
}
@@ -264,24 +263,24 @@ bx_hard_drive_c::read(Bit32u address, un
Bit32u value32;
if (io_len==2 && address!=0x1f0) {
- bx_panic("disk: non-byte IO read to %04x\n", (unsigned) address);
+ bio->panic("[HDD] non-byte IO read to %04x\n", (unsigned) address);
}
switch (address) {
case 0x1f0: // hard disk data (16bit)
if (BX_SELECTED_CONTROLLER.status.drq == 0) {
- bx_panic("disk: IO read(1f0h) with drq == 0: last command was %02xh\n",
+ bio->panic("[HDD] IO read(1f0h) with drq == 0: last command was %02xh\n",
(unsigned) BX_SELECTED_CONTROLLER.current_command);
}
switch (BX_SELECTED_CONTROLLER.current_command) {
case 0x20: // read sectors, with retries
case 0x21: // read sectors, without retries
if (io_len != 2) {
- bx_panic("disk: non-word IO read from %04x\n",
+ bio->panic("[HDD] non-word IO read from %04x\n",
(unsigned) address);
}
if (BX_SELECTED_CONTROLLER.buffer_index >= 512)
- bx_panic("disk: IO read(1f0): buffer_index >= 512\n");
+ bio->panic("[HDD] IO read(1f0): buffer_index >= 512\n");
value16 = BX_SELECTED_CONTROLLER.buffer[BX_SELECTED_CONTROLLER.buffer_index];
value16 |= (BX_SELECTED_CONTROLLER.buffer[BX_SELECTED_CONTROLLER.buffer_index+1] << 8);
BX_SELECTED_CONTROLLER.buffer_index += 2;
@@ -321,11 +320,11 @@ bx_hard_drive_c::read(Bit32u address, un
ret = BX_SELECTED_HD.hard_drive->lseek(logical_sector * 512, SEEK_SET);
if (ret < 0)
- bx_panic("disk: could lseek() hard drive image file\n");
+ bio->panic("[HDD] could lseek() hard drive image file\n");
ret = BX_SELECTED_HD.hard_drive->read((bx_ptr_t) BX_SELECTED_CONTROLLER.buffer, 512);
if (ret < 512) {
- bx_printf("logical sector was %u\n", (unsigned) logical_sector);
- bx_panic("disk: could not read() hard drive image file\n");
+ bio->printf("[HDD] logical sector was %u\n", (unsigned) logical_sector);
+ bio->panic("[HDD] could not read() hard drive image file\n");
}
BX_SELECTED_CONTROLLER.buffer_index = 0;
@@ -363,8 +362,8 @@ bx_hard_drive_c::read(Bit32u address, un
if (BX_SELECTED_CONTROLLER.buffer_index >= 512) {
BX_SELECTED_CONTROLLER.status.drq = 0;
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf ("disk: Read all drive ID Bytes ...\n");
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf ("[HDD] Read all drive ID Bytes ...\n");
}
if (io_len == 1) {
value8 = (Bit8u)value32;
@@ -377,7 +376,7 @@ bx_hard_drive_c::read(Bit32u address, un
}
}
else
- bx_panic("disk: IO read(1f0h): current command is %02xh\n",
+ bio->panic("[HDD] IO read(1f0h): current command is %02xh\n",
(unsigned) BX_SELECTED_CONTROLLER.current_command);
case 0xa0: {
@@ -386,7 +385,7 @@ bx_hard_drive_c::read(Bit32u address, un
// Load block if necessary
if (index >= 2048) {
if (index > 2048)
- bx_panic("disk: index > 2048\n");
+ bio->panic("[HDD] index > 2048\n");
switch (BX_SELECTED_HD.atapi.command) {
case 0x28: // read (10)
case 0xa8: // read (12)
@@ -396,11 +395,11 @@ bx_hard_drive_c::read(Bit32u address, un
BX_SELECTED_HD.cdrom.next_lba++;
BX_SELECTED_HD.cdrom.remaining_blocks--;
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
if (!BX_SELECTED_HD.cdrom.remaining_blocks)
- bx_printf("disk: Last READ block loaded {CDROM}\n");
+ bio->printf("[HDD] Last READ block loaded {CDROM}\n");
else
- bx_printf("disk: READ block loaded (%d remaining) {CDROM}\n",
+ bio->printf("[HDD] READ block loaded (%d remaining) {CDROM}\n",
BX_SELECTED_HD.cdrom.remaining_blocks);
// one block transfered
@@ -408,7 +407,7 @@ bx_hard_drive_c::read(Bit32u address, un
BX_SELECTED_HD.atapi.total_bytes_remaining -= 2048;
index = 0;
#else
- bx_panic("Read with no LOWLEVEL_CDROM\n");
+ bio->panic("Read with no LOWLEVEL_CDROM\n");
#endif
break;
@@ -437,8 +436,8 @@ bx_hard_drive_c::read(Bit32u address, un
if (BX_SELECTED_HD.atapi.total_bytes_remaining > 0) {
// one or more blocks remaining (works only for single block commands)
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: PACKET drq bytes read\n");
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] PACKET drq bytes read\n");
BX_SELECTED_CONTROLLER.interrupt_reason.i_o = 1;
BX_SELECTED_CONTROLLER.status.busy = 0;
BX_SELECTED_CONTROLLER.status.drq = 1;
@@ -453,8 +452,8 @@ bx_hard_drive_c::read(Bit32u address, un
raise_interrupt();
} else {
// all bytes read
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: PACKET all bytes read\n");
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] PACKET all bytes read\n");
BX_SELECTED_CONTROLLER.interrupt_reason.i_o = 1;
BX_SELECTED_CONTROLLER.interrupt_reason.c_d = 1;
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
@@ -479,7 +478,7 @@ bx_hard_drive_c::read(Bit32u address, un
}
default:
- bx_panic("disk: IO read(1f0h): current command is %02xh\n",
+ bio->panic("[HDD] IO read(1f0h): current command is %02xh\n",
(unsigned) BX_SELECTED_CONTROLLER.current_command);
}
break;
@@ -498,7 +497,10 @@ bx_hard_drive_c::read(Bit32u address, un
value8 = BX_SELECTED_CONTROLLER.sector_count;
goto return_value8;
}
- bx_panic("disk: IO read(0x1f2): current command not read/write\n");
+ bio->printf("[HDD] IO read(0x1f2): current command(0x%x) not read/write\n",
+ BX_SELECTED_CONTROLLER.current_command);
+ value8 = BX_SELECTED_CONTROLLER.sector_count;
+ goto return_value8;
break;
case 0x1f3: // sector number
@@ -556,28 +558,28 @@ bx_hard_drive_c::read(Bit32u address, un
break;
default:
- bx_panic("hard drive: io read to address %x unsupported\n",
+ bio->panic("[HDD] io read to address %x unsupported\n",
(unsigned) address);
}
- bx_panic("hard drive: shouldnt get here!\n");
+ bio->panic("[HDD] shouldnt get here!\n");
return(0);
return_value32:
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: 32-bit read from %04x = %08x {%s}\n",
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] 32-bit read from %04x = %08x {%s}\n",
(unsigned) address, value32, DEVICE_TYPE_STRING);
return value32;
return_value16:
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: 16-bit read from %04x = %04x {%s}\n",
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] 16-bit read from %04x = %04x {%s}\n",
(unsigned) address, value16, DEVICE_TYPE_STRING);
return value16;
return_value8:
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: 8-bit read from %04x = %02x {%s}\n",
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] 8-bit read from %04x = %02x {%s}\n",
(unsigned) address, value8, DEVICE_TYPE_STRING);
return value8;
}
@@ -606,45 +608,45 @@ bx_hard_drive_c::write(Bit32u address, B
Boolean prev_control_reset;
if (io_len==2 && address!=0x1f0) {
- bx_panic("disk: non-byte IO write to %04x\n", (unsigned) address);
+ bio->panic("[HDD] non-byte IO write to %04x\n", (unsigned) address);
}
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom)) {
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom)) {
switch (io_len) {
case 1:
- bx_printf("disk: 8-bit write to %04x = %02x {%s}\n",
+ bio->printf("[HDD] 8-bit write to %04x = %02x {%s}\n",
(unsigned) address, (unsigned) value, DEVICE_TYPE_STRING);
break;
case 2:
- bx_printf("disk: 16-bit write to %04x = %04x {%s}\n",
+ bio->printf("[HDD] 16-bit write to %04x = %04x {%s}\n",
(unsigned) address, (unsigned) value, DEVICE_TYPE_STRING);
break;
case 4:
- bx_printf("disk: 32-bit write to %04x = %08x {%s}\n",
+ bio->printf("[HDD] 32-bit write to %04x = %08x {%s}\n",
(unsigned) address, (unsigned) value, DEVICE_TYPE_STRING);
break;
default:
- bx_printf("disk: unknown-size write to %04x = %08x {%s}\n",
+ bio->printf("[HDD] unknown-size write to %04x = %08x {%s}\n",
(unsigned) address, (unsigned) value, DEVICE_TYPE_STRING);
break;
}
}
-//bx_printf("disk: IO write to %04x = %02x\n",
+//bio->printf("[HDD] IO write to %04x = %02x\n",
// (unsigned) address, (unsigned) value);
switch (address) {
case 0x1f0:
if (io_len != 2) {
- bx_panic("disk: non-word IO read from %04x\n", (unsigned) address);
+ bio->panic("[HDD] non-word IO read from %04x\n", (unsigned) address);
}
switch (BX_SELECTED_CONTROLLER.current_command) {
case 0x30:
if (BX_SELECTED_CONTROLLER.buffer_index >= 512)
- bx_panic("disk: IO write(1f0): buffer_index >= 512\n");
+ bio->panic("[HDD] IO write(1f0): buffer_index >= 512\n");
BX_SELECTED_CONTROLLER.buffer[BX_SELECTED_CONTROLLER.buffer_index] = value;
BX_SELECTED_CONTROLLER.buffer[BX_SELECTED_CONTROLLER.buffer_index+1] = (value >> 8);
BX_SELECTED_CONTROLLER.buffer_index += 2;
@@ -658,11 +660,11 @@ bx_hard_drive_c::write(Bit32u address, B
ret = BX_SELECTED_HD.hard_drive->lseek(logical_sector * 512, SEEK_SET);
if (ret < 0)
- bx_panic("disk: could lseek() hard drive image file\n");
+ bio->panic("[HDD] could lseek() hard drive image file\n");
ret = BX_SELECTED_HD.hard_drive->write((bx_ptr_t) BX_SELECTED_CONTROLLER.buffer, 512);
if (ret < 512)
- bx_panic("disk: could not write() hard drive image file\n");
+ bio->panic("[HDD] could not write() hard drive image file\n");
BX_SELECTED_CONTROLLER.buffer_index = 0;
@@ -699,7 +701,7 @@ bx_hard_drive_c::write(Bit32u address, B
case 0xa0: // PACKET
if (BX_SELECTED_CONTROLLER.buffer_index >= PACKET_SIZE)
- bx_panic("disk: IO write(1f0): buffer_index >= PACKET_SIZE\n");
+ bio->panic("[HDD] IO write(1f0): buffer_index >= PACKET_SIZE\n");
BX_SELECTED_CONTROLLER.buffer[BX_SELECTED_CONTROLLER.buffer_index] = value;
BX_SELECTED_CONTROLLER.buffer[BX_SELECTED_CONTROLLER.buffer_index+1] = (value >> 8);
BX_SELECTED_CONTROLLER.buffer_index += 2;
@@ -710,8 +712,8 @@ bx_hard_drive_c::write(Bit32u address, B
Bit8u atapi_command = BX_SELECTED_CONTROLLER.buffer[0];
int alloc_length;
- if (bx_dbg.cdrom)
- bx_printf("cdrom: ATAPI command 0x%x started\n", atapi_command);
+ if (bio->getdbg().cdrom)
+ bio->printf("[CDD] ATAPI command 0x%x started\n", atapi_command);
switch (atapi_command) {
case 0x00: // test unit ready
@@ -757,11 +759,11 @@ bx_hard_drive_c::write(Bit32u address, B
Boolean Start = (BX_SELECTED_CONTROLLER.buffer[4] >> 0) & 1;
if (!LoEj && !Start) { // stop the disc
- bx_panic("disk: Stop disc not implemented\n");
+ bio->panic("[HDD] Stop disc not implemented\n");
} else if (!LoEj && Start) { // start the disc and read the TOC
- bx_panic("disk: Start disc not implemented\n");
+ bio->panic("[HDD] Start disc not implemented\n");
} else if (LoEj && !Start) { // Eject the disc
- bx_panic("disk: Eject the disc not implemented\n");
+ bio->panic("[HDD] Eject the disc not implemented\n");
} else { // Load the disc
// My guess is that this command only closes the tray, that's a no-op for us
atapi_cmd_nop();
@@ -774,7 +776,7 @@ bx_hard_drive_c::write(Bit32u address, B
uint16 alloc_length = read_16bit(BX_SELECTED_CONTROLLER.buffer + 8);
if (alloc_length == 0)
- bx_panic("disk: Zero allocation length to MECHANISM STATUS not impl.\n");
+ bio->panic("[HDD] Zero allocation length to MECHANISM STATUS not impl.\n");
init_send_atapi_command(atapi_command, 8, alloc_length);
@@ -844,13 +846,13 @@ bx_hard_drive_c::write(Bit32u address, B
case 0x0d: // CD-ROM
case 0x0e: // CD-ROM audio control
case 0x3f: // all
- bx_panic("cdrom: MODE SENSE (curr), code=%x\n",
+ bio->panic("[CDD] MODE SENSE (curr), code=%x\n",
PageCode);
break;
default:
// not implemeted by this device
- bx_printf("cdrom: MODE SENSE PC=%x, PageCode=%x,"
+ bio->printf("[CDD] MODE SENSE PC=%x, PageCode=%x,"
" not implemented by device\n",
PC, PageCode);
atapi_cmd_error(SENSE_ILLEGAL_REQUEST,
@@ -867,13 +869,13 @@ bx_hard_drive_c::write(Bit32u address, B
case 0x0e: // CD-ROM audio control
case 0x2a: // CD-ROM capabilities & mech. status
case 0x3f: // all
- bx_panic("cdrom: MODE SENSE (chg), code=%x\n",
+ bio->panic("[CDD] MODE SENSE (chg), code=%x\n",
PageCode);
break;
default:
// not implemeted by this device
- bx_printf("cdrom: MODE SENSE PC=%x, PageCode=%x,"
+ bio->printf("[CDD] MODE SENSE PC=%x, PageCode=%x,"
" not implemented by device\n",
PC, PageCode);
atapi_cmd_error(SENSE_ILLEGAL_REQUEST,
@@ -890,13 +892,13 @@ bx_hard_drive_c::write(Bit32u address, B
case 0x0e: // CD-ROM audio control
case 0x2a: // CD-ROM capabilities & mech. status
case 0x3f: // all
- bx_panic("cdrom: MODE SENSE (dflt), code=%x\n",
+ bio->panic("[CDD] MODE SENSE (dflt), code=%x\n",
PageCode);
break;
default:
// not implemeted by this device
- bx_printf("cdrom: MODE SENSE PC=%x, PageCode=%x,"
+ bio->printf("[CDD] MODE SENSE PC=%x, PageCode=%x,"
" not implemented by device\n",
PC, PageCode);
atapi_cmd_error(SENSE_ILLEGAL_REQUEST,
@@ -912,7 +914,7 @@ bx_hard_drive_c::write(Bit32u address, B
break;
default:
- bx_panic("disk: Should not get here!\n");
+ bio->panic("[HDD] Should not get here!\n");
break;
}
}
@@ -958,7 +960,7 @@ bx_hard_drive_c::write(Bit32u address, B
if (BX_SELECTED_HD.cdrom.ready) {
uint32 capacity = BX_SELECTED_HD.cdrom.capacity;
- bx_printf("disk: Capacity is %d sectors (%d bytes)\n", capacity, capacity * 2048);
+ bio->printf("[HDD] Capacity is %d sectors (%d bytes)\n", capacity, capacity * 2048);
BX_SELECTED_CONTROLLER.buffer[0] = (capacity >> 24) & 0xff;
BX_SELECTED_CONTROLLER.buffer[1] = (capacity >> 16) & 0xff;
BX_SELECTED_CONTROLLER.buffer[2] = (capacity >> 8) & 0xff;
@@ -977,7 +979,7 @@ bx_hard_drive_c::write(Bit32u address, B
case 0xbe: { // read cd
if (BX_SELECTED_HD.cdrom.ready) {
- bx_panic("Read CD with CD present not implemented\n");
+ bio->panic("Read CD with CD present not implemented\n");
} else {
atapi_cmd_error(SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);
raise_interrupt();
@@ -1009,7 +1011,7 @@ bx_hard_drive_c::write(Bit32u address, B
ready_to_send_atapi();
}
#else
- bx_panic("LOWLEVEL_CDROM not defined\n");
+ bio->panic("LOWLEVEL_CDROM not defined\n");
#endif
break;
@@ -1029,7 +1031,7 @@ bx_hard_drive_c::write(Bit32u address, B
case 2:
default:
- bx_panic("disk: (READ TOC) Format %d not supported\n", format);
+ bio->panic("[HDD] (READ TOC) Format %d not supported\n", format);
break;
}
} else {
@@ -1052,7 +1054,7 @@ bx_hard_drive_c::write(Bit32u address, B
if (transfer_length == 0) {
atapi_cmd_nop();
raise_interrupt();
- bx_printf("disk: READ(10) with transfer length 0, ok\n");
+ bio->printf("[HDD] READ(10) with transfer length 0, ok\n");
break;
}
@@ -1062,7 +1064,7 @@ bx_hard_drive_c::write(Bit32u address, B
break;
}
- //bx_printf("cdrom: READ LBA=%d LEN=%d\n", lba, transfer_length);
+ //bio->printf("[CDD] READ LBA=%d LEN=%d\n", lba, transfer_length);
// handle command
init_send_atapi_command(atapi_command, transfer_length * 2048,
@@ -1086,7 +1088,7 @@ bx_hard_drive_c::write(Bit32u address, B
raise_interrupt();
break;
}
- bx_printf("cdrom: SEEK (ignored)\n");
+ bio->printf("[CDD] SEEK (ignored)\n");
atapi_cmd_nop();
raise_interrupt();
}
@@ -1125,7 +1127,7 @@ bx_hard_drive_c::write(Bit32u address, B
int ret_len = 4; // header size
if (sub_q) { // !sub_q == header only
- bx_panic("Read sub-channel with SubQ not implemented\n");
+ bio->panic("Read sub-channel with SubQ not implemented\n");
}
init_send_atapi_command(atapi_command, ret_len, alloc_length);
@@ -1147,7 +1149,7 @@ bx_hard_drive_c::write(Bit32u address, B
case 0xbb: // set cd speed
case 0x4e: // stop play/scan
default:
- bx_panic("Unknown ATAPI command 0x%x (%d)\n",
+ bio->panic("Unknown ATAPI command 0x%x (%d)\n",
atapi_command, atapi_command);
break;
}
@@ -1156,43 +1158,43 @@ bx_hard_drive_c::write(Bit32u address, B
break;
default:
- bx_panic("disk: IO write(1f0h): current command is %02xh\n",
+ bio->panic("[HDD] IO write(1f0h): current command is %02xh\n",
(unsigned) BX_SELECTED_CONTROLLER.current_command);
}
break;
case 0x1f1: /* hard disk write precompensation */
WRITE_FEATURES(value);
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom)) {
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom)) {
if (value == 0xff)
- bx_printf("disk: no precompensation {%s}\n", DEVICE_TYPE_STRING);
+ bio->printf("[HDD] no precompensation {%s}\n", DEVICE_TYPE_STRING);
else
- bx_printf("disk: precompensation value %02x {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
+ bio->printf("[HDD] precompensation value %02x {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
}
break;
case 0x1f2: /* hard disk sector count */
WRITE_SECTOR_COUNT(value);
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: sector count = %u {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] sector count = %u {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
break;
case 0x1f3: /* hard disk sector number */
WRITE_SECTOR_NUMBER(value);
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: sector number = %u {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] sector number = %u {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
break;
case 0x1f4: /* hard disk cylinder low */
WRITE_CYLINDER_LOW(value);
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: cylinder low = %02xh {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] cylinder low = %02xh {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
break;
case 0x1f5: /* hard disk cylinder high */
WRITE_CYLINDER_HIGH(value);
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: cylinder high = %02xh {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] cylinder high = %02xh {%s}\n", (unsigned) value, DEVICE_TYPE_STRING);
break;
case 0x1f6: // hard disk drive and head register
@@ -1202,11 +1204,11 @@ bx_hard_drive_c::write(Bit32u address, B
// b4: DRV
// b3..0 HD3..HD0
if ( (value & 0xe0) != 0xa0 ) // 101xxxxx
- bx_printf("disk: IO write 1f6 (%02x): not 101xxxxxb\n", (unsigned) value);
+ bio->printf("[HDD] IO write 1f6 (%02x): not 101xxxxxb\n", (unsigned) value);
BX_HD_THIS drive_select = (value >> 4) & 0x01;
WRITE_HEAD_NO(value & 0xf);
if (BX_SELECTED_CONTROLLER.lba_mode == 0 && ((value >> 6) & 1) == 1)
- bx_printf("disk: enabling LBA mode\n");
+ bio->printf("[HDD] enabling LBA mode\n");
WRITE_LBA_MODE((value >> 6) & 1);
break;
@@ -1217,14 +1219,14 @@ bx_hard_drive_c::write(Bit32u address, B
break;
if (BX_SELECTED_CONTROLLER.status.busy)
- bx_panic("hard disk: command sent, controller BUSY\n");
+ bio->panic("hard disk: command sent, controller BUSY\n");
if ( (value & 0xf0) == 0x10 )
value = 0x10;
switch (value) {
case 0x10: // calibrate drive
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: calibrate drive issued to non-disk\n");
+ bio->panic("[HDD] calibrate drive issued to non-disk\n");
if (BX_HD_THIS drive_select != 0 && !bx_options.diskd.present) {
BX_SELECTED_CONTROLLER.error_register = 0x02; // Track 0 not found
BX_SELECTED_CONTROLLER.status.busy = 0;
@@ -1233,7 +1235,7 @@ bx_hard_drive_c::write(Bit32u address, B
BX_SELECTED_CONTROLLER.status.drq = 0;
BX_SELECTED_CONTROLLER.status.err = 1;
raise_interrupt();
- bx_printf("disk: calibrate drive != 0, with diskd not present\n");
+ bio->printf("[HDD] calibrate drive != 0, with diskd not present\n");
break;
}
@@ -1259,7 +1261,7 @@ bx_hard_drive_c::write(Bit32u address, B
*/
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: read multiple issued to non-disk\n");
+ bio->panic("[HDD] read multiple issued to non-disk\n");
BX_SELECTED_CONTROLLER.current_command = value;
@@ -1268,7 +1270,7 @@ bx_hard_drive_c::write(Bit32u address, B
!BX_SELECTED_CONTROLLER.head_no &&
!BX_SELECTED_CONTROLLER.cylinder_no &&
!BX_SELECTED_CONTROLLER.sector_no) {
- bx_printf("disk: Read from 0/0/0, aborting command\n");
+ bio->printf("[HDD] Read from 0/0/0, aborting command\n");
command_aborted(value);
break;
}
@@ -1278,13 +1280,13 @@ bx_hard_drive_c::write(Bit32u address, B
ret = BX_SELECTED_HD.hard_drive->lseek(logical_sector * 512, SEEK_SET);
if (ret < 0) {
- bx_panic("disk: could not lseek() hard drive image file\n");
+ bio->panic("[HDD] could not lseek() hard drive image file\n");
}
ret = BX_SELECTED_HD.hard_drive->read((bx_ptr_t) BX_SELECTED_CONTROLLER.buffer, 512);
if (ret < 512) {
- bx_printf("logical sector was %u\n", (unsigned) logical_sector);
- bx_panic("disk: could not read() hard drive image file\n");
+ bio->printf("[HDD] logical sector was %u\n", (unsigned) logical_sector);
+ bio->panic("[HDD] could not read() hard drive image file\n");
}
BX_SELECTED_CONTROLLER.error_register = 0;
@@ -1308,10 +1310,10 @@ bx_hard_drive_c::write(Bit32u address, B
*/
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: write multiple issued to non-disk\n");
+ bio->panic("[HDD] write multiple issued to non-disk\n");
if (BX_SELECTED_CONTROLLER.status.busy) {
- bx_panic("disk: write command: BSY bit set\n");
+ bio->panic("[HDD] write command: BSY bit set\n");
}
BX_SELECTED_CONTROLLER.current_command = value;
@@ -1327,10 +1329,10 @@ bx_hard_drive_c::write(Bit32u address, B
case 0x90: // Drive Diagnostic
if (BX_SELECTED_CONTROLLER.status.busy) {
- bx_panic("disk: diagnostic command: BSY bit set\n");
+ bio->panic("[HDD] diagnostic command: BSY bit set\n");
}
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: drive diagnostics issued to non-disk\n");
+ bio->panic("[HDD] drive diagnostics issued to non-disk\n");
BX_SELECTED_CONTROLLER.error_register = 0x81; // Drive 1 failed, no error on drive 0
// BX_SELECTED_CONTROLLER.status.busy = 0; // not needed
BX_SELECTED_CONTROLLER.status.drq = 0;
@@ -1339,20 +1341,20 @@ bx_hard_drive_c::write(Bit32u address, B
case 0x91: // initialize drive parameters
if (BX_SELECTED_CONTROLLER.status.busy) {
- bx_panic("disk: init drive parameters command: BSY bit set\n");
+ bio->panic("[HDD] init drive parameters command: BSY bit set\n");
}
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: initialize drive parameters issued to non-disk\n");
+ bio->panic("[HDD] initialize drive parameters issued to non-disk\n");
// sets logical geometry of specified drive
- bx_printf("initialize drive params\n");
- bx_printf(" sector count = %u\n",
+ bio->printf("[HDD] initialize drive params\n");
+ bio->printf("[HDD] sector count = %u\n",
(unsigned) BX_SELECTED_CONTROLLER.sector_count);
- bx_printf(" drive select = %u\n",
+ bio->printf("[HDD] drive select = %u\n",
(unsigned) BX_HD_THIS drive_select);
- bx_printf(" head number = %u\n",
+ bio->printf("[HDD] head number = %u\n",
(unsigned) BX_SELECTED_CONTROLLER.head_no);
if (BX_HD_THIS drive_select != 0 && !bx_options.diskd.present) {
- bx_panic("disk: init drive params: drive != 0\n");
+ bio->panic("[HDD] init drive params: drive != 0\n");
//BX_SELECTED_CONTROLLER.error_register = 0x12;
BX_SELECTED_CONTROLLER.status.busy = 0;
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
@@ -1362,9 +1364,9 @@ bx_hard_drive_c::write(Bit32u address, B
break;
}
if (BX_SELECTED_CONTROLLER.sector_count != BX_SELECTED_HD.hard_drive->sectors)
- bx_panic("disk: init drive params: sector count doesnt match\n");
+ bio->printf("[HDD] init drive params: sector count doesnt match\n");
if ( BX_SELECTED_CONTROLLER.head_no != (BX_SELECTED_HD.hard_drive->heads-1) )
- bx_panic("disk: init drive params: head number doesn't match\n");
+ bio->printf("[HDD] init drive params: head number doesn't match\n");
BX_SELECTED_CONTROLLER.status.busy = 0;
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
BX_SELECTED_CONTROLLER.status.drq = 0;
@@ -1374,11 +1376,11 @@ bx_hard_drive_c::write(Bit32u address, B
case 0xec: // Get Drive Info
if (bx_options.newHardDriveSupport) {
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf ("disk: Drive ID Command issued : 0xec \n");
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf ("[HDD] Drive ID Command issued : 0xec \n");
if (BX_HD_THIS drive_select && !bx_options.diskd.present) {
- bx_printf("disk: 2nd drive not present, aborting\n");
+ bio->printf("[HDD] 2nd drive not present, aborting\n");
command_aborted(value);
break;
}
@@ -1408,7 +1410,7 @@ bx_hard_drive_c::write(Bit32u address, B
}
}
else {
- bx_printf("disk: old hard drive\n");
+ bio->printf("[HDD] old hard drive\n");
command_aborted(value);
}
break;
@@ -1416,8 +1418,8 @@ bx_hard_drive_c::write(Bit32u address, B
case 0x40: //
if (bx_options.newHardDriveSupport) {
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: read verify issued to non-disk\n");
- bx_printf ("disk: Verify Command : 0x40 ! \n");
+ bio->panic("[HDD] read verify issued to non-disk\n");
+ bio->printf ("[HDD] Verify Command : 0x40 ! \n");
BX_SELECTED_CONTROLLER.status.busy = 0;
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
BX_SELECTED_CONTROLLER.status.drq = 0;
@@ -1425,11 +1427,14 @@ bx_hard_drive_c::write(Bit32u address, B
raise_interrupt();
}
else {
- bx_printf("disk: old hard drive\n");
+ bio->printf("[HDD] old hard drive\n");
command_aborted(value);
}
break;
-
+ case 0xef:
+ bio->printf("[HDD] 0xef received, returning\n"); /* XXX */
+ command_aborted(value);
+ break;
case 0xc6: // (mch) set multiple mode
if (BX_SELECTED_CONTROLLER.sector_count != 128 &&
BX_SELECTED_CONTROLLER.sector_count != 64 &&
@@ -1441,7 +1446,7 @@ bx_hard_drive_c::write(Bit32u address, B
command_aborted(value);
if (BX_SELECTED_HD.device_type != IDE_DISK)
- bx_panic("disk: set multiple mode issued to non-disk\n");
+ bio->panic("[HDD] set multiple mode issued to non-disk\n");
BX_SELECTED_CONTROLLER.sectors_per_block = BX_SELECTED_CONTROLLER.sector_count;
BX_SELECTED_CONTROLLER.status.busy = 0;
@@ -1498,9 +1503,9 @@ bx_hard_drive_c::write(Bit32u address, B
if (BX_SELECTED_HD.device_type == IDE_CDROM) {
// PACKET
if (BX_SELECTED_CONTROLLER.features & (1 << 0))
- bx_panic("disk: PACKET-DMA not supported\n");
+ bio->panic("[HDD] PACKET-DMA not supported\n");
if (BX_SELECTED_CONTROLLER.features & (1 << 1))
- bx_panic("disk: PACKET-overlapped not supported\n");
+ bio->panic("[HDD] PACKET-overlapped not supported\n");
// We're already ready!
BX_SELECTED_CONTROLLER.sector_count = 1;
@@ -1518,11 +1523,11 @@ bx_hard_drive_c::write(Bit32u address, B
}
case 0xa2: // ATAPI service (optional)
if (BX_SELECTED_HD.device_type == IDE_CDROM) {
- bx_panic("disk: ATAPI SERVICE not implemented\n");
+ bio->panic("[HDD] ATAPI SERVICE not implemented\n");
}
// non-standard commands
case 0xf0: // Exabyte enable nest command
- bx_printf("disk: Not implemented command\n");
+ bio->printf("[HDD] Not implemented command\n");
command_aborted(value);
break;
@@ -1538,7 +1543,7 @@ bx_hard_drive_c::write(Bit32u address, B
break;
default:
- bx_panic("IO write(1f7h): command 0x%02x\n", (unsigned) value);
+ bio->panic("disk IO write(1f7h): command 0x%02x\n", (unsigned) value);
}
break;
@@ -1550,13 +1555,13 @@ bx_hard_drive_c::write(Bit32u address, B
BX_HD_THIS s[0].controller.control.reset = value & 0x04;
BX_HD_THIS s[1].controller.control.reset = value & 0x04;
BX_SELECTED_CONTROLLER.control.disable_irq = value & 0x02;
- //fprintf(stderr, "# hard drive: adpater control reg: reset controller = %d\n",
+ //bio->printf("#HDD] adpater control reg: reset controller = %d\n",
// (unsigned) (BX_SELECTED_CONTROLLER.control.reset) ? 1 : 0);
- //fprintf(stderr, "# hard drive: adpater control reg: disable_irq(14) = %d\n",
+ //bio->printf("#HDD] adpater control reg: disable_irq(14) = %d\n",
// (unsigned) (BX_SELECTED_CONTROLLER.control.disable_irq) ? 1 : 0);
if (!prev_control_reset && BX_SELECTED_CONTROLLER.control.reset) {
// transition from 0 to 1 causes all drives to reset
- bx_printf("hard drive: RESET\n");
+ bio->printf("[HDD] RESET\n");
// (mch) Set BSY, drive not ready
for (int id = 0; id < 2; id++) {
@@ -1583,7 +1588,7 @@ bx_hard_drive_c::write(Bit32u address, B
} else if (BX_SELECTED_CONTROLLER.reset_in_progress &&
!BX_SELECTED_CONTROLLER.control.reset) {
// Clear BSY and DRDY
- bx_printf("disk: Reset complete {%s}\n", DEVICE_TYPE_STRING);
+ bio->printf("[HDD] Reset complete {%s}\n", DEVICE_TYPE_STRING);
for (int id = 0; id < 2; id++) {
BX_CONTROLLER(id).status.busy = 0;
BX_CONTROLLER(id).status.drive_ready = 1;
@@ -1606,7 +1611,7 @@ bx_hard_drive_c::write(Bit32u address, B
break;
default:
- bx_panic("hard drive: io write to address %x = %02x\n",
+ bio->panic("[HDD] io write to address %x = %02x\n",
(unsigned) address, (unsigned) value);
}
}
@@ -1619,7 +1624,7 @@ bx_hard_drive_c::close_harddrive(void)
}
-#define assert(i) do { if (!((i))) bx_panic("assertion on line %d", __LINE__); } while (0)
+#define assert(i) do { if (!((i))) bio->panic("assertion on line %d", __LINE__); } while (0)
Bit32u
bx_hard_drive_c::calculate_logical_address()
@@ -1637,8 +1642,21 @@ bx_hard_drive_c::calculate_logical_addre
(BX_SELECTED_CONTROLLER.sector_no - 1);
if (logical_sector >=
- (BX_SELECTED_HD.hard_drive->cylinders * BX_SELECTED_HD.hard_drive->heads * BX_SELECTED_HD.hard_drive->sectors)) {
- bx_panic("disk: read sectors: out of bounds\n");
+ (BX_SELECTED_HD.hard_drive->cylinders *
+ BX_SELECTED_HD.hard_drive->heads *
+ BX_SELECTED_HD.hard_drive->sectors))
+ {
+ bio->printf("[HDD] read sectors: out of bounds (c,h,s) -> (%d,%d,%d) = %d, (%d log)\n",
+ BX_SELECTED_HD.hard_drive->cylinders,
+ BX_SELECTED_HD.hard_drive->heads,
+ BX_SELECTED_HD.hard_drive->sectors,
+ BX_SELECTED_HD.hard_drive->cylinders *
+ BX_SELECTED_HD.hard_drive->heads *
+ BX_SELECTED_HD.hard_drive->sectors,
+ logical_sector);
+ return BX_SELECTED_HD.hard_drive->cylinders *
+ BX_SELECTED_HD.hard_drive->heads *
+ BX_SELECTED_HD.hard_drive->sectors - 1;
}
return logical_sector;
}
@@ -1675,7 +1693,7 @@ bx_hard_drive_c::identify_ATAPI_drive(un
unsigned i;
if (drive != (unsigned)BX_HD_THIS drive_select) {
- bx_panic("disk: identify_drive panic (drive != drive_select)\n");
+ bio->panic("[HDD] identify_drive panic (drive != drive_select)\n");
}
BX_SELECTED_HD.id_drive[0] = (2 << 14) | (5 << 8) | (1 << 7) | (2 << 5) | (0 << 0); // Removable CDROM, 50us response, 12 byte packets
@@ -1779,7 +1797,7 @@ bx_hard_drive_c::identify_drive(unsigned
Bit16u temp16;
if (drive != BX_HD_THIS drive_select) {
- bx_panic("disk: identify_drive panic (drive != drive_select)\n");
+ bio->panic("[HDD] identify_drive panic (drive != drive_select)\n");
}
#if defined(CONNER_CFA540A)
@@ -2108,8 +2126,8 @@ bx_hard_drive_c::identify_drive(unsigned
#endif
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf ("disk: Drive ID Info. initialized : %04d {%s}\n", 512, DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf ("[HDD] Drive ID Info. initialized : %04d {%s}\n", 512, DEVICE_TYPE_STRING);
// now convert the id_drive array (native 256 word format) to
// the controller buffer (512 bytes)
@@ -2124,13 +2142,13 @@ bx_hard_drive_c::identify_drive(unsigned
bx_hard_drive_c::init_send_atapi_command(Bit8u command, int req_length, int alloc_length, bool lazy)
{
if (BX_SELECTED_CONTROLLER.byte_count == 0)
- bx_panic("disk: ATAPI command with zero byte count\n");
+ bio->panic("[HDD] ATAPI command with zero byte count\n");
if (BX_SELECTED_CONTROLLER.byte_count & 1)
- bx_panic("disk: Odd byte count to ATAPI command\n");
+ bio->panic("[HDD] Odd byte count to ATAPI command\n");
if (alloc_length <= 0)
- bx_panic("disk: Allocation length <= 0\n");
+ bio->panic("[HDD] Allocation length <= 0\n");
BX_SELECTED_CONTROLLER.interrupt_reason.i_o = 1;
BX_SELECTED_CONTROLLER.interrupt_reason.c_d = 0;
@@ -2218,19 +2236,19 @@ void
bx_hard_drive_c::raise_interrupt()
{
if (!BX_SELECTED_CONTROLLER.control.disable_irq) {
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: Raising interrupt {%s}\n", DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] Raising interrupt {%s}\n", DEVICE_TYPE_STRING);
BX_HD_THIS devices->pic->trigger_irq(14);
} else {
- if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
- bx_printf("disk: Interrupt masked {%s}\n", DEVICE_TYPE_STRING);
+ if (bio->getdbg().disk || (CDROM_SELECTED && bio->getdbg().cdrom))
+ bio->printf("[HDD] Interrupt masked {%s}\n", DEVICE_TYPE_STRING);
}
}
void
bx_hard_drive_c::command_aborted(unsigned value)
{
- bx_printf("disk: aborting on command 0x%02x {%s}\n", value, DEVICE_TYPE_STRING);
+ bio->printf("[HDD] aborting on command 0x%02x {%s}\n", value, DEVICE_TYPE_STRING);
BX_SELECTED_CONTROLLER.current_command = 0;
BX_SELECTED_CONTROLLER.status.busy = 0;
BX_SELECTED_CONTROLLER.status.drive_ready = 1;
@@ -2263,7 +2281,7 @@ int default_image_t::open (const char* p
int ret = fstat(fd, &stat_buf);
if (ret) {
perror("fstat'ing hard drive image file");
- bx_panic("fstat() returns error!\n");
+ bio->panic("fstat() returns error!\n");
}
return fd;
@@ -2294,7 +2312,7 @@ ssize_t default_image_t::write (const vo
error_recovery_t::error_recovery_t ()
{
if (sizeof(error_recovery_t) != 8) {
- bx_panic("error_recovery_t has size != 8\n");
+ bio->panic("error_recovery_t has size != 8\n");
}
data[0] = 0x01;

View File

@ -0,0 +1,919 @@
$OpenBSD: patch-iodev_keyboard_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/keyboard.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/keyboard.cc Tue Oct 31 12:27:44 2000
@@ -131,7 +131,7 @@ bx_keyb_c::init(bx_devices_c *d, bx_cmos
BX_KEY_THIS s.kbd_controller.irq1_requested = 0;
BX_KEY_THIS s.kbd_controller.irq12_requested = 0;
-//fprintf(stderr, "# keyboard_serial_delay is %u usec\n",
+//bio->printf("#KBD] keyboard_serial_delay is %u usec\n",
// (unsigned) bx_options.keyboard_serial_delay);
BX_KEY_THIS s.kbd_controller.timer_pending = 0;
@@ -175,12 +175,14 @@ bx_keyb_c::read(Bit32u address, unsign
Bit32u ret = 0;
- if (io_len > 1)
- bx_panic("kbd: io read to address %08x, len=%u\n",
+ if (io_len > 1) {
+ bio->printf("[KBD] io read to address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
+ return ret;
+ }
-//fprintf(stderr, "# KBD: read from port 0x%04x\n", (unsigned) address);
+//bio->printf("#KBD] read from port 0x%04x\n", (unsigned) address);
if (address == 0x60) { /* output buffer */
Bit8u val;
@@ -204,11 +206,11 @@ bx_keyb_c::read(Bit32u address, unsign
BX_KEY_THIS s.controller_Qsize--;
}
-//bx_printf("mouse: ___io_read aux = 0x%02x\n", (unsigned) val);
+//bio->printf("[MOUSE] ___io_read aux = 0x%02x\n", (unsigned) val);
activate_timer();
- if (bx_dbg.keyboard)
- bx_printf("KBD: READ(%02x) = %02x\n", (unsigned) address,
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] READ(%02x) = %02x\n", (unsigned) address,
(unsigned) val);
RETURN(val);
}
@@ -217,7 +219,7 @@ bx_keyb_c::read(Bit32u address, unsign
BX_KEY_THIS s.kbd_controller.kbd_output_buffer = 0;
BX_KEY_THIS s.kbd_controller.outb = 0;
BX_KEY_THIS s.kbd_controller.auxb = 0;
-//fprintf(stderr, "# ___io_read kbd\n");
+//bio->printf("#MOUSE] ___io_read kbd\n");
if (BX_KEY_THIS s.controller_Qsize) {
unsigned i;
@@ -234,15 +236,15 @@ bx_keyb_c::read(Bit32u address, unsign
}
activate_timer();
- if (bx_dbg.keyboard)
- bx_printf("KBD: READ(%02x) = %02x\n", (unsigned) address,
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] READ(%02x) = %02x\n", (unsigned) address,
(unsigned) val);
RETURN(val);
}
else {
- if (bx_dbg.keyboard) {
- bx_printf("KBD: num_elements = %d\n", BX_KEY_THIS s.kbd_internal_buffer.num_elements);
- bx_printf("KBD: read from port 60h with outb empty\n");
+ if (bio->getdbg().keyboard) {
+ bio->printf("[KBD] num_elements = %d\n", BX_KEY_THIS s.kbd_internal_buffer.num_elements);
+ bio->printf("[KBD] read from port 60h with outb empty\n");
}
val = 0;
RETURN(val);
@@ -267,21 +269,21 @@ bx_keyb_c::read(Bit32u address, unsign
#else /* BX_CPU_LEVEL > 0 */
/* XT MODE, System 8255 Mode Register */
else if (address == 0x64) { /* status register */
- if (bx_dbg.keyboard)
- bx_printf("KBD: IO read from port 64h, system 8255 mode register\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] IO read from port 64h, system 8255 mode register\n");
RETURN(BX_KEY_THIS s.kbd_controller.outb);
}
#endif /* BX_CPU_LEVEL > 0 */
else {
- bx_panic("KBD: unknown address in io read to keyboard port %x\n",
+ bio->printf("[KBD] unknown address in io read to keyboard port %x\n",
(unsigned) address);
RETURN(0); /* keep compiler happy */
}
read_return:
- if (bx_dbg.keyboard)
- bx_printf("keyboard: 8-bit read from %04x = %02x\n", (unsigned)address, ret);
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] 8-bit read from %04x = %02x\n", (unsigned)address, ret);
return ret;
}
@@ -306,15 +308,17 @@ bx_keyb_c::write( Bit32u address, Bit3
#endif // !BX_USE_KEY_SMF
Bit8u command_byte;
- if (io_len > 1)
- bx_panic("kbd: io write to address %08x, len=%u\n",
+ if (io_len > 1) {
+ bio->printf("[KBD] io write to address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
+ return;
+ }
- if (bx_dbg.keyboard)
- bx_printf("keyboard: 8-bit write to %04x = %02x\n", (unsigned)address, (unsigned)value);
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] 8-bit write to %04x = %02x\n", (unsigned)address, (unsigned)value);
-//fprintf(stderr, "# KBD: WRITE(%02x) = %02x\n", (unsigned) address,
+//bio->printf("[KBD] WRITE(%02x) = %02x\n", (unsigned) address,
// (unsigned) value);
switch (address) {
@@ -325,7 +329,8 @@ bx_keyb_c::write( Bit32u address, Bit3
// data byte written last to 0x60
BX_KEY_THIS s.kbd_controller.c_d = 0;
if (BX_KEY_THIS s.kbd_controller.inpb) {
- bx_panic("KBD: write to port 60h, not ready for write\n");
+ bio->printf("[KBD] write to port 60h, not ready for write\n");
+ break;
}
switch (BX_KEY_THIS s.kbd_controller.last_comm) {
case 0x60: // write command byte
@@ -346,21 +351,22 @@ bx_keyb_c::write( Bit32u address, Bit3
else if (BX_KEY_THIS s.kbd_controller.allow_irq1 && BX_KEY_THIS s.kbd_controller.outb)
BX_KEY_THIS s.kbd_controller.irq1_requested = 1;
-//fprintf(stderr, "# allow_irq12 set to %u\n", (unsigned)
+//bio->printf("#KBD] allow_irq12 set to %u\n", (unsigned)
// BX_KEY_THIS s.kbd_controller.allow_irq12);
if ( !scan_convert )
- bx_printf("keyboard: (mch) scan convert turned off\n");
+ bio->printf("[KBD] (mch) scan convert turned off\n");
// (mch) NT needs this
BX_KEY_THIS s.kbd_controller.scan_convert = scan_convert;
}
break;
case 0xd1: // write output port
- if (bx_dbg.keyboard)
- bx_printf("KBD: write output port with value %02xh\n",
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] write output port with value %02xh\n",
(unsigned) value);
BX_SET_ENABLE_A20( (value & 0x02) != 0 );
- if (!(value & 0x01)) bx_panic("KBD: IO write: processor reset requested!\n");
+ if (!(value & 0x01)) /* XXX insert reset?? */
+ bio->printf("[KBD] IO write: processor reset requested!\n");
break;
case 0xd4: // Write to mouse
// I don't think this enables the AUX clock
@@ -375,7 +381,7 @@ bx_keyb_c::write( Bit32u address, Bit3
break;
default:
- bx_panic("KBD: === unsupported write to port 60h(lastcomm=%02x): %02x\n",
+ bio->printf("[KBD] === unsupported write to port 60h(lastcomm=%02x): %02x\n",
(unsigned) BX_KEY_THIS s.kbd_controller.last_comm, (unsigned) value);
}
}
@@ -386,7 +392,7 @@ bx_keyb_c::write( Bit32u address, Bit3
/* pass byte to keyboard */
/* ??? should conditionally pass to mouse device here ??? */
if (BX_KEY_THIS s.kbd_controller.kbd_clock_enabled==0) {
- bx_printf("KBD: keyboard disabled & send of byte %02x to kbd\n",
+ bio->printf("[KBD] keyboard disabled & send of byte %02x to kbd\n",
(unsigned) value);
}
kbd_ctrl_to_kbd(value);
@@ -402,11 +408,11 @@ bx_keyb_c::write( Bit32u address, Bit3
switch (value) {
case 0x20: // get keyboard command byte
- if (bx_dbg.keyboard)
- bx_printf("KBD: get keyboard command byte\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] get keyboard command byte\n");
// controller output buffer must be empty
if (BX_KEY_THIS s.kbd_controller.outb) {
-bx_panic("kbd: OUTB set and command 0x%02x encountered\n", value);
+bio->printf("[KBD] OUTB set and command 0x%02x encountered\n", value);
break;
}
command_byte =
@@ -420,37 +426,37 @@ bx_panic("kbd: OUTB set and command 0x%0
controller_enQ(command_byte, 0);
break;
case 0x60: // write command byte
- if (bx_dbg.keyboard)
- bx_printf("KBD: write command byte\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] write command byte\n");
// following byte written to port 60h is command byte
BX_KEY_THIS s.kbd_controller.expecting_port60h = 1;
break;
case 0xa1:
- bx_printf ("KBD: Dummy out Green PC for now : 0xa1\n");
+ bio->printf ("[KBD] Dummy out Green PC for now : 0xa1\n");
break;
case 0xa7: // disable the aux device
set_aux_clock_enable(0);
- if (bx_dbg.keyboard) bx_printf("KBD: aux device disabled\n");
+ if (bio->getdbg().keyboard) bio->printf("[KBD] aux device disabled\n");
break;
case 0xa8: // enable the aux device
set_aux_clock_enable(1);
- if (bx_dbg.keyboard) bx_printf("KBD: aux device enabled\n");
+ if (bio->getdbg().keyboard) bio->printf("[KBD] aux device enabled\n");
break;
case 0xa9: // Test Mouse Port
// controller output buffer must be empty
if (BX_KEY_THIS s.kbd_controller.outb) {
-bx_panic("kbd: OUTB set and command 0x%02x encountered\n", value);
+bio->printf("[KBD] OUTB set and command 0x%02x encountered\n", value);
break;
}
controller_enQ(0x00, 0); // no errors detected
break;
case 0xaa: // motherboard controller self test
- if (bx_dbg.keyboard) bx_printf("KBD: Self Test\n");
+ if (bio->getdbg().keyboard) bio->printf("[KBD] Self Test\n");
// controller output buffer must be empty
if (BX_KEY_THIS s.kbd_controller.outb) {
-bx_panic("kbd: OUTB set and command 0x%02x encountered\n", value);
+bio->printf("[KBD] OUTB set and command 0x%02x encountered\n", value);
break;
}
// (mch) Why is this commented out??? Enabling
@@ -460,34 +466,34 @@ bx_panic("kbd: OUTB set and command 0x%0
case 0xab: // Interface Test
// controller output buffer must be empty
if (BX_KEY_THIS s.kbd_controller.outb) {
-bx_panic("kbd: OUTB set and command 0x%02x encountered\n", value);
+bio->printf("[KBD] OUTB set and command 0x%02x encountered\n", value);
break;
}
controller_enQ(0x00, 0);
break;
case 0xad: // disable keyboard
set_kbd_clock_enable(0);
- if (bx_dbg.keyboard) bx_printf("KBD: keyboard disabled\n");
+ if (bio->getdbg().keyboard) bio->printf("[KBD] keyboard disabled\n");
break;
case 0xae: // enable keyboard
set_kbd_clock_enable(1);
- if (bx_dbg.keyboard) bx_printf("KBD: keyboard enabled\n");
+ if (bio->getdbg().keyboard) bio->printf("[KBD] keyboard enabled\n");
break;
case 0xc0: // read input port
// controller output buffer must be empty
if (BX_KEY_THIS s.kbd_controller.outb) {
-bx_panic("kbd: OUTB set and command 0x%02x encountered\n", value);
+bio->printf("[KBD] OUTB set and command 0x%02x encountered\n", value);
break;
}
// keyboard power normal
controller_enQ(0x00, 0);
break;
case 0xd0: // read output port: next byte read from port 60h
- if (bx_dbg.keyboard)
- bx_printf("KBD: io write to port 64h, command d0h (partial)\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] io write to port 64h, command d0h (partial)\n");
// controller output buffer must be empty
if (BX_KEY_THIS s.kbd_controller.outb) {
-bx_panic("kbd: OUTB set and command 0x%02x encountered\n", value);
+bio->printf("[KBD] OUTB set and command 0x%02x encountered\n", value);
break;
}
controller_enQ(
@@ -498,20 +504,20 @@ bx_panic("kbd: OUTB set and command 0x%0
break;
case 0xd1: // write output port: next byte written to port 60h
- if (bx_dbg.keyboard)
- bx_printf("KBD: write output port\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] write output port\n");
// following byte to port 60h written to output port
BX_KEY_THIS s.kbd_controller.expecting_port60h = 1;
break;
case 0xd3: // write mouse output buffer
- bx_panic("KBD: io write 0x64: command = 0xD3(write mouse outb)\n");
+ bio->printf("[KBD] io write 0x64: command = 0xD3(write mouse outb)\n");
BX_KEY_THIS s.kbd_controller.expecting_port60h = 1;
break;
case 0xd4: // write to mouse
- if (bx_dbg.mouse)
- bx_printf("KBD: io write 0x64: command = 0xD4 (write to mouse)\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[KBD] io write 0x64: command = 0xD4 (write to mouse)\n");
// following byte written to port 60h
BX_KEY_THIS s.kbd_controller.expecting_port60h = 1;
break;
@@ -522,32 +528,34 @@ bx_panic("kbd: OUTB set and command 0x%0
case 0xc1: // Continuous Input Port Poll, Low
case 0xc2: // Continuous Input Port Poll, High
case 0xe0: // Read Test Inputs
- bx_panic("KBD: io write 0x64: command = %02xh\n", (unsigned) value);
+ bio->printf("[KBD] io write 0x64: command = %02xh\n", (unsigned) value);
break;
case 0xfe: // System Reset, transition to real mode
- if (bx_dbg.keyboard)
- bx_printf("KBD: system reset\n");
- bx_panic("system reset via KBD ctrl command FEh\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] system reset via ctrl command FEh\n");
+ bx_pc_system.ResetSignal( PCS_SET ); /* XXX is this right? */
+ BX_CPU.reset(BX_RESET_HARDWARE);
// Use bx_pc_system if necessary bx_cpu.reset_cpu();
- bx_pc_system.ResetSignal( PCS_SET );
+ // bx_pc_system.ResetSignal( PCS_SET );
break;
default:
if (value==0xff || (value>=0xf0 && value<=0xfd)) {
/* useless pulse output bit commands ??? */
- if (bx_dbg.keyboard)
- bx_printf("KBD: io write to port 64h, useless command %02x\n",
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] io write to port 64h, useless command %02x\n",
(unsigned) value);
return;
}
- bx_panic("KBD: unsupported io write to keyboard port %x, value = %x\n",
+ bio->printf("[KBD] unsupported io write to keyboard port %x, value = %x\n",
(unsigned) address, (unsigned) value);
break;
}
break;
- default: bx_panic("KBD: unknown address in bx_keyb_c::write()\n");
+ default:
+ bio->printf("[KBD] unknown address in bx_keyb_c::write()\n");
}
}
@@ -557,15 +565,17 @@ bx_keyb_c::gen_scancode(Bit32u key)
{
Bit8u scancode;
- if (bx_dbg.record_io) {
- fprintf((FILE*)bx_dbg.record_io, "gen_scancode %lld %x\n", bx_pc_system.time_ticks(), key);
+ if (bio->getdbg().record_io) {
+ fprintf((FILE*)bio->getdbg().record_io, "gen_scancode %lld %x\n", bx_pc_system.time_ticks(), key);
}
- if (!BX_KEY_THIS s.kbd_controller.scan_convert)
- bx_panic("keyboard: gen_scancode with scan_convert cleared\n");
+ if (!BX_KEY_THIS s.kbd_controller.scan_convert) {
+ bio->printf("[KBD] gen_scancode with scan_convert cleared\n");
+ return;
+ }
- if (bx_dbg.keyboard)
- bx_printf("KBD: gen_scancode(): scancode: %08x\n", (unsigned) key);
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] gen_scancode(): scancode: %08x\n", (unsigned) key);
// Ignore scancode if keyboard clock is driven low
if (BX_KEY_THIS s.kbd_controller.kbd_clock_enabled==0)
@@ -640,20 +650,21 @@ bx_keyb_c::gen_scancode(Bit32u key)
case BX_KEY_GRAVE: scancode = 0x29; break;
case BX_KEY_BACKSPACE: scancode = 0x0e; break;
+ case BX_KEY_KP_ENTER:
case BX_KEY_ENTER: scancode = 0x1c; break;
case BX_KEY_TAB: scancode = 0x0f; break;
case BX_KEY_LEFT:
- //fprintf(stderr,"# Grey left-arrow key not on 83-key keyboard\n");
+ //bio->printf("#KBD] Grey left-arrow key not on 83-key keyboard\n");
scancode = 0x4b; break;
case BX_KEY_RIGHT:
- //fprintf(stderr,"# Grey right-arrow key not on 83-key keyboard\n");
+ //bio->printf("#KBD] Grey right-arrow key not on 83-key keyboard\n");
scancode = 0x4d; break;
case BX_KEY_UP:
- //fprintf(stderr,"# Grey up-arrow key not on 83-key keyboard\n");
+ //bio->printf("#KBD] Grey up-arrow key not on 83-key keyboard\n");
scancode = 0x48; break;
case BX_KEY_DOWN:
- //fprintf(stderr,"# Grey down-arrow key not on 83-key keyboard\n");
+ //bio->printf("#KBD] Grey down-arrow key not on 83-key keyboard\n");
scancode = 0x50; break;
case BX_KEY_KP_LEFT: scancode = 0x4b; break;
@@ -661,43 +672,46 @@ bx_keyb_c::gen_scancode(Bit32u key)
case BX_KEY_KP_UP: scancode = 0x48; break;
case BX_KEY_KP_DOWN: scancode = 0x50; break;
- case BX_KEY_INSERT:
- fprintf(stderr,"# Grey insert key not on 83-key keyboard\n");
- return;
- case BX_KEY_DELETE:
- fprintf(stderr,"# Grey delete key not on 83-key keyboard\n");
- return;
- case BX_KEY_HOME:
- fprintf(stderr,"# Grey home key not on 83-key keyboard\n");
- return;
- case BX_KEY_END:
- fprintf(stderr,"# Grey end key not on 83-key keyboard\n");
- return;
- case BX_KEY_PAGE_UP:
- fprintf(stderr,"# Grey page-up key not on 83-key keyboard\n");
- return;
- case BX_KEY_PAGE_DOWN:
- fprintf(stderr,"# Grey page-down key not on 83-key keyboard\n");
- return;
+ //case BX_KEY_INSERT:
+ //bio->printf("#KBD] Grey insert key not on 83-key keyboard\n");
+ //return;
+ //case BX_KEY_DELETE:
+ //bio->printf("#KBD] Grey delete key not on 83-key keyboard\n");
+ //return;
+ //case BX_KEY_HOME:
+ //bio->printf("#KBD] Grey home key not on 83-key keyboard\n");
+ //return;
+ //case BX_KEY_END:
+ //bio->printf("#KBD] Grey end key not on 83-key keyboard\n");
+ //return;
+ //case BX_KEY_PAGE_UP:
+ //bio->printf("#KBD] Grey page-up key not on 83-key keyboard\n");
+ //return;
+ //case BX_KEY_PAGE_DOWN:
+ //bio->printf("#KBD] Grey page-down key not on 83-key keyboard\n");
+ //return;
+ case BX_KEY_INSERT:
case BX_KEY_KP_INSERT: scancode = 0x52; break;
+ case BX_KEY_DELETE:
case BX_KEY_KP_DELETE: scancode = 0x53; break;
+ case BX_KEY_HOME:
case BX_KEY_KP_HOME: scancode = 0x47; break;
+ case BX_KEY_END:
case BX_KEY_KP_END: scancode = 0x4f; break;
+ case BX_KEY_PAGE_UP:
case BX_KEY_KP_PAGE_UP: scancode = 0x49; break;
+ case BX_KEY_PAGE_DOWN:
case BX_KEY_KP_PAGE_DOWN: scancode = 0x51; break;
case BX_KEY_KP_ADD: scancode = 0x4e; break;
case BX_KEY_KP_SUBTRACT: scancode = 0x4a; break;
case BX_KEY_KP_5: scancode = 0x4c; break;
- case BX_KEY_KP_ENTER:
- fprintf(stderr,"# Grey Enter key not on 83-key keyboard\n");
- return;
case BX_KEY_KP_MULTIPLY:
- fprintf(stderr,"# Grey Multiply key not on 83-key keyboard\n");
+ bio->printf("#KBD] Grey Multiply key not on 83-key keyboard\n");
return;
case BX_KEY_KP_DIVIDE:
- fprintf(stderr,"# Grey Divide key not on 83-key keyboard\n");
+ bio->printf("#KBD] Grey Divide key not on 83-key keyboard\n");
return;
case BX_KEY_NUM_LOCK: scancode = 0x45; break;
@@ -713,7 +727,7 @@ bx_keyb_c::gen_scancode(Bit32u key)
case BX_KEY_F10: scancode = 0x44; break;
default:
- fprintf(stderr, "# bx_keyb_c::gen_scancode : Unhandled %u\n",
+ bio->printf("#KBD] bx_keyb_c::gen_scancode : Unhandled %u\n",
(unsigned) key);
return;
}
@@ -750,8 +764,8 @@ bx_keyb_c::set_aux_clock_enable(Bit8u
{
Boolean prev_aux_clock_enabled;
- if (bx_dbg.keyboard)
- bx_printf("set_aux_clock_enable(%u)\n", (unsigned) value);
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] set_aux_clock_enable(%u)\n", (unsigned) value);
if (value==0) {
BX_KEY_THIS s.kbd_controller.aux_clock_enabled = 0;
}
@@ -768,8 +782,8 @@ bx_keyb_c::set_aux_clock_enable(Bit8u
bx_keyb_c::get_kbd_enable(void)
{
#ifdef BX_DEBUG
- if (bx_dbg.keyboard)
- bx_printf("KBD: get_kbd_enable(): getting kbd_clock_enabled of: %02x\n",
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] get_kbd_enable(): getting kbd_clock_enabled of: %02x\n",
(unsigned) BX_KEY_THIS s.kbd_controller.kbd_clock_enabled);
#endif
@@ -781,16 +795,16 @@ bx_keyb_c::controller_enQ(Bit8u data,
{
// source is 0 for keyboard, 1 for mouse
- if (bx_dbg.keyboard)
- bx_printf("controller_enQ(%02x)\n", (unsigned) data);
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] controller_enQ(%02x)\n", (unsigned) data);
if (BX_KEY_THIS s.kbd_controller.outb)
- bx_printf("KBD: controller_enQ(): OUTB set!\n");
+ bio->printf("[KBD] controller_enQ(): OUTB set!\n");
// see if we need to Q this byte from the controller
if (BX_KEY_THIS s.kbd_controller.outb) {
if (BX_KEY_THIS s.controller_Qsize >= BX_KBD_CONTROLLER_QSIZE)
- bx_panic("KBD: controller_enq(): controller_Q full!\n");
+ bio->printf("[KBD] controller_enq(): controller_Q full!\n");
BX_KEY_THIS s.controller_Q[BX_KEY_THIS s.controller_Qsize++] = data;
BX_KEY_THIS s.controller_Qsource = source;
return;
@@ -820,7 +834,7 @@ bx_keyb_c::kbd_enQ_imm(Bit8u val)
int tail;
if (BX_KEY_THIS s.kbd_internal_buffer.num_elements >= BX_KBD_ELEMENTS) {
- bx_panic("KBD: internal keyboard buffer full (imm)\n");
+ bio->printf("[KBD] internal keyboard buffer full (imm)\n");
return;
}
@@ -841,18 +855,18 @@ bx_keyb_c::kbd_enQ(Bit8u scancode)
{
int tail;
- if (bx_dbg.keyboard)
- bx_printf("enQ(%02x)\n", (unsigned) scancode);
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] enQ(%02x)\n", (unsigned) scancode);
if (BX_KEY_THIS s.kbd_internal_buffer.num_elements >= BX_KBD_ELEMENTS) {
- bx_printf("KBD: internal keyboard buffer full, ignoring scancode.(%02x)\n",
+ bio->printf("[KBD] internal keyboard buffer full, ignoring scancode.(%02x)\n",
(unsigned) scancode);
return;
}
/* enqueue scancode in multibyte internal keyboard buffer */
- if (bx_dbg.keyboard)
- bx_printf("KBD: enQ: putting scancode %02x in internal buffer\n",
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] enQ: putting scancode %02x in internal buffer\n",
(unsigned) scancode);
tail = (BX_KEY_THIS s.kbd_internal_buffer.head + BX_KEY_THIS s.kbd_internal_buffer.num_elements) %
BX_KBD_ELEMENTS;
@@ -861,14 +875,14 @@ bx_keyb_c::kbd_enQ(Bit8u scancode)
if (!BX_KEY_THIS s.kbd_controller.outb && BX_KEY_THIS s.kbd_controller.kbd_clock_enabled) {
activate_timer();
-//fprintf(stderr, "# activating timer...\n");
+//bio->printf("#KBD] activating timer...\n");
return;
}
-//fprintf(stderr, "# not activating timer...\n");
-//fprintf(stderr, "# allow_irq1 = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.allow_irq1);
-//fprintf(stderr, "# outb = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.outb);
-//fprintf(stderr, "# clock_enab = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.kbd_clock_enabled);
-//fprintf(stderr, "# out_buffer = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.kbd_output_buffer);
+//bio->printf("#KBD] not activating timer...\n");
+//bio->printf("#KBD] allow_irq1 = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.allow_irq1);
+//bio->printf("#KBD] outb = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.outb);
+//bio->printf("#KBD] clock_enab = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.kbd_clock_enabled);
+//bio->printf("#KBD] out_buffer = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.kbd_output_buffer);
}
Boolean
@@ -878,7 +892,7 @@ bx_keyb_c::mouse_enQ_packet(Bit8u b1,
return(0); /* buffer doesn't have the space */
}
-//bx_printf("mouse: enQ_packet(%02x, %02x, %02x)\n",
+//bio->printf("[MOUSE] enQ_packet(%02x, %02x, %02x)\n",
// (unsigned) b1, (unsigned) b2, (unsigned) b3);
mouse_enQ(b1);
@@ -893,15 +907,15 @@ bx_keyb_c::mouse_enQ(Bit8u mouse_data)
{
int tail;
- if (bx_dbg.mouse)
- bx_printf("mouse_enQ(%02x)\n", (unsigned) mouse_data);
+ if (bio->getdbg().mouse)
+ bio->printf("[MOUSE] mouse_enQ(%02x)\n", (unsigned) mouse_data);
if (BX_KEY_THIS s.mouse_internal_buffer.num_elements >= BX_MOUSE_BUFF_SIZE) {
- bx_printf("mouse: internal mouse buffer full, ignoring mouse data.(%02x)\n",
+ bio->printf("[MOUSE] internal mouse buffer full, ignoring mouse data.(%02x)\n",
(unsigned) mouse_data);
return;
}
-//fprintf(stderr, "# mouse_enq() aux_clock_enabled = %u\n",
+//bio->printf("#MOUSE] mouse_enq() aux_clock_enabled = %u\n",
// (unsigned) BX_KEY_THIS s.kbd_controller.aux_clock_enabled);
/* enqueue mouse data in multibyte internal mouse buffer */
@@ -912,33 +926,33 @@ bx_keyb_c::mouse_enQ(Bit8u mouse_data)
if (!BX_KEY_THIS s.kbd_controller.outb && BX_KEY_THIS s.kbd_controller.aux_clock_enabled) {
activate_timer();
-//fprintf(stderr, "# activating timer...\n");
+//bio->printf("#MOUSE] activating timer...\n");
return;
}
-//fprintf(stderr, "# not activating timer...\n");
-//fprintf(stderr, "# allow_irq12= %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.allow_irq12);
-//fprintf(stderr, "# outb = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.outb);
-//fprintf(stderr, "# clock_enab = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.aux_clock_enabled);
-//fprintf(stderr, "# out_buffer = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.aux_output_buffer);
+//bio->printf("#MOUSE] not activating timer...\n");
+//bio->printf("#MOUSE] allow_irq12= %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.allow_irq12);
+//bio->printf("#MOUSE] outb = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.outb);
+//bio->printf("#MOUSE] clock_enab = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.aux_clock_enabled);
+//bio->printf("#MOUSE] out_buffer = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.aux_output_buffer);
}
void
bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
{
- if (bx_dbg.keyboard)
- bx_printf("KBD: controller passed byte %02xh to keyboard\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] controller passed byte %02xh to keyboard\n");
if (BX_KEY_THIS s.kbd_internal_buffer.expecting_typematic) {
BX_KEY_THIS s.kbd_internal_buffer.expecting_typematic = 0;
BX_KEY_THIS s.kbd_internal_buffer.delay = (value >> 5) & 0x03;
switch (BX_KEY_THIS s.kbd_internal_buffer.delay) {
- case 0: bx_printf("KBD: setting delay to 250 mS\n"); break;
- case 1: bx_printf("KBD: setting delay to 250 mS\n"); break;
- case 2: bx_printf("KBD: setting delay to 250 mS\n"); break;
- case 3: bx_printf("KBD: setting delay to 250 mS\n"); break;
+ case 0: bio->printf("[KBD] setting delay to 250 mS\n"); break;
+ case 1: bio->printf("[KBD] setting delay to 250 mS\n"); break;
+ case 2: bio->printf("[KBD] setting delay to 250 mS\n"); break;
+ case 3: bio->printf("[KBD] setting delay to 250 mS\n"); break;
}
BX_KEY_THIS s.kbd_internal_buffer.repeat_rate = value & 0x1f;
- bx_printf("KBD: setting repeat rate to %u\n", (unsigned) value);
+ bio->printf("[KBD] setting repeat rate to %u\n", (unsigned) value);
kbd_enQ(0xFA); // send ACK
return;
}
@@ -946,7 +960,7 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value
if (BX_KEY_THIS s.kbd_internal_buffer.expecting_led_write) {
BX_KEY_THIS s.kbd_internal_buffer.expecting_led_write = 0;
BX_KEY_THIS s.kbd_internal_buffer.led_status = value;
- bx_printf("KBD: LED status set to %02x\n",
+ bio->printf("[KBD] LED status set to %02x\n",
(unsigned) BX_KEY_THIS s.kbd_internal_buffer.led_status);
kbd_enQ(0xFA); // send ACK %%%
return;
@@ -977,14 +991,14 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value
break;
case 0xf2: // identify keyboard
- bx_printf("KBD: indentify keyboard command received\n");
+ bio->printf("[KBD] indentify keyboard command received\n");
kbd_enQ(0xFA); // AT sends ACK, MFII sends ACK+ABh+41h
return;
break;
case 0xf3: // typematic info
BX_KEY_THIS s.kbd_internal_buffer.expecting_typematic = 1;
- bx_printf("KBD: setting typematic info\n");
+ bio->printf("[KBD] setting typematic info\n");
kbd_enQ(0xFA); // send ACK
return;
break;
@@ -1000,7 +1014,7 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value
resetinternals(1);
kbd_enQ(0xFA); // send ACK
BX_KEY_THIS s.kbd_internal_buffer.scanning_enabled = 0;
- bx_printf ("KBD: reset-disable command received\n");
+ bio->printf ("[KBD] reset-disable command received\n");
return;
break;
@@ -1008,7 +1022,7 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value
resetinternals(1);
kbd_enQ(0xFA); // send ACK
BX_KEY_THIS s.kbd_internal_buffer.scanning_enabled = 1;
- bx_printf ("KBD: reset-enable command received\n");
+ bio->printf ("[KBD] reset-enable command received\n");
return;
break;
@@ -1026,12 +1040,12 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value
break;
case 0xfe: // resend. aiiee.
- bx_panic ("KBD: got 0xFE (resend)\n");
+ bio->printf("[KBD] got 0xFE (resend)\n");
return;
break;
case 0xff: // reset: internal keyboard reset and afterwards the BAT
- bx_printf("KBD: rest command received\n");
+ bio->printf("[KBD] rest command received\n");
kbd_enQ(0xFA); // send ACK
kbd_enQ(0xAA); // BAT test passed
return;
@@ -1042,7 +1056,7 @@ case 0xd3:
return;
default:
- bx_panic("KBD: kbd_ctrl_to_kbd(): got value of %02x\n",
+ bio->printf("[KBD] kbd_ctrl_to_kbd(): got value of %02x\n",
(unsigned) value);
kbd_enQ(0xFA); /* send ACK ??? */
return;
@@ -1085,14 +1099,14 @@ bx_keyb_c::periodic( Bit32u usec_delta
/* nothing in outb, look for possible data xfer from keyboard or mouse */
if (BX_KEY_THIS s.kbd_controller.kbd_clock_enabled && BX_KEY_THIS s.kbd_internal_buffer.num_elements) {
-//fprintf(stderr, "# servicing keyboard code\n");
- if (bx_dbg.keyboard)
- bx_printf("KBD: service_keyboard: key in internal buffer waiting\n");
+//bio->printf("#KBD] servicing keyboard code\n");
+ if (bio->getdbg().keyboard)
+ bio->printf("[KBD] service_keyboard: key in internal buffer waiting\n");
BX_KEY_THIS s.kbd_controller.kbd_output_buffer =
BX_KEY_THIS s.kbd_internal_buffer.buffer[BX_KEY_THIS s.kbd_internal_buffer.head];
BX_KEY_THIS s.kbd_controller.outb = 1;
BX_KEY_THIS s.kbd_controller.auxb = 0;
-//fprintf(stderr, "# ___kbd::periodic kbd\n");
+//bio->printf("#KBD] ___kbd::periodic kbd\n");
BX_KEY_THIS s.kbd_internal_buffer.head = (BX_KEY_THIS s.kbd_internal_buffer.head + 1) %
BX_KBD_ELEMENTS;
BX_KEY_THIS s.kbd_internal_buffer.num_elements--;
@@ -1100,26 +1114,26 @@ bx_keyb_c::periodic( Bit32u usec_delta
BX_KEY_THIS s.kbd_controller.irq1_requested = 1;
}
else if (BX_KEY_THIS s.kbd_controller.aux_clock_enabled && BX_KEY_THIS s.mouse_internal_buffer.num_elements) {
-//fprintf(stderr, "# servicing mouse code\n");
- if (bx_dbg.mouse)
- bx_printf("KBD: service_keyboard: key in internal buffer waiting\n");
+//bio->printf("#MOUSE] servicing mouse code\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[KBD] service_keyboard: key in internal buffer waiting\n");
BX_KEY_THIS s.kbd_controller.aux_output_buffer =
BX_KEY_THIS s.mouse_internal_buffer.buffer[BX_KEY_THIS s.mouse_internal_buffer.head];
BX_KEY_THIS s.kbd_controller.outb = 1;
BX_KEY_THIS s.kbd_controller.auxb = 1;
-//fprintf(stderr, "# ___kbd:periodic aux\n");
+//bio->printf("#KBD] ___kbd:periodic aux\n");
BX_KEY_THIS s.mouse_internal_buffer.head = (BX_KEY_THIS s.mouse_internal_buffer.head + 1) %
BX_MOUSE_BUFF_SIZE;
BX_KEY_THIS s.mouse_internal_buffer.num_elements--;
-//fprintf(stderr, "# allow12 = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.allow_irq12);
+//bio->printf("#KBD] allow12 = %u\n", (unsigned) BX_KEY_THIS s.kbd_controller.allow_irq12);
if (BX_KEY_THIS s.kbd_controller.allow_irq12)
BX_KEY_THIS s.kbd_controller.irq12_requested = 1;
}
else {
-//fprintf(stderr, "# servicing no code\n");
- if (bx_dbg.keyboard) {
- bx_printf("KBD: service_keyboard(): no keys waiting\n");
+//bio->printf("#KBD] servicing no code\n");
+ if (bio->getdbg().keyboard) {
+ bio->printf("[KBD] service_keyboard(): no keys waiting\n");
}
}
return(retval);
@@ -1141,13 +1155,13 @@ bx_keyb_c::activate_timer(void)
void
bx_keyb_c::kbd_ctrl_to_mouse(Bit8u value)
{
-bx_printf("MOUSE: kbd_ctrl_to_mouse(%02xh)\n", (unsigned) value);
-bx_printf(" enable = %u\n", (unsigned) BX_KEY_THIS s.mouse.enable);
-bx_printf(" allow_irq12 = %u\n",
+bio->printf("[MOUSE] kbd_ctrl_to_mouse(%02xh)\n", (unsigned) value);
+bio->printf("[MOUSE] enable = %u", (unsigned) BX_KEY_THIS s.mouse.enable);
+bio->printf("[MOUSE] allow_irq12 = %u\n",
(unsigned) BX_KEY_THIS s.kbd_controller.allow_irq12);
-bx_printf(" aux_clock_enabled = %u\n",
+bio->printf("[MOUSE] aux_clock_enabled = %u\n",
(unsigned) BX_KEY_THIS s.kbd_controller.aux_clock_enabled);
-//fprintf(stderr, "# MOUSE: kbd_ctrl_to_mouse(%02xh)\n", (unsigned) value);
+//bio->printf("#MOUSE] kbd_ctrl_to_mouse(%02xh)\n", (unsigned) value);
// an ACK (0xFA) is always the first response to any valid input
// received from the system other than Set-Wrap-Mode & Resend-Command
@@ -1158,8 +1172,8 @@ bx_printf(" aux_clock_enabled = %u\n",
switch (BX_KEY_THIS s.kbd_controller.last_mouse_command) {
case 0xf3: // Set Mouse Sample Rate
BX_KEY_THIS s.mouse.sample_rate = value;
- if (bx_dbg.mouse)
- bx_printf("[mouse] Sampling rate set: %d Hz\n", value);
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Sampling rate set: %d Hz\n", value);
controller_enQ(0xFA, 1); // ack
break;
@@ -1178,18 +1192,19 @@ bx_printf(" aux_clock_enabled = %u\n",
BX_KEY_THIS s.mouse.resolution_cpmm = 8;
break;
default:
- bx_panic("[mouse] Unknown resolution %d\n", value);
+ bio->printf("[mouse] Unknown resolution %d\n", value);
break;
}
- if (bx_dbg.mouse)
- bx_printf("[mouse] Resolution set to %d counts per mm\n",
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Resolution set to %d counts per mm\n",
BX_KEY_THIS s.mouse.resolution_cpmm);
controller_enQ(0xFA, 1); // ack
break;
default:
- bx_panic("MOUSE: unknown last command (%02xh)\n", (unsigned) BX_KEY_THIS s.kbd_controller.last_mouse_command);
+ bio->printf("[MOUSE] unknown last command (%02xh)\n", (unsigned) BX_KEY_THIS s.kbd_controller.last_mouse_command);
+ break;
}
} else {
BX_KEY_THIS s.kbd_controller.expecting_mouse_parameter = 0;
@@ -1198,15 +1213,15 @@ bx_printf(" aux_clock_enabled = %u\n",
case 0xe6: // Set Mouse Scaling to 1:1
controller_enQ(0xFA, 1); // ACK
BX_KEY_THIS s.mouse.scaling = 2;
- if (bx_dbg.mouse)
- bx_printf("[mouse] Scaling set to 1:1\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Scaling set to 1:1\n");
break;
case 0xe7: // Set Mouse Scaling to 2:1
controller_enQ(0xFA, 1); // ACK
BX_KEY_THIS s.mouse.scaling = 2;
- if (bx_dbg.mouse)
- bx_printf("[mouse] Scaling set to 2:1\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Scaling set to 2:1\n");
break;
case 0xe8: // Set Mouse Resolution
@@ -1217,8 +1232,8 @@ bx_printf(" aux_clock_enabled = %u\n",
case 0xf2: // Read Device Type
controller_enQ(0xFA, 1); // ACK
controller_enQ(0x00, 1); // Device ID
- if (bx_dbg.mouse)
- bx_printf("[mouse] Read mouse ID\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Read mouse ID\n");
break;
case 0xf3: // Set Mouse Sample Rate (sample rate written to port 60h)
@@ -1229,15 +1244,15 @@ bx_printf(" aux_clock_enabled = %u\n",
case 0xf4: // Enable (in stream mode)
BX_KEY_THIS s.mouse.enable = 1;
controller_enQ(0xFA, 1); // ACK
- if (bx_dbg.mouse)
- bx_printf("[mouse] Mouse enabled (stream mode)\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Mouse enabled (stream mode)\n");
break;
case 0xf5: // Disable (in stream mode)
BX_KEY_THIS s.mouse.enable = 0;
controller_enQ(0xFA, 1); // ACK
- if (bx_dbg.mouse)
- bx_printf("[mouse] Mouse disabled (stream mode)\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Mouse disabled (stream mode)\n");
break;
case 0xff: // Reset
@@ -1250,8 +1265,8 @@ bx_printf(" aux_clock_enabled = %u\n",
controller_enQ(0xFA, 1); // ACK
controller_enQ(0xAA, 1); // completion code
controller_enQ(0x00, 1); // ID code (normal mouse, wheelmouse has id 0x3)
- if (bx_dbg.mouse)
- bx_printf("[mouse] Mouse reset\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Mouse reset\n");
break;
case 0xe9: // Get mouse information
@@ -1260,12 +1275,12 @@ bx_printf(" aux_clock_enabled = %u\n",
controller_enQ(BX_KEY_THIS s.mouse.get_status_byte(), 1); // status
controller_enQ(BX_KEY_THIS s.mouse.get_resolution_byte(), 1); // resolution
controller_enQ(BX_KEY_THIS s.mouse.sample_rate, 1); // sample rate
- if (bx_dbg.mouse)
- bx_printf("[mouse] Get mouse information\n");
+ if (bio->getdbg().mouse)
+ bio->printf("[mouse] Get mouse information\n");
break;
default:
- bx_panic("MOUSE: kbd_ctrl_to_mouse(%02xh)\n", (unsigned) value);
+ bio->printf("[MOUSE] kbd_ctrl_to_mouse(%02xh)\n", (unsigned) value);
}
}
}
@@ -1289,7 +1304,7 @@ bx_keyb_c::mouse_motion(int delta_x, int
if ( (delta_y < -1) || (delta_y > 1) )
delta_y /= 2;
- //fprintf(stderr, "# MOUSE: Dx=%d Dy=%d\n",
+ //bio->printf("#MOUSE] Dx=%d Dy=%d\n",
// delta_x, delta_y);
b1 = (button_state & 0x0f) | 0x08; // bit3 always set

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-iodev_keyboard_h,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/keyboard.h.orig Sat Mar 25 21:36:56 2000
+++ iodev/keyboard.h Tue Oct 17 12:04:06 2000
@@ -132,7 +132,7 @@ private:
break;
default:
- bx_panic("[mouse] invalid resolution_cpmm");
+ bio->panic("[mouse] invalid resolution_cpmm");
};
return ret;
}

View File

@ -0,0 +1,394 @@
$OpenBSD: patch-iodev_ne2k_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/ne2k.cc.orig Sat Mar 25 21:33:09 2000
+++ iodev/ne2k.cc Fri Oct 20 15:29:11 2000
@@ -108,7 +108,7 @@ bx_ne2k_c::write_cr(Bit32u value)
{
// Validate remote-DMA
if ((value & 0x38) == 0x00)
- bx_panic("ne2k: CR write - invalide rDMA value 0");
+ bio->printf("ne2k: CR write - invalide rDMA value 0");
// Check for s/w reset
if (value & 0x01) {
@@ -132,10 +132,10 @@ bx_ne2k_c::write_cr(Bit32u value)
// Check for start-tx
if (value & 0x04) {
if (BX_NE2K_THIS s.CR.stop || !BX_NE2K_THIS s.CR.start)
- bx_panic("ne2k: CR write - tx start, dev in reset");
+ bio->panic("ne2k: CR write - tx start, dev in reset");
if (BX_NE2K_THIS s.tx_bytes == 0)
- bx_panic("ne2k: CR write - tx start, tx bytes == 0");
+ bio->panic("ne2k: CR write - tx start, tx bytes == 0");
#ifdef notdef
// XXX debug stuff
@@ -156,7 +156,7 @@ bx_ne2k_c::write_cr(Bit32u value)
// some more debug
if (BX_NE2K_THIS s.tx_timer_active)
- bx_panic("ne2k: CR write, tx timer still active");
+ bio->panic("ne2k: CR write, tx timer still active");
// Schedule a timer to trigger a tx-complete interrupt
// The number of microseconds is the bit-time / 10.
@@ -196,7 +196,7 @@ bx_ne2k_c::chipmem_read(Bit32u address,
Bit32u retval = 0;
if ((io_len == 2) && (address & 0x1))
- bx_panic("ne2k: unaligned chipmem word read");
+ bio->panic("ne2k: unaligned chipmem word read");
// ROM'd MAC address
if ((address >=0) && (address <= 31)) {
@@ -215,7 +215,7 @@ bx_ne2k_c::chipmem_read(Bit32u address,
return (retval);
}
- bx_printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
+ bio->printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
return (0xff);
}
@@ -224,14 +224,14 @@ void
bx_ne2k_c::chipmem_write(Bit32u address, Bit32u value, unsigned io_len)
{
if ((io_len == 2) && (address & 0x1))
- bx_panic("ne2k: unaligned chipmem word write");
+ bio->panic("ne2k: unaligned chipmem word write");
if ((address >= BX_NE2K_MEMSTART) && (address <= BX_NE2K_MEMEND)) {
BX_NE2K_THIS s.mem[address - BX_NE2K_MEMSTART] = value & 0xff;
if (io_len == 2)
BX_NE2K_THIS s.mem[address - BX_NE2K_MEMSTART + 1] = value >> 8;
} else
- bx_printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
+ bio->printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
}
//
@@ -259,10 +259,10 @@ bx_ne2k_c::asic_read(Bit32u offset, unsi
// registers must have been initialised.
//
if (io_len != (1 + BX_NE2K_THIS s.DCR.wdsize))
- bx_panic("ne2k: dma read, wrong size %d", io_len);
+ bio->panic("ne2k: dma read, wrong size %d", io_len);
if (BX_NE2K_THIS s.remote_bytes == 0)
- bx_panic("ne2K: dma read, byte count 0");
+ bio->panic("ne2K: dma read, byte count 0");
retval = chipmem_read(BX_NE2K_THIS s.remote_dma, io_len);
BX_NE2K_THIS s.remote_dma += io_len;
@@ -274,7 +274,7 @@ bx_ne2k_c::asic_read(Bit32u offset, unsi
break;
default:
- bx_printf("ne2k: asic read invalid address %04x", (unsigned) offset);
+ bio->printf("ne2k: asic read invalid address %04x", (unsigned) offset);
break;
}
@@ -288,10 +288,10 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit
case 0x0: // Data register - see asic_read for a description
if (io_len != (1 + BX_NE2K_THIS s.DCR.wdsize))
- bx_panic("ne2k: dma write, wrong size %d", io_len);
+ bio->panic("ne2k: dma write, wrong size %d", io_len);
if (BX_NE2K_THIS s.remote_bytes == 0)
- bx_panic("ne2K: dma write, byte count 0");
+ bio->panic("ne2K: dma write, byte count 0");
chipmem_write(BX_NE2K_THIS s.remote_dma, value, io_len);
BX_NE2K_THIS s.remote_dma += io_len;
@@ -308,7 +308,7 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit
break;
default:
- bx_panic("ne2k: asic write invalid address %04x", (unsigned) offset);
+ bio->panic("ne2k: asic write invalid address %04x", (unsigned) offset);
break ;
}
}
@@ -321,7 +321,7 @@ Bit32u
bx_ne2k_c::page0_read(Bit32u offset, unsigned int io_len)
{
if (io_len > 1)
- bx_panic("ne2k: page 0 read from port %04x, len=%u\n", (unsigned) offset,
+ bio->panic("ne2k: page 0 read from port %04x, len=%u\n", (unsigned) offset,
(unsigned) io_len);
switch (offset) {
@@ -379,12 +379,12 @@ bx_ne2k_c::page0_read(Bit32u offset, uns
break;
case 0xa: // reserved
- bx_printf("ne2k: reserved read - page 0, 0xa\n");
+ bio->printf("ne2k: reserved read - page 0, 0xa\n");
return (0xff);
break;
case 0xb: // reserved
- bx_printf("ne2k: reserved read - page 0, 0xb\n");
+ bio->printf("ne2k: reserved read - page 0, 0xb\n");
return (0xff);
break;
@@ -412,7 +412,7 @@ bx_ne2k_c::page0_read(Bit32u offset, uns
break;
default:
- bx_panic("ne2k: page 0 offset %04x out of range", (unsigned) offset);
+ bio->panic("ne2k: page 0 offset %04x out of range", (unsigned) offset);
}
return(0);
@@ -422,7 +422,7 @@ void
bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
{
if (io_len > 1)
- bx_panic("ne2k: page 0 write to port %04x, len=%u\n", (unsigned) offset,
+ bio->printf("ne2k: page 0 write to port %04x, len=%u\n", (unsigned) offset,
(unsigned) io_len);
switch (offset) {
@@ -499,7 +499,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
case 0xc: // RCR
// Check if the reserved bits are set
if (value & 0xc0)
- bx_printf("ne2k: RCR write, reserved bits set\n");
+ bio->printf("ne2k: RCR write, reserved bits set\n");
// Set all other bit-fields
BX_NE2K_THIS s.RCR.errors_ok = ((value & 0x01) == 0x01);
@@ -511,17 +511,17 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
// Monitor bit is a little suspicious...
if (value & 0x20)
- bx_printf("ne2k: RCR write, monitor bit set!\n");
+ bio->printf("ne2k: RCR write, monitor bit set!\n");
break;
case 0xd: // TCR
// Check reserved bits
if (value & 0xe0)
- bx_panic("ne2k: TCR write, reserved bits set");
+ bio->panic("ne2k: TCR write, reserved bits set");
// Test loop mode (not supported)
if (value & 0x06) {
- bx_printf("ne2k: TCR write, loop mode not supported");
+ bio->printf("ne2k: TCR write, loop mode not supported");
BX_NE2K_THIS s.TCR.loop_cntl = (value & 0x6) >> 1;
} else {
BX_NE2K_THIS s.TCR.loop_cntl = 0;
@@ -529,11 +529,11 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
// Inhibit-CRC not supported.
if (value & 0x01)
- bx_panic("ne2k: TCR write, inhibit-CRC not supported");
+ bio->panic("ne2k: TCR write, inhibit-CRC not supported");
// Auto-transmit disable very suspicious
if (value & 0x04)
- bx_panic("ne2k: TCR write, auto transmit disable not supported");
+ bio->panic("ne2k: TCR write, auto transmit disable not supported");
// Allow collision-offset to be set, although not used
BX_NE2K_THIS s.TCR.coll_prio = ((value & 0x08) == 0x08);
@@ -541,15 +541,17 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
case 0xe: // DCR
// Don't allow loopback mode to be set
- if (!(value & 0x08))
- bx_panic("ne2k: DCR write, loopback mode selected");
+ if (!(value & 0x08)) {
+ bio->printf("ne2k: DCR write, loopback mode selected\n");
+ value -= 8;
+ }
// It is questionable to set longaddr and auto_rx, since they
// aren't supported on the ne2000. Print a warning and continue
if (value & 0x04)
- bx_printf("ne2k: DCR write - LAS set ???\n");
+ bio->printf("ne2k: DCR write - LAS set ???\n");
if (value & 0x10)
- bx_printf("ne2k: DCR write - AR set ???\n");
+ bio->printf("ne2k: DCR write - AR set ???\n");
// Set other values.
BX_NE2K_THIS s.DCR.wdsize = ((value & 0x01) == 0x01);
@@ -562,7 +564,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
case 0xf: // IMR
// Check for reserved bit
if (value & 0x80)
- bx_panic("ne2k: IMR write, reserved bit set");
+ bio->panic("ne2k: IMR write, reserved bit set");
// Set other values
BX_NE2K_THIS s.IMR.rx_inte = ((value & 0x01) == 0x01);
@@ -575,7 +577,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
break;
default:
- bx_panic("ne2k: page 0 write, bad offset %0x", offset);
+ bio->printf("ne2k: page 0 write, bad offset %0x\n", offset);
}
}
@@ -588,7 +590,7 @@ Bit32u
bx_ne2k_c::page1_read(Bit32u offset, unsigned int io_len)
{
if (io_len > 1)
- bx_panic("ne2k: page 1 read from port %04x, len=%u\n", (unsigned) offset,
+ bio->panic("ne2k: page 1 read from port %04x, len=%u\n", (unsigned) offset,
(unsigned) io_len);
switch (offset) {
@@ -620,7 +622,7 @@ bx_ne2k_c::page1_read(Bit32u offset, uns
break;
default:
- bx_panic("ne2k: page 1 r offset %04x out of range", (unsigned) offset);
+ bio->panic("ne2k: page 1 r offset %04x out of range", (unsigned) offset);
}
return (0);
@@ -659,7 +661,7 @@ bx_ne2k_c::page1_write(Bit32u offset, Bi
break;
default:
- bx_panic("ne2k: page 1 w offset %04x out of range", (unsigned) offset);
+ bio->panic("ne2k: page 1 w offset %04x out of range", (unsigned) offset);
}
}
@@ -672,7 +674,7 @@ Bit32u
bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
{
if (io_len > 1)
- bx_panic("ne2k: page 2 read from port %04x, len=%u\n", (unsigned) offset,
+ bio->panic("ne2k: page 2 read from port %04x, len=%u\n", (unsigned) offset,
(unsigned) io_len);
switch (offset) {
@@ -712,7 +714,7 @@ bx_ne2k_c::page2_read(Bit32u offset, uns
case 0x9:
case 0xa:
case 0xb:
- bx_printf("ne2k: reserved read - page 2, 0x%02x\n", (unsigned) offset);
+ bio->printf("ne2k: reserved read - page 2, 0x%02x\n", (unsigned) offset);
return (0xff);
break;
@@ -752,7 +754,7 @@ bx_ne2k_c::page2_read(Bit32u offset, uns
break;
default:
- bx_panic("ne2k: page 2 offset %04x out of range", (unsigned) offset);
+ bio->panic("ne2k: page 2 offset %04x out of range", (unsigned) offset);
}
return (0);
@@ -761,11 +763,11 @@ bx_ne2k_c::page2_read(Bit32u offset, uns
void
bx_ne2k_c::page2_write(Bit32u offset, Bit32u value, unsigned io_len)
{
- // Maybe all writes here should be bx_panic'd, since they
+ // Maybe all writes here should be bio->panic'd, since they
// affect internal operation, but let them through for now
// and print a warning.
if (offset != 0)
- bx_printf("ne2k: page 2 write ?\n");
+ bio->printf("ne2k: page 2 write ?\n");
switch (offset) {
case 0x0: // CR
@@ -789,7 +791,7 @@ bx_ne2k_c::page2_write(Bit32u offset, Bi
break;
case 0x4:
- bx_panic("ne2k: page 2 write to reserved offset 4");
+ bio->panic("ne2k: page 2 write to reserved offset 4");
break;
case 0x5: // Local Next-packet pointer
@@ -816,11 +818,11 @@ bx_ne2k_c::page2_write(Bit32u offset, Bi
case 0xd:
case 0xe:
case 0xf:
- bx_panic("ne2k: page 2 write to reserved offset %0x", offset);
+ bio->panic("ne2k: page 2 write to reserved offset %0x", offset);
break;
default:
- bx_panic("ne2k: page 2 write, illegal offset %0x", offset);
+ bio->panic("ne2k: page 2 write, illegal offset %0x", offset);
break;
}
}
@@ -831,14 +833,14 @@ bx_ne2k_c::page2_write(Bit32u offset, Bi
Bit32u
bx_ne2k_c::page3_read(Bit32u offset, unsigned int io_len)
{
- bx_panic("ne2k: page 3 read attempted");
+ bio->panic("ne2k: page 3 read attempted");
return (0);
}
void
bx_ne2k_c::page3_write(Bit32u offset, Bit32u value, unsigned io_len)
{
- bx_panic("ne2k: page 3 write attempted");
+ bio->panic("ne2k: page 3 write attempted");
}
//
@@ -909,7 +911,7 @@ bx_ne2k_c::read(Bit32u address, unsigned
break;
default:
- bx_panic("ne2K: unknown value of pgsel in read - %d",
+ bio->panic("ne2K: unknown value of pgsel in read - %d",
BX_NE2K_THIS s.CR.pgsel);
}
}
@@ -967,7 +969,7 @@ bx_ne2k_c::write(Bit32u address, Bit32u
break;
default:
- bx_panic("ne2K: unknown value of pgsel in write - %d",
+ bio->panic("ne2K: unknown value of pgsel in write - %d",
BX_NE2K_THIS s.CR.pgsel);
}
}
@@ -1126,7 +1128,10 @@ bx_ne2k_c::init(bx_devices_c *d)
{
BX_NE2K_THIS devices = d;
+ if(bio->getdbg().network)
+ bio->printf("bx_ne2k_c::init(*d)\n");
if (bx_options.ne2k.valid) {
+ bio->printf("bx_ne2k_c::init(*d) ne2k.valid = 1\n");
// Bring the register state into power-up state
reset_device();
@@ -1182,7 +1187,7 @@ bx_ne2k_c::init(bx_devices_c *d)
this);
if (BX_NE2K_THIS ethdev == NULL) {
- bx_printf("ne2k: could not find eth module %s - using null instead\n",
+ bio->printf("ne2k: could not find eth module %s - using null instead\n",
bx_options.ne2k.ethmod);
BX_NE2K_THIS ethdev = eth_locator_c::create("null", NULL,
@@ -1190,7 +1195,7 @@ bx_ne2k_c::init(bx_devices_c *d)
rx_handler,
this);
if (BX_NE2K_THIS ethdev == NULL)
- bx_panic("ne2k: could not locate null module\n");
+ bio->panic("ne2k: could not locate null module\n");
}
}
}

View File

@ -0,0 +1,121 @@
$OpenBSD: patch-iodev_pci_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/pci.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/pci.cc Fri Oct 20 16:25:43 2000
@@ -118,15 +118,17 @@ bx_pci_c::read(Bit32u address, unsigned
default:
retMask = 0xFFFFFFFF; break;
}
- bx_printf("440FX IO read from port: %04x, len: %02x, data: %04x\n",
+ if(bio->getdbg().io)
+ bio->printf("[440FX] IO read from port: %04x, len: %02x, data: %04x\n",
address, io_len, (val440fx & retMask));
return (val440fx & retMask);
}
}
- bx_panic("pci: unsupported IO read to port 0x%x\n",
- (unsigned) address);
- return(0xffffffff);
+ if(bio->getdbg().unsupported_io)
+ bio->printf("pci: unsupported IO read to port 0x%x\n",
+ (unsigned) address);
+ return(0xffffffff);
}
@@ -152,7 +154,8 @@ bx_pci_c::write(Bit32u address, Bit32u v
switch (address) {
case 0xCF8:
BX_PCI_THIS s.i440fx.confAddr = value;
- bx_printf("440FX IO write to port %04x of %04x, len %02x \n",
+ if(bio->getdbg().io)
+ bio->printf("[PCI] 440FX IO write to port %04x of %04x, len %02x \n",
address, value, io_len);
break;
@@ -173,7 +176,8 @@ bx_pci_c::write(Bit32u address, Bit32u v
if (BX_PCI_THIS s.i440fx.confAddr & 0x80000000) {
idx = (BX_PCI_THIS s.i440fx.confAddr & 0xFC);
BX_PCI_THIS s.i440fx.array[idx] = (BX_PCI_THIS s.i440fx.array[idx] & ~dMask) | (value & dMask);
- bx_printf("440FX IO write to port %04x of %04x, len %02x \n",
+ if(bio->getdbg().io)
+ bio->printf("440FX IO write to port %04x of %04x, len %02x \n",
address, value, io_len);
}
}
@@ -194,7 +198,8 @@ bx_pci_c::write(Bit32u address, Bit32u v
if (BX_PCI_THIS s.i440fx.confAddr & 0x80000000) {
idx = (BX_PCI_THIS s.i440fx.confAddr & 0xFC);
BX_PCI_THIS s.i440fx.array[idx] = (BX_PCI_THIS s.i440fx.array[idx] & ~dMask) | ((value << 8) & dMask);
- bx_printf("440FX IO write to port %04x of %04x, len %02x \n",
+ if(bio->getdbg().io)
+ bio->printf("440FX IO write to port %04x of %04x, len %02x \n",
address, value, io_len);
}
}
@@ -215,7 +220,8 @@ bx_pci_c::write(Bit32u address, Bit32u v
if (BX_PCI_THIS s.i440fx.confAddr & 0x80000000) {
idx = (BX_PCI_THIS s.i440fx.confAddr & 0xFC);
BX_PCI_THIS s.i440fx.array[idx] = (BX_PCI_THIS s.i440fx.array[idx] & ~dMask) | ((value << 16) & dMask);
- bx_printf("440FX IO write to port %04x of %04x, len %02x \n",
+ if(bio->getdbg().io)
+ bio->printf("440FX IO write to port %04x of %04x, len %02x \n",
address, value, io_len);
}
}
@@ -234,14 +240,16 @@ bx_pci_c::write(Bit32u address, Bit32u v
if (BX_PCI_THIS s.i440fx.confAddr & 0x80000000) {
idx = (BX_PCI_THIS s.i440fx.confAddr & 0xFC);
BX_PCI_THIS s.i440fx.array[idx] = (BX_PCI_THIS s.i440fx.array[idx] & ~dMask) | ((value << 24) & dMask);
- bx_printf("440FX IO write to port %04x of %04x, len %02x \n",
+ if(bio->getdbg().io)
+ bio->printf("440FX IO write to port %04x of %04x, len %02x \n",
address, value, io_len);
}
}
break;
default:
- bx_panic("pci: IO write to port 0x%x\n", (unsigned) address);
+ if(bio->getdbg().unsupported_io)
+ bio->printf("pci: IO write to port 0x%x\n", (unsigned) address);
}
}
@@ -315,8 +323,10 @@ bx_pci_c::rd_memType (Bit32u addr)
return (mapRead ( (BX_PCI_THIS s.i440fx.array[0x58] >> 12) & 0x3));
default:
- bx_panic ("wr_memType () Error: Memory Type not known !\n");
- return(0); // keep compiler happy
+ if(bio->getdbg().unsupported_io)
+ bio->printf("[PCI] rd_memType(): Memory Type(0x%x) not known !\n",
+ (addr & 0xFC000) >> 12);
+ return(0);
break;
}
@@ -361,8 +371,10 @@ bx_pci_c::wr_memType (Bit32u addr)
return (mapWrite ( (BX_PCI_THIS s.i440fx.array[0x58] >> 12) & 0x3));
default:
- bx_panic ("rd_memType () Error: Memory Type not known !\n");
- return(0); // keep compiler happy
+ if(bio->getdbg().unsupported)
+ bio->printf("[PCI] wr_memType(): Memory Type 0x%x not known !\n",
+ (addr & 0xFC000) >> 12);
+ return(0);
break;
}
}
@@ -398,7 +410,9 @@ bx_pci_c::i440fx_fetch_ptr(Bit32u addr)
case 0x1: // Read from ROM
return (&bx_pci.s.i440fx.shadow[(addr - 0xc0000)]);
default:
- bx_panic("i440fx_fetch_ptr(): default case\n");
+ if(bio->getdbg().unsupported_io)
+ bio->printf("[PCI] i440fx_fetch_ptr(): default case 0x%x\n",
+ bx_pci.rd_memType(addr));
return(0);
}
}

View File

@ -0,0 +1,395 @@
$OpenBSD: patch-iodev_pic_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/pic.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/pic.cc Thu Oct 19 10:53:07 2000
@@ -121,11 +121,11 @@ bx_pic_c::read(Bit32u address, unsigned
UNUSED(this_ptr);
#endif // !BX_USE_PIC_SMF
if (io_len > 1)
- bx_panic("pic: io read from port %04x, len=%u\n", (unsigned) address,
+ bio->panic("[PIC] io read from port %04x, len=%u\n", (unsigned) address,
(unsigned) io_len);
- if (bx_dbg.pic)
- bx_printf("pic: IO read from %04x\n", (unsigned) address);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] IO read from %04x\n", (unsigned) address);
/*
8259A PIC
@@ -134,41 +134,41 @@ bx_pic_c::read(Bit32u address, unsigned
switch (address) {
case 0x20:
if (BX_PIC_THIS s.master_pic.read_reg_select) { /* ISR */
- if (bx_dbg.pic) bx_printf("pic: read master ISR = %02x\n",
+ if (bio->getdbg().pic) bio->printf("[PIC] read master ISR = %02x\n",
(unsigned) BX_PIC_THIS s.master_pic.isr);
return(BX_PIC_THIS s.master_pic.isr);
}
else { /* IRR */
- if (bx_dbg.pic) bx_printf("pic: read master IRR = %02x\n",
+ if (bio->getdbg().pic) bio->printf("[PIC] read master IRR = %02x\n",
(unsigned) BX_PIC_THIS s.master_pic.irr);
return(BX_PIC_THIS s.master_pic.irr);
}
break;
case 0x21:
- if (bx_dbg.pic) bx_printf("pic: read master IMR = %02x\n",
+ if (bio->getdbg().pic) bio->printf("[PIC] read master IMR = %02x\n",
(unsigned) BX_PIC_THIS s.master_pic.imr);
return(BX_PIC_THIS s.master_pic.imr);
break;
case 0xA0:
if (BX_PIC_THIS s.slave_pic.read_reg_select) { /* ISR */
- if (bx_dbg.pic) bx_printf("pic: read slave ISR = %02x\n",
+ if (bio->getdbg().pic) bio->printf("[PIC] read slave ISR = %02x\n",
(unsigned) BX_PIC_THIS s.slave_pic.isr);
return(BX_PIC_THIS s.slave_pic.isr);
}
else { /* IRR */
- if (bx_dbg.pic) bx_printf("pic: read slave IRR = %02x\n",
+ if (bio->getdbg().pic) bio->printf("[PIC] read slave IRR = %02x\n",
(unsigned) BX_PIC_THIS s.slave_pic.irr);
return(BX_PIC_THIS s.slave_pic.irr);
}
break;
case 0xA1:
- if (bx_dbg.pic) bx_printf("pic: read slave IMR = %02x\n",
+ if (bio->getdbg().pic) bio->printf("[PIC] read slave IMR = %02x\n",
(unsigned) BX_PIC_THIS s.slave_pic.imr);
return(BX_PIC_THIS s.slave_pic.imr);
break;
}
- bx_panic("pic: io read to address %04x\n", (unsigned) address);
+ bio->panic("[PIC] io read to address %04x\n", (unsigned) address);
return(0); /* default if not found above */
}
@@ -194,11 +194,11 @@ bx_pic_c::write(Bit32u address, Bit32u v
int irq;
if (io_len > 1)
- bx_panic("pic: io write to port %04x, len=%u\n", (unsigned) address,
+ bio->panic("[PIC] io write to port %04x, len=%u\n", (unsigned) address,
(unsigned) io_len);
- if (bx_dbg.pic)
- bx_printf("pic: IO write to %04x = %02x\n",
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] IO write to %04x = %02x\n",
(unsigned) address, (unsigned) value);
/*
@@ -209,12 +209,12 @@ bx_pic_c::write(Bit32u address, Bit32u v
case 0x20:
if (value & 0x10) { /* initialization command 1 */
// (mch) Ignore...
- // bx_printf("pic:master: init command 1 found %02x\n", (unsigned) value);
- if (bx_dbg.pic) {
- bx_printf("pic:master: init command 1 found\n");
- bx_printf(" requires 4 = %u\n",
+ // bio->printf("[PIC] master: init command 1 found %02x\n", (unsigned) value);
+ if (bio->getdbg().pic) {
+ bio->printf("[PIC] master: init command 1 found\n");
+ bio->printf("[PIC] requires 4 = %u\n",
(unsigned) (value & 0x01) );
- bx_printf(" cascade mode: [0=cascade,1=single] %u\n",
+ bio->printf("[PIC] cascade mode: [0=cascade,1=single] %u\n",
(unsigned) ((value & 0x02) >> 1));
}
BX_PIC_THIS s.master_pic.init.in_init = 1;
@@ -225,7 +225,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
BX_PIC_THIS s.master_pic.irr = 0x00; /* no IRQ's requested */
BX_PIC_THIS s.master_pic.INT = 0; /* reprogramming clears previous INTR request */
if ( (value & 0x02) == 1 )
- bx_panic("pic:master: init command: single mode\n");
+ bio->panic("[PIC] master: init command: single mode\n");
BX_SET_INTR(0);
return;
}
@@ -237,7 +237,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
poll = (value & 0x04) >> 2;
read_op = (value & 0x03);
if (poll)
- bx_panic("pic:master:OCW3: poll bit set\n");
+ bio->panic("[PIC] master:OCW3: poll bit set\n");
if (read_op == 0x02) /* read IRR */
BX_PIC_THIS s.master_pic.read_reg_select = 0;
else if (read_op == 0x03) /* read ISR */
@@ -255,7 +255,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
/* OCW2 */
switch (value) {
case 0x00: // Rotate in Auto-EOI mode
- bx_panic("PIC: Rotate in Auto-EOI mode command received.\n");
+ bio->panic("[PIC] Rotate in Auto-EOI mode command received.\n");
case 0x0A: /* select read interrupt request register */
BX_PIC_THIS s.master_pic.read_reg_select = 0;
break;
@@ -296,11 +296,11 @@ bx_pic_c::write(Bit32u address, Bit32u v
case 0xC6: // 6 5 4 3 2 1 0 7
case 0xC7: // 7 6 5 4 3 2 1 0
// ignore for now
- bx_printf("pic: IRQ lowest command 0x%x\n", value);
+ bio->printf("[PIC] IRQ lowest command 0x%x\n", value);
break;
default:
- bx_panic("PIC: write to port 20h = %02x\n", value);
+ bio->panic("[PIC] write to port 20h = %02x\n", value);
} /* switch (value) */
break;
@@ -311,16 +311,16 @@ bx_pic_c::write(Bit32u address, Bit32u v
case 2:
BX_PIC_THIS s.master_pic.interrupt_offset = value & 0xf8;
BX_PIC_THIS s.master_pic.init.byte_expected = 3;
- if (bx_dbg.pic) {
- bx_printf("pic:master: init command 2 = %02x\n", (unsigned) value);
- bx_printf(" offset = INT %02x\n",
+ if (bio->getdbg().pic) {
+ bio->printf("[PIC] master: init command 2 = %02x\n", (unsigned) value);
+ bio->printf("[PIC] offset = INT %02x\n",
BX_PIC_THIS s.master_pic.interrupt_offset);
}
return;
break;
case 3:
- if (bx_dbg.pic)
- bx_printf("pic:master: init command 3 = %02x\n", (unsigned) value);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] master: init command 3 = %02x\n", (unsigned) value);
if (BX_PIC_THIS s.master_pic.init.requires_4) {
BX_PIC_THIS s.master_pic.init.byte_expected = 4;
}
@@ -330,27 +330,27 @@ bx_pic_c::write(Bit32u address, Bit32u v
return;
break;
case 4:
- if (bx_dbg.pic) {
- bx_printf("pic:master: init command 4 = %02x\n", (unsigned) value);
- if (value & 0x02) bx_printf("pic: auto EOI\n");
- else bx_printf("pic: normal EOI interrupt\n");
+ if (bio->getdbg().pic) {
+ bio->printf("[PIC] master: init command 4 = %02x\n", (unsigned) value);
+ if (value & 0x02) bio->printf("[PIC] auto EOI\n");
+ else bio->printf("[PIC] normal EOI interrupt\n");
}
if (value & 0x01) {
- if (bx_dbg.pic)
- bx_printf("pic: 80x86 mode\n");
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] 80x86 mode\n");
} else
- bx_panic("pic: not 80x86 mode\n");
+ bio->panic("[PIC] not 80x86 mode\n");
BX_PIC_THIS s.master_pic.init.in_init = 0;
return;
break;
default:
- bx_panic("pic:master expecting bad init command\n");
+ bio->panic("[PIC] master expecting bad init command\n");
}
}
/* normal operation */
- if (bx_dbg.pic)
- bx_printf("pic: setting master pic IMR to %02x\n", value);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] setting master pic IMR to %02x\n", value);
BX_PIC_THIS s.master_pic.imr = value;
service_master_pic();
return;
@@ -358,11 +358,11 @@ bx_pic_c::write(Bit32u address, Bit32u v
case 0xA0:
if (value & 0x10) { /* initialization command 1 */
- if (bx_dbg.pic) {
- bx_printf("pic:slave: init command 1 found\n");
- bx_printf(" requires 4 = %u\n",
+ if (bio->getdbg().pic) {
+ bio->printf("[PIC] slave: init command 1 found\n");
+ bio->printf("[PIC] requires 4 = %u\n",
(unsigned) (value & 0x01) );
- bx_printf(" cascade mode: [0=cascade,1=single] %u\n",
+ bio->printf("[PIC] cascade mode: [0=cascade,1=single] %u\n",
(unsigned) ((value & 0x02) >> 1));
}
BX_PIC_THIS s.slave_pic.init.in_init = 1;
@@ -373,7 +373,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
BX_PIC_THIS s.slave_pic.irr = 0x00; /* no IRQ's requested */
BX_PIC_THIS s.slave_pic.INT = 0; /* reprogramming clears previous INTR request */
if ( (value & 0x02) == 1 )
- bx_panic("pic:slave: init command: single mode\n");
+ bio->panic("[PIC] slave: init command: single mode\n");
return;
}
@@ -384,7 +384,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
poll = (value & 0x04) >> 2;
read_op = (value & 0x03);
if (poll)
- bx_panic("pic:slave:OCW3: poll bit set\n");
+ bio->panic("[PIC] slave:OCW3: poll bit set\n");
if (read_op == 0x02) /* read IRR */
BX_PIC_THIS s.slave_pic.read_reg_select = 0;
else if (read_op == 0x03) /* read ISR */
@@ -395,7 +395,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
else if (special_mask == 0x03) { /* set specific mask */
BX_PIC_THIS s.slave_pic.special_mask = 1;
service_slave_pic();
- bx_printf("pic:slave: OCW3 not implemented (%02x)\n",
+ bio->printf("[PIC] slave: OCW3 not implemented (%02x)\n",
(unsigned) value);
}
return;
@@ -432,7 +432,7 @@ bx_pic_c::write(Bit32u address, Bit32u v
break;
default:
- bx_panic("PIC: write to port A0h = %02x\n", value);
+ bio->panic("[PIC] write to port A0h = %02x\n", value);
} /* switch (value) */
break;
@@ -443,16 +443,16 @@ bx_pic_c::write(Bit32u address, Bit32u v
case 2:
BX_PIC_THIS s.slave_pic.interrupt_offset = value & 0xf8;
BX_PIC_THIS s.slave_pic.init.byte_expected = 3;
- if (bx_dbg.pic) {
- bx_printf("pic:slave: init command 2 = %02x\n", (unsigned) value);
- bx_printf(" offset = INT %02x\n",
+ if (bio->getdbg().pic) {
+ bio->printf("[PIC] slave: init command 2 = %02x\n", (unsigned) value);
+ bio->printf("[PIC] offset = INT %02x\n",
BX_PIC_THIS s.slave_pic.interrupt_offset);
}
return;
break;
case 3:
- if (bx_dbg.pic)
- bx_printf("pic:slave: init command 3 = %02x\n", (unsigned) value);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] slave: init command 3 = %02x\n", (unsigned) value);
if (BX_PIC_THIS s.slave_pic.init.requires_4) {
BX_PIC_THIS s.slave_pic.init.byte_expected = 4;
}
@@ -462,26 +462,26 @@ bx_pic_c::write(Bit32u address, Bit32u v
return;
break;
case 4:
- if (bx_dbg.pic) {
- bx_printf("pic:slave: init command 4 = %02x\n", (unsigned) value);
- if (value & 0x02) bx_printf("pic: auto EOI\n");
- else bx_printf("pic: normal EOI interrupt\n");
+ if (bio->getdbg().pic) {
+ bio->printf("[PIC] slave: init command 4 = %02x\n", (unsigned) value);
+ if (value & 0x02) bio->printf("[PIC] auto EOI\n");
+ else bio->printf("[PIC] normal EOI interrupt\n");
}
if (value & 0x01) {
- if (bx_dbg.pic)
- bx_printf("pic: 80x86 mode\n");
- } else bx_panic("pic: not 80x86 mode\n");
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] 80x86 mode\n");
+ } else bio->panic("[PIC] not 80x86 mode\n");
BX_PIC_THIS s.slave_pic.init.in_init = 0;
return;
break;
default:
- bx_panic("pic:slave: expecting bad init command\n");
+ bio->panic("[PIC] slave: expecting bad init command\n");
}
}
/* normal operation */
- if (bx_dbg.pic)
- bx_printf("pic: setting slave pic IMR to %02x\n", value);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] setting slave pic IMR to %02x\n", value);
BX_PIC_THIS s.slave_pic.imr = value;
service_slave_pic();
return;
@@ -498,11 +498,11 @@ bx_pic_c::trigger_irq(unsigned irq_no)
#if BX_DEBUG
if ( irq_no > 15 )
- bx_panic("trigger_irq: irq out of range\n");
+ bio->panic("[PIC] trigger_irq: irq out of range\n");
#endif
- if (bx_dbg.pic)
- bx_printf("trigger_irq(%d decimal)\n", (unsigned) irq_no);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] trigger_irq(%d decimal)\n", (unsigned) irq_no);
if (irq_no <= 7) {
irq_no_bitmask = 1 << irq_no;
@@ -523,11 +523,11 @@ bx_pic_c::untrigger_irq(unsigned irq_no)
#if BX_DEBUG
if ( irq_no > 15 )
- bx_panic("untrigger_irq: irq out of range\n");
+ bio->panic("[PIC] untrigger_irq: irq out of range\n");
#endif
- if (bx_dbg.pic)
- bx_printf("untrigger_irq(%d decimal)\n", (unsigned) irq_no);
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] untrigger_irq(%d decimal)\n", (unsigned) irq_no);
if (irq_no <= 7) {
irq_no_bitmask = 1 << irq_no;
@@ -571,7 +571,7 @@ bx_pic_c::service_master_pic(void)
max_irq++;
}
if (max_irq == 0 ) return; /* IRQ0 in-service, no other priorities allowed */
- if (max_irq > 7) bx_panic("error in service_master_pic()\n");
+ if (max_irq > 7) bio->panic("[PIC] error in service_master_pic()\n");
}
else
max_irq = 7; /* 0..7 bits in ISR are cleared */
@@ -587,8 +587,8 @@ bx_pic_c::service_master_pic(void)
if ( BX_PIC_THIS s.master_pic.special_mask && ((BX_PIC_THIS s.master_pic.isr >> irq) & 0x01) )
continue;
if (unmasked_requests & (1 << irq)) {
- if (bx_dbg.pic)
- bx_printf("pic: signalling IRQ(%u)\n",
+ if (bio->getdbg().pic)
+ bio->printf("[PIC] signalling IRQ(%u)\n",
(unsigned) irq);
BX_PIC_THIS s.master_pic.irr &= ~(1 << irq);
/*??? do for slave too: BX_PIC_THIS s.master_pic.isr |= (1 << irq);*/
@@ -621,7 +621,7 @@ bx_pic_c::service_slave_pic(void)
isr >>= 1;
lowest_priority_irq++;
}
- if (lowest_priority_irq > 7) bx_panic("error in service_slave_pic()\n");
+ if (lowest_priority_irq > 7) bio->panic("[PIC] error in service_slave_pic()\n");
}
else
lowest_priority_irq = 8;
@@ -631,8 +631,8 @@ bx_pic_c::service_slave_pic(void)
if ((unmasked_requests = (BX_PIC_THIS s.slave_pic.irr & ~BX_PIC_THIS s.slave_pic.imr)) ) {
for (irq=0; irq<lowest_priority_irq; irq++) {
if (unmasked_requests & (1 << irq)) {
- if (bx_dbg.pic)
- bx_printf("pic(slave): signalling IRQ(%u)\n",
+ if (bio->getdbg().pic)
+ bio->printf("pic(slave): signalling IRQ(%u)\n",
(unsigned) 8 + irq);
BX_PIC_THIS s.slave_pic.irr &= ~(1 << irq);
BX_PIC_THIS s.slave_pic.INT = 1;
@@ -681,8 +681,8 @@ bx_pic_c::IAC(void)
void
bx_pic_c::show_pic_state(void)
{
-bx_printf("s.master_pic.imr = %02x\n", BX_PIC_THIS s.master_pic.imr);
-bx_printf("s.master_pic.isr = %02x\n", BX_PIC_THIS s.master_pic.isr);
-bx_printf("s.master_pic.irr = %02x\n", BX_PIC_THIS s.master_pic.irr);
-bx_printf("s.master_pic.irq = %02x\n", BX_PIC_THIS s.master_pic.irq);
+bio->printf("[PIC] s.master_pic.imr = %02x\n", BX_PIC_THIS s.master_pic.imr);
+bio->printf("[PIC] s.master_pic.isr = %02x\n", BX_PIC_THIS s.master_pic.isr);
+bio->printf("[PIC] s.master_pic.irr = %02x\n", BX_PIC_THIS s.master_pic.irr);
+bio->printf("[PIC] s.master_pic.irq = %02x\n", BX_PIC_THIS s.master_pic.irq);
}

View File

@ -0,0 +1,370 @@
$OpenBSD: patch-iodev_pit_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/pit.cc.orig Sat Mar 25 21:33:31 2000
+++ iodev/pit.cc Thu Oct 19 11:23:33 2000
@@ -238,11 +238,11 @@ bx_pit_c::read( Bit32u address, unsign
UNUSED(this_ptr);
#endif // !BX_USE_PIT_SMF
if (io_len > 1)
- bx_panic("pit: io read from port %04x, len=%u\n", (unsigned) address,
+ bio->panic("pit: io read from port %04x, len=%u\n", (unsigned) address,
(unsigned) io_len);
- if (bx_dbg.pit)
- bx_printf("pit: io read from port %04x\n", (unsigned) address);
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] io read from port %04x\n", (unsigned) address);
switch (address) {
case 0x40: /* timer 0 - system ticks */
@@ -263,7 +263,7 @@ bx_pit_c::read( Bit32u address, unsign
break;
default:
- bx_panic("pit: unsupported io read from port %04x\n", address);
+ bio->panic("pit: unsupported io read from port %04x\n", address);
}
return(0); /* keep compiler happy */
}
@@ -294,11 +294,11 @@ bx_pit_c::write( Bit32u address, Bit32
value = (Bit8u ) dvalue;
if (io_len > 1)
- bx_panic("pit: io write to port %04x, len=%u\n", (unsigned) address,
+ bio->panic("pit: io write to port %04x, len=%u\n", (unsigned) address,
(unsigned) io_len);
- if (bx_dbg.pit)
- bx_printf("pit: write to port %04x = %02x\n",
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] write to port %04x = %02x\n",
(unsigned) address, (unsigned) value);
switch (address) {
@@ -323,14 +323,14 @@ bx_pit_c::write( Bit32u address, Bit32
mode = (value >> 1) & 0x07;
bcd_mode = value & 0x01;
#if 0
-bx_printf("timer 0-2 mode control: comm:%02x mode:%02x bcd_mode:%u\n",
+bio->printf("[PIT] timer 0-2 mode control: comm:%02x mode:%02x bcd_mode:%u\n",
(unsigned) command, (unsigned) mode, (unsigned) bcd_mode);
#endif
if ( (mode > 5) || (command > 0x0e) )
- bx_panic("pit: outp(43h)=%02xh out of range\n", (unsigned) value);
+ bio->panic("pit: outp(43h)=%02xh out of range\n", (unsigned) value);
if (bcd_mode)
- bx_panic("pit: outp(43h)=%02xh: bcd mode unhandled\n",
+ bio->panic("pit: outp(43h)=%02xh: bcd mode unhandled\n",
(unsigned) bcd_mode);
switch (command) {
@@ -340,7 +340,7 @@ bx_printf("timer 0-2 mode control: comm:
case 0x1: /* timer 0: LSB mode */
case 0x2: /* timer 0: MSB mode */
- bx_panic("pit: outp(43h): command %02xh unhandled\n",
+ bio->panic("pit: outp(43h): command %02xh unhandled\n",
(unsigned) command);
break;
case 0x3: /* timer 0: 16-bit mode */
@@ -350,7 +350,7 @@ bx_printf("timer 0-2 mode control: comm:
BX_PIT_THIS s.timer[0].input_latch_toggle = 0;
BX_PIT_THIS s.timer[0].bcd_mode = bcd_mode;
if ( (mode!=3 && mode!=2 && mode!=0) || bcd_mode!=0 )
- bx_panic("pit: outp(43h): comm 3, mode %02x, bcd %02x unhandled\n",
+ bio->panic("pit: outp(43h): comm 3, mode %02x, bcd %02x unhandled\n",
(unsigned) mode, bcd_mode);
break;
case 0x4: /* timer 1: counter latch */
@@ -359,7 +359,7 @@ bx_printf("timer 0-2 mode control: comm:
case 0x5: /* timer 1: LSB mode */
case 0x6: /* timer 1: MSB mode */
- bx_printf("pit: outp(43h): command %02xh unhandled (ignored)\n",
+ bio->printf("[PIT] outp(43h): command %02xh unhandled (ignored)\n",
(unsigned) command);
break;
case 0x7: /* timer 1: 16-bit mode */
@@ -369,7 +369,7 @@ bx_printf("timer 0-2 mode control: comm:
BX_PIT_THIS s.timer[1].input_latch_toggle = 0;
BX_PIT_THIS s.timer[1].bcd_mode = bcd_mode;
if ( mode!=2 || bcd_mode!=0 )
- bx_panic("pit: outp(43h): comm 7, mode %02x, bcd %02x unhandled\n",
+ bio->panic("pit: outp(43h): comm 7, mode %02x, bcd %02x unhandled\n",
(unsigned) mode, bcd_mode);
break;
case 0x8: /* timer 2: counter latch */
@@ -378,7 +378,7 @@ bx_printf("timer 0-2 mode control: comm:
case 0x9: /* timer 2: LSB mode */
case 0xa: /* timer 2: MSB mode */
- bx_panic("pit: outp(43h): command %02xh unhandled\n",
+ bio->panic("pit: outp(43h): command %02xh unhandled\n",
(unsigned) command);
break;
case 0xb: /* timer 2: 16-bit mode */
@@ -388,7 +388,7 @@ bx_printf("timer 0-2 mode control: comm:
BX_PIT_THIS s.timer[2].input_latch_toggle = 0;
BX_PIT_THIS s.timer[2].bcd_mode = bcd_mode;
if ( (mode!=3 && mode!=2) || bcd_mode!=0 )
- bx_panic("pit: outp(43h): comm Bh, mode %02x, bcd %02x unhandled\n",
+ bio->panic("pit: outp(43h): comm Bh, mode %02x, bcd %02x unhandled\n",
(unsigned) mode, bcd_mode);
break;
#if 0
@@ -402,16 +402,16 @@ bx_printf("timer 0-2 mode control: comm:
break;
case 0xe: /* latch status of timers */
- bx_panic("pit: outp(43h): command %02xh unhandled\n",
+ bio->panic("pit: outp(43h): command %02xh unhandled\n",
(unsigned) command);
break;
#endif
case 0x0c: case 0x0d: case 0x0e: case 0x0f:
- bx_printf("pit: ignoring 8254 command %u\n", (unsigned) command);
+ bio->printf("[PIT] ignoring 8254 command %u\n", (unsigned) command);
break;
default: /* 0xc & 0xf */
- bx_panic("pit: outp(43h) command %1xh unhandled\n",
+ bio->panic("pit: outp(43h) command %1xh unhandled\n",
(unsigned) command);
break;
}
@@ -428,7 +428,7 @@ bx_printf("timer 0-2 mode control: comm:
break;
default:
- bx_panic("pit: unsupported io write to port %04x = %02x\n",
+ bio->panic("pit: unsupported io write to port %04x = %02x\n",
(unsigned) address, (unsigned) value);
}
}
@@ -447,34 +447,34 @@ bx_pit_c::write_count_reg( Bit8u value
BX_PIT_THIS s.timer[timerid].input_latch_value = value;
BX_PIT_THIS s.timer[timerid].input_latch_toggle = 1;
xfer_complete = 0;
- if (bx_dbg.pit)
- bx_printf("pit: BX_PIT_THIS s.timer[timerid] write L = %02x\n", (unsigned) value);
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] BX_PIT_THIS s.timer[timerid] write L = %02x\n", (unsigned) value);
}
else {
BX_PIT_THIS s.timer[timerid].input_latch_value |= (value << 8);
BX_PIT_THIS s.timer[timerid].input_latch_toggle = 0;
xfer_complete = 1;
- if (bx_dbg.pit)
- bx_printf("pit: BX_PIT_THIS s.timer[timerid] write H = %02x\n", (unsigned) value);
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] BX_PIT_THIS s.timer[timerid] write H = %02x\n", (unsigned) value);
}
break;
case BX_PIT_LATCH_MODE_MSB: /* write1=MSB, LSB=0 */
BX_PIT_THIS s.timer[timerid].input_latch_value = (value << 8);
xfer_complete = 1;
- if (bx_dbg.pit)
- bx_printf("pit: BX_PIT_THIS s.timer[timerid] write H = %02x\n", (unsigned) value);
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] BX_PIT_THIS s.timer[timerid] write H = %02x\n", (unsigned) value);
break;
case BX_PIT_LATCH_MODE_LSB: /* write1=LSB, MSB=0 */
BX_PIT_THIS s.timer[timerid].input_latch_value = value;
xfer_complete = 1;
- if (bx_dbg.pit)
- bx_printf("pit: BX_PIT_THIS s.timer[timerid] write L = %02x\n", (unsigned) value);
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] BX_PIT_THIS s.timer[timerid] write L = %02x\n", (unsigned) value);
break;
default:
- bx_panic("write_count_reg: latch_mode unknown\n");
+ bio->panic("write_count_reg: latch_mode unknown\n");
xfer_complete = 0;
}
@@ -502,12 +502,12 @@ bx_pit_c::write_count_reg( Bit8u value
}
break;
case 1:
- bx_panic("pit:write_count_reg(%u): mode1 unsupported\n",
+ bio->panic("pit:write_count_reg(%u): mode1 unsupported\n",
timerid);
break;
case 2:
if ( BX_PIT_THIS s.timer[timerid].counter_max == 1 )
- bx_panic("pit:write_count_reg(%u): mode %u counter_max=1\n",
+ bio->panic("pit:write_count_reg(%u): mode %u counter_max=1\n",
timerid, (unsigned) BX_PIT_THIS s.timer[timerid].mode);
if ( BX_PIT_THIS s.timer[timerid].GATE && !BX_PIT_THIS s.timer[timerid].active ) {
// software triggered
@@ -519,7 +519,7 @@ bx_pit_c::write_count_reg( Bit8u value
break;
case 3:
if ( BX_PIT_THIS s.timer[timerid].counter_max == 1 )
- bx_panic("pit:write_count_reg(%u): mode %u counter_max=1\n",
+ bio->panic("pit:write_count_reg(%u): mode %u counter_max=1\n",
timerid, (unsigned) BX_PIT_THIS s.timer[timerid].mode);
BX_PIT_THIS s.timer[timerid].counter_max = BX_PIT_THIS s.timer[timerid].counter_max & 0xfffe;
if ( BX_PIT_THIS s.timer[timerid].GATE && !BX_PIT_THIS s.timer[timerid].active ) {
@@ -531,11 +531,11 @@ bx_pit_c::write_count_reg( Bit8u value
}
break;
case 4:
- bx_panic("pit:write_count_reg(%u): mode4 unsupported\n",
+ bio->panic("pit:write_count_reg(%u): mode4 unsupported\n",
timerid);
break;
case 5:
- bx_panic("pit:write_count_reg(%u): mode5 unsupported\n",
+ bio->panic("pit:write_count_reg(%u): mode5 unsupported\n",
timerid);
break;
}
@@ -554,7 +554,7 @@ bx_pit_c::read_counter( unsigned timerid
}
else { /* direct unlatched read */
counter_value = BX_PIT_THIS s.timer[timerid].counter;
-bx_printf("CV=%04x\n", (unsigned) BX_PIT_THIS s.timer[timerid].counter);
+bio->printf("[PIT] CV=%04x\n", (unsigned) BX_PIT_THIS s.timer[timerid].counter);
}
switch (BX_PIT_THIS s.timer[timerid].latch_mode) {
@@ -578,7 +578,7 @@ bx_printf("CV=%04x\n", (unsigned) BX_PIT
BX_PIT_THIS s.timer[timerid].output_latch_full = 0;
break;
default:
- bx_panic("pit: io read from port 40h: unknown latch mode\n");
+ bio->panic("pit: io read from port 40h: unknown latch mode\n");
retval = 0; /* keep compiler happy */
}
return( retval );
@@ -590,15 +590,15 @@ bx_pit_c::latch( unsigned timerid )
{
/* subsequent counter latch commands are ignored until value read out */
if (BX_PIT_THIS s.timer[timerid].output_latch_full) {
- bx_printf("pit: pit(%u) latch: output latch full, ignoring\n",
+ bio->printf("[PIT] pit(%u) latch: output latch full, ignoring\n",
timerid);
return;
}
BX_PIT_THIS s.timer[timerid].output_latch_value = BX_PIT_THIS s.timer[timerid].counter;
- if (bx_dbg.pit)
- bx_printf("pit: latch_value = %lu\n", BX_PIT_THIS s.timer[timerid].output_latch_value);
+ if (bio->getdbg().pit)
+ bio->printf("[PIT] latch_value = %lu\n", BX_PIT_THIS s.timer[timerid].output_latch_value);
BX_PIT_THIS s.timer[timerid].output_latch_toggle = 0;
BX_PIT_THIS s.timer[timerid].output_latch_full = 1;
}
@@ -608,7 +608,7 @@ bx_pit_c::set_GATE(unsigned pit_id, unsi
{
// GATE's for Timer 0 & Timer 1 are tied high.
if (pit_id != 2)
- bx_panic("pit:set_GATE: pit_id != 2\n");
+ bio->panic("pit:set_GATE: pit_id != 2\n");
value = (value > 0);
@@ -644,7 +644,7 @@ bx_pit_c::set_GATE(unsigned pit_id, unsi
case 4:
case 5:
default:
- bx_panic("bx_pit_c::set_GATE: unhandled timer2 mode %u\n",
+ bio->panic("bx_pit_c::set_GATE: unhandled timer2 mode %u\n",
(unsigned) BX_PIT_THIS s.timer[2].mode);
}
}
@@ -667,7 +667,7 @@ bx_pit_c::set_GATE(unsigned pit_id, unsi
case 4:
case 5:
default:
- bx_panic("bx_pit_c::set_GATE: unhandled timer2 mode %u\n",
+ bio->panic("bx_pit_c::set_GATE: unhandled timer2 mode %u\n",
(unsigned) BX_PIT_THIS s.timer[2].mode);
}
}
@@ -685,14 +685,14 @@ bx_pit_c::start(unsigned timerid)
else {
period_hz = 1193182 / BX_PIT_THIS s.timer[timerid].counter_max;
}
- bx_printf("timer%u period set to %lu hz\n", timerid, period_hz);
+ bio->printf("[PIT] timer%u period set to %lu hz\n", timerid, period_hz);
switch (BX_PIT_THIS s.timer[timerid].mode) {
case 0: /* single timeout */
break;
case 1: /* retriggerable one-shot */
- bx_panic("start: mode %u unhandled\n",
+ bio->panic("start: mode %u unhandled\n",
(unsigned) BX_PIT_THIS s.timer[timerid].mode);
break;
case 2: /* rate generator */
@@ -700,15 +700,15 @@ bx_pit_c::start(unsigned timerid)
case 3: /* square wave mode */
break;
case 4: /* software triggered strobe */
- bx_panic("start: mode %u unhandled\n",
+ bio->panic("start: mode %u unhandled\n",
(unsigned) BX_PIT_THIS s.timer[timerid].mode);
break;
case 5: /* hardware retriggerable strobe */
- bx_panic("start: mode %u unhandled\n",
+ bio->panic("start: mode %u unhandled\n",
(unsigned) BX_PIT_THIS s.timer[timerid].mode);
break;
default:
- bx_panic("start: timer%u has bad mode\n",
+ bio->panic("start: timer%u has bad mode\n",
(unsigned) BX_PIT_THIS s.timer[timerid].mode);
}
}
@@ -776,7 +776,7 @@ bx_pit_c::periodic( Bit32u usec_delta
case 1: // Mode 1: Retriggerable One-Shot
// wraps after count expires
- bx_panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
+ bio->panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
i, (unsigned) BX_PIT_THIS s.timer[i].mode);
break;
@@ -818,30 +818,30 @@ bx_pit_c::periodic( Bit32u usec_delta
// counter expired, reload
BX_PIT_THIS s.timer[i].counter = BX_PIT_THIS s.timer[i].counter_max;
BX_PIT_THIS s.timer[i].OUT = !BX_PIT_THIS s.timer[i].OUT;
- //bx_printf("CV: reload t%u to %04x\n", (unsigned) i, (unsigned)
+ //bio->printf("[PIT] CV: reload t%u to %04x\n", (unsigned) i, (unsigned)
// BX_PIT_THIS s.timer[i].counter);
}
else {
// decrement counter by elapsed useconds
BX_PIT_THIS s.timer[i].counter -= (Bit16u ) ( 2*usec_delta );
- //bx_printf("CV: dec count to %04x\n",
+ //bio->printf("[PIT] CV: dec count to %04x\n",
// (unsigned) BX_PIT_THIS s.timer[i].counter);
}
break;
case 4: // Mode 4: Software Triggered Strobe
// wraps after count expires
- bx_panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
+ bio->panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
i, (unsigned) BX_PIT_THIS s.timer[i].mode);
break;
case 5: // Mode 5: Hardware Retriggerable Strobe
// wraps after count expires
- bx_panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
+ bio->panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
i, (unsigned) BX_PIT_THIS s.timer[i].mode);
break;
default:
- bx_panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
+ bio->panic("bx_pit_c::periodic: bad mode: timer[%u], mode %u\n",
i, (unsigned) BX_PIT_THIS s.timer[i].mode);
break;
} // switch ( BX_PIT_THIS s.tim...

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-iodev_sb16_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/sb16.cc.orig Sat Mar 25 21:34:08 2000
+++ iodev/sb16.cc Tue Oct 17 12:04:02 2000
@@ -104,7 +104,7 @@ void bx_sb16_c::init(bx_devices_c *d)
LOGFILE = fopen(bx_options.sb16.logfile,"w"); // logfile for errors etc.
if (LOGFILE == NULL)
{
- bx_printf("#SB16: Error opening file %s. Logging disabled.", bx_options.sb16.logfile);
+ bio->printf("#SB16: Error opening file %s. Logging disabled.", bx_options.sb16.logfile);
bx_options.sb16.loglevel = 0;
}
}
@@ -156,7 +156,7 @@ void bx_sb16_c::init(bx_devices_c *d)
bx_options.sb16.wavemode = 0;
}
- bx_printf("#SB16 options: midi=%d,%s wave=%d,%s log=%d,%s dmatimer=%d\n",
+ bio->printf("#SB16 options: midi=%d,%s wave=%d,%s log=%d,%s dmatimer=%d\n",
bx_options.sb16.midimode, bx_options.sb16.midifile,
bx_options.sb16.wavemode, bx_options.sb16.wavefile,
bx_options.sb16.loglevel, bx_options.sb16.logfile,
@@ -3227,7 +3227,7 @@ Boolean bx_sb16_buffer::puts(char *data,
va_end(ap);
if ( (int) strlen(string) >= length)
- bx_panic("bx_sb16_buffer: puts() too long!\n");
+ bio->panic("bx_sb16_buffer: puts() too long!\n");
while (string[index] != 0)
{

View File

@ -0,0 +1,269 @@
--- iodev/serial.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/serial.cc Tue Oct 17 12:04:02 2000
@@ -31,10 +31,12 @@
// define USE_TTY_HACK to connect an xterm or similar (depends on tty.c)
// to the serial port /AM
+// #define USE_TTY_HACK
+// #define USE_RAW_SERIAL
#include "bochs.h"
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
#include <signal.h>
#endif
@@ -47,7 +49,7 @@
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
extern "C" {
#include <termios.h>
};
@@ -58,7 +60,7 @@ bx_serial_c bx_serial;
#define this (&bx_serial)
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
static struct termios term_orig, term_new;
#endif
@@ -66,7 +68,7 @@ static int tty_id;
bx_serial_c::bx_serial_c(void)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
tcgetattr(0, &term_orig);
bcopy((caddr_t) &term_orig, (caddr_t) &term_new, sizeof(struct termios));
cfmakeraw(&term_new);
@@ -85,18 +87,19 @@ bx_serial_c::bx_serial_c(void)
tcsetattr(0, TCSAFLUSH, &term_new);
#endif
// nothing for now
-#if USE_RAW_SERIAL
- raw = new serial_raw("/dev/cua0", SIGUSR1);
+#if defined(USE_RAW_SERIAL)
+ /* raw = new bx_serial_raw("/dev/cua0", SIGUSR1); */
+ raw = new bx_serial_raw("/dev/ttyq6", SIGUSR1);
#endif // USE_RAW_SERIAL
}
bx_serial_c::~bx_serial_c(void)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
tcsetattr(0, TCSAFLUSH, &term_orig);
#endif
// nothing for now
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
delete raw;
#endif // USE_RAW_SERIAL
}
@@ -106,17 +109,18 @@ bx_serial_c::~bx_serial_c(void)
bx_serial_c::init(bx_devices_c *d)
{
BX_SER_THIS devices = d;
+ bio->printf("serial\n");
BX_SER_THIS devices->register_irq(4, "Serial Port 1");
#if defined (USE_TTY_HACK)
tty_id = tty_alloc("Bx Serial Console, Your Window to the 8250");
if (tty_id > 0)
- bx_printf("TTY Allocated fd = %d\n", tty_get_fd(tty_id));
+ bio->printf("TTY Allocated fd = %d\n", tty_get_fd(tty_id));
else
- bx_printf("TTY allocation failed\n");
+ bio->printf("TTY allocation failed\n");
#else
- bx_printf("TTY not used, serial port is not connected\n");
+ bio->printf("TTY not used, serial port is not connected\n");
#endif
/*
@@ -235,12 +239,12 @@ bx_serial_c::read(Bit32u address, unsign
/* SERIAL PORT 1 */
if (io_len > 1)
- bx_panic("serial: io read from port %04x, bad len=%u\n",
+ bio->panic("serial: io read from port %04x, bad len=%u\n",
(unsigned) address,
(unsigned) io_len);
- if (bx_dbg.serial)
- bx_printf("serial register read from address 0x%x - ",
+ if (bio->getdbg().serial)
+ bio->printf("serial register read from address 0x%x - ",
(unsigned) address);
switch (address) {
@@ -346,13 +350,13 @@ bx_serial_c::read(Bit32u address, unsign
default:
val = 0; // keep compiler happy
- bx_panic("unsupported serial io read from address=%0x%x!\n",
+ bio->panic("unsupported serial io read from address=%0x%x!\n",
(unsigned) address);
break;
}
- if (bx_dbg.serial)
- bx_printf("val = 0x%x\n",
+ if (bio->getdbg().serial)
+ bio->printf("val = 0x%x\n",
(unsigned) val);
return(val);
@@ -381,11 +385,11 @@ bx_serial_c::write(Bit32u address, Bit32
/* SERIAL PORT 1 */
if (io_len > 1)
- bx_panic("serial: io write to address %08x len=%u\n",
+ bio->panic("serial: io write to address %08x len=%u\n",
(unsigned) address, (unsigned) io_len);
- if (bx_dbg.serial)
- bx_printf("serial: write to address: 0x%x = 0x%x\n",
+ if (bio->getdbg().serial)
+ bio->printf("serial: write to address: 0x%x = 0x%x\n",
(unsigned) address, (unsigned) value);
switch (address) {
@@ -397,7 +401,7 @@ bx_serial_c::write(Bit32u address, Bit32
BX_SER_THIS s[0].baudrate = (int) (BX_PC_CLOCK_XTL /
(16 * ((BX_SER_THIS s[0].divisor_msb << 8) |
BX_SER_THIS s[0].divisor_lsb)));
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
BX_SER_THIS raw->set_baudrate(BX_SER_THIS s[0].baudrate);
#endif // USE_RAW_SERIAL
}
@@ -418,7 +422,7 @@ bx_serial_c::write(Bit32u address, Bit32
(int) (1000000.0 / (BX_SER_THIS s[0].baudrate / 8)),
0); /* not continuous */
} else {
- bx_printf("serial: write to tx hold register when not empty\n");
+ bio->printf("serial: write to tx hold register when not empty\n");
}
}
break;
@@ -431,7 +435,7 @@ bx_serial_c::write(Bit32u address, Bit32
BX_SER_THIS s[0].baudrate = (int) (BX_PC_CLOCK_XTL /
(16 * ((BX_SER_THIS s[0].divisor_msb << 8) |
BX_SER_THIS s[0].divisor_lsb)));
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
BX_SER_THIS raw->set_baudrate(BX_SER_THIS s[0].baudrate);
#endif // USE_RAW_SERIAL
}
@@ -448,13 +452,13 @@ bx_serial_c::write(Bit32u address, Bit32
break;
case 0x03FB: /* Line control register */
-#if !USE_RAW_SERIAL
+#if !defined(USE_RAW_SERIAL)
if ((value & 0x3) != 0x3) {
/* ignore this: this is set by FreeBSD when the console
code wants to set DLAB */
}
#endif // !USE_RAW_SERIAL
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
if (BX_SER_THIS s[0].line_cntl.wordlen_sel != (value & 0x3)) {
BX_SER_THIS raw->set_data_bits((value & 0x3) + 5);
}
@@ -466,12 +470,12 @@ bx_serial_c::write(Bit32u address, Bit32
BX_SER_THIS s[0].line_cntl.stick_parity != (value & 0x20) >> 5) {
if (((value & 0x20) >> 5) &&
((value & 0x8) >> 3))
- bx_panic("[serial] sticky parity set and parity enabled");
+ bio->panic("[serial] sticky parity set and parity enabled");
BX_SER_THIS raw->set_parity_mode(((value & 0x8) >> 3),
- ((value & 0x10) >> 4) ? P_EVEN : P_ODD);
+ ((value & 0x10) >> 4) ? PAREVEN : PARODD);
}
if (BX_SER_THIS s[0].line_cntl.break_cntl && !((value & 0x40) >> 6)) {
- BX_SER_THIS raw->transmit(C_BREAK);
+ BX_SER_THIS raw->transmit(CBREAK);
}
#endif // USE_RAW_SERIAL
@@ -494,8 +498,8 @@ bx_serial_c::write(Bit32u address, Bit32
(int) (1000000.0 / (BX_SER_THIS s[0].baudrate / 4)),
0); /* not continuous */
}
- if (bx_dbg.serial) {
- bx_printf("serial: baud rate set - %d\n", BX_SER_THIS s[0].baudrate);
+ if (bio->getdbg().serial) {
+ bio->printf("serial: baud rate set - %d\n", BX_SER_THIS s[0].baudrate);
}
}
BX_SER_THIS s[0].line_cntl.dlab = (value & 0x80) >> 7;
@@ -503,7 +507,7 @@ bx_serial_c::write(Bit32u address, Bit32
case 0x03FC: /* MODEM control register */
if ((value & 0x01) == 0) {
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
BX_SER_THIS raw->send_hangup();
#endif
}
@@ -530,12 +534,12 @@ bx_serial_c::write(Bit32u address, Bit32
case 0x03FD: /* Line status register */
/* XXX ignore ? */
- bx_panic("serial: write to line status register\n");
+ bio->panic("serial: write to line status register\n");
break;
case 0x03FE: /* MODEM status register */
/* XXX ignore ? */
- bx_panic("serial: write to MODEM status register\n");
+ bio->panic("serial: write to MODEM status register\n");
break;
case 0x03FF: /* scratch register */
@@ -543,7 +547,7 @@ bx_serial_c::write(Bit32u address, Bit32
break;
default:
- bx_panic("unsupported serial io write to address=0x%x, value = 0x%x!\n",
+ bio->panic("unsupported serial io write to address=0x%x, value = 0x%x!\n",
(unsigned) address, (unsigned) value);
break;
}
@@ -582,9 +586,9 @@ bx_serial_c::tx_timer(void)
} else {
#if defined (USE_TTY_HACK)
tty(tty_id, 0, & BX_SER_THIS s[0].txbuffer);
-#elif USE_RAW_SERIAL
+#elif defined(USE_RAW_SERIAL)
if (!BX_SER_THIS raw->ready_transmit())
- bx_panic("[serial] Not ready to transmit");
+ bio->panic("[serial] Not ready to transmit");
BX_SER_THIS raw->transmit(BX_SER_THIS s[0].txbuffer);
#elif 0
write(0, (bx_ptr_t) & BX_SER_THIS s[0].txbuffer, 1);
@@ -634,13 +638,13 @@ bx_serial_c::rx_timer(void)
#if defined (USE_TTY_HACK)
if (tty_prefetch_char(tty_id)) {
tty(tty_id, 1, &chbuf);
-#elif USE_RAW_SERIAL
+#elif defined(USE_RAW_SERIAL)
Boolean rdy;
uint16 data;
if ((rdy = BX_SER_THIS raw->ready_receive())) {
data = BX_SER_THIS raw->receive();
- if (data == C_BREAK) {
- bx_printf("[serial] Got BREAK\n");
+ if (data == CBREAK) {
+ bio->printf("[serial] Got BREAK\n");
BX_SER_THIS s[0].line_status.break_int = 1;
rdy = 0;
}

View File

@ -0,0 +1,22 @@
--- iodev/serial.h.orig Wed Oct 4 11:15:45 2000
+++ iodev/serial.h Wed Oct 4 11:16:51 2000
@@ -24,7 +24,7 @@
// Peter Grehan (grehan@iprg.nokia.com) coded most of this
// serial emulation.
-#if USE_RAW_SERIAL
+#if defined(USE_RAW_SERIAL)
#include "serial_raw.h"
#endif // USE_RAW_SERIAL
@@ -162,8 +162,8 @@ private:
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
#endif
-#if USE_RAW_SERIAL
- serial_raw* raw;
+#if defined(USE_RAW_SERIAL)
+ bx_serial_raw* raw;
#endif // USE_RAW_SERIAL
};

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-iodev_soundlnx_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- iodev/soundlnx.cc.orig Sat Mar 25 21:34:46 2000
+++ iodev/soundlnx.cc Tue Oct 17 12:04:02 2000
@@ -76,7 +76,7 @@ int bx_sound_linux_c::openmidioutput(cha
int bx_sound_linux_c::sendmidicommand(int delta, int command, int length, Bit8u data[])
{
UNUSED(delta);
- // bx_panic("Sendmidicommand!!");
+ // bio->panic("Sendmidicommand!!");
fputc(command, midi);
fwrite(data, 1, length, midi);

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-iodev_soundwin_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- iodev/soundwin.cc.orig Sat Mar 25 21:35:09 2000
+++ iodev/soundwin.cc Tue Oct 17 12:04:02 2000
@@ -58,7 +58,7 @@ bx_sound_windows_c::bx_sound_windows_c(b
DataPointer = (Bit8u*) GlobalLock(DataHandle);
if (DataPointer == NULL)
- bx_panic("GlobalLock returned NULL-pointer");
+ bio->panic("GlobalLock returned NULL-pointer");
#define NEWBUFFER(size) &(DataPointer[offset]); offset += ALIGN(size)
@@ -73,7 +73,7 @@ bx_sound_windows_c::bx_sound_windows_c(b
}
if (offset > size)
- bx_panic("Allocated memory was too small!");
+ bio->panic("Allocated memory was too small!");
#undef size
#undef ALIGN

View File

@ -0,0 +1,112 @@
$OpenBSD: patch-iodev_unmapped_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- iodev/unmapped.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/unmapped.cc Tue Oct 17 12:04:02 2000
@@ -107,7 +107,7 @@ bx_unmapped_c::read(Bit32u address, unsi
#endif
case 0x03df:
retval = 0xffffffff;
- /* bx_printf("unsupported IO read from port %04x (CGA)\n", address);*/
+ /* bio->printf("unsupported IO read from port %04x (CGA)\n", address);*/
break;
case 0x023a:
case 0x02f8: /* UART */
@@ -130,28 +130,28 @@ bx_unmapped_c::read(Bit32u address, unsi
case 0x03fd: /* UART */
case 0x17c6:
retval = 0xffffffff;
- /* bx_printf("unsupported IO read from port %04x\n", address); */
+ /* bio->printf("unsupported IO read from port %04x\n", address); */
break;
default:
retval = 0xffffffff;
}
return_from_read:
- if (bx_dbg.unsupported_io)
+ if (bio->getdbg().unsupported_io)
switch (io_len) {
case 1:
retval = (Bit8u)retval;
- bx_printf("unmapped: 8-bit read from %04x = %02x\n", address, retval);
+ bio->printf("unmapped: 8-bit read from %04x = %02x\n", address, retval);
break;
case 2:
retval = (Bit16u)retval;
- bx_printf("unmapped: 16-bit read from %04x = %04x\n", address, retval);
+ bio->printf("unmapped: 16-bit read from %04x = %04x\n", address, retval);
break;
case 4:
- bx_printf("unmapped: 32-bit read from %04x = %08x\n", address, retval);
+ bio->printf("unmapped: 32-bit read from %04x = %08x\n", address, retval);
break;
default:
- bx_printf("unmapped: ??-bit read from %04x = %x\n", address, retval);
+ bio->printf("unmapped: ??-bit read from %04x = %x\n", address, retval);
}
return retval;
}
@@ -190,7 +190,7 @@ bx_unmapped_c::write(Bit32u address, Bit
switch (address) {
case 0x80: // diagnostic test port to display progress of POST
- //bx_printf("Diagnostic port 80h: write = %02xh\n", (unsigned) value);
+ //bio->printf("Diagnostic port 80h: write = %02xh\n", (unsigned) value);
BX_UM_THIS s.port80 = value;
break;
@@ -229,12 +229,12 @@ bx_unmapped_c::write(Bit32u address, Bit
case 0x3eb:
case 0x3ec:
case 0x3ed:
- // bx_printf("unsupported IO write to port %04x of %02x\n",
+ // bio->printf("unsupported IO write to port %04x of %02x\n",
// address, value);
break;
case 0xfedc:
- bx_dbg.debugger = (value > 0);
-fprintf(stderr, "# DEBUGGER = %u\n", (unsigned) bx_dbg.debugger);
+ bio->getdbg().debugger = (value > 0);
+fprintf(stderr, "# DEBUGGER = %u\n", (unsigned) bio->getdbg().debugger);
break;
case 0xfff0:
@@ -244,12 +244,12 @@ fprintf(stderr, "# DEBUGGER = %u\n", (un
if ( BX_UM_THIS s.bios_message_i >= BX_BIOS_MESSAGE_SIZE ) {
BX_UM_THIS s.bios_message[ BX_BIOS_MESSAGE_SIZE - 1] = 0;
BX_UM_THIS s.bios_message_i = 0;
- bx_printf("BIOS message: %s\n", BX_UM_THIS s.bios_message);
+ bio->printf("BIOS message: %s\n", BX_UM_THIS s.bios_message);
}
else if ((value & 0xff) == '\n') {
BX_UM_THIS s.bios_message[ BX_UM_THIS s.bios_message_i ] = 0;
BX_UM_THIS s.bios_message_i = 0;
- bx_printf("BIOS message: %s\n", BX_UM_THIS s.bios_message);
+ bio->printf("BIOS message: %s\n", BX_UM_THIS s.bios_message);
}
break;
@@ -257,19 +257,19 @@ fprintf(stderr, "# DEBUGGER = %u\n", (un
break;
}
return_from_write:
- if (bx_dbg.unsupported_io)
+ if (bio->getdbg().unsupported_io)
switch (io_len) {
case 1:
- bx_printf("unmapped: 8-bit write to %04x = %02x\n", address, value);
+ bio->printf("unmapped: 8-bit write to %04x = %02x\n", address, value);
break;
case 2:
- bx_printf("unmapped: 16-bit write to %04x = %04x\n", address, value);
+ bio->printf("unmapped: 16-bit write to %04x = %04x\n", address, value);
break;
case 4:
- bx_printf("unmapped: 32-bit write to %04x = %08x\n", address, value);
+ bio->printf("unmapped: 32-bit write to %04x = %08x\n", address, value);
break;
default:
- bx_printf("unmapped: ??-bit write to %04x = %x\n", address, value);
+ bio->printf("unmapped: ??-bit write to %04x = %x\n", address, value);
break;
}
}

View File

@ -0,0 +1,873 @@
$OpenBSD: patch-iodev_vga_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- iodev/vga.cc.orig Sat Mar 25 21:28:49 2000
+++ iodev/vga.cc Tue Oct 31 12:25:06 2000
@@ -188,14 +188,17 @@ bx_vga_c::init(bx_devices_c *d, bx_cmos_
bx_gui.init(1, &argv[0], BX_VGA_THIS s.x_tilesize, BX_VGA_THIS s.y_tilesize);
}
- bx_printf("vga: interval=%lu\n", bx_options.vga_update_interval);
- bx_pc_system.register_timer(this, timer_handler,
- bx_options.vga_update_interval, 1, 1);
+ //if(bio->getdbg().video)
+ bio->printf("[VGA] interval=%lu\n",
+ bx_options.vga_update_interval);
+ bx_pc_system.register_timer(this, timer_handler,
+ bx_options.vga_update_interval, 1, 1);
- cmos->s.reg[0x14] = (cmos->s.reg[0x14] & 0xcf) | 0x00; /* video card with BIOS ROM */
+ cmos->s.reg[0x14] = (cmos->s.reg[0x14] & 0xcf) | 0x00;
+ /* video card with BIOS ROM */
- BX_VGA_THIS s.horiz_tick = 0;
- BX_VGA_THIS s.vert_tick = 0;
+ BX_VGA_THIS s.horiz_tick = 0;
+ BX_VGA_THIS s.vert_tick = 0;
}
@@ -314,7 +317,7 @@ bx_vga_c::read(Bit32u address, unsigned
#endif
if (io_len > 1)
- bx_panic("vga: io read from address %08x, len=%u\n",
+ bio->panic("[VGA] io read from address %08x, len=%u\n",
(unsigned) address, (unsigned) io_len);
#ifdef __OS2__
@@ -325,8 +328,8 @@ bx_vga_c::read(Bit32u address, unsigned
#endif
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga_io_read(%04x)!\n", (unsigned) address);
+ if (bio->getdbg().video)
+ bio->printf("[VGA] vga_io_read(%04x)!\n", (unsigned) address);
#endif
if ( (address >= 0x03b0) && (address <= 0x03bf) &&
@@ -350,7 +353,7 @@ bx_vga_c::read(Bit32u address, unsigned
// 1 = display is not in the display mode; either the
// horizontal or vertical retrace period is active
- // printf("horiz = %d, vert = %d\n", BX_VGA_THIS s.horiz_tick, BX_VGA_THIS s.vert_tick);
+ // printf("[VGA] horiz = %d, vert = %d\n", BX_VGA_THIS s.horiz_tick, BX_VGA_THIS s.vert_tick);
if (BX_VGA_THIS s.horiz_tick >= 100) { // ??? bogus # 100
BX_VGA_THIS s.horiz_tick = 0;
@@ -383,14 +386,15 @@ bx_vga_c::read(Bit32u address, unsigned
case 0x03c0: /* */
if (BX_VGA_THIS s.attribute_ctrl.flip_flop == 0) {
- //bx_printf("vga_io_read: 3c0: flip_flop = 0\n");
+ if(bio->getdbg().video)
+ bio->printf("[VGA] vga_io_read: 3c0: flip_flop = 0\n");
retval =
(BX_VGA_THIS s.attribute_ctrl.video_enabled << 5) |
BX_VGA_THIS s.attribute_ctrl.address;
RETURN(retval);
}
else {
- bx_panic("vga_io_read: 3c0: flip_flop = 0\n");
+ bio->panic("vga_io_read: 3c0: flip_flop = 0\n");
return(0);
}
break;
@@ -428,14 +432,16 @@ bx_vga_c::read(Bit32u address, unsigned
RETURN(BX_VGA_THIS s.attribute_ctrl.color_select);
break;
default:
- bx_printf("vga_io_read: 3c1: address %02xh?\n",
- (unsigned) BX_VGA_THIS s.attribute_ctrl.address);
+ if(bio->getdbg().video)
+ bio->printf("[VGA] vga_io_read: 3c1: address %02xh?\n",
+ (unsigned) BX_VGA_THIS s.attribute_ctrl.address);
RETURN(0);
}
break;
case 0x03c2: /* Input Status 0 */
- bx_printf("vga: io read 3c2: input status #0: ignoring\n");
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io read 3c2: input status #0: ignoring\n");
RETURN(0);
break;
@@ -446,11 +452,13 @@ bx_vga_c::read(Bit32u address, unsigned
case 0x03c5: /* Sequencer Registers 00..04 */
switch (BX_VGA_THIS s.sequencer.index) {
case 0: /* sequencer: reset */
-bx_printf("*** io read 3c5 case 0: sequencer reset\n");
+ if(bio->getdbg().video)
+bio->printf("[VGA] *** io read 3c5 case 0: sequencer reset\n");
RETURN(BX_VGA_THIS s.sequencer.bit0 | (BX_VGA_THIS s.sequencer.bit1<<1));
break;
case 1: /* sequencer: clocking mode */
-bx_printf("*** io read 3c5 case 1: sequencer clocking mode\n");
+ if(bio->getdbg().video)
+bio->printf("[VGA] *** io read 3c5 case 1: sequencer clocking mode\n");
RETURN(BX_VGA_THIS s.sequencer.reg1);
break;
case 2: /* sequencer: map mask register */
@@ -468,7 +476,8 @@ bx_printf("*** io read 3c5 case 1: seque
break;
default:
- bx_printf("vga: io read 3c5: index %u unhandled\n",
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io read 3c5: index %u unhandled\n",
(unsigned) BX_VGA_THIS s.sequencer.index);
RETURN(0);
}
@@ -490,7 +499,8 @@ bx_printf("*** io read 3c5 case 1: seque
retval = BX_VGA_THIS s.pel.data[BX_VGA_THIS s.pel.read_data_register].blue;
break;
default:
- bx_panic("vga: io write 3c9: data cyle is bad value\n");
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io write 3c9: data cyle is bad value\n");
retval = 0; // keep compiler happy
}
BX_VGA_THIS s.pel.read_data_cycle++;
@@ -517,7 +527,8 @@ bx_printf("*** io read 3c5 case 1: seque
break;
case 0x03cd: /* ??? */
- bx_printf("vga: io read from 03cd\n");
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io read from 0x03cd\n");
RETURN(0x00);
break;
@@ -548,10 +559,11 @@ bx_printf("*** io read 3c5 case 1: seque
((BX_VGA_THIS s.graphics_ctrl.read_mode & 0x01) << 3) |
((BX_VGA_THIS s.graphics_ctrl.write_mode & 0x03) << 0);
-if (BX_VGA_THIS s.graphics_ctrl.odd_even ||
- BX_VGA_THIS s.graphics_ctrl.shift_reg)
- bx_printf("read 3cf: reg 05 = %02x\n", (unsigned) retval);
- RETURN(retval);
+ if (BX_VGA_THIS s.graphics_ctrl.odd_even ||
+ BX_VGA_THIS s.graphics_ctrl.shift_reg)
+ if(bio->getdbg().video)
+ bio->printf("[VGA] read 3cf: reg 05 = %02x\n", (unsigned) retval);
+ RETURN(retval);
break;
case 6: /* Miscellaneous */
retval =
@@ -568,11 +580,13 @@ if (BX_VGA_THIS s.graphics_ctrl.odd_even
break;
default:
/* ??? */
- bx_printf("vga: io read: 3cf: index %u unhandled\n",
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io read: 3cf: index %u unhandled\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.index);
RETURN(0);
}
- bx_panic("vga: io read: 3cf: shouldn't get here\n");
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io read: 3cf: shouldn't get here\n");
break;
case 0x03d4: /* CRTC Index Register (color emulation modes) */
@@ -581,9 +595,10 @@ if (BX_VGA_THIS s.graphics_ctrl.odd_even
case 0x03b5: /* CRTC Registers (monochrome emulation modes) */
case 0x03d5: /* CRTC Registers (color emulation modes) */
- if (BX_VGA_THIS s.CRTC.address > 0x18)
- bx_printf("vga_io_read: 3d5: address = %02xh\n",
- (unsigned) BX_VGA_THIS s.CRTC.address);
+ if(bio->getdbg().video)
+ if (BX_VGA_THIS s.CRTC.address > 0x18)
+ bio->printf("vga_io_read: 3d5: address = %02xh\n",
+ (unsigned) BX_VGA_THIS s.CRTC.address);
RETURN(BX_VGA_THIS s.CRTC.reg[BX_VGA_THIS s.CRTC.address]);
break;
@@ -592,14 +607,15 @@ if (BX_VGA_THIS s.graphics_ctrl.odd_even
case 0x03c7: /* */
case 0x03c8: /* */
default:
- bx_panic("*** io read from vga port %x\n", (unsigned) address);
- RETURN(0); /* keep compiler happy */
+ if(bio->getdbg().video)
+ bio->printf("[VGA] *** io read from vga port %x\n", (unsigned) address);
+ RETURN(0);
}
#if defined(VGA_TRACE_FEATURE)
read_return:
- if (bx_dbg.video)
- bx_printf("vga: 8-bit read from %04x = %02x\n", (unsigned) address, ret);
+ if (bio->getdbg().video)
+ bio->printf("[VGA] 8-bit read from %04x = %02x\n", (unsigned) address, ret);
return ret;
#endif
}
@@ -646,22 +662,22 @@ bx_vga_c::write(Bit32u address, Bit32u v
Boolean needs_update;
#if defined(VGA_TRACE_FEATURE)
- if (!no_log && bx_dbg.video)
+ if (!no_log && bio->getdbg().video)
switch (io_len) {
case 1:
- bx_printf("vga: 8-bit write to %04x = %02x\n", (unsigned)address, (unsigned)value);
+ bio->printf("[VGA] 8-bit write to %04x = %02x\n", (unsigned)address, (unsigned)value);
break;
case 2:
- bx_printf("vga: 16-bit write to %04x = %04x\n", (unsigned)address, (unsigned)value);
+ bio->printf("[VGA] 16-bit write to %04x = %04x\n", (unsigned)address, (unsigned)value);
break;
default:
- bx_panic("Weird VGA write size\n");
+ bio->printf("Weird VGA write size\n");
}
#endif
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga_io_write(%04x)=%02x!\n", (unsigned) address,
+ if (bio->getdbg().video)
+ bio->printf("[VGA] vga_io_write(%04x)=%02x!\n", (unsigned) address,
(unsigned) value);
#endif
@@ -694,25 +710,25 @@ bx_vga_c::write(Bit32u address, Bit32u v
switch (address) {
case 0x03b4: /* CRTC Index Register (monochrome emulation modes) */
if (value > 0x18)
- bx_panic("vga: io write 3b4: value > 18h\n");
+ bio->panic("[VGA] io write 3b4: value > 18h\n");
BX_VGA_THIS s.CRTC.address = value;
break;
case 0x03b5: /* CRTC Registers (monochrome emulation modes) */
- if (BX_VGA_THIS s.CRTC.address > 0x18)
- bx_panic("vga: io write 3b5: CRTC reg > 18h\n");
+ if (BX_VGA_THIS s.CRTC.address > 0x18 && bio->getdbg().video)
+ bio->printf("[VGA] io write 3b5: CRTC reg > 18h\n");
BX_VGA_THIS s.CRTC.reg[BX_VGA_THIS s.CRTC.address] = value;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: mono CRTC Reg[%u] = %02x\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] mono CRTC Reg[%u] = %02x\n",
(unsigned) BX_VGA_THIS s.CRTC.address, (unsigned) value);
#endif
break;
case 0x03ba: /* Feature Control (monochrome emulation modes) */
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3ba: feature control: ignoring\n");
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3ba: feature control: ignoring\n");
#endif
break;
@@ -721,16 +737,16 @@ bx_vga_c::write(Bit32u address, Bit32u v
prev_video_enabled = BX_VGA_THIS s.attribute_ctrl.video_enabled;
BX_VGA_THIS s.attribute_ctrl.video_enabled = (value >> 5) & 0x01;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c0: video_enabled = %u\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: video_enabled = %u\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.video_enabled);
#endif
if (BX_VGA_THIS s.attribute_ctrl.video_enabled == 0)
bx_gui.clear_screen();
else if (!prev_video_enabled) {
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("found enable transition\n");
+ if (bio->getdbg().video)
+ bio->printf("[VGA] found enable transition\n");
#endif
// Mark all video as updated so the color changes will go through
memset(BX_VGA_THIS s.text_snapshot, 0,
@@ -752,7 +768,8 @@ bx_vga_c::write(Bit32u address, Bit32u v
break;
default:
- bx_printf("vga: io write 3c0: address mode reg=%u\n",
+ if(bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: address mode reg=%u\n",
(unsigned) value);
}
}
@@ -764,7 +781,7 @@ bx_vga_c::write(Bit32u address, Bit32u v
case 0x0c: case 0x0d: case 0x0e: case 0x0f:
BX_VGA_THIS s.attribute_ctrl.palette_reg[BX_VGA_THIS s.attribute_ctrl.address] =
value;
- //bx_printf("vga: io write: 3c0 palette reg[%u] = %02x\n",
+ //bio->printf("[VGA] io write: 3c0 palette reg[%u] = %02x\n",
// (unsigned) BX_VGA_THIS s.attribute_ctrl.address,
// (unsigned) value);
break;
@@ -784,45 +801,45 @@ bx_vga_c::write(Bit32u address, Bit32u v
BX_VGA_THIS s.attribute_ctrl.mode_ctrl.internal_palette_size =
(value >> 7) & 0x01;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c0: mode control: %02x h\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: mode control: %02x h\n",
(unsigned) value);
#endif
break;
case 0x11: // Overscan Color Register
BX_VGA_THIS s.attribute_ctrl.overscan_color = (value & 0x3f);
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c0: overscan color = %02x\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: overscan color = %02x\n",
(unsigned) value);
#endif
break;
case 0x12: // Color Plane Enable Register
BX_VGA_THIS s.attribute_ctrl.color_plane_enable = (value & 0x0f);
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c0: color plane enable = %02x\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: color plane enable = %02x\n",
(unsigned) value);
#endif
break;
case 0x13: // Horizontal Pixel Panning Register
BX_VGA_THIS s.attribute_ctrl.horiz_pel_panning = (value & 0x0f);
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c0: horiz pel panning = %02x\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: horiz pel panning = %02x\n",
(unsigned) value);
#endif
break;
case 0x14: // Color Select Register
BX_VGA_THIS s.attribute_ctrl.color_select = (value & 0x0f);
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c0: color select = %02x\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c0: color select = %02x\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.color_select);
#endif
break;
default:
- bx_printf("vga: io write 3c0: data-write mode %02x h\n",
+ bio->printf("[VGA] io write 3c0: data-write mode %02x h\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.address);
}
}
@@ -837,19 +854,19 @@ bx_vga_c::write(Bit32u address, Bit32u v
BX_VGA_THIS s.misc_output.horiz_sync_pol = (value >> 6) & 0x01;
BX_VGA_THIS s.misc_output.vert_sync_pol = (value >> 7) & 0x01;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video) {
- bx_printf("vga: io write 3c2:\n");
- bx_printf(" color_emulation (attempted) = %u\n",
+ if (bio->getdbg().video) {
+ bio->printf("[VGA] io write 3c2:\n");
+ bio->printf("[VGA] color_emulation (attempted) = %u\n",
(value >> 0) & 0x01 );
- bx_printf(" enable_ram = %u\n",
+ bio->printf("[VGA] enable_ram = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.enable_ram);
- bx_printf(" clock_select = %u\n",
+ bio->printf("[VGA] clock_select = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.clock_select);
- bx_printf(" select_high_bank = %u\n",
+ bio->printf("[VGA] select_high_bank = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.select_high_bank);
- bx_printf(" horiz_sync_pol = %u\n",
+ bio->printf("[VGA] horiz_sync_pol = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.horiz_sync_pol);
- bx_printf(" vert_sync_pol = %u\n",
+ bio->printf("[VGA] vert_sync_pol = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.vert_sync_pol);
}
#endif
@@ -858,15 +875,15 @@ bx_vga_c::write(Bit32u address, Bit32u v
case 0x03c3: // VGA enable
// bit0: enables VGA display if set
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c3: (ignoring) VGA enable = %u\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c3: (ignoring) VGA enable = %u\n",
(unsigned) (value & 0x01) );
#endif
break;
case 0x03c4: /* Sequencer Index Register */
- if (value > 4) {
- bx_printf("vga: io write 3c4: value > 4\n");
+ if (value > 4 && bio->getdbg().video) {
+ bio->printf("[VGA] io write 3c4: value > 4\n");
}
BX_VGA_THIS s.sequencer.index = value;
break;
@@ -875,8 +892,8 @@ bx_vga_c::write(Bit32u address, Bit32u v
switch (BX_VGA_THIS s.sequencer.index) {
case 0: /* sequencer: reset */
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c5=%02x: reset reg: ignoring\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c5=%02x: reset reg: ignoring\n",
(unsigned) value);
#endif
BX_VGA_THIS s.sequencer.bit0 = (value >> 0) & 0x01;
@@ -884,8 +901,8 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
break;
case 1: /* sequencer: clocking mode */
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write 3c5=%02x: clocking mode reg: ignoring\n",
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write 3c5=%02x: clocking mode reg: ignoring\n",
(unsigned) value);
#endif
BX_VGA_THIS s.sequencer.reg1 = value & 0x3f;
@@ -904,27 +921,28 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
BX_VGA_THIS s.sequencer.chain_four = (value >> 3) & 0x01;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video) {
- bx_printf("vga: io write 3c5: index 4:\n");
- bx_printf(" extended_mem %u\n",
+ if (bio->getdbg().video) {
+ bio->printf("[VGA] io write 3c5: index 4:\n");
+ bio->printf("[VGA] extended_mem %u\n",
(unsigned) BX_VGA_THIS s.sequencer.extended_mem);
- bx_printf(" odd_even %u\n",
+ bio->printf("[VGA] odd_even %u\n",
(unsigned) BX_VGA_THIS s.sequencer.odd_even);
- bx_printf(" chain_four %u\n",
+ bio->printf("[VGA] chain_four %u\n",
(unsigned) BX_VGA_THIS s.sequencer.chain_four);
}
#endif
break;
default:
- bx_printf("vga: io write 3c5: index %u unhandled\n",
- (unsigned) BX_VGA_THIS s.sequencer.index);
+ if(bio->getdbg().floppy)
+ bio->printf("[VGA] io write 3c5: index %u unhandled\n",
+ (unsigned) BX_VGA_THIS s.sequencer.index);
}
break;
case 0x03c6: /* PEL mask */
BX_VGA_THIS s.pel.mask = value;
if (BX_VGA_THIS s.pel.mask != 0xff)
- bx_printf("vga: io write 3c6: PEL mask=0x%02x != 0xFF\n");
+ bio->printf("[VGA] io write 3c6: PEL mask=0x%02x != 0xFF\n");
// BX_VGA_THIS s.pel.mask should be and'd with final value before
// indexing into color registerBX_VGA_THIS s.
break;
@@ -970,12 +988,12 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
}
break;
default:
- bx_panic("vga: io write 3c9: data cyle is bad value\n");
+ bio->panic("[VGA] io write 3c9: data cyle is bad value\n");
}
BX_VGA_THIS s.pel.write_data_cycle++;
if (BX_VGA_THIS s.pel.write_data_cycle >= 3) {
- //bx_printf("vga: BX_VGA_THIS s.pel.data[%u] {r=%u, g=%u, b=%u}\n",
+ //bio->printf("[VGA] BX_VGA_THIS s.pel.data[%u] {r=%u, g=%u, b=%u}\n",
// (unsigned) BX_VGA_THIS s.pel.write_data_register,
// (unsigned) BX_VGA_THIS s.pel.data[BX_VGA_THIS s.pel.write_data_register].red,
// (unsigned) BX_VGA_THIS s.pel.data[BX_VGA_THIS s.pel.write_data_register].green,
@@ -995,12 +1013,12 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
case 0x03ce: /* Graphics Controller Index Register */
if (value > 0x08) /* ??? */
- bx_printf("vga: io write: 3ce: value > 8\n");
+ bio->printf("[VGA] io write: 3ce: value > 8\n");
BX_VGA_THIS s.graphics_ctrl.index = value;
break;
case 0x03cd: /* ??? */
- bx_printf("vga: io write to 03cd = %02x\n", (unsigned) value);
+ bio->printf("[VGA] io write to 03cd = %02x\n", (unsigned) value);
break;
case 0x03cf: /* Graphics Controller Registers 00..08 */
@@ -1022,8 +1040,8 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
case 4: /* Read Map Select */
BX_VGA_THIS s.graphics_ctrl.read_map_select = value & 0x03;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video)
- bx_printf("vga: io write to 03cf = %02x (RMS)\n", (unsigned) value);
+ if (bio->getdbg().video)
+ bio->printf("[VGA] io write to 03cf = %02x (RMS)\n", (unsigned) value);
#endif
break;
case 5: /* Mode */
@@ -1032,11 +1050,11 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
BX_VGA_THIS s.graphics_ctrl.odd_even = (value >> 4) & 0x01;
BX_VGA_THIS s.graphics_ctrl.shift_reg = (value >> 5) & 0x03;
- if (BX_VGA_THIS s.graphics_ctrl.odd_even)
- bx_printf("vga: io write: 3cf: reg 05: value = %02xh\n",
+ if (BX_VGA_THIS s.graphics_ctrl.odd_even && bio->getdbg().video)
+ bio->printf("[VGA] io write: 3cf: reg 05: value = %02xh\n",
(unsigned) value);
- if (BX_VGA_THIS s.graphics_ctrl.shift_reg)
- bx_printf("vga: io write: 3cf: reg 05: value = %02xh\n",
+ if (BX_VGA_THIS s.graphics_ctrl.shift_reg && bio->getdbg().video)
+ bio->printf("[VGA] io write: 3cf: reg 05: value = %02xh\n",
(unsigned) value);
break;
case 6: /* Miscellaneous */
@@ -1048,14 +1066,14 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
BX_VGA_THIS s.graphics_ctrl.chain_odd_even = (value >> 1) & 0x01;
BX_VGA_THIS s.graphics_ctrl.memory_mapping = (value >> 2) & 0x03;
#if !defined(VGA_TRACE_FEATURE)
- if (bx_dbg.video) {
- bx_printf("memory_mapping set to %u\n",
+ if (bio->getdbg().video) {
+ bio->printf("[VGA] memory_mapping set to %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.memory_mapping);
- bx_printf("graphics mode set to %u\n",
+ bio->printf("[VGA] graphics mode set to %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.graphics_alpha);
- bx_printf("odd_even mode set to %u\n",
+ bio->printf("[VGA] odd_even mode set to %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.odd_even);
- bx_printf("vga: io write: 3cf: reg 06: value = %02xh\n",
+ bio->printf("[VGA] io write: 3cf: reg 06: value = %02xh\n",
(unsigned) value);
}
#endif
@@ -1073,7 +1091,7 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
break;
default:
/* ??? */
- bx_printf("vga: io write: 3cf: index %u unhandled\n",
+ bio->printf("[VGA] io write: 3cf: index %u unhandled\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.index);
}
break;
@@ -1081,16 +1099,18 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
case 0x03d4: /* CRTC Index Register (color emulation modes) */
BX_VGA_THIS s.CRTC.address = value;
if (BX_VGA_THIS s.CRTC.address > 0x18)
- bx_printf("vga_io_write: 3d4: address = %02xh\n",
+ if(bio->getdbg().video)
+ bio->printf("[VGA] vga_io_write: 3d4: address = %02xh\n",
(unsigned) BX_VGA_THIS s.CRTC.address);
break;
case 0x03d5: /* CRTC Registers (color emulation modes) */
if (BX_VGA_THIS s.CRTC.address > 0x18)
- bx_printf("vga_io_write: 3d5: address = %02xh\n",
+ if(bio->getdbg().video)
+ bio->printf("[VGA] vga_io_write: 3d5: address = %02xh\n",
(unsigned) BX_VGA_THIS s.CRTC.address);
BX_VGA_THIS s.CRTC.reg[BX_VGA_THIS s.CRTC.address] = value;
- //bx_printf("vga: color CRTC Reg[%u] = %02x\n",
+ //bio->printf("[VGA] color CRTC Reg[%u] = %02x\n",
// (unsigned) BX_VGA_THIS s.CRTC.address, (unsigned) value);
if (BX_VGA_THIS s.CRTC.address>=0x0C || BX_VGA_THIS s.CRTC.address<=0x0F) {
// Start Address or Cursor Location change
@@ -1099,12 +1119,13 @@ BX_VGA_THIS s.sequencer.bit1 = (value >>
break;
case 0x03da: /* Feature Control (color emulation modes) */
- bx_printf("vga: io write: 3da: ignoring: feature ctrl & vert sync\n");
+ if(bio->getdbg().floppy)
+ bio->printf("[VGA] io write: 3da: ignoring: feature ctrl & vert sync\n");
break;
case 0x03c1: /* */
default:
- bx_panic("vga: unsupported io write to port %x, val=%02x\n",
+ bio->panic("[VGA] unsupported io write to port %x, val=%02x\n",
(unsigned) address, (unsigned) value);
}
}
@@ -1138,11 +1159,11 @@ bx_vga_c::update(void)
// (modes 4 & 5)
// 2: output data 8 bits at a time from the 4 bit planes
// (mode 13 and variants like modeX)
-//fprintf(stderr, "# update()\n");
+//bio->printf("# update()\n");
// if (BX_VGA_THIS s.vga_mem_updated==0 || BX_VGA_THIS s.attribute_ctrl.video_enabled == 0)
if (BX_VGA_THIS s.vga_mem_updated==0) {
-//bx_printf("update(): updated=%u enabled=%u\n",
+//bio->printf("[VGA] update(): updated=%u enabled=%u\n",
//(unsigned) BX_VGA_THIS s.vga_mem_updated, (unsigned) BX_VGA_THIS s.attribute_ctrl.video_enabled);
return;
}
@@ -1156,7 +1177,7 @@ bx_vga_c::update(void)
unsigned xti, yti;
-//bx_printf("update: shiftreg=%u, chain4=%u, mapping=%u\n",
+//bio->printf("[VGA] update: shiftreg=%u, chain4=%u, mapping=%u\n",
// (unsigned) BX_VGA_THIS s.graphics_ctrl.shift_reg,
// (unsigned) BX_VGA_THIS s.sequencer.chain_four,
// (unsigned) BX_VGA_THIS s.graphics_ctrl.memory_mapping);
@@ -1170,7 +1191,7 @@ bx_vga_c::update(void)
determine_screen_dimensions(&iHeight, &iWidth);
- //bx_printf("update(): Mode 12h: 640x480x16colors\n");
+ //bio->printf("[VGA] update(): Mode 12h: 640x480x16colors\n");
bx_gui.dimension_update(iWidth, iHeight);
for (yti=0; yti<iHeight/Y_TILESIZE; yti++)
@@ -1216,7 +1237,7 @@ bx_vga_c::update(void)
case 1: // output the data in a CGA-compatible 320x200 4 color graphics
// mode. (modes 4 & 5)
- bx_panic("update: shift_reg == 1\n");
+ bio->panic("update: shift_reg == 1\n");
break; // case 1
case 2: // output the data eight bits at a time from the 4 bit planeBX_VGA_THIS s.
@@ -1228,7 +1249,7 @@ bx_vga_c::update(void)
// bx_vga_dump_status();
if (BX_VGA_THIS s.misc_output.select_high_bank != 1)
- bx_panic("update: select_high_bank != 1\n");
+ bio->panic("update: select_high_bank != 1\n");
bx_gui.dimension_update(iWidth, iHeight);
for (yti=0; yti<iHeight/Y_TILESIZE; yti++)
@@ -1284,7 +1305,7 @@ bx_vga_c::update(void)
break; // case 2
default:
- bx_panic("update: shift_reg == %u\n", (unsigned)
+ bio->panic("update: shift_reg == %u\n", (unsigned)
BX_VGA_THIS s.graphics_ctrl.shift_reg );
}
@@ -1300,7 +1321,7 @@ bx_vga_c::update(void)
switch (BX_VGA_THIS s.graphics_ctrl.memory_mapping) {
case 2: // B0000 .. B7FFF
bx_gui.dimension_update(8*80, 16*25); // ??? should use font size
-//bx_printf("update(): case 2\n");
+//bio->printf("[VGA] update(): case 2\n");
/* pass old text snapshot & new VGA memory contents */
start_address = 2*((BX_VGA_THIS s.CRTC.reg[12] << 8) + BX_VGA_THIS s.CRTC.reg[13]);
cursor_address = 2*((BX_VGA_THIS s.CRTC.reg[0x0e] << 8) |
@@ -1334,7 +1355,7 @@ bx_vga_c::update(void)
MSL = bx_vga.s.CRTC.reg[0x09] & 0x1f;
rows = (VDE+1)/(MSL+1);
if (rows > BX_MAX_TEXT_LINES)
- bx_panic("vga: text rows>50\n");
+ bio->panic("[VGA] text rows>50\n");
bx_gui.dimension_update(8*80, 16*rows); // ??? should use font size
// pass old text snapshot & new VGA memory contents
start_address = 2*((BX_VGA_THIS s.CRTC.reg[12] << 8) + BX_VGA_THIS s.CRTC.reg[13]);
@@ -1358,7 +1379,7 @@ bx_vga_c::update(void)
BX_VGA_THIS s.vga_mem_updated = 0;
break;
default:
- bx_printf("update(): color text mode: mem map is %u\n",
+ bio->printf("[VGA] update(): color text mode: mem map is %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.memory_mapping);
}
}
@@ -1372,8 +1393,8 @@ bx_vga_c::mem_read(Bit32u addr)
#if defined(VGA_TRACE_FEATURE)
-// if (bx_dbg.video)
-// bx_printf("vga: 8-bit memory read from %08x\n", addr);
+// if (bio->getdbg().video)
+// bio->printf("[VGA] 8-bit memory read from %08x\n", addr);
#endif
// ??? should get rid of references to shift_reg in this function
@@ -1397,14 +1418,14 @@ bx_vga_c::mem_read(Bit32u addr)
offset = addr - 0xB8000;
if (BX_VGA_THIS s.graphics_ctrl.shift_reg != 2)
- bx_panic("vga_mem_read: shift_reg = %u\n",
+ bio->panic("vga_mem_read: shift_reg = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.shift_reg);
return(BX_VGA_THIS s.vga_memory[offset]);
}
if (BX_VGA_THIS s.graphics_ctrl.memory_mapping != 1) {
- bx_printf(" location %08x\n", (unsigned) addr);
- bx_panic("vga_mem_read: graphics: mapping = %u?\n",
+ bio->printf("[VGA] location %08x\n", (unsigned) addr);
+ bio->panic("vga_mem_read: graphics: mapping = %u?\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.memory_mapping);
return(0);
}
@@ -1462,7 +1483,7 @@ bx_vga_c::mem_read(Bit32u addr)
break;
default:
- bx_panic("vga_mem_read: read mode %u ?\n",
+ bio->panic("vga_mem_read: read mode %u ?\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.read_mode);
return(0);
}
@@ -1480,8 +1501,8 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u v
Bit8u new_bit, new_val[4], cpu_data_b[4];
#if defined(VGA_TRACE_FEATURE)
-// if (bx_dbg.video)
-// bx_printf("vga: 8-bit memory write to %08x = %02x\n", addr, value);
+// if (bio->getdbg().video)
+// bio->printf("[VGA] 8-bit memory write to %08x = %02x\n", addr, value);
#endif
#ifdef __OS2__
@@ -1510,7 +1531,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u v
offset = addr - 0xB8000;
}
else {
- bx_panic("vga_mem_write: graphics: mapping = %u\n",
+ bio->panic("vga_mem_write: graphics: mapping = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.memory_mapping);
return;
}
@@ -1576,7 +1597,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u v
(new_bit ^ (BX_VGA_THIS s.graphics_ctrl.latch[i] & and_mask));
break;
default:
- bx_panic("vga_mem_write: write mode 0: op = %u\n",
+ bio->panic("vga_mem_write: write mode 0: op = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.raster_op);
}
}
@@ -1600,7 +1621,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u v
case 2: /* write mode 2 */
if (BX_VGA_THIS s.graphics_ctrl.raster_op)
- bx_panic("vga_mem_write: write mode 2: op = %u\n",
+ bio->panic("vga_mem_write: write mode 2: op = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.raster_op);
bitmask = BX_VGA_THIS s.graphics_ctrl.bitmask;
for (i=0; i<4; i++ ) {
@@ -1624,7 +1645,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u v
case 2: /* OR */
case 3: /* XOR */
default:
- bx_panic("vga_mem_write: raster_op = %u?\n",
+ bio->panic("vga_mem_write: raster_op = %u?\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.raster_op);
}
}
@@ -1695,7 +1716,7 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u v
break;
default:
- bx_panic("vga_mem_write: write mode %u ?\n",
+ bio->panic("vga_mem_write: write mode %u ?\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.write_mode);
}
@@ -1729,65 +1750,65 @@ BX_VGA_THIS s.vga_tile_updated[x_tileno]
void
bx_vga_c::dump_status(void)
{
- bx_printf("s.misc_output.color_emulation = %u\n",
+ bio->printf("[VGA] s.misc_output.color_emulation = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.color_emulation);
- bx_printf("s.misc_output.enable_ram = %u\n",
+ bio->printf("[VGA] s.misc_output.enable_ram = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.enable_ram);
- bx_printf("s.misc_output.clock_select = %u\n",
+ bio->printf("[VGA] s.misc_output.clock_select = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.clock_select);
if (BX_VGA_THIS s.misc_output.clock_select == 0)
- bx_printf(" 25Mhz 640 horiz pixel clock\n");
+ bio->printf("[VGA] 25Mhz 640 horiz pixel clock\n");
else
- bx_printf(" 28Mhz 720 horiz pixel clock\n");
- bx_printf("s.misc_output.select_high_bank = %u\n",
+ bio->printf("[VGA] 28Mhz 720 horiz pixel clock\n");
+ bio->printf("[VGA] s.misc_output.select_high_bank = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.select_high_bank);
- bx_printf("s.misc_output.horiz_sync_pol = %u\n",
+ bio->printf("[VGA] s.misc_output.horiz_sync_pol = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.horiz_sync_pol);
- bx_printf("s.misc_output.vert_sync_pol = %u\n",
+ bio->printf("[VGA] s.misc_output.vert_sync_pol = %u\n",
(unsigned) BX_VGA_THIS s.misc_output.vert_sync_pol);
switch ( (BX_VGA_THIS s.misc_output.vert_sync_pol << 1) |
BX_VGA_THIS s.misc_output.horiz_sync_pol ) {
- case 0: bx_printf(" (reserved\n"); break;
- case 1: bx_printf(" 400 lines\n"); break;
- case 2: bx_printf(" 350 lines\n"); break;
- case 3: bx_printf(" 480 lines\n"); break;
- default: bx_printf(" ???\n");
+ case 0: bio->printf("[VGA] (reserved\n"); break;
+ case 1: bio->printf("[VGA] 400 lines\n"); break;
+ case 2: bio->printf("[VGA] 350 lines\n"); break;
+ case 3: bio->printf("[VGA] 480 lines\n"); break;
+ default: bio->printf("[VGA] ???\n");
}
- bx_printf("s.graphics_ctrl.odd_even = %u\n",
+ bio->printf("[VGA] s.graphics_ctrl.odd_even = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.odd_even);
- bx_printf("s.graphics_ctrl.chain_odd_even = %u\n",
+ bio->printf("[VGA] s.graphics_ctrl.chain_odd_even = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.chain_odd_even);
- bx_printf("s.graphics_ctrl.shift_reg = %u\n",
+ bio->printf("[VGA] s.graphics_ctrl.shift_reg = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.shift_reg);
- bx_printf("s.graphics_ctrl.graphics_alpha = %u\n",
+ bio->printf("[VGA] s.graphics_ctrl.graphics_alpha = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.graphics_alpha);
- bx_printf("s.graphics_ctrl.memory_mapping = %u\n",
+ bio->printf("[VGA] s.graphics_ctrl.memory_mapping = %u\n",
(unsigned) BX_VGA_THIS s.graphics_ctrl.memory_mapping);
switch (BX_VGA_THIS s.graphics_ctrl.memory_mapping) {
- case 0: bx_printf(" A0000-BFFFF\n"); break;
- case 1: bx_printf(" A0000-AFFFF\n"); break;
- case 2: bx_printf(" B0000-B7FFF\n"); break;
- case 3: bx_printf(" B8000-BFFFF\n"); break;
- default: bx_printf(" ???\n");
+ case 0: bio->printf("[VGA] A0000-BFFFF\n"); break;
+ case 1: bio->printf("[VGA] A0000-AFFFF\n"); break;
+ case 2: bio->printf("[VGA] B0000-B7FFF\n"); break;
+ case 3: bio->printf("[VGA] B8000-BFFFF\n"); break;
+ default: bio->printf("[VGA] ???\n");
}
- bx_printf("s.sequencer.extended_mem = %u\n",
+ bio->printf("[VGA] s.sequencer.extended_mem = %u\n",
(unsigned) BX_VGA_THIS s.sequencer.extended_mem);
- bx_printf("s.sequencer.odd_even = %u (inverted)\n",
+ bio->printf("[VGA] s.sequencer.odd_even = %u (inverted)\n",
(unsigned) BX_VGA_THIS s.sequencer.odd_even);
- bx_printf("s.sequencer.chain_four = %u\n",
+ bio->printf("[VGA] s.sequencer.chain_four = %u\n",
(unsigned) BX_VGA_THIS s.sequencer.chain_four);
- bx_printf("s.attribute_ctrl.video_enabled = %u\n",
+ bio->printf("[VGA] s.attribute_ctrl.video_enabled = %u\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.video_enabled);
- bx_printf("s.attribute_ctrl.mode_ctrl.graphics_alpha = %u\n",
+ bio->printf("[VGA] s.attribute_ctrl.mode_ctrl.graphics_alpha = %u\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.mode_ctrl.graphics_alpha);
- bx_printf("s.attribute_ctrl.mode_ctrl.display_type = %u\n",
+ bio->printf("[VGA] s.attribute_ctrl.mode_ctrl.display_type = %u\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.mode_ctrl.display_type);
- bx_printf("s.attribute_ctrl.mode_ctrl.internal_palette_size = %u\n",
+ bio->printf("[VGA] s.attribute_ctrl.mode_ctrl.internal_palette_size = %u\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.mode_ctrl.internal_palette_size);
- bx_printf("s.attribute_ctrl.mode_ctrl.pixel_clock_select = %u\n",
+ bio->printf("[VGA] s.attribute_ctrl.mode_ctrl.pixel_clock_select = %u\n",
(unsigned) BX_VGA_THIS s.attribute_ctrl.mode_ctrl.pixel_clock_select);
}

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-load32bitOShack_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- load32bitOShack.cc.orig Sat Mar 25 21:23:19 2000
+++ load32bitOShack.cc Tue Oct 17 12:04:03 2000
@@ -45,7 +45,7 @@ bx_load32bitOSimagehack(void)
fp = fopen(bx_options.load32bitOSImage.iolog, "r");
if (fp == NULL) {
- bx_panic("could not open IO init file.\n");
+ bio->panic("could not open IO init file.\n");
}
while (1) {
@@ -54,7 +54,7 @@ bx_load32bitOSimagehack(void)
ret = fscanf(fp, "%u %u %x %x\n",
&len, &op, &port, &val);
if (ret != 4) {
- bx_panic("could not open IO init file.\n");
+ bio->panic("could not open IO init file.\n");
}
if (op == 0) {
// read
@@ -65,7 +65,7 @@ bx_load32bitOSimagehack(void)
bx_devices.outp(port, val, len);
}
else {
- bx_panic("bad IO op in init filen");
+ bio->panic("bad IO op in init filen");
}
if (feof(fp)) break;
}
@@ -79,7 +79,7 @@ bx_load32bitOSimagehack(void)
bx_load_null_kernel_hack();
break;
default:
- bx_panic("load32bitOSImage: OS not recognized\n");
+ bio->panic("load32bitOSImage: OS not recognized\n");
}
}

View File

@ -0,0 +1,981 @@
$OpenBSD: patch-main_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- main.cc.orig Sat Mar 25 21:23:20 2000
+++ main.cc Mon Oct 23 22:12:22 2000
@@ -26,10 +26,12 @@
-void bx_signal_handler(int signum);
-
-
-
+#include "config.h"
+// Need bxio to be created before the first usage in bx_cpu_c::bx_cpu_c,
+// or any other object
+#include "bxio.h"
+bxio bbio(stderr);
+class bxio *bio = &bbio;
#include "bochs.h"
#include "state_file.h"
@@ -53,7 +55,6 @@ void bx_close_harddrive(void);
-void bx_init_debug(void);
void bx_emulate_hga_dumps_timer(void);
/* typedefs */
@@ -65,19 +66,6 @@ class state_file state_stuff("state_file
#endif
-FILE *bx_logfd = NULL; /* for logging bx_printf() messages */
-
-
-
-
-
-
-bx_debug_t bx_dbg;
-
-
-
-
-
bx_options_t bx_options = {
{ "", BX_FLOPPY_NONE, BX_EJECTED },
{ "", BX_FLOPPY_NONE, BX_EJECTED },
@@ -109,7 +97,6 @@ static void parse_line_unformatted(char
static void parse_line_formatted(int num_params, char *params[]);
static void parse_bochsrc(void);
-
int
main(int argc, char *argv[])
{
@@ -138,8 +125,10 @@ bx_bochs_init(int argc, char *argv[])
{
int n;
+ bio->init_log(logfilename);
+
#ifdef MAGIC_BREAKPOINT
- bx_dbg.magic_break_enabled = 0;
+ bio->getdbg().magic_break_enabled = 0;
#endif
/* read the .bochsrc file */
@@ -165,16 +154,6 @@ bx_bochs_init(int argc, char *argv[])
bx_pc_system.init_ips(bx_options.ips);
- if (!strcmp(logfilename, "-")) {
- bx_logfd = stderr;
- }
- else {
- bx_logfd = fopen(logfilename, "w");
- if (!bx_logfd) {
- fprintf(stderr, "could not open log file '%s'\n", logfilename);
- exit(1);
- }
- }
#if BX_DEBUGGER == 0
// debugger will do this work, if enabled
@@ -184,20 +163,12 @@ bx_bochs_init(int argc, char *argv[])
BX_MEM.load_ROM(bx_options.vgarom.path, 0xc0000);
#endif
- bx_init_debug();
-
#if BX_DEBUGGER == 0
bx_devices.init();
bx_pc_system.start_timers();
#endif
-// if not using debugger, then we can take control of SIGINT.
-// If using debugger, it needs control of this.
-#if BX_DEBUGGER==0
- signal(SIGINT, bx_signal_handler);
-#endif
-
#if BX_SHOW_IPS
#ifndef __MINGW32__
signal(SIGALRM, bx_signal_handler);
@@ -208,123 +179,6 @@ bx_bochs_init(int argc, char *argv[])
return(0);
}
-
-
- void
-bx_init_debug(void)
-{
- bx_dbg.floppy = 0;
- bx_dbg.keyboard = 0;
- bx_dbg.video = 0;
- bx_dbg.disk = 0;
- bx_dbg.pit = 0;
- bx_dbg.pic = 0;
- bx_dbg.bios = 0;
- bx_dbg.cmos = 0;
- bx_dbg.a20 = 0;
- bx_dbg.interrupts = 0;
- bx_dbg.exceptions = 0;
- bx_dbg.unsupported = 0;
- bx_dbg.temp = 0;
- bx_dbg.reset = 0;
- bx_dbg.mouse = 0;
- bx_dbg.io = 0;
- bx_dbg.debugger = 0;
- bx_dbg.xms = 0;
- bx_dbg.v8086 = 0;
- bx_dbg.paging = 0;
- bx_dbg.creg = 0;
- bx_dbg.dreg = 0;
- bx_dbg.dma = 0;
- bx_dbg.unsupported_io = 0;
- bx_dbg.record_io = 0;
- bx_dbg.serial = 0;
- bx_dbg.cdrom = 0;
-}
-
-
-
- void
-bx_printf(char *fmt, ...)
-{
- va_list ap;
-
- if (bx_logfd) {
- fprintf(bx_logfd, "%lld ", bx_pc_system.time_ticks());
-
- va_start(ap, fmt);
- vfprintf(bx_logfd, fmt, ap);
- va_end(ap);
- }
-
- fflush(bx_logfd);
-}
-
-
-
- void
-bx_atexit(void)
-{
- static Boolean been_here = 0;
-
-
-#if BX_PROVIDE_DEVICE_MODELS==1
- if (been_here == 0) {
- bx_pc_system.exit();
- }
-#endif
-
-#if BX_DEBUGGER == 0
- BX_CPU.atexit();
-#endif
-
- if (bx_logfd) {
-#if BX_PCI_SUPPORT
- if (bx_options.i440FXSupport) {
- bx_devices.pci->print_i440fx_state(bx_logfd);
- }
-#endif
- fprintf(stderr, "bochs exited, log file was '%s'\n",
- logfilename);
- fflush(bx_logfd);
- fclose(bx_logfd);
- bx_logfd = NULL;
- }
-}
-
-
-
- void
-bx_panic(char *fmt, ...)
-{
- va_list ap;
-#if BX_DEBUGGER
- static Boolean dbg_exit_called = 0;
-#endif
-
- if (bx_logfd) {
- fprintf(bx_logfd, "bochs: panic, ");
-
- va_start(ap, fmt);
- vfprintf(bx_logfd, fmt, ap);
- va_end(ap);
- }
-
- bx_atexit();
-
-#if !BX_DEBUGGER
- exit(1);
-#else
- if (dbg_exit_called == 0) {
- dbg_exit_called = 1;
- bx_dbg_exit(1);
- }
-#endif
-}
-
-
-
-
#if (BX_PROVIDE_CPU_MEMORY==1) && (BX_EMULATE_HGA_DUMPS>0)
void
bx_emulate_hga_dumps_timer(void)
@@ -349,15 +203,16 @@ parse_bochsrc(void)
ptr = getenv("HOME");
if (!ptr) {
- fprintf(stderr, "could not get environment variable 'HOME'.\n");
- exit(1);
+ bio->printf( "could not get environment variable 'HOME'.\n");
+ bio->printf( "Using '/' instead.\n");
+ ptr = "/";
}
strcpy(bochsrc_path, ".bochsrc");
fd = fopen(bochsrc_path, "r");
if (!fd) {
- fprintf(stderr, "could not open file '%s', trying home directory.\n",
+ bio->printf( "could not open file '%s', trying home directory.\n",
bochsrc_path);
strcpy(bochsrc_path, ptr);
@@ -366,16 +221,16 @@ parse_bochsrc(void)
fd = fopen(bochsrc_path, "r");
if (!fd) {
- fprintf(stderr, "could not open file '%s'.\n", bochsrc_path);
+ bio->printf( "could not open file '%s'.\n", bochsrc_path);
// no file used, nothing left to do. This is now valid,
// as you can pass everything on the command line.
return;
}
else
- bx_printf("using rc file '%s'.\n", bochsrc_path);
+ bio->printf("parse: using rc file '%s'.\n", bochsrc_path);
}
else
- bx_printf("using rc file '%s'.\n", bochsrc_path);
+ bio->printf("parse: using rc file '%s'.\n", bochsrc_path);
#else
// try opening file bochsrc only in current directory for win32
@@ -383,7 +238,7 @@ parse_bochsrc(void)
fd = fopen(bochsrc_path, "r");
if (!fd) {
- fprintf(stderr, "could not open file '%s' in current directory.\n",
+ bio->printf( "could not open file '%s' in current directory.\n",
bochsrc_path);
exit(1);
}
@@ -450,7 +305,11 @@ parse_line_formatted(int num_params, cha
if (params[0][0] == '#') return; /* comment */
else if (!strcmp(params[0], "floppya")) {
for (i=1; i<num_params; i++) {
- if (!strncmp(params[i], "1_44=", 5)) {
+ if (!strncmp(params[i], "2_88=", 5)) {
+ strcpy(bx_options.floppya.path, &params[i][5]);
+ bx_options.floppya.type = BX_FLOPPY_2_88;
+ }
+ else if (!strncmp(params[i], "1_44=", 5)) {
strcpy(bx_options.floppya.path, &params[i][5]);
bx_options.floppya.type = BX_FLOPPY_1_44;
}
@@ -469,7 +328,7 @@ parse_line_formatted(int num_params, cha
bx_options.floppya.initial_status = BX_INSERTED;
}
else {
- fprintf(stderr, ".bochsrc: floppya attribute '%s' not understood.\n",
+ bio->printf( ".bochsrc: floppya attribute '%s' not understood.\n",
params[i]);
exit(1);
}
@@ -478,7 +337,11 @@ parse_line_formatted(int num_params, cha
else if (!strcmp(params[0], "floppyb")) {
for (i=1; i<num_params; i++) {
- if (!strncmp(params[i], "1_44=", 5)) {
+ if (!strncmp(params[i], "2_88=", 5)) {
+ strcpy(bx_options.floppyb.path, &params[i][5]);
+ bx_options.floppyb.type = BX_FLOPPY_2_88;
+ }
+ else if (!strncmp(params[i], "1_44=", 5)) {
strcpy(bx_options.floppyb.path, &params[i][5]);
bx_options.floppyb.type = BX_FLOPPY_1_44;
}
@@ -497,7 +360,7 @@ parse_line_formatted(int num_params, cha
bx_options.floppyb.initial_status = BX_INSERTED;
}
else {
- fprintf(stderr, ".bochsrc: floppyb attribute '%s' not understood.\n",
+ bio->printf( ".bochsrc: floppyb attribute '%s' not understood.\n",
params[i]);
exit(1);
}
@@ -506,14 +369,14 @@ parse_line_formatted(int num_params, cha
else if (!strcmp(params[0], "diskc")) {
if (num_params != 5) {
- fprintf(stderr, ".bochsrc: diskc directive malformed.\n");
+ bio->printf( ".bochsrc: diskc directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "file=", 5) ||
strncmp(params[2], "cyl=", 4) ||
strncmp(params[3], "heads=", 6) ||
strncmp(params[4], "spt=", 4)) {
- fprintf(stderr, ".bochsrc: diskc directive malformed.\n");
+ bio->printf( ".bochsrc: diskc directive malformed.\n");
exit(1);
}
strcpy(bx_options.diskc.path, &params[1][5]);
@@ -523,16 +386,15 @@ parse_line_formatted(int num_params, cha
bx_options.diskc.present = 1;
}
else if (!strcmp(params[0], "diskd")) {
- bx_panic("Diskd not implemented. Use cdromd for CD-ROM support.\n");
if (num_params != 5) {
- fprintf(stderr, ".bochsrc: diskd directive malformed.\n");
+ bio->printf( ".bochsrc: diskd directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "file=", 5) ||
strncmp(params[2], "cyl=", 4) ||
strncmp(params[3], "heads=", 6) ||
strncmp(params[4], "spt=", 4)) {
- fprintf(stderr, ".bochsrc: diskd directive malformed.\n");
+ bio->printf( ".bochsrc: diskd directive malformed.\n");
exit(1);
}
strcpy(bx_options.diskd.path, &params[1][5]);
@@ -544,11 +406,11 @@ parse_line_formatted(int num_params, cha
else if (!strcmp(params[0], "cdromd")) {
if (num_params != 3) {
- fprintf(stderr, ".bochsrc: cdromd directive malformed.\n");
+ bio->printf( ".bochsrc: cdromd directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "dev=", 4) || strncmp(params[2], "status=", 7)) {
- fprintf(stderr, ".bochsrc: cdromd directive malformed.\n");
+ bio->printf( ".bochsrc: cdromd directive malformed.\n");
exit(1);
}
strcpy(bx_options.cdromd.dev, &params[1][4]);
@@ -557,7 +419,7 @@ parse_line_formatted(int num_params, cha
else if (!strcmp(params[2], "status=ejected"))
bx_options.cdromd.inserted = 0;
else {
- fprintf(stderr, ".bochsrc: cdromd directive malformed.\n");
+ bio->printf( ".bochsrc: cdromd directive malformed.\n");
exit(1);
}
bx_options.cdromd.present = 1;
@@ -569,30 +431,31 @@ parse_line_formatted(int num_params, cha
strcpy(bx_options.bootdrive, params[1]);
}
else {
- fprintf(stderr, ".bochsrc: boot directive with unknown boot device '%s'.\n",
+ bio->printf( ".bochsrc: boot directive with unknown boot device '%s'.\n",
params[1]);
- fprintf(stderr, " use 'a', or 'c'.\n");
+ bio->printf( " use 'a', or 'c'.\n");
exit(1);
}
}
else if (!strcmp(params[0], "log")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: log directive has wrong # args.\n");
+ bio->printf( ".bochsrc: log directive has wrong # args.\n");
exit(1);
}
strcpy(logfilename, params[1]);
+ bio->init_log(logfilename);
}
else if (!strcmp(params[0], "romimage")) {
if (num_params != 3) {
- fprintf(stderr, ".bochsrc: romimage directive: wrong # args.\n");
+ bio->printf( ".bochsrc: romimage directive: wrong # args.\n");
exit(1);
}
if (strncmp(params[1], "file=", 5)) {
- fprintf(stderr, ".bochsrc: romimage directive malformed.\n");
+ bio->printf( ".bochsrc: romimage directive malformed.\n");
exit(1);
}
if (strncmp(params[2], "address=", 8)) {
- fprintf(stderr, ".bochsrc: romimage directive malformed.\n");
+ bio->printf( ".bochsrc: romimage directive malformed.\n");
exit(1);
}
bx_options.rom.path = strdup(&params[1][5]);
@@ -603,69 +466,69 @@ parse_line_formatted(int num_params, cha
}
else if (!strcmp(params[0], "vgaromimage")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: vgaromimage directive: wrong # args.\n");
+ bio->printf( ".bochsrc: vgaromimage directive: wrong # args.\n");
exit(1);
}
bx_options.vgarom.path = strdup(params[1]);
}
else if (!strcmp(params[0], "vga_update_interval")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: vga_update_interval directive: wrong # args.\n");
+ bio->printf( ".bochsrc: vga_update_interval directive: wrong # args.\n");
exit(1);
}
bx_options.vga_update_interval = atol(params[1]);
if (bx_options.vga_update_interval < 50000) {
- fprintf(stderr, ".bochsrc: vga_update_interval not big enough!\n");
+ bio->printf( ".bochsrc: vga_update_interval not big enough!\n");
exit(1);
}
}
else if (!strcmp(params[0], "keyboard_serial_delay")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: keyboard_serial_delay directive: wrong # args.\n");
+ bio->printf( ".bochsrc: keyboard_serial_delay directive: wrong # args.\n");
exit(1);
}
bx_options.keyboard_serial_delay = atol(params[1]);
if (bx_options.keyboard_serial_delay < 5) {
- fprintf(stderr, ".bochsrc: keyboard_serial_delay not big enough!\n");
+ bio->printf( ".bochsrc: keyboard_serial_delay not big enough!\n");
exit(1);
}
}
else if (!strcmp(params[0], "megs")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: megs directive: wrong # args.\n");
+ bio->printf( ".bochsrc: megs directive: wrong # args.\n");
exit(1);
}
bx_options.memory.megs = atol(params[1]);
}
else if (!strcmp(params[0], "floppy_command_delay")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: floppy_command_delay directive: wrong # args.\n");
+ bio->printf( ".bochsrc: floppy_command_delay directive: wrong # args.\n");
exit(1);
}
bx_options.floppy_command_delay = atol(params[1]);
if (bx_options.floppy_command_delay < 100) {
- fprintf(stderr, ".bochsrc: floppy_command_delay not big enough!\n");
+ bio->printf( ".bochsrc: floppy_command_delay not big enough!\n");
exit(1);
}
}
else if (!strcmp(params[0], "ips")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: ips directive: wrong # args.\n");
+ bio->printf( ".bochsrc: ips directive: wrong # args.\n");
exit(1);
}
bx_options.ips = atol(params[1]);
if (bx_options.ips < 200000) {
- fprintf(stderr, ".bochsrc: WARNING: ips is AWEFULLY low!\n");
+ bio->printf( ".bochsrc: WARNING: ips is AWEFULLY low!\n");
}
}
else if (!strcmp(params[0], "mouse")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: mouse directive malformed.\n");
+ bio->printf( ".bochsrc: mouse directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "enabled=", 8)) {
- fprintf(stderr, ".bochsrc: mouse directive malformed.\n");
+ bio->printf( ".bochsrc: mouse directive malformed.\n");
exit(1);
}
if (params[1][8] == '0')
@@ -673,17 +536,17 @@ parse_line_formatted(int num_params, cha
else if (params[1][8] == '1')
bx_options.mouse_enabled = 1;
else {
- fprintf(stderr, ".bochsrc: mouse directive malformed.\n");
+ bio->printf( ".bochsrc: mouse directive malformed.\n");
exit(1);
}
}
else if (!strcmp(params[0], "private_colormap")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: private_colormap directive malformed.\n");
+ bio->printf( ".bochsrc: private_colormap directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "enabled=", 8)) {
- fprintf(stderr, ".bochsrc: private_colormap directive malformed.\n");
+ bio->printf( ".bochsrc: private_colormap directive malformed.\n");
exit(1);
}
if (params[1][8] == '0')
@@ -691,7 +554,7 @@ parse_line_formatted(int num_params, cha
else if (params[1][8] == '1')
bx_options.private_colormap = 1;
else {
- fprintf(stderr, ".bochsrc: private_colormap directive malformed.\n");
+ bio->printf( ".bochsrc: private_colormap directive malformed.\n");
exit(1);
}
}
@@ -724,11 +587,11 @@ parse_line_formatted(int num_params, cha
else if (!strcmp(params[0], "i440fxsupport")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: i440FXSupport directive malformed.\n");
+ bio->printf( ".bochsrc: i440FXSupport directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "enabled=", 8)) {
- fprintf(stderr, ".bochsrc: i440FXSupport directive malformed.\n");
+ bio->printf( ".bochsrc: i440FXSupport directive malformed.\n");
exit(1);
}
if (params[1][8] == '0')
@@ -736,17 +599,17 @@ parse_line_formatted(int num_params, cha
else if (params[1][8] == '1')
bx_options.i440FXSupport = 1;
else {
- fprintf(stderr, ".bochsrc: i440FXSupport directive malformed.\n");
+ bio->printf( ".bochsrc: i440FXSupport directive malformed.\n");
exit(1);
}
}
else if (!strcmp(params[0], "newharddrivesupport")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: newharddrivesupport directive malformed.\n");
+ bio->printf( ".bochsrc: newharddrivesupport directive malformed.\n");
exit(1);
}
if (strncmp(params[1], "enabled=", 8)) {
- fprintf(stderr, ".bochsrc: newharddrivesupport directive malformed.\n");
+ bio->printf( ".bochsrc: newharddrivesupport directive malformed.\n");
exit(1);
}
if (params[1][8] == '0')
@@ -754,13 +617,13 @@ parse_line_formatted(int num_params, cha
else if (params[1][8] == '1')
bx_options.newHardDriveSupport = 1;
else {
- fprintf(stderr, ".bochsrc: newharddrivesupport directive malformed.\n");
+ bio->printf( ".bochsrc: newharddrivesupport directive malformed.\n");
exit(1);
}
}
else if (!strcmp(params[0], "cmosimage")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: cmosimage directive: wrong # args.\n");
+ bio->printf( ".bochsrc: cmosimage directive: wrong # args.\n");
exit(1);
}
bx_options.cmos.path = strdup(params[1]);
@@ -768,31 +631,35 @@ parse_line_formatted(int num_params, cha
}
else if (!strcmp(params[0], "time0")) {
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: time0 directive: wrong # args.\n");
+ bio->printf( ".bochsrc: time0 directive: wrong # args.\n");
exit(1);
}
bx_options.cmos.time0 = atoi(params[1]);
}
#ifdef MAGIC_BREAKPOINT
else if (!strcmp(params[0], "magic_break")) {
+ bx_debug_t dbg = bio->getdbg();
if (num_params != 2) {
- fprintf(stderr, ".bochsrc: magic_break directive: wrong # args.\n");
+ bio->printf( ".bochsrc: magic_break directive: wrong # args.\n");
exit(1);
}
if (strncmp(params[1], "enabled=", 8)) {
- fprintf(stderr, ".bochsrc: magic_break directive malformed.\n");
+ bio->printf( ".bochsrc: magic_break directive malformed.\n");
exit(1);
}
if (params[1][8] == '0') {
- fprintf(stderr, "Ignoring magic break points\n");
- bx_dbg.magic_break_enabled = 0;
+ bio->printf( "Ignoring magic break points\n");
+ dbg.magic_break_enabled = 0;
+ bio->setdbg(dbg);
}
else if (params[1][8] == '1') {
- fprintf(stderr, "Stopping on magic break points\n");
- bx_dbg.magic_break_enabled = 1;
+ bx_debug_t dbg = bio->getdbg();
+ bio->printf( "Stopping on magic break points\n");
+ dbg.magic_break_enabled = 1;
+ bio->setdbg(dbg);
}
else {
- fprintf(stderr, ".bochsrc: magic_break directive malformed.\n");
+ bio->printf( ".bochsrc: magic_break directive malformed.\n");
exit(1);
}
}
@@ -801,20 +668,20 @@ parse_line_formatted(int num_params, cha
int tmp[6];
bx_options.ne2k.valid = 0;
if ((num_params < 4) || (num_params > 6)) {
- fprintf(stderr, ".bochsrc: ne2k directive malformed.\n");
+ bio->printf( ".bochsrc: ne2k directive malformed.\n");
exit(1);
}
bx_options.ne2k.ethmod = "null";
if (strncmp(params[1], "ioaddr=", 7)) {
- fprintf(stderr, ".bochsrc: ne2k directive malformed.\n");
+ bio->printf( ".bochsrc: ne2k directive malformed.\n");
exit(1);
}
if (strncmp(params[2], "irq=", 4)) {
- fprintf(stderr, ".bochsrc: ne2k directive malformed.\n");
+ bio->printf( ".bochsrc: ne2k directive malformed.\n");
exit(1);
}
if (strncmp(params[3], "mac=", 4)) {
- fprintf(stderr, ".bochsrc: ne2k directive malformed.\n");
+ bio->printf( ".bochsrc: ne2k directive malformed.\n");
exit(1);
}
bx_options.ne2k.ioaddr = strtoul(&params[1][7], NULL, 16);
@@ -822,35 +689,44 @@ parse_line_formatted(int num_params, cha
i = sscanf(&params[3][4], "%x:%x:%x:%x:%x:%x",
&tmp[0],&tmp[1],&tmp[2],&tmp[3],&tmp[4],&tmp[5]);
if (i != 6) {
- fprintf(stderr, ".bochsrc: ne2k mac address malformed.\n");
+ bio->printf( ".bochsrc: ne2k mac address malformed.\n");
exit(1);
}
for (i=0;i<6;i++)
bx_options.ne2k.macaddr[i] = tmp[i];
if (num_params > 4) {
if (strncmp(params[4], "ethmod=", 7)) {
- fprintf(stderr, ".bochsrc: ne2k directive malformed.\n");
+ bio->printf( ".bochsrc: ne2k directive malformed.\n");
exit(1);
}
bx_options.ne2k.ethmod = strdup(&params[4][7]);
if (num_params == 6) {
if (strncmp(params[5], "ethdev=", 7)) {
- fprintf(stderr, ".bochsrc: ne2k directive malformed.\n");
+ bio->printf( ".bochsrc: ne2k directive malformed.\n");
exit(1);
}
bx_options.ne2k.ethdev = strdup(&params[5][7]);
}
}
bx_options.ne2k.valid = 1;
+ bio->printf("ne2k: port 0x%x irq %d address %02x:%02x:%02x:%02x:%02x:%02x\n",
+ bx_options.ne2k.ioaddr,
+ bx_options.ne2k.irq,
+ bx_options.ne2k.macaddr[0],
+ bx_options.ne2k.macaddr[1],
+ bx_options.ne2k.macaddr[2],
+ bx_options.ne2k.macaddr[3],
+ bx_options.ne2k.macaddr[4],
+ bx_options.ne2k.macaddr[5]);
}
else if (!strcmp(params[0], "load32bitOSImage")) {
if ( (num_params!=4) && (num_params!=5) ) {
- fprintf(stderr, ".bochsrc: load32bitOSImage directive: wrong # args.\n");
+ bio->printf( ".bochsrc: load32bitOSImage directive: wrong # args.\n");
exit(1);
}
if (strncmp(params[1], "os=", 3)) {
- fprintf(stderr, ".bochsrc: load32bitOSImage: directive malformed.\n");
+ bio->printf( ".bochsrc: load32bitOSImage: directive malformed.\n");
exit(1);
}
if (!strcmp(&params[1][3], "nullkernel")) {
@@ -860,22 +736,22 @@ parse_line_formatted(int num_params, cha
bx_options.load32bitOSImage.whichOS = Load32bitOSLinux;
}
else {
- fprintf(stderr, ".bochsrc: load32bitOSImage: unsupported OS.\n");
+ bio->printf( ".bochsrc: load32bitOSImage: unsupported OS.\n");
exit(1);
}
if (strncmp(params[2], "path=", 5)) {
- fprintf(stderr, ".bochsrc: load32bitOSImage: directive malformed.\n");
+ bio->printf( ".bochsrc: load32bitOSImage: directive malformed.\n");
exit(1);
}
if (strncmp(params[3], "iolog=", 6)) {
- fprintf(stderr, ".bochsrc: load32bitOSImage: directive malformed.\n");
+ bio->printf( ".bochsrc: load32bitOSImage: directive malformed.\n");
exit(1);
}
bx_options.load32bitOSImage.path = strdup(&params[2][5]);
bx_options.load32bitOSImage.iolog = strdup(&params[3][6]);
if (num_params == 5) {
if (strncmp(params[4], "initrd=", 7)) {
- fprintf(stderr, ".bochsrc: load32bitOSImage: directive malformed.\n");
+ bio->printf( ".bochsrc: load32bitOSImage: directive malformed.\n");
exit(1);
}
bx_options.load32bitOSImage.initrd = strdup(&params[4][7]);
@@ -883,7 +759,7 @@ parse_line_formatted(int num_params, cha
}
else {
- fprintf(stderr, ".bochsrc: directive '%s' not understood\n", params[0]);
+ bio->printf( ".bochsrc: directive '%s' not understood\n", params[0]);
exit(1);
}
}
@@ -906,5 +782,241 @@ bx_signal_handler( int signum)
}
#endif
- bx_panic("SIGNAL %u caught\n", signum);
+ bio->printf("SIGNAL %u caught\n", signum);
}
+
+bxio::bxio(FILE *fs) {
+ //fprintf(stderr,"bxio::bxio(%s)\n",fn);
+ this->init();
+ this->init_log(fs);
+ this->printf("[bxio] Output log initialized: '%s'.\n",logfn);
+}
+bxio::bxio(int fd) {
+ //fprintf(stderr,"bxio::bxio(%s)\n",fn);
+ this->init();
+ this->init_log(fd);
+ this->printf("[bxio] Output log initialized: '%s'.\n",logfn);
+}
+
+bxio::bxio(char *fn) {
+ //fprintf(stderr,"bxio::bxio(%s)\n",fn);
+ this->init();
+ this->init_log(fn);
+ this->printf("[bxio] Output log initialized: '%s'.\n",logfn);
+}
+
+bxio::bxio(void) {
+ //fprintf(stderr,"bxio::bxio()\n");
+ this->init();
+}
+
+bxio::~bxio(void) {
+ //fprintf(stderr,"bxio::~bxio()\n");
+ this->flush();
+}
+
+void
+bxio::flush(void) {
+ if(logfd) {
+ fflush(logfd);
+ }
+}
+
+void
+bxio::init(void) {
+ //fprintf(stderr,"bxio::init()\n");
+ this->showtick = 1;
+ this->status = 234;
+ this->logfd = NULL;
+ this->init_debug();
+ this->init_log(stderr);
+}
+
+void
+bxio::init_log(char *fn)
+{
+ //fprintf(stderr,"bxio::init_log(%s)\n",fn);
+ logfd = stderr;
+ logfn = "/dev/stderr";
+ if (strcmp(fn, "-")) {
+ logfd = fopen(fn, "w");
+ if(logfd) {
+ logfn = strdup(fn);
+ bio->printf( "[BXIO] opened log file '%s'.\n", fn);
+ } else {
+ bio->printf( "[BXIO] log file '%s' not there?\n", fn);
+ logfd = NULL;
+ logfn = "(none)";
+ }
+ }
+}
+
+void
+bxio::init_log(FILE *fs)
+{
+ logfd = fs;
+
+ if(fs == stderr) {
+ logfn = "/dev/stderr";
+ } else {
+ logfn = "(unknown)";
+ }
+}
+
+void
+bxio::init_log(int fd)
+{
+ if( (logfd = fdopen(fd,"w")) == NULL ) {
+ fprintf(stderr,"Couldnt open fd %d as a stream for writing\n",
+ fd);
+ return;
+ }
+
+ switch(fd) {
+ case 1: logfn = "/dev/stdout"; break;
+ case 2: logfn = "/dev/stderr"; break;
+ default: logfn = "(unknown)"; break;
+ }
+}
+
+bx_debug_t
+bxio::getdbg(void)
+{
+ if(this == NULL) {
+ bx_debug_t dbg;
+ return dbg;
+ }
+ //fprintf(stderr,"bxio::getdbg()\n");
+ return dbg;
+}
+
+void
+bxio::setdbg(bx_debug_t dbg)
+{
+ //fprintf(stderr,"bxio::setdbg()\n");
+ this->dbg = dbg;
+}
+
+void
+bxio::set_attribs(int attr) {
+ if(attr&1)
+ showtick = 1;
+ else
+ showtick = 0;
+}
+
+ void
+bxio::printf(char *fmt, ...)
+{
+ va_list ap;
+
+ if(this == NULL) {
+ /* Unfortunately this MUST be stderr, infinite loop otherwise */
+ fprintf(stderr, "[BXIO] Warning! (this:'0x%x') bxio::printf called before init()", this);
+ return;
+ }
+
+ if (logfd) {
+ if(showtick) {
+ fprintf(logfd, "%010lld ", bx_pc_system.time_ticks());
+ //fprintf(logfd, "%#lx ", bx_pc_system.time_ticks());
+ }
+
+ va_start(ap, fmt);
+ vfprintf(logfd, fmt, ap);
+ va_end(ap);
+ this->flush();
+ }
+
+}
+
+ void
+bxio::panic(char *fmt, ...)
+{
+ va_list ap;
+#if BX_DEBUGGER
+ static Boolean dbg_exit_called = 0;
+#endif
+
+ if (logfd) {
+ this->printf("[BOCHS] panic, ");
+
+ va_start(ap, fmt);
+ vfprintf(logfd, fmt, ap);
+ va_end(ap);
+ }
+
+ atexit();
+
+#if !BX_DEBUGGER
+ exit(1);
+#else
+ if (dbg_exit_called == 0) {
+ dbg_exit_called = 1;
+ bx_dbg_exit(1);
+ }
+#endif
+}
+
+ void
+bxio::atexit(void)
+{
+ static Boolean been_here = 0;
+
+
+#if BX_PROVIDE_DEVICE_MODELS==1
+ if (been_here == 0) {
+ bx_pc_system.exit();
+ }
+#endif
+
+#if BX_DEBUGGER == 0
+ BX_CPU.atexit();
+#endif
+
+ if (logfd) {
+#if BX_PCI_SUPPORT
+ if (bx_options.i440FXSupport) {
+ bx_devices.pci->print_i440fx_state(logfd);
+ }
+#endif
+ fprintf(stderr, "bochs exited, log file closed: '%s'\n\n", logfn);
+ this->flush();
+ fclose(logfd);
+ logfd = NULL;
+ }
+}
+
+ void
+bxio::init_debug(void)
+{
+ this->dbg.floppy = 0;
+ this->dbg.keyboard = 0;
+ this->dbg.video = 0;
+ this->dbg.disk = 0;
+ this->dbg.pit = 0;
+ this->dbg.pic = 0;
+ this->dbg.bios = 0;
+ this->dbg.cmos = 0;
+ this->dbg.a20 = 0;
+ this->dbg.interrupts = 0;
+ this->dbg.exceptions = 0;
+ this->dbg.unsupported = 0;
+ this->dbg.temp = 0;
+ this->dbg.reset = 0;
+ this->dbg.mouse = 0;
+ this->dbg.io = 0;
+ this->dbg.debugger = 0;
+ this->dbg.xms = 0;
+ this->dbg.v8086 = 0;
+ this->dbg.paging = 0;
+ this->dbg.creg = 0;
+ this->dbg.dreg = 0;
+ this->dbg.dma = 0;
+ this->dbg.unsupported_io = 0;
+ this->dbg.record_io = 0;
+ this->dbg.serial = 0;
+ this->dbg.cdrom = 0;
+}
+
+

View File

@ -0,0 +1,79 @@
$OpenBSD: patch-memory_memory_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- memory/memory.cc.orig Sat Mar 25 21:46:39 2000
+++ memory/memory.cc Tue Oct 17 12:04:03 2000
@@ -170,7 +170,7 @@ inc_one:
// adapter ROM C0000 .. DFFFF
// ROM BIOS memory E0000 .. FFFFF
// (ignore write)
- //bx_printf("ROM lock %08x: len=%u\n",
+ //bio->printf("ROM lock %08x: len=%u\n",
// (unsigned) a20addr, (unsigned) len);
#if BX_PCI_SUPPORT == 0
#if BX_SHADOW_RAM
@@ -187,7 +187,7 @@ inc_one:
((a20addr >= 0xC0000) && (a20addr <= 0xFFFFF))) {
switch (bx_pci.wr_memType(a20addr & 0xFC000)) {
case 0x0: // Writes to ShadowRAM
-// bx_printf ("Writing to ShadowRAM %08x, len %u ! \n", (unsigned) a20addr, (unsigned) len);
+// bio->printf ("Writing to ShadowRAM %08x, len %u ! \n", (unsigned) a20addr, (unsigned) len);
BX_MEM.vector[a20addr] = *data_ptr;
BX_DBG_DIRTY_PAGE(a20addr >> 12);
BX_DYN_DIRTY_PAGE(a20addr >> 12);
@@ -195,10 +195,10 @@ inc_one:
case 0x1: // Writes to ROM, Inhibit
// bx_pci.s.i440fx.shadow[(a20addr - 0xc0000)] = *data_ptr;
-// bx_printf ("Writing to ROM %08x, Data %02x ! \n", (unsigned) a20addr, *data_ptr);
+// bio->printf ("Writing to ROM %08x, Data %02x ! \n", (unsigned) a20addr, *data_ptr);
goto inc_one;
default:
- bx_panic("write_physical: default case\n");
+ bio->panic("write_physical: default case\n");
goto inc_one;
}
}
@@ -374,15 +374,15 @@ inc_one:
switch (bx_pci.rd_memType(a20addr & 0xFC000)) {
case 0x0: // Read from ShadowRAM
*data_ptr = BX_MEM.vector[a20addr];
- bx_printf ("Reading from ShadowRAM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
+ bio->printf ("Reading from ShadowRAM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
goto inc_one;
case 0x1: // Read from ROM
*data_ptr = bx_pci.s.i440fx.shadow[(a20addr - 0xc0000)];
- //bx_printf ("Reading from ROM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
+ //bio->printf ("Reading from ROM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
goto inc_one;
default:
- bx_panic("::read_physical: default case\n");
+ bio->panic("::read_physical: default case\n");
}
}
goto inc_one;
@@ -413,21 +413,21 @@ inc_one:
switch (bx_pci.rd_memType(a20addr & 0xFC000)) {
case 0x0: // Read from ROM
*data_ptr = BX_MEM.vector[a20addr];
- //bx_printf ("Reading from ROM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
+ //bio->printf ("Reading from ROM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
break;
case 0x1: // Read from Shadow RAM
*data_ptr = bx_pci.s.i440fx.shadow[(a20addr - 0xc0000)];
- bx_printf ("Reading from ShadowRAM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
+ bio->printf ("Reading from ShadowRAM %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
break;
default:
- bx_panic("read_physical: default case\n");
+ bio->panic("read_physical: default case\n");
} // Switch
}
}
else {
*data_ptr = BX_MEM.vector[a20addr];
- bx_printf ("Reading from Norm %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
+ bio->printf ("Reading from Norm %08x, Data %02x \n", (unsigned) a20addr, *data_ptr);
}
}
else

View File

@ -0,0 +1,122 @@
$OpenBSD: patch-memory_misc_mem_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- memory/misc_mem.cc.orig Sat Mar 25 21:46:43 2000
+++ memory/misc_mem.cc Thu Oct 19 11:27:34 2000
@@ -35,7 +35,7 @@
Bit32u
BX_MEM_C::get_memory_in_k(void)
{
- bx_printf("(%u) get_memory_in_k() = %u\n", BX_SIM_ID, (unsigned)
+ bio->printf("[CPU%u] get_memory_in_k() = %u\n", BX_SIM_ID, (unsigned)
(BX_MEM_THIS megabytes * 1024));
return(BX_MEM_THIS megabytes * 1024);
@@ -59,8 +59,8 @@ BX_MEM_C::BX_MEM_C(void)
// BX_MEM_C constructor
BX_MEM_C::BX_MEM_C(size_t memsize)
{
- bx_printf("(%u) BX_MEM_C::BX_MEM_C(size_t) called\n", BX_SIM_ID);
- bx_printf("(%u) memsize = %u\n", BX_SIM_ID, (unsigned) memsize);
+ bio->printf("[CPU%u] BX_MEM_C::BX_MEM_C(size_t) called\n", BX_SIM_ID);
+ bio->printf("[CPU%u] memsize = %u\n", BX_SIM_ID, (unsigned) memsize);
vector = new Bit8u[memsize];
len = memsize;
megabytes = len / (1024*1024);
@@ -76,7 +76,7 @@ BX_MEM_C::~BX_MEM_C(void)
delete this->vector;
}
else {
- bx_printf("(%u) memory not freed as it wasn't allocated!\n", BX_SIM_ID);
+ bio->printf("[CPU%u] memory not freed as it wasn't allocated!\n", BX_SIM_ID);
}
}
#endif // #if BX_PROVIDE_CPU_MEMORY
@@ -91,8 +91,8 @@ BX_MEM_C::init_memory(int memsize)
if (BX_MEM_THIS vector == NULL) {
// memory not already allocated, do now...
- bx_printf("(%u) BX_MEM_C::init_memory(int): allocating memory.\n", BX_SIM_ID);
- bx_printf("(%u) memsize = %u\n", BX_SIM_ID, (unsigned) memsize);
+ bio->printf("[CPU%u] BX_MEM_C::init_memory(int): allocating memory.\n", BX_SIM_ID);
+ bio->printf("[CPU%u] memsize = %u\n", BX_SIM_ID, (unsigned) memsize);
BX_MEM_THIS vector = new Bit8u[memsize];
BX_MEM_THIS len = memsize;
BX_MEM_THIS megabytes = memsize / (1024*1024);
@@ -108,8 +108,8 @@ BX_MEM_C::init_memory(int memsize)
memset(BX_MEM.dbg_dirty_pages, 0, sizeof(BX_MEM.dbg_dirty_pages));
if (BX_MEM.megabytes > BX_MAX_DIRTY_PAGE_TABLE_MEGS) {
- bx_printf("Error: memory larger than dirty page table can handle\n");
- bx_panic("Error: increase BX_MAX_DIRTY_PAGE_TABLE_MEGS\n");
+ bio->printf("[CPU%u] Error: memory larger than dirty page table can handle\n",BX_SIM_ID);
+ bio->panic("CPU%u Error: increase BX_MAX_DIRTY_PAGE_TABLE_MEGS\n",BX_SIM_ID);
}
#endif
@@ -132,19 +132,19 @@ BX_MEM_C::load_ROM(const char *path, Bit
#endif
);
if (fd < 0) {
- fprintf(stderr, "load_ROM: couldn't open ROM image file '%s'.\n", path);
+ bio->printf("[load_ROM] couldn't open ROM image file '%s'.\n", path);
exit(1);
}
ret = fstat(fd, &stat_buf);
if (ret) {
- fprintf(stderr, "load_ROM: couldn't stat ROM image file '%s'.\n", path);
+ bio->printf("[load_ROM] couldn't stat ROM image file '%s'.\n", path);
exit(1);
}
size = stat_buf.st_size;
if ( (romaddress + size) > BX_MEM_THIS len ) {
- fprintf(stderr, "load_ROM: ROM address range > physical memsize!\n");
+ bio->printf("[load_ROM] ROM address range > physical memsize!\n");
exit(1);
}
@@ -160,7 +160,7 @@ BX_MEM_C::load_ROM(const char *path, Bit
ret = read(fd, (bx_ptr_t) &BX_MEM_THIS vector[romaddress + offset], size);
#endif
if (ret <= 0) {
- fprintf(stderr, "load_ROM: read failed on ROM BIOS image\n");
+ bio->printf("[load_ROM] read failed on ROM BIOS image\n");
exit(1);
}
size -= ret;
@@ -169,13 +169,13 @@ BX_MEM_C::load_ROM(const char *path, Bit
close(fd);
#if BX_PCI_SUPPORT
if (bx_options.i440FXSupport)
- bx_printf("(%u) load_ROM: ROM BIOS in i440FX RAM '%s', size=%u read into memory at %08x\n",
+ bio->printf("[CPU%u] load_ROM: ROM BIOS in i440FX RAM '%s', size=%u read into memory at %08x\n",
BX_SIM_ID, path, (unsigned) stat_buf.st_size, (unsigned) romaddress);
else
- bx_printf("(%u) load_ROM: ROM BIOS '%s', size=%u read into memory at %08x\n",
+ bio->printf("[CPU%u] load_ROM: ROM BIOS '%s', size=%u read into memory at %08x\n",
BX_SIM_ID, path, (unsigned) stat_buf.st_size, (unsigned) romaddress);
#else // #if BX_PCI_SUPPORT
- bx_printf("(%u) load_ROM: ROM BIOS '%s', size=%u read into memory at %08x\n",
+ bio->printf("[CPU%u] load_ROM: ROM BIOS '%s', size=%u read into memory at %08x\n",
BX_SIM_ID, path, (unsigned) stat_buf.st_size, (unsigned) romaddress);
#endif // #if BX_PCI_SUPPORT
}
@@ -204,15 +204,15 @@ BX_MEM_C::dbg_fetch_mem(Bit32u addr, uns
switch (bx_pci.rd_memType (addr)) {
case 0x0: // Fetch from ShadowRAM
*buf = BX_MEM.vector[addr];
-// bx_printf ("Fetching from ShadowRAM %08x, len %u !\n", (unsigned)addr, (unsigned)len);
+// bio->printf ("Fetching from ShadowRAM %08x, len %u !\n", (unsigned)addr, (unsigned)len);
break;
case 0x1: // Fetch from ROM
*buf = bx_pci.s.i440fx.shadow[(addr - 0xC0000)];
-// bx_printf ("Fetching from ROM %08x, Data %02x \n", (unsigned)addr, *buf);
+// bio->printf ("Fetching from ROM %08x, Data %02x \n", (unsigned)addr, *buf);
break;
default:
- bx_panic("dbg_fetch_mem: default case\n");
+ bio->panic("dbg_fetch_mem: default case\n");
}
}
else

View File

@ -0,0 +1,190 @@
$OpenBSD: patch-pc_system_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- pc_system.cc.orig Sat Mar 25 21:24:35 2000
+++ pc_system.cc Fri Oct 20 14:39:22 2000
@@ -76,7 +76,7 @@ bx_pc_system_c::init_ips(Bit32u ips)
{
// parameter 'ips' is the processor speed in Instructions-Per-Second
m_ips = double(ips) / 1000000.0L;
- bx_printf("ips = %u\n", (unsigned) ips);
+ bio->printf("[SYS] ips = %u\n", (unsigned) ips);
}
void
@@ -91,7 +91,7 @@ bx_pc_system_c::raise_HLDA(void)
bx_pc_system_c::set_DRQ(unsigned channel, Boolean val)
{
if (channel > 7)
- bx_panic("set_DRQ() channel > 7\n");
+ bio->panic("set_DRQ() channel > 7\n");
DRQ[channel] = val;
bx_devices.drq(channel, val);
}
@@ -187,7 +187,7 @@ bx_pc_system_c::outp(Bit16u addr, Bit32u
bx_pc_system_c::set_enable_a20(Bit8u value)
{
#if BX_CPU_LEVEL < 2
- bx_panic("set_enable_a20() called: 8086 emulation\n");
+ bio->panic("set_enable_a20() called: 8086 emulation\n");
#else
#if BX_SUPPORT_A20
@@ -206,10 +206,10 @@ bx_pc_system_c::set_enable_a20(Bit8u val
BX_DBG_A20_REPORT(value);
- if (bx_dbg.a20)
- bx_printf("A20: set() = %u\n", (unsigned) enable_a20);
+ if (bio->getdbg().a20)
+ bio->printf("[SYS] A20: set() = %u\n", (unsigned) enable_a20);
#else
- bx_printf("set_enable_a20: ignoring: SUPPORT_A20 = 0\n");
+ bio->printf("[SYS] set_enable_a20: ignoring: SUPPORT_A20 = 0\n");
#endif // #if BX_SUPPORT_A20
#endif
@@ -219,13 +219,13 @@ bx_pc_system_c::set_enable_a20(Bit8u val
bx_pc_system_c::get_enable_a20(void)
{
#if BX_SUPPORT_A20
- if (bx_dbg.a20)
- bx_printf("A20: get() = %u\n", (unsigned) enable_a20);
+ if (bio->getdbg().a20)
+ bio->printf("[SYS] A20: get() = %u\n", (unsigned) enable_a20);
if (enable_a20) return(1);
else return(0);
#else
- bx_printf("get_enable_a20: ignoring: SUPPORT_A20 = 0\n");
+ bio->printf("[SYS] get_enable_a20: ignoring: SUPPORT_A20 = 0\n");
return(1);
#endif // #if BX_SUPPORT_A20
}
@@ -236,8 +236,8 @@ bx_pc_system_c::ResetSignal( PCS_OP oper
UNUSED( operation );
// Reset the processor.
- fprintf(stderr, "# bx_pc_system_c::ResetSignal() called\n");
- bx_panic("pc_system.resetsignal() called\n");
+ bio->printf("[SYS] bx_pc_system_c::ResetSignal() called\n");
+ BX_CPU.reset(BX_RESET_SOFTWARE);
return(0);
}
@@ -253,7 +253,7 @@ bx_pc_system_c::exit(void)
{
if (bx_devices.hard_drive)
bx_devices.hard_drive->close_harddrive();
- bx_printf("Last time is %d\n", BX_CMOS_THIS s.timeval);
+ bio->printf("[SYS] Last time is %d\n", BX_CMOS_THIS s.timeval);
bx_gui.exit();
}
@@ -270,12 +270,12 @@ bx_pc_system_c::timer_handler(void)
unsigned i;
Bit64u delta;
- // fprintf(stderr, "Time handler ptime = %d\n", bx_pc_system.time_ticks());
+ // bio->printf("Time handler ptime = %d\n", bx_pc_system.time_ticks());
delta = num_cpu_ticks_in_period - num_cpu_ticks_left;
#if BX_TIMER_DEBUG
if (num_cpu_ticks_left != 0)
- bx_panic("timer_handler: ticks_left!=0\n");
+ bio->panic("timer_handler: ticks_left!=0\n");
#endif
for (i=0; i < num_timers; i++) {
@@ -283,7 +283,7 @@ bx_pc_system_c::timer_handler(void)
if (timer[i].active) {
#if BX_TIMER_DEBUG
if (timer[i].remaining < delta) {
- bx_panic("timer_handler: remain < delta\n");
+ bio->panic("timer_handler: remain < delta\n");
}
#endif
timer[i].remaining -= delta;
@@ -328,11 +328,11 @@ bx_pc_system_c::expire_ticks(void)
#if BX_TIMER_DEBUG
if (timer[i].remaining <= ticks_delta) {
for (unsigned j=0; j<num_timers; j++) {
- bx_printf("^^^timer[%u]\n", j);
- bx_printf("^^^remaining = %u, period = %u\n",
+ bio->printf("[SYS] ^^^timer[%u]\n", j);
+ bio->printf("[SYS] ^^^remaining = %u, period = %u\n",
timer[j].remaining, timer[j].period);
}
- bx_panic("expire_ticks: i=%u, remain(%u) <= delta(%u)\n",
+ bio->panic("expire_ticks: i=%u, remain(%u) <= delta(%u)\n",
i, timer[i].remaining, (unsigned) ticks_delta);
}
#endif
@@ -351,13 +351,13 @@ bx_pc_system_c::register_timer( void *th
Bit64u instructions;
if (num_timers >= BX_MAX_TIMERS) {
- bx_panic("register_timer: too many registered timers.");
+ bio->panic("register_timer: too many registered timers.");
}
if (this_ptr == NULL)
- bx_panic("register_timer: this_ptr is NULL\n");
+ bio->panic("register_timer: this_ptr is NULL\n");
if (funct == NULL)
- bx_panic("register_timer: funct is NULL\n");
+ bio->panic("register_timer: funct is NULL\n");
// account for ticks up to now
expire_ticks();
@@ -374,13 +374,13 @@ bx_pc_system_c::register_timer_ticks(voi
unsigned i;
if (num_timers >= BX_MAX_TIMERS) {
- bx_panic("register_timer: too many registered timers.");
+ bio->panic("register_timer: too many registered timers.");
}
if (this_ptr == NULL)
- bx_panic("register_timer: this_ptr is NULL\n");
+ bio->panic("register_timer: this_ptr is NULL\n");
if (funct == NULL)
- bx_panic("register_timer: funct is NULL\n");
+ bio->panic("register_timer: funct is NULL\n");
i = num_timers;
num_timers++;
@@ -422,7 +422,7 @@ bx_pc_system_c::counter_timer_handler(vo
bx_pc_system_c::timebp_handler(void* this_ptr)
{
BX_CPU_THIS_PTR break_point = BREAK_POINT_TIME;
- fprintf(stderr, "Time breakpoint triggered\n");
+ bio->printf("[SYS] Time breakpoint triggered\n");
if (timebp_queue_size > 1) {
long long new_diff = timebp_queue[1] - bx_pc_system.time_ticks();
@@ -472,7 +472,7 @@ bx_pc_system_c::start_timers(void)
bx_pc_system_c::activate_timer_ticks (unsigned timer_index, Bit64u instructions, Boolean continuous)
{
if (timer_index >= num_timers)
- bx_panic("activate_timer(): bad timer index given\n");
+ bio->panic("activate_timer(): bad timer index given\n");
// set timer continuity to new value (1=continuous, 0=one-shot)
timer[timer_index].continuous = continuous;
@@ -500,7 +500,7 @@ bx_pc_system_c::activate_timer( unsigned
Bit64u instructions;
if (timer_index >= num_timers)
- bx_panic("activate_timer(): bad timer index given\n");
+ bio->panic("activate_timer(): bad timer index given\n");
// account for ticks up to now
expire_ticks();
@@ -538,7 +538,7 @@ bx_pc_system_c::activate_timer( unsigned
bx_pc_system_c::deactivate_timer( unsigned timer_index )
{
if (timer_index >= num_timers)
- bx_panic("deactivate_timer(): bad timer index given\n");
+ bio->panic("deactivate_timer(): bad timer index given\n");
timer[timer_index].active = 0;
}

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-state_file_cc,v 1.1 2001/02/02 16:59:12 todd Exp $
--- state_file.cc.orig Sat Mar 25 21:24:40 2000
+++ state_file.cc Tue Oct 17 12:04:03 2000
@@ -111,16 +111,16 @@ state_file::state_file (const char *name
{
UNUSED(name);
UNUSED(options);
- bx_printf("state_file::state_file()\n");
+ bio->printf("state_file::state_file()\n");
}
state_file::state_file (FILE *f)
{
UNUSED(f);
- bx_printf("state_file::state_file(FILE *)\n");
+ bio->printf("state_file::state_file(FILE *)\n");
}
state_file::~state_file()
{
- bx_printf("state_file::~state_file()\n");
+ bio->printf("state_file::~state_file()\n");
}