Commit Graph

3129 Commits

Author SHA1 Message Date
Bryce Denney
fa56678dc0 - for win32 DLL plugin build, link with $(CDROM_OBJS) instead of writing
cdrom.o explicitly.  This makes it so that cdrom.o is only linked in
  when the configure script enables it.
2002-10-28 05:26:09 +00:00
Christophe Bothamy
b8bbe1c7c2 - compile rombios.c r1.74 2002-10-28 00:18:40 +00:00
Bryce Denney
db750f8234 - to make the "idle hack" compile again, add virtual function sim_is_idle
to bx_gui_c and to bx_x_gui_c.
2002-10-27 23:33:13 +00:00
Christophe Bothamy
d5443fcba3 - change offset of the answer to the identify device query where current disk geometry is read.
Thanks to Adam Sulmicki
2002-10-27 23:04:59 +00:00
Bryce Denney
4f53ba4e39 - bx_gui is now a pointer, so it needs to be 'bx_gui->' not 'bx_gui.' 2002-10-27 22:26:34 +00:00
Christophe Bothamy
ffc3d88be3 - compile rombios.c r1.73 2002-10-27 21:27:00 +00:00
Christophe Bothamy
814d8b69ef - add "none", "lba", "rechs", "large", "auto" translation
- if translation=auto :
  . translation=none if cylinders <=1024 and heads <=16
  . translation=large if cylinders * heads <= 131072
  . transaltion=lba otherwise
