Fail* directories reorganized, Code-cleanup (-> coding-style), Typos+comments fixed.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1321 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-06-08 20:09:43 +00:00
parent d474a5b952
commit 2575604b41
866 changed files with 1848 additions and 1879 deletions

View File

@ -0,0 +1,16 @@
----------------------------------------------------------------------
Patch name:
Author:
Date:
Status:
Detailed description:
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on DATE, release version VER
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------

View File

@ -0,0 +1,5 @@
This directory contains patches that are under consideration or being
tested.
The file HEADER is a nice template for the top of a patch.
Use it if you want.

Binary file not shown.

View File

@ -0,0 +1,20 @@
Marton Fabo <morton@eik.bme.hu> rewrote the BeOS GUI mostly from scratch,
and this "capture filter" goes with his GUI. You must first apply
either patch.beos-gui-fabo or patch.beos-gui-fabo-template.
Then, according to Marton Fabo:
> Then, you'll need to place capture_filter into
> $HOME/config/add-ons/input_server/filters, this one will enable bochs to
> capture keyboard and mouse input. If you don't put it there, bochs will still
> work to some extent, but it will be much less usable. Compile, and then give
> it a go!
> You can get back your mouse pointer after enabling the bochs mouse by
> pressing both buttons simultaneously. Caps lock doesn't work yet properly
> (it won't turn off, just when you press Shift next time), and Numlock
> doesn't work at all. I'm working on fixing these.
Feedback goes to:
Marton Fabo
morton@eik.bme.hu

View File

@ -0,0 +1,74 @@
diff -Nurd bios-orig/rombios32.ld bios/rombios32.ld
--- bios-orig/rombios32.ld Sat Jan 26 09:15:27 2008
+++ bios/rombios32.ld Sat Mar 22 09:29:24 2008
@@ -1,4 +1,3 @@
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start);
SECTIONS
diff -Nurd bios-orig/rombios32start.S bios/rombios32start.S
--- bios-orig/rombios32start.S Sat Jan 26 09:15:27 2008
+++ bios/rombios32start.S Sat Mar 22 09:30:49 2008
@@ -21,12 +21,12 @@
#include "rombios.h"
.globl _start
-.globl smp_ap_boot_code_start
-.globl smp_ap_boot_code_end
-.global smm_relocation_start
-.global smm_relocation_end
-.global smm_code_start
-.global smm_code_end
+.globl _smp_ap_boot_code_start
+.globl _smp_ap_boot_code_end
+.global _smm_relocation_start
+.global _smm_relocation_end
+.global _smm_code_start
+.global _smm_code_end
_start:
/* clear bss section */
@@ -36,20 +36,20 @@
sub %edi, %ecx
rep stosb
- jmp rombios32_init
+ jmp _rombios32_init
.code16
-smp_ap_boot_code_start:
+_smp_ap_boot_code_start:
xor %ax, %ax
mov %ax, %ds
incw CPU_COUNT_ADDR
1:
hlt
jmp 1b
-smp_ap_boot_code_end:
+_smp_ap_boot_code_end:
/* code to relocate SMBASE to 0xa0000 */
-smm_relocation_start:
+_smm_relocation_start:
mov $0x38000 + 0x7efc, %ebx
addr32 mov (%ebx), %al /* revision ID to see if x86_64 or x86 */
cmp $0x64, %al
@@ -66,10 +66,10 @@
movw $0xb3, %dx
outb %al, %dx
rsm
-smm_relocation_end:
+_smm_relocation_end:
/* minimal SMM code to enable or disable ACPI */
-smm_code_start:
+_smm_code_start:
movw $0xb2, %dx
inb %dx, %al
cmp $0xf0, %al
@@ -95,4 +95,4 @@
2:
rsm
-smm_code_end:
+_smm_code_end:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,112 @@
----------------------------------------------------------------------
Patch name: patch.example-override-ask
Author: Bryce Denney
Date: Mon Sep 23 13:00:53 EDT 2002
Status: Demo
Detailed description:
This patch shows how to create your own siminterface callback function.
It is not intended to be checked in anytime, only to serve as an example
of how to use the siminterface.
Patch updated for current CVS. (Volker Ruppert, Oct 16, 2005)
Patch was created with:
diff -u
Apply patch to what version:
cvs checked out on DATE
Instructions:
To patch, go to main bochs directory.
Type "patch -p1 < THIS_PATCH_FILE".
----------------------------------------------------------------------
--- bochs/config.h.in 2005-10-13 20:40:50.131262080 +0200
+++ bochs-overrideask/config.h.in 2005-10-13 20:44:40.841188840 +0200
@@ -949,6 +949,9 @@
// External Debugger
#define BX_EXTERNAL_DEBUGGER 0
+// Override ask dialog (demo)
+#define BX_OVERRIDE_ASK_EXAMPLE 1
+
// Magic breakpoints
#define BX_MAGIC_BREAKPOINT 1
--- bochs/gui/textconfig.cc 2005-06-06 22:14:50.000000000 +0200
+++ bochs-overrideask/gui/textconfig.cc 2005-10-13 20:12:16.090835832 +0200
@@ -996,6 +996,10 @@
case CI_START:
//fprintf (stderr, "textconfig.cc: start\n");
bx_config_interface_init ();
+#if BX_OVERRIDE_ASK_EXAMPLE
+ extern void override_ask_init();
+ override_ask_init ();
+#endif
if (SIM->get_param_enum(BXP_BOCHS_START)->get () == BX_QUICK_START)
bx_config_interface (BX_CI_START_SIMULATION);
else {
diff -urN bochs/Makefile.in bochs-overrideask/Makefile.in
--- bochs/Makefile.in 2005-07-30 17:02:40.000000000 +0200
+++ bochs-overrideask/Makefile.in 2005-10-13 20:04:06.137320088 +0200
@@ -146,6 +146,7 @@
pc_system.o \
osdep.o \
plugin.o \
+ overrideask.o \
@EXTRA_BX_OBJS@
EXTERN_ENVIRONMENT_OBJS = \
--- bochs/overrideask.cc 1970-01-01 01:00:00.000000000 +0100
+++ bochs-overrideask/overrideask.cc 2005-10-13 20:15:25.713008880 +0200
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <assert.h>
+#include "config.h"
+#include "osdep.h"
+#include "gui/siminterface.h"
+
+bxevent_handler old_callback = NULL;
+void *old_callback_arg = NULL;
+
+BxEvent *
+override_ask_callback (void *unused, BxEvent *event)
+{
+ int n;
+ int level;
+ fprintf (stderr, "override_ask_callback\n");
+ event->retcode = -1;
+ switch (event->type)
+ {
+ case BX_SYNC_EVT_LOG_ASK:
+ level = event->u.logmsg.level;
+ fprintf (stderr, "============ override_ask_callback was called ==========================\n");
+ fprintf (stderr, "Event type: %s\n", SIM->get_log_level_name (level));
+ fprintf (stderr, "Device: %s\n", event->u.logmsg.prefix);
+ fprintf (stderr, "Message: %s\n\n", event->u.logmsg.msg);
+ // note: 4 only available if BX_DEBUGGER=1. ideally, don't show it
+ fprintf (stderr, "What should I do? (0=continue, 1=alwayscont, 2=die, 3=abort, 4=debug) ");
+ while (scanf ("%d", &n) != 1 || (n<0 && n>4)) {
+ fprintf (stderr, "Enter 0-4 only.\n");
+ }
+ event->retcode = n;
+ fprintf (stderr, "============ override_ask_callback is done =============================\n");
+ return event;
+ case BX_SYNC_EVT_TICK: // called periodically by siminterface.
+ case BX_SYNC_EVT_ASK_PARAM: // called if simulator needs to know value of a param.
+ case BX_ASYNC_EVT_REFRESH: // called when some bx_param_c parameters have changed.
+ // fall into default case
+ default:
+ return (*old_callback)(old_callback_arg, event);
+ }
+}
+
+// called from textconfig.cc
+void override_ask_init ()
+{
+ fprintf (stderr, "override_ask_init");
+ // this should be called after the configuration interface has had a
+ // chance to install its own callback. Otherwise, overrideask will not
+ // override anything.
+ SIM->get_notify_callback (&old_callback, &old_callback_arg);
+ assert (old_callback != NULL);
+ SIM->set_notify_callback (override_ask_callback, NULL);
+}

View File

@ -0,0 +1,319 @@
----------------------------------------------------------------------
Patch name: patch.example-user-plugin
Author: Volker Ruppert
Date: 3 Jan 2009
Status: Demo
Detailed description:
This sample code can be used as a framework for writing user plugins.
It contains enough code for testing the existing user plugin support
in Bochs and creates a device that installs a 32-bit r/w register at
i/o address 0x1000.
This example also shows how to install and handle user-defined config
options for bochsrc, command line and the config interface. In this
demo it is used to specify the reset value.
For user plugin support Bochs must be configured with plugins enabled.
Compiling with plugin support is known to work on Linux and Windows
(Cygwin or MinGW/MSYS). Bochs supports loading of up to 16 different
user plugins when starting up. Loading / removing plugins at runtime
is not yet supported.
Patch was created with:
diff -u
Apply patch to what version:
cvs checked out on 09 Feb 2009
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
Regenerate the configure script and compile Bochs as usual
cd user-plugin
make
make install
----------------------------------------------------------------------
diff -urN ../bochs/configure.in ./configure.in
--- ../bochs/configure.in 2009-02-02 14:02:47.000000000 +0100
+++ ./configure.in 2009-02-09 10:49:14.000000000 +0100
@@ -3126,4 +3126,4 @@
build/linux/bochs-dlx \
bxversion.h bxversion.rc build/macosx/Info.plist \
build/win32/nsis/Makefile build/win32/nsis/bochs.nsi \
- host/linux/pcidev/Makefile)
+ host/linux/pcidev/Makefile user-plugin/Makefile)
diff -urN ../bochs/user-plugin/Makefile.in ./user-plugin/Makefile.in
--- ../bochs/user-plugin/Makefile.in 1970-01-01 01:00:00.000000000 +0100
+++ ./user-plugin/Makefile.in 2009-02-09 10:49:14.000000000 +0100
@@ -0,0 +1,108 @@
+# Copyright (C) 2009 Volker Ruppert
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Makefile for the user plugin example of bochs
+
+
+@SUFFIX_LINE@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+srcdir = @srcdir@
+VPATH = @srcdir@
+bindir = @bindir@
+libdir = @libdir@
+plugdir = @libdir@/bochs/plugins
+datarootdir = @datarootdir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man5dir = $(mandir)/man5
+docdir = $(datarootdir)/doc/bochs
+sharedir = $(datarootdir)/bochs
+top_builddir = ..
+top_srcdir = @top_srcdir@
+
+SHELL = /bin/sh
+
+@SET_MAKE@
+
+CXX = @CXX@
+CXXFLAGS = $(BX_INCDIRS) @CXXFLAGS@ @GUI_CXXFLAGS@
+
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+RANLIB = @RANLIB@
+PLUGIN_PATH=@libdir@
+top_builddir = ..
+LIBTOOL=@LIBTOOL@
+WIN32_DLL_IMPORT_LIBRARY=../dllexports.a
+
+BX_INCDIRS = -I.. -I$(srcdir)/.. -I../iodev -I$(srcdir)/../iodev -I../@INSTRUMENT_DIR@ -I$(srcdir)/../@INSTRUMENT_DIR@
+
+PLUGIN_OBJS = testdev.o
+
+plugins: $(PLUGIN_OBJS:@PLUGIN_LIBNAME_TRANSFORMATION@)
+
+install: @INSTALL_PLUGINS_VAR@
+
+install_libtool_plugins::
+ list=`echo *.la`; for i in $$list; do $(LIBTOOL) --mode=install install $$i $(DESTDIR)$(plugdir); done
+ $(LIBTOOL) --finish $(DESTDIR)$(plugdir)
+
+install_dll_plugins::
+ list=`echo *.dll`; for i in $$list; do cp $$i $(DESTDIR)$(plugdir); done
+
+# standard compile rule for C++ files
+.@CPP_SUFFIX@.o:
+ $(CXX) @DASH@c $(CXXFLAGS) $(LOCAL_CXXFLAGS) @CXXFP@$< @OFP@$@
+
+##### building plugins with libtool
+%.lo: %.@CPP_SUFFIX@
+ $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@
+
+libbx_%.la: %.lo
+ $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH)
+
+#### building DLLs for win32 (tested on cygwin only)
+bx_%.dll: %.o
+ $(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY)
+
+clean:
+ @RMCOMMAND@ -rf .libs *.lo *.o *.la *.a *.dll
+
+dist-clean: clean
+ @RMCOMMAND@ Makefile
+
+###########################################
+# dependencies generated by
+# gcc -MM -I.. -I../instrument/stubs *.cc | sed -e 's/\.cc/.@CPP_SUFFIX@/g'
+# gcc -MM -I.. -I../instrument/stubs *.cc | \
+# sed -e 's/\.cc/.@CPP_SUFFIX@/g' -e 's/\.o:/.lo:/g'
+#
+# This means that every source file is listed twice, once with a .o rule
+# and then again with an identical .lo rule. The .lo rules are used when
+# building plugins.
+###########################################
+testdev.o: testdev.@CPP_SUFFIX@ ../iodev/iodev.h ../bochs.h ../config.h ../osdep.h \
+ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
+ ../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
+ ../extplugin.h ../ltdl.h ../gui/gui.h ../gui/textconfig.h \
+ ../gui/keymap.h ../instrument/stubs/instrument.h testdev.h
+testdev.lo: testdev.@CPP_SUFFIX@ ../iodev/iodev.h ../bochs.h ../config.h ../osdep.h \
+ ../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
+ ../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
+ ../extplugin.h ../ltdl.h ../gui/gui.h ../gui/textconfig.h \
+ ../gui/keymap.h ../instrument/stubs/instrument.h testdev.h
diff -urN ../bochs/user-plugin/testdev.cc ./user-plugin/testdev.cc
--- ../bochs/user-plugin/testdev.cc 1970-01-01 01:00:00.000000000 +0100
+++ ./user-plugin/testdev.cc 2009-02-09 10:49:14.000000000 +0100
@@ -0,0 +1,118 @@
+// Copyright (C) 2009 Volker Ruppert
+//
+// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+// User plugin example (see patch description for details)
+
+// Define BX_PLUGGABLE in files that can be compiled into plugins. For
+// platforms that require a special tag on exported symbols, BX_PLUGGABLE
+// is used to know when we are exporting symbols and when we are importing.
+#define BX_PLUGGABLE
+
+// Don't include other devices headers
+#define NO_DEVICE_INCLUDES
+
+#include "iodev.h"
+#include "testdev.h"
+
+#define LOG_THIS theTestDevice->
+
+bx_testdev_c *theTestDevice = NULL;
+
+Bit32s testdev_options_parser(const char *context, int num_params, char *params[]);
+Bit32s testdev_options_save(FILE *fp);
+
+int libuser_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
+{
+ theTestDevice = new bx_testdev_c();
+ BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theTestDevice, "testdev");
+ // add new configuration parameter for the config interface
+ bx_param_c *root_param = SIM->get_param("user");
+ bx_list_c *menu = new bx_list_c(root_param, "testdev", "Test Device");
+ menu->get_options()->set(bx_list_c::SHOW_PARENT);
+ new bx_param_num_c(menu, "test", "Test Parameter", "", 0, BX_MAX_BIT32U, 0);
+ // register user-defined option for bochsrc and command line
+ SIM->register_user_option("testdev", testdev_options_parser, testdev_options_save);
+ return(0); // Success
+}
+
+void libuser_LTX_plugin_fini(void)
+{
+ SIM->unregister_user_option("testdev");
+ bx_list_c *menu = (bx_list_c*)SIM->get_param("user");
+ menu->remove("testdev");
+ delete theTestDevice;
+}
+
+Bit32s testdev_options_parser(const char *context, int num_params, char *params[])
+{
+ if (!strcmp(params[0], "testdev")) {
+ if (!strncmp(params[1], "test=", 5)) {
+ SIM->get_param_num("user.testdev.test")->set(atoi(&params[1][5]));
+ } else {
+ BX_PANIC(("%s: testdev: unknown parameter '%s'", context, params[1]));
+ }
+ } else {
+ BX_PANIC(("%s: unknown directive '%s'", context, params[0]));
+ }
+ return 0;
+}
+
+Bit32s testdev_options_save(FILE *fp)
+{
+ fprintf(fp, "testdev: test=%d\n", SIM->get_param_num("user.testdev.test")->get());
+ return 0;
+}
+
+bx_testdev_c::bx_testdev_c(void)
+{
+ put("USER");
+}
+
+bx_testdev_c::~bx_testdev_c(void)
+{
+ // nothing here yet
+}
+
+void bx_testdev_c::init(void)
+{
+ DEV_register_ioread_handler(this, read_handler, 0x1000, "Test Device", 4);
+ DEV_register_iowrite_handler(this, write_handler, 0x1000, "Test Device", 4);
+}
+
+void bx_testdev_c::reset(unsigned type)
+{
+ BX_USER_THIS s.reg0 = SIM->get_param_num("user.testdev.test")->get();
+}
+
+void bx_testdev_c::register_state(void)
+{
+ bx_list_c *list = new bx_list_c(SIM->get_bochs_root(), "testdev", "Test Device", 1);
+ BXRS_HEX_PARAM_FIELD(list, reg0, BX_USER_THIS s.reg0);
+}
+
+Bit32u bx_testdev_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
+{
+ UNUSED(this_ptr);
+
+ return BX_USER_THIS s.reg0;
+}
+
+void bx_testdev_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
+{
+ UNUSED(this_ptr);
+
+ BX_USER_THIS s.reg0 = value;
+}
diff -urN ../bochs/user-plugin/testdev.h ./user-plugin/testdev.h
--- ../bochs/user-plugin/testdev.h 1970-01-01 01:00:00.000000000 +0100
+++ ./user-plugin/testdev.h 2009-02-09 10:49:14.000000000 +0100
@@ -0,0 +1,40 @@
+// Copyright (C) 2009 Volker Ruppert
+//
+// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#ifndef BX_TESTDEV_H
+#define BX_TESTDEV_H
+
+#define BX_USER_THIS theTestDevice->
+
+class bx_testdev_c : public bx_devmodel_c {
+public:
+ bx_testdev_c();
+ virtual ~bx_testdev_c();
+
+ virtual void init(void);
+ virtual void reset(unsigned type);
+ virtual void register_state(void);
+
+private:
+ static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
+ static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
+
+ struct {
+ Bit32u reg0;
+ } s;
+};
+
+#endif

