2001-10-03 16:56:51 +04:00
/////////////////////////////////////////////////////////////////////////
2003-02-13 18:51:22 +03:00
// $Id: main.cc,v 1.223 2003-02-13 15:51:12 sshwarts Exp $
2001-10-03 16:56:51 +04:00
/////////////////////////////////////////////////////////////////////////
//
2002-07-16 00:12:14 +04:00
// Copyright (C) 2002 MandrakeSoft S.A.
2001-04-10 05:04:59 +04:00
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
// 75002 Paris - France
// http://www.linux-mandrake.com/
// http://www.mandrakesoft.com/
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# include "bochs.h"
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
# include <assert.h>
2001-04-10 05:04:59 +04:00
# include "state_file.h"
2002-10-02 03:34:52 +04:00
# if BX_WITH_SDL
// since SDL redefines main() to SDL_main(), we must include SDL.h so that the
// C language prototype is found. Otherwise SDL_main() will get its name
// mangled and not match what the SDL library is expecting.
# include <SDL/SDL.h>
2002-10-02 23:23:01 +04:00
# if defined(macintosh)
// Work around a bug in SDL 1.2.4 on MacOS X, which redefines getenv to
// SDL_getenv, but then neglects to provide SDL_getenv. It happens
// because we are defining -Dmacintosh.
# undef getenv
# endif
2002-10-02 03:34:52 +04:00
# endif
2002-11-01 20:53:52 +03:00
# if BX_WITH_CARBON
# include <Carbon/Carbon.h>
# endif
2002-12-15 20:11:13 +03:00
// BX_SHARE_PATH should be defined by the makefile. If not, give it
// a value of NULL to avoid compile problems.
# ifndef BX_SHARE_PATH
# define BX_SHARE_PATH NULL
# endif
2002-08-18 20:59:26 +04:00
int bochsrc_include_count = 0 ;
2001-09-27 06:54:06 +04:00
2001-04-10 05:04:59 +04:00
extern " C " {
# include <signal.h>
}
# ifdef __MINGW32__
void alarm ( int ) ;
# endif
2002-11-11 20:09:57 +03:00
# if BX_GUI_SIGHANDLER
bx_bool bx_gui_sighandler = 0 ;
# endif
2001-04-10 05:04:59 +04:00
# if BX_PROVIDE_DEVICE_MODELS==1
// some prototypes from iodev/
// I want to stay away from including iodev/iodev.h here
Bit32u bx_unmapped_io_read_handler ( Bit32u address , unsigned io_len ) ;
void bx_unmapped_io_write_handler ( Bit32u address , Bit32u value ,
unsigned io_len ) ;
void bx_close_harddrive ( void ) ;
# endif
2001-06-10 00:01:12 +04:00
void bx_init_bx_dbg ( void ) ;
2001-05-23 06:37:52 +04:00
static char * divider = " ======================================================================== " ;
2002-10-25 01:07:56 +04:00
static logfunctions thePluginLog ;
logfunctions * pluginlog = & thePluginLog ;
2001-05-23 06:37:52 +04:00
2002-11-01 18:19:48 +03:00
bx_startup_flags_t bx_startup_flags ;
2001-04-10 05:04:59 +04:00
/* typedefs */
2001-06-19 20:25:41 +04:00
# define LOG_THIS genlog->
2001-04-10 05:04:59 +04:00
# if ( BX_PROVIDE_DEVICE_MODELS==1 )
bx_pc_system_c bx_pc_system ;
class state_file state_stuff ( " state_file.out " , " options " ) ;
# endif
bx_debug_t bx_dbg ;
2002-09-03 10:22:53 +04:00
bx_options_t bx_options ; // initialized in bx_init_options()
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
char * bochsrc_filename = NULL ;
2001-04-10 05:04:59 +04:00
2002-09-25 22:31:38 +04:00
static Bit32s parse_line_unformatted ( char * context , char * line ) ;
static Bit32s parse_line_formatted ( char * context , int num_params , char * params [ ] ) ;
2001-06-10 00:01:12 +04:00
static int parse_bochsrc ( char * rcfile ) ;
2001-04-10 05:04:59 +04:00
- upgrade bx_param_num to use 64 bit values, so that I could make
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
2002-10-16 23:39:27 +04:00
static Bit64s
bx_param_handler ( bx_param_c * param , int set , Bit64s val )
2001-06-17 03:08:32 +04:00
{
2001-06-21 22:34:50 +04:00
bx_id id = param - > get_id ( ) ;
switch ( id ) {
2001-06-17 03:08:32 +04:00
case BXP_VGA_UPDATE_INTERVAL :
// if after init, notify the vga device to change its timer.
if ( set & & SIM - > get_init_done ( ) )
2002-11-01 19:30:53 +03:00
DEV_vga_set_update_interval ( val ) ;
2001-06-17 03:08:32 +04:00
break ;
case BXP_MOUSE_ENABLED :
// if after init, notify the GUI
2001-09-21 06:46:17 +04:00
if ( set & & SIM - > get_init_done ( ) ) {
2002-11-01 19:30:53 +03:00
bx_gui - > mouse_enabled_changed ( val ! = 0 ) ;
DEV_mouse_enabled_changed ( val ! = 0 ) ;
2001-09-21 06:46:17 +04:00
}
2001-06-17 03:08:32 +04:00
break ;
2002-11-18 20:16:07 +03:00
case BXP_NE2K_PRESENT :
2001-06-21 22:34:50 +04:00
if ( set ) {
2002-11-01 19:30:53 +03:00
int enable = ( val ! = 0 ) ;
SIM - > get_param ( BXP_NE2K_IOADDR ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_NE2K_IRQ ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_NE2K_MACADDR ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_NE2K_ETHMOD ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_NE2K_ETHDEV ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_NE2K_SCRIPT ) - > set_enabled ( enable ) ;
2001-06-21 22:34:50 +04:00
}
break ;
2001-06-21 23:57:21 +04:00
case BXP_LOAD32BITOS_WHICH :
if ( set ) {
2002-11-01 19:30:53 +03:00
int enable = ( val ! = 0 ) ;
SIM - > get_param ( BXP_LOAD32BITOS_PATH ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_LOAD32BITOS_IOLOG ) - > set_enabled ( enable ) ;
SIM - > get_param ( BXP_LOAD32BITOS_INITRD ) - > set_enabled ( enable ) ;
2001-06-21 23:57:21 +04:00
}
break ;
2002-09-23 00:56:12 +04:00
case BXP_ATA0_MASTER_STATUS :
case BXP_ATA0_SLAVE_STATUS :
case BXP_ATA1_MASTER_STATUS :
case BXP_ATA1_SLAVE_STATUS :
case BXP_ATA2_MASTER_STATUS :
case BXP_ATA2_SLAVE_STATUS :
case BXP_ATA3_MASTER_STATUS :
case BXP_ATA3_SLAVE_STATUS :
2002-03-14 23:14:47 +03:00
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
2002-11-01 19:30:53 +03:00
Bit8u device = id - BXP_ATA0_MASTER_STATUS ;
Bit32u handle = DEV_hd_get_device_handle ( device / 2 , device % 2 ) ;
2002-10-25 01:07:56 +04:00
DEV_hd_set_cd_media_status ( handle , val = = BX_INSERTED ) ;
bx_gui - > update_drive_status_buttons ( ) ;
2002-03-14 23:14:47 +03:00
}
break ;
2002-08-04 12:42:34 +04:00
case BXP_FLOPPYA_TYPE :
if ( ( set ) & & ( ! SIM - > get_init_done ( ) ) ) {
bx_options . floppya . Odevtype - > set ( val ) ;
}
break ;
2002-03-14 23:14:47 +03:00
case BXP_FLOPPYA_STATUS :
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
2002-10-25 01:07:56 +04:00
DEV_floppy_set_media_status ( 0 , val = = BX_INSERTED ) ;
bx_gui - > update_drive_status_buttons ( ) ;
2002-03-14 23:14:47 +03:00
}
break ;
2002-08-04 12:42:34 +04:00
case BXP_FLOPPYB_TYPE :
if ( ( set ) & & ( ! SIM - > get_init_done ( ) ) ) {
bx_options . floppyb . Odevtype - > set ( val ) ;
}
break ;
2002-03-14 23:14:47 +03:00
case BXP_FLOPPYB_STATUS :
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
2002-10-25 01:07:56 +04:00
DEV_floppy_set_media_status ( 1 , val = = BX_INSERTED ) ;
bx_gui - > update_drive_status_buttons ( ) ;
2002-03-14 23:14:47 +03:00
}
break ;
2002-03-26 17:46:03 +03:00
case BXP_KBD_PASTE_DELAY :
2002-10-25 01:07:56 +04:00
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
DEV_kbd_paste_delay_changed ( ) ;
}
2002-03-26 17:46:03 +03:00
break ;
2002-09-23 00:56:12 +04:00
case BXP_ATA0_MASTER_TYPE :
case BXP_ATA0_SLAVE_TYPE :
case BXP_ATA1_MASTER_TYPE :
case BXP_ATA1_SLAVE_TYPE :
case BXP_ATA2_MASTER_TYPE :
case BXP_ATA2_SLAVE_TYPE :
case BXP_ATA3_MASTER_TYPE :
case BXP_ATA3_SLAVE_TYPE :
if ( set ) {
int device = id - BXP_ATA0_MASTER_TYPE ;
2002-11-01 19:30:53 +03:00
switch ( val ) {
2002-09-23 00:56:12 +04:00
case BX_ATA_DEVICE_DISK :
SIM - > get_param_num ( ( bx_id ) ( BXP_ATA0_MASTER_PRESENT + device ) ) - > set ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_PATH + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_CYLINDERS + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_HEADS + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_SPT + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_STATUS + device ) ) - > set_enabled ( 0 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_MODEL + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_BIOSDETECT + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_TRANSLATION + device ) ) - > set_enabled ( 1 ) ;
break ;
case BX_ATA_DEVICE_CDROM :
SIM - > get_param_num ( ( bx_id ) ( BXP_ATA0_MASTER_PRESENT + device ) ) - > set ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_PATH + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_CYLINDERS + device ) ) - > set_enabled ( 0 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_HEADS + device ) ) - > set_enabled ( 0 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_SPT + device ) ) - > set_enabled ( 0 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_STATUS + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_MODEL + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_BIOSDETECT + device ) ) - > set_enabled ( 1 ) ;
SIM - > get_param ( ( bx_id ) ( BXP_ATA0_MASTER_TRANSLATION + device ) ) - > set_enabled ( 0 ) ;
break ;
}
}
break ;
2001-06-17 03:08:32 +04:00
default :
2001-06-21 22:34:50 +04:00
BX_PANIC ( ( " bx_param_handler called with unknown id %d " , id ) ) ;
2001-06-17 03:08:32 +04:00
return - 1 ;
}
return val ;
}
2001-06-21 18:37:55 +04:00
char * bx_param_string_handler ( bx_param_string_c * param , int set , char * val , int maxlen )
{
2002-09-23 00:56:12 +04:00
bx_id id = param - > get_id ( ) ;
2001-06-21 18:37:55 +04:00
int empty = 0 ;
if ( ( strlen ( val ) < 1 ) | | ! strcmp ( " none " , val ) ) {
empty = 1 ;
val = " none " ;
}
2002-09-23 00:56:12 +04:00
switch ( id ) {
2001-06-21 18:37:55 +04:00
case BXP_FLOPPYA_PATH :
if ( set = = 1 ) {
2002-03-14 23:14:47 +03:00
if ( SIM - > get_init_done ( ) ) {
if ( empty ) {
2002-10-25 01:07:56 +04:00
DEV_floppy_set_media_status ( 0 , 0 ) ;
bx_gui - > update_drive_status_buttons ( ) ;
2002-03-14 23:14:47 +03:00
} else {
if ( ! SIM - > get_param_num ( BXP_FLOPPYA_TYPE ) - > get_enabled ( ) ) {
BX_ERROR ( ( " Cannot add a floppy drive at runtime " ) ) ;
bx_options . floppya . Opath - > set ( " none " ) ;
}
}
2002-10-25 01:07:56 +04:00
if ( ( DEV_floppy_present ( ) ) & &
2002-03-14 23:14:47 +03:00
( SIM - > get_param_num ( BXP_FLOPPYA_STATUS ) - > get ( ) = = BX_INSERTED ) ) {
// tell the device model that we removed, then inserted the disk
2002-10-25 01:07:56 +04:00
DEV_floppy_set_media_status ( 0 , 0 ) ;
DEV_floppy_set_media_status ( 0 , 1 ) ;
2002-03-14 23:14:47 +03:00
}
} else {
2002-08-04 12:42:34 +04:00
SIM - > get_param_num ( BXP_FLOPPYA_DEVTYPE ) - > set_enabled ( ! empty ) ;
2002-03-14 23:14:47 +03:00
SIM - > get_param_num ( BXP_FLOPPYA_TYPE ) - > set_enabled ( ! empty ) ;
SIM - > get_param_num ( BXP_FLOPPYA_STATUS ) - > set_enabled ( ! empty ) ;
}
2001-06-21 18:37:55 +04:00
}
break ;
case BXP_FLOPPYB_PATH :
if ( set = = 1 ) {
2002-03-14 23:14:47 +03:00
if ( SIM - > get_init_done ( ) ) {
if ( empty ) {
2002-10-25 01:07:56 +04:00
DEV_floppy_set_media_status ( 1 , 0 ) ;
bx_gui - > update_drive_status_buttons ( ) ;
2002-03-14 23:14:47 +03:00
} else {
if ( ! SIM - > get_param_num ( BXP_FLOPPYB_TYPE ) - > get_enabled ( ) ) {
BX_ERROR ( ( " Cannot add a floppy drive at runtime " ) ) ;
bx_options . floppyb . Opath - > set ( " none " ) ;
}
}
2002-10-25 01:07:56 +04:00
if ( ( DEV_floppy_present ( ) ) & &
2002-03-14 23:14:47 +03:00
( SIM - > get_param_num ( BXP_FLOPPYB_STATUS ) - > get ( ) = = BX_INSERTED ) ) {
// tell the device model that we removed, then inserted the disk
2002-10-25 01:07:56 +04:00
DEV_floppy_set_media_status ( 1 , 0 ) ;
DEV_floppy_set_media_status ( 1 , 1 ) ;
2002-03-14 23:14:47 +03:00
}
} else {
2002-08-04 12:42:34 +04:00
SIM - > get_param_num ( BXP_FLOPPYB_DEVTYPE ) - > set_enabled ( ! empty ) ;
2002-03-14 23:14:47 +03:00
SIM - > get_param_num ( BXP_FLOPPYB_TYPE ) - > set_enabled ( ! empty ) ;
SIM - > get_param_num ( BXP_FLOPPYB_STATUS ) - > set_enabled ( ! empty ) ;
}
2001-06-21 18:37:55 +04:00
}
break ;
2002-09-23 00:56:12 +04:00
case BXP_ATA0_MASTER_PATH :
case BXP_ATA0_SLAVE_PATH :
case BXP_ATA1_MASTER_PATH :
case BXP_ATA1_SLAVE_PATH :
case BXP_ATA2_MASTER_PATH :
case BXP_ATA2_SLAVE_PATH :
case BXP_ATA3_MASTER_PATH :
case BXP_ATA3_SLAVE_PATH :
2001-06-21 18:37:55 +04:00
if ( set = = 1 ) {
2002-03-14 23:14:47 +03:00
if ( SIM - > get_init_done ( ) ) {
2002-10-25 01:07:56 +04:00
Bit8u device = id - BXP_ATA0_MASTER_PATH ;
2002-11-01 19:30:53 +03:00
Bit32u handle = DEV_hd_get_device_handle ( device / 2 , device % 2 ) ;
2002-10-25 01:07:56 +04:00
2002-03-14 23:14:47 +03:00
if ( empty ) {
2002-10-25 01:07:56 +04:00
DEV_hd_set_cd_media_status ( handle , 0 ) ;
bx_gui - > update_drive_status_buttons ( ) ;
2002-03-14 23:14:47 +03:00
} else {
2002-09-23 00:56:12 +04:00
if ( ! SIM - > get_param_num ( ( bx_id ) ( BXP_ATA0_MASTER_PRESENT + device ) ) - > get ( ) ) {
2002-03-14 23:14:47 +03:00
BX_ERROR ( ( " Cannot add a cdrom drive at runtime " ) ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ device / 2 ] [ device % 2 ] . Opresent - > set ( 0 ) ;
}
if ( SIM - > get_param_num ( ( bx_id ) ( BXP_ATA0_MASTER_TYPE + device ) ) - > get ( ) ! = BX_ATA_DEVICE_CDROM ) {
BX_ERROR ( ( " Device is not a cdrom drive " ) ) ;
bx_options . atadevice [ device / 2 ] [ device % 2 ] . Opresent - > set ( 0 ) ;
2002-03-14 23:14:47 +03:00
}
}
2002-10-25 01:07:56 +04:00
if ( DEV_hd_present ( ) & &
2002-09-23 00:56:12 +04:00
( SIM - > get_param_num ( ( bx_id ) ( BXP_ATA0_MASTER_STATUS + device ) ) - > get ( ) = = BX_INSERTED ) & &
( SIM - > get_param_num ( ( bx_id ) ( BXP_ATA0_MASTER_TYPE + device ) ) - > get ( ) = = BX_ATA_DEVICE_CDROM ) ) {
2002-03-14 23:14:47 +03:00
// tell the device model that we removed, then inserted the cd
2002-10-25 01:07:56 +04:00
DEV_hd_set_cd_media_status ( handle , 0 ) ;
DEV_hd_set_cd_media_status ( handle , 1 ) ;
2002-03-14 23:14:47 +03:00
}
}
2001-06-21 18:37:55 +04:00
}
break ;
2002-09-23 00:56:12 +04:00
2001-08-16 06:00:31 +04:00
case BXP_SCREENMODE :
if ( set = = 1 ) {
2002-11-01 19:30:53 +03:00
BX_INFO ( ( " Screen mode changed to %s " , val ) ) ;
2001-08-16 06:00:31 +04:00
}
break ;
2001-09-11 20:56:48 +04:00
default :
BX_PANIC ( ( " bx_string_handler called with unexpected parameter %d " , param - > get_id ( ) ) ) ;
2001-06-21 18:37:55 +04:00
}
return val ;
}
2001-06-16 23:29:59 +04:00
void bx_init_options ( )
2002-09-03 23:04:17 +04:00
{
2002-09-03 19:59:52 +04:00
int i ;
2001-06-21 18:37:55 +04:00
bx_list_c * menu ;
2002-09-03 12:42:23 +04:00
bx_list_c * deplist ;
char name [ 1024 ] , descr [ 1024 ] ;
2001-06-21 18:37:55 +04:00
2002-09-03 10:22:53 +04:00
memset ( & bx_options , 0 , sizeof ( bx_options ) ) ;
2002-09-05 11:01:30 +04:00
// quick start option, set by command line arg
2002-11-09 17:12:10 +03:00
new bx_param_enum_c ( BXP_BOCHS_START ,
" Bochs start types " ,
" Bochs start types " ,
bochs_start_names ,
BX_RUN_START ,
BX_QUICK_START ) ;
2002-09-05 11:01:30 +04:00
2001-06-21 18:37:55 +04:00
// floppya
2002-04-18 04:22:20 +04:00
bx_options . floppya . Opath = new bx_param_filename_c ( BXP_FLOPPYA_PATH ,
2001-06-21 18:37:55 +04:00
" Floppy A image " ,
2001-06-20 18:01:39 +04:00
" Pathname of first floppy image file or device. If you're booting from floppy, this should be a bootable floppy. " ,
" " , BX_PATHNAME_LEN ) ;
2002-04-18 04:22:20 +04:00
# if BX_WITH_WX
bx_options . floppya . Opath - > set_ask_format ( " Filename of first floppy image " ) ;
# else
2001-06-21 18:37:55 +04:00
bx_options . floppya . Opath - > set_ask_format ( " Enter new filename, or 'none' for no disk: [%s] " ) ;
2002-04-18 04:22:20 +04:00
# endif
2002-08-04 12:42:34 +04:00
bx_options . floppya . Odevtype = new bx_param_enum_c ( BXP_FLOPPYA_DEVTYPE ,
" floppya:devtype " ,
" Type of floppy drive " ,
floppy_type_names ,
BX_FLOPPY_NONE ,
BX_FLOPPY_NONE ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppya . Otype = new bx_param_enum_c ( BXP_FLOPPYA_TYPE ,
" floppya:type " ,
" Type of floppy disk " ,
2001-06-21 18:37:55 +04:00
floppy_type_names ,
2001-06-20 18:01:39 +04:00
BX_FLOPPY_NONE ,
BX_FLOPPY_NONE ) ;
2001-06-21 18:37:55 +04:00
bx_options . floppya . Otype - > set_ask_format ( " What type of floppy disk? [%s] " ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppya . Ostatus = new bx_param_enum_c ( BXP_FLOPPYA_STATUS ,
2001-06-21 18:37:55 +04:00
" Is floppya inserted " ,
2001-06-20 18:01:39 +04:00
" Inserted or ejected " ,
2001-06-21 18:37:55 +04:00
floppy_status_names ,
BX_INSERTED ,
2001-06-20 18:01:39 +04:00
BX_EJECTED ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppya . Ostatus - > set_ask_format ( " Is the floppy inserted or ejected? [%s] " ) ;
2001-06-21 18:37:55 +04:00
bx_options . floppya . Opath - > set_format ( " %s " ) ;
bx_options . floppya . Otype - > set_format ( " , size=%s, " ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppya . Ostatus - > set_format ( " %s " ) ;
2001-06-21 18:37:55 +04:00
bx_param_c * floppya_init_list [ ] = {
2002-08-28 11:45:30 +04:00
// if the order "path,type,status" changes, corresponding changes must
// be made in gui/wxmain.cc, MyFrame::editFloppyConfig.
2001-06-21 18:37:55 +04:00
bx_options . floppya . Opath ,
bx_options . floppya . Otype ,
2002-08-04 12:42:34 +04:00
bx_options . floppya . Ostatus ,
2001-06-21 18:37:55 +04:00
NULL
} ;
menu = new bx_list_c ( BXP_FLOPPYA , " Floppy Disk 0 " , " All options for first floppy disk " , floppya_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SERIES_ASK ) ;
2001-06-21 18:37:55 +04:00
bx_options . floppya . Opath - > set_handler ( bx_param_string_handler ) ;
bx_options . floppya . Opath - > set ( " none " ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppya . Otype - > set_handler ( bx_param_handler ) ;
bx_options . floppya . Ostatus - > set_handler ( bx_param_handler ) ;
2001-06-21 18:37:55 +04:00
2002-04-18 04:22:20 +04:00
bx_options . floppyb . Opath = new bx_param_filename_c ( BXP_FLOPPYB_PATH ,
2001-06-20 18:01:39 +04:00
" floppyb:path " ,
" Pathname of second floppy image file or device. " ,
" " , BX_PATHNAME_LEN ) ;
2002-04-18 04:22:20 +04:00
# if BX_WITH_WX
bx_options . floppyb . Opath - > set_ask_format ( " Filename of second floppy image " ) ;
# else
2001-06-21 18:37:55 +04:00
bx_options . floppyb . Opath - > set_ask_format ( " Enter new filename, or 'none' for no disk: [%s] " ) ;
2002-04-18 04:22:20 +04:00
# endif
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Odevtype = new bx_param_enum_c ( BXP_FLOPPYB_DEVTYPE ,
" floppyb:devtype " ,
" Type of floppy drive " ,
floppy_type_names ,
BX_FLOPPY_NONE ,
BX_FLOPPY_NONE ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppyb . Otype = new bx_param_enum_c ( BXP_FLOPPYB_TYPE ,
" floppyb:type " ,
" Type of floppy disk " ,
floppy_type_names ,
BX_FLOPPY_NONE ,
BX_FLOPPY_NONE ) ;
2001-06-21 18:37:55 +04:00
bx_options . floppyb . Otype - > set_ask_format ( " What type of floppy disk? [%s] " ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Ostatus = new bx_param_enum_c ( BXP_FLOPPYB_STATUS ,
2001-06-21 18:37:55 +04:00
" Is floppyb inserted " ,
2001-06-20 18:01:39 +04:00
" Inserted or ejected " ,
2001-06-21 18:37:55 +04:00
floppy_status_names ,
BX_INSERTED ,
2001-06-20 18:01:39 +04:00
BX_EJECTED ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Ostatus - > set_ask_format ( " Is the floppy inserted or ejected? [%s] " ) ;
bx_options . floppyb . Ostatus - > set_format ( " %s " ) ;
2001-06-21 18:37:55 +04:00
bx_options . floppyb . Opath - > set_format ( " %s " ) ;
bx_options . floppyb . Otype - > set_format ( " , size=%s, " ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Ostatus - > set_format ( " %s " ) ;
2001-06-21 18:37:55 +04:00
bx_param_c * floppyb_init_list [ ] = {
bx_options . floppyb . Opath ,
bx_options . floppyb . Otype ,
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Ostatus ,
2001-06-21 18:37:55 +04:00
NULL
} ;
menu = new bx_list_c ( BXP_FLOPPYB , " Floppy Disk 1 " , " All options for second floppy disk " , floppyb_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SERIES_ASK ) ;
2001-06-21 18:37:55 +04:00
bx_options . floppyb . Opath - > set_handler ( bx_param_string_handler ) ;
bx_options . floppyb . Opath - > set ( " none " ) ;
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Otype - > set_handler ( bx_param_handler ) ;
bx_options . floppyb . Ostatus - > set_handler ( bx_param_handler ) ;
2001-06-20 18:01:39 +04:00
2002-09-23 00:56:12 +04:00
// disk options
// FIXME use descr and name
char * s_atachannel [ ] = {
" ATA channel 0 " ,
" ATA channel 1 " ,
" ATA channel 2 " ,
" ATA channel 3 " ,
} ;
char * s_atadevice [ 4 ] [ 2 ] = {
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
{ " First HD/CD on channel 0 " ,
" Second HD/CD on channel 0 " } ,
{ " First HD/CD on channel 1 " ,
" Second HD/CD on channel 1 " } ,
{ " First HD/CD on channel 2 " ,
" Second HD/CD on channel 2 " } ,
{ " First HD/CD on channel 3 " ,
" Second HD/CD on channel 3 " }
2002-09-23 00:56:12 +04:00
} ;
Bit16u ata_default_ioaddr1 [ BX_MAX_ATA_CHANNEL ] = {
0x1f0 , 0x170 , 0x1e8 , 0x168
2001-06-21 18:37:55 +04:00
} ;
2002-09-23 00:56:12 +04:00
Bit8u ata_default_irq [ BX_MAX_ATA_CHANNEL ] = {
2002-09-25 02:49:52 +04:00
14 , 15 , 11 , 9
2001-06-21 18:37:55 +04:00
} ;
2001-06-20 18:01:39 +04:00
2002-09-23 00:56:12 +04:00
bx_list_c * ata [ BX_MAX_ATA_CHANNEL ] ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
bx_list_c * ata_menu [ BX_MAX_ATA_CHANNEL ] ;
2002-09-23 00:56:12 +04:00
2002-09-25 12:04:07 +04:00
Bit8u channel ;
for ( channel = 0 ; channel < BX_MAX_ATA_CHANNEL ; channel + + ) {
2002-09-23 00:56:12 +04:00
ata [ channel ] = new bx_list_c ( ( bx_id ) ( BXP_ATA0 + channel ) , s_atachannel [ channel ] , s_atachannel [ channel ] , 8 ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
ata [ channel ] - > get_options ( ) - > set ( bx_list_c : : SERIES_ASK ) ;
2002-09-23 00:56:12 +04:00
ata [ channel ] - > add ( bx_options . ata [ channel ] . Opresent = new bx_param_bool_c ( ( bx_id ) ( BXP_ATA0_PRESENT + channel ) ,
" ata:present " ,
" Controls whether ata channel is installed or not " ,
0 ) ) ;
ata [ channel ] - > add ( bx_options . ata [ channel ] . Oioaddr1 = new bx_param_num_c ( ( bx_id ) ( BXP_ATA0_IOADDR1 + channel ) ,
" ata:ioaddr1 " ,
" IO adress of ata command block " ,
0 , 0xffff ,
ata_default_ioaddr1 [ channel ] ) ) ;
ata [ channel ] - > add ( bx_options . ata [ channel ] . Oioaddr2 = new bx_param_num_c ( ( bx_id ) ( BXP_ATA0_IOADDR2 + channel ) ,
" ata:ioaddr2 " ,
" IO adress of ata control block " ,
0 , 0xffff ,
ata_default_ioaddr1 [ channel ] + 0x200 ) ) ;
ata [ channel ] - > add ( bx_options . ata [ channel ] . Oirq = new bx_param_num_c ( ( bx_id ) ( BXP_ATA0_IRQ + channel ) ,
" ata:irq " ,
" IRQ of ata " ,
0 , 15 ,
ata_default_irq [ channel ] ) ) ;
// all items in the ata[channel] menu depend on the present flag.
// The menu list is complete, but a few dependent_list items will
// be added later. Use clone() to make a copy of the dependent_list
// so that it can be changed without affecting the menu.
bx_options . ata [ channel ] . Opresent - > set_dependent_list (
2002-11-01 19:30:53 +03:00
ata [ channel ] - > clone ( ) ) ;
2002-09-23 00:56:12 +04:00
for ( Bit8u slave = 0 ; slave < 2 ; slave + + ) {
menu = bx_options . atadevice [ channel ] [ slave ] . Omenu = new bx_list_c ( ( bx_id ) ( BXP_ATA0_MASTER + channel * 2 + slave ) ,
2002-11-01 19:30:53 +03:00
s_atadevice [ channel ] [ slave ] ,
2002-09-23 00:56:12 +04:00
s_atadevice [ channel ] [ slave ] ,
2002-11-01 19:30:53 +03:00
12 /* list max size */ ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SERIES_ASK ) ;
2002-09-23 00:56:12 +04:00
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Opresent = new bx_param_bool_c ( ( bx_id ) ( BXP_ATA0_MASTER_PRESENT + channel * 2 + slave ) ,
" ata-device:present " ,
" Controls whether ata device is installed or not " ,
0 ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Otype = new bx_param_enum_c ( ( bx_id ) ( BXP_ATA0_MASTER_TYPE + channel * 2 + slave ) ,
" ata-device:type " ,
" Type of ATA device " ,
atadevice_type_names ,
BX_ATA_DEVICE_DISK ,
BX_ATA_DEVICE_DISK ) ) ;
2002-12-12 21:31:20 +03:00
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Ostatus = new bx_param_enum_c ( ( bx_id ) ( BXP_ATA0_MASTER_STATUS + channel * 2 + slave ) ,
" ata-device:status " ,
" Inserted or ejected " ,
atadevice_status_names ,
BX_INSERTED ,
BX_EJECTED ) ) ;
2002-09-23 00:56:12 +04:00
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Opath = new bx_param_filename_c ( ( bx_id ) ( BXP_ATA0_MASTER_PATH + channel * 2 + slave ) ,
" ata-device:path " ,
" Pathname of the image " ,
" " , BX_PATHNAME_LEN ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Ocylinders = new bx_param_num_c ( ( bx_id ) ( BXP_ATA0_MASTER_CYLINDERS + channel * 2 + slave ) ,
" ata-device:cylinders " ,
" Number of cylinders " ,
0 , 65535 ,
0 ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Oheads = new bx_param_num_c ( ( bx_id ) ( BXP_ATA0_MASTER_HEADS + channel * 2 + slave ) ,
" ata-device:heads " ,
" Number of heads " ,
0 , 65535 ,
0 ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Ospt = new bx_param_num_c ( ( bx_id ) ( BXP_ATA0_MASTER_SPT + channel * 2 + slave ) ,
" ata-device:spt " ,
" Number of sectors per track " ,
0 , 65535 ,
0 ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Omodel = new bx_param_string_c ( ( bx_id ) ( BXP_ATA0_MASTER_MODEL + channel * 2 + slave ) ,
" ata-device:model " ,
" Model name " ,
" Generic 1234 " , 40 ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Obiosdetect = new bx_param_enum_c ( ( bx_id ) ( BXP_ATA0_MASTER_BIOSDETECT + channel * 2 + slave ) ,
" ata-device:biosdetect " ,
" Type of bios detection " ,
atadevice_biosdetect_names ,
BX_ATA_BIOSDETECT_AUTO ,
BX_ATA_BIOSDETECT_NONE ) ) ;
menu - > add ( bx_options . atadevice [ channel ] [ slave ] . Otranslation = new bx_param_enum_c ( ( bx_id ) ( BXP_ATA0_MASTER_TRANSLATION + channel * 2 + slave ) ,
" How the ata-disk translation is done by the bios " ,
" Type of translation " ,
atadevice_translation_names ,
2002-10-28 00:25:33 +03:00
BX_ATA_TRANSLATION_AUTO ,
2002-09-23 00:56:12 +04:00
BX_ATA_TRANSLATION_NONE ) ) ;
bx_options . atadevice [ channel ] [ slave ] . Opresent - > set_dependent_list (
2002-11-01 19:30:53 +03:00
menu - > clone ( ) ) ;
2002-09-23 00:56:12 +04:00
// the menu and all items on it depend on the Opresent flag
bx_options . atadevice [ channel ] [ slave ] . Opresent - > get_dependent_list ( ) - > add ( menu ) ;
// the present flag depends on the ATA channel's present flag
bx_options . ata [ channel ] . Opresent - > get_dependent_list ( ) - > add (
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Opresent ) ;
2002-09-23 00:56:12 +04:00
}
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
// set up top level menu for ATA[i] controller configuration. This list
// controls what will appear on the ATA configure dialog. It now
// requests the USE_TAB_WINDOW display, which is implemented in wx.
char buffer [ 32 ] ;
sprintf ( buffer , " Configure ATA%d " , channel ) ;
ata_menu [ channel ] = new bx_list_c ( ( bx_id ) ( BXP_ATA0_MENU + channel ) , strdup ( buffer ) , " " , 4 ) ;
ata_menu [ channel ] - > add ( ata [ channel ] ) ;
ata_menu [ channel ] - > add ( bx_options . atadevice [ channel ] [ 0 ] . Omenu ) ;
ata_menu [ channel ] - > add ( bx_options . atadevice [ channel ] [ 1 ] . Omenu ) ;
ata_menu [ channel ] - > get_options ( ) - > set ( bx_list_c : : USE_TAB_WINDOW ) ;
2002-09-23 00:56:12 +04:00
}
// Enable first ata interface by default, disable the others.
bx_options . ata [ 0 ] . Opresent - > set_initial_val ( 1 ) ;
// now that the dependence relationships are established, call set() on
// the ata device present params to set all enables correctly.
for ( i = 0 ; i < BX_MAX_ATA_CHANNEL ; i + + )
bx_options . ata [ i ] . Opresent - > set ( i = = 0 ) ;
2002-09-25 12:04:07 +04:00
for ( channel = 0 ; channel < BX_MAX_ATA_CHANNEL ; channel + + ) {
2002-09-23 00:56:12 +04:00
bx_options . ata [ channel ] . Opresent - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Enable this channel? "
: " Channel is enabled: [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . ata [ channel ] . Oioaddr1 - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " I/O Address 1: "
: " Enter new ioaddr1: [0x%x] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . ata [ channel ] . Oioaddr2 - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " I/O Address 2: "
: " Enter new ioaddr2: [0x%x] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . ata [ channel ] . Oirq - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " IRQ: "
: " Enter new IRQ: [%d] " ) ;
2002-09-23 00:56:12 +04:00
# if !BX_WITH_WX
bx_options . ata [ channel ] . Opresent - > set_format ( " enabled: %s " ) ;
bx_options . ata [ channel ] . Oioaddr1 - > set_format ( " , ioaddr1: 0x%x " ) ;
bx_options . ata [ channel ] . Oioaddr2 - > set_format ( " , ioaddr2: 0x%x " ) ;
bx_options . ata [ channel ] . Oirq - > set_format ( " , irq: %d " ) ;
2002-04-18 04:22:20 +04:00
# endif
2002-09-23 00:56:12 +04:00
bx_options . ata [ channel ] . Oioaddr1 - > set_base ( 16 ) ;
bx_options . ata [ channel ] . Oioaddr2 - > set_base ( 16 ) ;
for ( Bit8u slave = 0 ; slave < 2 ; slave + + ) {
bx_options . atadevice [ channel ] [ slave ] . Opresent - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Enable this device? "
: " Device is enabled: [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Otype - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Type of ATA device: "
: " Enter type of ATA device, disk or cdrom: [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Opath - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Path or physical device name: "
: " Enter new filename: [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Ocylinders - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Cylinders: "
: " Enter number of cylinders: [%d] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Oheads - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Heads: "
: " Enter number of heads: [%d] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Ospt - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Sectors per track: "
: " Enter number of sectors per track: [%d] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Ostatus - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Inserted? "
: " Is the device inserted or ejected? [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Omodel - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Model name: "
: " Enter new model name: [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " Translation type: "
: " Enter translation type: [%s] " ) ;
2002-09-23 00:56:12 +04:00
bx_options . atadevice [ channel ] [ slave ] . Obiosdetect - > set_ask_format (
2002-11-01 19:30:53 +03:00
BX_WITH_WX ? " BIOS Detection: "
: " Enter bios detection type: [%s] " ) ;
2002-09-23 00:56:12 +04:00
# if !BX_WITH_WX
bx_options . atadevice [ channel ] [ slave ] . Opresent - > set_format ( " enabled: %s " ) ;
bx_options . atadevice [ channel ] [ slave ] . Otype - > set_format ( " , %s " ) ;
bx_options . atadevice [ channel ] [ slave ] . Opath - > set_format ( " on '%s' " ) ;
bx_options . atadevice [ channel ] [ slave ] . Ocylinders - > set_format ( " , %d cylinders " ) ;
bx_options . atadevice [ channel ] [ slave ] . Oheads - > set_format ( " , %d heads " ) ;
bx_options . atadevice [ channel ] [ slave ] . Ospt - > set_format ( " , %d sectors/track " ) ;
bx_options . atadevice [ channel ] [ slave ] . Ostatus - > set_format ( " , %s " ) ;
bx_options . atadevice [ channel ] [ slave ] . Omodel - > set_format ( " , model '%s' " ) ;
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set_format ( " , translation '%s' " ) ;
bx_options . atadevice [ channel ] [ slave ] . Obiosdetect - > set_format ( " , biosdetect '%s' " ) ;
# endif
bx_options . atadevice [ channel ] [ slave ] . Otype - > set_handler ( bx_param_handler ) ;
bx_options . atadevice [ channel ] [ slave ] . Ostatus - > set_handler ( bx_param_handler ) ;
bx_options . atadevice [ channel ] [ slave ] . Opath - > set_handler ( bx_param_string_handler ) ;
}
}
2001-06-21 18:37:55 +04:00
bx_options . OnewHardDriveSupport = new bx_param_bool_c ( BXP_NEWHARDDRIVESUPPORT ,
2002-09-03 12:42:23 +04:00
" New hard drive support " ,
2001-06-21 18:37:55 +04:00
" Enables new features found on newer hard drives. " ,
1 ) ;
bx_options . Obootdrive = new bx_param_enum_c ( BXP_BOOTDRIVE ,
" bootdrive " ,
2002-01-30 13:30:52 +03:00
" Boot A, C or CD " ,
2001-06-21 18:37:55 +04:00
floppy_bootdisk_names ,
BX_BOOT_FLOPPYA ,
BX_BOOT_FLOPPYA ) ;
bx_options . Obootdrive - > set_format ( " Boot from: %s drive " ) ;
2002-01-30 13:30:52 +03:00
bx_options . Obootdrive - > set_ask_format ( " Boot from floppy drive, hard drive or cdrom ? [%s] " ) ;
2002-04-23 11:44:34 +04:00
bx_options . OfloppySigCheck = new bx_param_bool_c ( BXP_FLOPPYSIGCHECK ,
2002-05-25 17:16:55 +04:00
" Skip Floppy Boot Signature Check " ,
" Skips check for the 0xaa55 signature on floppy boot device. " ,
2002-05-04 20:00:40 +04:00
0 ) ;
2002-04-23 11:44:34 +04:00
2001-06-21 18:37:55 +04:00
// disk menu
bx_param_c * disk_menu_init_list [ ] = {
SIM - > get_param ( BXP_FLOPPYA ) ,
SIM - > get_param ( BXP_FLOPPYB ) ,
2002-09-23 00:56:12 +04:00
//SIM->get_param (BXP_DISKC),
//SIM->get_param (BXP_DISKD),
//SIM->get_param (BXP_CDROMD),
SIM - > get_param ( BXP_ATA0 ) ,
SIM - > get_param ( BXP_ATA0_MASTER ) ,
SIM - > get_param ( BXP_ATA0_SLAVE ) ,
# if BX_MAX_ATA_CHANNEL>1
SIM - > get_param ( BXP_ATA1 ) ,
SIM - > get_param ( BXP_ATA1_MASTER ) ,
SIM - > get_param ( BXP_ATA1_SLAVE ) ,
# endif
# if BX_MAX_ATA_CHANNEL>2
SIM - > get_param ( BXP_ATA2 ) ,
SIM - > get_param ( BXP_ATA2_MASTER ) ,
SIM - > get_param ( BXP_ATA2_SLAVE ) ,
# endif
# if BX_MAX_ATA_CHANNEL>3
SIM - > get_param ( BXP_ATA3 ) ,
SIM - > get_param ( BXP_ATA3_MASTER ) ,
SIM - > get_param ( BXP_ATA3_SLAVE ) ,
# endif
2001-06-21 18:37:55 +04:00
SIM - > get_param ( BXP_NEWHARDDRIVESUPPORT ) ,
SIM - > get_param ( BXP_BOOTDRIVE ) ,
2002-04-23 11:44:34 +04:00
SIM - > get_param ( BXP_FLOPPYSIGCHECK ) ,
2001-06-21 18:37:55 +04:00
NULL
} ;
menu = new bx_list_c ( BXP_MENU_DISK , " Bochs Disk Options " , " diskmenu " , disk_menu_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2001-06-20 18:01:39 +04:00
2001-06-18 18:11:55 +04:00
// memory options menu
2001-06-20 18:01:39 +04:00
bx_options . memory . Osize = new bx_param_num_c ( BXP_MEM_SIZE ,
2001-06-17 03:08:32 +04:00
" megs " ,
" Amount of RAM in megabytes " ,
2002-10-21 15:13:54 +04:00
1 , BX_MAX_BIT32U ,
2001-06-17 03:08:32 +04:00
BX_DEFAULT_MEM_MEGS ) ;
2001-06-20 18:01:39 +04:00
bx_options . memory . Osize - > set_format ( " Memory size in megabytes: %d " ) ;
bx_options . memory . Osize - > set_ask_format ( " Enter memory size (MB): [%d] " ) ;
2001-11-12 05:35:09 +03:00
2002-09-03 12:42:23 +04:00
// initialize serial and parallel port options
2002-09-03 23:04:17 +04:00
# define PAR_SER_INIT_LIST_MAX \
2002-09-03 19:59:52 +04:00
( ( BXP_PARAMS_PER_PARALLEL_PORT * BX_N_PARALLEL_PORTS ) \
2003-01-28 19:58:10 +03:00
+ ( BXP_PARAMS_PER_SERIAL_PORT * BX_N_SERIAL_PORTS ) \
+ ( BXP_PARAMS_PER_USB_HUB * BX_N_USB_HUBS ) )
2002-09-03 19:59:52 +04:00
bx_param_c * par_ser_init_list [ 1 + PAR_SER_INIT_LIST_MAX ] ;
2002-09-03 12:42:23 +04:00
bx_param_c * * par_ser_ptr = & par_ser_init_list [ 0 ] ;
// parallel ports
2002-09-03 19:59:52 +04:00
for ( i = 0 ; i < BX_N_PARALLEL_PORTS ; i + + ) {
2002-11-01 19:30:53 +03:00
sprintf ( name , " Enable parallel port #%d " , i + 1 ) ;
bx_options . par [ i ] . Oenabled = new bx_param_bool_c (
BXP_PARPORTx_ENABLED ( i + 1 ) ,
strdup ( name ) ,
" " ,
( i = = 0 ) ? 1 : 0 ) ; // only enable #1 by default
sprintf ( name , " Parallel port #%d output file " , i + 1 ) ;
sprintf ( descr , " Data written to parport#%d by the guest OS is written to this file " , i + 1 ) ;
bx_options . par [ i ] . Ooutfile = new bx_param_filename_c (
BXP_PARPORTx_OUTFILE ( i + 1 ) ,
strdup ( name ) ,
strdup ( descr ) ,
" " , BX_PATHNAME_LEN ) ;
deplist = new bx_list_c ( BXP_NULL , 1 ) ;
deplist - > add ( bx_options . par [ i ] . Ooutfile ) ;
bx_options . par [ i ] . Oenabled - > set_dependent_list ( deplist ) ;
// add to menu
* par_ser_ptr + + = bx_options . par [ i ] . Oenabled ;
* par_ser_ptr + + = bx_options . par [ i ] . Ooutfile ;
2002-09-03 12:42:23 +04:00
}
// serial ports
2002-09-03 19:59:52 +04:00
for ( i = 0 ; i < BX_N_SERIAL_PORTS ; i + + ) {
2002-11-01 19:30:53 +03:00
// options for COM port
sprintf ( name , " Enable serial port #%d (COM%d) " , i + 1 , i + 1 ) ;
sprintf ( descr , " Controls whether COM%d is installed or not " , i + 1 ) ;
bx_options . com [ i ] . Oenabled = new bx_param_bool_c (
BXP_COMx_ENABLED ( i + 1 ) ,
strdup ( name ) ,
strdup ( descr ) ,
( i = = 0 ) ? 1 : 0 ) ; // only enable the first by default
sprintf ( name , " Pathname of the serial device for COM%d " , i + 1 ) ;
bx_options . com [ i ] . Odev = new bx_param_filename_c (
BXP_COMx_PATH ( i + 1 ) ,
strdup ( name ) ,
" " ,
" " , BX_PATHNAME_LEN ) ;
deplist = new bx_list_c ( BXP_NULL , 1 ) ;
deplist - > add ( bx_options . com [ i ] . Odev ) ;
bx_options . com [ i ] . Oenabled - > set_dependent_list ( deplist ) ;
// add to menu
* par_ser_ptr + + = bx_options . com [ i ] . Oenabled ;
* par_ser_ptr + + = bx_options . com [ i ] . Odev ;
2002-09-03 12:42:23 +04:00
}
2003-01-28 19:58:10 +03:00
// usb hubs
for ( i = 0 ; i < BX_N_USB_HUBS ; i + + ) {
// options for USB hub
sprintf ( name , " Enable usb hub #%d (USB%d) " , i + 1 , i + 1 ) ;
sprintf ( descr , " Controls whether USB%d is installed or not " , i + 1 ) ;
bx_options . usb [ i ] . Oenabled = new bx_param_bool_c (
BXP_USBx_ENABLED ( i + 1 ) ,
strdup ( name ) ,
strdup ( descr ) ,
( i = = 0 ) ? 1 : 0 ) ; // only enable the first by default
bx_options . usb [ i ] . Oioaddr = new bx_param_num_c (
BXP_USBx_IOADDR ( i + 1 ) ,
" USB ioaddr " ,
" IO base adress of USB hub " ,
0 , 0xffe0 ,
( i = = 0 ) ? 0xff40 : 0 ) ;
bx_options . usb [ i ] . Oirq = new bx_param_num_c (
BXP_USBx_IRQ ( i + 1 ) ,
" USB irq " ,
" IRQ of USB hub " ,
0 , 15 ,
( i = = 0 ) ? 9 : 0 ) ;
deplist = new bx_list_c ( BXP_NULL , 2 ) ;
deplist - > add ( bx_options . usb [ i ] . Oioaddr ) ;
deplist - > add ( bx_options . usb [ i ] . Oirq ) ;
bx_options . usb [ i ] . Oenabled - > set_dependent_list ( deplist ) ;
// add to menu
* par_ser_ptr + + = bx_options . usb [ i ] . Oenabled ;
* par_ser_ptr + + = bx_options . usb [ i ] . Oioaddr ;
* par_ser_ptr + + = bx_options . usb [ i ] . Oirq ;
bx_options . usb [ i ] . Oioaddr - > set_ask_format (
BX_WITH_WX ? " I/O Address : "
: " Enter new ioaddr: [0x%x] " ) ;
bx_options . usb [ i ] . Oioaddr - > set_base ( 16 ) ;
}
2002-09-03 12:42:23 +04:00
// add final NULL at the end, and build the menu
* par_ser_ptr = NULL ;
menu = new bx_list_c ( BXP_MENU_SERIAL_PARALLEL ,
2002-11-01 19:30:53 +03:00
" Serial and Parallel Port Options " ,
" serial_parallel_menu " ,
par_ser_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2001-11-12 05:35:09 +03:00
2002-04-18 04:22:20 +04:00
bx_options . rom . Opath = new bx_param_filename_c ( BXP_ROM_PATH ,
2001-06-18 18:11:55 +04:00
" romimage " ,
" Pathname of ROM image to load " ,
" " , BX_PATHNAME_LEN ) ;
2001-06-20 18:01:39 +04:00
bx_options . rom . Opath - > set_format ( " Name of ROM BIOS image: %s " ) ;
bx_options . rom . Oaddress = new bx_param_num_c ( BXP_ROM_ADDRESS ,
2001-06-18 18:11:55 +04:00
" romaddr " ,
" The address at which the ROM image should be loaded " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2002-09-03 09:34:32 +04:00
0xf0000 ) ;
2001-06-20 18:01:39 +04:00
bx_options . rom . Oaddress - > set_format ( " ROM BIOS address: 0x%05x " ) ;
bx_options . rom . Oaddress - > set_base ( 16 ) ;
2002-07-24 21:52:34 +04:00
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Opath = new bx_param_filename_c ( BXP_OPTROM1_PATH ,
2002-07-24 21:52:34 +04:00
" optional romimage #1 " ,
" Pathname of optional ROM image #1 to load " ,
" " , BX_PATHNAME_LEN ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Opath - > set_format ( " Name of optional ROM image #1 : %s " ) ;
bx_options . optrom [ 0 ] . Oaddress = new bx_param_num_c ( BXP_OPTROM1_ADDRESS ,
2002-07-24 21:52:34 +04:00
" optional romaddr #1 " ,
" The address at which the optional ROM image #1 should be loaded " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2002-07-24 21:52:34 +04:00
0 ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Oaddress - > set_format ( " optional ROM #1 address: 0x%05x " ) ;
bx_options . optrom [ 0 ] . Oaddress - > set_base ( 16 ) ;
2002-07-24 21:52:34 +04:00
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 1 ] . Opath = new bx_param_filename_c ( BXP_OPTROM2_PATH ,
2002-07-24 21:52:34 +04:00
" optional romimage #2 " ,
" Pathname of optional ROM image #2 to load " ,
" " , BX_PATHNAME_LEN ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 1 ] . Opath - > set_format ( " Name of optional ROM image #2 : %s " ) ;
bx_options . optrom [ 1 ] . Oaddress = new bx_param_num_c ( BXP_OPTROM2_ADDRESS ,
2002-07-24 21:52:34 +04:00
" optional romaddr #2 " ,
" The address at which the optional ROM image #2 should be loaded " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2002-07-24 21:52:34 +04:00
0 ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 1 ] . Oaddress - > set_format ( " optional ROM #2 address: 0x%05x " ) ;
bx_options . optrom [ 1 ] . Oaddress - > set_base ( 16 ) ;
2002-07-24 21:52:34 +04:00
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 2 ] . Opath = new bx_param_filename_c ( BXP_OPTROM3_PATH ,
2002-07-24 21:52:34 +04:00
" optional romimage #3 " ,
" Pathname of optional ROM image #3 to load " ,
" " , BX_PATHNAME_LEN ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 2 ] . Opath - > set_format ( " Name of optional ROM image #3 : %s " ) ;
bx_options . optrom [ 2 ] . Oaddress = new bx_param_num_c ( BXP_OPTROM3_ADDRESS ,
2002-07-24 21:52:34 +04:00
" optional romaddr #3 " ,
" The address at which the optional ROM image #3 should be loaded " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2002-07-24 21:52:34 +04:00
0 ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 2 ] . Oaddress - > set_format ( " optional ROM #3 address: 0x%05x " ) ;
bx_options . optrom [ 2 ] . Oaddress - > set_base ( 16 ) ;
2002-07-24 21:52:34 +04:00
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 3 ] . Opath = new bx_param_filename_c ( BXP_OPTROM4_PATH ,
2002-07-24 21:52:34 +04:00
" optional romimage #4 " ,
" Pathname of optional ROM image #4 to load " ,
" " , BX_PATHNAME_LEN ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 3 ] . Opath - > set_format ( " Name of optional ROM image #4 : %s " ) ;
bx_options . optrom [ 3 ] . Oaddress = new bx_param_num_c ( BXP_OPTROM4_ADDRESS ,
2002-07-24 21:52:34 +04:00
" optional romaddr #4 " ,
" The address at which the optional ROM image #4 should be loaded " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2002-07-24 21:52:34 +04:00
0 ) ;
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 3 ] . Oaddress - > set_format ( " optional ROM #4 address: 0x%05x " ) ;
bx_options . optrom [ 3 ] . Oaddress - > set_base ( 16 ) ;
2002-07-24 21:52:34 +04:00
2002-04-18 04:22:20 +04:00
bx_options . vgarom . Opath = new bx_param_filename_c ( BXP_VGA_ROM_PATH ,
2001-06-18 18:11:55 +04:00
" vgaromimage " ,
" Pathname of VGA ROM image to load " ,
" " , BX_PATHNAME_LEN ) ;
2001-06-20 18:01:39 +04:00
bx_options . vgarom . Opath - > set_format ( " Name of VGA BIOS image: %s " ) ;
2001-06-21 18:37:55 +04:00
bx_param_c * memory_init_list [ ] = {
2001-06-20 18:01:39 +04:00
bx_options . memory . Osize ,
bx_options . vgarom . Opath ,
bx_options . rom . Opath ,
bx_options . rom . Oaddress ,
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Opath ,
bx_options . optrom [ 0 ] . Oaddress ,
bx_options . optrom [ 1 ] . Opath ,
bx_options . optrom [ 1 ] . Oaddress ,
bx_options . optrom [ 2 ] . Opath ,
bx_options . optrom [ 2 ] . Oaddress ,
bx_options . optrom [ 3 ] . Opath ,
bx_options . optrom [ 3 ] . Oaddress ,
2001-06-18 18:11:55 +04:00
NULL
} ;
2001-06-21 18:37:55 +04:00
menu = new bx_list_c ( BXP_MENU_MEMORY , " Bochs Memory Options " , " memmenu " , memory_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2001-06-18 18:11:55 +04:00
2001-06-21 23:57:21 +04:00
// interface
2001-06-20 18:01:39 +04:00
bx_options . Ovga_update_interval = new bx_param_num_c ( BXP_VGA_UPDATE_INTERVAL ,
2001-06-21 18:37:55 +04:00
" VGA Update Interval " ,
2001-06-17 03:08:32 +04:00
" Number of microseconds between VGA updates " ,
2002-10-21 15:13:54 +04:00
1 , BX_MAX_BIT32U ,
2001-06-17 03:08:32 +04:00
30000 ) ;
2001-06-20 18:01:39 +04:00
bx_options . Ovga_update_interval - > set_handler ( bx_param_handler ) ;
2001-06-21 18:37:55 +04:00
bx_options . Ovga_update_interval - > set_ask_format ( " Type a new value for VGA update interval: [%d] " ) ;
bx_options . Omouse_enabled = new bx_param_bool_c ( BXP_MOUSE_ENABLED ,
" Enable the mouse " ,
" Controls whether the mouse sends events to bochs " ,
0 ) ;
bx_options . Omouse_enabled - > set_handler ( bx_param_handler ) ;
bx_options . Oips = new bx_param_num_c ( BXP_IPS ,
" Emulated instructions per second (IPS) " ,
" Emulated instructions per second, used to calibrate bochs emulated \n time with wall clock time. " ,
2002-10-21 15:13:54 +04:00
1 , BX_MAX_BIT32U ,
2001-06-21 18:37:55 +04:00
500000 ) ;
2002-10-30 01:26:32 +03:00
bx_options . Orealtime_pit = new bx_param_bool_c ( BXP_REALTIME_PIT ,
" Enable the realtime PIT " ,
" Keeps bochs in sync with real time, but sacrifices reproducibility " ,
0 ) ;
2002-12-12 09:21:43 +03:00
bx_options . Otext_snapshot_check = new bx_param_bool_c ( BXP_TEXT_SNAPSHOT_CHECK ,
" Enable panic for use in bochs testing " ,
2002-12-16 05:49:55 +03:00
" Enable panic when text on screen matches snapchk.txt. \n Useful for regression testing. \n In win32, turns off CR/LF in snapshots and cuts. " ,
2002-12-12 09:21:43 +03:00
0 ) ;
2001-06-21 18:37:55 +04:00
bx_options . Oprivate_colormap = new bx_param_bool_c ( BXP_PRIVATE_COLORMAP ,
" Use a private colormap " ,
" Request that the GUI create and use it's own non-shared colormap. This colormap will be used when in the bochs window. If not enabled, a shared colormap scheme may be used. Not implemented on all GUI's. " ,
0 ) ;
2001-08-16 16:35:52 +04:00
# if BX_WITH_AMIGAOS
2001-08-16 06:00:31 +04:00
bx_options . Ofullscreen = new bx_param_bool_c ( BXP_FULLSCREEN ,
" Use full screen mode " ,
" When enabled, bochs occupies the whole screen instead of just a window. " ,
0 ) ;
bx_options . Oscreenmode = new bx_param_string_c ( BXP_SCREENMODE ,
" Screen mode name " ,
" Screen mode name " ,
" " , BX_PATHNAME_LEN ) ;
bx_options . Oscreenmode - > set_handler ( bx_param_string_handler ) ;
# endif
2002-10-25 01:07:56 +04:00
static char * config_interface_list [ ] = {
2002-10-29 23:18:32 +03:00
" textconfig " ,
2002-10-25 01:07:56 +04:00
# if BX_WITH_WX
" wx " ,
# endif
NULL
} ;
bx_options . Osel_config = new bx_param_enum_c (
BXP_SEL_CONFIG_INTERFACE ,
" Configuration interface " ,
" Select configuration interface " ,
config_interface_list ,
0 ,
0 ) ;
bx_options . Osel_config - > set_by_name ( BX_DEFAULT_CONFIG_INTERFACE ) ;
bx_options . Osel_config - > set_format ( " Configuration interface: %s " ) ;
bx_options . Osel_config - > set_ask_format ( " Choose which configuration interface to use: [%s] " ) ;
// this is a list of gui libraries that are known to be available at
// compile time. The one that is listed first will be the default,
// which is used unless the user overrides it on the command line or
// in a configuration file.
static char * display_library_list [ ] = {
# if BX_WITH_X11
" x " ,
# endif
# if BX_WITH_WIN32
" win32 " ,
# endif
# if BX_WITH_CARBON
" carbon " ,
# endif
# if BX_WITH_BEOS
" beos " ,
# endif
# if BX_WITH_MACOS
" macos " ,
# endif
# if BX_WITH_AMIGAOS
" amigaos " ,
# endif
# if BX_WITH_SDL
" sdl " ,
# endif
2002-11-21 22:26:07 +03:00
# if BX_WITH_SVGA
" svga " ,
# endif
2002-10-25 01:07:56 +04:00
# if BX_WITH_TERM
" term " ,
# endif
# if BX_WITH_RFB
" rfb " ,
# endif
# if BX_WITH_WX
" wx " ,
# endif
# if BX_WITH_NOGUI
" nogui " ,
# endif
NULL
} ;
bx_options . Osel_displaylib = new bx_param_enum_c ( BXP_SEL_DISPLAY_LIBRARY ,
" VGA Display Library " ,
" Select VGA Display Library " ,
display_library_list ,
0 ,
0 ) ;
bx_options . Osel_displaylib - > set_by_name ( BX_DEFAULT_DISPLAY_LIBRARY ) ;
2002-11-15 19:14:01 +03:00
bx_options . Osel_displaylib - > set_format ( " Display library: %s " ) ;
2002-11-16 01:56:37 +03:00
bx_options . Osel_displaylib - > set_ask_format ( " Choose which library to use for the Bochs display: [%s] " ) ;
2001-06-21 18:37:55 +04:00
bx_param_c * interface_init_list [ ] = {
2002-10-25 01:07:56 +04:00
bx_options . Osel_config ,
bx_options . Osel_displaylib ,
2001-06-21 18:37:55 +04:00
bx_options . Ovga_update_interval ,
bx_options . Omouse_enabled ,
bx_options . Oips ,
2002-10-30 01:26:32 +03:00
bx_options . Orealtime_pit ,
2001-06-21 18:37:55 +04:00
bx_options . Oprivate_colormap ,
2001-08-16 16:35:52 +04:00
# if BX_WITH_AMIGAOS
2001-08-16 00:17:19 +04:00
bx_options . Ofullscreen ,
2001-08-16 06:00:31 +04:00
bx_options . Oscreenmode ,
# endif
2001-06-21 18:37:55 +04:00
NULL
} ;
menu = new bx_list_c ( BXP_MENU_INTERFACE , " Bochs Interface Menu " , " intfmenu " , interface_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2001-06-21 18:37:55 +04:00
2001-06-21 22:34:50 +04:00
// NE2K options
2002-11-18 20:16:07 +03:00
bx_options . ne2k . Opresent = new bx_param_bool_c ( BXP_NE2K_PRESENT ,
2001-06-21 22:34:50 +04:00
" NE2K is present " ,
" to be written " ,
0 ) ;
bx_options . ne2k . Oioaddr = new bx_param_num_c ( BXP_NE2K_IOADDR ,
" NE2K I/O Address " ,
" to be written " ,
0 , 0xffff ,
0 ) ;
bx_options . ne2k . Oioaddr - > set_base ( 16 ) ;
bx_options . ne2k . Oirq = new bx_param_num_c ( BXP_NE2K_IRQ ,
" NE2K Interrupt " ,
" to be written " ,
0 , 15 ,
0 ) ;
2001-06-21 23:27:05 +04:00
bx_options . ne2k . Omacaddr = new bx_param_string_c ( BXP_NE2K_MACADDR ,
" MAC Address " ,
" to be written " ,
" " , 6 ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
bx_options . ne2k . Omacaddr - > get_options ( ) - > set ( bx_options . ne2k . Omacaddr - > RAW_BYTES ) ;
2001-06-21 23:27:05 +04:00
bx_options . ne2k . Omacaddr - > set_separator ( ' : ' ) ;
2001-06-21 22:34:50 +04:00
bx_options . ne2k . Oethmod = new bx_param_string_c ( BXP_NE2K_ETHMOD ,
" Ethernet module " ,
" to be written " ,
" null " , 16 ) ;
bx_options . ne2k . Oethdev = new bx_param_string_c ( BXP_NE2K_ETHDEV ,
" Ethernet device " ,
" to be written " ,
" xl0 " , BX_PATHNAME_LEN ) ;
2002-05-02 11:54:22 +04:00
bx_options . ne2k . Oscript = new bx_param_string_c ( BXP_NE2K_SCRIPT ,
" Device configuration script " ,
" to be written " ,
" none " , BX_PATHNAME_LEN ) ;
bx_options . ne2k . Oscript - > set_ask_format ( " Enter new script name, or 'none': [%s] " ) ;
2001-06-21 22:34:50 +04:00
bx_param_c * ne2k_init_list [ ] = {
2002-11-18 20:16:07 +03:00
bx_options . ne2k . Opresent ,
2001-06-21 22:34:50 +04:00
bx_options . ne2k . Oioaddr ,
bx_options . ne2k . Oirq ,
2001-06-21 23:27:05 +04:00
bx_options . ne2k . Omacaddr ,
2001-06-21 22:34:50 +04:00
bx_options . ne2k . Oethmod ,
bx_options . ne2k . Oethdev ,
2002-05-02 11:54:22 +04:00
bx_options . ne2k . Oscript ,
2001-06-21 22:34:50 +04:00
NULL
} ;
menu = new bx_list_c ( BXP_NE2K , " NE2K Configuration " , " " , ne2k_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2002-11-18 20:16:07 +03:00
bx_options . ne2k . Opresent - > set_handler ( bx_param_handler ) ;
bx_options . ne2k . Opresent - > set ( 0 ) ;
2001-06-21 22:34:50 +04:00
// SB16 options
bx_options . sb16 . Opresent = new bx_param_bool_c ( BXP_SB16_PRESENT ,
" SB16 is present " ,
" to be written " ,
0 ) ;
2002-04-18 04:22:20 +04:00
bx_options . sb16 . Omidifile = new bx_param_filename_c ( BXP_SB16_MIDIFILE ,
2001-06-21 22:34:50 +04:00
" Midi file " ,
" to be written " ,
" " , BX_PATHNAME_LEN ) ;
2002-04-18 04:22:20 +04:00
bx_options . sb16 . Owavefile = new bx_param_filename_c ( BXP_SB16_WAVEFILE ,
2001-06-21 22:34:50 +04:00
" Wave file " ,
" to be written " ,
" " , BX_PATHNAME_LEN ) ;
2002-04-18 04:22:20 +04:00
bx_options . sb16 . Ologfile = new bx_param_filename_c ( BXP_SB16_LOGFILE ,
2001-06-21 22:34:50 +04:00
" Log file " ,
" to be written " ,
" " , BX_PATHNAME_LEN ) ;
bx_options . sb16 . Omidimode = new bx_param_num_c ( BXP_SB16_MIDIMODE ,
" Midi mode " ,
" to be written " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2001-06-21 22:34:50 +04:00
0 ) ;
bx_options . sb16 . Owavemode = new bx_param_num_c ( BXP_SB16_WAVEMODE ,
" Wave mode " ,
" to be written " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2001-06-21 22:34:50 +04:00
0 ) ;
bx_options . sb16 . Ologlevel = new bx_param_num_c ( BXP_SB16_LOGLEVEL ,
" Log mode " ,
" to be written " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2001-06-21 22:34:50 +04:00
0 ) ;
bx_options . sb16 . Odmatimer = new bx_param_num_c ( BXP_SB16_DMATIMER ,
" DMA timer " ,
" to be written " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2001-06-21 22:34:50 +04:00
0 ) ;
bx_param_c * sb16_init_list [ ] = {
bx_options . sb16 . Opresent ,
bx_options . sb16 . Omidifile ,
bx_options . sb16 . Owavefile ,
bx_options . sb16 . Ologfile ,
bx_options . sb16 . Omidimode ,
bx_options . sb16 . Owavemode ,
bx_options . sb16 . Ologlevel ,
bx_options . sb16 . Odmatimer ,
NULL
} ;
menu = new bx_list_c ( BXP_SB16 , " SB16 Configuration " , " " , sb16_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2002-09-03 12:42:23 +04:00
// sb16_dependent_list is a null-terminated list including all the
// sb16 fields except for the "present" field. These will all be enabled/
// disabled according to the value of the present field.
bx_param_c * * sb16_dependent_list = & sb16_init_list [ 1 ] ;
bx_options . sb16 . Opresent - > set_dependent_list (
new bx_list_c ( BXP_NULL , " " , " " , sb16_dependent_list ) ) ;
2001-06-21 22:34:50 +04:00
2002-04-18 04:22:20 +04:00
bx_options . log . Ofilename = new bx_param_filename_c ( BXP_LOG_FILENAME ,
2002-09-03 12:42:23 +04:00
" Log filename " ,
2001-06-21 23:57:21 +04:00
" Pathname of bochs log file " ,
" - " , BX_PATHNAME_LEN ) ;
bx_options . log . Ofilename - > set_ask_format ( " Enter log filename: [%s] " ) ;
2002-06-26 18:42:35 +04:00
bx_options . log . Oprefix = new bx_param_string_c ( BXP_LOG_PREFIX ,
2002-09-03 12:42:23 +04:00
" Log output prefix " ,
2002-06-26 18:42:35 +04:00
" Prefix prepended to log output " ,
" %t%e%d " , BX_PATHNAME_LEN ) ;
bx_options . log . Oprefix - > set_ask_format ( " Enter log prefix: [%s] " ) ;
2002-12-03 00:26:05 +03:00
bx_options . log . Odebugger_filename = new bx_param_filename_c ( BXP_DEBUGGER_LOG_FILENAME ,
" Debugger Log filename " ,
" Pathname of debugger log file " ,
" - " , BX_PATHNAME_LEN ) ;
bx_options . log . Odebugger_filename - > set_ask_format ( " Enter debugger log filename: [%s] " ) ;
2001-06-21 23:57:21 +04:00
// loader
bx_options . load32bitOSImage . OwhichOS = new bx_param_enum_c ( BXP_LOAD32BITOS_WHICH ,
" Which operating system? " ,
" Which OS to boot " ,
loader_os_names ,
Load32bitOSNone ,
Load32bitOSNone ) ;
2002-04-18 04:22:20 +04:00
bx_options . load32bitOSImage . Opath = new bx_param_filename_c ( BXP_LOAD32BITOS_PATH ,
2001-06-21 23:57:21 +04:00
" Pathname of OS to load " ,
NULL ,
" " , BX_PATHNAME_LEN ) ;
2002-04-18 04:22:20 +04:00
bx_options . load32bitOSImage . Oiolog = new bx_param_filename_c ( BXP_LOAD32BITOS_IOLOG ,
2001-06-21 23:57:21 +04:00
" Pathname of I/O log file " ,
NULL ,
" " , BX_PATHNAME_LEN ) ;
2002-04-18 04:22:20 +04:00
bx_options . load32bitOSImage . Oinitrd = new bx_param_filename_c ( BXP_LOAD32BITOS_INITRD ,
2001-06-21 23:57:21 +04:00
" Pathname of initrd " ,
NULL ,
" " , BX_PATHNAME_LEN ) ;
bx_param_c * loader_init_list [ ] = {
bx_options . load32bitOSImage . OwhichOS ,
bx_options . load32bitOSImage . Opath ,
bx_options . load32bitOSImage . Oiolog ,
bx_options . load32bitOSImage . Oinitrd ,
NULL
} ;
bx_options . load32bitOSImage . OwhichOS - > set_format ( " os=%s " ) ;
bx_options . load32bitOSImage . Opath - > set_format ( " , path=%s " ) ;
bx_options . load32bitOSImage . Oiolog - > set_format ( " , iolog=%s " ) ;
bx_options . load32bitOSImage . Oinitrd - > set_format ( " , initrd=%s " ) ;
bx_options . load32bitOSImage . OwhichOS - > set_ask_format ( " Enter OS to load: [%s] " ) ;
bx_options . load32bitOSImage . Opath - > set_ask_format ( " Enter pathname of OS: [%s] " ) ;
bx_options . load32bitOSImage . Oiolog - > set_ask_format ( " Enter pathname of I/O log: [%s] " ) ;
bx_options . load32bitOSImage . Oinitrd - > set_ask_format ( " Enter pathname of initrd: [%s] " ) ;
menu = new bx_list_c ( BXP_LOAD32BITOS , " 32-bit OS Loader " , " " , loader_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SERIES_ASK ) ;
2001-06-21 23:57:21 +04:00
bx_options . load32bitOSImage . OwhichOS - > set_handler ( bx_param_handler ) ;
bx_options . load32bitOSImage . OwhichOS - > set ( Load32bitOSNone ) ;
// other
2001-06-20 18:01:39 +04:00
bx_options . Okeyboard_serial_delay = new bx_param_num_c ( BXP_KBD_SERIAL_DELAY ,
2002-09-03 12:42:23 +04:00
" Keyboard serial delay " ,
2001-06-20 18:01:39 +04:00
" Approximate time in microseconds that it takes one character to be transfered from the keyboard to controller over the serial path. " ,
2002-10-21 15:13:54 +04:00
1 , BX_MAX_BIT32U ,
2001-06-20 18:01:39 +04:00
20000 ) ;
2002-03-26 16:51:48 +03:00
bx_options . Okeyboard_paste_delay = new bx_param_num_c ( BXP_KBD_PASTE_DELAY ,
2002-09-03 12:42:23 +04:00
" Keyboard paste delay " ,
2002-03-26 16:51:48 +03:00
" Approximate time in microseconds between attemps to paste characters to the keyboard controller. " ,
2002-10-21 15:13:54 +04:00
1000 , BX_MAX_BIT32U ,
2002-03-26 16:51:48 +03:00
100000 ) ;
2002-03-26 17:46:03 +03:00
bx_options . Okeyboard_paste_delay - > set_handler ( bx_param_handler ) ;
2001-06-20 18:01:39 +04:00
bx_options . Ofloppy_command_delay = new bx_param_num_c ( BXP_FLOPPY_CMD_DELAY ,
2002-09-03 12:42:23 +04:00
" Floppy command delay " ,
2001-06-20 18:01:39 +04:00
" Time in microseconds to wait before completing some floppy commands such as read/write/seek/etc, which normally have a delay associated. This used to be hardwired to 50,000 before. " ,
2002-10-21 15:13:54 +04:00
1 , BX_MAX_BIT32U ,
2001-06-20 18:01:39 +04:00
50000 ) ;
bx_options . Oi440FXSupport = new bx_param_bool_c ( BXP_I440FX_SUPPORT ,
2002-09-03 12:42:23 +04:00
" PCI i440FX Support " ,
2001-06-20 18:01:39 +04:00
" Controls whether to emulate PCI I440FX " ,
0 ) ;
2001-06-21 23:57:21 +04:00
bx_options . cmos . OcmosImage = new bx_param_bool_c ( BXP_CMOS_IMAGE ,
" Use a CMOS image " ,
NULL ,
0 ) ;
2002-04-18 04:22:20 +04:00
bx_options . cmos . Opath = new bx_param_filename_c ( BXP_CMOS_PATH ,
2001-06-20 18:01:39 +04:00
" Pathname of CMOS image " ,
2001-06-21 23:57:21 +04:00
NULL ,
2001-06-20 18:01:39 +04:00
" " , BX_PATHNAME_LEN ) ;
2002-09-03 12:42:23 +04:00
deplist = new bx_list_c ( BXP_NULL , 1 ) ;
deplist - > add ( bx_options . cmos . Opath ) ;
bx_options . cmos . OcmosImage - > set_dependent_list ( deplist ) ;
2001-06-20 18:01:39 +04:00
bx_options . cmos . Otime0 = new bx_param_num_c ( BXP_CMOS_TIME0 ,
2001-06-21 23:57:21 +04:00
" Initial CMOS time for Bochs " ,
2001-06-20 18:01:39 +04:00
" Start time for Bochs CMOS clock, used if you really want two runs to be identical (cosimulation) " ,
2002-10-21 15:13:54 +04:00
0 , BX_MAX_BIT32U ,
2001-06-20 18:01:39 +04:00
0 ) ;
2001-12-12 13:43:36 +03:00
2001-12-14 20:56:37 +03:00
// Keyboard mapping
bx_options . keyboard . OuseMapping = new bx_param_bool_c ( BXP_KEYBOARD_USEMAPPING ,
" Use keyboard mapping " ,
NULL ,
0 ) ;
2002-04-18 04:22:20 +04:00
bx_options . keyboard . Okeymap = new bx_param_filename_c ( BXP_KEYBOARD_MAP ,
2002-03-06 12:31:55 +03:00
" Keymap filename " ,
2001-12-14 20:56:37 +03:00
NULL ,
2002-03-06 12:31:55 +03:00
" " , BX_PATHNAME_LEN ) ;
2002-09-03 12:42:23 +04:00
deplist = new bx_list_c ( BXP_NULL , 1 ) ;
deplist - > add ( bx_options . keyboard . Okeymap ) ;
bx_options . keyboard . OuseMapping - > set_dependent_list ( deplist ) ;
2001-12-14 20:56:37 +03:00
// Keyboard type
2001-12-12 13:43:36 +03:00
bx_options . Okeyboard_type = new bx_param_enum_c ( BXP_KBD_TYPE ,
" Keyboard type " ,
" Keyboard type " ,
keyboard_type_names ,
BX_KBD_MF_TYPE ,
BX_KBD_XT_TYPE ) ;
bx_options . Okeyboard_type - > set_format ( " Keyboard type: %s " ) ;
bx_options . Okeyboard_type - > set_ask_format ( " Enter keyboard type: [%s] " ) ;
2002-08-09 10:16:43 +04:00
// Userbutton shortcut
bx_options . Ouser_shortcut = new bx_param_string_c ( BXP_USER_SHORTCUT ,
" Userbutton shortcut " ,
" Userbutton shortcut " ,
" none " , 16 ) ;
2002-10-03 09:29:15 +04:00
// GDB stub
bx_options . gdbstub . port = 1234 ;
bx_options . gdbstub . text_base = 0 ;
bx_options . gdbstub . data_base = 0 ;
bx_options . gdbstub . bss_base = 0 ;
2001-06-21 23:57:21 +04:00
bx_param_c * other_init_list [ ] = {
2002-03-26 16:51:48 +03:00
bx_options . Okeyboard_serial_delay ,
bx_options . Okeyboard_paste_delay ,
2001-06-21 23:57:21 +04:00
bx_options . Ofloppy_command_delay ,
bx_options . Oi440FXSupport ,
bx_options . cmos . OcmosImage ,
bx_options . cmos . Opath ,
bx_options . cmos . Otime0 ,
SIM - > get_param ( BXP_LOAD32BITOS ) ,
2001-12-14 20:56:37 +03:00
bx_options . keyboard . OuseMapping ,
bx_options . keyboard . Okeymap ,
2001-12-12 13:43:36 +03:00
bx_options . Okeyboard_type ,
2002-08-09 10:16:43 +04:00
bx_options . Ouser_shortcut ,
2001-06-21 23:57:21 +04:00
NULL
} ;
menu = new bx_list_c ( BXP_MENU_MISC , " Configure Everything Else " , " " , other_init_list ) ;
- fixed up ParamDialog to correctly handle "trees" of parameters. A
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
2002-10-06 06:37:28 +04:00
menu - > get_options ( ) - > set ( menu - > SHOW_PARENT ) ;
2001-06-16 23:29:59 +04:00
}
2002-08-30 18:22:47 +04:00
void bx_reset_options ( )
{
// drives
bx_options . floppya . Opath - > reset ( ) ;
bx_options . floppya . Odevtype - > reset ( ) ;
bx_options . floppya . Otype - > reset ( ) ;
bx_options . floppya . Ostatus - > reset ( ) ;
bx_options . floppyb . Opath - > reset ( ) ;
bx_options . floppyb . Odevtype - > reset ( ) ;
bx_options . floppyb . Otype - > reset ( ) ;
bx_options . floppyb . Ostatus - > reset ( ) ;
2002-09-23 00:56:12 +04:00
for ( Bit8u channel = 0 ; channel < BX_MAX_ATA_CHANNEL ; channel + + ) {
bx_options . ata [ channel ] . Opresent - > reset ( ) ;
bx_options . ata [ channel ] . Oioaddr1 - > reset ( ) ;
bx_options . ata [ channel ] . Oioaddr2 - > reset ( ) ;
bx_options . ata [ channel ] . Oirq - > reset ( ) ;
for ( Bit8u slave = 0 ; slave < 2 ; slave + + ) {
bx_options . atadevice [ channel ] [ slave ] . Opresent - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Otype - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Opath - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Ocylinders - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Oheads - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Ospt - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Ostatus - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Omodel - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Obiosdetect - > reset ( ) ;
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > reset ( ) ;
}
}
2002-08-30 18:22:47 +04:00
bx_options . OnewHardDriveSupport - > reset ( ) ;
// boot & memory
bx_options . Obootdrive - > reset ( ) ;
bx_options . OfloppySigCheck - > reset ( ) ;
bx_options . memory . Osize - > reset ( ) ;
// standard ports
bx_options . com [ 0 ] . Oenabled - > reset ( ) ;
bx_options . com [ 0 ] . Odev - > reset ( ) ;
bx_options . par [ 0 ] . Oenabled - > reset ( ) ;
bx_options . par [ 0 ] . Ooutfile - > reset ( ) ;
// rom images
bx_options . rom . Opath - > reset ( ) ;
bx_options . rom . Oaddress - > reset ( ) ;
bx_options . optrom [ 0 ] . Opath - > reset ( ) ;
bx_options . optrom [ 0 ] . Oaddress - > reset ( ) ;
bx_options . optrom [ 1 ] . Opath - > reset ( ) ;
bx_options . optrom [ 1 ] . Oaddress - > reset ( ) ;
bx_options . optrom [ 2 ] . Opath - > reset ( ) ;
bx_options . optrom [ 2 ] . Oaddress - > reset ( ) ;
bx_options . optrom [ 3 ] . Opath - > reset ( ) ;
bx_options . optrom [ 3 ] . Oaddress - > reset ( ) ;
bx_options . vgarom . Opath - > reset ( ) ;
// interface
bx_options . Ovga_update_interval - > reset ( ) ;
bx_options . Omouse_enabled - > reset ( ) ;
bx_options . Oips - > reset ( ) ;
2002-10-30 01:26:32 +03:00
bx_options . Orealtime_pit - > reset ( ) ;
2002-08-30 18:22:47 +04:00
bx_options . Oprivate_colormap - > reset ( ) ;
# if BX_WITH_AMIGAOS
bx_options . Ofullscreen - > reset ( ) ;
bx_options . Oscreenmode - > reset ( ) ;
# endif
// ne2k
2002-11-18 20:16:07 +03:00
bx_options . ne2k . Opresent - > reset ( ) ;
2002-08-30 18:22:47 +04:00
bx_options . ne2k . Oioaddr - > reset ( ) ;
bx_options . ne2k . Oirq - > reset ( ) ;
bx_options . ne2k . Omacaddr - > reset ( ) ;
bx_options . ne2k . Oethmod - > reset ( ) ;
bx_options . ne2k . Oethdev - > reset ( ) ;
bx_options . ne2k . Oscript - > reset ( ) ;
// SB16
bx_options . sb16 . Opresent - > reset ( ) ;
bx_options . sb16 . Omidifile - > reset ( ) ;
bx_options . sb16 . Owavefile - > reset ( ) ;
bx_options . sb16 . Ologfile - > reset ( ) ;
bx_options . sb16 . Omidimode - > reset ( ) ;
bx_options . sb16 . Owavemode - > reset ( ) ;
bx_options . sb16 . Ologlevel - > reset ( ) ;
bx_options . sb16 . Odmatimer - > reset ( ) ;
// logfile
bx_options . log . Ofilename - > reset ( ) ;
bx_options . log . Oprefix - > reset ( ) ;
2002-12-03 00:26:05 +03:00
bx_options . log . Odebugger_filename - > reset ( ) ;
2002-08-30 18:22:47 +04:00
// loader
bx_options . load32bitOSImage . OwhichOS - > reset ( ) ;
bx_options . load32bitOSImage . Opath - > reset ( ) ;
bx_options . load32bitOSImage . Oiolog - > reset ( ) ;
bx_options . load32bitOSImage . Oinitrd - > reset ( ) ;
// keyboard
bx_options . Okeyboard_serial_delay - > reset ( ) ;
bx_options . Okeyboard_paste_delay - > reset ( ) ;
bx_options . keyboard . OuseMapping - > reset ( ) ;
bx_options . keyboard . Okeymap - > reset ( ) ;
bx_options . Okeyboard_type - > reset ( ) ;
bx_options . Ouser_shortcut - > reset ( ) ;
// other
bx_options . Ofloppy_command_delay - > reset ( ) ;
bx_options . Oi440FXSupport - > reset ( ) ;
bx_options . cmos . OcmosImage - > reset ( ) ;
bx_options . cmos . Opath - > reset ( ) ;
bx_options . cmos . Otime0 - > reset ( ) ;
2002-12-12 09:21:43 +03:00
bx_options . Otext_snapshot_check - > reset ( ) ;
2002-08-30 18:22:47 +04:00
}
2001-06-19 20:25:41 +04:00
void bx_print_header ( )
{
fprintf ( stderr , " %s \n " , divider ) ;
char buffer [ 128 ] ;
sprintf ( buffer , " Bochs x86 Emulator %s \n " , VER_STRING ) ;
bx_center_print ( stderr , buffer , 72 ) ;
if ( REL_STRING [ 0 ] ) {
sprintf ( buffer , " %s \n " , REL_STRING ) ;
bx_center_print ( stderr , buffer , 72 ) ;
}
fprintf ( stderr , " %s \n " , divider ) ;
}
2001-09-26 07:19:25 +04:00
# if BX_WITH_CARBON
2001-09-26 04:12:12 +04:00
/* Original code by Darrell Walisser - dwaliss1@purdue.edu */
static void setupWorkingDirectory ( char * path )
{
char parentdir [ MAXPATHLEN ] ;
char * c ;
strncpy ( parentdir , path , MAXPATHLEN ) ;
c = ( char * ) parentdir ;
while ( * c ! = ' \0 ' ) /* go to end */
c + + ;
while ( * c ! = ' / ' ) /* back up to parent */
c - - ;
* c = ' \0 ' ; /* cut off last part (binary name) */
2001-10-09 07:21:48 +04:00
2002-11-01 19:30:53 +03:00
/* chdir to the binary app's parent */
int n ;
2001-10-09 07:21:48 +04:00
n = chdir ( parentdir ) ;
2002-11-01 19:30:53 +03:00
if ( n ) BX_PANIC ( ( " failed to change dir to parent " ) ) ;
/* chdir to the .app's parent */
n = chdir ( " ../../../ " ) ;
2001-10-07 22:16:01 +04:00
if ( n ) BX_PANIC ( ( " failed to change to ../../.. " ) ) ;
2001-09-26 04:12:12 +04:00
}
2002-11-25 20:53:53 +03:00
/* Panic button to display fatal errors.
Completely self contained , can ' t rely on carbon . cc being available */
static void carbonFatalDialog ( const char * error , const char * exposition )
{
DialogRef alertDialog ;
CFStringRef cfError ;
CFStringRef cfExposition ;
DialogItemIndex index ;
AlertStdCFStringAlertParamRec alertParam = { 0 } ;
fprintf ( stderr , " Entering carbonFatalDialog: %s \n " , error ) ;
// Init libraries
InitCursor ( ) ;
// Assemble dialog
cfError = CFStringCreateWithCString ( NULL , error , kCFStringEncodingASCII ) ;
if ( exposition ! = NULL )
{
cfExposition = CFStringCreateWithCString ( NULL , exposition , kCFStringEncodingASCII ) ;
}
else { cfExposition = NULL ; }
alertParam . version = kStdCFStringAlertVersionOne ;
alertParam . defaultText = CFSTR ( " Quit " ) ;
alertParam . position = kWindowDefaultPosition ;
alertParam . defaultButton = kAlertStdAlertOKButton ;
// Display Dialog
CreateStandardAlert (
kAlertStopAlert ,
cfError ,
cfExposition , /* can be NULL */
& alertParam , /* can be NULL */
& alertDialog ) ;
RunStandardAlert ( alertDialog , NULL , & index ) ;
// Cleanup
CFRelease ( cfError ) ;
if ( cfExposition ! = NULL ) { CFRelease ( cfExposition ) ; }
}
2001-09-26 04:12:12 +04:00
# endif
2002-11-01 18:19:48 +03:00
int bxmain ( ) {
2002-09-25 20:26:29 +04:00
bx_init_siminterface ( ) ; // create the SIM object
- use setjmp() and longjmp() to quit the simulation thread cleanly.
I use setjmp() to save the context just before calling
bx_continue_after_config_interface(). Then, in
bx_real_sim_c:quit_sim, I use longjmp() to jump back to that context.
This happens in main.cc and in gui/wxmain.cc (wxWindows only).
I haven't tested with the debugger yet. Possibly with debugger
the quit longjmp() should jump back to the debugger prompt loop
instead of actually quitting the program.
- clean up BX_ASYNC_EVT_LOG_MSG implementation by creating a different,
synchronous event called BX_SYNC_EVT_LOG_ASK. The async event
could be used to simply tell the CI that an event has occurred,
for example if the user wanted to view the events on screen
(not implemented). The sync event is used when you want the user
to respond before the simulation can continue, such as a for the
"panic=ask" behavior.
- in wxmain.cc, move the updates to the Start,Stop,Pause,Resume menu
items into a separate method simStatusChanged(). This makes the code that
does important stuff more readable.
- remove wxMutexGuiEnter()/Leave() from MyFrame::OnSim2CuiEvent().
This method is an event handler called in the gui thread, so it
already has the gui lock. This call caused thread lock on my linux
box.
2002-08-27 22:11:13 +04:00
static jmp_buf context ;
if ( setjmp ( context ) = = 0 ) {
SIM - > set_quit_context ( & context ) ;
2002-11-01 18:19:48 +03:00
if ( bx_init_main ( bx_startup_flags . argc , bx_startup_flags . argv ) < 0 )
return 0 ;
2002-10-25 01:07:56 +04:00
// read a param to decide which config interface to start.
// If one exists, start it. If not, just begin.
bx_param_enum_c * ci_param = SIM - > get_param_enum ( BXP_SEL_CONFIG_INTERFACE ) ;
char * ci_name = ci_param - > get_choice ( ci_param - > get ( ) ) ;
2002-10-29 23:18:32 +03:00
if ( ! strcmp ( ci_name , " textconfig " ) ) {
2002-11-23 16:26:21 +03:00
init_text_config_interface ( ) ; // in textconfig.h
2002-10-25 01:07:56 +04:00
}
# if BX_WITH_WX
else if ( ! strcmp ( ci_name , " wx " ) ) {
PLUG_load_plugin ( wx , PLUGTYPE_CORE ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
}
2002-10-25 01:07:56 +04:00
# endif
else {
BX_PANIC ( ( " unsupported configuration interface '%s' " , ci_name ) ) ;
}
2002-12-17 08:58:45 +03:00
int status = SIM - > configuration_interface ( ci_name , CI_START ) ;
if ( status = = CI_ERR_NO_TEXT_CONSOLE )
BX_PANIC ( ( " Bochs needed the text console, but it was not usable " ) ) ;
2002-10-25 01:07:56 +04:00
// user quit the config interface, so just quit
- use setjmp() and longjmp() to quit the simulation thread cleanly.
I use setjmp() to save the context just before calling
bx_continue_after_config_interface(). Then, in
bx_real_sim_c:quit_sim, I use longjmp() to jump back to that context.
This happens in main.cc and in gui/wxmain.cc (wxWindows only).
I haven't tested with the debugger yet. Possibly with debugger
the quit longjmp() should jump back to the debugger prompt loop
instead of actually quitting the program.
- clean up BX_ASYNC_EVT_LOG_MSG implementation by creating a different,
synchronous event called BX_SYNC_EVT_LOG_ASK. The async event
could be used to simply tell the CI that an event has occurred,
for example if the user wanted to view the events on screen
(not implemented). The sync event is used when you want the user
to respond before the simulation can continue, such as a for the
"panic=ask" behavior.
- in wxmain.cc, move the updates to the Start,Stop,Pause,Resume menu
items into a separate method simStatusChanged(). This makes the code that
does important stuff more readable.
- remove wxMutexGuiEnter()/Leave() from MyFrame::OnSim2CuiEvent().
This method is an event handler called in the gui thread, so it
already has the gui lock. This call caused thread lock on my linux
box.
2002-08-27 22:11:13 +04:00
} else {
// quit via longjmp
}
2002-10-06 23:21:05 +04:00
SIM - > set_quit_context ( NULL ) ;
2002-11-26 21:15:56 +03:00
# if defined(WIN32)
// ask user to press ENTER before exiting, so that they can read messages
// before the console window is closed.
fprintf ( stderr , " \n Bochs is exiting. Press ENTER when you're ready to close this window. \n " ) ;
char buf [ 16 ] ;
fgets ( buf , sizeof ( buf ) , stdin ) ;
# endif
2002-12-16 09:43:02 +03:00
return SIM - > get_exit_code ( ) ;
2002-04-18 04:22:20 +04:00
}
2002-11-26 21:15:56 +03:00
# if defined(__WXMSW__)
2002-11-14 08:12:28 +03:00
// win32 applications get the whole command line in one long string.
// This function is used to split up the string into argc and argv,
// so that the command line can be used on win32 just like on every
// other platform.
2002-11-25 21:17:13 +03:00
//
// I'm sure other people have written this same function, and they may have
// done it better, but I don't know where to find it. -BBD
2002-12-01 17:18:37 +03:00
# ifndef MAX_ARGLEN
# define MAX_ARGLEN 80
# endif
2002-11-14 08:12:28 +03:00
int split_string_into_argv (
char * string ,
int * argc_out ,
char * * argv ,
int max_argv )
{
char * buf0 = new char [ strlen ( string ) + 1 ] ;
strcpy ( buf0 , string ) ;
char * buf = buf0 ;
int in_double_quote = 0 , in_single_quote = 0 ;
for ( int i = 0 ; i < max_argv ; i + + )
argv [ i ] = NULL ;
argv [ 0 ] = new char [ 6 ] ;
strcpy ( argv [ 0 ] , " bochs " ) ;
int argc = 1 ;
argv [ argc ] = new char [ MAX_ARGLEN ] ;
char * outp = & argv [ argc ] [ 0 ] ;
// trim leading and trailing spaces
while ( * buf = = ' ' ) buf + + ;
char * p ;
char * last_nonspace = buf ;
for ( p = buf ; * p ; p + + ) {
if ( * p ! = ' ' ) last_nonspace = p ;
}
2002-11-17 01:50:51 +03:00
if ( last_nonspace ! = buf ) * ( last_nonspace + 1 ) = 0 ;
2002-11-14 08:12:28 +03:00
p = buf ;
2002-11-17 01:50:51 +03:00
bx_bool done = false ;
while ( ! done ) {
2002-11-15 21:53:52 +03:00
//fprintf (stderr, "parsing '%c' with singlequote=%d, dblquote=%d\n", *p, in_single_quote, in_double_quote);
2002-11-14 08:12:28 +03:00
switch ( * p ) {
2002-11-17 01:50:51 +03:00
case ' \0 ' :
done = true ;
// fall through into behavior for space
case ' ' :
if ( in_double_quote | | in_single_quote )
goto do_default ;
* outp = 0 ;
//fprintf (stderr, "completed arg %d = '%s'\n", argc, argv[argc]);
argc + + ;
if ( argc > = max_argv ) {
fprintf ( stderr , " too many arguments. Increase MAX_ARGUMENTS \n " ) ;
return - 1 ;
}
argv [ argc ] = new char [ MAX_ARGLEN ] ;
outp = & argv [ argc ] [ 0 ] ;
while ( * p = = ' ' ) p + + ;
break ;
case ' " ' :
if ( in_single_quote ) goto do_default ;
in_double_quote = ! in_double_quote ;
p + + ;
break ;
case ' \' ' :
if ( in_double_quote ) goto do_default ;
in_single_quote = ! in_single_quote ;
p + + ;
break ;
do_default :
default :
if ( outp - & argv [ argc ] [ 0 ] > = MAX_ARGLEN ) {
//fprintf (stderr, "command line arg %d exceeded max size %d\n", argc, MAX_ARGLEN);
return - 1 ;
}
* ( outp + + ) = * ( p + + ) ;
2002-11-14 08:12:28 +03:00
}
}
if ( in_single_quote ) {
2002-11-17 01:50:51 +03:00
fprintf ( stderr , " end of string with mismatched single quote (') \n " ) ;
return - 1 ;
2002-11-14 08:12:28 +03:00
}
if ( in_double_quote ) {
2002-11-17 01:50:51 +03:00
fprintf ( stderr , " end of string with mismatched double quote ( \" ) \n " ) ;
return - 1 ;
2002-11-14 08:12:28 +03:00
}
2002-11-17 01:50:51 +03:00
* argc_out = argc ;
2002-11-14 08:12:28 +03:00
return 0 ;
}
2002-11-26 21:15:56 +03:00
# endif /* if defined(__WXMSW__) */
2002-11-14 08:12:28 +03:00
2002-11-26 21:15:56 +03:00
# if defined(__WXMSW__) || (BX_WITH_SDL && defined(WIN32))
2002-11-15 21:53:52 +03:00
// The RedirectIOToConsole() function is copied from an article called "Adding
// Console I/O to a Win32 GUI App" in Windows Developer Journal, December 1997.
2002-11-25 21:17:13 +03:00
// It creates a console window.
//
// NOTE: It could probably be written so that it can safely be called for all
// win32 builds. Right now it appears to have absolutely no error checking:
// for example if AllocConsole returns false we should probably return early.
2002-11-15 21:53:52 +03:00
void RedirectIOToConsole ( )
{
int hConHandle ;
long lStdHandle ;
FILE * fp ;
// allocate a console for this app
AllocConsole ( ) ;
// redirect unbuffered STDOUT to the console
lStdHandle = ( long ) GetStdHandle ( STD_OUTPUT_HANDLE ) ;
hConHandle = _open_osfhandle ( lStdHandle , _O_TEXT ) ;
fp = _fdopen ( hConHandle , " w " ) ;
* stdout = * fp ;
setvbuf ( stdout , NULL , _IONBF , 0 ) ;
// redirect unbuffered STDIN to the console
lStdHandle = ( long ) GetStdHandle ( STD_INPUT_HANDLE ) ;
hConHandle = _open_osfhandle ( lStdHandle , _O_TEXT ) ;
fp = _fdopen ( hConHandle , " r " ) ;
* stdin = * fp ;
setvbuf ( stdin , NULL , _IONBF , 0 ) ;
// redirect unbuffered STDERR to the console
lStdHandle = ( long ) GetStdHandle ( STD_ERROR_HANDLE ) ;
hConHandle = _open_osfhandle ( lStdHandle , _O_TEXT ) ;
fp = _fdopen ( hConHandle , " w " ) ;
* stderr = * fp ;
setvbuf ( stderr , NULL , _IONBF , 0 ) ;
}
2002-11-26 21:15:56 +03:00
# endif /* if defined(__WXMSW__) || (BX_WITH_SDL && defined(WIN32)) */
2002-11-14 08:12:28 +03:00
2002-11-26 21:15:56 +03:00
# if defined(__WXMSW__)
2002-11-25 21:17:13 +03:00
// only used for wxWindows/win32.
// This works ok in Cygwin with a standard wxWindows compile. In
// VC++ wxWindows must be compiled with -DNOMAIN=1.
2002-11-17 01:50:51 +03:00
int WINAPI WinMain (
2002-11-01 18:19:48 +03:00
HINSTANCE hInstance ,
HINSTANCE hPrevInstance ,
LPSTR m_lpCmdLine , int nCmdShow )
{
bx_startup_flags . hInstance = hInstance ;
bx_startup_flags . hPrevInstance = hPrevInstance ;
bx_startup_flags . m_lpCmdLine = m_lpCmdLine ;
bx_startup_flags . nCmdShow = nCmdShow ;
2002-11-15 21:53:52 +03:00
RedirectIOToConsole ( ) ;
2002-11-14 08:12:28 +03:00
int max_argv = 20 ;
bx_startup_flags . argv = ( char * * ) malloc ( max_argv * sizeof ( char * ) ) ;
split_string_into_argv ( m_lpCmdLine , & bx_startup_flags . argc , bx_startup_flags . argv , max_argv ) ;
2002-11-26 21:15:56 +03:00
return bxmain ( ) ;
}
# endif
# if !defined(__WXMSW__)
// normal main function, presently in for all cases except for
// wxWindows under win32.
int main ( int argc , char * argv [ ] )
{
bx_startup_flags . argc = argc ;
bx_startup_flags . argv = argv ;
# if BX_WITH_SDL && defined(WIN32)
// if SDL/win32, try to create a console window.
RedirectIOToConsole ( ) ;
# endif
return bxmain ( ) ;
2002-11-01 18:19:48 +03:00
}
# endif
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
void
print_usage ( )
2001-04-10 05:04:59 +04:00
{
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
fprintf ( stderr ,
" Usage: bochs [flags] [bochsrc options] \n \n "
2002-11-24 16:41:07 +03:00
" -n no configuration file \n "
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
" -f configfile specify configuration file \n "
2002-11-15 17:47:58 +03:00
" -q quick start (skip configuration interface) \n "
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
" --help display this help and exit \n \n "
" For information on Bochs configuration file arguments, see the \n "
# if (!defined(WIN32)) && !BX_WITH_MACOS
" bochsrc section in the user documentation or the man page of bochsrc. \n " ) ;
# else
" bochsrc section in the user documentation. \n " ) ;
2002-08-25 19:51:46 +04:00
# endif
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
}
2002-08-25 12:31:16 +04:00
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
int
bx_init_main ( int argc , char * argv [ ] )
{
2001-06-10 00:01:12 +04:00
// To deal with initialization order problems inherent in C++, use the macros
// SAFE_GET_IOFUNC and SAFE_GET_GENLOG to retrieve "io" and "genlog" in all
// constructors or functions called by constructors. The macros test for
// NULL and create the object if necessary, then return it. Ensure that io
// and genlog get created, by making one reference to each macro right here.
2002-08-31 01:41:29 +04:00
// All other code can reference io and genlog directly. Because these
// objects are required for logging, and logging is so fundamental to
// knowing what the program is doing, they are never free()d.
SAFE_GET_IOFUNC ( ) ; // never freed
SAFE_GET_GENLOG ( ) ; // never freed
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
// initalization must be done early because some destructors expect
// the bx_options to exist by the time they are called.
2001-06-10 00:01:12 +04:00
bx_init_bx_dbg ( ) ;
2002-04-18 04:22:20 +04:00
bx_init_options ( ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
2002-11-19 11:54:32 +03:00
bx_print_header ( ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
2002-11-09 17:12:10 +03:00
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_RUN_START ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
// interpret the args that start with -, like -q, -f, etc.
2002-11-24 16:41:07 +03:00
int arg = 1 , load_rcfile = 1 ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
while ( arg < argc ) {
// parse next arg
if ( ! strcmp ( " --help " , argv [ arg ] ) | | ! strncmp ( " -h " , argv [ arg ] , 2 ) ) {
print_usage ( ) ;
SIM - > quit_sim ( 0 ) ;
2002-08-25 19:51:46 +04:00
}
2002-11-24 16:41:07 +03:00
else if ( ! strcmp ( " -n " , argv [ arg ] ) ) {
load_rcfile = 0 ;
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
else if ( ! strcmp ( " -q " , argv [ arg ] ) ) {
2002-11-09 17:12:10 +03:00
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_QUICK_START ) ;
2002-08-25 19:51:46 +04:00
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
else if ( ! strcmp ( " -f " , argv [ arg ] ) ) {
if ( + + arg > = argc ) BX_PANIC ( ( " -f must be followed by a filename " ) ) ;
else bochsrc_filename = argv [ arg ] ;
2002-09-25 23:05:01 +04:00
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
else if ( ! strcmp ( " -qf " , argv [ arg ] ) ) {
2002-11-09 17:12:10 +03:00
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_QUICK_START ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
if ( + + arg > = argc ) BX_PANIC ( ( " -qf must be followed by a filename " ) ) ;
else bochsrc_filename = argv [ arg ] ;
2002-08-18 20:59:26 +04:00
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
# if BX_WITH_CARBON
else if ( ! strncmp ( " -psn " , argv [ arg ] , 4 ) ) {
// "-psn" is passed if we are launched by double-clicking
// ugly hack. I don't know how to open a window to print messages in,
// so put them in /tmp/early-bochs-out.txt. Sorry. -bbd
io - > init_log ( " /tmp/early-bochs-out.txt " ) ;
BX_INFO ( ( " I was launched by double clicking. Fixing home directory. " ) ) ;
arg = argc ; // ignore all other args.
setupWorkingDirectory ( argv [ 0 ] ) ;
// there is no stdin/stdout so disable the text-based config interface.
2002-11-09 17:12:10 +03:00
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_QUICK_START ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
char cwd [ MAXPATHLEN ] ;
getwd ( cwd ) ;
BX_INFO ( ( " Now my working directory is %s " , cwd ) ) ;
// if it was started from command line, there could be some args still.
for ( int a = 0 ; a < argc ; a + + ) {
BX_INFO ( ( " argument %d is %s " , a , argv [ a ] ) ) ;
}
2002-07-14 17:22:38 +04:00
}
2001-06-10 00:01:12 +04:00
# endif
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
else if ( argv [ arg ] [ 0 ] = = ' - ' ) {
print_usage ( ) ;
BX_PANIC ( ( " command line arg '%s' was not understood " , argv [ arg ] ) ) ;
}
else {
// the arg did not start with -, so stop interpreting flags
break ;
2001-06-10 00:01:12 +04:00
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
arg + + ;
2001-06-10 00:01:12 +04:00
}
2002-12-17 23:58:18 +03:00
# if BX_WITH_CARBON
if ( ! getenv ( " BXSHARE " ) )
{
CFBundleRef mainBundle ;
CFURLRef bxshareDir ;
char bxshareDirPath [ MAXPATHLEN ] ;
BX_INFO ( ( " fixing default bxshare location ... " ) ) ;
// set bxshare to the directory that contains our application
mainBundle = CFBundleGetMainBundle ( ) ;
BX_ASSERT ( mainBundle ! = NULL ) ;
bxshareDir = CFBundleCopyBundleURL ( mainBundle ) ;
BX_ASSERT ( bxshareDir ! = NULL ) ;
// translate this to a unix style full path
if ( ! CFURLGetFileSystemRepresentation ( bxshareDir , true , ( UInt8 * ) bxshareDirPath , MAXPATHLEN ) )
{
BX_PANIC ( ( " Unable to work out bxshare path! (Most likely path too long!) " ) ) ;
return - 1 ;
}
char * c ;
c = ( char * ) bxshareDirPath ;
while ( * c ! = ' \0 ' ) /* go to end */
c + + ;
while ( * c ! = ' / ' ) /* back up to parent */
c - - ;
* c = ' \0 ' ; /* cut off last part (binary name) */
setenv ( " BXSHARE " , bxshareDirPath , 1 ) ;
BX_INFO ( ( " now my BXSHARE is %s " , getenv ( " BXSHARE " ) ) ) ;
CFRelease ( bxshareDir ) ;
}
# endif
2002-11-18 05:32:53 +03:00
# if BX_PLUGINS
// set a default plugin path, in case the user did not specify one
# if BX_WITH_CARBON
2002-11-01 20:53:52 +03:00
// if there is no stdin, then we must create our own LTDL_LIBRARY_PATH.
// also if there is no LTDL_LIBRARY_PATH, but we have a bundle since we're here
// This is here so that it is available whenever --with-carbon is defined but
// the above code might be skipped, as in --with-sdl --with-carbon
if ( ! isatty ( STDIN_FILENO ) | | ! getenv ( " LTDL_LIBRARY_PATH " ) )
{
CFBundleRef mainBundle ;
CFURLRef libDir ;
2002-11-23 15:35:42 +03:00
char libDirPath [ MAXPATHLEN ] ;
2002-11-01 20:53:52 +03:00
if ( ! isatty ( STDIN_FILENO ) )
{
// there is no stdin/stdout so disable the text-based config interface.
2002-11-09 17:12:10 +03:00
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_QUICK_START ) ;
2002-11-01 20:53:52 +03:00
}
BX_INFO ( ( " fixing default lib location ... " ) ) ;
// locate the lib directory within the application bundle.
// our libs have been placed in bochs.app/Contents/(current platform aka MacOS)/lib
// This isn't quite right, but they are platform specific and we haven't put
// our plugins into true frameworks and bundles either
mainBundle = CFBundleGetMainBundle ( ) ;
BX_ASSERT ( mainBundle ! = NULL ) ;
libDir = CFBundleCopyAuxiliaryExecutableURL ( mainBundle , CFSTR ( " lib " ) ) ;
BX_ASSERT ( libDir ! = NULL ) ;
// translate this to a unix style full path
2002-11-23 15:35:42 +03:00
if ( ! CFURLGetFileSystemRepresentation ( libDir , true , ( UInt8 * ) libDirPath , MAXPATHLEN ) )
2002-11-01 20:53:52 +03:00
{
BX_PANIC ( ( " Unable to work out ltdl library path within bochs bundle! (Most likely path too long!) " ) ) ;
return - 1 ;
}
setenv ( " LTDL_LIBRARY_PATH " , libDirPath , 1 ) ;
2002-11-23 15:35:42 +03:00
BX_INFO ( ( " now my LTDL_LIBRARY_PATH is %s " , getenv ( " LTDL_LIBRARY_PATH " ) ) ) ;
2002-11-01 20:53:52 +03:00
CFRelease ( libDir ) ;
}
2002-11-18 05:32:53 +03:00
# elif BX_HAVE_GETENV && BX_HAVE_SETENV
if ( getenv ( " LTDL_LIBRARY_PATH " ) ! = NULL ) {
BX_INFO ( ( " LTDL_LIBRARY_PATH is set to '%s' " , getenv ( " LTDL_LIBRARY_PATH " ) ) ) ;
} else {
BX_INFO ( ( " LTDL_LIBRARY_PATH not set. using compile time default '%s' " ,
2003-02-07 02:16:56 +03:00
BX_PLUGIN_PATH ) ) ;
2002-11-18 05:32:53 +03:00
setenv ( " LTDL_LIBRARY_PATH " , BX_PLUGIN_PATH , 1 ) ;
}
2002-12-15 01:18:00 +03:00
if ( getenv ( " BXSHARE " ) ! = NULL ) {
BX_INFO ( ( " BXSHARE is set to '%s' " , getenv ( " BXSHARE " ) ) ) ;
2002-11-25 21:00:05 +03:00
} else {
2002-12-15 01:18:00 +03:00
BX_INFO ( ( " BXSHARE not set. using compile time default '%s' " ,
2003-02-07 02:16:56 +03:00
BX_SHARE_PATH ) ) ;
2002-12-15 01:18:00 +03:00
setenv ( " BXSHARE " , BX_SHARE_PATH , 1 ) ;
2002-11-25 21:00:05 +03:00
}
2002-11-18 05:32:53 +03:00
# else
// we don't have getenv or setenv. Do nothing.
2002-11-01 20:53:52 +03:00
# endif
2002-11-18 05:32:53 +03:00
# endif /* if BX_PLUGINS */
2002-11-09 17:12:10 +03:00
# if !BX_USE_CONFIG_INTERFACE
// this allows people to get quick start behavior by default
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_QUICK_START ) ;
# endif
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
int norcfile = 1 ;
2002-11-24 16:41:07 +03:00
if ( load_rcfile ) {
/* parse configuration file and command line arguments */
if ( bochsrc_filename = = NULL ) bochsrc_filename = bx_find_bochsrc ( ) ;
if ( bochsrc_filename )
norcfile = bx_read_configuration ( bochsrc_filename ) ;
}
2002-11-09 17:12:10 +03:00
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
if ( norcfile ) {
// No configuration was loaded, so the current settings are unusable.
// Switch off quick start so that we will drop into the configuration
// interface.
2002-11-15 17:47:58 +03:00
if ( SIM - > get_param_enum ( BXP_BOCHS_START ) - > get ( ) = = BX_QUICK_START ) {
2002-12-17 08:58:45 +03:00
if ( ! SIM - > test_for_text_console ( ) )
BX_PANIC ( ( " Unable to start Bochs without a bochsrc.txt and without a text console " ) ) ;
else
BX_ERROR ( ( " Switching off quick start, because no configuration file was found. " ) ) ;
2002-11-15 17:47:58 +03:00
}
2002-11-09 17:12:10 +03:00
SIM - > get_param_enum ( BXP_BOCHS_START ) - > set ( BX_LOAD_START ) ;
2001-10-07 02:31:31 +04:00
}
2002-11-09 17:12:10 +03:00
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
// parse the rest of the command line. This is done after reading the
// configuration file so that the command line arguments can override
// the settings from the file.
if ( bx_parse_cmdline ( arg , argc , argv ) ) {
BX_PANIC ( ( " There were errors while parsing the command line " ) ) ;
return - 1 ;
2001-10-07 02:31:31 +04:00
}
2002-10-25 01:07:56 +04:00
// initialize plugin system. This must happen before we attempt to
// load any modules.
plugin_startup ( ) ;
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
return 0 ;
2002-04-18 04:22:20 +04:00
}
2002-10-25 15:44:41 +04:00
bx_bool load_and_init_display_lib ( ) {
2002-10-25 01:07:56 +04:00
if ( bx_gui ! = NULL ) {
// bx_gui has already been filled in. This happens when you start
// the simulation for the second time.
// Also, if you load wxWindows as the configuration interface. Its
// plugin_init will install wxWindows as the bx_gui.
return true ;
}
BX_ASSERT ( bx_gui = = NULL ) ;
bx_param_enum_c * gui_param = SIM - > get_param_enum ( BXP_SEL_DISPLAY_LIBRARY ) ;
char * gui_name = gui_param - > get_choice ( gui_param - > get ( ) ) ;
if ( ! strcmp ( gui_name , " wx " ) ) {
// they must not have used wx as the configuration interface, or bx_gui
// would already be initialized. Sorry, it doesn't work that way.
2002-10-26 17:22:47 +04:00
BX_ERROR ( ( " wxWindows was not used as the configuration interface, so it cannot be used as the display library " ) ) ;
2002-10-25 01:07:56 +04:00
// choose another, hopefully different!
gui_param - > set ( 0 ) ;
gui_name = gui_param - > get_choice ( gui_param - > get ( ) ) ;
if ( ! strcmp ( gui_name , " wx " ) ) {
2002-10-26 17:22:47 +04:00
BX_PANIC ( ( " no alternative display libraries are available " ) ) ;
2002-10-25 01:07:56 +04:00
return false ;
}
2002-10-26 17:22:47 +04:00
BX_ERROR ( ( " changing display library to '%s' instead " , gui_name ) ) ;
2002-10-25 01:07:56 +04:00
}
# if BX_WITH_AMIGAOS
if ( ! strcmp ( gui_name , " amigaos " ) )
PLUG_load_plugin ( amigaos , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_BEOS
if ( ! strcmp ( gui_name , " beos " ) )
PLUG_load_plugin ( beos , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_CARBON
if ( ! strcmp ( gui_name , " carbon " ) )
PLUG_load_plugin ( carbon , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_MACOS
2002-12-12 18:29:45 +03:00
if ( ! strcmp ( gui_name , " macos " ) )
2002-10-25 01:07:56 +04:00
PLUG_load_plugin ( macintosh , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_NOGUI
if ( ! strcmp ( gui_name , " nogui " ) )
PLUG_load_plugin ( nogui , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_RFB
if ( ! strcmp ( gui_name , " rfb " ) )
PLUG_load_plugin ( rfb , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_SDL
if ( ! strcmp ( gui_name , " sdl " ) )
PLUG_load_plugin ( sdl , PLUGTYPE_OPTIONAL ) ;
# endif
2002-11-21 22:26:07 +03:00
# if BX_WITH_SVGA
if ( ! strcmp ( gui_name , " svga " ) )
PLUG_load_plugin ( svga , PLUGTYPE_OPTIONAL ) ;
# endif
2002-10-25 01:07:56 +04:00
# if BX_WITH_TERM
if ( ! strcmp ( gui_name , " term " ) )
PLUG_load_plugin ( term , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_WIN32
if ( ! strcmp ( gui_name , " win32 " ) )
PLUG_load_plugin ( win32 , PLUGTYPE_OPTIONAL ) ;
# endif
# if BX_WITH_X11
if ( ! strcmp ( gui_name , " x " ) )
PLUG_load_plugin ( x , PLUGTYPE_OPTIONAL ) ;
# endif
2002-11-11 20:09:57 +03:00
# if BX_GUI_SIGHANDLER
// set the flag for guis requiring a GUI sighandler.
// useful when guis are compiled as plugins
// only term for now
if ( ! strcmp ( gui_name , " term " ) ) {
bx_gui_sighandler = 1 ;
}
# endif
2002-10-25 01:07:56 +04:00
BX_ASSERT ( bx_gui ! = NULL ) ;
return true ;
}
2002-04-18 04:22:20 +04:00
int
2002-10-25 01:07:56 +04:00
bx_begin_simulation ( int argc , char * argv [ ] )
2002-04-18 04:22:20 +04:00
{
2002-10-25 01:07:56 +04:00
// deal with gui selection
if ( ! load_and_init_display_lib ( ) ) {
BX_PANIC ( ( " no gui module was loaded " ) ) ;
return 0 ;
}
2002-10-03 09:29:15 +04:00
# if BX_GDBSTUB
2002-10-25 01:07:56 +04:00
// If using gdbstub, it will take control and call
// bx_init_hardware() and cpu_loop()
2002-10-03 09:29:15 +04:00
bx_gdbstub_init ( argc , argv ) ;
# elif BX_DEBUGGER
2001-04-10 05:04:59 +04:00
// If using the debugger, it will take control and call
2001-06-10 00:01:12 +04:00
// bx_init_hardware() and cpu_loop()
2001-04-10 05:04:59 +04:00
bx_dbg_main ( argc , argv ) ;
# else
2002-10-25 01:07:56 +04:00
# if BX_PLUGINS
2002-10-25 16:36:44 +04:00
# ifdef __GNUC__
2002-10-25 01:07:56 +04:00
# warning bx_load_plugins doesnt do much anymore and should maybe be removed
2002-10-25 16:36:44 +04:00
# endif
2002-10-25 01:07:56 +04:00
bx_load_plugins ( ) ;
# endif
2001-06-10 00:01:12 +04:00
bx_init_hardware ( ) ;
2001-04-10 05:04:59 +04:00
2001-06-20 18:01:39 +04:00
if ( bx_options . load32bitOSImage . OwhichOS - > get ( ) ) {
2001-04-10 05:04:59 +04:00
void bx_load32bitOSimagehack ( void ) ;
bx_load32bitOSimagehack ( ) ;
}
2001-06-10 00:01:12 +04:00
SIM - > set_init_done ( 1 ) ;
2002-11-20 22:34:51 +03:00
// update headerbar buttons since drive status can change during init
bx_gui - > update_drive_status_buttons ( ) ;
2001-06-23 07:23:19 +04:00
// The set handler for mouse_enabled does not actually update the gui
// until init_done is set. This forces the set handler to be called,
// which sets up the mouse enabled GUI-specific stuff correctly.
// Not a great solution but it works. BBD
bx_options . Omouse_enabled - > set ( bx_options . Omouse_enabled - > get ( ) ) ;
2001-06-05 19:56:19 +04:00
if ( BX_SMP_PROCESSORS = = 1 ) {
// only one processor, run as fast as possible by not messing with
// quantums and loops.
BX_CPU ( 0 ) - > cpu_loop ( 1 ) ;
2002-11-01 19:30:53 +03:00
// for one processor, the only reason for cpu_loop to return is
// that kill_bochs_request was set by the GUI interface.
2001-06-05 19:56:19 +04:00
} else {
2001-06-13 17:36:12 +04:00
// SMP simulation: do a few instructions on each processor, then switch
// to another. Increasing quantum speeds up overall performance, but
// reduces granularity of synchronization between processors.
2001-06-05 19:56:19 +04:00
int processor = 0 ;
int quantum = 5 ;
while ( 1 ) {
// do some instructions in each processor
BX_CPU ( processor ) - > cpu_loop ( quantum ) ;
processor = ( processor + 1 ) % BX_SMP_PROCESSORS ;
2002-11-01 19:30:53 +03:00
if ( BX_CPU ( 0 ) - > kill_bochs_request )
break ;
2001-06-05 19:56:19 +04:00
if ( processor = = 0 )
2002-11-01 19:30:53 +03:00
BX_TICKN ( quantum ) ;
2001-06-05 19:56:19 +04:00
}
2001-05-23 12:16:07 +04:00
}
2001-04-10 05:04:59 +04:00
# endif
2002-04-18 04:22:20 +04:00
BX_INFO ( ( " cpu loop quit, shutting down simulator " ) ) ;
bx_atexit ( ) ;
2001-04-10 05:04:59 +04:00
return ( 0 ) ;
}
2002-04-18 04:22:20 +04:00
2001-06-10 00:01:12 +04:00
int
2001-06-13 17:36:12 +04:00
bx_read_configuration ( char * rcfile )
2001-04-10 05:04:59 +04:00
{
2001-06-10 00:01:12 +04:00
// parse rcfile first, then parse arguments in order.
BX_INFO ( ( " reading configuration from %s " , rcfile ) ) ;
if ( parse_bochsrc ( rcfile ) < 0 ) {
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
BX_PANIC ( ( " reading from %s failed " , rcfile ) ) ;
2001-06-10 00:01:12 +04:00
return - 1 ;
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
// update log actions
for ( int level = 0 ; level < N_LOGLEV ; level + + ) {
int action = SIM - > get_default_log_action ( level ) ;
io - > set_log_action ( level , action ) ;
2001-12-29 14:40:37 +03:00
}
2001-06-13 17:36:12 +04:00
return 0 ;
}
2001-04-10 05:04:59 +04:00
2001-10-07 02:31:31 +04:00
int bx_parse_cmdline ( int arg , int argc , char * argv [ ] )
2001-06-13 17:36:12 +04:00
{
2001-10-07 02:31:31 +04:00
//if (arg < argc) BX_INFO (("parsing command line arguments"));
2001-04-10 05:04:59 +04:00
2001-10-07 02:31:31 +04:00
while ( arg < argc ) {
BX_INFO ( ( " parsing arg %d, %s " , arg , argv [ arg ] ) ) ;
parse_line_unformatted ( " cmdline args " , argv [ arg ] ) ;
arg + + ;
2001-06-10 00:01:12 +04:00
}
- clean up the command line argument parsing. Before, we had two slightly
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
2002-10-14 17:37:20 +04:00
// update log actions
for ( int level = 0 ; level < N_LOGLEV ; level + + ) {
int action = SIM - > get_default_log_action ( level ) ;
io - > set_log_action ( level , action ) ;
}
2001-06-10 00:01:12 +04:00
return 0 ;
}
int
bx_init_hardware ( )
{
// all configuration has been read, now initialize everything.
2001-04-10 05:04:59 +04:00
2002-11-09 17:12:10 +03:00
if ( SIM - > get_param_enum ( BXP_BOCHS_START ) - > get ( ) = = BX_QUICK_START ) {
2002-01-02 12:57:58 +03:00
for ( int level = 0 ; level < N_LOGLEV ; level + + ) {
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
int action = SIM - > get_default_log_action ( level ) ;
2002-09-07 13:57:54 +04:00
# if !BX_USE_CONFIG_INTERFACE
2002-01-02 12:57:58 +03:00
if ( action = = ACT_ASK ) action = ACT_FATAL ;
2002-09-07 13:57:54 +04:00
# endif
2002-01-02 12:57:58 +03:00
io - > set_log_action ( level , action ) ;
}
2001-06-22 01:24:05 +04:00
}
2001-05-23 06:37:52 +04:00
2001-06-20 18:01:39 +04:00
bx_pc_system . init_ips ( bx_options . Oips - > get ( ) ) ;
2001-04-10 05:04:59 +04:00
2001-06-20 18:01:39 +04:00
if ( bx_options . log . Ofilename - > getptr ( ) [ 0 ] ! = ' - ' ) {
BX_INFO ( ( " using log file %s " , bx_options . log . Ofilename - > getptr ( ) ) ) ;
io - > init_log ( bx_options . log . Ofilename - > getptr ( ) ) ;
2001-05-22 23:07:53 +04:00
}
2001-04-10 05:04:59 +04:00
2002-06-28 18:03:47 +04:00
io - > set_log_prefix ( bx_options . log . Oprefix - > getptr ( ) ) ;
2003-02-05 21:19:03 +03:00
// Output to the log file the cpu settings
// This will by handy for bug reports
BX_INFO ( ( " Bochs x86 Emulator %s " , VER_STRING ) ) ;
BX_INFO ( ( " %s " , REL_STRING ) ) ;
BX_INFO ( ( " System configuration " ) ) ;
BX_INFO ( ( " processors: %d " , BX_SMP_PROCESSORS ) ) ;
BX_INFO ( ( " A20 line support: %s " , BX_SUPPORT_A20 ? " yes " : " no " ) ) ;
BX_INFO ( ( " APIC support: %s " , BX_SUPPORT_APIC ? " yes " : " no " ) ) ;
BX_INFO ( ( " CPU configuration " ) ) ;
BX_INFO ( ( " level: %d " , BX_CPU_LEVEL ) ) ;
BX_INFO ( ( " fpu support: %s " , BX_SUPPORT_FPU ? " yes " : " no " ) ) ;
BX_INFO ( ( " paging support: %s, tlb enabled: %s " , BX_SUPPORT_PAGING ? " yes " : " no " , BX_USE_TLB ? " yes " : " no " ) ) ;
BX_INFO ( ( " mmx support: %s " , BX_SUPPORT_MMX ? " yes " : " no " ) ) ;
BX_INFO ( ( " sse support: %s " , BX_SUPPORT_SSE = = 2 ? " 2 " : BX_SUPPORT_SSE = = 1 ? " 1 " : " no " ) ) ;
BX_INFO ( ( " v8086 mode support: %s " , BX_SUPPORT_V8086_MODE ? " yes " : " no " ) ) ;
BX_INFO ( ( " PAE support: %s " , BX_SupportPAE ? " yes " : " no " ) ) ;
BX_INFO ( ( " PGE support: %s " , BX_SupportGlobalPages ? " yes " : " no " ) ) ;
BX_INFO ( ( " PSE support: %s " , BX_SUPPORT_4MEG_PAGES ? " yes " : " no " ) ) ;
BX_INFO ( ( " x86-64 support: %s " , BX_SUPPORT_X86_64 ? " yes " : " no " ) ) ;
BX_INFO ( ( " SEP support: %s " , BX_SUPPORT_SEP ? " yes " : " no " ) ) ;
BX_INFO ( ( " Optimization configuration " ) ) ;
BX_INFO ( ( " Guest2HostTLB support: %s " , BX_SupportGuest2HostTLB ? " yes " : " no " ) ) ;
BX_INFO ( ( " RepeatSpeedups support: %s " , BX_SupportRepeatSpeedups ? " yes " : " no " ) ) ;
BX_INFO ( ( " Icache support: %s " , BX_SupportICache ? " yes " : " no " ) ) ;
BX_INFO ( ( " Host Asm support: %s " , BX_SupportHostAsms ? " yes " : " no " ) ) ;
2001-05-23 12:16:07 +04:00
// set up memory and CPU objects
2001-06-12 17:07:43 +04:00
# if BX_SUPPORT_APIC
2002-10-01 02:18:53 +04:00
bx_generic_apic_c : : reset_all_ids ( ) ;
2001-05-23 12:16:07 +04:00
# endif
2001-06-05 21:35:08 +04:00
2002-11-09 17:12:10 +03:00
// Check if there is a romimage
if ( strcmp ( bx_options . rom . Opath - > getptr ( ) , " " ) = = 0 ) {
BX_ERROR ( ( " No romimage to load. Is your bochsrc file loaded/valid ? " ) ) ;
}
2001-06-05 21:35:08 +04:00
# if BX_SMP_PROCESSORS==1
2001-06-20 18:01:39 +04:00
BX_MEM ( 0 ) - > init_memory ( bx_options . memory . Osize - > get ( ) * 1024 * 1024 ) ;
2002-07-24 21:52:34 +04:00
// First load the optional ROM images
2002-12-12 18:29:45 +03:00
if ( strcmp ( bx_options . optrom [ 0 ] . Opath - > getptr ( ) , " " ) ! = 0 )
2002-08-23 02:38:40 +04:00
BX_MEM ( 0 ) - > load_ROM ( bx_options . optrom [ 0 ] . Opath - > getptr ( ) , bx_options . optrom [ 0 ] . Oaddress - > get ( ) ) ;
2002-12-12 18:29:45 +03:00
if ( strcmp ( bx_options . optrom [ 1 ] . Opath - > getptr ( ) , " " ) ! = 0 )
2002-08-23 02:38:40 +04:00
BX_MEM ( 0 ) - > load_ROM ( bx_options . optrom [ 1 ] . Opath - > getptr ( ) , bx_options . optrom [ 1 ] . Oaddress - > get ( ) ) ;
2002-12-12 18:29:45 +03:00
if ( strcmp ( bx_options . optrom [ 2 ] . Opath - > getptr ( ) , " " ) ! = 0 )
2002-08-23 02:38:40 +04:00
BX_MEM ( 0 ) - > load_ROM ( bx_options . optrom [ 2 ] . Opath - > getptr ( ) , bx_options . optrom [ 2 ] . Oaddress - > get ( ) ) ;
2002-12-12 18:29:45 +03:00
if ( strcmp ( bx_options . optrom [ 3 ] . Opath - > getptr ( ) , " " ) ! = 0 )
2002-08-23 02:38:40 +04:00
BX_MEM ( 0 ) - > load_ROM ( bx_options . optrom [ 3 ] . Opath - > getptr ( ) , bx_options . optrom [ 3 ] . Oaddress - > get ( ) ) ;
2002-07-24 21:52:34 +04:00
// Then Load the BIOS and VGABIOS
2001-06-20 18:01:39 +04:00
BX_MEM ( 0 ) - > load_ROM ( bx_options . rom . Opath - > getptr ( ) , bx_options . rom . Oaddress - > get ( ) ) ;
BX_MEM ( 0 ) - > load_ROM ( bx_options . vgarom . Opath - > getptr ( ) , 0xc0000 ) ;
2002-07-24 21:52:34 +04:00
2001-06-05 21:35:08 +04:00
BX_CPU ( 0 ) - > init ( BX_MEM ( 0 ) ) ;
2003-02-13 18:51:22 +03:00
BX_CPU ( 0 ) - > set_cpu_id ( 0 ) ;
2002-03-27 19:05:13 +03:00
# if BX_SUPPORT_APIC
2002-03-30 02:37:07 +03:00
BX_CPU ( 0 ) - > local_apic . set_id ( 0 ) ;
2002-03-27 19:05:13 +03:00
# endif
2003-02-13 18:51:22 +03:00
BX_INSTR_INIT ( 0 ) ;
2001-06-05 21:35:08 +04:00
BX_CPU ( 0 ) - > reset ( BX_RESET_HARDWARE ) ;
# else
// SMP initialization
2003-01-29 18:01:16 +03:00
bx_mem_array [ 0 ] = new BX_MEM_C ( bx_options . memory . Osize - > get ( ) * 1024 * 1024 ) ;
2001-06-20 18:01:39 +04:00
bx_mem_array [ 0 ] - > init_memory ( bx_options . memory . Osize - > get ( ) * 1024 * 1024 ) ;
2002-07-24 21:52:34 +04:00
// First load the optional ROM images
2002-08-23 02:38:40 +04:00
if ( bx_options . optrom [ 0 ] . Opath - > getptr ( ) > 0 )
bx_mem_array [ 0 ] - > load_ROM ( bx_options . optrom [ 0 ] . Opath - > getptr ( ) , bx_options . optrom [ 0 ] . Oaddress - > get ( ) ) ;
if ( bx_options . optrom [ 1 ] . Opath - > getptr ( ) > 0 )
bx_mem_array [ 0 ] - > load_ROM ( bx_options . optrom [ 1 ] . Opath - > getptr ( ) , bx_options . optrom [ 1 ] . Oaddress - > get ( ) ) ;
if ( bx_options . optrom [ 2 ] . Opath - > getptr ( ) > 0 )
BX_MEM ( 0 ) - > load_ROM ( bx_options . optrom [ 2 ] . Opath - > getptr ( ) , bx_options . optrom [ 2 ] . Oaddress - > get ( ) ) ;
bx_mem_array [ 0 ] - > load_ROM ( bx_options . optrom [ 2 ] . Opath - > getptr ( ) , bx_options . optrom [ 2 ] . Oaddress - > get ( ) ) ;
if ( bx_options . optrom [ 3 ] . Opath - > getptr ( ) > 0 )
bx_mem_array [ 0 ] - > load_ROM ( bx_options . optrom [ 3 ] . Opath - > getptr ( ) , bx_options . optrom [ 3 ] . Oaddress - > get ( ) ) ;
2002-07-24 21:52:34 +04:00
// Then Load the BIOS and VGABIOS
2001-11-06 18:41:34 +03:00
bx_mem_array [ 0 ] - > load_ROM ( bx_options . rom . Opath - > getptr ( ) , bx_options . rom . Oaddress - > get ( ) ) ;
bx_mem_array [ 0 ] - > load_ROM ( bx_options . vgarom . Opath - > getptr ( ) , 0xc0000 ) ;
2002-07-24 21:52:34 +04:00
2001-05-23 12:16:07 +04:00
for ( int i = 0 ; i < BX_SMP_PROCESSORS ; i + + ) {
2003-02-13 18:51:22 +03:00
BX_CPU ( i ) = new BX_CPU_C ;
2001-05-23 12:16:07 +04:00
BX_CPU ( i ) - > init ( bx_mem_array [ 0 ] ) ;
// assign apic ID from the index of this loop
2001-06-12 17:07:43 +04:00
// if !BX_SUPPORT_APIC, this will not compile.
2003-02-13 18:51:22 +03:00
BX_CPU ( i ) - > set_cpu_id ( i ) ;
2001-05-23 12:16:07 +04:00
BX_CPU ( i ) - > local_apic . set_id ( i ) ;
2002-09-29 20:59:28 +04:00
BX_INSTR_INIT ( i ) ;
2001-05-23 12:16:07 +04:00
BX_CPU ( i ) - > reset ( BX_RESET_HARDWARE ) ;
}
2001-06-05 21:35:08 +04:00
# endif
2001-04-10 05:04:59 +04:00
# if BX_DEBUGGER == 0
2002-10-25 01:07:56 +04:00
DEV_init_devices ( ) ;
DEV_reset_devices ( BX_RESET_HARDWARE ) ;
bx_gui - > init_signal_handlers ( ) ;
2001-04-10 05:04:59 +04:00
bx_pc_system . start_timers ( ) ;
# endif
2001-06-10 00:01:12 +04:00
BX_DEBUG ( ( " bx_init_hardware is setting signal handlers " ) ) ;
2001-04-10 05:04:59 +04:00
// if not using debugger, then we can take control of SIGINT.
2002-09-05 19:51:03 +04:00
# if !BX_DEBUGGER
2001-04-10 05:04:59 +04:00
signal ( SIGINT , bx_signal_handler ) ;
# endif
# if BX_SHOW_IPS
# ifndef __MINGW32__
signal ( SIGALRM , bx_signal_handler ) ;
# endif
alarm ( 1 ) ;
# endif
return ( 0 ) ;
}
void
2001-06-10 00:01:12 +04:00
bx_init_bx_dbg ( void )
2001-04-10 05:04:59 +04:00
{
bx_dbg . floppy = 0 ;
bx_dbg . keyboard = 0 ;
bx_dbg . video = 0 ;
bx_dbg . disk = 0 ;
bx_dbg . pit = 0 ;
bx_dbg . pic = 0 ;
bx_dbg . bios = 0 ;
bx_dbg . cmos = 0 ;
bx_dbg . a20 = 0 ;
bx_dbg . interrupts = 0 ;
bx_dbg . exceptions = 0 ;
bx_dbg . unsupported = 0 ;
bx_dbg . temp = 0 ;
bx_dbg . reset = 0 ;
bx_dbg . mouse = 0 ;
bx_dbg . io = 0 ;
bx_dbg . debugger = 0 ;
bx_dbg . xms = 0 ;
bx_dbg . v8086 = 0 ;
bx_dbg . paging = 0 ;
bx_dbg . creg = 0 ;
bx_dbg . dreg = 0 ;
bx_dbg . dma = 0 ;
bx_dbg . unsupported_io = 0 ;
bx_dbg . record_io = 0 ;
bx_dbg . serial = 0 ;
bx_dbg . cdrom = 0 ;
2001-06-10 00:01:12 +04:00
# ifdef MAGIC_BREAKPOINT
bx_dbg . magic_break_enabled = 0 ;
# endif
2001-04-10 05:04:59 +04:00
}
2002-04-18 04:22:20 +04:00
int
2001-04-10 05:04:59 +04:00
bx_atexit ( void )
{
2002-10-25 15:44:41 +04:00
static bx_bool been_here = 0 ;
2002-04-18 04:22:20 +04:00
if ( been_here ) return 1 ; // protect from reentry
been_here = 1 ;
2001-04-10 05:04:59 +04:00
2002-12-06 22:34:32 +03:00
// in case we ended up in simulation mode, change back to config mode
// so that the user can see any messages left behind on the console.
SIM - > set_display_mode ( DISP_MODE_CONFIG ) ;
2002-09-03 08:54:28 +04:00
2001-04-10 05:04:59 +04:00
# if BX_PROVIDE_DEVICE_MODELS==1
2002-04-18 04:22:20 +04:00
bx_pc_system . exit ( ) ;
2001-04-10 05:04:59 +04:00
# endif
# if BX_DEBUGGER == 0
2002-09-25 22:49:35 +04:00
if ( SIM & & SIM - > get_init_done ( ) ) {
for ( int cpu = 0 ; cpu < BX_SMP_PROCESSORS ; cpu + + )
if ( BX_CPU ( cpu ) ) BX_CPU ( cpu ) - > atexit ( ) ;
}
2001-04-10 05:04:59 +04:00
# endif
# if BX_PCI_SUPPORT
2002-09-05 19:51:03 +04:00
if ( bx_options . Oi440FXSupport - > get ( ) ) {
2002-11-09 23:51:40 +03:00
bx_devices . pluginPciBridge - > print_i440fx_state ( ) ;
2002-09-05 19:51:03 +04:00
}
# endif
// restore signal handling to defaults
# if !BX_DEBUGGER
BX_INFO ( ( " restoring default signal behavior " ) ) ;
signal ( SIGINT , SIG_DFL ) ;
# endif
# if BX_SHOW_IPS
# ifndef __MINGW32__
signal ( SIGALRM , SIG_DFL ) ;
# endif
2001-04-10 05:04:59 +04:00
# endif
2002-11-01 19:30:53 +03:00
return 0 ;
2001-04-10 05:04:59 +04:00
}
# if BX_PROVIDE_MAIN
2001-06-10 00:01:12 +04:00
char *
bx_find_bochsrc ( )
2001-04-10 05:04:59 +04:00
{
2001-06-12 00:39:05 +04:00
FILE * fd = NULL ;
2001-06-10 00:01:12 +04:00
char rcfile [ 512 ] ;
2001-05-22 22:47:30 +04:00
Bit32u retry = 0 , found = 0 ;
// try several possibilities for the bochsrc before giving up
while ( ! found ) {
2001-06-10 00:01:12 +04:00
rcfile [ 0 ] = 0 ;
2001-05-22 22:47:30 +04:00
switch ( retry + + ) {
2001-06-10 00:01:12 +04:00
case 0 : strcpy ( rcfile , " .bochsrc " ) ; break ;
case 1 : strcpy ( rcfile , " bochsrc " ) ; break ;
case 2 : strcpy ( rcfile , " bochsrc.txt " ) ; break ;
2001-09-26 19:22:52 +04:00
# if (!defined(WIN32)) && !BX_WITH_MACOS
2001-05-22 22:47:30 +04:00
// only try this on unix
2002-08-12 18:55:21 +04:00
case 3 :
2001-05-22 22:47:30 +04:00
{
char * ptr = getenv ( " HOME " ) ;
2001-06-10 00:01:12 +04:00
if ( ptr ) sprintf ( rcfile , " %s/.bochsrc " , ptr ) ;
2001-04-10 05:04:59 +04:00
}
2001-05-22 22:47:30 +04:00
break ;
2002-08-12 18:55:21 +04:00
case 4 : strcpy ( rcfile , " /etc/bochsrc " ) ; break ;
# endif
2001-05-22 22:47:30 +04:00
default :
2001-06-10 00:01:12 +04:00
return NULL ;
2001-04-10 05:04:59 +04:00
}
2001-06-10 00:01:12 +04:00
if ( rcfile [ 0 ] ) {
BX_DEBUG ( ( " looking for configuration in %s " , rcfile ) ) ;
fd = fopen ( rcfile , " r " ) ;
2001-05-22 22:47:30 +04:00
if ( fd ) found = 1 ;
}
}
2001-06-10 00:01:12 +04:00
assert ( fd ! = NULL & & rcfile [ 0 ] ! = 0 ) ;
fclose ( fd ) ;
return strdup ( rcfile ) ;
}
static int
parse_bochsrc ( char * rcfile )
{
FILE * fd = NULL ;
char * ret ;
char line [ 512 ] ;
// try several possibilities for the bochsrc before giving up
2001-04-10 05:04:59 +04:00
2002-08-18 20:59:26 +04:00
bochsrc_include_count + + ;
2001-06-10 00:01:12 +04:00
fd = fopen ( rcfile , " r " ) ;
2002-07-14 17:22:38 +04:00
if ( fd = = NULL ) return - 1 ;
2001-04-10 05:04:59 +04:00
2002-09-25 23:05:01 +04:00
int retval = 0 ;
2001-04-10 05:04:59 +04:00
do {
ret = fgets ( line , sizeof ( line ) - 1 , fd ) ;
line [ sizeof ( line ) - 1 ] = ' \0 ' ;
2001-05-23 19:00:10 +04:00
int len = strlen ( line ) ;
if ( len > 0 )
line [ len - 1 ] = ' \0 ' ;
2001-04-10 05:04:59 +04:00
if ( ( ret ! = NULL ) & & strlen ( line ) ) {
2002-09-25 22:31:38 +04:00
if ( parse_line_unformatted ( rcfile , line ) < 0 ) {
2002-11-01 19:30:53 +03:00
retval = - 1 ;
break ; // quit parsing after first error
2002-09-25 22:31:38 +04:00
}
2001-04-10 05:04:59 +04:00
}
} while ( ! feof ( fd ) ) ;
2002-07-16 00:12:14 +04:00
fclose ( fd ) ;
2002-08-18 20:59:26 +04:00
bochsrc_include_count - - ;
2002-09-25 23:05:01 +04:00
return retval ;
2001-04-10 05:04:59 +04:00
}
2002-11-26 23:40:50 +03:00
static char *
get_builtin_variable ( char * varname )
{
2002-12-03 21:55:23 +03:00
# ifdef WIN32
int code ;
DWORD size ;
DWORD type = 0 ;
HKEY hkey ;
char keyname [ 80 ] ;
static char data [ MAX_PATH ] ;
# endif
2002-11-26 23:40:50 +03:00
if ( strlen ( varname ) < 1 ) return NULL ;
else {
2002-12-15 01:18:00 +03:00
if ( ! strcmp ( varname , " BXSHARE " ) ) {
2002-12-03 21:55:23 +03:00
# ifdef WIN32
wsprintf ( keyname , " Software \\ Bochs %s " , VER_STRING ) ;
code = RegOpenKeyEx ( HKEY_LOCAL_MACHINE , keyname , 0 , KEY_READ , & hkey ) ;
if ( code = = ERROR_SUCCESS ) {
data [ 0 ] = 0 ;
size = MAX_PATH ;
if ( RegQueryValueEx ( hkey , " " , NULL , ( LPDWORD ) & type , ( LPBYTE ) data ,
( LPDWORD ) & size ) = = ERROR_SUCCESS ) {
RegCloseKey ( hkey ) ;
return data ;
} else {
RegCloseKey ( hkey ) ;
return NULL ;
}
} else {
return NULL ;
}
# else
2002-12-15 01:18:00 +03:00
return BX_SHARE_PATH ;
2002-12-03 21:55:23 +03:00
# endif
2002-11-26 23:40:50 +03:00
}
return NULL ;
}
}
2002-09-25 22:31:38 +04:00
static Bit32s
2001-06-10 00:01:12 +04:00
parse_line_unformatted ( char * context , char * line )
2001-04-10 05:04:59 +04:00
{
2001-12-21 22:33:18 +03:00
# define MAX_PARAMS_LEN 40
2001-04-10 05:04:59 +04:00
char * ptr ;
unsigned i , string_i ;
char string [ 512 ] ;
2001-12-21 22:33:18 +03:00
char * params [ MAX_PARAMS_LEN ] ;
2001-04-10 05:04:59 +04:00
int num_params ;
2002-10-25 15:44:41 +04:00
bx_bool inquotes = 0 ;
2003-01-10 23:33:12 +03:00
bx_bool comment = 0 ;
2001-04-10 05:04:59 +04:00
2001-12-21 22:33:18 +03:00
memset ( params , 0 , sizeof ( params ) ) ;
2002-09-25 22:31:38 +04:00
if ( line = = NULL ) return 0 ;
2001-04-10 05:04:59 +04:00
// if passed nothing but whitespace, just return
for ( i = 0 ; i < strlen ( line ) ; i + + ) {
if ( ! isspace ( line [ i ] ) ) break ;
}
if ( i > = strlen ( line ) )
2002-09-25 22:31:38 +04:00
return 0 ;
2001-04-10 05:04:59 +04:00
num_params = 0 ;
2002-08-18 20:59:26 +04:00
if ( ! strncmp ( line , " #include " , 8 ) )
ptr = strtok ( line , " " ) ;
else
ptr = strtok ( line , " : " ) ;
2003-01-10 23:33:12 +03:00
while ( ( ptr ) & & ( ! comment ) ) {
2001-04-10 05:04:59 +04:00
string_i = 0 ;
for ( i = 0 ; i < strlen ( ptr ) ; i + + ) {
if ( ptr [ i ] = = ' " ' )
inquotes = ! inquotes ;
2003-01-10 23:33:12 +03:00
else if ( ( ptr [ i ] = = ' # ' ) & & ( strncmp ( line + i , " #include " , 8 ) ) & & ! inquotes ) {
comment = 1 ;
break ;
} else {
2001-11-11 08:44:40 +03:00
# if BX_HAVE_GETENV
2002-11-01 19:30:53 +03:00
// substitute environment variables.
if ( ptr [ i ] = = ' $ ' ) {
char varname [ 512 ] ;
char * pv = varname ;
char * value ;
* pv = 0 ;
i + + ;
while ( isalpha ( ptr [ i ] ) | | ptr [ i ] = = ' _ ' ) {
* pv = ptr [ i ] ; pv + + ; i + + ;
}
* pv = 0 ;
if ( strlen ( varname ) < 1 | | ! ( value = getenv ( varname ) ) ) {
2002-11-26 23:40:50 +03:00
if ( ( value = get_builtin_variable ( varname ) ) ) {
// append value to the string
for ( pv = value ; * pv ; pv + + )
string [ string_i + + ] = * pv ;
} else {
BX_PANIC ( ( " could not look up environment variable '%s' " , varname ) ) ;
}
2002-11-01 19:30:53 +03:00
} else {
// append value to the string
for ( pv = value ; * pv ; pv + + )
string [ string_i + + ] = * pv ;
}
}
2001-11-11 08:44:40 +03:00
# endif
2001-04-10 05:04:59 +04:00
if ( ! isspace ( ptr [ i ] ) | | inquotes ) {
2002-11-01 19:30:53 +03:00
string [ string_i + + ] = ptr [ i ] ;
}
2001-04-10 05:04:59 +04:00
}
2001-11-11 08:44:40 +03:00
}
2001-04-10 05:04:59 +04:00
string [ string_i ] = ' \0 ' ;
2003-01-10 23:33:12 +03:00
if ( string_i = = 0 ) break ;
2001-12-21 22:33:18 +03:00
if ( params [ num_params ] ! = NULL )
{
free ( params [ num_params ] ) ;
params [ num_params ] = NULL ;
}
if ( num_params < MAX_PARAMS_LEN )
{
2001-11-11 08:44:40 +03:00
params [ num_params + + ] = strdup ( string ) ;
2001-04-10 05:04:59 +04:00
ptr = strtok ( NULL , " , " ) ;
2001-12-21 22:33:18 +03:00
}
else
{
BX_PANIC ( ( " too many parameters, max is %d \n " , MAX_PARAMS_LEN ) ) ;
}
2001-11-11 08:44:40 +03:00
}
2002-09-25 22:31:38 +04:00
Bit32s retval = parse_line_formatted ( context , num_params , & params [ 0 ] ) ;
2001-12-21 22:33:18 +03:00
for ( i = 0 ; i < MAX_PARAMS_LEN ; i + + )
{
if ( params [ i ] ! = NULL )
{
free ( params [ i ] ) ;
params [ i ] = NULL ;
}
}
2002-09-25 22:31:38 +04:00
return retval ;
2001-04-10 05:04:59 +04:00
}
2002-10-21 15:22:26 +04:00
// These macros are called for all parse errors, so that we can easily
2002-09-25 22:31:38 +04:00
// change the behavior of all occurrences.
# define PARSE_ERR(x) \
do { BX_PANIC ( x ) ; return - 1 ; } while ( 0 )
2002-10-21 15:22:26 +04:00
# define PARSE_WARN(x) \
BX_ERROR ( x )
2002-09-25 22:31:38 +04:00
static Bit32s
2001-06-10 00:01:12 +04:00
parse_line_formatted ( char * context , int num_params , char * params [ ] )
2001-04-10 05:04:59 +04:00
{
int i ;
2002-09-25 22:31:38 +04:00
if ( num_params < 1 ) return 0 ;
2001-04-10 05:04:59 +04:00
2002-08-18 20:59:26 +04:00
if ( ! strcmp ( params [ 0 ] , " #include " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ignoring malformed #include directive. " , context ) ) ;
2002-08-18 20:59:26 +04:00
}
if ( ! strcmp ( params [ 1 ] , context ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: cannot include this file again. " , context ) ) ;
2002-08-18 20:59:26 +04:00
}
if ( bochsrc_include_count = = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: include directive in an included file not supported yet. " , context ) ) ;
2002-08-18 20:59:26 +04:00
}
bx_read_configuration ( params [ 1 ] ) ;
}
2002-09-25 22:31:38 +04:00
else if ( params [ 0 ] [ 0 ] = = ' # ' ) return 0 ; /* comment */
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " floppya " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
2001-05-08 21:45:44 +04:00
if ( ! strncmp ( params [ i ] , " 2_88= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppya . Otype - > set ( BX_FLOPPY_2_88 ) ;
2001-05-08 21:45:44 +04:00
}
else if ( ! strncmp ( params [ i ] , " 1_44= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppya . Otype - > set ( BX_FLOPPY_1_44 ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " 1_2= " , 4 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppya . Opath - > set ( & params [ i ] [ 4 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppya . Otype - > set ( BX_FLOPPY_1_2 ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " 720k= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppya . Otype - > set ( BX_FLOPPY_720K ) ;
2001-04-10 05:04:59 +04:00
}
2002-08-01 11:37:56 +04:00
else if ( ! strncmp ( params [ i ] , " 360k= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
2002-08-01 11:37:56 +04:00
bx_options . floppya . Otype - > set ( BX_FLOPPY_360K ) ;
}
2003-02-07 02:16:56 +03:00
// use CMOS reserved types?
else if ( ! strncmp ( params [ i ] , " 160k= " , 5 ) ) {
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
bx_options . floppya . Otype - > set ( BX_FLOPPY_160K ) ;
}
else if ( ! strncmp ( params [ i ] , " 180k= " , 5 ) ) {
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
bx_options . floppya . Otype - > set ( BX_FLOPPY_180K ) ;
}
else if ( ! strncmp ( params [ i ] , " 320k= " , 5 ) ) {
bx_options . floppya . Opath - > set ( & params [ i ] [ 5 ] ) ;
bx_options . floppya . Otype - > set ( BX_FLOPPY_320K ) ;
}
2001-04-10 05:04:59 +04:00
else if ( ! strncmp ( params [ i ] , " status=ejected " , 14 ) ) {
2002-08-04 12:42:34 +04:00
bx_options . floppya . Ostatus - > set ( BX_EJECTED ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " status=inserted " , 15 ) ) {
2002-08-04 12:42:34 +04:00
bx_options . floppya . Ostatus - > set ( BX_INSERTED ) ;
2001-04-10 05:04:59 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppya attribute '%s' not understood. " , context ,
2001-05-23 19:13:05 +04:00
params [ i ] ) ) ;
2001-04-10 05:04:59 +04:00
}
}
}
2002-10-03 09:29:15 +04:00
else if ( ! strcmp ( params [ 0 ] , " gdbstub_port " ) )
{
if ( num_params ! = 2 )
{
fprintf ( stderr , " .bochsrc: gdbstub_port directive: wrong # args. \n " ) ;
exit ( 1 ) ;
}
bx_options . gdbstub . port = atoi ( params [ 1 ] ) ;
}
else if ( ! strcmp ( params [ 0 ] , " gdbstub_text_base " ) )
{
if ( num_params ! = 2 )
{
fprintf ( stderr , " .bochsrc: gdbstub_text_base directive: wrong # args. \n " ) ;
exit ( 1 ) ;
}
bx_options . gdbstub . text_base = atoi ( params [ 1 ] ) ;
}
else if ( ! strcmp ( params [ 0 ] , " gdbstub_data_base " ) )
{
if ( num_params ! = 2 )
{
fprintf ( stderr , " .bochsrc: gdbstub_data_base directive: wrong # args. \n " ) ;
exit ( 1 ) ;
}
bx_options . gdbstub . data_base = atoi ( params [ 1 ] ) ;
}
else if ( ! strcmp ( params [ 0 ] , " gdbstub_bss_base " ) )
{
if ( num_params ! = 2 )
{
fprintf ( stderr , " .bochsrc: gdbstub_bss_base directive: wrong # args. \n " ) ;
exit ( 1 ) ;
}
bx_options . gdbstub . bss_base = atoi ( params [ 1 ] ) ;
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " floppyb " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
2001-05-08 21:45:44 +04:00
if ( ! strncmp ( params [ i ] , " 2_88= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppyb . Otype - > set ( BX_FLOPPY_2_88 ) ;
2001-05-08 21:45:44 +04:00
}
else if ( ! strncmp ( params [ i ] , " 1_44= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppyb . Otype - > set ( BX_FLOPPY_1_44 ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " 1_2= " , 4 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppyb . Opath - > set ( & params [ i ] [ 4 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppyb . Otype - > set ( BX_FLOPPY_1_2 ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " 720k= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
2001-06-20 18:01:39 +04:00
bx_options . floppyb . Otype - > set ( BX_FLOPPY_720K ) ;
2001-04-10 05:04:59 +04:00
}
2002-08-01 11:37:56 +04:00
else if ( ! strncmp ( params [ i ] , " 360k= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
2002-08-01 11:37:56 +04:00
bx_options . floppyb . Otype - > set ( BX_FLOPPY_360K ) ;
}
2003-02-07 02:16:56 +03:00
// use CMOS reserved types?
else if ( ! strncmp ( params [ i ] , " 160k= " , 5 ) ) {
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
bx_options . floppyb . Otype - > set ( BX_FLOPPY_160K ) ;
}
else if ( ! strncmp ( params [ i ] , " 180k= " , 5 ) ) {
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
bx_options . floppyb . Otype - > set ( BX_FLOPPY_180K ) ;
}
else if ( ! strncmp ( params [ i ] , " 320k= " , 5 ) ) {
bx_options . floppyb . Opath - > set ( & params [ i ] [ 5 ] ) ;
bx_options . floppyb . Otype - > set ( BX_FLOPPY_320K ) ;
}
2001-04-10 05:04:59 +04:00
else if ( ! strncmp ( params [ i ] , " status=ejected " , 14 ) ) {
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Ostatus - > set ( BX_EJECTED ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " status=inserted " , 15 ) ) {
2002-08-04 12:42:34 +04:00
bx_options . floppyb . Ostatus - > set ( BX_INSERTED ) ;
2001-04-10 05:04:59 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppyb attribute '%s' not understood. " , context ,
2001-05-23 19:13:05 +04:00
params [ i ] ) ) ;
2001-04-10 05:04:59 +04:00
}
}
}
2002-09-23 00:56:12 +04:00
else if ( ( ! strncmp ( params [ 0 ] , " ata " , 3 ) ) & & ( strlen ( params [ 0 ] ) = = 4 ) ) {
Bit8u channel = params [ 0 ] [ 3 ] ;
if ( ( channel < ' 0 ' ) | | ( channel > ' 9 ' ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
channel - = ' 0 ' ;
if ( channel > = BX_MAX_ATA_CHANNEL ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
if ( ( num_params < 2 ) | | ( num_params > 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
else {
bx_options . ata [ channel ] . Opresent - > set ( atol ( & params [ 1 ] [ 8 ] ) ) ;
}
if ( num_params > 2 ) {
if ( strncmp ( params [ 2 ] , " ioaddr1= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
else {
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
bx_options . ata [ channel ] . Oioaddr1 - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
else
bx_options . ata [ channel ] . Oioaddr1 - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
}
}
if ( num_params > 3 ) {
if ( strncmp ( params [ 3 ] , " ioaddr2= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
else {
if ( ( params [ 3 ] [ 8 ] = = ' 0 ' ) & & ( params [ 3 ] [ 9 ] = = ' x ' ) )
bx_options . ata [ channel ] . Oioaddr2 - > set ( strtoul ( & params [ 3 ] [ 8 ] , NULL , 16 ) ) ;
else
bx_options . ata [ channel ] . Oioaddr2 - > set ( strtoul ( & params [ 3 ] [ 8 ] , NULL , 10 ) ) ;
}
}
if ( num_params > 4 ) {
if ( strncmp ( params [ 4 ] , " irq= " , 4 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
else {
bx_options . ata [ channel ] . Oirq - > set ( atol ( & params [ 4 ] [ 4 ] ) ) ;
}
}
}
// ataX-master, ataX-slave
else if ( ( ! strncmp ( params [ 0 ] , " ata " , 3 ) ) & & ( strlen ( params [ 0 ] ) > 4 ) ) {
Bit8u channel = params [ 0 ] [ 3 ] , slave = 0 ;
if ( ( channel < ' 0 ' ) | | ( channel > ' 9 ' ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
channel - = ' 0 ' ;
if ( channel > = BX_MAX_ATA_CHANNEL ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
if ( ( strcmp ( & params [ 0 ] [ 4 ] , " -slave " ) ) & &
( strcmp ( & params [ 0 ] [ 4 ] , " -master " ) ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
if ( ! strcmp ( & params [ 0 ] [ 4 ] , " -slave " ) ) {
slave = 1 ;
}
2003-01-13 20:55:12 +03:00
// This was originally meant to warn users about both diskc
// and ata0-master defined, but it also prevent users to
// override settings on the command line
// (see [ 661010 ] cannot override ata-settings from cmdline)
// if (bx_options.atadevice[channel][slave].Opresent->get()) {
// BX_INFO(("%s: %s device of ata channel %d already defined.", context, slave?"slave":"master",channel));
// }
2002-09-23 00:56:12 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strcmp ( params [ i ] , " type=disk " ) ) {
bx_options . atadevice [ channel ] [ slave ] . Otype - > set ( BX_ATA_DEVICE_DISK ) ;
}
else if ( ! strcmp ( params [ i ] , " type=cdrom " ) ) {
bx_options . atadevice [ channel ] [ slave ] . Otype - > set ( BX_ATA_DEVICE_CDROM ) ;
}
else if ( ! strncmp ( params [ i ] , " path= " , 5 ) ) {
bx_options . atadevice [ channel ] [ slave ] . Opath - > set ( & params [ i ] [ 5 ] ) ;
}
else if ( ! strncmp ( params [ i ] , " cylinders= " , 10 ) ) {
bx_options . atadevice [ channel ] [ slave ] . Ocylinders - > set ( atol ( & params [ i ] [ 10 ] ) ) ;
}
else if ( ! strncmp ( params [ i ] , " heads= " , 6 ) ) {
bx_options . atadevice [ channel ] [ slave ] . Oheads - > set ( atol ( & params [ i ] [ 6 ] ) ) ;
}
else if ( ! strncmp ( params [ i ] , " spt= " , 4 ) ) {
bx_options . atadevice [ channel ] [ slave ] . Ospt - > set ( atol ( & params [ i ] [ 4 ] ) ) ;
}
else if ( ! strncmp ( params [ i ] , " model= " , 6 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Omodel - > set ( & params [ i ] [ 6 ] ) ;
2002-09-23 00:56:12 +04:00
}
else if ( ! strcmp ( params [ i ] , " biosdetect=none " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Obiosdetect - > set ( BX_ATA_BIOSDETECT_NONE ) ;
2002-09-23 00:56:12 +04:00
}
else if ( ! strcmp ( params [ i ] , " biosdetect=cmos " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Obiosdetect - > set ( BX_ATA_BIOSDETECT_CMOS ) ;
2002-09-23 00:56:12 +04:00
}
else if ( ! strcmp ( params [ i ] , " biosdetect=auto " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Obiosdetect - > set ( BX_ATA_BIOSDETECT_AUTO ) ;
2002-09-23 00:56:12 +04:00
}
else if ( ! strcmp ( params [ i ] , " translation=none " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set ( BX_ATA_TRANSLATION_NONE ) ;
2002-09-23 00:56:12 +04:00
}
else if ( ! strcmp ( params [ i ] , " translation=lba " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set ( BX_ATA_TRANSLATION_LBA ) ;
2002-09-23 00:56:12 +04:00
}
2002-10-28 00:25:33 +03:00
else if ( ! strcmp ( params [ i ] , " translation=large " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set ( BX_ATA_TRANSLATION_LARGE ) ;
2002-09-23 00:56:12 +04:00
}
2002-10-28 00:25:33 +03:00
else if ( ! strcmp ( params [ i ] , " translation=echs " ) ) { // synonym of large
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set ( BX_ATA_TRANSLATION_LARGE ) ;
2002-10-28 00:25:33 +03:00
}
else if ( ! strcmp ( params [ i ] , " translation=rechs " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set ( BX_ATA_TRANSLATION_RECHS ) ;
2002-10-28 00:25:33 +03:00
}
else if ( ! strcmp ( params [ i ] , " translation=auto " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Otranslation - > set ( BX_ATA_TRANSLATION_AUTO ) ;
2002-10-28 00:25:33 +03:00
}
2002-09-23 00:56:12 +04:00
else if ( ! strcmp ( params [ i ] , " status=ejected " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Ostatus - > set ( BX_EJECTED ) ;
2002-09-23 00:56:12 +04:00
}
else if ( ! strcmp ( params [ i ] , " status=inserted " ) ) {
2002-11-01 19:30:53 +03:00
bx_options . atadevice [ channel ] [ slave ] . Ostatus - > set ( BX_INSERTED ) ;
2002-09-23 00:56:12 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
}
// Enables the ata device
bx_options . atadevice [ channel ] [ slave ] . Opresent - > set ( 1 ) ;
// if enabled check if device ok
if ( bx_options . atadevice [ channel ] [ slave ] . Opresent - > get ( ) = = 1 ) {
if ( bx_options . atadevice [ channel ] [ slave ] . Otype - > get ( ) = = BX_ATA_DEVICE_DISK ) {
2002-10-21 15:22:26 +04:00
if ( strlen ( bx_options . atadevice [ channel ] [ slave ] . Opath - > getptr ( ) ) = = 0 )
2002-11-01 19:30:53 +03:00
PARSE_WARN ( ( " %s: ataX-master/slave has empty path " , context ) ) ;
if ( ( bx_options . atadevice [ channel ] [ slave ] . Ocylinders - > get ( ) = = 0 ) | |
2002-09-23 00:56:12 +04:00
( bx_options . atadevice [ channel ] [ slave ] . Oheads - > get ( ) = = 0 ) | |
( bx_options . atadevice [ channel ] [ slave ] . Ospt - > get ( ) = = 0 ) ) {
2002-10-21 15:22:26 +04:00
PARSE_WARN ( ( " %s: ataX-master/slave cannot have zero cylinders, heads, or sectors/track " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
}
else if ( bx_options . atadevice [ channel ] [ slave ] . Otype - > get ( ) = = BX_ATA_DEVICE_CDROM ) {
if ( strlen ( bx_options . atadevice [ channel ] [ slave ] . Opath - > getptr ( ) ) = = 0 ) {
2002-10-21 15:22:26 +04:00
PARSE_WARN ( ( " %s: ataX-master/slave has empty path " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
}
else {
2002-10-21 15:22:26 +04:00
PARSE_WARN ( ( " %s: ataX-master/slave: type should be specified " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
}
}
// Legacy disk options emulation
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " diskc " ) ) {
2002-09-23 00:56:12 +04:00
if ( bx_options . atadevice [ 0 ] [ 0 ] . Opresent - > get ( ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: master device of ata channel 0 already defined. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
2001-04-10 05:04:59 +04:00
if ( num_params ! = 5 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: diskc directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) | |
strncmp ( params [ 2 ] , " cyl= " , 4 ) | |
strncmp ( params [ 3 ] , " heads= " , 6 ) | |
strncmp ( params [ 4 ] , " spt= " , 4 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: diskc directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2002-09-23 00:56:12 +04:00
bx_options . ata [ 0 ] . Opresent - > set ( 1 ) ;
bx_options . atadevice [ 0 ] [ 0 ] . Otype - > set ( BX_ATA_DEVICE_DISK ) ;
bx_options . atadevice [ 0 ] [ 0 ] . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
bx_options . atadevice [ 0 ] [ 0 ] . Ocylinders - > set ( atol ( & params [ 2 ] [ 4 ] ) ) ;
bx_options . atadevice [ 0 ] [ 0 ] . Oheads - > set ( atol ( & params [ 3 ] [ 6 ] ) ) ;
bx_options . atadevice [ 0 ] [ 0 ] . Ospt - > set ( atol ( & params [ 4 ] [ 4 ] ) ) ;
bx_options . atadevice [ 0 ] [ 0 ] . Opresent - > set ( 1 ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " diskd " ) ) {
2002-09-23 00:56:12 +04:00
if ( bx_options . atadevice [ 0 ] [ 1 ] . Opresent - > get ( ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: slave device of ata channel 0 already defined. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
2001-04-10 05:04:59 +04:00
if ( num_params ! = 5 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: diskd directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) | |
strncmp ( params [ 2 ] , " cyl= " , 4 ) | |
strncmp ( params [ 3 ] , " heads= " , 6 ) | |
strncmp ( params [ 4 ] , " spt= " , 4 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: diskd directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2002-09-23 00:56:12 +04:00
bx_options . ata [ 0 ] . Opresent - > set ( 1 ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Otype - > set ( BX_ATA_DEVICE_DISK ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Ocylinders - > set ( atol ( & params [ 2 ] [ 4 ] ) ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Oheads - > set ( atol ( & params [ 3 ] [ 6 ] ) ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Ospt - > set ( atol ( & params [ 4 ] [ 4 ] ) ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Opresent - > set ( 1 ) ;
}
else if ( ! strcmp ( params [ 0 ] , " cdromd " ) ) {
if ( bx_options . atadevice [ 0 ] [ 1 ] . Opresent - > get ( ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: slave device of ata channel 0 already defined. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
if ( num_params ! = 3 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: cdromd directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
if ( strncmp ( params [ 1 ] , " dev= " , 4 ) | | strncmp ( params [ 2 ] , " status= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: cdromd directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
bx_options . ata [ 0 ] . Opresent - > set ( 1 ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Otype - > set ( BX_ATA_DEVICE_CDROM ) ;
bx_options . atadevice [ 0 ] [ 1 ] . Opath - > set ( & params [ 1 ] [ 4 ] ) ;
if ( ! strcmp ( params [ 2 ] , " status=inserted " ) )
bx_options . atadevice [ 0 ] [ 1 ] . Ostatus - > set ( BX_INSERTED ) ;
else if ( ! strcmp ( params [ 2 ] , " status=ejected " ) )
bx_options . atadevice [ 0 ] [ 1 ] . Ostatus - > set ( BX_EJECTED ) ;
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: cdromd directive malformed. " , context ) ) ;
2002-09-23 00:56:12 +04:00
}
bx_options . atadevice [ 0 ] [ 1 ] . Opresent - > set ( 1 ) ;
}
else if ( ! strcmp ( params [ 0 ] , " boot " ) ) {
if ( ! strcmp ( params [ 1 ] , " a " ) ) {
bx_options . Obootdrive - > set ( BX_BOOT_FLOPPYA ) ;
2002-09-24 13:50:16 +04:00
} else if ( ! strcmp ( params [ 1 ] , " floppy " ) ) {
bx_options . Obootdrive - > set ( BX_BOOT_FLOPPYA ) ;
2002-09-23 00:56:12 +04:00
} else if ( ! strcmp ( params [ 1 ] , " c " ) ) {
bx_options . Obootdrive - > set ( BX_BOOT_DISKC ) ;
2002-09-24 13:50:16 +04:00
} else if ( ! strcmp ( params [ 1 ] , " disk " ) ) {
bx_options . Obootdrive - > set ( BX_BOOT_DISKC ) ;
2002-09-23 00:56:12 +04:00
} else if ( ! strcmp ( params [ 1 ] , " cdrom " ) ) {
bx_options . Obootdrive - > set ( BX_BOOT_CDROM ) ;
} else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: boot directive with unknown boot device '%s'. use 'a', 'c' or 'cdrom'. " , context , params [ 1 ] ) ) ;
2002-09-23 00:56:12 +04:00
}
2001-04-10 05:04:59 +04:00
}
2002-03-03 09:03:29 +03:00
else if ( ! strcmp ( params [ 0 ] , " com1 " ) ) {
2002-08-24 21:11:33 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . com [ 0 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2002-08-24 21:11:33 +04:00
}
else if ( ! strncmp ( params [ i ] , " dev= " , 4 ) ) {
bx_options . com [ 0 ] . Odev - > set ( & params [ i ] [ 4 ] ) ;
2002-11-01 19:30:53 +03:00
bx_options . com [ 0 ] . Oenabled - > set ( 1 ) ;
2002-08-24 21:11:33 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: unknown parameter for com1 ignored. " , context ) ) ;
2002-08-24 21:11:33 +04:00
}
2002-03-03 09:03:29 +03:00
}
}
2002-08-24 21:11:33 +04:00
#if 0
2002-03-03 09:03:29 +03:00
else if ( ! strcmp ( params [ 0 ] , " com2 " ) ) {
2002-08-24 21:11:33 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . com [ 1 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2002-08-24 21:11:33 +04:00
}
else if ( ! strncmp ( params [ i ] , " dev= " , 4 ) ) {
bx_options . com [ 1 ] . Odev - > set ( & params [ i ] [ 4 ] ) ;
2002-11-01 19:30:53 +03:00
bx_options . com [ 1 ] . Oenabled - > set ( 1 ) ;
2002-08-24 21:11:33 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: unknown parameter for com2 ignored. " , context ) ) ;
2002-08-24 21:11:33 +04:00
}
2002-03-03 09:03:29 +03:00
}
}
else if ( ! strcmp ( params [ 0 ] , " com3 " ) ) {
2002-08-24 21:11:33 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . com [ 2 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2002-08-24 21:11:33 +04:00
}
else if ( ! strncmp ( params [ i ] , " dev= " , 4 ) ) {
bx_options . com [ 2 ] . Odev - > set ( & params [ i ] [ 4 ] ) ;
2002-11-01 19:30:53 +03:00
bx_options . com [ 2 ] . Oenabled - > set ( 1 ) ;
2002-08-24 21:11:33 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: unknown parameter for com3 ignored. " , context ) ) ;
2002-08-24 21:11:33 +04:00
}
2002-03-03 09:03:29 +03:00
}
}
else if ( ! strcmp ( params [ 0 ] , " com4 " ) ) {
2002-08-24 21:11:33 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . com [ 3 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2002-08-24 21:11:33 +04:00
}
else if ( ! strncmp ( params [ i ] , " dev= " , 4 ) ) {
bx_options . com [ 3 ] . Odev - > set ( & params [ i ] [ 4 ] ) ;
2002-11-01 19:30:53 +03:00
bx_options . com [ 3 ] . Oenabled - > set ( 1 ) ;
2002-08-24 21:11:33 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: unknown parameter for com4 ignored. " , context ) ) ;
2002-08-24 21:11:33 +04:00
}
2002-03-03 09:03:29 +03:00
}
}
2002-08-24 21:11:33 +04:00
# endif
2003-01-28 19:58:10 +03:00
else if ( ! strcmp ( params [ 0 ] , " usb1 " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
bx_options . usb [ 0 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
}
else if ( ! strncmp ( params [ i ] , " ioaddr= " , 7 ) ) {
if ( ( params [ i ] [ 7 ] = = ' 0 ' ) & & ( params [ i ] [ 8 ] = = ' x ' ) )
bx_options . usb [ 0 ] . Oioaddr - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 16 ) ) ;
else
bx_options . usb [ 0 ] . Oioaddr - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 10 ) ) ;
bx_options . usb [ 0 ] . Oenabled - > set ( 1 ) ;
}
else if ( ! strncmp ( params [ i ] , " irq= " , 4 ) ) {
bx_options . usb [ 0 ] . Oirq - > set ( atol ( & params [ i ] [ 4 ] ) ) ;
}
else {
PARSE_ERR ( ( " %s: unknown parameter for usb1 ignored. " , context ) ) ;
}
}
}
2002-04-23 11:44:34 +04:00
else if ( ! strcmp ( params [ 0 ] , " floppy_bootsig_check " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppy_bootsig_check directive malformed. " , context ) ) ;
2002-04-23 11:44:34 +04:00
}
2002-05-04 20:00:40 +04:00
if ( strncmp ( params [ 1 ] , " disabled= " , 9 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppy_bootsig_check directive malformed. " , context ) ) ;
2002-04-23 11:44:34 +04:00
}
2002-05-04 20:00:40 +04:00
if ( params [ 1 ] [ 9 ] = = ' 0 ' )
2002-04-23 11:44:34 +04:00
bx_options . OfloppySigCheck - > set ( 0 ) ;
2002-05-04 20:00:40 +04:00
else if ( params [ 1 ] [ 9 ] = = ' 1 ' )
2002-04-23 11:44:34 +04:00
bx_options . OfloppySigCheck - > set ( 1 ) ;
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppy_bootsig_check directive malformed. " , context ) ) ;
2002-04-23 11:44:34 +04:00
}
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " log " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: log directive has wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . log . Ofilename - > set ( params [ 1 ] ) ;
2001-04-10 05:04:59 +04:00
}
2002-06-26 18:42:35 +04:00
else if ( ! strcmp ( params [ 0 ] , " logprefix " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: logprefix directive has wrong # args. " , context ) ) ;
2002-06-26 18:42:35 +04:00
}
bx_options . log . Oprefix - > set ( params [ 1 ] ) ;
}
2002-12-03 00:26:05 +03:00
else if ( ! strcmp ( params [ 0 ] , " debugger_log " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: debugger_log directive has wrong # args. " , context ) ) ;
}
bx_options . log . Odebugger_filename - > set ( params [ 1 ] ) ;
}
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( params [ 0 ] , " panic " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: panic directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
if ( strncmp ( params [ 1 ] , " action= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: panic directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
char * action = 7 + params [ 1 ] ;
2001-05-23 06:37:52 +04:00
if ( ! strcmp ( action , " fatal " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_PANIC , ACT_FATAL ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " report " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_PANIC , ACT_REPORT ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " ignore " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_PANIC , ACT_IGNORE ) ;
2001-06-11 18:03:35 +04:00
else if ( ! strcmp ( action , " ask " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_PANIC , ACT_ASK ) ;
2001-05-23 00:01:40 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: panic directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
}
2002-12-17 06:36:53 +03:00
else if ( ! strcmp ( params [ 0 ] , " pass " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: pass directive malformed. " , context ) ) ;
}
if ( strncmp ( params [ 1 ] , " action= " , 7 ) ) {
PARSE_ERR ( ( " %s: pass directive malformed. " , context ) ) ;
}
char * action = 7 + params [ 1 ] ;
if ( ! strcmp ( action , " fatal " ) )
SIM - > set_default_log_action ( LOGLEV_PASS , ACT_FATAL ) ;
else if ( ! strcmp ( action , " report " ) )
SIM - > set_default_log_action ( LOGLEV_PASS , ACT_REPORT ) ;
else if ( ! strcmp ( action , " ignore " ) )
SIM - > set_default_log_action ( LOGLEV_PASS , ACT_IGNORE ) ;
else if ( ! strcmp ( action , " ask " ) )
SIM - > set_default_log_action ( LOGLEV_PASS , ACT_ASK ) ;
else {
PARSE_ERR ( ( " %s: pass directive malformed. " , context ) ) ;
}
}
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( params [ 0 ] , " error " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: error directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
if ( strncmp ( params [ 1 ] , " action= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: error directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
char * action = 7 + params [ 1 ] ;
2001-05-23 06:37:52 +04:00
if ( ! strcmp ( action , " fatal " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_ERROR , ACT_FATAL ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " report " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_ERROR , ACT_REPORT ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " ignore " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_ERROR , ACT_IGNORE ) ;
2001-06-11 18:03:35 +04:00
else if ( ! strcmp ( action , " ask " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_ERROR , ACT_ASK ) ;
2001-05-23 00:01:40 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: error directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
}
else if ( ! strcmp ( params [ 0 ] , " info " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: info directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
if ( strncmp ( params [ 1 ] , " action= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: info directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
char * action = 7 + params [ 1 ] ;
2001-05-23 06:37:52 +04:00
if ( ! strcmp ( action , " fatal " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_INFO , ACT_FATAL ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " report " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_INFO , ACT_REPORT ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " ignore " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_INFO , ACT_IGNORE ) ;
2001-06-11 18:03:35 +04:00
else if ( ! strcmp ( action , " ask " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_INFO , ACT_ASK ) ;
2001-05-23 00:01:40 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: info directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
}
else if ( ! strcmp ( params [ 0 ] , " debug " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: debug directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
if ( strncmp ( params [ 1 ] , " action= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: debug directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
char * action = 7 + params [ 1 ] ;
2001-05-23 06:37:52 +04:00
if ( ! strcmp ( action , " fatal " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_DEBUG , ACT_FATAL ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " report " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_DEBUG , ACT_REPORT ) ;
2001-05-23 00:01:40 +04:00
else if ( ! strcmp ( action , " ignore " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_DEBUG , ACT_IGNORE ) ;
2001-06-11 18:03:35 +04:00
else if ( ! strcmp ( action , " ask " ) )
- How to handle default log options has been somewhat confused for a long
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
2002-09-20 21:56:22 +04:00
SIM - > set_default_log_action ( LOGLEV_DEBUG , ACT_ASK ) ;
2001-05-23 00:01:40 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: debug directive malformed. " , context ) ) ;
2001-05-23 00:01:40 +04:00
}
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " romimage " ) ) {
if ( num_params ! = 3 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: romimage directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: romimage directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 2 ] , " address= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: romimage directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . rom . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
2001-04-10 05:04:59 +04:00
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2001-06-20 18:01:39 +04:00
bx_options . rom . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2001-04-10 05:04:59 +04:00
else
2001-06-20 18:01:39 +04:00
bx_options . rom . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2001-04-10 05:04:59 +04:00
}
2002-07-24 21:52:34 +04:00
else if ( ! strcmp ( params [ 0 ] , " optromimage1 " ) ) {
if ( num_params ! = 3 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage1 directive: wrong # args. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage1 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 2 ] , " address= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage2 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
2002-07-24 21:52:34 +04:00
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2002-07-24 21:52:34 +04:00
else
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 0 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2002-07-24 21:52:34 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " optromimage2 " ) ) {
if ( num_params ! = 3 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage2 directive: wrong # args. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage2 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 2 ] , " address= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage2 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 1 ] . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
2002-07-24 21:52:34 +04:00
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 1 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2002-07-24 21:52:34 +04:00
else
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 1 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2002-07-24 21:52:34 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " optromimage3 " ) ) {
if ( num_params ! = 3 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage3 directive: wrong # args. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage3 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 2 ] , " address= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage2 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 2 ] . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
2002-07-24 21:52:34 +04:00
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 2 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2002-07-24 21:52:34 +04:00
else
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 2 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2002-07-24 21:52:34 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " optromimage4 " ) ) {
if ( num_params ! = 3 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage4 directive: wrong # args. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage4 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
if ( strncmp ( params [ 2 ] , " address= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: optromimage2 directive malformed. " , context ) ) ;
2002-07-24 21:52:34 +04:00
}
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 3 ] . Opath - > set ( & params [ 1 ] [ 5 ] ) ;
2002-07-24 21:52:34 +04:00
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 3 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2002-07-24 21:52:34 +04:00
else
2002-08-23 02:38:40 +04:00
bx_options . optrom [ 3 ] . Oaddress - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2002-07-24 21:52:34 +04:00
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " vgaromimage " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: vgaromimage directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . vgarom . Opath - > set ( params [ 1 ] ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " vga_update_interval " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: vga_update_interval directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . Ovga_update_interval - > set ( atol ( params [ 1 ] ) ) ;
if ( bx_options . Ovga_update_interval - > get ( ) < 50000 ) {
2001-06-17 03:08:32 +04:00
BX_INFO ( ( " %s: vga_update_interval seems awfully small! " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
else if ( ! strcmp ( params [ 0 ] , " keyboard_serial_delay " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: keyboard_serial_delay directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . Okeyboard_serial_delay - > set ( atol ( params [ 1 ] ) ) ;
if ( bx_options . Okeyboard_serial_delay - > get ( ) < 5 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: keyboard_serial_delay not big enough! " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
2002-03-26 16:51:48 +03:00
else if ( ! strcmp ( params [ 0 ] , " keyboard_paste_delay " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: keyboard_paste_delay directive: wrong # args. " , context ) ) ;
2002-03-26 16:51:48 +03:00
}
bx_options . Okeyboard_paste_delay - > set ( atol ( params [ 1 ] ) ) ;
if ( bx_options . Okeyboard_paste_delay - > get ( ) < 1000 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: keyboard_paste_delay not big enough! " , context ) ) ;
2002-03-26 16:51:48 +03:00
}
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " megs " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: megs directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . memory . Osize - > set ( atol ( params [ 1 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " floppy_command_delay " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppy_command_delay directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . Ofloppy_command_delay - > set ( atol ( params [ 1 ] ) ) ;
if ( bx_options . Ofloppy_command_delay - > get ( ) < 100 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: floppy_command_delay not big enough! " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
else if ( ! strcmp ( params [ 0 ] , " ips " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ips directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . Oips - > set ( atol ( params [ 1 ] ) ) ;
2002-10-30 21:30:29 +03:00
if ( bx_options . Oips - > get ( ) < BX_MIN_IPS ) {
2001-06-20 18:01:39 +04:00
BX_ERROR ( ( " %s: WARNING: ips is AWFULLY low! " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
2002-12-21 20:27:42 +03:00
else if ( ! strcmp ( params [ 0 ] , " pit " ) ) {
2002-10-30 01:26:32 +03:00
if ( num_params ! = 2 ) {
2002-12-21 20:27:42 +03:00
PARSE_ERR ( ( " %s: pit directive: wrong # args. " , context ) ) ;
2002-10-30 01:26:32 +03:00
}
2002-12-21 20:27:42 +03:00
if ( ! strncmp ( params [ 1 ] , " realtime= " , 9 ) ) {
switch ( params [ 1 ] [ 9 ] ) {
2003-02-07 02:16:56 +03:00
case ' 0 ' : bx_options . Orealtime_pit - > set ( 0 ) ; break ;
case ' 1 ' : bx_options . Orealtime_pit - > set ( 1 ) ; break ;
default : PARSE_ERR ( ( " %s: pit expected realtime=[0|1] arg " , context ) ) ;
2002-12-21 20:27:42 +03:00
}
2002-10-30 01:26:32 +03:00
}
2002-12-21 20:27:42 +03:00
else PARSE_ERR ( ( " %s: pit expected realtime=[0|1] arg " , context ) ) ;
2002-10-30 01:26:32 +03:00
}
2001-06-21 20:59:56 +04:00
else if ( ! strcmp ( params [ 0 ] , " max_ips " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: max_ips directive: wrong # args. " , context ) ) ;
2001-06-21 20:59:56 +04:00
}
2001-10-07 04:58:10 +04:00
BX_INFO ( ( " WARNING: max_ips not implemented " ) ) ;
2001-06-21 20:59:56 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " system_clock_sync " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: system_clock_sync directive malformed. " , context ) ) ;
2001-06-21 20:59:56 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: system_clock_sync directive malformed. " , context ) ) ;
2001-06-21 20:59:56 +04:00
}
if ( params [ 1 ] [ 8 ] = = ' 0 ' | | params [ 1 ] [ 8 ] = = ' 1 ' )
2001-10-07 04:58:10 +04:00
BX_INFO ( ( " WARNING: system_clock_sync not implemented " ) ) ;
2001-06-21 20:59:56 +04:00
else
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: system_clock_sync directive malformed. " , context ) ) ;
2001-06-21 20:59:56 +04:00
}
2002-12-12 09:21:43 +03:00
else if ( ! strcmp ( params [ 0 ] , " text_snapshot_check " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: text_snapshot_check directive: wrong # args. " , context ) ) ;
}
if ( ! strncmp ( params [ 1 ] , " enable " , 6 ) ) {
bx_options . Otext_snapshot_check - > set ( 1 ) ;
}
else if ( ! strncmp ( params [ 1 ] , " disable " , 7 ) ) {
bx_options . Otext_snapshot_check - > set ( 0 ) ;
}
else bx_options . Otext_snapshot_check - > set ( ! ! ( atol ( params [ 1 ] ) ) ) ;
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " mouse " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: mouse directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: mouse directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-17 03:08:32 +04:00
if ( params [ 1 ] [ 8 ] = = ' 0 ' | | params [ 1 ] [ 8 ] = = ' 1 ' )
2001-06-20 18:01:39 +04:00
bx_options . Omouse_enabled - > set ( params [ 1 ] [ 8 ] - ' 0 ' ) ;
2001-06-17 03:08:32 +04:00
else
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: mouse directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " private_colormap " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: private_colormap directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: private_colormap directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
if ( params [ 1 ] [ 8 ] = = ' 0 ' | | params [ 1 ] [ 8 ] = = ' 1 ' )
bx_options . Oprivate_colormap - > set ( params [ 1 ] [ 8 ] - ' 0 ' ) ;
2001-04-10 05:04:59 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: private_colormap directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
2001-08-16 00:17:19 +04:00
else if ( ! strcmp ( params [ 0 ] , " fullscreen " ) ) {
2001-08-16 16:35:52 +04:00
# if BX_WITH_AMIGAOS
2001-08-16 00:17:19 +04:00
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: fullscreen directive malformed. " , context ) ) ;
2001-08-16 00:17:19 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: fullscreen directive malformed. " , context ) ) ;
2001-08-16 00:17:19 +04:00
}
2001-08-16 06:00:31 +04:00
if ( params [ 1 ] [ 8 ] = = ' 0 ' | | params [ 1 ] [ 8 ] = = ' 1 ' ) {
2001-08-16 00:17:19 +04:00
bx_options . Ofullscreen - > set ( params [ 1 ] [ 8 ] - ' 0 ' ) ;
2001-08-16 06:00:31 +04:00
} else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: fullscreen directive malformed. " , context ) ) ;
2001-08-16 00:17:19 +04:00
}
2001-08-16 06:00:31 +04:00
# endif
}
else if ( ! strcmp ( params [ 0 ] , " screenmode " ) ) {
2001-08-16 16:35:52 +04:00
# if BX_WITH_AMIGAOS
2001-08-16 06:00:31 +04:00
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: screenmode directive malformed. " , context ) ) ;
2001-08-16 06:00:31 +04:00
}
if ( strncmp ( params [ 1 ] , " name= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: screenmode directive malformed. " , context ) ) ;
2001-08-16 06:00:31 +04:00
}
bx_options . Oscreenmode - > set ( strdup ( & params [ 1 ] [ 5 ] ) ) ;
# endif
2001-08-16 00:17:19 +04:00
}
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " sb16 " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
2001-06-21 22:34:50 +04:00
bx_options . sb16 . Opresent - > set ( 1 ) ;
2001-04-10 05:04:59 +04:00
if ( ! strncmp ( params [ i ] , " midi= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Omidifile - > set ( strdup ( & params [ i ] [ 5 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " midimode= " , 9 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Omidimode - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " wave= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Owavefile - > set ( strdup ( & params [ i ] [ 5 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " wavemode= " , 9 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Owavemode - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " log= " , 4 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Ologfile - > set ( strdup ( & params [ i ] [ 4 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " loglevel= " , 9 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Ologlevel - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strncmp ( params [ i ] , " dmatimer= " , 9 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . sb16 . Odmatimer - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
}
}
2001-11-12 05:35:09 +03:00
else if ( ! strcmp ( params [ 0 ] , " parport1 " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
2002-08-24 14:20:35 +04:00
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . par [ 0 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2001-11-12 05:35:09 +03:00
}
else if ( ! strncmp ( params [ i ] , " file= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . par [ 0 ] . Ooutfile - > set ( strdup ( & params [ i ] [ 5 ] ) ) ;
bx_options . par [ 0 ] . Oenabled - > set ( 1 ) ;
2002-08-24 21:11:33 +04:00
}
else {
BX_ERROR ( ( " %s: unknown parameter for parport1 ignored. " , context ) ) ;
2001-11-12 05:35:09 +03:00
}
}
}
#if 0
else if ( ! strcmp ( params [ 0 ] , " parport2 " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
2002-08-24 14:20:35 +04:00
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . par [ 1 ] . Oenabled - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2001-11-12 05:35:09 +03:00
}
else if ( ! strncmp ( params [ i ] , " file= " , 5 ) ) {
2002-11-01 19:30:53 +03:00
bx_options . par [ 1 ] . Ooutfile - > set ( strdup ( & params [ i ] [ 5 ] ) ) ;
bx_options . par [ 1 ] . Oenabled - > set ( 1 ) ;
2002-08-24 21:11:33 +04:00
}
else {
BX_ERROR ( ( " %s: unknown parameter for parport2 ignored. " , context ) ) ;
2001-11-12 05:35:09 +03:00
}
}
}
# endif
2001-04-10 05:04:59 +04:00
else if ( ! strcmp ( params [ 0 ] , " i440fxsupport " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: i440FXSupport directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: i440FXSupport directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( params [ 1 ] [ 8 ] = = ' 0 ' )
2001-06-20 18:01:39 +04:00
bx_options . Oi440FXSupport - > set ( 0 ) ;
2001-04-10 05:04:59 +04:00
else if ( params [ 1 ] [ 8 ] = = ' 1 ' )
2001-06-20 18:01:39 +04:00
bx_options . Oi440FXSupport - > set ( 1 ) ;
2001-04-10 05:04:59 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: i440FXSupport directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
else if ( ! strcmp ( params [ 0 ] , " newharddrivesupport " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: newharddrivesupport directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: newharddrivesupport directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( params [ 1 ] [ 8 ] = = ' 0 ' )
2001-06-20 18:01:39 +04:00
bx_options . OnewHardDriveSupport - > set ( 0 ) ;
2001-04-10 05:04:59 +04:00
else if ( params [ 1 ] [ 8 ] = = ' 1 ' )
2001-06-20 18:01:39 +04:00
bx_options . OnewHardDriveSupport - > set ( 1 ) ;
2001-04-10 05:04:59 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: newharddrivesupport directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
else if ( ! strcmp ( params [ 0 ] , " cmosimage " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: cmosimage directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . cmos . Opath - > set ( strdup ( params [ 1 ] ) ) ;
bx_options . cmos . OcmosImage - > set ( 1 ) ; // CMOS Image is true
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " time0 " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: time0 directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . cmos . Otime0 - > set ( atoi ( params [ 1 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
# ifdef MAGIC_BREAKPOINT
else if ( ! strcmp ( params [ 0 ] , " magic_break " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: magic_break directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: magic_break directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( params [ 1 ] [ 8 ] = = ' 0 ' ) {
2001-05-30 22:56:02 +04:00
BX_INFO ( ( " Ignoring magic break points " ) ) ;
2001-04-10 05:04:59 +04:00
bx_dbg . magic_break_enabled = 0 ;
}
else if ( params [ 1 ] [ 8 ] = = ' 1 ' ) {
2001-05-30 22:56:02 +04:00
BX_INFO ( ( " Stopping on magic break points " ) ) ;
2001-04-10 05:04:59 +04:00
bx_dbg . magic_break_enabled = 1 ;
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: magic_break directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
}
# endif
else if ( ! strcmp ( params [ 0 ] , " ne2k " ) ) {
int tmp [ 6 ] ;
2001-06-21 23:27:05 +04:00
char tmpchar [ 6 ] ;
2002-11-18 20:16:07 +03:00
bx_options . ne2k . Opresent - > set ( 0 ) ;
2002-05-02 11:54:22 +04:00
if ( ( num_params < 4 ) | | ( num_params > 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-21 22:34:50 +04:00
bx_options . ne2k . Oethmod - > set ( " null " ) ;
2001-04-10 05:04:59 +04:00
if ( strncmp ( params [ 1 ] , " ioaddr= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 2 ] , " irq= " , 4 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 3 ] , " mac= " , 4 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-21 22:34:50 +04:00
bx_options . ne2k . Oioaddr - > set ( strtoul ( & params [ 1 ] [ 7 ] , NULL , 16 ) ) ;
bx_options . ne2k . Oirq - > set ( atol ( & params [ 2 ] [ 4 ] ) ) ;
2001-04-10 05:04:59 +04:00
i = sscanf ( & params [ 3 ] [ 4 ] , " %x:%x:%x:%x:%x:%x " ,
& tmp [ 0 ] , & tmp [ 1 ] , & tmp [ 2 ] , & tmp [ 3 ] , & tmp [ 4 ] , & tmp [ 5 ] ) ;
if ( i ! = 6 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k mac address malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
for ( i = 0 ; i < 6 ; i + + )
2001-06-21 23:27:05 +04:00
tmpchar [ i ] = ( unsigned char ) tmp [ i ] ;
bx_options . ne2k . Omacaddr - > set ( tmpchar ) ;
2001-04-10 05:04:59 +04:00
if ( num_params > 4 ) {
if ( strncmp ( params [ 4 ] , " ethmod= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-21 22:34:50 +04:00
bx_options . ne2k . Oethmod - > set ( strdup ( & params [ 4 ] [ 7 ] ) ) ;
2002-05-02 11:54:22 +04:00
if ( num_params > 5 ) {
if ( strncmp ( params [ 5 ] , " ethdev= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2002-05-02 11:54:22 +04:00
}
bx_options . ne2k . Oethdev - > set ( strdup ( & params [ 5 ] [ 7 ] ) ) ;
if ( num_params > 6 ) {
if ( strncmp ( params [ 6 ] , " script= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: ne2k directive malformed. " , context ) ) ;
2002-05-02 11:54:22 +04:00
}
bx_options . ne2k . Oscript - > set ( strdup ( & params [ 6 ] [ 7 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
}
}
2002-11-18 20:16:07 +03:00
bx_options . ne2k . Opresent - > set ( 1 ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " load32bitOSImage " ) ) {
if ( ( num_params ! = 4 ) & & ( num_params ! = 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage directive: wrong # args. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 1 ] , " os= " , 3 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( ! strcmp ( & params [ 1 ] [ 3 ] , " nullkernel " ) ) {
2001-06-20 18:01:39 +04:00
bx_options . load32bitOSImage . OwhichOS - > set ( Load32bitOSNullKernel ) ;
2001-04-10 05:04:59 +04:00
}
else if ( ! strcmp ( & params [ 1 ] [ 3 ] , " linux " ) ) {
2001-06-20 18:01:39 +04:00
bx_options . load32bitOSImage . OwhichOS - > set ( Load32bitOSLinux ) ;
2001-04-10 05:04:59 +04:00
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage: unsupported OS. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 2 ] , " path= " , 5 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
if ( strncmp ( params [ 3 ] , " iolog= " , 6 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . load32bitOSImage . Opath - > set ( strdup ( & params [ 2 ] [ 5 ] ) ) ;
bx_options . load32bitOSImage . Oiolog - > set ( strdup ( & params [ 3 ] [ 6 ] ) ) ;
2001-04-10 05:04:59 +04:00
if ( num_params = = 5 ) {
if ( strncmp ( params [ 4 ] , " initrd= " , 7 ) ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2001-04-10 05:04:59 +04:00
}
2001-06-20 18:01:39 +04:00
bx_options . load32bitOSImage . Oinitrd - > set ( strdup ( & params [ 4 ] [ 7 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
}
2001-12-12 13:43:36 +03:00
else if ( ! strcmp ( params [ 0 ] , " keyboard_type " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: keyboard_type directive: wrong # args. " , context ) ) ;
2001-12-12 13:43:36 +03:00
}
if ( strcmp ( params [ 1 ] , " xt " ) = = 0 ) {
bx_options . Okeyboard_type - > set ( BX_KBD_XT_TYPE ) ;
}
else if ( strcmp ( params [ 1 ] , " at " ) = = 0 ) {
bx_options . Okeyboard_type - > set ( BX_KBD_AT_TYPE ) ;
}
else if ( strcmp ( params [ 1 ] , " mf " ) = = 0 ) {
bx_options . Okeyboard_type - > set ( BX_KBD_MF_TYPE ) ;
}
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: keyboard_type directive: wrong arg %s. " , context , params [ 1 ] ) ) ;
2001-12-12 13:43:36 +03:00
}
}
2001-04-10 05:04:59 +04:00
2001-12-14 20:56:37 +03:00
else if ( ! strcmp ( params [ 0 ] , " keyboard_mapping " )
| | ! strcmp ( params [ 0 ] , " keyboardmapping " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
bx_options . keyboard . OuseMapping - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
}
else if ( ! strncmp ( params [ i ] , " map= " , 4 ) ) {
bx_options . keyboard . Okeymap - > set ( strdup ( & params [ i ] [ 4 ] ) ) ;
}
2002-08-09 10:16:43 +04:00
}
2001-12-14 20:56:37 +03:00
}
2002-08-09 10:16:43 +04:00
else if ( ! strcmp ( params [ 0 ] , " user_shortcut " ) ) {
if ( num_params ! = 2 ) {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: user_shortcut directive: wrong # args. " , context ) ) ;
2002-08-09 10:16:43 +04:00
}
if ( ! strncmp ( params [ 1 ] , " keys= " , 4 ) ) {
bx_options . Ouser_shortcut - > set ( strdup ( & params [ 1 ] [ 5 ] ) ) ;
}
2002-09-23 00:56:12 +04:00
}
2002-10-25 01:07:56 +04:00
else if ( ! strcmp ( params [ 0 ] , " config_interface " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: config_interface directive: wrong # args. " , context ) ) ;
}
if ( ! bx_options . Osel_config - > set_by_name ( params [ 1 ] ) )
PARSE_ERR ( ( " %s: config_interface '%s' not available " , context , params [ 1 ] ) ) ;
}
else if ( ! strcmp ( params [ 0 ] , " display_library " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: display_library directive: wrong # args. " , context ) ) ;
}
if ( ! bx_options . Osel_displaylib - > set_by_name ( params [ 1 ] ) )
2002-10-26 17:22:47 +04:00
PARSE_ERR ( ( " %s: display library '%s' not available " , context , params [ 1 ] ) ) ;
2002-10-25 01:07:56 +04:00
}
2001-04-10 05:04:59 +04:00
else {
2002-09-25 22:31:38 +04:00
PARSE_ERR ( ( " %s: directive '%s' not understood " , context , params [ 0 ] ) ) ;
2001-04-10 05:04:59 +04:00
}
2002-09-25 22:31:38 +04:00
return 0 ;
2001-04-10 05:04:59 +04:00
}
2001-06-11 10:35:18 +04:00
static char * fdtypes [ ] = {
2003-02-07 02:16:56 +03:00
" none " , " 1_2 " , " 1_44 " , " 2_88 " , " 720k " , " 360k " , " 160k " , " 180k " , " 320k "
2001-06-11 10:35:18 +04:00
} ;
2003-02-07 02:16:56 +03:00
2001-06-11 10:35:18 +04:00
int
bx_write_floppy_options ( FILE * fp , int drive , bx_floppy_options * opt )
{
BX_ASSERT ( drive = = 0 | | drive = = 1 ) ;
2001-06-20 18:01:39 +04:00
if ( opt - > Otype - > get ( ) = = BX_FLOPPY_NONE ) {
2001-06-11 10:35:18 +04:00
fprintf ( fp , " # no floppy%c \n " , ( char ) ' a ' + drive ) ;
return 0 ;
}
2001-06-20 18:01:39 +04:00
BX_ASSERT ( opt - > Otype - > get ( ) > BX_FLOPPY_NONE & & opt - > Otype - > get ( ) < = BX_FLOPPY_LAST ) ;
fprintf ( fp , " floppy%c: %s= \" %s \" , status=%s \n " ,
2001-06-11 10:35:18 +04:00
( char ) ' a ' + drive ,
2001-06-20 18:01:39 +04:00
fdtypes [ opt - > Otype - > get ( ) - BX_FLOPPY_NONE ] ,
opt - > Opath - > getptr ( ) ,
2002-08-04 12:42:34 +04:00
opt - > Ostatus - > get ( ) = = BX_EJECTED ? " ejected " : " inserted " ) ;
2001-06-11 10:35:18 +04:00
return 0 ;
}
int
2002-09-23 00:56:12 +04:00
bx_write_ata_options ( FILE * fp , Bit8u channel , bx_ata_options * opt )
2001-06-11 10:35:18 +04:00
{
2002-09-23 00:56:12 +04:00
fprintf ( fp , " ata%d: enabled=%d " , channel , opt - > Opresent - > get ( ) ) ;
if ( opt - > Opresent - > get ( ) ) {
fprintf ( fp , " , ioaddr1=0x%x, ioaddr2=0x%x, irq=%d " , opt - > Oioaddr1 - > get ( ) ,
opt - > Oioaddr2 - > get ( ) , opt - > Oirq - > get ( ) ) ;
}
fprintf ( fp , " \n " ) ;
2001-06-11 10:35:18 +04:00
return 0 ;
}
int
2002-09-23 00:56:12 +04:00
bx_write_atadevice_options ( FILE * fp , Bit8u channel , Bit8u drive , bx_atadevice_options * opt )
2001-06-11 10:35:18 +04:00
{
2002-09-23 00:56:12 +04:00
if ( opt - > Opresent - > get ( ) ) {
fprintf ( fp , " ata%d-%s: " , channel , drive = = 0 ? " master " : " slave " ) ;
if ( opt - > Otype - > get ( ) = = BX_ATA_DEVICE_DISK ) {
fprintf ( fp , " type=disk, path= \" %s \" , cylinders=%d, heads=%d, spt=%d " ,
opt - > Opath - > getptr ( ) , opt - > Ocylinders - > get ( ) , opt - > Oheads - > get ( ) , opt - > Ospt - > get ( ) ) ;
switch ( opt - > Otranslation - > get ( ) ) {
case BX_ATA_TRANSLATION_NONE :
fprintf ( fp , " , translation=none " ) ;
break ;
case BX_ATA_TRANSLATION_LBA :
fprintf ( fp , " , translation=lba " ) ;
break ;
case BX_ATA_TRANSLATION_LARGE :
fprintf ( fp , " , translation=large " ) ;
break ;
2002-10-28 00:25:33 +03:00
case BX_ATA_TRANSLATION_RECHS :
fprintf ( fp , " , translation=rechs " ) ;
break ;
case BX_ATA_TRANSLATION_AUTO :
fprintf ( fp , " , translation=auto " ) ;
break ;
2002-09-23 00:56:12 +04:00
}
}
else if ( opt - > Otype - > get ( ) = = BX_ATA_DEVICE_CDROM ) {
fprintf ( fp , " type=cdrom, path= \" %s \" , status=%s " ,
opt - > Opath - > getptr ( ) ,
opt - > Ostatus - > get ( ) = = BX_EJECTED ? " ejected " : " inserted " ) ;
}
switch ( opt - > Obiosdetect - > get ( ) ) {
case BX_ATA_BIOSDETECT_NONE :
fprintf ( fp , " , biosdetect=none " ) ;
break ;
case BX_ATA_BIOSDETECT_CMOS :
fprintf ( fp , " , biosdetect=cmos " ) ;
break ;
case BX_ATA_BIOSDETECT_AUTO :
fprintf ( fp , " , biosdetect=auto " ) ;
break ;
}
if ( strlen ( opt - > Omodel - > getptr ( ) ) > 0 ) {
fprintf ( fp , " , model= \" %s \" " , opt - > Omodel - > getptr ( ) ) ;
}
fprintf ( fp , " \n " ) ;
2001-06-11 10:35:18 +04:00
}
return 0 ;
}
2001-11-12 05:35:09 +03:00
int
bx_write_parport_options ( FILE * fp , bx_parport_options * opt , int n )
{
2002-08-24 21:11:33 +04:00
fprintf ( fp , " parport%d: enabled=%d " , n , opt - > Oenabled - > get ( ) ) ;
if ( opt - > Oenabled - > get ( ) ) {
2002-08-24 14:20:35 +04:00
fprintf ( fp , " , file= \" %s \" " , opt - > Ooutfile - > getptr ( ) ) ;
2001-11-12 05:35:09 +03:00
}
fprintf ( fp , " \n " ) ;
return 0 ;
}
2002-08-24 21:11:33 +04:00
int
bx_write_serial_options ( FILE * fp , bx_serial_options * opt , int n )
{
fprintf ( fp , " com%d: enabled=%d " , n , opt - > Oenabled - > get ( ) ) ;
if ( opt - > Oenabled - > get ( ) ) {
fprintf ( fp , " , dev= \" %s \" " , opt - > Odev - > getptr ( ) ) ;
}
fprintf ( fp , " \n " ) ;
return 0 ;
}
2003-01-28 19:58:10 +03:00
int
bx_write_usb_options ( FILE * fp , bx_usb_options * opt , int n )
{
fprintf ( fp , " usb%d: enabled=%d " , n , opt - > Oenabled - > get ( ) ) ;
if ( opt - > Oenabled - > get ( ) ) {
fprintf ( fp , " , ioaddr=0x%04x, irq=%d " , opt - > Oioaddr - > get ( ) ,
opt - > Oirq - > get ( ) ) ;
}
fprintf ( fp , " \n " ) ;
return 0 ;
}
2001-06-11 10:35:18 +04:00
int
bx_write_sb16_options ( FILE * fp , bx_sb16_options * opt )
{
2001-06-21 22:34:50 +04:00
if ( ! opt - > Opresent - > get ( ) ) {
2001-06-11 10:35:18 +04:00
fprintf ( fp , " # no sb16 \n " ) ;
return 0 ;
}
2001-06-21 22:34:50 +04:00
fprintf ( fp , " sb16: midimode=%d, midi=%s, wavemode=%d, wave=%s, loglevel=%d, log=%s, dmatimer=%d \n " , opt - > Omidimode - > get ( ) , opt - > Omidifile - > getptr ( ) , opt - > Owavemode - > get ( ) , opt - > Owavefile - > getptr ( ) , opt - > Ologlevel - > get ( ) , opt - > Ologfile - > getptr ( ) , opt - > Odmatimer - > get ( ) ) ;
2001-06-11 10:35:18 +04:00
return 0 ;
}
int
bx_write_ne2k_options ( FILE * fp , bx_ne2k_options * opt )
{
2002-11-18 20:16:07 +03:00
if ( ! opt - > Opresent - > get ( ) ) {
2001-06-11 10:35:18 +04:00
fprintf ( fp , " # no ne2k \n " ) ;
return 0 ;
}
2001-06-21 23:27:05 +04:00
char * ptr = opt - > Omacaddr - > getptr ( ) ;
2002-05-02 11:54:22 +04:00
fprintf ( fp , " ne2k: ioaddr=0x%x, irq=%d, mac=%02x:%02x:%02x:%02x:%02x:%02x, ethmod=%s, ethdev=%s, script=%s \n " ,
2001-06-21 22:34:50 +04:00
opt - > Oioaddr - > get ( ) ,
opt - > Oirq - > get ( ) ,
2001-06-25 11:12:45 +04:00
( unsigned int ) ( 0xff & ptr [ 0 ] ) ,
( unsigned int ) ( 0xff & ptr [ 1 ] ) ,
( unsigned int ) ( 0xff & ptr [ 2 ] ) ,
( unsigned int ) ( 0xff & ptr [ 3 ] ) ,
( unsigned int ) ( 0xff & ptr [ 4 ] ) ,
( unsigned int ) ( 0xff & ptr [ 5 ] ) ,
2001-06-21 22:34:50 +04:00
opt - > Oethmod - > getptr ( ) ,
2002-05-02 11:54:22 +04:00
opt - > Oethdev - > getptr ( ) ,
opt - > Oscript - > getptr ( ) ) ;
2001-06-11 10:35:18 +04:00
return 0 ;
}
int
bx_write_loader_options ( FILE * fp , bx_load32bitOSImage_t * opt )
{
2001-06-20 18:01:39 +04:00
if ( opt - > OwhichOS - > get ( ) = = 0 ) {
2001-06-11 10:35:18 +04:00
fprintf ( fp , " # no loader \n " ) ;
return 0 ;
}
2001-06-20 18:01:39 +04:00
BX_ASSERT ( opt - > OwhichOS - > get ( ) = = Load32bitOSLinux | | opt - > OwhichOS - > get ( ) = = Load32bitOSNullKernel ) ;
2001-06-11 10:35:18 +04:00
fprintf ( fp , " load32bitOSImage: os=%s, path=%s, iolog=%s, initrd=%s \n " ,
2001-06-20 18:01:39 +04:00
( opt - > OwhichOS - > get ( ) = = Load32bitOSLinux ) ? " linux " : " nullkernel " ,
opt - > Opath - > getptr ( ) ,
opt - > Oiolog - > getptr ( ) ,
opt - > Oinitrd - > getptr ( ) ) ;
2001-06-11 10:35:18 +04:00
return 0 ;
}
int
bx_write_log_options ( FILE * fp , bx_log_options * opt )
{
2001-06-20 18:01:39 +04:00
fprintf ( fp , " log: %s \n " , opt - > Ofilename - > getptr ( ) ) ;
2002-06-26 18:42:35 +04:00
fprintf ( fp , " logprefix: %s \n " , opt - > Oprefix - > getptr ( ) ) ;
2002-12-03 00:26:05 +03:00
fprintf ( fp , " debugger_log: %s \n " , opt - > Odebugger_filename - > getptr ( ) ) ;
2001-06-11 10:35:18 +04:00
fprintf ( fp , " panic: action=%s \n " ,
2002-09-20 22:14:27 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_PANIC ) ) ) ;
2001-06-11 10:35:18 +04:00
fprintf ( fp , " error: action=%s \n " ,
2002-09-20 22:14:27 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_ERROR ) ) ) ;
2001-06-11 10:35:18 +04:00
fprintf ( fp , " info: action=%s \n " ,
2002-09-20 22:14:27 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_INFO ) ) ) ;
2001-06-11 10:35:18 +04:00
fprintf ( fp , " debug: action=%s \n " ,
2002-09-20 22:14:27 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_DEBUG ) ) ) ;
2002-12-24 12:14:54 +03:00
fprintf ( fp , " pass: action=%s \n " ,
2002-12-17 06:36:53 +03:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_PASS ) ) ) ;
2001-06-12 00:39:05 +04:00
return 0 ;
2001-06-11 10:35:18 +04:00
}
2001-12-14 20:56:37 +03:00
int
bx_write_keyboard_options ( FILE * fp , bx_keyboard_options * opt )
{
fprintf ( fp , " keyboard_mapping: enabled=%d, map=%s \n " , opt - > OuseMapping - > get ( ) , opt - > Okeymap - > getptr ( ) ) ;
return 0 ;
}
2001-06-11 10:35:18 +04:00
// return values:
// 0: written ok
// -1: failed
// -2: already exists, and overwrite was off
int
bx_write_configuration ( char * rc , int overwrite )
{
BX_INFO ( ( " write configuration to %s \n " , rc ) ) ;
// check if it exists. If so, only proceed if overwrite is set.
FILE * fp = fopen ( rc , " r " ) ;
if ( fp ! = NULL ) {
fclose ( fp ) ;
if ( ! overwrite ) return - 2 ;
}
fp = fopen ( rc , " w " ) ;
if ( fp = = NULL ) return - 1 ;
// finally it's open and we can start writing.
fprintf ( fp , " # configuration file generated by Bochs \n " ) ;
// it would be nice to put this type of function as methods on
// the structs like bx_floppy_options::print or something.
bx_write_floppy_options ( fp , 0 , & bx_options . floppya ) ;
bx_write_floppy_options ( fp , 1 , & bx_options . floppyb ) ;
2002-09-23 00:56:12 +04:00
for ( Bit8u channel = 0 ; channel < BX_MAX_ATA_CHANNEL ; channel + + ) {
bx_write_ata_options ( fp , channel , & bx_options . ata [ channel ] ) ;
bx_write_atadevice_options ( fp , channel , 0 , & bx_options . atadevice [ channel ] [ 0 ] ) ;
bx_write_atadevice_options ( fp , channel , 1 , & bx_options . atadevice [ channel ] [ 1 ] ) ;
}
2001-06-20 18:01:39 +04:00
if ( strlen ( bx_options . rom . Opath - > getptr ( ) ) > 0 )
fprintf ( fp , " romimage: file=%s, address=0x%05x \n " , bx_options . rom . Opath - > getptr ( ) , ( unsigned int ) bx_options . rom . Oaddress - > get ( ) ) ;
2001-06-11 10:35:18 +04:00
else
fprintf ( fp , " # no romimage \n " ) ;
2001-06-20 18:01:39 +04:00
if ( strlen ( bx_options . vgarom . Opath - > getptr ( ) ) > 0 )
fprintf ( fp , " vgaromimage: %s \n " , bx_options . vgarom . Opath - > getptr ( ) ) ;
2001-06-11 10:35:18 +04:00
else
fprintf ( fp , " # no vgaromimage \n " ) ;
2002-08-23 02:38:40 +04:00
if ( strlen ( bx_options . optrom [ 0 ] . Opath - > getptr ( ) ) > 0 )
fprintf ( fp , " optromimage1: file=%s, address=0x%05x \n " , bx_options . optrom [ 0 ] . Opath - > getptr ( ) , ( unsigned int ) bx_options . optrom [ 0 ] . Oaddress - > get ( ) ) ;
if ( strlen ( bx_options . optrom [ 1 ] . Opath - > getptr ( ) ) > 0 )
fprintf ( fp , " optromimage2: file=%s, address=0x%05x \n " , bx_options . optrom [ 1 ] . Opath - > getptr ( ) , ( unsigned int ) bx_options . optrom [ 1 ] . Oaddress - > get ( ) ) ;
if ( strlen ( bx_options . optrom [ 2 ] . Opath - > getptr ( ) ) > 0 )
fprintf ( fp , " optromimage3: file=%s, address=0x%05x \n " , bx_options . optrom [ 2 ] . Opath - > getptr ( ) , ( unsigned int ) bx_options . optrom [ 2 ] . Oaddress - > get ( ) ) ;
if ( strlen ( bx_options . optrom [ 3 ] . Opath - > getptr ( ) ) > 0 )
fprintf ( fp , " optromimage4: file=%s, address=0x%05x \n " , bx_options . optrom [ 3 ] . Opath - > getptr ( ) , ( unsigned int ) bx_options . optrom [ 3 ] . Oaddress - > get ( ) ) ;
2001-06-20 18:01:39 +04:00
fprintf ( fp , " megs: %d \n " , bx_options . memory . Osize - > get ( ) ) ;
2002-08-24 14:20:35 +04:00
bx_write_parport_options ( fp , & bx_options . par [ 0 ] , 1 ) ;
//bx_write_parport_options (fp, &bx_options.par[1], 2);
2002-08-24 21:11:33 +04:00
bx_write_serial_options ( fp , & bx_options . com [ 0 ] , 1 ) ;
//bx_write_serial_options (fp, &bx_options.com[1], 2);
//bx_write_serial_options (fp, &bx_options.com[2], 3);
//bx_write_serial_options (fp, &bx_options.com[3], 4);
2003-01-28 19:58:10 +03:00
bx_write_usb_options ( fp , & bx_options . usb [ 0 ] , 1 ) ;
2001-06-11 10:35:18 +04:00
bx_write_sb16_options ( fp , & bx_options . sb16 ) ;
2001-06-20 18:01:39 +04:00
int bootdrive = bx_options . Obootdrive - > get ( ) ;
2002-09-24 13:50:16 +04:00
fprintf ( fp , " boot: %s \n " , ( bootdrive = = BX_BOOT_FLOPPYA ) ? " floppy " : ( bootdrive = = BX_BOOT_DISKC ) ? " disk " : " cdrom " ) ;
2002-05-25 17:16:55 +04:00
fprintf ( fp , " floppy_bootsig_check: disabled=%d \n " , bx_options . OfloppySigCheck - > get ( ) ) ;
2001-09-11 20:56:48 +04:00
fprintf ( fp , " vga_update_interval: %u \n " , bx_options . Ovga_update_interval - > get ( ) ) ;
fprintf ( fp , " keyboard_serial_delay: %u \n " , bx_options . Okeyboard_serial_delay - > get ( ) ) ;
2002-03-26 16:51:48 +03:00
fprintf ( fp , " keyboard_paste_delay: %u \n " , bx_options . Okeyboard_paste_delay - > get ( ) ) ;
2001-09-11 20:56:48 +04:00
fprintf ( fp , " floppy_command_delay: %u \n " , bx_options . Ofloppy_command_delay - > get ( ) ) ;
2001-10-08 06:02:47 +04:00
fprintf ( fp , " ips: %u \n " , bx_options . Oips - > get ( ) ) ;
2002-12-23 13:30:13 +03:00
fprintf ( fp , " pit: realtime=%d \n " , bx_options . Orealtime_pit - > get ( ) ) ;
2002-12-12 09:21:43 +03:00
fprintf ( fp , " text_snapshot_check: %d \n " , bx_options . Otext_snapshot_check - > get ( ) ) ;
2001-06-20 18:01:39 +04:00
fprintf ( fp , " mouse: enabled=%d \n " , bx_options . Omouse_enabled - > get ( ) ) ;
fprintf ( fp , " private_colormap: enabled=%d \n " , bx_options . Oprivate_colormap - > get ( ) ) ;
2001-08-16 16:35:52 +04:00
# if BX_WITH_AMIGAOS
2001-08-16 06:00:31 +04:00
fprintf ( fp , " fullscreen: enabled=%d \n " , bx_options . Ofullscreen - > get ( ) ) ;
fprintf ( fp , " screenmode: name= \" %s \" \n " , bx_options . Oscreenmode - > getptr ( ) ) ;
# endif
2001-06-20 18:01:39 +04:00
fprintf ( fp , " i440fxsupport: enabled=%d \n " , bx_options . Oi440FXSupport - > get ( ) ) ;
fprintf ( fp , " time0: %u \n " , bx_options . cmos . Otime0 - > get ( ) ) ;
2001-06-11 10:35:18 +04:00
bx_write_ne2k_options ( fp , & bx_options . ne2k ) ;
2001-06-20 18:01:39 +04:00
fprintf ( fp , " newharddrivesupport: enabled=%d \n " , bx_options . OnewHardDriveSupport - > get ( ) ) ;
2001-06-11 10:35:18 +04:00
bx_write_loader_options ( fp , & bx_options . load32bitOSImage ) ;
bx_write_log_options ( fp , & bx_options . log ) ;
2001-12-14 20:56:37 +03:00
bx_write_keyboard_options ( fp , & bx_options . keyboard ) ;
2001-12-12 13:43:36 +03:00
fprintf ( fp , " keyboard_type: %s \n " , bx_options . Okeyboard_type - > get ( ) = = BX_KBD_XT_TYPE ? " xt " :
bx_options . Okeyboard_type - > get ( ) = = BX_KBD_AT_TYPE ? " at " : " mf " ) ;
2002-12-02 23:32:13 +03:00
fprintf ( fp , " user_shortcut: keys=%s \n " , bx_options . Ouser_shortcut - > getptr ( ) ) ;
fprintf ( fp , " config_interface: %s \n " , bx_options . Osel_config - > get_choice ( bx_options . Osel_config - > get ( ) ) ) ;
fprintf ( fp , " display_library: %s \n " , bx_options . Osel_displaylib - > get_choice ( bx_options . Osel_displaylib - > get ( ) ) ) ;
2001-06-11 10:35:18 +04:00
fclose ( fp ) ;
return 0 ;
}
2001-04-10 05:04:59 +04:00
# endif // #if BX_PROVIDE_MAIN
void
bx_signal_handler ( int signum )
{
2002-09-05 11:48:39 +04:00
// in a multithreaded environment, a signal such as SIGINT can be sent to all
// threads. This function is only intended to handle signals in the
// simulator thread. It will simply return if called from any other thread.
// Otherwise the BX_PANIC() below can be called in multiple threads at
// once, leading to multiple threads trying to display a dialog box,
// leading to GUI deadlock.
2002-10-25 01:07:56 +04:00
if ( ! SIM - > is_sim_thread ( ) ) {
2002-09-05 11:48:39 +04:00
BX_INFO ( ( " bx_signal_handler: ignored sig %d because it wasn't called from the simulator thread " , signum ) ) ;
return ;
}
2001-05-09 00:18:05 +04:00
# if BX_GUI_SIGHANDLER
2002-11-11 20:09:57 +03:00
if ( bx_gui_sighandler ) {
// GUI signal handler gets first priority, if the mask says it's wanted
if ( ( 1 < < signum ) & bx_gui - > get_sighandler_mask ( ) ) {
bx_gui - > sighandler ( signum ) ;
return ;
}
2001-05-09 00:18:05 +04:00
}
# endif
2001-04-10 05:04:59 +04:00
# if BX_SHOW_IPS
extern unsigned long ips_count ;
if ( signum = = SIGALRM ) {
2001-05-30 22:56:02 +04:00
BX_INFO ( ( " ips = %lu " , ips_count ) ) ;
2001-04-10 05:04:59 +04:00
ips_count = 0 ;
# ifndef __MINGW32__
signal ( SIGALRM , bx_signal_handler ) ;
alarm ( 1 ) ;
# endif
return ;
}
# endif
2001-05-23 12:16:07 +04:00
# if BX_GUI_SIGHANDLER
2002-11-11 20:09:57 +03:00
if ( bx_gui_sighandler ) {
if ( ( 1 < < signum ) & bx_gui - > get_sighandler_mask ( ) ) {
bx_gui - > sighandler ( signum ) ;
return ;
}
2001-05-23 12:16:07 +04:00
}
# endif
2001-05-30 22:56:02 +04:00
BX_PANIC ( ( " SIGNAL %u caught " , signum ) ) ;
2001-04-10 05:04:59 +04:00
}
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00