- changes default translation value to "auto"
- add example in .bochsrc
2002-10-27 21:25:33 +00:00
Christophe Bothamy
bd04f51748 - remove tabs from source code
- implement "large" "r-echs" "lba" disk translations
- fix if ( (sc==0x01) && (sn=0x01) ) bug
- fix option field in int13 function 0x48 for harddisks
- fix option field in int13 function 0x48 for cdrom
- add "%u" in printf to handle unsigned values
- remove UDIV
- asm helper asm function ldivul idiv_ and idiv_u
2002-10-27 21:17:03 +00:00
Bryce Denney
8ff15654e8 - add #ifs around use of cr0-4, which didn't all exist on earlier cpus 2002-10-27 15:15:12 +00:00
Bryce Denney
1dfbe73deb - let's try "bx_cdrom" instead of "bx_cdom" 2002-10-27 13:28:30 +00:00
Volker Ruppert
e6348a579e - print an error message when the logfile cannot be opened and use stderr in
that case
2002-10-27 13:20:25 +00:00
Gregory Alexander
cc48301722 Fix for bug #628957
I accidentally left a debug define turned on.
2002-10-27 06:02:47 +00:00
Bryce Denney
954b737dda - apply MacOSX "About Box Patch" from Jeremy Parsons (Br'fin). This fixes
bug [ 626261 ] About Box is awkwardly outdated
2002-10-26 22:06:37 +00:00
Bryce Denney
ddd7d1c173 - there are three different actions related to cdrom. One for --enable-cdrom,
one for --disable-cdrom, and one for the defalt if it's not specified.  The
  enabled action and default are supposed to be the same, but they were
  slightly different, and Bochs on BeOS was able to compile with --enable-cdrom
  but not with the default action.  Solution: now the autoconf actions only
  sets bx_cdrom=0 or bx_cdrom=1.  Then afterward, it tests $bx_cdrom and does
  the enable or disable action.  This will be easier to maintain because there
  is just one copy of each action, instead of two copies that are supposed to
  be kept identical to each other.
2002-10-26 21:51:19 +00:00
Bryce Denney
dd7ad0449d - add missing LOG_THIS to fix compile problem reported by Timothy Schepens 2002-10-26 21:03:21 +00:00
Bryce Denney
99aa099b67 - we renamed the term 'VGA library' to 'display library' a while ago. I
fixed some lingering references to vga library.
2002-10-26 13:22:47 +00:00
Bryce Denney
4717b9bf13 - remove obsolete makefile 2002-10-26 13:19:06 +00:00
Bryce Denney
441eb253f7 - remove references to obsolete hga. Now --enable-vga and --disable-vga
no longer exist.  I think configure will silently ignore them.
- modified:
    iodev/Makefile.in iodev/devices.cc iodev/iodev.h main.cc
    configure.in config.h.in configure build/batch-build.perl
2002-10-26 13:14:11 +00:00
Bryce Denney
79831381de - fix compile problem in old PIT 2002-10-26 03:57:19 +00:00
Bryce Denney
31adc410b7 - fix compile problems in iodebug 2002-10-26 03:53:22 +00:00
Bryce Denney
35b51e3e4f - fix the register trace output which has had EBX, ECX, and EDX values
switched around ever since 1.61 when we started using accessors.  Ooops.
2002-10-25 20:04:40 +00:00
Stanislav Shwartsman
b84f0bd0f2 This was not a cleanup. Those macros were intentionally
there to offer a way to substitute more efficient code
to do the RMW cases.  At the moment, they just map to
the normal functions.

Sorry, restored the previous version ...
2002-10-25 18:26:29 +00:00
Stanislav Shwartsman
a0c1fd60e6 Just little cleanup of macro duplicating an existing code 2002-10-25 17:23:34 +00:00
Bryce Denney
48acd53db4 - all #warnings are now inside #ifdef __GNUC__ ... #endif
Modified Files:
    ltdl.c main.cc plugin.cc cpu/cpu.cc cpu/debugstuff.cc
    cpu/exception.cc cpu/fetchdecode64.cc cpu/init.cc
    cpu/paging.cc gui/siminterface.cc gui/wxmain.cc
    iodev/harddrv.cc
2002-10-25 12:36:44 +00:00
Bryce Denney
eba25386fd - change some #warnings into comments 2002-10-25 12:28:34 +00:00
Bryce Denney
c34fe7ea12 - add tests for plugins and various devices 2002-10-25 12:23:35 +00:00
Bryce Denney
357cf9845f - in rev 1.24 I broke the compile, because I was missing BX_CPU_THIS_PTR
before "mem".  This is fixed now.
2002-10-25 11:54:42 +00:00
Bryce Denney
13d1113b36 - this has been checked in now. removing. 2002-10-25 11:49:27 +00:00
Bryce Denney
cec9135e9f - Apply patch.replace-Boolean rev 1.3. Every "Boolean" is now changed to a
"bx_bool" which is always defined as Bit32u on all platforms.  In Carbon
  specific code, Boolean is still used because the Carbon header files
  define it to unsigned char.
- this fixes bug [ 623152 ] MacOSX: Triple Exception Booting win95.
  The bug was that some code in Bochs depends on Boolean to be a
  32 bit value.  (This should be fixed, but I don't know all the places
  where it needs to be fixed yet.)  Because Carbon defined Boolean as
  an unsigned char, Bochs just followed along and used the unsigned char
  definition to avoid compile problems.  This exposed the dependency
  on 32 bit Boolean on MacOS X only and led to major simulation problems,
  that could only be reproduced and debugged on that platform.
- On the mailing list we debated whether to make all Booleans into "bool" or
  our own type.  I chose bx_bool for several reasons.
  1. Unlike C++'s bool, we can guarantee that bx_bool is the same size on all
     platforms, which makes it much less likely to have more platform-specific
     simulation differences in the future.  (I spent hours on a borrowed
     MacOSX machine chasing bug 618388 before discovering that different sized
     Booleans were the problem, and I don't want to repeat that.)
  2. We still have at least one dependency on 32 bit Booleans which must be
     fixed some time, but I don't want to risk introducing new bugs into the
     simulation just before the 2.0 release.

Modified Files:
    bochs.h config.h.in gdbstub.cc logio.cc main.cc pc_system.cc
    pc_system.h plugin.cc plugin.h bios/rombios.c cpu/apic.cc
    cpu/arith16.cc cpu/arith32.cc cpu/arith64.cc cpu/arith8.cc
    cpu/cpu.cc cpu/cpu.h cpu/ctrl_xfer16.cc cpu/ctrl_xfer32.cc
    cpu/ctrl_xfer64.cc cpu/data_xfer16.cc cpu/data_xfer32.cc
    cpu/data_xfer64.cc cpu/debugstuff.cc cpu/exception.cc
    cpu/fetchdecode.cc cpu/flag_ctrl_pro.cc cpu/init.cc
    cpu/io_pro.cc cpu/lazy_flags.cc cpu/lazy_flags.h cpu/mult16.cc
    cpu/mult32.cc cpu/mult64.cc cpu/mult8.cc cpu/paging.cc
    cpu/proc_ctrl.cc cpu/segment_ctrl_pro.cc cpu/stack_pro.cc
    cpu/tasking.cc debug/dbg_main.cc debug/debug.h debug/sim2.cc
    disasm/dis_decode.cc disasm/disasm.h doc/docbook/Makefile
    docs-html/cosimulation.html fpu/wmFPUemu_glue.cc
    gui/amigaos.cc gui/beos.cc gui/carbon.cc gui/gui.cc gui/gui.h
    gui/keymap.cc gui/keymap.h gui/macintosh.cc gui/nogui.cc
    gui/rfb.cc gui/sdl.cc gui/siminterface.cc gui/siminterface.h
    gui/term.cc gui/win32.cc gui/wx.cc gui/wxmain.cc gui/wxmain.h
    gui/x.cc instrument/example0/instrument.cc
    instrument/example0/instrument.h
    instrument/example1/instrument.cc
    instrument/example1/instrument.h
    instrument/stubs/instrument.cc instrument/stubs/instrument.h
    iodev/cdrom.cc iodev/cdrom.h iodev/cdrom_osx.cc iodev/cmos.cc
    iodev/devices.cc iodev/dma.cc iodev/dma.h iodev/eth_arpback.cc
    iodev/eth_packetmaker.cc iodev/eth_packetmaker.h
    iodev/floppy.cc iodev/floppy.h iodev/guest2host.h
    iodev/harddrv.cc iodev/harddrv.h iodev/ioapic.cc
    iodev/ioapic.h iodev/iodebug.cc iodev/iodev.h
    iodev/keyboard.cc iodev/keyboard.h iodev/ne2k.h
    iodev/parallel.h iodev/pci.cc iodev/pci.h iodev/pic.h
    iodev/pit.cc iodev/pit.h iodev/pit_wrap.cc iodev/pit_wrap.h
    iodev/sb16.cc iodev/sb16.h iodev/serial.cc iodev/serial.h
    iodev/vga.cc iodev/vga.h memory/memory.h memory/misc_mem.cc
2002-10-25 11:44:41 +00:00
Bryce Denney
605b88ec2f - the plugin merge broke all sorts of things in this patch. I cleaned
it up and this version applies cleanly again.  If testing goes well
  I will commit it ASAP.
2002-10-25 03:40:57 +00:00
Bryce Denney
6aa472fdb0 - add some tests that enable SSE
- add CFLAGS and CXXFLAGS, set to "-g -O2 -Wall"
2002-10-25 02:50:06 +00:00
Bryce Denney
5e520261db Add plugin support to Bochs by merging all the changes from the
BRANCH_PLUGINS branch!

Authors:
  Bryce Denney
  Christophe Bothamy
  Kevin Lawton (we grabbed a lot of plugin code from plex86)
Testing help from:
  Volker Ruppert
  Don Becker (Psyon)
  Jeremy Parsons (Br'fin)

The change log is too long to paste in here.  To read the change log, do
  cvs log patches/patch.final-from-BRANCH_PLUGINS.gz

All the changes and a detailed description are contained in a patch
called patch.final-from-BRANCH_PLUGINS.gz.  To look at the complete
patch, do
  cvs upd -r1.1 patches/patch.final-from-BRANCH_PLUGINS.gz

Then you will have a local copy of the patch, which you can gunzip and
play with however you want.

Modified Files:
    .bochsrc Makefile.in aclocal.m4 bochs.h config.h.in configure
    configure.in gdbstub.cc logio.cc main.cc pc_system.cc
    pc_system.h state_file.h bios/Makefile.in bios/rombios.c
    cpu/Makefile.in cpu/access.cc cpu/apic.cc cpu/arith16.cc
    cpu/arith32.cc cpu/arith8.cc cpu/cpu.cc cpu/cpu.h
    cpu/ctrl_xfer32.cc cpu/exception.cc cpu/fetchdecode.cc
    cpu/fetchdecode64.cc cpu/flag_ctrl.cc cpu/flag_ctrl_pro.cc
    cpu/init.cc cpu/io.cc cpu/logical16.cc cpu/logical32.cc
    cpu/logical8.cc cpu/paging.cc cpu/proc_ctrl.cc
    cpu/protect_ctrl.cc cpu/segment_ctrl_pro.cc cpu/shift16.cc
    cpu/shift32.cc cpu/stack64.cc cpu/string.cc cpu/tasking.cc
    debug/Makefile.in debug/dbg_main.cc disasm/Makefile.in
    doc/docbook/user/user.dbk dynamic/Makefile.in fpu/Makefile.in
    gui/Makefile.in gui/amigaos.cc gui/beos.cc gui/carbon.cc
    gui/control.cc gui/control.h gui/gui.cc gui/gui.h
    gui/keymap.cc gui/keymap.h gui/macintosh.cc gui/nogui.cc
    gui/rfb.cc gui/sdl.cc gui/sdlkeys.h gui/siminterface.cc
    gui/siminterface.h gui/term.cc gui/win32.cc gui/wx.cc
    gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc gui/wxmain.h
    gui/x.cc gui/keymaps/sdl-pc-de.map gui/keymaps/sdl-pc-us.map
    gui/keymaps/x11-pc-de.map instrument/example0/instrument.h
    instrument/example1/instrument.h
    instrument/stubs/instrument.cc instrument/stubs/instrument.h
    iodev/Makefile.in iodev/biosdev.cc iodev/biosdev.h
    iodev/cdrom.cc iodev/cmos.cc iodev/cmos.h iodev/devices.cc
    iodev/dma.cc iodev/dma.h iodev/eth_fbsd.cc iodev/eth_linux.cc
    iodev/eth_null.cc iodev/eth_tap.cc iodev/floppy.cc
    iodev/floppy.h iodev/guest2host.cc iodev/guest2host.h
    iodev/harddrv.cc iodev/harddrv.h iodev/iodebug.cc
    iodev/iodebug.h iodev/iodev.h iodev/keyboard.cc
    iodev/keyboard.h iodev/ne2k.cc iodev/ne2k.h iodev/parallel.cc
    iodev/parallel.h iodev/pci.cc iodev/pci.h iodev/pci2isa.cc
    iodev/pci2isa.h iodev/pic.cc iodev/pic.h iodev/pit.cc
    iodev/pit.h iodev/pit_wrap.cc iodev/pit_wrap.h iodev/sb16.cc
    iodev/sb16.h iodev/scancodes.cc iodev/scancodes.h
    iodev/serial.cc iodev/serial.h iodev/slowdown_timer.cc
    iodev/slowdown_timer.h iodev/unmapped.cc iodev/unmapped.h
    iodev/vga.cc iodev/vga.h memory/Makefile.in memory/memory.cc
    memory/memory.h memory/misc_mem.cc misc/bximage.c
    misc/niclist.c
Added Files:
    README-plugins extplugin.h ltdl.c ltdl.h ltdlconf.h.in
    ltmain.sh plugin.cc plugin.h
2002-10-24 21:07:56 +00:00
Bryce Denney
d8aace9898 Remove the patch from CVS. To get the final plugins patch, do
cvs upd -p -r1.1 patches/patch.final-from-BRANCH_PLUGINS.gz > patch.gz
Then gunzip it and read it!

If all you are looking for is the change log, I will save you the trouble
and paste it in right here...

----------------------------------------------------------------------
Patch name: patch.plugins
Date: Thu Oct 24 16:19:04 EDT 2002
Authors:
  Bryce Denney
  Christophe Bothamy
  Kevin Lawton (we grabbed a lot of plugin code from plex86)
Testing help from:
  Volker Ruppert
  Don Becker (Psyon)
  Jeremy Parsons (Br'fin)

GENERAL NOTES
- All the work on this patch was done in a CVS branch called BRANCH_PLUGINS.
  It was made into a patch mostly for documentation purposes.  You can find
  more details on many things mentioned here in the CVS logs for
  BRANCH_PLUGINS.
- Generally, this patch touches so many files and so many important variables
  that any file that has NOT been test-compiled might not compile anymore.
  We have tried to test every file, but there are some that we just can't
  test without help from others because we don't have every platform avaiable.
  During the bugfix/release process for 2.0 I hope we can get somebody to
  compile every file so that we don't release a broken 2.0.
- WARNING: I didn't diff the configure script, since it will almost always be
  rejected.  You must run autoconf after applying this patch.

USING PLUGINS
- add new configure option --enable-plugins, which turns on plugin support
- added 2 new bochsrc options that let you select which configuration
  interface and which display library you want to use:
    config_interface: control
    display_library: sdl
  There is one restriction though: if you want to use wxWindows at all,
  then it must be selected as both the config_interface and the
  display_library.  These two are not separable.  There could be
  strange interactions between other combinations of libraries that we
  haven't discovered yet.
- now you can configure with several different --with-* options at once,
  and select between them at runtime.  This works with or without plugins
  enabled.  Example:  configure --with-x11 --with-sdl --with-term.
  To choose between them use "display_library: name" in the bochsrc
- add new configure options --with-all-libs which tries to detect all the
  display libraries that can be compiled on your machine, and enables them
  all.  If the detection fails, you can always write a bunch of
  --with-PACKAGE options yourself.
- when you run Bochs, it needs to know where to find its plugins.  For now
  if the plugins are not stored in a default system library path, you need to
  set the LTDL_LIBRARY_PATH environment to a colon-separated list of
  directories to search in to find the plugins.  When you first build
  Bochs, all the plugins are in gui/* and iodev/*.  So this command would
  work (sh syntax):
      LTDL_LIBRARY_PATH=`pwd`/gui:`pwd`/iodev;  export LTDL_LIBRARY_PATH
  There is a slight variation for win32: use a semicolon instead of a
  colon to separate the directories in the list, and the directories should
  start with a drive letter and colon.  Example
      d:/bochs/plugins;d:/bochs-2.0/plugins

PLATFORMS
- on Win32 platforms, plugins currently work in Cygwin/MinGW but some more
  work is needed to support VC++.  The makefiles build .DLL files for
  the plugins using gcc and a program called dlltool.  Remember to
  use semicolons to separate dir names in LTDL_LIBRARY_PATH, and to
  list absolute directories starting with a drive letter.
- on MacOS X, plugins will only work correctly if you install the
  "dlcompat" library.  Dlcompat is part of the OpenDarwin project.
- Bochs plugins work on Linux and Solaris without any extra work.

CONFIGURE AND MAKE
- makefiles in gui and iodev directories have some new options and targets
  for building plugins.  First the object files are sorted into two groups,
  pluggable and non-pluggable.  When you are compiling with plugins, each of
  the pluggable object files is added to the list to compile as plugins.
  If plugins are disabled, all objects are put into a list to compile
  normally.
- remove MDEFINES from top level makefile
- add LDFLAGS to the @LINK@ variable that is set by configure
- add several plugin-related make targets in toplevel, gui, and iodev
  makefiles
- use libtool to build libraries: both static and shared.  Except on win32,
  libtool doesn't do the job so we just use gcc directly with help from
  a program called dlltool.
- use libtool's tiny LTDL library to provide a cross-platform interface
  to the functions that load shared libraries.  The LTDL sources are included
  in the Bochs source code now (ltdl.h and ltdl.c), and also the configure
  script generates ltdlconf.h.  Bryce has done some minor-to-medium intensity
  hacking on LTDL to make it work at all.  To see the changes, do cvs diff
  -r1.1.2.1 -r1.1.2.2 ltdl.c or look at the CVS logs of
  bochs-testing/plugin-test/libltdl/ltdl.c for details.
- add "BOCHSAPI" to every variable, function, and class that any plugin
  will need, for building win32 DLLs.  The BOCHSAPI macro is used
  for DLL building on win32 platforms.  In config.h it is defined as
  __declspec(dllexport), or __declspec(dllimport), or empty.  Config.h
  knows if it should be importing or exporting symbols by the BX_PLUGGABLE
  macro which is defined in all plugin files.

PLUGIN CONFIGURATION INTERFACES AND DISPLAY LIBRARIES
- a configuration interface is a set of menus that lets you change Bochs's
  settings.  You can choose between two configuration interfaces:
  the text mode menus, and the wxWindows graphical interface.
- A display library is the code that shows text and graphics on the
  virtual Bochs screen.  There are many different display libraries
  to choose from, for example X11, win32, BeOS, Carbon(MacOSX), SDL, etc.
  Except for wxWindows, all display libraries look pretty similar.  They
  create a window with a toolbar full of buttons at the top.
- The wxWindows port is BOTH a configuration interface and a display library.
  It has menus and dialog boxes (the config interface) and also a toolbar and
  virtual Bochs screen.
- now the standard main() is used ALL the time, even for wxWindows which
  used to define its own main in the IMPLEMENT_APP macro.  Now we always
  start in main(), and wxWindows uses the IMPLEMENT_APP_NO_MAIN macro.  It
  parses the command line and possibly the configuration file, then according
  to the setting of the param BXP_SEL_CONFIG_INTERFACE it starts the text
  config interface (control) or the wxWindows config interface (loading a
  plugin if necessary).  Now the config interface is responsible for
  starting the simulation at the appropriate time (by calling
  SIM->begin_simulation()), instead of returning and letting main start the
  simulation.  See cvs log for main.cc 1.156.2.14 for more details.
- wxmain.cc's MyApp::OnInit function is called later in the startup
  process than it used to be.  Now main() does the first few steps, such
  as calling bx_init_main(), and starts up the configuration interface
  when it's ready.  This means that the config interface does not get
  to control the messages that appear during command line parsing or
  loading of the .bochsrc.  It may have to change in the future.
- configuration interfaces now must define an initialization function that
  calls SIM->register_configuration_interface with a callback function.
  The callback function is called whenever Bochs needs a simulation
  interface.  This allows us to easily select between them, even when
  support for multiple config interfaces is compiled in.  wxWindows
  has been made into a plugin, but so far control.cc (the text config
  interface) has not due to some difficulties linking bochs without it.
- Bryce intends to rename control.cc to textconfig.cc or something more
  appropriate when the branch merge is done.  When it was created, it was
  called a "control panel" but now that term has been replaced by a
  "configuration interface".
- Each display library file (gui/win32.cc, gui/x.cc, etc.) defines a C++ class
  that descends from bx_gui_c.  bx_gui_c declares some of its methods virtual
  so that the child class can redefine the methods.  The virtual methods are:
  specific_init, text_update, graphics_tile_update, handle_events, flush,
  clear_screen, palette_change, dimension_update, create_bitmap,
  headerbar_bitmap, replace_bitmap, show_headerbar, get_clipboard_text,
  set_clipboard_text, mouse_enabled_changed_specific, and exit.  Also,
  each file needed a plugin_init, which creates an object of the right
  type and sets the global "bx_gui" to it, and a plugin_fini which
  (theoretically) cleans up afterward.  These turned out to be so similar
  that they are defined in a macro called IMPLEMENT_GUI_PLUGIN_CODE(gui_name).
  (As usual, wxWindows is different and needs its own plugin_init and fini
  since it provides both a configuration interface and a display.  It
  registers a config interface and calls MyPanel::OnPluginInit, which is
  in wx.cc, to create a bx_wx_gui_c and set the bx_gui pointer.)
- removed the first argument of bx_gui::specific_init method because it
  is no longer static.  In a virtual method, you always know who "this" is.
- bx_gui::get_sighandler_mask() and bx_gui::sighandler() are always present,
  defined as virtual methods that do nothing.  In term.cc only, they are
  redefined to do whatever term needs to do with them.  This solves problems
  with undefined symbols when you enable term support.
- The various display libraries used to all redefine bx_gui methods instead
  of virtual methods of their own subclass.  This made it impossible to
  compile multiple guis at once.  Because they are all child classes with
  different names, any number can be linked into a binary at once.  This was
  important for plugins, but even without plugins it allows us to compile
  in support for many display libraries and select them at runtime.
- in siminterface, added register_configuration_interface and
  configuration_interface.  The register method is called by the
  init function of a configuration interface (control.cc or wxmain.cc)
  to tell siminterface what function to call when someone wants to start
  the config interface.  To start it, you call configuration_interface(),
  which calls the callback function set up by that init function.
- in siminterface, is_sim_thread, set_sim_thread_func.  These replace the
  global isSimThread function.  I had to make something that was
  1) available if wxWindows was compiled in, compiled as a plugin and
  either loaded, or not., and 2) did not have any link time references
  to wxWindows files.  As with other things, when wxWindows initializes
  it calls SIM->set_sim_thread_func() with a callback function.  When
  anyone calls SIM->is_sim_thread() it calls the callback function, or if
  it hasn't been installed yet it always returns true.

PLUGIN DEVICES
- Plugin devices are not as uniform as plugin display libraries.  There
  are many of them that interact, some provide special functions that other
  devices can call like bx_pic::raise_irq(), and some have to be initialized
  before or after others.  Our implementation of plugin devices works like
  this:
  - each device provides a plugin_init method and a plugin_fini method
  - the plugin_init method can initialize any number of devices and they
    should be "registered" by calling BX_REGISTER_DEVICE_DEVMODEL().
  - all plugin devices descend from a class called bx_devmodel_c.  The devmodel
    class is made up of virtual functions which tell the operations that we
    should be able to do on ANY device.  The real implementation of a device,
    in a child class, will override these methods to implement the real
    behavior of that device.  As an example, the C++ class heirarchy for the
    keyboard device looks like this:

      logfunctions
      |
      +-- bx_devmodel_c
          |
          +-- bx_keyb_stub_c
              |
              +-- bx_keyboard_c

    Logfunctions provides logging capabilities.  bx_devmodel_c provides a
    uniform interface for dealing with any device without even knowing which
    one it is.  bx_keyb_stub_c defines the interfaces that all external
    functions and objects can use, but the implementation of those interfaces
    just does a panic saying that you forgot to load the keyboard plugin.
    Finally, bx_keyboard_c implements all of the missing methods.
  - for devices that provide special functions that other devices can call, we
    make a "stub" class in iodev/iodev.h which has virtual functions that just
    print a panic or warning message.  The real device will create a subclass
    of the stub, which redefines the virtual methods with the actual
    implementation.  This means that we can install an instance of the stub if
    the plugin is not loaded to catch any calls to the device (it's that
    or a segfault).  When the plugin is loaded, we replace the stub with a
    pointer to the real class.  Virtual functions are equivalent in performance
    to setting up function pointers, but the syntax is cleaner and the compiler
    helps to enforce correct usage.
  - because of limitations of shared libraries on some systems such as
    Solaris, it is not safe to rely on global variable constructors being
    called.  So if you write "bx_my_device device;" as a global variable,
    on Solaris the constructor(s) for bx_my_device will not ever be called.
    That's why in the plugin_init function we explictly create the object
    with the "new" operator.
  - every file that can be compiled as a plugin should define BX_PLUGGABLE
    before including config.h.  This is used when building win32 DLLs.
- in plugin.h, define macros for basically every inter-device function,
  for example DEV_dma_register_8bit_channel, BX_MEM_READ_PHYSICAL,
  DEV_hd_read_handler, etc.  The macros are used everywhere instead
  of the direct call to the device, because the macros are designed to
  do the right thing even if the plugin is not loaded.  This is necessary
  even for devices that will always be loaded, but we want to make them
  into a plugin.  Otherwise we can't link bochs because of references to
  undefined symbols.
- in iodev/devices.cc, device plugins are loaded if they are needed.  At
  the moment we still load almost all of them all the time, but it doesn't have
  to be that way.  Serial and Parallel devices are loaded only if they
  are enabled in the bochsrc/config interface.  Devices that can be compiled
  as plugins are called plugin*.  Devices that have not been converted to
  plugins still have their old names like sb16, pit, ne2k.  At the end
  of the bx_devices::init() function we call bx_init_plugins() which
  calls the init function of devices created in plugins.  (Not every
  device, see core plugins vs. optional plugins.)  At the end of
  bx_devices::reset() we call bx_reset_plugins() which calls the reset
  function of devices created in plugins.
- core plugins vs. optional plugins vs. user plugins
  - core plugin: These are so fundamental that Bochs can't even initialize
    without them, for example the CMOS.  The user can substitute his own
    equivalent plugin to replace the CMOS, but he cannot say "Don't load the
    CMOS at all."  Core plugin devices are initialized and reset explictly by
    code in iodev/devices.cc, since the initialization order for some of them
    is critical.  They are currently NOT added to the device list in
    pluginRegisterDevice and pluginRegisterDeviceDevmodel, so that the plugin
    system does not call init() and reset().  If a core plugin cannot be found,
    Bochs will panic.
    (NOT DONE) In the bochsrc we could easily provide a way for the user to
    replace a core plugin with a different plugin that implements the same C++
    interface.  This is not implemented yet.  Example bochsrc line:
      replace_core_plugin: old=pic, new=mypic
  - optional plugin: These can be loaded or not, without affecting Bochs's
    ability to start up and simulate.  Initialization and reset for all
    optional plugins are handled by bx_init_plugins() and bx_reset_plugins(),
    which are now called from bx_devices_c::init() and bx_devices_c::reset().
    Bochs knows how to configure optional plugins at compile time, and they are
    loaded only if the configuration settings enables the device.  Examples:
    serial, parallel.  See the call to is_serial_enabled() in iodev/devices.cc.
    There are some "optional" plugins that you might not ever want to leave
    out, like vga.  Maybe the term optional is not clear and we need to think
    of a better name.  Bochs will panic if an optional plugin cannot be found.
    If the plugin was compiled, then it should be available at runtime too!
  - (NOT DONE) user plugin: These are plugins that Bochs does not know
    anything about at compile time.  The user asks Bochs to load a plugin
    using just its filename.  It loads the plugin and (somehow) gets
    information about what settings the user can configure.  The settings are
    adjusted by either bochsrc lines or the user interface, and then the
    device can be used.  User plugins will probably not be supported until
    after v2.0.
  - These categories might change over time, and more may be added.  We have
    to start somewhere.
- the keyboard timer handler used to control all sorts of things that had very
  little to do with the keyboard!  For example, it would call SIM->periodic()
  and bx_gui->handle_events() to make the gui update when it was supposed to.
  This has been moved into iodev/devices.cc instead.  It didn't really belong
  in the keyboard model, and what if you wanted to simulate with no keyboard
  one day?
- in devices.cc, added the concept of a default I/O handler.  Before, the
  "unmapped" device was initialized first and it would register every single
  I/O port in the whole 64k address space, then other devices would claim the
  ones that they needed.  Now it works differently.  Now, the unmapped device
  registers the default I/O read handler and the default I/O write handler,
  which are represented by BX_DEFAULT_IO_DEVICE.  This is from an email
  conversation with Christophe
  >   Sooner or later, we will need to unregister some ioport handler, because
  > some ports can be moved around the io architecture (for example the PCI
  > IDE Bus Master ioports).  Bochs can not do this at the moment.
  > ...
  >   When another device claims the io address, we change the handler
  > number to the one of the new function.  This behaviour is compatible with
  > the old one.
  >   But when we'll need to unregister an io address handler, we will just
  > reset the handler number to BX_DEFAULT_IO_HANDLER so unmapped is called
  > again when the io port is accessed.
  >   This way, we can have Bochs devices register/unregister/re-register
  > their handlers.
- device init() methods no longer have an argument.  We used to pass in
  a pointer to the global variable bx_devices, which each device would
  (usually) dutifully store and use instead of using the global symbol,
  but it wasn't helping much.  If we start to simulate more than one
  PC at once (who knows? it might happen) then maybe we'll add it back.

BUG FIXES THAT ENDED UP IN THE PLUGIN BRANCH
(maybe should be checked in separately?)
- gdbstub should not call bx_parse_cmdline anymore
- check SIM->get_init_done before calling DEV_kbd_paste_delay_changed.
- in all makefiles move $(BX_INCDIRS) to the front.  Otherwise you can
  accidently get config.h or other important includes from libraries
  when they put -Ipath into CFLAGS.
- add semicolon to the end of a BX_INFO for XADD_EdGd in arith32.cc
- make control.cc ignore BX_ASYNC_EVT_REFRESH and BX_ASYNC_EVT_DBG_MSG
  instead of sending them to default: which prints a warning.
- remove memset(&s, 0, sizeof(s)) in bx_keyb_c constructor.  This memset
  was wiping out some of the fields of the parent class (logfunctions).

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".
----------------------------------------------------------------------
2002-10-24 20:43:08 +00:00
Bryce Denney
cf73a42456 This patch contains all the diffs from the CVS branch called BRANCH_PLUGINS,
and a very detailed description of what was changed.  These changes will
be checked into the CVS trunk momentarily.

Then I will remove the patch, but it will stay around in CVS history
forever as documentation of what we have done.
2002-10-24 20:37:37 +00:00
Bryce Denney
026e0da7fe - removed. This is highly obsolete now. 2002-10-24 20:09:49 +00:00
Bryce Denney
6f49d51996 - avoid crash if BX_CPU_C::debug() called while mem is NULL 2002-10-24 06:26:37 +00:00
Bryce Denney
491b05d4bc - add missing BX_CMOS_THIS to fix the previous rev 2002-10-23 19:37:36 +00:00
Bryce Denney
279901987c - extra {}'s no longer needed now that Volker cleaned up the char* mess
in rev 1.29
2002-10-23 18:59:25 +00:00
Bryce Denney
ab70c14ec6 - print time value that was used for this simulation, in case you want to
set time0 later to duplicate it
2002-10-23 15:50:59 +00:00
Bryce Denney
ffba22d72b - make BX_MAX_TIMERS a function of the number of processors, since each
processor's local apic registers one.  Now BX_MAX_TIMERS is
  (15+BX_SMP_PROCESSORS)
2002-10-23 15:13:10 +00:00
Volker Ruppert
c43564368a - remove trailing spaces from text snapshot
- incrementing variable txt_addr simplified
2002-10-22 17:30:54 +00:00
Bryce Denney
070603cb4d - in gdbstub, the cpu and memory were referred to in some nonstandard ways
such as bx_cpu and bx_mem.  I changed them to BX_CPU(0) and BX_MEM(0).
- we still don't have correct support for debugging with multiple processors,
  so I added a check in bochs.h that will abort the compile if you try
  on GDBstub and processors>1.  If/when gdbstub supports multiple processors
  we can remove this check.
- also I brought attention to, but did not fix, the line that sets
  sockaddr.sin_len = sizeof(sockaddr).  On Linux, sockaddr.sin_len does
  not exist so we have to remove the line.  Since Stu Grossman added this line,
  I've asked him to test without the line and let me know if it works.
- modified: gdbstub.cc, bochs.h
2002-10-22 12:50:56 +00:00
Bryce Denney
10f4667c5d - fix date of previous irc conversation 2002-10-22 03:00:14 +00:00
Christophe Bothamy
957e1b5abe - fix bug [ 625676 ] VC++ do not support S_ISBLK. Block devices are not supported on win32 anyway. 2002-10-21 23:51:49 +00:00
Bryce Denney
b43ca82b5e - in debug message, mention WHICH reserved register was written 2002-10-21 16:57:35 +00:00
Bryce Denney
7f8b965243 ----------------------------------------------------------------------
Patch name: patch.macosx-console-launch-script
Author: Jeremy Parsons <brefin@mac.com>
Date: Wed Oct 16 2002

Detailed description:

Since the Carbon gui does not yet have a console window of its own, then it
can't be configured from the gui (only the command line) and stdout/stderr both
go to the console. As a shortcut, I offer this patch consisting of this file and

build/macosx/script.data
build/macosx/script.r
build/macosx/bochs.applescript

script.data and script.r are taken from a script compiled into an application.
Flattened out to be checked in. (osacompile can produce runnable scripts, but
wants to create them for the classic environment, so I use these files as part
of a workaround)

When bochs.app is built, it also builds bochs.scpt. To use bochs.scpt you put
both bochs.app and bochs.scpt into the directory with your bochsrc.txt.

bochs.scpt is an applescript that when run notes the current directory, then
tells the terminal application to open a window, cd to the current directory,
and run bochs from the commandline.
----------------------------------------------------------------------

Modified Files:
  Makefile.in
Added Files:
  build/macosx/bochs.applescript build/macosx/script.data
  build/macosx/script.r
2002-10-21 11:38:38 +00:00
Bryce Denney
37be797307 - bochsdbg is an OPTIONAL install target. I build a bochsdbg.exe manually
when making windows releases, and copy it into the build directory.
  However, since some make programs (e.g. freebsd)  are giving errors when
  bochsdbg is not found (in Linux it just gives a little warning), I have tried
  to do it in a more clean way.  I put bochsdbg into an "optional" install
  list, and put a minus before the line that installs optional files.  This
  should cause make to ignore any errors that occur while trying to install the
  optional ones.
2002-10-21 11:28:37 +00:00
Bryce Denney
9297b17797 - in main.cc make the bochsrc parser a little more lenient about
empty pathnames, zero cylinders, etc.  It doesn't seem fair to allow
  people to write out bochsrcs that they cannot read back in without
  patching them up by hand!
- in harddrv.cc add the equivalent checks with BX_PANICs so that at least
  we don't start simulating with incomplete device configuration.
- make a few error messages more clear
- modified: main.cc iodev/harddrv.cc
2002-10-21 11:22:26 +00:00
Bryce Denney
cd4d17a363 - min and max in shadow params were broken recently when I changed the
constructors around.  The min,max that were being passed to the parent
  class constructor had junk in them.  In config.h.in, I defined the minimum
  and maximum values for each integer datatype so now we pass correct
  min and max values to the parent class.  These replace the BX_MAX_[U]INT
  and BX_MIN_[U]INT values.
- modified: main.cc config.h.in gui/siminterface.cc
2002-10-21 11:13:54 +00:00
Bryce Denney
8047b68ba2 - in a recent revision, I made bx_param_num_c::get() return a 64 bit
value instead of a 32 bit value.  Unfortunately there were many uses
  of bx_param_num_c::get() which depended on its size, and they were
  all broken by this change.  So in this rev I am changing get() to
  return a 32bit unsigned again.  If you really want a 64bit value (which
  is quite rare) you should call get64() instead.
- modified: gui/siminterface.h gui/siminterface.cc
2002-10-21 01:05:53 +00:00