it's easier to find. The other one is for wxWindows on win32 only.
- for wxWindows on win32, I added a function called RedirectIOToConsole() from
an article in the Windows Developers Journal that creates a console window
and sets up stdin,stdout,stderr to operate on the console. This works,
except for a console freezing problem that I described on the mailing list
earlier today.
- Once it is working better, we may want to use the WinMain definition for
other types of compiles on win32, and maybe even for all win32 compiles. In
particular when we compile with SDL we should create a console window too.
- comment out some debug output from the command line parser, add \n's in
a few places. (I'm using stderr instead of BX_PANIC because I don't think
the logging system is ready to be used at this early stage.)
the bochsrc is loaded by default.
- if you asked for quick start, but the config file could not be loaded,
print a warning "Switching off quick start, because no configuration file
was found".
- now the behavior looks like this:
. no command line arg (most common)
-> .bochsrc is loaded
-> if found defaults to "5. Begin simulation"
-> if not found defaults to "2. Read options from..."
. command line arg -q (user want to quick start from .bochsrc)
-> .bochsrc is loaded
-> if found, run the simulation
-> if not found defaults to "2. Read options from..."
. command line arg -f (user specifies which conf file to load)
-> conf file is loaded
-> if found defaults to "5. Begin simulation"
-> if not found, print error message on console:
>>PANIC<< reading from bochsrc2.txt failed
. command line arg -qf (user want to quick start from a conf file)
-> conf file is loaded
-> if found, run the simulation
-> if not found, print error message on console:
>>PANIC<< reading from other failed
. after selection of "2. Read options from..."
-> defaults to "5. Begin simulation"
. if user wants to create a new conf file:
-> run bochs with no args
-> .bochsrc is loaded by default
-> choose 1. Restore factory default configuration
-> default is changed to "3. Edit options"
- See bug #625696 "text config menu: default can be wrong" for
more discussion of this issue.
. if BX_GUI_SIGHANDLER is true and the term gui is selected at run time,
a new global boolean (bx_gui_sighandler) variable is set to true.
Special signal handling is done if bx_gui_sighandler is true.
. if BX_GUI_SIGHANDLER is not true, bx_gui_sighandler is not compiled in.
New behaviour is:
. No command line arg (user want to load or create a new conf file)
-> no .bochsrc is loaded
-> defaults to "2. Read options from..."
. command line arg -q (user want to quick start from .bochsrc)
-> .bochsrc is loaded
-> if found Run the simulation
-> if not found defaults to "2. Read options from..."
. command line arg -f (user want to edit a conf file)
-> conf file is loaded
-> if found defaults to "3. Edit options"
-> if not found defaults to "2. Read options from..."
. command line arg -qf (user want to quick start from a conf file)
-> conf file is loaded
-> if found Run the simulation
-> if not found defaults to "2. Read options from..."
. After selection of "2. Read options from..."
-> defaults to "5. Begin simulation"
- fix "enable-control-panel" behaviour in configure.in.
- check if a romimage was supplied in the conf file.
If not, print a hint about a missing/corrupt conf file.
I hope I did not break anything, notably the Carbon gui
- add a new global struct bx_startup_flags which stores argc,argv and
when necessary, the WinMain arguments hInstance, hPrevInstance, etc.
The new struct is defined in gui/siminterface.h because it is needed in
both the main.cc code and in wxmain.cc and textconfig.cc (which don't
include bochs.h).
- rename main() to bxmain() and create new main() and WinMain().
main() and WinMain() just fill in the bx_startup_flags and then
call bxmain(). Only one is defined at a time, of course.
- so far, WinMain is ONLY used when compiling with wxWindows on win32.
It may be useful in other contexts as well, but I don't want to enable
it in any other situation without some serious testing of different
configurations.
- modified:
main.cc gui/siminterface.cc gui/siminterface.h
gui/textconfig.cc gui/wxmain.cc
a control panel, but now we're calling it a text configuration interface.
Modified:
.bochsrc Makefile.in bochs.h main.cc cpu/Makefile.in
debug/Makefile.in disasm/Makefile.in fpu/Makefile.in
gui/Makefile.in iodev/Makefile.in memory/Makefile.in
- 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
"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
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
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
bx_shadow_num_c able to handle pointers to 64 bit values. This
allows x86-64 and wxWindows to coexist.
- I had a number of duplicate constructors for bx_shadow_num_c,
with an without the description arg. I eliminated the ones
that had no description, and also removed the min/max arg from
all. I still need a bunch of constructors though, for
Bit64u*, Bit64s*, Bit32u*, Bit32s*, Bit16u*, Bit16s*, Bit8u*, Bit8s*.
Having all these constructors allows us to write
new bx_shadow_num (bxid, name, description, &value)
for basically any integer variable. They are all handled by the same class.
- these changes led to minor touchups in cpu/init.cc and iodev/keyboard.cc
- modified:
configure main.cc cpu/init.cc iodev/keyboard.cc
gui/siminterface.cc gui/siminterface.h
different versions of the code for wxWindows and non-wxWindows and the GDB
stub did not accept any command line options at all.
- IMPORTANT CHANGE: the quick start option used to cause two things:
1) read the bochsrc immediately, 2) start simulation immediately without
going into the config interface. This has changed in a subtle way.
Now, we always try to read the bochsrc immediately. Then if the quick
start option is on, we start the simulation immediately.
- add "Restore Factory Default Configuration" in text config menu. It was
already there in wx. Now the default choice is always "5. Begin simulation"
and because the bochsrc is always read now, this works.
- When the user chooses "Read configuration file" from either text mode
or wx interfaces, reset all bochs parameters first, then read in the
new file. This means that every time you read a configuration file
you are starting from a consistent "blank slate".
- move much of the code from bx_do_text_config_interface into bx_init_main
so that wxWindows and non-wxWindows code uses the same logic. There was
only a tiny bit left in bx_do_text_config_interface so I eliminated it.
- move the "help" message into a separate function print_usage()
- detect all flags (cmdline args that start with -) in a loop, instead of
a big if/else. This makes it easy to add others.
- fix problem with Carbon gui, so that -psn arg gets ignored
- print usage if you type -h, --help, or if flags are not recognized
- code that called io->set_log_action (that sets the log action for all
devices) was only called if the configuration interface was on; I'm not
sure why. Now it is called all the time.
- the wxWindows equivalent of main() is called MyApp::OnInit. Now OnInit
and main() are very similar. They both call bx_init_siminterface, then
bx_init_main (and quit if it fails), then show the config interface if
quickstart is off, and then simulate.
- modified: main.cc gui/control.cc gui/wxmain.cc
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
Include SDL.h so that the C language prototype can be found. Otherwise
SDL_main() will get its name mangled and not match what the SDL library is
expecting.
restart another one in wxWindows. Fixed that. Also, on restart, the
apic id's left over from the first run were causing panics. Fixed that.
- modified: main.cc cpu/apic.cc cpu/cpu.h cpu/init.cc
- make bx_init_main return -1 if any parse errors occur.
- wxWindows: if bx_init_main returns -1, don't even show the application
window. You'll get an error dialog and then it exits. So far this
only happens if you run with -q and the parse fails.
- non-wxWindows: if bx_init_main returns -1, just exit. So far this
only happens if you run with -q and the parse fails.
- with these changes, handling of bochsrc parse errors seems to work
as you would expect. And it certainly doesn't go into an infinite
recursive loop, as it used to!
- a little more testing and I can close
bug 614175: infinite panic loop if bochsrc buggy
- modified: main.cc gui/siminterface.h gui/wxmain.cc
(0=success, -1=failure). If parse_line_unformatted returns failure, I
stop parsing the bochsrc.
- implement all parsing BX_PANICs with new PARSE_ERR macro, so that we can
easily change the behavior of all parse errors at once. For now, I want
it to BX_PANIC and then return -1 (case panic continues). Eventually I
might turn it into BX_ERROR and return -1.
- Features :
. number of active channels defined at boot-time config
. new options in bochsrc
. up to 8 devices support (disks or cdroms)
. up to 4 cdrom devices can be changed at runtime config
. wxwindows config interface
interface) by using get/set_default_log_action. This has very minimal effect
on the behavior of the text config interface.
- modified: main.cc gui/control.cc
time, so I've tried to improve it. Now the logfunctions class has a
static field default_onoff[] which represents the default actions for
each kind of log message. Default_onoff[] is initialized with static
data so it should be valid by the time it's used. This can be reached by
static accesors logfunctions::set_default_action and
logfunctions::get_default_action. It seemed appropriate to put the defaults
inside the logfunctions class, rather than in bx_options or siminterface.
However, to make them accessible to the config interface, I added similar
methods in siminterface that map to the accessors in logfunctions.
- logio.cc had two different definitions of LOG_THIS for different halves
of the file, which was ugly and confusing. (LOG_THIS is needed for BX_INFO,
BX_DEBUG, etc.) I removed the first definition and fixed the minor compile
problems that ensued. In the initializers for iofunctions, everything
is complicated because of the unpredictable order that constructors get
called. They must use this->log to print things, because genlog hasn't
been initialized yet.
- now if SIM->set_log_action(int mod, int level, int action) is called
with mod<0, it sets the action for all modules/devices instead of just one.
- modified: bochs.h logio.cc main.cc gui/siminterface.cc gui/siminterface.h
delivered to both the GUI and simulator thread, so they both call
bx_signal_handler. This can lead to deadlock as multiple threads enter
BX_PANIC and try to show a dialog box at once. To solve the problem, I made
a function isSimThread() which can be called from anywhere. If the
bx_signal_handler is called from any thread OTHER THAN the simulation thread,
it returns without doing anything. As a result, only one thread is allowed
to enter the signal handler code, and now control-C works correctly.
Bochs to immediately read the bochsrc and start simulating immediately (as
opposed to going into the configuration interface first). Now -q does
the right thing in the wxWindows interface. It behaves as if you selected
Read Configuration and then Simulate:Start.
- modified: main.cc gui/siminterface.cc gui/siminterface.h gui/wxmain.cc
think i is still defined the second time.
- MSVC++: can't use a variable to define another variable's array bounds.
Now I use a #define for the array bounds instead.