View File

@ -0,0 +1,572 @@
----------------------------------------------------------------------
Patch name: patch.fast-dma-cbothamy
Author: Christophe Bothamy
Date: Wed Feb 18 14:00:40 CET 2004
Status: Proposed changes
Detailed description:
This patch improves DMA transfers by moving more than one byte
on each cpu tick. This works only on address-incrementing DMA
transfers. The number of transferred bytes is currently
limited to 512 on each cpu tick, but can be easily increased.
Only floppy DMA transfers are impacted right now, and DOS 6.2
and Win95 seems to work fine with the patch applied.
The performance increase is (measured on a 1GHz PIII, with
all optimizations enabled) :
command without patch with patch
format a: 4s 3s
surface scan of scandisk 17s 10s
xcopy a: b: 14s 4s
These tests prefigures what kind of performance increase we
can get by implementing the IDE BusMaster feature.
More test on more guest os are needed to find probable
incompatibilities.
Todo:
- implement similar changes for sb16
- fix BX_DBG_DMA_REPORT to report data from buffer
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on DATE, release version VER
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: bochs.h
===================================================================
RCS file: /cvsroot/bochs/bochs/bochs.h,v
retrieving revision 1.136
diff -u -r1.136 bochs.h
--- bochs.h 6 Feb 2004 22:27:59 -0000 1.136
+++ bochs.h 18 Feb 2004 13:41:55 -0000
@@ -491,6 +491,8 @@
#define BX_RW 2
+#define BX_MEM_GET_HOST_MEM_ADDR_READ(addr) BX_MEM(0)->getHostMemAddr(NULL, addr, BX_READ)
+#define BX_MEM_GET_HOST_MEM_ADDR_WRITE(addr) BX_MEM(0)->getHostMemAddr(NULL, addr, BX_WRITE)
Index: iodev/dma.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/dma.cc,v
retrieving revision 1.30
diff -u -r1.30 dma.cc
--- iodev/dma.cc 31 Jul 2003 15:29:34 -0000 1.30
+++ iodev/dma.cc 18 Feb 2004 13:41:59 -0000
@@ -70,8 +70,8 @@
unsigned
bx_dma_c::registerDMA8Channel(
unsigned channel,
- void (* dmaRead)(Bit8u *data_byte),
- void (* dmaWrite)(Bit8u *data_byte),
+ void (* dmaRead)(Bit8u *data_byte, Bit16u len),
+ void (* dmaWrite)(Bit8u *data_byte, Bit16u len),
const char *name
)
{
@@ -93,8 +93,8 @@
unsigned
bx_dma_c::registerDMA16Channel(
unsigned channel,
- void (* dmaRead)(Bit16u *data_word),
- void (* dmaWrite)(Bit16u *data_word),
+ void (* dmaRead)(Bit16u *data_word, Bit16u len),
+ void (* dmaWrite)(Bit16u *data_word, Bit16u len),
const char *name
)
{
@@ -709,12 +709,26 @@
(BX_DMA_THIS s[ma_sl].chan[channel].current_address << ma_sl);
BX_DMA_THIS s[ma_sl].DACK[channel] = 1;
- // check for expiration of count, so we can signal TC and DACK(n)
- // at the same time.
- if (BX_DMA_THIS s[ma_sl].chan[channel].mode.address_decrement==0)
+
+ Bit16u length;
+ if (BX_DMA_THIS s[ma_sl].chan[channel].mode.address_decrement==0) {
+ // Maxout length, it could be per device selectable
+ length=BX_DMA_THIS s[ma_sl].chan[channel].current_count;
+ if (length > 511) length=511;
+
+ BX_DMA_THIS s[ma_sl].chan[channel].current_address+=length;
BX_DMA_THIS s[ma_sl].chan[channel].current_address++;
- else
+ }
+ else {
+ // When decrementing it is easier to do it 1 byte at a time
+ length=0;
+ //BX_DMA_THIS s[ma_sl].chan[channel].current_address-=length;
BX_DMA_THIS s[ma_sl].chan[channel].current_address--;
+ }
+
+ // check for expiration of count, so we can signal TC and DACK(n)
+ // at the same time.
+ BX_DMA_THIS s[ma_sl].chan[channel].current_count-=length;
BX_DMA_THIS s[ma_sl].chan[channel].current_count--;
if (BX_DMA_THIS s[ma_sl].chan[channel].current_count == 0xffff) {
// count expired, done with transfer
@@ -736,65 +750,86 @@
}
}
- Bit8u data_byte;
- Bit16u data_word;
+ Bit8u *data8;
+ Bit16u *data16;
if (BX_DMA_THIS s[ma_sl].chan[channel].mode.transfer_type == 1) { // write
// DMA controlled xfer of byte from I/O to Memory
if (!ma_sl) {
- if (BX_DMA_THIS h[channel].dmaWrite8)
- BX_DMA_THIS h[channel].dmaWrite8(&data_byte);
- else
- BX_PANIC(("no dmaWrite handler for channel %u.", channel));
- BX_MEM_WRITE_PHYSICAL(phy_addr, 1, &data_byte);
+ data8 = BX_MEM_GET_HOST_MEM_ADDR_WRITE(phy_addr);
+ if (data8 == NULL)
+ BX_PANIC(("dma8 tries to write outside memory"));
+ else
+ if (BX_DMA_THIS h[channel].dmaWrite8)
+ BX_DMA_THIS h[channel].dmaWrite8(data8, length);
+ else
+ BX_PANIC(("no dmaWrite handler for channel %u.", channel));
- BX_DBG_DMA_REPORT(phy_addr, 1, BX_WRITE, data_byte);
+ //BX_MEM_WRITE_PHYSICAL(phy_addr, 1+(Bit32u)length, &data_byte);
+
+ //BX_DBG_DMA_REPORT(phy_addr, 1, BX_WRITE, &data_byte);
}
else {
- if (BX_DMA_THIS h[channel].dmaWrite16)
- BX_DMA_THIS h[channel].dmaWrite16(&data_word);
+
+ data16 = (Bit16u*)BX_MEM_GET_HOST_MEM_ADDR_WRITE(phy_addr);
+ if (data16 == NULL)
+ BX_PANIC(("dma16 tries to write outside memory"));
else
- BX_PANIC(("no dmaWrite handler for channel %u.", channel));
+ if (BX_DMA_THIS h[channel].dmaWrite16)
+ BX_DMA_THIS h[channel].dmaWrite16(data16, length);
+ else
+ BX_PANIC(("no dmaWrite handler for channel %u.", channel));
- BX_MEM_WRITE_PHYSICAL(phy_addr, 2, &data_word);
+ //BX_MEM_WRITE_PHYSICAL(phy_addr, 2*(1+(Bit32u)length), data_word);
- BX_DBG_DMA_REPORT(phy_addr, 2, BX_WRITE, data_word);
+ //BX_DBG_DMA_REPORT(phy_addr, 2, BX_WRITE, data_word);
}
}
else if (BX_DMA_THIS s[ma_sl].chan[channel].mode.transfer_type == 2) { // read
// DMA controlled xfer of byte from Memory to I/O
if (!ma_sl) {
- BX_MEM_READ_PHYSICAL(phy_addr, 1, &data_byte);
+ //BX_MEM_READ_PHYSICAL(phy_addr, 1+(Bit32u)length, &data_byte);
- if (BX_DMA_THIS h[channel].dmaRead8)
- BX_DMA_THIS h[channel].dmaRead8(&data_byte);
+ data8 = BX_MEM_GET_HOST_MEM_ADDR_READ(phy_addr);
+ if (data8 == NULL)
+ BX_PANIC(("dma8 tries to read outside memory"));
+ else
+ if (BX_DMA_THIS h[channel].dmaRead8)
+ BX_DMA_THIS h[channel].dmaRead8(data8, length);
- BX_DBG_DMA_REPORT(phy_addr, 1, BX_READ, data_byte);
+ //BX_DBG_DMA_REPORT(phy_addr, 1, BX_READ, &data_byte);
}
else {
- BX_MEM_READ_PHYSICAL(phy_addr, 2, &data_word);
+ // BX_MEM_READ_PHYSICAL(phy_addr, 2*(1+(Bit32u)length), data_word);
- if (BX_DMA_THIS h[channel].dmaRead16)
- BX_DMA_THIS h[channel].dmaRead16(&data_word);
+ data16 = (Bit16u*)BX_MEM_GET_HOST_MEM_ADDR_WRITE(phy_addr);
+ if (data16 == NULL)
+ BX_PANIC(("dma16 tries to read outside memory"));
+ else
+ if (BX_DMA_THIS h[channel].dmaRead16)
+ BX_DMA_THIS h[channel].dmaRead16(data16,length);
- BX_DBG_DMA_REPORT(phy_addr, 2, BX_READ, data_word);
+ //BX_DBG_DMA_REPORT(phy_addr, 2, BX_READ, data_word);
}
}
else if (BX_DMA_THIS s[ma_sl].chan[channel].mode.transfer_type == 0) {
// verify
+ // Buffer for verify, max 64k words
+ Bit16u buffer[64*1024];
+
if (!ma_sl) {
if (BX_DMA_THIS h[channel].dmaWrite8)
- BX_DMA_THIS h[channel].dmaWrite8(&data_byte);
+ BX_DMA_THIS h[channel].dmaWrite8((Bit8u*)buffer, length);
else
BX_PANIC(("no dmaWrite handler for channel %u.", channel));
}
else {
if (BX_DMA_THIS h[channel].dmaWrite16)
- BX_DMA_THIS h[channel].dmaWrite16(&data_word);
+ BX_DMA_THIS h[channel].dmaWrite16(buffer, length);
else
BX_PANIC(("no dmaWrite handler for channel %u.", channel));
}
Index: iodev/dma.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/dma.h,v
retrieving revision 1.15
diff -u -r1.15 dma.h
--- iodev/dma.h 3 May 2003 07:41:27 -0000 1.15
+++ iodev/dma.h 18 Feb 2004 13:41:59 -0000
@@ -52,12 +52,12 @@
virtual unsigned get_TC(void);
virtual unsigned registerDMA8Channel(unsigned channel,
- void (* dmaRead)(Bit8u *data_byte),
- void (* dmaWrite)(Bit8u *data_byte),
+ void (* dmaRead)(Bit8u *data_byte, Bit16u len),
+ void (* dmaWrite)(Bit8u *data_byte, Bit16u len),
const char *name);
virtual unsigned registerDMA16Channel(unsigned channel,
- void (* dmaRead)(Bit16u *data_word),
- void (* dmaWrite)(Bit16u *data_word),
+ void (* dmaRead)(Bit16u *data_word, Bit16u len),
+ void (* dmaWrite)(Bit16u *data_word, Bit16u len),
const char *name);
virtual unsigned unregisterDMAChannel(unsigned channel);
@@ -102,10 +102,10 @@
bx_bool TC; // Terminal Count
struct {
- void (* dmaRead8)(Bit8u *data_byte);
- void (* dmaWrite8)(Bit8u *data_byte);
- void (* dmaRead16)(Bit16u *data_word);
- void (* dmaWrite16)(Bit16u *data_word);
+ void (* dmaRead8)(Bit8u *data_byte, Bit16u len);
+ void (* dmaWrite8)(Bit8u *data_byte, Bit16u len);
+ void (* dmaRead16)(Bit16u *data_word, Bit16u len);
+ void (* dmaWrite16)(Bit16u *data_word, Bit16u len);
} h[4]; // DMA read and write handlers
};
Index: iodev/floppy.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/floppy.cc,v
retrieving revision 1.72
diff -u -r1.72 floppy.cc
--- iodev/floppy.cc 8 Feb 2004 18:38:26 -0000 1.72
+++ iodev/floppy.cc 18 Feb 2004 13:42:04 -0000
@@ -1110,66 +1110,91 @@
}
void
-bx_floppy_ctrl_c::dma_write(Bit8u *data_byte)
+bx_floppy_ctrl_c::dma_write(Bit8u *data_byte, Bit16u len)
{
// A DMA write is from I/O to Memory
// We need to return then next data byte from the floppy buffer
// to be transfered via the DMA to memory. (read block from floppy)
+ //
+ // len is the length of the DMA transfert minus 1 byte
+ Bit32u xfer_len;
+ Bit8u drive = BX_FD_THIS s.DOR & 0x03;
- *data_byte = BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index++];
+ if ( BX_FD_THIS s.floppy_buffer_index >= 512)
+ BX_PANIC(("Index should not be >= 512"));
- if (BX_FD_THIS s.floppy_buffer_index >= 512) {
- Bit8u drive;
+ do {
+ xfer_len = 512 - BX_FD_THIS s.floppy_buffer_index;
+ if (xfer_len > ((Bit32u)len + 1)) xfer_len = (Bit32u)len + 1;
+ if (xfer_len == 1)
+ *data_byte = BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index++];
+ else {
+ memcpy(data_byte, &BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index],xfer_len);
+ BX_FD_THIS s.floppy_buffer_index += xfer_len;
+ }
- drive = BX_FD_THIS s.DOR & 0x03;
- increment_sector(); // increment to next sector before retrieving next one
- BX_FD_THIS s.floppy_buffer_index = 0;
- if (DEV_dma_get_tc()) { // Terminal Count line, done
- BX_FD_THIS s.status_reg0 = (BX_FD_THIS s.head[drive] << 2) | drive;
- BX_FD_THIS s.status_reg1 = 0;
- BX_FD_THIS s.status_reg2 = 0;
+ data_byte += xfer_len;
+ len -= (Bit16u)xfer_len;
- if (bx_dbg.floppy) {
- BX_INFO(("<<READ DONE>>"));
- BX_INFO(("AFTER"));
- BX_INFO((" drive = %u", (unsigned) drive));
- BX_INFO((" head = %u", (unsigned) BX_FD_THIS s.head[drive]));
- BX_INFO((" cylinder = %u", (unsigned) BX_FD_THIS s.cylinder[drive]));
- BX_INFO((" sector = %u", (unsigned) BX_FD_THIS s.sector[drive]));
- }
+ if (BX_FD_THIS s.floppy_buffer_index >= 512) {
+ increment_sector(); // increment to next sector before retrieving next one
+ BX_FD_THIS s.floppy_buffer_index = 0;
+
+ // Only needed if more data to transfer
+ if (!DEV_dma_get_tc()) {
+ Bit32u logical_sector;
+
+ // original assumed all floppies had two sides...now it does not *delete this comment line*
+ logical_sector = (BX_FD_THIS s.cylinder[drive] * BX_FD_THIS s.media[drive].heads *
+ BX_FD_THIS s.media[drive].sectors_per_track) +
+ (BX_FD_THIS s.head[drive] *
+ BX_FD_THIS s.media[drive].sectors_per_track) +
+ (BX_FD_THIS s.sector[drive] - 1);
- DEV_dma_set_drq(FLOPPY_DMA_CHAN, 0);
- enter_result_phase();
+ floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
+ 512, FROM_FLOPPY);
+ }
}
- else { // more data to transfer
- Bit32u logical_sector;
-
- // original assumed all floppies had two sides...now it does not *delete this comment line*
- logical_sector = (BX_FD_THIS s.cylinder[drive] * BX_FD_THIS s.media[drive].heads *
- BX_FD_THIS s.media[drive].sectors_per_track) +
- (BX_FD_THIS s.head[drive] *
- BX_FD_THIS s.media[drive].sectors_per_track) +
- (BX_FD_THIS s.sector[drive] - 1);
+ } while (len!=0xffff);
+
+ // If DMA transfer is over
+ if (DEV_dma_get_tc()) { // Terminal Count line, done
+ BX_FD_THIS s.status_reg0 = (BX_FD_THIS s.head[drive] << 2) | drive;
+ BX_FD_THIS s.status_reg1 = 0;
+ BX_FD_THIS s.status_reg2 = 0;
+
+ if (bx_dbg.floppy) {
+ BX_INFO(("<<READ DONE>>"));
+ BX_INFO(("AFTER"));
+ BX_INFO((" drive = %u", (unsigned) drive));
+ BX_INFO((" head = %u", (unsigned) BX_FD_THIS s.head[drive]));
+ BX_INFO((" cylinder = %u", (unsigned) BX_FD_THIS s.cylinder[drive]));
+ BX_INFO((" sector = %u", (unsigned) BX_FD_THIS s.sector[drive]));
+ }
- floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
- 512, FROM_FLOPPY);
+ DEV_dma_set_drq(FLOPPY_DMA_CHAN, 0);
+ enter_result_phase();
}
- }
+ return;
}
void
-bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
+bx_floppy_ctrl_c::dma_read(Bit8u *data_byte, Bit16u len)
{
// A DMA read is from Memory to I/O
// We need to write the data_byte which was already transfered from memory
// via DMA to I/O (write block to floppy)
+ //
+ // len is the length of the DMA transfert minus 1 byte
Bit8u drive;
Bit32u logical_sector;
drive = BX_FD_THIS s.DOR & 0x03;
+
if (BX_FD_THIS s.pending_command == 0x4d) { // format track in progress
+ do {
--BX_FD_THIS s.format_count;
switch (3 - (BX_FD_THIS s.format_count & 0x03)) {
case 0:
@@ -1187,50 +1212,76 @@
BX_DEBUG(("formatting cylinder %u head %u sector %u",
BX_FD_THIS s.cylinder[drive], BX_FD_THIS s.head[drive],
BX_FD_THIS s.sector[drive]));
- for (unsigned i = 0; i < 512; i++) {
- BX_FD_THIS s.floppy_buffer[i] = BX_FD_THIS s.format_fillbyte;
- }
+ memset(BX_FD_THIS s.floppy_buffer, BX_FD_THIS s.format_fillbyte, 512);
// original assumed all floppies had two sides...now it does not *delete this comment line*
- logical_sector = (BX_FD_THIS s.cylinder[drive] * BX_FD_THIS s.media[drive].heads * BX_FD_THIS s.media[drive].sectors_per_track) +
+ logical_sector = (BX_FD_THIS s.cylinder[drive] * BX_FD_THIS s.media[drive].heads *
+ BX_FD_THIS s.media[drive].sectors_per_track) +
(BX_FD_THIS s.head[drive] * BX_FD_THIS s.media[drive].sectors_per_track) +
(BX_FD_THIS s.sector[drive] - 1);
floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
512, TO_FLOPPY);
break;
}
+
+ len --;
+ data_byte++;
+ } while (len != 0xffff);
+
if ((BX_FD_THIS s.format_count == 0) || (DEV_dma_get_tc())) {
BX_FD_THIS s.format_count = 0;
BX_FD_THIS s.status_reg0 = (BX_FD_THIS s.head[drive] << 2) | drive;
DEV_dma_set_drq(FLOPPY_DMA_CHAN, 0);
enter_result_phase();
}
+
return;
}
+ else { // format track not in progress
+ if ( BX_FD_THIS s.media[drive].write_protected ) {
+ // write protected error
+ BX_INFO(("tried to write disk %u, which is write-protected", drive));
+ // ST0: IC1,0=01 (abnormal termination: started execution but failed)
+ BX_FD_THIS s.status_reg0 = 0x40 | (BX_FD_THIS s.head[drive]<<2) | drive;
+ // ST1: DataError=1, NDAT=1, NotWritable=1, NID=1
+ BX_FD_THIS s.status_reg1 = 0x27; // 0010 0111
+ // ST2: CRCE=1, SERR=1, BCYL=1, NDAM=1.
+ BX_FD_THIS s.status_reg2 = 0x31; // 0011 0001
+ enter_result_phase();
+ return;
+ }
- BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index++] = *data_byte;
+ Bit32u xfer_len;
- if (BX_FD_THIS s.floppy_buffer_index >= 512) {
- // original assumed all floppies had two sides...now it does not *delete this comment line*
- logical_sector = (BX_FD_THIS s.cylinder[drive] * BX_FD_THIS s.media[drive].heads * BX_FD_THIS s.media[drive].sectors_per_track) +
- (BX_FD_THIS s.head[drive] * BX_FD_THIS s.media[drive].sectors_per_track) +
- (BX_FD_THIS s.sector[drive] - 1);
- if ( BX_FD_THIS s.media[drive].write_protected ) {
- // write protected error
- BX_INFO(("tried to write disk %u, which is write-protected", drive));
- // ST0: IC1,0=01 (abnormal termination: started execution but failed)
- BX_FD_THIS s.status_reg0 = 0x40 | (BX_FD_THIS s.head[drive]<<2) | drive;
- // ST1: DataError=1, NDAT=1, NotWritable=1, NID=1
- BX_FD_THIS s.status_reg1 = 0x27; // 0010 0111
- // ST2: CRCE=1, SERR=1, BCYL=1, NDAM=1.
- BX_FD_THIS s.status_reg2 = 0x31; // 0011 0001
- enter_result_phase();
- return;
+ if ( BX_FD_THIS s.floppy_buffer_index >= 512)
+ BX_PANIC(("Index should not be >= 512"));
+
+ do {
+
+ xfer_len = 512 - BX_FD_THIS s.floppy_buffer_index;
+ if (xfer_len > ((Bit32u)len + 1)) xfer_len = (Bit32u)len + 1;
+ if (xfer_len == 1)
+ BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index++] = *data_byte;
+ else {
+ memcpy(&BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index],data_byte,xfer_len);
+ BX_FD_THIS s.floppy_buffer_index += xfer_len;
}
- floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
+
+ data_byte += xfer_len;
+ len -= (Bit16u)xfer_len;
+
+ if (BX_FD_THIS s.floppy_buffer_index >= 512) {
+ // original assumed all floppies had two sides...now it does not *delete this comment line*
+ logical_sector = (BX_FD_THIS s.cylinder[drive] * BX_FD_THIS s.media[drive].heads * BX_FD_THIS s.media[drive].sectors_per_track) +
+ (BX_FD_THIS s.head[drive] * BX_FD_THIS s.media[drive].sectors_per_track) +
+ (BX_FD_THIS s.sector[drive] - 1);
+ floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
512, TO_FLOPPY);
- increment_sector(); // increment to next sector after writing current one
- BX_FD_THIS s.floppy_buffer_index = 0;
- if (DEV_dma_get_tc()) { // Terminal Count line, done
+ increment_sector(); // increment to next sector after writing current one
+ BX_FD_THIS s.floppy_buffer_index = 0;
+ } // if BX_FD_THIS s.floppy_buffer_index >= 512
+ } while (len != 0xffff);
+
+ if (DEV_dma_get_tc()) { // Terminal Count line, done
BX_FD_THIS s.status_reg0 = (BX_FD_THIS s.head[drive] << 2) | drive;
BX_FD_THIS s.status_reg1 = 0;
BX_FD_THIS s.status_reg2 = 0;
@@ -1243,13 +1294,11 @@
BX_INFO((" cylinder = %u", (unsigned) BX_FD_THIS s.cylinder[drive]));
BX_INFO((" sector = %u", (unsigned) BX_FD_THIS s.sector[drive]));
}
-
+
DEV_dma_set_drq(FLOPPY_DMA_CHAN, 0);
enter_result_phase();
- }
- else { // more data to transfer
- } // else
- } // if BX_FD_THIS s.floppy_buffer_index >= 512
+ }
+ }
}
void
@@ -1286,8 +1335,8 @@
if (BX_FD_THIS s.cylinder[drive] >= BX_FD_THIS s.media[drive].tracks) {
// Set to 1 past last possible cylinder value.
// I notice if I set it to tracks-1, prama linux won't boot.
+ BX_INFO(("increment_sector: clamping cylinder %x to max",BX_FD_THIS s.cylinder[drive]));
BX_FD_THIS s.cylinder[drive] = BX_FD_THIS s.media[drive].tracks;
- BX_INFO(("increment_sector: clamping cylinder to max"));
}
}
}
Index: iodev/floppy.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/floppy.h,v
retrieving revision 1.17
diff -u -r1.17 floppy.h
--- iodev/floppy.h 7 Feb 2004 14:34:34 -0000 1.17
+++ iodev/floppy.h 18 Feb 2004 13:42:04 -0000
@@ -123,8 +123,8 @@
Bit32u read(Bit32u address, unsigned io_len);
void write(Bit32u address, Bit32u value, unsigned io_len);
#endif
- BX_FD_SMF void dma_write(Bit8u *data_byte);
- BX_FD_SMF void dma_read(Bit8u *data_byte);
+ BX_FD_SMF void dma_write(Bit8u *data_byte, Bit16u len);
+ BX_FD_SMF void dma_read(Bit8u *data_byte, Bit16u len);
BX_FD_SMF void floppy_command(void);
BX_FD_SMF void floppy_xfer(Bit8u drive, Bit32u offset, Bit8u *buffer, Bit32u bytes, Bit8u direction);
BX_FD_SMF void raise_interrupt(void);
Index: iodev/iodev.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/iodev.h,v
retrieving revision 1.41
diff -u -r1.41 iodev.h
--- iodev/iodev.h 2 Feb 2004 21:47:26 -0000 1.41
+++ iodev/iodev.h 18 Feb 2004 13:42:05 -0000
@@ -176,16 +176,16 @@
public:
virtual unsigned registerDMA8Channel(
unsigned channel,
- void (* dmaRead)(Bit8u *data_byte),
- void (* dmaWrite)(Bit8u *data_byte),
+ void (* dmaRead)(Bit8u *data_byte, Bit16u len),
+ void (* dmaWrite)(Bit8u *data_byte, Bit16u len),
const char *name
) {
STUBFUNC(dma, registerDMA8Channel); return 0;
}
virtual unsigned registerDMA16Channel(
unsigned channel,
- void (* dmaRead)(Bit16u *data_word),
- void (* dmaWrite)(Bit16u *data_word),
+ void (* dmaRead)(Bit16u *data_word, Bit16u len),
+ void (* dmaWrite)(Bit16u *data_word, Bit16u len),
const char *name
) {
STUBFUNC(dma, registerDMA16Channel); return 0;

View File

@ -0,0 +1,306 @@
----------------------------------------------------------------------
Patch name: patch.floppy-athiel
Author: Alex Thiel (uploaded by cbothamy)
Date: 8 Nov 2002
Status: Proposed
Detailed description:
This patch introduces the implicit termination of data transfer via
end-of-track and data overrun/underrun conditions, as well as non-DMA mode.
The code cleanup is present in CVS now (Volker Ruppert, Dec 1st 2002).
We still have no test case for the non-DMA mode and the overrun/underrun (timeout)
code fails if cpu speedups are enabled. The timeout code expects at least one DMA
cycle within 15 usec (Volker Ruppert, Mar 12th 2005).
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on 11 Mar 2005
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: iodev/floppy.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/floppy.cc,v
retrieving revision 1.77
diff -u -r1.77 floppy.cc
--- iodev/floppy.cc 2005-03-11 21:12:52 +0100
+++ iodev/floppy.cc 2005-03-12 15:23:40 +0200
@@ -73,11 +73,18 @@
#define FD_MS_ACTB 0x02
#define FD_MS_ACTA 0x01
+/* for status registers */
+#define FD_ST_EOT 0x80
+#define FD_ST_OVERRUN 0x10
+
#define FROM_FLOPPY 10
#define TO_FLOPPY 11
#define FLOPPY_DMA_CHAN 2
+#define FD_TIMEOUT 15 // for FIFO overrun/underrun
+#define FD_IRQ_DELAY 2 // delay so the system can detect a INT change
+
typedef struct {
unsigned id;
Bit8u trk;
@@ -391,6 +398,20 @@
break;
case 0x3F5: /* diskette controller data */
+
+ /* data transfer in non-DMA mode */
+ if (BX_FD_THIS s.main_status_reg & FD_MS_NDMA) {
+ BX_FD_THIS dma_write(&value); // write: from controller to cpu
+
+ /* This simulates the FIFO latency, see comment in timer() below. */
+ BX_FD_THIS lower_interrupt();
+ BX_FD_THIS s.main_status_reg &= ~FD_MS_MRQ;
+ // overrides the timer set in dma_write()
+ bx_pc_system.activate_timer(BX_FD_THIS s.floppy_timer_index,
+ FD_IRQ_DELAY, 0);
+ return(value);
+ }
+
if (BX_FD_THIS s.result_size == 0) {
BX_ERROR(("port 0x3f5: no results to read"));
BX_FD_THIS s.main_status_reg = 0;
@@ -527,6 +548,20 @@
break;
case 0x3F5: /* diskette controller data */
+
+ /* data transfer in non-DMA mode */
+ if (BX_FD_THIS s.main_status_reg & FD_MS_NDMA) {
+ BX_FD_THIS dma_read((Bit8u *) &value); // read: from cpu to controller
+
+ /* This simulates the FIFO latency, see comment in timer() below. */
+ BX_FD_THIS lower_interrupt();
+ BX_FD_THIS s.main_status_reg &= ~FD_MS_MRQ;
+ // overrides the timer set in dma_read()
+ bx_pc_system.activate_timer(BX_FD_THIS s.floppy_timer_index,
+ FD_IRQ_DELAY, 0);
+ break;
+ }
+
BX_DEBUG(("command = %02x", (unsigned) value));
if (BX_FD_THIS s.command_complete) {
if (BX_FD_THIS s.pending_command!=0)
@@ -670,7 +705,7 @@
head_load_time = BX_FD_THIS s.command[2] >> 1;
BX_FD_THIS s.non_dma = BX_FD_THIS s.command[2] & 0x01;
if (BX_FD_THIS s.non_dma)
- BX_ERROR(("non DMA mode not implemented yet"));
+ BX_INFO(("non DMA mode selected"));
enter_idle_phase();
return;
break;
@@ -839,10 +874,14 @@
/* 4 header bytes per sector are required */
BX_FD_THIS s.format_count <<= 2;
- DEV_dma_set_drq(FLOPPY_DMA_CHAN, 1);
-
- /* data reg not ready, controller busy */
- BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
+ if (BX_FD_THIS s.non_dma) {
+ BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_NDMA | FD_MS_BUSY;
+ BX_FD_THIS raise_interrupt();
+ } else {
+ /* data reg not ready, controller busy */
+ BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
+ DEV_dma_set_drq(FLOPPY_DMA_CHAN, 1);
+ }
BX_DEBUG(("format track"));
return;
break;
@@ -957,21 +996,25 @@
floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
512, FROM_FLOPPY);
- DEV_dma_set_drq(FLOPPY_DMA_CHAN, 1);
-
- /* data reg not ready, controller busy */
- BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
- return;
- }
- else if ((BX_FD_THIS s.command[0] & 0x7f) == 0x45) { // write
-
- DEV_dma_set_drq(FLOPPY_DMA_CHAN, 1);
-
- /* data reg not ready, controller busy */
- BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
- return;
+ if (BX_FD_THIS s.non_dma) {
+ BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_NDMA | FD_MS_DIO | FD_MS_BUSY;
+ BX_FD_THIS raise_interrupt();
+ } else {
+ /* data reg not ready, controller busy */
+ BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
+ DEV_dma_set_drq(FLOPPY_DMA_CHAN, 1);
+ }
+ } else if ((BX_FD_THIS s.command[0] & 0x7f) == 0x45) { // write
+
+ if (BX_FD_THIS s.non_dma) {
+ BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_NDMA | FD_MS_BUSY;
+ BX_FD_THIS raise_interrupt();
+ } else {
+ /* data reg not ready, controller busy */
+ BX_FD_THIS s.main_status_reg = FD_MS_BUSY;
+ DEV_dma_set_drq(FLOPPY_DMA_CHAN, 1);
}
- else
+ } else
BX_PANIC(("floppy_command(): unknown read/write command"));
return;
@@ -1138,6 +1181,31 @@
enter_result_phase();
break;
+ case 0x4d: // format track
+ case 0x46: // read normal data
+ case 0x66:
+ case 0xc6:
+ case 0xe6:
+ case 0x45: // write normal data
+ case 0xc5:
+ /* During non-DMA operation, the state of the FDC oscillates
+ between IRQ low/MRQ clear (set after data is transferred via 0x3f5)
+ and IRQ high/MRQ set.
+ Whenever the timer is triggered in DMA mode, or in non-DMA mode with
+ MRQ set, we have a data overrun/underrun. */
+ if ((BX_FD_THIS s.main_status_reg & (FD_MS_MRQ | FD_MS_NDMA))
+ == FD_MS_NDMA) { // NDMA & !MRQ
+ BX_FD_THIS raise_interrupt();
+ BX_FD_THIS s.main_status_reg |= FD_MS_MRQ;
+ bx_pc_system.activate_timer(BX_FD_THIS s.floppy_timer_index,
+ FD_TIMEOUT, 0 );
+ } else { // timeout
+ // FIXME: this code requires at least one DMA cycle within 15 usec
+ //BX_FD_THIS s.status_reg1 |= FD_ST_OVERRUN;
+ //enter_result_phase();
+ }
+ break;
+
case 0xfe: // (contrived) RESET
theFloppyController->reset(BX_RESET_SOFTWARE);
BX_FD_THIS s.pending_command = 0;
@@ -1163,9 +1231,11 @@
// We need to return then next data byte from the floppy buffer
// to be transfered via the DMA to memory. (read block from floppy)
-
*data_byte = BX_FD_THIS s.floppy_buffer[BX_FD_THIS s.floppy_buffer_index++];
+ // reschedule timeout
+ bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index, FD_TIMEOUT, 0 );
+
if (BX_FD_THIS s.floppy_buffer_index >= 512) {
Bit8u drive;
@@ -1174,7 +1244,6 @@
BX_FD_THIS s.floppy_buffer_index = 0;
if (DEV_dma_get_tc()) { // Terminal Count line, done
BX_FD_THIS s.status_reg0 = (BX_FD_THIS s.head[drive] << 2) | drive;
- BX_FD_THIS s.status_reg1 = 0;
BX_FD_THIS s.status_reg2 = 0;
if (bx_dbg.floppy) {
@@ -1215,6 +1284,9 @@
Bit8u drive;
Bit32u logical_sector;
+ // reschedule timeout
+ bx_pc_system.activate_timer( BX_FD_THIS s.floppy_timer_index, FD_TIMEOUT, 0 );
+
drive = BX_FD_THIS s.DOR & 0x03;
if (BX_FD_THIS s.pending_command == 0x4d) { // format track in progress
--BX_FD_THIS s.format_count;
@@ -1279,7 +1351,6 @@
BX_FD_THIS s.floppy_buffer_index = 0;
if (DEV_dma_get_tc()) { // Terminal Count line, done
BX_FD_THIS s.status_reg0 = (BX_FD_THIS s.head[drive] << 2) | drive;
- BX_FD_THIS s.status_reg1 = 0;
BX_FD_THIS s.status_reg2 = 0;
if (bx_dbg.floppy) {
@@ -1322,6 +1393,14 @@
drive = BX_FD_THIS s.DOR & 0x03;
+ if (BX_FD_THIS s.status_reg1 & FD_ST_EOT) {
+ /* increment past EOT: abnormal termination */
+ BX_FD_THIS s.status_reg0 = 0x40 | (BX_FD_THIS s.head[drive]<<2) | drive;
+ DEV_dma_set_drq(FLOPPY_DMA_CHAN, 0);
+ enter_result_phase();
+ return;
+ }
+
// values after completion of data xfer
// ??? calculation depends on base_count being multiple of 512
BX_FD_THIS s.sector[drive] ++;
@@ -1344,6 +1423,12 @@
BX_INFO(("increment_sector: clamping cylinder to max"));
}
}
+
+ /* check end-of-track condition */
+ if ((BX_FD_THIS s.multi_track == BX_FD_THIS s.head[drive]) &&
+ (BX_FD_THIS s.sector[drive] == BX_FD_THIS s.media[drive].sectors_per_track)) {
+ BX_FD_THIS s.status_reg1 |= FD_ST_EOT;
+ }
}
unsigned
@@ -1702,14 +1787,23 @@
BX_FD_THIS s.result[0] = BX_FD_THIS s.status_reg0;
BX_FD_THIS s.result[1] = BX_FD_THIS s.cylinder[drive];
break;
- case 0x4a: // read ID
- case 0x4d: // format track
case 0x46: // read normal data
case 0x66:
case 0xc6:
case 0xe6:
case 0x45: // write normal data
case 0xc5:
+ /* increment sector once more if we terminated normally at EOT */
+ if ((BX_FD_THIS s.status_reg0 & 0xc0) == 0x00 &&
+ (BX_FD_THIS s.status_reg1 & FD_ST_EOT)) {
+ BX_FD_THIS s.status_reg1 &= ~FD_ST_EOT; // clear EOT flag
+ increment_sector();
+ // reset the head bit
+ BX_FD_THIS s.status_reg0 &= 0xfb;
+ BX_FD_THIS s.status_reg0 |= (BX_FD_THIS s.head[drive] << 2);
+ }
+ case 0x4a: // read ID
+ case 0x4d: // format track
BX_FD_THIS s.result_size = 7;
BX_FD_THIS s.result[0] = BX_FD_THIS s.status_reg0;
BX_FD_THIS s.result[1] = BX_FD_THIS s.status_reg1;
@@ -1718,6 +1812,8 @@
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; /* sector size code */
+
+ bx_pc_system.deactivate_timer( BX_FD_THIS s.floppy_timer_index ); // clear pending timeout
BX_FD_THIS raise_interrupt();
break;
}
@@ -1729,6 +1825,11 @@
BX_FD_THIS s.main_status_reg &= 0x0f; // leave drive status untouched
BX_FD_THIS s.main_status_reg |= FD_MS_MRQ; // data register ready
+ /* do not touch ST0 and ST3 since these may be queried later via
+ commands 0x08 and 0x04, respectively. */
+ BX_FD_THIS s.status_reg1 = 0;
+ BX_FD_THIS s.status_reg2 = 0;
+
BX_FD_THIS s.command_complete = 1; /* waiting for new command */
BX_FD_THIS s.command_index = 0;
BX_FD_THIS s.command_size = 0;

View File

@ -0,0 +1,165 @@
----------------------------------------------------------------------
Patch name: patch.hosttime-port
Author: cbbochs@free.fr
Date: July, 31th 2002
Detailed description:
This patch enables the guest to read to host time (linux only).
Port 0x8901 is used. Two time values can be set and
read, along with the difference of the two.
This can be useful to do performance tests.
port 0x8901 :
Writes can be bytes, word, dword
Reads must be dword
write 0x00 : set both times to 0
write 0x01 : set the first time
write 0x02 : set the second time
write 0x03 : set the both time
write 0x11 : the seconds of the first time will be read from 0x8901
write 0x12 : the microseconds of the first time will be read from 0x8901
write 0x21 : the seconds of the second time will be read from 0x8901
write 0x22 : the microseconds of the second time will be read from 0x8901
write 0x31 : the seconds of the difference will be read from 0x8901
write 0x32 : the microseconds of the difference will be read from 0x8901
Additionnal values have been defined for language that can't do 32bits
port access. Please look in the source.
Example : Set first time, then second time, and get the difference :
outb(0x8901, 0x01); // Set first time
outb(0x8901, 0x02); // Set second time
outb(0x8901, 0x31); // Read difference : seconds fields
sec = inl(0x8901);
outb(0x8901, 0x32); // Read difference : microseconds fields
usec = inl(0x8901);
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on July, 31th 2002
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: iodev/unmapped.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/unmapped.cc,v
retrieving revision 1.17
diff -u -r1.17 unmapped.cc
--- iodev/unmapped.cc 30 Jul 2002 08:48:03 -0000 1.17
+++ iodev/unmapped.cc 31 Jul 2002 09:01:23 -0000
@@ -137,6 +137,40 @@
retval = 0xffffffff;
BX_DEBUG(("unsupported IO read from port %04x", address));
break;
+#ifdef __linux__
+ case 0x8901: // host-time port
+ struct timeval diff;
+ retval = 0;
+
+ if (timercmp(& BX_UM_THIS s.hosttime_value1, & BX_UM_THIS s.hosttime_value2, < ) )
+ timersub(& BX_UM_THIS s.hosttime_value2, & BX_UM_THIS s.hosttime_value1, &diff);
+ else
+ timersub(& BX_UM_THIS s.hosttime_value1, & BX_UM_THIS s.hosttime_value2, &diff);
+
+ switch (BX_UM_THIS s.hosttime_field) {
+ case 0x11: retval = BX_UM_THIS s.hosttime_value1.tv_sec; break;
+ case 0x12: retval = BX_UM_THIS s.hosttime_value1.tv_usec; break;
+ case 0x1C: retval = BX_UM_THIS s.hosttime_value1.tv_sec & 0xffff; break;
+ case 0x1D: retval = BX_UM_THIS s.hosttime_value1.tv_sec >> 16; break;
+ case 0x1E: retval = BX_UM_THIS s.hosttime_value1.tv_usec & 0xffff; break;
+ case 0x1F: retval = BX_UM_THIS s.hosttime_value1.tv_usec >> 16; break;
+ case 0x21: retval = BX_UM_THIS s.hosttime_value2.tv_sec; break;
+ case 0x22: retval = BX_UM_THIS s.hosttime_value2.tv_usec; break;
+ case 0x2C: retval = BX_UM_THIS s.hosttime_value2.tv_sec & 0xffff; break;
+ case 0x2D: retval = BX_UM_THIS s.hosttime_value2.tv_sec >> 16; break;
+ case 0x2E: retval = BX_UM_THIS s.hosttime_value2.tv_usec & 0xffff; break;
+ case 0x2F: retval = BX_UM_THIS s.hosttime_value2.tv_usec >> 16; break;
+ case 0x31: retval = diff.tv_sec; break;
+ case 0x32: retval = diff.tv_usec; break;
+ case 0x3C: retval = diff.tv_sec & 0xffff; break;
+ case 0x3D: retval = diff.tv_sec >> 16; break;
+ case 0x3E: retval = diff.tv_usec & 0xffff; break;
+ case 0x3F: retval = diff.tv_usec >> 16; break;
+ }
+
+ break;
+#endif
+
default:
retval = 0xffffffff;
}
@@ -256,6 +290,51 @@
BX_CPU(0)->kill_bochs_request = 2;
}
break;
+
+#ifdef __linux__
+ case 0x8901: // host-time port
+ switch (value) {
+ case 0x01: // set first time
+ gettimeofday(& BX_UM_THIS s.hosttime_value1, NULL);
+ break;
+ case 0x02: // set second time
+ gettimeofday(& BX_UM_THIS s.hosttime_value2, NULL);
+ break;
+ case 0x03: // set both times
+ gettimeofday(& BX_UM_THIS s.hosttime_value1, NULL);
+ BX_UM_THIS s.hosttime_value2.tv_sec = BX_UM_THIS s.hosttime_value1.tv_sec;
+ BX_UM_THIS s.hosttime_value2.tv_usec = BX_UM_THIS s.hosttime_value1.tv_usec;
+ break;
+ case 0x11: // retrieve sec from first time // 32 bits
+ case 0x12: // retrieve usec from first time // 32 bits
+ case 0x1C: // retrieve sec from first time // low 16 bits
+ case 0x1D: // retrieve sec from first time // high 16 bits
+ case 0x1E: // retrieve usec from first time // low 16 bits
+ case 0x1F: // retrieve usec from first time // high 16 bits
+ case 0x21: // retrieve sec from second time // 32 bits
+ case 0x22: // retrieve usec from second time // 32 bits
+ case 0x2C: // retrieve sec from second time // low 16 bits
+ case 0x2D: // retrieve sec from second time // high 16 bits
+ case 0x2E: // retrieve usec from second time // low 16 bits
+ case 0x2F: // retrieve usec from second time // high 16 bits
+ case 0x31: // retrieve sec from difference // 32 bits
+ case 0x32: // retrieve usec from difference // 32 bits
+ case 0x3C: // retrieve sec from difference // low 16 bits
+ case 0x3D: // retrieve sec from difference // high 16 bits
+ case 0x3E: // retrieve usec from difference // low 16 bits
+ case 0x3F: // retrieve usec from difference // high 16 bits
+ BX_UM_THIS s.hosttime_field = value;
+ break;
+ default:
+ BX_UM_THIS s.hosttime_field = 0;
+ BX_UM_THIS s.hosttime_value1.tv_sec = 0;
+ BX_UM_THIS s.hosttime_value1.tv_usec = 0;
+ BX_UM_THIS s.hosttime_value2.tv_sec = 0;
+ BX_UM_THIS s.hosttime_value2.tv_usec = 0;
+ break;
+ }
+ break;
+#endif
case 0xfedc:
bx_dbg.debugger = (value > 0);
Index: iodev/unmapped.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/unmapped.h,v
retrieving revision 1.8
diff -u -r1.8 unmapped.h
--- iodev/unmapped.h 29 Jul 2002 12:44:47 -0000 1.8
+++ iodev/unmapped.h 31 Jul 2002 09:01:23 -0000
@@ -56,6 +56,11 @@
Bit8u port80;
Bit8u port8e;
Bit8u shutdown;
+#ifdef __linux__
+ Bit8u hosttime_field;
+ struct timeval hosttime_value1;
+ struct timeval hosttime_value2;
+#endif
} s; // state information
bx_devices_c *devices;

View File

@ -0,0 +1,161 @@
----------------------------------------------------------------------
Patch name: patch.marklog
Author: Carl Sopchak
Date: May, 1st 2002
Detailed description:
While working on getting SCO OSR5 installed into bochs,
I added this mod to the gui programs. It adds a button
(labelled XX LOG; my bitmap artsmanship leaves MUCH to
be desired!) to the gui bar that writes a BX_ERROR
entry into the log file. The format of the entry is:
tttttttttt-x-@eeeeeeee[XGUI ]
================================
Log Marker # nnnn
================================
where nnnn is a sequential number from the beginning of
the bochs session. A message is also written to stdout
stating that the entry was logged, which also shows the
number.
This is useful to log demarcation points in the log
file (e.g., "skip everything before marker #1"; "stuff
between markers 3 & 4 is where the hard disk gets
initialized", etc.)
Please make this a part of the standard bochs package.
Thanks,
Carl
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on May, 1st 2002
Instructions:
To patch, go to main bochs directory.
Type "cd gui"
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: gui.h
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/gui.h,v
retrieving revision 1.27
diff -u -r1.27 gui.h
--- gui.h 20 Apr 2002 07:19:35 -0000 1.27
+++ gui.h 1 May 2002 18:13:03 -0000
@@ -78,6 +78,7 @@
static void cdromD_handler(void);
static void reset_handler(void);
static void power_handler(void);
+ static void marklog_handler(void);
static void copy_handler(void);
static void paste_handler(void);
static void snapshot_handler(void);
@@ -91,6 +92,7 @@
unsigned floppyA_bmap_id, floppyA_eject_bmap_id, floppyA_hbar_id;
unsigned floppyB_bmap_id, floppyB_eject_bmap_id, floppyB_hbar_id;
unsigned cdromD_bmap_id, cdromD_eject_bmap_id, cdromD_hbar_id;
+ unsigned marklog_bmap_id, marklog_hbar_id;
unsigned power_bmap_id, power_hbar_id;
unsigned reset_bmap_id, reset_hbar_id;
unsigned copy_bmap_id, copy_hbar_id;
@@ -98,11 +100,13 @@
unsigned snapshot_bmap_id, snapshot_hbar_id;
unsigned config_bmap_id, config_hbar_id;
unsigned mouse_bmap_id, nomouse_bmap_id, mouse_hbar_id;
+
+ unsigned markercount;
};
#define BX_MAX_PIXMAPS 16
-#define BX_MAX_HEADERBAR_ENTRIES 10
+#define BX_MAX_HEADERBAR_ENTRIES 11
#define BX_HEADER_BAR_Y 32
// align pixmaps towards left or right side of header bar
Index: gui.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/gui.cc,v
retrieving revision 1.41
diff -u -r1.41 gui.cc
--- gui.cc 18 Apr 2002 00:22:19 -0000 1.41
+++ gui.cc 1 May 2002 18:13:03 -0000
@@ -37,6 +37,7 @@
#include "gui/bitmaps/paste.h"
#include "gui/bitmaps/configbutton.h"
#include "gui/bitmaps/cdromd.h"
+#include "gui/bitmaps/marklog.h"
#if BX_WITH_MACOS
# include <Disks.h>
#endif
@@ -75,13 +76,15 @@
BX_GUI_THIS nomouse_bmap_id = create_bitmap(bx_nomouse_bmap,
BX_MOUSE_BMAP_X, BX_MOUSE_BMAP_Y);
-
BX_GUI_THIS power_bmap_id = create_bitmap(bx_power_bmap, BX_POWER_BMAP_X, BX_POWER_BMAP_Y);
BX_GUI_THIS reset_bmap_id = create_bitmap(bx_reset_bmap, BX_RESET_BMAP_X, BX_RESET_BMAP_Y);
BX_GUI_THIS snapshot_bmap_id = create_bitmap(bx_snapshot_bmap, BX_SNAPSHOT_BMAP_X, BX_SNAPSHOT_BMAP_Y);
BX_GUI_THIS copy_bmap_id = create_bitmap(bx_copy_bmap, BX_COPY_BMAP_X, BX_COPY_BMAP_Y);
BX_GUI_THIS paste_bmap_id = create_bitmap(bx_paste_bmap, BX_PASTE_BMAP_X, BX_PASTE_BMAP_Y);
BX_GUI_THIS config_bmap_id = create_bitmap(bx_config_bmap, BX_CONFIG_BMAP_X, BX_CONFIG_BMAP_Y);
+ BX_GUI_THIS marklog_bmap_id = create_bitmap(bx_marklog_bmap, BX_MARKLOG_BMAP_X, BX_MARKLOG_BMAP_Y);
+
+ BX_GUI_THIS markercount = 0;
// Add the initial bitmaps to the headerbar, and enable callback routine, for use
@@ -145,6 +148,9 @@
// Copy button
BX_GUI_THIS copy_hbar_id = headerbar_bitmap(BX_GUI_THIS copy_bmap_id,
BX_GRAVITY_RIGHT, copy_handler);
+ // Mark Log button
+ BX_GUI_THIS marklog_hbar_id = headerbar_bitmap(BX_GUI_THIS marklog_bmap_id,
+ BX_GRAVITY_RIGHT, marklog_handler);
show_headerbar();
}
@@ -262,6 +268,15 @@
bx_pc_system.ResetSignal( PCS_SET ); /* XXX is this right? */
for (int i=0; i<BX_SMP_PROCESSORS; i++)
BX_CPU(i)->reset(BX_RESET_HARDWARE);
+}
+
+ void
+bx_gui_c::marklog_handler(void)
+{
+ // the user pressed Mark Log button, so write error marker to log file
+ BX_GUI_THIS markercount += 1;
+ BX_ERROR (("\n================================\nLog Marker # %d\n================================", BX_GUI_THIS markercount));
+ fprintf (stderr, "Marker # %d written to log.\n", BX_GUI_THIS markercount);
}
void
--- /dev/null Thu Aug 30 16:30:55 2001
+++ bitmaps/marklog.h Wed May 1 09:58:00 2002
@@ -0,0 +1,20 @@
+/////////////////////////////////////////////////////////////////////////
+// $Id: patch.marklog,v 1.1 2002-05-01 21:07:13 cbothamy Exp $
+/////////////////////////////////////////////////////////////////////////
+//
+#define BX_MARKLOG_BMAP_X 32
+#define BX_MARKLOG_BMAP_Y 32
+
+static const unsigned char bx_marklog_bmap[(BX_MARKLOG_BMAP_X * BX_MARKLOG_BMAP_Y)/8] = {
+ 0x60, 0x18, 0x86, 0x01, 0xc0, 0x0c, 0xcc, 0x00, 0x80, 0x07, 0x78, 0x00,
+ 0x00, 0x03, 0x30, 0x00, 0x80, 0x07, 0x78, 0x00, 0xc0, 0x0c, 0xcc, 0x00,
+ 0x60, 0x18, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x30, 0x18, 0x00,
+ 0x00, 0x30, 0x18, 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x30, 0x18, 0x00,
+ 0x00, 0x30, 0x18, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x00, 0x30, 0x1e, 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x30, 0x18, 0x00,
+ 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00
+ };

View File

@ -0,0 +1,53 @@
----------------------------------------------------------------------
Patch name: patch.mingw-resources
Author: Jeroen Janssen
Date: 2003-08-19
Status: not applied
Detailed description:
Changes the .rc (resource) files to use forware (/) style slashes
instead of backwards style ones.
This allows for crosscompilation from linux using a crosscompiler.
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on DATE, release version VER
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: win32res.rc
===================================================================
RCS file: /cvsroot/bochs/bochs/win32res.rc,v
retrieving revision 1.4
diff -u -r1.4 win32res.rc
--- win32res.rc 15 Jul 2003 21:02:05 -0000 1.4
+++ win32res.rc 19 Aug 2003 16:40:03 -0000
@@ -1,7 +1,7 @@
#include <windows.h>
-#include "gui\win32res.h"
+#include "gui/win32res.h"
-ICON_BOCHS ICON build\win32\nsis\bochs.ico
+ICON_BOCHS ICON build/win32/nsis/bochs.ico
ASK_DLG DIALOG 30, 30, 200, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
Index: wxbochs.rc
===================================================================
RCS file: /cvsroot/bochs/bochs/wxbochs.rc,v
retrieving revision 1.4
diff -u -r1.4 wxbochs.rc
--- wxbochs.rc 13 Jul 2003 23:30:55 -0000 1.4
+++ wxbochs.rc 19 Aug 2003 16:40:03 -0000
@@ -1,5 +1,5 @@
#include "config.h"
-icon_bochs ICON build\win32\nsis\bochs.ico
+icon_bochs ICON build/win32/nsis/bochs.ico
#include "wx/msw/wx.rc"
#if BX_WITH_WIN32
#include "win32res.rc"