2004-06-05 02:06:55 +04:00
/////////////////////////////////////////////////////////////////////////
2010-07-17 01:03:52 +04:00
// $Id: config.cc,v 1.208 2010-07-16 21:03:52 sshwarts Exp $
2004-06-05 02:06:55 +04:00
/////////////////////////////////////////////////////////////////////////
//
2009-12-04 23:02:12 +03:00
// Copyright (C) 2002-2009 The Bochs Project
2004-06-05 02:06:55 +04:00
//
// 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
2009-08-22 23:30:23 +04:00
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2004-06-05 02:06:55 +04:00
# include "bochs.h"
2004-06-19 19:20:15 +04:00
# include "iodev/iodev.h"
2010-02-26 17:18:19 +03:00
# include "param_names.h"
2004-06-05 02:06:55 +04:00
# include <assert.h>
# ifdef HAVE_LOCALE_H
# include <locale.h>
# endif
# 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
int bochsrc_include_count = 0 ;
2009-01-02 14:51:03 +03:00
# if BX_PLUGINS
Bit8u bx_user_plugin_count = 0 ;
# endif
2004-06-05 02:06:55 +04:00
# define LOG_THIS genlog->
extern bx_debug_t bx_dbg ;
2007-10-25 03:29:40 +04:00
static const char * get_builtin_variable ( const char * varname ) ;
2008-03-30 18:32:14 +04:00
static int parse_line_unformatted ( const char * context , char * line ) ;
static int parse_line_formatted ( const char * context , int num_params , char * params [ ] ) ;
2006-03-13 21:55:53 +03:00
static int parse_bochsrc ( const char * rcfile ) ;
2005-11-20 20:22:44 +03:00
static int get_floppy_type_from_image ( const char * filename ) ;
2004-06-05 02:06:55 +04:00
2006-02-26 22:11:20 +03:00
static Bit64s bx_param_handler ( bx_param_c * param , int set , Bit64s val )
2004-06-05 02:06:55 +04:00
{
2006-02-24 15:05:24 +03:00
char pname [ BX_PATHNAME_LEN ] ;
2006-02-26 22:11:20 +03:00
Bit8u channel , device ;
bx_list_c * base = ( bx_list_c * ) param - > get_parent ( ) ;
base - > get_param_path ( pname , BX_PATHNAME_LEN ) ;
if ( ! strncmp ( pname , " ata. " , 4 ) ) {
channel = pname [ 4 ] - ' 0 ' ;
if ( ! strcmp ( base - > get_name ( ) , " master " ) ) {
device = 0 ;
} else {
device = 1 ;
}
if ( ! strcmp ( param - > get_name ( ) , " status " ) ) {
2006-06-05 23:06:36 +04:00
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
2006-02-26 22:11:20 +03:00
Bit32u handle = DEV_hd_get_device_handle ( channel , device ) ;
2009-03-22 23:18:17 +03:00
DEV_hd_set_cd_media_status ( handle , val ) ;
2006-02-26 22:11:20 +03:00
bx_gui - > update_drive_status_buttons ( ) ;
2004-06-05 02:06:55 +04:00
}
2006-02-26 22:11:20 +03:00
} else if ( ! strcmp ( param - > get_name ( ) , " type " ) ) {
2004-06-05 02:06:55 +04:00
if ( set ) {
switch ( val ) {
case BX_ATA_DEVICE_DISK :
2009-03-16 00:16:17 +03:00
( ( bx_param_filename_c * ) SIM - > get_param ( " path " , base ) ) - > set_extension ( " img " ) ;
2004-06-05 02:06:55 +04:00
break ;
case BX_ATA_DEVICE_CDROM :
2009-03-16 00:16:17 +03:00
( ( bx_param_filename_c * ) SIM - > get_param ( " path " , base ) ) - > set_extension ( " iso " ) ;
2004-06-05 02:06:55 +04:00
break ;
2006-02-25 01:35:46 +03:00
}
2006-02-26 22:11:20 +03:00
}
2009-03-21 03:50:53 +03:00
} else {
BX_PANIC ( ( " bx_param_handler called with unknown parameter '%s.%s' " , pname , param - > get_name ( ) ) ) ;
return - 1 ;
2006-02-26 22:11:20 +03:00
}
} else {
param - > get_param_path ( pname , BX_PATHNAME_LEN ) ;
2009-03-23 22:05:16 +03:00
if ( ( ! strcmp ( pname , BXPN_FLOPPYA_TYPE ) ) | |
( ! strcmp ( pname , BXPN_FLOPPYB_TYPE ) ) ) {
2006-02-26 22:11:20 +03:00
if ( set ) {
if ( val = = BX_FLOPPY_AUTO ) {
2009-03-23 22:05:16 +03:00
val = get_floppy_type_from_image ( SIM - > get_param_string ( " path " , base ) - > getptr ( ) ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( val ) ;
} else if ( ! SIM - > get_init_done ( ) & & ( val ! = BX_FLOPPY_NONE ) ) {
2008-05-25 10:25:44 +04:00
switch ( val ) {
case BX_FLOPPY_2_88 :
2009-03-23 22:05:16 +03:00
device = BX_FDD_350ED ;
2008-05-25 10:25:44 +04:00
break ;
case BX_FLOPPY_720K :
case BX_FLOPPY_1_44 :
2009-03-23 22:05:16 +03:00
device = BX_FDD_350HD ;
2008-05-25 10:25:44 +04:00
break ;
default :
2009-03-23 22:05:16 +03:00
device = BX_FDD_525HD ;
2008-05-25 10:25:44 +04:00
}
2009-03-23 22:05:16 +03:00
SIM - > get_param_enum ( " devtype " , base ) - > set ( device ) ;
2006-02-25 01:35:46 +03:00
}
2006-02-24 01:48:57 +03:00
}
2006-02-26 22:11:20 +03:00
} else if ( ! strcmp ( pname , BXPN_FLOPPYA_STATUS ) ) {
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
2009-03-25 21:33:43 +03:00
DEV_floppy_set_media_status ( 0 , val ) ;
2006-02-26 22:11:20 +03:00
bx_gui - > update_drive_status_buttons ( ) ;
}
} else if ( ! strcmp ( pname , BXPN_FLOPPYB_STATUS ) ) {
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
2009-03-25 21:33:43 +03:00
DEV_floppy_set_media_status ( 1 , val ) ;
2006-02-26 22:11:20 +03:00
bx_gui - > update_drive_status_buttons ( ) ;
}
2010-07-03 09:34:27 +04:00
} else if ( ! strcmp ( pname , BXPN_FLOPPYA_READONLY ) ) {
if ( set ) {
DEV_floppy_set_media_readonly ( 0 , val ) ;
}
} else if ( ! strcmp ( pname , BXPN_FLOPPYB_READONLY ) ) {
if ( set ) {
DEV_floppy_set_media_readonly ( 1 , val ) ;
}
2009-01-13 22:01:19 +03:00
} else if ( ! strcmp ( pname , BXPN_MOUSE_ENABLED ) ) {
if ( ( set ) & & ( SIM - > get_init_done ( ) ) ) {
bx_gui - > mouse_enabled_changed ( val ! = 0 ) ;
DEV_mouse_enabled_changed ( val ! = 0 ) ;
}
2006-02-26 22:11:20 +03:00
} else {
BX_PANIC ( ( " bx_param_handler called with unknown parameter '%s' " , pname ) ) ;
return - 1 ;
}
2004-06-05 02:06:55 +04:00
}
return val ;
}
2009-01-05 00:46:20 +03:00
const char * bx_param_string_handler ( bx_param_string_c * param , int set ,
const char * oldval , const char * val , int maxlen )
2004-06-05 02:06:55 +04:00
{
2006-02-24 15:05:24 +03:00
char pname [ BX_PATHNAME_LEN ] ;
2006-02-26 22:11:20 +03:00
Bit8u channel , device ;
2004-06-05 02:06:55 +04:00
int empty = 0 ;
if ( ( strlen ( val ) < 1 ) | | ! strcmp ( " none " , val ) ) {
empty = 1 ;
val = " none " ;
}
2006-02-26 22:11:20 +03:00
bx_list_c * base = ( bx_list_c * ) param - > get_parent ( ) ;
base - > get_param_path ( pname , BX_PATHNAME_LEN ) ;
if ( ! strncmp ( pname , " ata. " , 4 ) ) {
channel = pname [ 4 ] - ' 0 ' ;
if ( ! strcmp ( base - > get_name ( ) , " master " ) ) {
device = 0 ;
} else {
device = 1 ;
}
if ( ! strcmp ( param - > get_name ( ) , " path " ) ) {
2004-06-05 02:06:55 +04:00
if ( set = = 1 ) {
2006-06-05 23:06:36 +04:00
if ( SIM - > get_init_done ( ) ) {
2006-02-26 22:11:20 +03:00
Bit32u handle = DEV_hd_get_device_handle ( channel , device ) ;
2004-06-05 02:06:55 +04:00
if ( empty ) {
DEV_hd_set_cd_media_status ( handle , 0 ) ;
2006-02-26 22:11:20 +03:00
bx_gui - > update_drive_status_buttons ( ) ;
2004-06-05 02:06:55 +04:00
} else {
2006-02-26 22:11:20 +03:00
if ( ! SIM - > get_param_num ( " present " , base ) - > get ( ) ) {
2004-06-05 02:06:55 +04:00
BX_ERROR ( ( " Cannot add a cdrom drive at runtime " ) ) ;
2006-02-26 22:11:20 +03:00
SIM - > get_param_num ( " present " , base ) - > set ( 0 ) ;
2004-06-05 02:06:55 +04:00
}
2006-02-26 22:11:20 +03:00
if ( SIM - > get_param_num ( " type " , base ) - > get ( ) ! = BX_ATA_DEVICE_CDROM ) {
2004-06-05 02:06:55 +04:00
BX_ERROR ( ( " Device is not a cdrom drive " ) ) ;
2006-02-26 22:11:20 +03:00
SIM - > get_param_num ( " present " , base ) - > set ( 0 ) ;
2004-06-05 02:06:55 +04:00
}
}
if ( DEV_hd_present ( ) & &
2009-03-22 23:18:17 +03:00
( SIM - > get_param_num ( " status " , base ) - > get ( ) = = 1 ) & &
2006-02-26 22:11:20 +03:00
( SIM - > get_param_num ( " type " , base ) - > get ( ) = = BX_ATA_DEVICE_CDROM ) ) {
2004-06-05 02:06:55 +04:00
// tell the device model that we removed, then inserted the cd
DEV_hd_set_cd_media_status ( handle , 0 ) ;
DEV_hd_set_cd_media_status ( handle , 1 ) ;
}
}
}
2006-02-26 22:11:20 +03:00
}
} else {
param - > get_param_path ( pname , BX_PATHNAME_LEN ) ;
if ( ! strcmp ( pname , BXPN_SCREENMODE ) ) {
if ( set = = 1 ) {
BX_INFO ( ( " Screen mode changed to %s " , val ) ) ;
}
2009-03-23 22:05:16 +03:00
} else if ( ( ! strcmp ( pname , BXPN_FLOPPYA_PATH ) ) | |
( ! strcmp ( pname , BXPN_FLOPPYB_PATH ) ) ) {
2006-02-26 22:11:20 +03:00
if ( set = = 1 ) {
2009-03-23 22:05:16 +03:00
device = ! strcmp ( pname , BXPN_FLOPPYB_PATH ) ;
2006-02-26 22:11:20 +03:00
if ( SIM - > get_init_done ( ) ) {
if ( empty ) {
2009-03-23 22:05:16 +03:00
DEV_floppy_set_media_status ( device , 0 ) ;
2006-02-26 22:11:20 +03:00
bx_gui - > update_drive_status_buttons ( ) ;
2006-02-25 01:35:46 +03:00
} else {
2009-03-23 22:05:16 +03:00
if ( SIM - > get_param_enum ( " devtype " , base ) - > get ( ) = = BX_FDD_NONE ) {
2006-02-26 22:11:20 +03:00
BX_ERROR ( ( " Cannot add a floppy drive at runtime " ) ) ;
2009-03-23 22:05:16 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( " none " ) ;
2006-02-26 22:11:20 +03:00
}
}
if ( ( DEV_floppy_present ( ) ) & &
2009-03-25 21:33:43 +03:00
( SIM - > get_param_bool ( " status " , base ) - > get ( ) = = 1 ) ) {
2006-02-26 22:11:20 +03:00
// tell the device model that we removed, then inserted the disk
2009-03-23 22:05:16 +03:00
DEV_floppy_set_media_status ( device , 0 ) ;
DEV_floppy_set_media_status ( device , 1 ) ;
2006-02-25 01:35:46 +03:00
}
}
2006-02-22 00:35:09 +03:00
}
2009-01-05 00:46:20 +03:00
# if BX_PLUGINS
} else if ( ! strncmp ( pname , " misc.user_plugin " , 16 ) ) {
if ( ( strlen ( oldval ) > 0 ) & & ( strcmp ( oldval , " none " ) ) ) {
PLUG_unload_user_plugin ( oldval ) ;
}
if ( ( strlen ( val ) > 0 ) & & ( strcmp ( val , " none " ) ) ) {
PLUG_load_user_plugin ( val ) ;
}
# endif
2006-02-26 22:11:20 +03:00
} else {
BX_PANIC ( ( " bx_param_string_handler called with unknown parameter '%s' " , pname ) ) ;
}
2004-06-05 02:06:55 +04:00
}
return val ;
}
2006-02-19 18:43:03 +03:00
void bx_init_options ( )
2004-06-05 02:06:55 +04:00
{
int i ;
bx_list_c * menu ;
bx_list_c * deplist ;
2006-02-26 22:11:20 +03:00
bx_param_num_c * ioaddr , * ioaddr2 , * irq ;
2010-07-03 09:34:27 +04:00
bx_param_bool_c * enabled , * readonly , * status ;
2010-05-16 13:01:36 +04:00
bx_param_enum_c * mode , * type , * ethmod , * toggle ;
2006-03-02 23:13:14 +03:00
bx_param_string_c * macaddr , * ethdev ;
2006-02-25 01:35:46 +03:00
bx_param_filename_c * path ;
2006-03-02 23:13:14 +03:00
char name [ BX_PATHNAME_LEN ] , descr [ 512 ] , group [ 16 ] , label [ 512 ] ;
2004-06-05 02:06:55 +04:00
2006-02-17 00:44:17 +03:00
bx_param_c * root_param = SIM - > get_param ( " . " ) ;
2006-03-05 13:24:29 +03:00
// general options subtree
2010-02-26 01:04:31 +03:00
menu = new bx_list_c ( root_param , " general " , " " , 11 ) ;
2006-03-05 13:24:29 +03:00
2006-10-08 14:18:51 +04:00
// config interface option, set in bochsrc or command line
2007-10-25 03:29:40 +04:00
static const char * config_interface_list [ ] = {
2009-03-24 19:28:03 +03:00
# ifdef WIN32
" win32config " ,
# endif
2006-10-08 14:18:51 +04:00
# if BX_USE_TEXTCONFIG
" textconfig " ,
# endif
# if BX_WITH_WX
" wx " ,
# endif
NULL
} ;
bx_param_enum_c * sel_config = new bx_param_enum_c ( menu ,
" config_interface " , " Configuration interface " ,
" Select configuration interface " ,
config_interface_list ,
0 ,
0 ) ;
sel_config - > set_by_name ( BX_DEFAULT_CONFIG_INTERFACE ) ;
2010-02-26 01:04:31 +03:00
static const char * bochs_start_names [ ] = { " quick " , " load " , " edit " , " run " } ;
2004-06-05 02:06:55 +04:00
// quick start option, set by command line arg
2006-03-05 13:24:29 +03:00
new bx_param_enum_c ( menu ,
" start_mode " ,
2004-06-05 02:06:55 +04:00
" Bochs start types " ,
" Bochs start types " ,
bochs_start_names ,
BX_RUN_START ,
BX_QUICK_START ) ;
2006-04-07 00:42:51 +04:00
new bx_param_bool_c ( menu ,
" restore " ,
" Restore Bochs session " ,
" Restore Bochs session " ,
0 ) ;
new bx_param_string_c ( menu ,
" restore_path " ,
" Path to data for restore " ,
" Path to data for restore " ,
" " ,
BX_PATHNAME_LEN ) ;
2007-09-22 19:59:41 +04:00
// benchmarking mode, set by command line arg
new bx_param_num_c ( menu ,
" benchmark " ,
" benchmark mode " ,
" set benchmark mode " ,
0 , BX_MAX_BIT32U , 0 ) ;
2006-03-05 13:24:29 +03:00
// subtree for special menus
bx_list_c * special_menus = new bx_list_c ( root_param , " menu " , " " ) ;
2006-02-18 19:53:18 +03:00
# if BX_SUPPORT_SMP
2009-02-20 18:38:36 +03:00
# define BX_CPU_PROCESSORS_LIMIT 255
# define BX_CPU_CORES_LIMIT 8
2006-02-18 19:53:18 +03:00
# define BX_CPU_HT_THREADS_LIMIT 4
# else
# define BX_CPU_PROCESSORS_LIMIT 1
# define BX_CPU_CORES_LIMIT 1
# define BX_CPU_HT_THREADS_LIMIT 1
# endif
// cpu subtree
2010-02-26 01:04:31 +03:00
bx_list_c * cpu_param = new bx_list_c ( root_param , " cpu " , " CPU Options " , 8 + BX_SUPPORT_SMP ) ;
2006-02-18 19:53:18 +03:00
// cpu options
bx_param_num_c * nprocessors = new bx_param_num_c ( cpu_param ,
" n_processors " , " Number of CPUs in SMP mode " ,
" Sets the number of CPUs for multiprocessor emulation " ,
1 , BX_CPU_PROCESSORS_LIMIT ,
1 ) ;
nprocessors - > set_enabled ( BX_CPU_PROCESSORS_LIMIT > 1 ) ;
bx_param_num_c * ncores = new bx_param_num_c ( cpu_param ,
" n_cores " , " Number of processor cores in each CPU in SMP mode " ,
" Sets the number of processor cores per CPU for multiprocessor emulation " ,
1 , BX_CPU_CORES_LIMIT ,
1 ) ;
ncores - > set_enabled ( BX_CPU_CORES_LIMIT > 1 ) ;
bx_param_num_c * nthreads = new bx_param_num_c ( cpu_param ,
" n_threads " , " Number of HT threads per each process core in SMP mode " ,
" Sets the number of HT (Intel(R) HyperThreading Technology) threads per core for multiprocessor emulation " ,
1 , BX_CPU_HT_THREADS_LIMIT ,
1 ) ;
nthreads - > set_enabled ( BX_CPU_HT_THREADS_LIMIT > 1 ) ;
new bx_param_num_c ( cpu_param ,
" ips " , " Emulated instructions per second (IPS) " ,
" Emulated instructions per second, used to calibrate bochs emulated time with wall clock time. " ,
2009-01-20 15:37:41 +03:00
BX_MIN_IPS , BX_MAX_BIT32U ,
4000000 ) ;
2006-06-22 00:42:26 +04:00
# if BX_SUPPORT_SMP
new bx_param_num_c ( cpu_param ,
" quantum " , " Quantum ticks in SMP simulation " ,
" Maximum amount of instructions allowed to execute before returning control to another CPU. " ,
BX_SMP_QUANTUM_MIN , BX_SMP_QUANTUM_MAX ,
5 ) ;
# endif
2006-02-18 19:53:18 +03:00
new bx_param_bool_c ( cpu_param ,
" reset_on_triple_fault " , " Enable CPU reset on triple fault " ,
" Enable CPU reset if triple fault occured (highly recommended) " ,
1 ) ;
2009-11-13 18:55:46 +03:00
# if BX_CPU_LEVEL >= 5
new bx_param_bool_c ( cpu_param ,
" ignore_bad_msrs " , " Ignore RDMSR/WRMSR to unknown MSR register " ,
" Ignore RDMSR/WRMSR to unknown MSR register " ,
1 ) ;
# endif
2008-12-28 23:30:48 +03:00
# if BX_CONFIGURE_MSRS
new bx_param_string_c ( cpu_param ,
" msrs " ,
" Configurable MSR definition file " ,
" Set path to the configurable MSR definition file " ,
2008-12-28 23:49:03 +03:00
" " , BX_PATHNAME_LEN ) ;
2008-12-28 23:30:48 +03:00
# endif
2010-02-26 01:04:31 +03:00
cpu_param - > set_options ( menu - > SHOW_PARENT ) ;
// cpuid subtree
2010-07-17 01:03:52 +04:00
bx_list_c * cpuid_param = new bx_list_c ( root_param , " cpuid " , " CPUID Options " , 15 ) ;
2010-02-26 01:04:31 +03:00
new bx_param_bool_c ( cpuid_param ,
" cpuid_limit_winnt " , " Limit max CPUID function to 3 " ,
" Limit max CPUID function reported to 3 to workaround WinNT issue " ,
0 ) ;
new bx_param_string_c ( cpuid_param ,
2008-08-19 20:43:07 +04:00
" vendor_string " ,
" CPUID vendor string " ,
" Set the CPUID vendor string " ,
# if BX_CPU_VENDOR_INTEL
" GenuineIntel " ,
# else
" AuthenticAMD " ,
# endif
BX_CPUID_VENDOR_LEN + 1 ) ;
2010-02-26 01:04:31 +03:00
new bx_param_string_c ( cpuid_param ,
2008-08-19 20:43:07 +04:00
" brand_string " ,
" CPUID brand string " ,
" Set the CPUID brand string " ,
# if BX_CPU_VENDOR_INTEL
" Intel(R) Pentium(R) 4 CPU " ,
# else
" AMD Athlon(tm) processor " ,
# endif
BX_CPUID_BRAND_LEN + 1 ) ;
2010-07-17 01:03:52 +04:00
new bx_param_num_c ( cpuid_param ,
" stepping " , " Stepping ID " ,
" Processor 4-bits stepping ID " ,
0 , 15 ,
3 ) ;
2010-03-01 21:53:53 +03:00
# if BX_CPU_LEVEL >= 5
new bx_param_bool_c ( cpuid_param ,
" mmx " , " Support for MMX instruction set " ,
" Support for MMX instruction set " ,
1 ) ;
# endif
2010-02-26 01:04:31 +03:00
# if BX_CPU_LEVEL >= 6
2010-02-28 17:52:17 +03:00
// configure defaults to CPU_LEVEL = 6 with SSE2 enabled
2010-02-26 01:04:31 +03:00
static const char * sse_names [ ] = { " none " , " sse " , " sse2 " , " sse3 " , " ssse3 " , " sse4_1 " , " sse4_2 " , NULL } ;
new bx_param_enum_c ( cpuid_param ,
" sse " , " Support for SSE instruction set " ,
" Support for SSE/SSE2/SSE3/SSSE3/SSE4_1/SSE4_2 instruction set " ,
sse_names ,
2010-02-28 17:52:17 +03:00
BX_CPUID_SUPPORT_SSE2 ,
2010-02-26 01:04:31 +03:00
BX_CPUID_SUPPORT_NOSSE ) ;
2010-02-28 17:52:17 +03:00
new bx_param_bool_c ( cpuid_param ,
" xapic " , " Support for XAPIC extensions " ,
" Support for XAPIC extensions " ,
1 ) ;
new bx_param_bool_c ( cpuid_param ,
" sep " , " Support for SYSENTER/SYSEXIT instructions " ,
" Support for SYSENTER/SYSEXIT instructions " ,
1 ) ;
2010-02-26 01:04:31 +03:00
new bx_param_bool_c ( cpuid_param ,
" movbe " , " Support for MOVBE instruction " ,
" Support for MOVBE instruction " ,
0 ) ;
new bx_param_bool_c ( cpuid_param ,
" aes " , " Support for AES instruction set " ,
" Support for AES instruction set " ,
0 ) ;
2010-02-27 01:53:43 +03:00
new bx_param_bool_c ( cpuid_param ,
" xsave " , " Support for XSAVE extensions " ,
" Support for XSAVE extensions " ,
0 ) ;
2010-04-24 13:36:04 +04:00
# if BX_SUPPORT_X86_64
new bx_param_bool_c ( cpuid_param ,
" 1g_pages " , " 1G pages support in long mode " ,
" Support for 1G pages in long mode " ,
0 ) ;
2010-04-29 23:34:32 +04:00
new bx_param_bool_c ( cpuid_param ,
" pcid " , " PCID support in long mode " ,
" Support for process context ID (PCID) in long mode " ,
0 ) ;
2010-04-24 13:36:04 +04:00
# endif
2010-03-12 14:28:59 +03:00
# if BX_SUPPORT_MONITOR_MWAIT
new bx_param_bool_c ( cpuid_param ,
" mwait_is_nop " , " MWAIT enter CPU to sleep state " ,
" Don't put CPU to sleep state by MWAIT " ,
0 ) ;
# endif
2010-02-26 01:04:31 +03:00
# endif
cpuid_param - > set_options ( menu - > SHOW_PARENT ) ;
2006-02-18 19:53:18 +03:00
2006-02-17 00:44:17 +03:00
// memory subtree
2006-02-18 19:53:18 +03:00
bx_list_c * memory = new bx_list_c ( root_param , " memory " , " Memory Options " ) ;
bx_list_c * stdmem = new bx_list_c ( memory , " standard " , " Standard Options " ) ;
bx_list_c * optrom = new bx_list_c ( memory , " optrom " , " Optional ROM Images " ) ;
bx_list_c * optram = new bx_list_c ( memory , " optram " , " Optional RAM Images " ) ;
bx_list_c * ram = new bx_list_c ( stdmem , " ram " , " " ) ;
bx_list_c * rom = new bx_list_c ( stdmem , " rom " , " " ) ;
bx_list_c * vgarom = new bx_list_c ( stdmem , " vgarom " , " " ) ;
2006-02-17 00:44:17 +03:00
2005-08-07 19:50:07 +04:00
// memory options (ram & rom)
2006-02-18 01:27:38 +03:00
bx_param_num_c * ramsize = new bx_param_num_c ( ram ,
2006-02-17 00:44:17 +03:00
" size " ,
2006-02-18 19:53:18 +03:00
" Memory size (megabytes) " ,
2004-06-05 02:06:55 +04:00
" Amount of RAM in megabytes " ,
2009-10-17 21:52:26 +04:00
1 , ( ( Bit64u ) ( 1 ) < < BX_PHY_ADDRESS_WIDTH ) / ( 1024 * 1024 ) ,
2004-06-05 02:06:55 +04:00
BX_DEFAULT_MEM_MEGS ) ;
2006-02-18 01:27:38 +03:00
ramsize - > set_ask_format ( " Enter memory size (MB): [%d] " ) ;
2009-03-16 00:16:17 +03:00
ramsize - > set_options ( ramsize - > USE_SPIN_CONTROL ) ;
2004-06-05 02:06:55 +04:00
2009-10-17 21:38:58 +04:00
bx_param_num_c * host_ramsize = new bx_param_num_c ( ram ,
" host_size " ,
" Host allocated memory size (megabytes) " ,
" Amount of host allocated memory in megabytes " ,
2009-10-17 21:52:26 +04:00
1 , 2048 ,
2009-10-17 21:38:58 +04:00
BX_DEFAULT_MEM_MEGS ) ;
host_ramsize - > set_ask_format ( " Enter memory size (MB): [%d] " ) ;
host_ramsize - > set_options ( ramsize - > USE_SPIN_CONTROL ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( rom ,
2006-02-17 00:44:17 +03:00
" path " ,
2006-02-18 19:53:18 +03:00
" ROM BIOS image " ,
2005-08-07 19:50:07 +04:00
" Pathname of ROM image to load " ,
" " , BX_PATHNAME_LEN ) ;
2006-02-25 01:35:46 +03:00
path - > set_format ( " Name of ROM BIOS image: %s " ) ;
2007-10-25 03:29:40 +04:00
sprintf ( name , " %s/BIOS-bochs-latest " , ( char * ) get_builtin_variable ( " BXSHARE " ) ) ;
2006-02-25 01:35:46 +03:00
path - > set_initial_val ( name ) ;
2006-02-18 01:27:38 +03:00
bx_param_num_c * romaddr = new bx_param_num_c ( rom ,
2006-02-17 00:44:17 +03:00
" addr " ,
2006-02-18 19:53:18 +03:00
" ROM BIOS address " ,
2005-08-07 19:50:07 +04:00
" The address at which the ROM image should be loaded " ,
2008-02-06 01:57:43 +03:00
0 , BX_MAX_BIT32U ,
2005-12-27 19:59:27 +03:00
0 ) ;
2006-02-18 01:27:38 +03:00
romaddr - > set_base ( 16 ) ;
romaddr - > set_format ( " 0x%05x " ) ;
2006-02-19 18:43:03 +03:00
romaddr - > set_long_format ( " ROM BIOS address: 0x%05x " ) ;
2005-08-07 19:50:07 +04:00
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( vgarom ,
2006-02-17 00:44:17 +03:00
" path " ,
2006-02-18 19:53:18 +03:00
" VGA BIOS image " ,
2005-08-07 19:50:07 +04:00
" Pathname of VGA ROM image to load " ,
" " , BX_PATHNAME_LEN ) ;
2006-02-25 01:35:46 +03:00
path - > set_format ( " Name of VGA BIOS image: %s " ) ;
2005-08-13 20:49:11 +04:00
sprintf ( name , " %s/VGABIOS-lgpl-latest " , get_builtin_variable ( " BXSHARE " ) ) ;
2006-02-25 01:35:46 +03:00
path - > set_initial_val ( name ) ;
2006-02-18 01:27:38 +03:00
bx_param_num_c * optaddr ;
2005-08-07 19:50:07 +04:00
2005-10-28 10:33:53 +04:00
for ( i = 0 ; i < BX_N_OPTROM_IMAGES ; i + + ) {
2006-02-18 01:27:38 +03:00
sprintf ( name , " %d " , i + 1 ) ;
sprintf ( descr , " Pathname of optional ROM image #%d to load " , i + 1 ) ;
2006-02-18 19:53:18 +03:00
sprintf ( label , " Optional ROM image #%d " , i + 1 ) ;
2006-05-30 02:33:38 +04:00
bx_list_c * optnum1 = new bx_list_c ( optrom , name , label ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( optnum1 ,
2008-02-06 01:57:43 +03:00
" path " ,
2006-02-19 18:43:03 +03:00
" Path " ,
2006-05-30 21:01:27 +04:00
descr ,
2005-08-07 19:50:07 +04:00
" " , BX_PATHNAME_LEN ) ;
2006-02-18 19:53:18 +03:00
sprintf ( label , " Name of optional ROM image #%d " , i + 1 ) ;
2005-08-07 19:50:07 +04:00
strcat ( label , " : %s " ) ;
2006-02-25 01:35:46 +03:00
path - > set_format ( strdup ( label ) ) ;
2006-02-18 19:53:18 +03:00
sprintf ( descr , " The address at which the optional ROM image #%d should be loaded " , i + 1 ) ;
2006-02-18 01:27:38 +03:00
optaddr = new bx_param_num_c ( optnum1 ,
2008-02-06 01:57:43 +03:00
" addr " ,
2006-02-18 19:53:18 +03:00
" Address " ,
2006-05-30 21:01:27 +04:00
descr ,
2008-02-06 01:57:43 +03:00
0 , BX_MAX_BIT32U ,
2005-08-07 19:50:07 +04:00
0 ) ;
2006-02-18 01:27:38 +03:00
optaddr - > set_base ( 16 ) ;
optaddr - > set_format ( " 0x%05x " ) ;
2006-02-18 19:53:18 +03:00
sprintf ( label , " Optional ROM #%d address: " , i + 1 ) ;
2005-08-07 19:50:07 +04:00
strcat ( label , " 0x%05x " ) ;
2006-02-19 18:43:03 +03:00
optaddr - > set_long_format ( strdup ( label ) ) ;
2009-03-16 00:16:17 +03:00
optnum1 - > set_options ( optnum1 - > SHOW_PARENT | optnum1 - > USE_BOX_TITLE ) ;
2005-08-07 19:50:07 +04:00
}
2009-03-16 00:16:17 +03:00
optrom - > set_options ( optrom - > SHOW_PARENT ) ;
2005-08-07 19:50:07 +04:00
2006-02-17 00:44:17 +03:00
for ( i = 0 ; i < BX_N_OPTRAM_IMAGES ; i + + ) {
2006-02-18 01:27:38 +03:00
sprintf ( name , " %d " , i + 1 ) ;
sprintf ( descr , " Pathname of optional RAM image #%d to load " , i + 1 ) ;
2006-02-18 19:53:18 +03:00
sprintf ( label , " Optional RAM image #%d " , i + 1 ) ;
2006-05-30 02:33:38 +04:00
bx_list_c * optnum2 = new bx_list_c ( optram , name , label ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( optnum2 ,
2008-02-06 01:57:43 +03:00
" path " ,
2006-02-19 18:43:03 +03:00
" Path " ,
2006-05-30 21:01:27 +04:00
descr ,
2005-10-28 04:12:27 +04:00
" " , BX_PATHNAME_LEN ) ;
2006-02-18 01:27:38 +03:00
sprintf ( label , " Name of optional RAM image #%d " , i + 1 ) ;
2005-10-28 04:12:27 +04:00
strcat ( label , " : %s " ) ;
2006-02-25 01:35:46 +03:00
path - > set_format ( strdup ( label ) ) ;
2006-02-18 19:53:18 +03:00
sprintf ( descr , " The address at which the optional RAM image #%d should be loaded " , i + 1 ) ;
2006-02-18 01:27:38 +03:00
optaddr = new bx_param_num_c ( optnum2 ,
2008-02-06 01:57:43 +03:00
" addr " ,
2006-02-18 19:53:18 +03:00
" Address " ,
2006-05-30 21:01:27 +04:00
descr ,
2008-02-06 01:57:43 +03:00
0 , BX_MAX_BIT32U ,
2005-10-28 04:12:27 +04:00
0 ) ;
2006-02-18 01:27:38 +03:00
optaddr - > set_base ( 16 ) ;
optaddr - > set_format ( " 0x%05x " ) ;
sprintf ( label , " Optional RAM #%d address: " , i + 1 ) ;
2005-10-28 04:12:27 +04:00
strcat ( label , " 0x%05x " ) ;
2006-02-19 18:43:03 +03:00
optaddr - > set_long_format ( strdup ( label ) ) ;
2009-03-16 00:16:17 +03:00
optnum2 - > set_options ( optnum2 - > SHOW_PARENT | optnum2 - > USE_BOX_TITLE ) ;
2005-10-28 04:12:27 +04:00
}
2009-03-16 00:16:17 +03:00
optrom - > set_options ( optrom - > SHOW_PARENT ) ;
memory - > set_options ( memory - > USE_TAB_WINDOW ) ;
2005-10-28 04:12:27 +04:00
2005-08-07 19:50:07 +04:00
bx_param_c * memory_init_list [ ] = {
2006-02-18 01:27:38 +03:00
SIM - > get_param ( BXPN_MEM_SIZE ) ,
SIM - > get_param ( BXPN_ROM_PATH ) ,
SIM - > get_param ( BXPN_ROM_ADDRESS ) ,
SIM - > get_param ( BXPN_VGA_ROM_PATH ) ,
2006-02-19 18:43:03 +03:00
SIM - > get_param ( " memory.optrom " ) ,
SIM - > get_param ( " memory.optram " ) ,
2005-08-07 19:50:07 +04:00
NULL
} ;
2006-03-05 13:24:29 +03:00
menu = new bx_list_c ( special_menus , " memory " , " Bochs Memory Options " , memory_init_list ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
2006-02-19 18:43:03 +03:00
// clock & cmos subtree
bx_list_c * clock_cmos = new bx_list_c ( root_param , " clock_cmos " , " Clock & CMOS Options " ) ;
// clock & cmos options
2010-02-26 01:04:31 +03:00
static const char * clock_sync_names [ ] = { " none " , " realtime " , " slowdown " , " both " , NULL } ;
2006-02-19 18:43:03 +03:00
bx_param_enum_c * clock_sync = new bx_param_enum_c ( clock_cmos ,
" clock_sync " , " Synchronisation method " ,
" Host to guest time synchronization method " ,
clock_sync_names ,
BX_CLOCK_SYNC_NONE ,
BX_CLOCK_SYNC_NONE ) ;
bx_param_num_c * time0 = new bx_param_num_c ( clock_cmos ,
" time0 " ,
" Initial CMOS time for Bochs \n (1:localtime, 2:utc, other:time in seconds) " ,
" Initial time for Bochs CMOS clock, used if you really want two runs to be identical " ,
0 , BX_MAX_BIT32U ,
BX_CLOCK_TIME0_LOCAL ) ;
bx_list_c * cmosimage = new bx_list_c ( clock_cmos , " cmosimage " , " CMOS Image Options " ) ;
bx_param_bool_c * use_cmosimage = new bx_param_bool_c ( cmosimage ,
" enabled " , " Use a CMOS image " ,
" Controls the usage of a CMOS image " ,
0 ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( cmosimage ,
2006-02-19 18:43:03 +03:00
" path " , " Pathname of CMOS image " ,
" Pathname of CMOS image " ,
" " , BX_PATHNAME_LEN ) ;
bx_param_bool_c * rtc_init = new bx_param_bool_c ( cmosimage ,
" rtc_init " , " Initialize RTC from image " ,
" Controls whether to initialize the RTC with values stored in the image " ,
0 ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 2 ) ;
2006-02-25 01:35:46 +03:00
deplist - > add ( path ) ;
2006-02-19 18:43:03 +03:00
deplist - > add ( rtc_init ) ;
use_cmosimage - > set_dependent_list ( deplist ) ;
time0 - > set_ask_format ( " Enter Initial CMOS time (1:localtime, 2:utc, other:time in seconds): [%d] " ) ;
clock_sync - > set_ask_format ( " Enter Synchronisation method: [%s] " ) ;
2009-03-16 00:16:17 +03:00
clock_cmos - > set_options ( clock_cmos - > SHOW_PARENT ) ;
cmosimage - > set_options ( cmosimage - > SHOW_PARENT ) ;
2005-08-07 19:50:07 +04:00
2006-02-20 00:35:50 +03:00
// pci subtree
bx_list_c * pci = new bx_list_c ( root_param , " pci " , " PCI Options " ) ;
// pci options
2008-12-11 21:01:56 +03:00
bx_param_c * pci_deps_list [ 3 + BX_N_PCI_SLOTS + 2 * BX_SUPPORT_PCIDEV ] ;
2006-02-20 00:35:50 +03:00
bx_param_c * * pci_deps_ptr = & pci_deps_list [ 0 ] ;
bx_param_bool_c * i440fx_support = new bx_param_bool_c ( pci ,
" i440fx_support " ,
" Enable i440FX PCI Support " ,
" Controls whether to emulate the i440FX PCI chipset " ,
BX_SUPPORT_PCI ) ;
// pci slots
bx_list_c * slot = new bx_list_c ( pci , " slot " , " PCI Slots " ) ;
2006-02-21 00:29:13 +03:00
* pci_deps_ptr + + = slot ;
2006-02-20 00:35:50 +03:00
for ( i = 0 ; i < BX_N_PCI_SLOTS ; i + + ) {
sprintf ( name , " %d " , i + 1 ) ;
sprintf ( descr , " Name of the device connected to PCI slot #%d " , i + 1 ) ;
sprintf ( label , " PCI slot #%d device " , i + 1 ) ;
bx_param_string_c * devname = new bx_param_string_c ( slot ,
2008-02-06 01:57:43 +03:00
name ,
label ,
2006-05-30 21:01:27 +04:00
descr ,
2006-02-20 00:35:50 +03:00
" " , BX_PATHNAME_LEN ) ;
2006-02-21 00:29:13 +03:00
// add to deplist
2006-02-20 00:35:50 +03:00
* pci_deps_ptr + + = devname ;
}
2006-02-21 00:29:13 +03:00
// pcidev options
bx_list_c * pcidev = new bx_list_c ( pci , " pcidev " , " Host PCI Device Mapping " ) ;
* pci_deps_ptr + + = pcidev ;
bx_param_num_c * pcivid = new bx_param_num_c ( pcidev ,
" vendor " ,
" PCI Vendor ID " ,
" The vendor ID of the host PCI device to map " ,
0 , 0xffff ,
0xffff ) ; // vendor id 0xffff = no pci device present
pcivid - > set_base ( 16 ) ;
pcivid - > set_format ( " 0x%04x " ) ;
pcivid - > set_long_format ( " PCI Vendor ID: 0x%04x " ) ;
# if BX_SUPPORT_PCIDEV
* pci_deps_ptr + + = pcivid ;
# else
pcivid - > set_enabled ( 0 ) ;
# endif
bx_param_num_c * pcidid = new bx_param_num_c ( pcidev ,
" device " ,
" PCI Device ID " ,
" The device ID of the host PCI device to map " ,
0 , 0xffff ,
0x0 ) ;
pcidid - > set_base ( 16 ) ;
pcidid - > set_format ( " 0x%04x " ) ;
pcidid - > set_long_format ( " PCI Device ID: 0x%04x " ) ;
# if BX_SUPPORT_PCIDEV
* pci_deps_ptr + + = pcidid ;
# else
pcidid - > set_enabled ( 0 ) ;
# endif
2006-02-20 00:35:50 +03:00
// add final NULL at the end, and build the menu
* pci_deps_ptr = NULL ;
2006-03-05 13:24:29 +03:00
i440fx_support - > set_dependent_list ( new bx_list_c ( NULL , " " , " " , pci_deps_list ) ) ;
2009-03-16 00:16:17 +03:00
pci - > set_options ( pci - > SHOW_PARENT ) ;
slot - > set_options ( slot - > SHOW_PARENT ) ;
pcidev - > set_options ( pcidev - > SHOW_PARENT | pcidev - > USE_BOX_TITLE ) ;
2006-02-20 00:35:50 +03:00
2006-02-22 00:35:09 +03:00
// display subtree
2006-10-08 14:18:51 +04:00
bx_list_c * display = new bx_list_c ( root_param , " display " , " Bochs Display & Interface Options " , 7 ) ;
2006-02-22 00:35:09 +03:00
// 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.
2007-10-25 03:29:40 +04:00
static const char * display_library_list [ ] = {
2006-02-22 00:35:09 +03:00
# 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
# if BX_WITH_SVGA
" svga " ,
# endif
# 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_param_enum_c * sel_displaylib = new bx_param_enum_c ( display ,
" display_library " , " VGA Display Library " ,
" Select VGA Display Library " ,
display_library_list ,
0 ,
0 ) ;
sel_displaylib - > set_by_name ( BX_DEFAULT_DISPLAY_LIBRARY ) ;
sel_displaylib - > set_ask_format ( " Choose which library to use for the Bochs display: [%s] " ) ;
new bx_param_string_c ( display ,
" displaylib_options " , " Display Library options " ,
" Options passed to Display Library " ,
" " ,
BX_PATHNAME_LEN ) ;
new bx_param_bool_c ( display ,
" 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 ) ;
bx_param_bool_c * fullscreen = new bx_param_bool_c ( display ,
" fullscreen " , " Use full screen mode " ,
" When enabled, bochs occupies the whole screen instead of just a window. " ,
0 ) ;
bx_param_string_c * screenmode = new bx_param_string_c ( display ,
" screenmode " ,
" Screen mode name " ,
" Screen mode name " ,
" " , BX_PATHNAME_LEN ) ;
screenmode - > set_handler ( bx_param_string_handler ) ;
# if !BX_WITH_AMIGAOS
fullscreen - > set_enabled ( 0 ) ;
screenmode - > set_enabled ( 0 ) ;
# endif
bx_param_num_c * vga_update_interval = new bx_param_num_c ( display ,
" vga_update_interval " ,
" VGA Update Interval " ,
" Number of microseconds between VGA updates " ,
2009-01-20 15:37:41 +03:00
40000 , BX_MAX_BIT32U ,
50000 ) ;
2006-02-22 00:35:09 +03:00
vga_update_interval - > set_ask_format ( " Type a new value for VGA update interval: [%d] " ) ;
bx_param_string_c * vga_extension = new bx_param_string_c ( display ,
2008-02-06 01:57:43 +03:00
" vga_extension " ,
" VGA Extension " ,
2006-02-22 00:35:09 +03:00
" Name of the VGA extension " ,
" none " , BX_PATHNAME_LEN ) ;
# if BX_SUPPORT_VBE
vga_extension - > set_initial_val ( " vbe " ) ;
# elif BX_SUPPORT_CLGD54XX
vga_extension - > set_initial_val ( " cirrus " ) ;
# endif
2009-03-16 00:16:17 +03:00
display - > set_options ( display - > SHOW_PARENT ) ;
2006-02-22 00:35:09 +03:00
2006-02-22 22:18:29 +03:00
// keyboard & mouse subtree
bx_list_c * kbd_mouse = new bx_list_c ( root_param , " keyboard_mouse " , " Keyboard & Mouse Options " ) ;
bx_list_c * keyboard = new bx_list_c ( kbd_mouse , " keyboard " , " Keyboard Options " ) ;
bx_list_c * mouse = new bx_list_c ( kbd_mouse , " mouse " , " Mouse Options " ) ;
// keyboard & mouse options
2006-03-01 20:14:36 +03:00
type = new bx_param_enum_c ( keyboard ,
2006-02-22 22:18:29 +03:00
" type " , " Keyboard type " ,
" Keyboard type reported by the 'identify keyboard' command " ,
keyboard_type_names ,
BX_KBD_MF_TYPE ,
BX_KBD_XT_TYPE ) ;
2006-03-01 20:14:36 +03:00
type - > set_ask_format ( " Enter keyboard type: [%s] " ) ;
2006-02-22 22:18:29 +03:00
new bx_param_num_c ( keyboard ,
" serial_delay " , " Keyboard serial delay " ,
" Approximate time in microseconds that it takes one character to be transfered from the keyboard to controller over the serial path. " ,
1 , BX_MAX_BIT32U ,
250 ) ;
new bx_param_num_c ( keyboard ,
" paste_delay " , " Keyboard paste delay " ,
" Approximate time in microseconds between attemps to paste characters to the keyboard controller. " ,
1000 , BX_MAX_BIT32U ,
100000 ) ;
bx_param_bool_c * use_kbd_mapping = new bx_param_bool_c ( keyboard ,
" use_mapping " , " Use keyboard mapping " ,
" Controls whether to use the keyboard mapping feature " ,
0 ) ;
bx_param_filename_c * keymap = new bx_param_filename_c ( keyboard ,
" keymap " , " Keymap filename " ,
" Pathname of the keymap file used " ,
" " , BX_PATHNAME_LEN ) ;
2009-03-16 00:16:17 +03:00
keymap - > set_extension ( " map " ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
2006-02-22 22:18:29 +03:00
deplist - > add ( keymap ) ;
use_kbd_mapping - > set_dependent_list ( deplist ) ;
bx_param_string_c * user_shortcut = new bx_param_string_c ( keyboard ,
" user_shortcut " ,
" Userbutton shortcut " ,
" Defines the keyboard shortcut to be sent when you press the 'user' button in the headerbar. " ,
" none " , 20 ) ;
user_shortcut - > set_runtime_param ( 1 ) ;
2007-10-25 03:29:40 +04:00
static const char * mouse_type_list [ ] = {
2006-02-22 22:18:29 +03:00
" none " ,
" ps2 " ,
" imps2 " ,
# if BX_SUPPORT_BUSMOUSE
" bus " ,
# endif
" serial " ,
" serial_wheel " ,
2006-12-31 14:56:14 +03:00
" serial_msys " ,
2006-02-22 22:18:29 +03:00
NULL
} ;
2006-03-01 20:14:36 +03:00
type = new bx_param_enum_c ( mouse ,
2006-02-22 22:18:29 +03:00
" type " , " Mouse type " ,
" The mouse type can be one of these: 'none', 'ps2', 'imps2', 'serial', 'serial_wheel' "
# if BX_SUPPORT_BUSMOUSE
" , 'bus' "
# endif
,
mouse_type_list ,
BX_MOUSE_TYPE_PS2 ,
BX_MOUSE_TYPE_NONE ) ;
2006-03-01 20:14:36 +03:00
type - > set_ask_format ( " Choose the type of mouse [%s] " ) ;
2006-02-22 22:18:29 +03:00
2009-01-13 22:01:19 +03:00
enabled = new bx_param_bool_c ( mouse ,
2009-03-10 22:33:03 +03:00
" enabled " , " Enable mouse capture " ,
2006-02-22 22:18:29 +03:00
" Controls whether the mouse sends events to the guest. The hardware emulation is always enabled. " ,
0 ) ;
2009-01-13 22:01:19 +03:00
enabled - > set_handler ( bx_param_handler ) ;
enabled - > set_runtime_param ( 1 ) ;
2010-05-16 13:01:36 +04:00
static const char * mouse_toggle_list [ ] = {
" ctrl+mbutton " ,
" ctrl+f10 " ,
" ctrl+alt " ,
2010-05-18 19:33:41 +04:00
" f12 " ,
2010-05-16 13:01:36 +04:00
NULL
} ;
toggle = new bx_param_enum_c ( mouse ,
" toggle " , " Mouse toggle method " ,
" The mouse toggle method can be one of these: 'ctrl+mbutton', 'ctrl+f10', 'ctrl+alt' " ,
mouse_toggle_list ,
BX_MOUSE_TOGGLE_CTRL_MB ,
BX_MOUSE_TOGGLE_CTRL_MB ) ;
toggle - > set_ask_format ( " Choose the mouse toggle method [%s] " ) ;
2009-03-16 00:16:17 +03:00
kbd_mouse - > set_options ( kbd_mouse - > SHOW_PARENT ) ;
keyboard - > set_options ( keyboard - > SHOW_PARENT ) ;
mouse - > set_options ( mouse - > SHOW_PARENT ) ;
2006-02-22 22:18:29 +03:00
2006-02-24 01:48:57 +03:00
// boot parameter subtree
bx_list_c * boot_params = new bx_list_c ( root_param , " boot_params " , " Boot Options " ) ;
// boot sequence
for ( i = 0 ; i < 3 ; i + + ) {
sprintf ( name , " boot_drive%d " , i + 1 ) ;
sprintf ( label , " Boot drive #%d " , i + 1 ) ;
sprintf ( descr , " Name of drive #%d in boot sequence (A, C or CD) " , i + 1 ) ;
bx_param_enum_c * bootdrive = new bx_param_enum_c ( boot_params ,
2006-05-30 02:33:38 +04:00
name ,
2006-05-30 21:01:27 +04:00
label ,
descr ,
2006-02-24 01:48:57 +03:00
& bochs_bootdisk_names [ ( i = = 0 ) ? BX_BOOT_FLOPPYA : BX_BOOT_NONE ] ,
( i = = 0 ) ? BX_BOOT_FLOPPYA : BX_BOOT_NONE ,
( i = = 0 ) ? BX_BOOT_FLOPPYA : BX_BOOT_NONE ) ;
bootdrive - > set_ask_format ( " Boot from floppy drive, hard drive or cdrom ? [%s] " ) ;
}
new bx_param_bool_c ( boot_params ,
" floppy_sig_check " ,
" Skip Floppy Boot Signature Check " ,
" Skips check for the 0xaa55 signature on floppy boot device. " ,
0 ) ;
// loader hack
bx_list_c * load32bitos = new bx_list_c ( boot_params , " load32bitos " , " 32-bit OS Loader Hack " ) ;
2010-02-27 01:53:43 +03:00
static const char * loader_os_names [ ] = { " none " , " linux " , " nullkernel " , NULL } ;
2006-02-24 01:48:57 +03:00
bx_param_enum_c * whichOS = new bx_param_enum_c ( load32bitos ,
" which " ,
" Which operating system? " ,
" Which OS to boot " ,
loader_os_names ,
Load32bitOSNone ,
Load32bitOSNone ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( load32bitos ,
2006-02-24 01:48:57 +03:00
" path " ,
" Pathname of OS to load " ,
" Pathname of the 32-bit OS to load " ,
" " , BX_PATHNAME_LEN ) ;
bx_param_filename_c * iolog = new bx_param_filename_c ( load32bitos ,
" iolog " ,
" Pathname of I/O log file " ,
" I/O logfile used for initializing the hardware " ,
" " , BX_PATHNAME_LEN ) ;
bx_param_filename_c * initrd = new bx_param_filename_c ( load32bitos ,
" initrd " ,
" Pathname of initrd " ,
" Pathname of the initial ramdisk " ,
" " , BX_PATHNAME_LEN ) ;
whichOS - > set_ask_format ( " Enter OS to load: [%s] " ) ;
path - > set_ask_format ( " Enter pathname of OS: [%s] " ) ;
iolog - > set_ask_format ( " Enter pathname of I/O log: [%s] " ) ;
initrd - > set_ask_format ( " Enter pathname of initrd: [%s] " ) ;
2009-03-16 00:16:17 +03:00
load32bitos - > set_options ( menu - > SERIES_ASK ) ;
2009-03-17 23:20:57 +03:00
whichOS - > set_dependent_list ( load32bitos - > clone ( ) , 1 ) ;
2009-03-17 00:07:44 +03:00
whichOS - > set_dependent_bitmap ( Load32bitOSNone , 0 ) ;
2006-02-24 01:48:57 +03:00
whichOS - > set ( Load32bitOSNone ) ;
2009-03-16 00:16:17 +03:00
boot_params - > set_options ( menu - > SHOW_PARENT ) ;
2006-02-25 01:35:46 +03:00
// floppy subtree
bx_list_c * floppy = new bx_list_c ( root_param , " floppy " , " Floppy Options " ) ;
2009-03-23 22:05:16 +03:00
bx_list_c * floppya = new bx_list_c ( floppy , " 0 " , " First Floppy Drive " ) ;
bx_list_c * floppyb = new bx_list_c ( floppy , " 1 " , " Second Floppy Drive " ) ;
2006-02-25 01:35:46 +03:00
2006-03-01 20:14:36 +03:00
bx_param_enum_c * devtype ;
2006-02-25 01:35:46 +03:00
// floppy options
2009-03-23 22:05:16 +03:00
devtype = new bx_param_enum_c ( floppya ,
" devtype " ,
" Type of floppy drive " ,
" Type of floppy drive " ,
floppy_devtype_names ,
BX_FDD_NONE ,
BX_FDD_NONE ) ;
devtype - > set_ask_format ( " What type of floppy drive? [%s] " ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( floppya ,
" path " ,
" First floppy image/device " ,
" Pathname of first floppy image file or device. If you're booting from floppy, this should be a bootable floppy. " ,
" " , BX_PATHNAME_LEN ) ;
path - > set_ask_format ( " Enter new filename, or 'none' for no disk: [%s] " ) ;
2009-03-16 00:16:17 +03:00
path - > set_extension ( " img " ) ;
2009-03-29 15:13:49 +04:00
path - > set_handler ( bx_param_string_handler ) ;
path - > set_initial_val ( " none " ) ;
2006-02-25 01:35:46 +03:00
path - > set_runtime_param ( 1 ) ;
type = new bx_param_enum_c ( floppya ,
" type " ,
2009-03-23 22:05:16 +03:00
" Type of floppy media " ,
" Type of floppy media " ,
2006-02-25 01:35:46 +03:00
floppy_type_names ,
BX_FLOPPY_NONE ,
BX_FLOPPY_NONE ) ;
2009-03-23 22:05:16 +03:00
type - > set_ask_format ( " What type of floppy media? (auto=detect) [%s] " ) ;
2009-03-29 15:13:49 +04:00
type - > set_handler ( bx_param_handler ) ;
2006-02-25 01:35:46 +03:00
type - > set_runtime_param ( 1 ) ;
2010-07-03 09:34:27 +04:00
readonly = new bx_param_bool_c ( floppya ,
" readonly " ,
" Write Protection " ,
" Floppy media write protection " ,
0 ) ;
readonly - > set_ask_format ( " Is media write protected? [%s] " ) ;
readonly - > set_handler ( bx_param_handler ) ;
readonly - > set_runtime_param ( 1 ) ;
2009-03-25 21:33:43 +03:00
status = new bx_param_bool_c ( floppya ,
2006-02-25 01:35:46 +03:00
" status " ,
2009-03-25 21:33:43 +03:00
" Inserted " ,
" Floppy media status (inserted / ejected) " ,
0 ) ;
status - > set_ask_format ( " Is media inserted in drive? [%s] " ) ;
2009-03-29 15:13:49 +04:00
status - > set_handler ( bx_param_handler ) ;
2006-02-25 01:35:46 +03:00
status - > set_runtime_param ( 1 ) ;
2009-03-23 22:05:16 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
deplist - > add ( path ) ;
devtype - > set_dependent_list ( deplist , 1 ) ;
devtype - > set_dependent_bitmap ( BX_FDD_NONE , 0 ) ;
2009-03-29 15:13:49 +04:00
2010-07-03 09:34:27 +04:00
deplist = new bx_list_c ( NULL , 3 ) ;
2009-03-29 15:13:49 +04:00
deplist - > add ( type ) ;
2010-07-03 09:34:27 +04:00
deplist - > add ( readonly ) ;
2009-03-29 15:13:49 +04:00
deplist - > add ( status ) ;
path - > set_dependent_list ( deplist ) ;
2009-03-23 22:05:16 +03:00
floppya - > set_options ( floppya - > SERIES_ASK | floppya - > USE_BOX_TITLE ) ;
devtype = new bx_param_enum_c ( floppyb ,
" devtype " ,
" Type of floppy drive " ,
" Type of floppy drive " ,
floppy_devtype_names ,
BX_FDD_NONE ,
BX_FDD_NONE ) ;
devtype - > set_ask_format ( " What type of floppy drive? [%s] " ) ;
2006-02-25 01:35:46 +03:00
path = new bx_param_filename_c ( floppyb ,
" path " ,
" Second floppy image/device " ,
" Pathname of second floppy image file or device. " ,
" " , BX_PATHNAME_LEN ) ;
path - > set_ask_format ( " Enter new filename, or 'none' for no disk: [%s] " ) ;
2009-03-16 00:16:17 +03:00
path - > set_extension ( " img " ) ;
2009-03-29 15:13:49 +04:00
path - > set_handler ( bx_param_string_handler ) ;
path - > set_initial_val ( " none " ) ;
2006-02-25 01:35:46 +03:00
path - > set_runtime_param ( 1 ) ;
type = new bx_param_enum_c ( floppyb ,
" type " ,
2009-03-23 22:05:16 +03:00
" Type of floppy media " ,
" Type of floppy media " ,
2006-02-25 01:35:46 +03:00
floppy_type_names ,
BX_FLOPPY_NONE ,
BX_FLOPPY_NONE ) ;
2009-03-23 22:05:16 +03:00
type - > set_ask_format ( " What type of floppy media? (auto=detect) [%s] " ) ;
2009-03-29 15:13:49 +04:00
type - > set_handler ( bx_param_handler ) ;
2006-02-25 01:35:46 +03:00
type - > set_runtime_param ( 1 ) ;
2010-07-03 09:34:27 +04:00
readonly = new bx_param_bool_c ( floppyb ,
" readonly " ,
" Write Protection " ,
" Floppy media write protection " ,
0 ) ;
readonly - > set_ask_format ( " Is media write protected? [%s] " ) ;
readonly - > set_handler ( bx_param_handler ) ;
readonly - > set_runtime_param ( 1 ) ;
2009-03-25 21:33:43 +03:00
status = new bx_param_bool_c ( floppyb ,
2006-02-25 01:35:46 +03:00
" status " ,
2009-03-25 21:33:43 +03:00
" Inserted " ,
" Floppy media status (inserted / ejected) " ,
0 ) ;
status - > set_ask_format ( " Is media inserted in drive? [%s] " ) ;
2009-03-29 15:13:49 +04:00
status - > set_handler ( bx_param_handler ) ;
2006-02-25 01:35:46 +03:00
status - > set_runtime_param ( 1 ) ;
2009-03-23 22:05:16 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
deplist - > add ( path ) ;
devtype - > set_dependent_list ( deplist , 1 ) ;
devtype - > set_dependent_bitmap ( BX_FDD_NONE , 0 ) ;
2009-03-29 15:13:49 +04:00
2010-07-03 09:34:27 +04:00
deplist = new bx_list_c ( NULL , 3 ) ;
2009-03-29 15:13:49 +04:00
deplist - > add ( type ) ;
2010-07-03 09:34:27 +04:00
deplist - > add ( readonly ) ;
2009-03-29 15:13:49 +04:00
deplist - > add ( status ) ;
path - > set_dependent_list ( deplist ) ;
2009-03-23 22:05:16 +03:00
floppyb - > set_options ( floppyb - > SERIES_ASK | floppyb - > USE_BOX_TITLE ) ;
2009-03-16 00:16:17 +03:00
floppy - > set_options ( floppy - > SHOW_PARENT ) ;
2006-02-25 01:35:46 +03:00
2006-02-26 22:11:20 +03:00
// ATA/ATAPI subtree
bx_list_c * ata = new bx_list_c ( root_param , " ata " , " ATA/ATAPI Options " ) ;
2009-03-16 00:16:17 +03:00
ata - > set_options ( ata - > USE_TAB_WINDOW ) ;
2006-02-26 22:11:20 +03:00
// disk options
2007-10-25 03:29:40 +04:00
const char * s_atachannel [ ] = {
2006-02-26 22:11:20 +03:00
" ATA channel 0 " ,
" ATA channel 1 " ,
" ATA channel 2 " ,
" ATA channel 3 " ,
} ;
2007-10-25 03:29:40 +04:00
const char * s_atadevname [ 2 ] = {
2006-02-26 22:11:20 +03:00
" master " ,
" slave " ,
} ;
2007-10-25 03:29:40 +04:00
const char * s_atadevice [ 4 ] [ 2 ] = {
2006-02-26 22:11:20 +03: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 " }
} ;
2006-02-27 12:37:58 +03:00
Bit16u ata_default_ioaddr1 [ 4 ] = {
2008-02-06 01:57:43 +03:00
0x1f0 , 0x170 , 0x1e8 , 0x168
2006-02-26 22:11:20 +03:00
} ;
2006-02-27 12:37:58 +03:00
Bit16u ata_default_ioaddr2 [ 4 ] = {
2008-02-06 01:57:43 +03:00
0x3f0 , 0x370 , 0x3e0 , 0x360
2006-02-26 22:11:20 +03:00
} ;
2008-02-06 01:57:43 +03:00
Bit8u ata_default_irq [ 4 ] = {
14 , 15 , 11 , 9
2006-02-26 22:11:20 +03:00
} ;
2006-03-08 21:10:41 +03:00
# define BXP_PARAMS_PER_ATA_DEVICE 12
2006-02-26 22:11:20 +03:00
bx_list_c * ata_menu [ BX_MAX_ATA_CHANNEL ] ;
bx_list_c * ata_res [ BX_MAX_ATA_CHANNEL ] ;
Bit8u channel ;
for ( channel = 0 ; channel < BX_MAX_ATA_CHANNEL ; channel + + ) {
sprintf ( name , " %d " , channel ) ;
2006-05-30 02:33:38 +04:00
ata_menu [ channel ] = new bx_list_c ( ata , name , s_atachannel [ channel ] ) ;
2009-03-16 00:16:17 +03:00
ata_menu [ channel ] - > set_options ( bx_list_c : : USE_TAB_WINDOW ) ;
2006-02-26 22:11:20 +03:00
ata_res [ channel ] = new bx_list_c ( ata_menu [ channel ] , " resources " , s_atachannel [ channel ] , 8 ) ;
2009-03-16 00:16:17 +03:00
ata_res [ channel ] - > set_options ( bx_list_c : : SERIES_ASK ) ;
2006-02-26 22:11:20 +03:00
enabled = new bx_param_bool_c ( ata_res [ channel ] ,
2008-02-06 01:57:43 +03:00
" enabled " ,
2006-02-26 22:11:20 +03:00
" Enable ATA channel " ,
" Controls whether ata channel is installed or not " ,
0 ) ;
enabled - > set_ask_format ( " Channel is enabled: [%s] " ) ;
ioaddr = new bx_param_num_c ( ata_res [ channel ] ,
" ioaddr1 " ,
" I/O Address 1 " ,
" IO adress of ata command block " ,
0 , 0xffff ,
ata_default_ioaddr1 [ channel ] ) ;
ioaddr - > set_base ( 16 ) ;
ioaddr - > set_ask_format ( " Enter new ioaddr1: [0x%x] " ) ;
ioaddr2 = new bx_param_num_c ( ata_res [ channel ] ,
" ioaddr2 " ,
" I/O Address 2 " ,
" IO adress of ata control block " ,
0 , 0xffff ,
ata_default_ioaddr2 [ channel ] ) ;
ioaddr2 - > set_base ( 16 ) ;
ioaddr2 - > set_ask_format ( " Enter new ioaddr2: [0x%x] " ) ;
irq = new bx_param_num_c ( ata_res [ channel ] ,
" irq " ,
" IRQ " ,
" IRQ used by this ata channel " ,
0 , 15 ,
ata_default_irq [ channel ] ) ;
irq - > set_ask_format ( " Enter new IRQ: [%d] " ) ;
2009-03-16 00:16:17 +03:00
irq - > set_options ( irq - > USE_SPIN_CONTROL ) ;
2006-02-26 22:11:20 +03:00
// all items in the ata[channel] menu depend on the enabled 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.
enabled - > set_dependent_list ( ata_res [ channel ] - > clone ( ) ) ;
for ( Bit8u slave = 0 ; slave < 2 ; slave + + ) {
menu = new bx_list_c ( ata_menu [ channel ] ,
2006-05-30 02:33:38 +04:00
s_atadevname [ slave ] ,
2006-02-26 22:11:20 +03:00
s_atadevice [ channel ] [ slave ] ,
BXP_PARAMS_PER_ATA_DEVICE + 1 ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SERIES_ASK ) ;
2006-02-26 22:11:20 +03:00
bx_param_bool_c * present = new bx_param_bool_c ( menu ,
2008-02-06 01:57:43 +03:00
" present " ,
2006-02-26 22:11:20 +03:00
" Enable this device " ,
" Controls whether ata device is installed or not " ,
0 ) ;
present - > set_ask_format ( " Device is enabled: [%s] " ) ;
2010-02-26 01:04:31 +03:00
static const char * atadevice_type_names [ ] = { " disk " , " cdrom " , NULL } ;
2006-03-01 20:14:36 +03:00
type = new bx_param_enum_c ( menu ,
2006-02-26 22:11:20 +03:00
" type " ,
" Type of ATA device " ,
" Type of ATA device (disk or cdrom) " ,
atadevice_type_names ,
BX_ATA_DEVICE_DISK ,
BX_ATA_DEVICE_DISK ) ;
type - > set_ask_format ( " Enter type of ATA device, disk or cdrom: [%s] " ) ;
path = new bx_param_filename_c ( menu ,
" path " ,
" Path or physical device name " ,
" Pathname of the image or physical device (cdrom only) " ,
" " , BX_PATHNAME_LEN ) ;
path - > set_ask_format ( " Enter new filename: [%s] " ) ;
2009-03-16 00:16:17 +03:00
path - > set_extension ( " img " ) ;
2006-02-26 22:11:20 +03:00
2006-03-01 20:14:36 +03:00
mode = new bx_param_enum_c ( menu ,
2006-02-26 22:11:20 +03:00
" mode " ,
" Type of disk image " ,
" Mode of the ATA harddisk " ,
atadevice_mode_names ,
BX_ATA_MODE_FLAT ,
BX_ATA_MODE_FLAT ) ;
mode - > set_ask_format ( " Enter mode of ATA device, (flat, concat, etc.): [%s] " ) ;
2009-03-25 21:33:43 +03:00
status = new bx_param_bool_c ( menu ,
2006-02-26 22:11:20 +03:00
" status " ,
" Inserted " ,
" CD-ROM media status (inserted / ejected) " ,
2009-03-22 23:18:17 +03:00
0 ) ;
2009-03-25 21:33:43 +03:00
status - > set_ask_format ( " Is media inserted in drive? [%s] " ) ;
2006-02-26 22:11:20 +03:00
bx_param_filename_c * journal = new bx_param_filename_c ( menu ,
" journal " ,
" Path of journal file " ,
" Pathname of the journal file " ,
" " , BX_PATHNAME_LEN ) ;
journal - > set_ask_format ( " Enter path of journal file: [%s] " ) ;
2009-03-17 22:37:20 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
deplist - > add ( journal ) ;
mode - > set_dependent_list ( deplist , 0 ) ;
mode - > set_dependent_bitmap ( BX_ATA_MODE_UNDOABLE , 1 ) ;
mode - > set_dependent_bitmap ( BX_ATA_MODE_VOLATILE , 1 ) ;
2006-02-26 22:11:20 +03:00
bx_param_num_c * cylinders = new bx_param_num_c ( menu ,
" cylinders " ,
" Cylinders " ,
" Number of cylinders " ,
0 , 262143 ,
0 ) ;
cylinders - > set_ask_format ( " Enter number of cylinders: [%d] " ) ;
bx_param_num_c * heads = new bx_param_num_c ( menu ,
" heads " ,
" Heads " ,
" Number of heads " ,
0 , 255 ,
0 ) ;
heads - > set_ask_format ( " Enter number of heads: [%d] " ) ;
bx_param_num_c * spt = new bx_param_num_c ( menu ,
" spt " ,
" Sectors per track " ,
" Number of sectors per track " ,
0 , 255 ,
0 ) ;
spt - > set_ask_format ( " Enter number of sectors per track: [%d] " ) ;
bx_param_string_c * model = new bx_param_string_c ( menu ,
" model " ,
" Model name " ,
" String returned by the 'identify device' command " ,
2008-07-27 12:06:52 +04:00
" Generic 1234 " , 41 ) ;
2006-02-26 22:11:20 +03:00
model - > set_ask_format ( " Enter new model name: [%s] " ) ;
2010-02-26 01:04:31 +03:00
static const char * atadevice_biosdetect_names [ ] = { " none " , " auto " , " cmos " , NULL } ;
2006-02-26 22:11:20 +03:00
bx_param_enum_c * biosdetect = new bx_param_enum_c ( menu ,
" biosdetect " ,
" BIOS Detection " ,
" Type of bios detection " ,
atadevice_biosdetect_names ,
BX_ATA_BIOSDETECT_AUTO ,
BX_ATA_BIOSDETECT_NONE ) ;
biosdetect - > set_ask_format ( " Enter bios detection type: [%s] " ) ;
2010-02-26 01:04:31 +03:00
static const char * atadevice_translation_names [ ] = { " none " , " lba " , " large " , " rechs " , " auto " , NULL } ;
2006-02-26 22:11:20 +03:00
bx_param_enum_c * translation = new bx_param_enum_c ( menu ,
" translation " ,
" Translation type " ,
" How the ata-disk translation is done by the bios " ,
atadevice_translation_names ,
BX_ATA_TRANSLATION_AUTO ,
BX_ATA_TRANSLATION_NONE ) ;
translation - > set_ask_format ( " Enter translation type: [%s] " ) ;
// the menu and all items on it depend on the present flag
2009-03-17 22:37:20 +03:00
deplist = new bx_list_c ( NULL , 4 ) ;
deplist - > add ( type ) ;
deplist - > add ( path ) ;
deplist - > add ( model ) ;
deplist - > add ( biosdetect ) ;
present - > set_dependent_list ( deplist ) ;
2006-02-26 22:11:20 +03:00
// the master/slave menu depends on the ATA channel's enabled flag
enabled - > get_dependent_list ( ) - > add ( menu ) ;
2009-03-17 22:37:20 +03:00
// the present flag depends on the ATA channel's enabled flag
enabled - > get_dependent_list ( ) - > add ( present ) ;
2006-02-26 22:11:20 +03:00
2009-03-17 00:07:44 +03:00
// some items depend on the drive type
bx_param_c * type_deplist [ ] = {
mode ,
2009-03-25 21:33:43 +03:00
status ,
2009-03-17 00:07:44 +03:00
cylinders ,
heads ,
spt ,
translation ,
NULL
} ;
deplist = new bx_list_c ( NULL , " deplist " , " " , type_deplist ) ;
2009-03-17 22:37:20 +03:00
type - > set_dependent_list ( deplist , 0 ) ;
2009-03-17 00:07:44 +03:00
type - > set_dependent_bitmap ( BX_ATA_DEVICE_DISK , 0x3d ) ;
type - > set_dependent_bitmap ( BX_ATA_DEVICE_CDROM , 0x02 ) ;
2006-02-26 22:11:20 +03:00
type - > set_handler ( bx_param_handler ) ;
2009-03-25 21:33:43 +03:00
status - > set_handler ( bx_param_handler ) ;
2006-02-26 22:11:20 +03:00
path - > set_handler ( bx_param_string_handler ) ;
}
// Enable two ATA interfaces by default, disable the others.
// Now that the dependence relationships are established, call set() on
// the ata device present params to set all enables correctly.
2006-02-27 01:36:01 +03:00
enabled - > set_initial_val ( channel < 2 ) ;
enabled - > set ( channel < 2 ) ;
2006-02-26 22:11:20 +03:00
}
2006-02-25 01:35:46 +03:00
// disk menu
bx_param_c * disk_menu_init_list [ ] = {
SIM - > get_param ( BXPN_FLOPPYA ) ,
SIM - > get_param ( BXPN_FLOPPYB ) ,
2006-02-26 22:11:20 +03:00
SIM - > get_param ( BXPN_ATA0_RES ) ,
SIM - > get_param ( BXPN_ATA0_MASTER ) ,
SIM - > get_param ( BXPN_ATA0_SLAVE ) ,
2006-02-25 01:35:46 +03:00
# if BX_MAX_ATA_CHANNEL>1
2006-02-26 22:11:20 +03:00
SIM - > get_param ( BXPN_ATA1_RES ) ,
SIM - > get_param ( BXPN_ATA1_MASTER ) ,
SIM - > get_param ( BXPN_ATA1_SLAVE ) ,
2006-02-25 01:35:46 +03:00
# endif
# if BX_MAX_ATA_CHANNEL>2
2006-02-26 22:11:20 +03:00
SIM - > get_param ( BXPN_ATA2_RES ) ,
SIM - > get_param ( BXPN_ATA2_MASTER ) ,
SIM - > get_param ( BXPN_ATA2_SLAVE ) ,
2006-02-25 01:35:46 +03:00
# endif
# if BX_MAX_ATA_CHANNEL>3
2006-02-26 22:11:20 +03:00
SIM - > get_param ( BXPN_ATA3_RES ) ,
SIM - > get_param ( BXPN_ATA3_MASTER ) ,
SIM - > get_param ( BXPN_ATA3_SLAVE ) ,
2006-02-25 01:35:46 +03:00
# endif
SIM - > get_param ( " boot_params " ) ,
NULL
} ;
2006-03-05 13:24:29 +03:00
menu = new bx_list_c ( special_menus , " disk " , " Bochs Disk Options " , disk_menu_init_list ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
// disk menu for win32paramdlg
bx_param_c * disk_menu2_init_list [ ] = {
SIM - > get_param ( " floppy " ) ,
SIM - > get_param ( " ata.0 " ) ,
# if BX_MAX_ATA_CHANNEL>1
SIM - > get_param ( " ata.1 " ) ,
# endif
# if BX_MAX_ATA_CHANNEL>2
SIM - > get_param ( " ata.2 " ) ,
# endif
# if BX_MAX_ATA_CHANNEL>3
SIM - > get_param ( " ata.3 " ) ,
# endif
SIM - > get_param ( " boot_params " ) ,
NULL
} ;
menu = new bx_list_c ( special_menus , " disk_win32 " , " Bochs Disk Options " , disk_menu2_init_list ) ;
menu - > set_options ( menu - > USE_TAB_WINDOW ) ;
2006-02-24 01:48:57 +03:00
2006-03-01 20:14:36 +03:00
// ports subtree
bx_list_c * ports = new bx_list_c ( root_param , " ports " , " Serial and Parallel Port Options " ) ;
2009-03-16 00:16:17 +03:00
ports - > set_options ( ports - > USE_TAB_WINDOW | ports - > SHOW_PARENT ) ;
2004-06-05 02:06:55 +04:00
// parallel ports
2006-03-01 20:14:36 +03:00
bx_list_c * parallel = new bx_list_c ( ports , " parallel " , " Parallel Port Options " ) ;
2009-03-16 00:16:17 +03:00
parallel - > set_options ( parallel - > SHOW_PARENT ) ;
2004-06-05 02:06:55 +04:00
for ( i = 0 ; i < BX_N_PARALLEL_PORTS ; i + + ) {
2006-03-01 20:14:36 +03:00
sprintf ( name , " %d " , i + 1 ) ;
sprintf ( label , " Parallel Port %d " , i + 1 ) ;
2006-05-30 02:33:38 +04:00
menu = new bx_list_c ( parallel , name , label ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SERIES_ASK ) ;
2006-03-01 20:14:36 +03:00
sprintf ( label , " Enable parallel port #%d " , i + 1 ) ;
sprintf ( descr , " Controls whether parallel port #%d is installed or not " , i + 1 ) ;
2006-05-30 21:01:27 +04:00
enabled = new bx_param_bool_c ( menu , " enabled " , label , descr ,
2006-03-01 20:14:36 +03:00
( i = = 0 ) ? 1 : 0 ) ; // only enable #1 by default
sprintf ( label , " 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 ) ;
2006-05-30 21:01:27 +04:00
path = new bx_param_filename_c ( menu , " outfile " , label , descr ,
2006-03-01 20:14:36 +03:00
" " , BX_PATHNAME_LEN ) ;
2009-03-16 00:16:17 +03:00
path - > set_extension ( " out " ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
2006-03-01 20:14:36 +03:00
deplist - > add ( path ) ;
enabled - > set_dependent_list ( deplist ) ;
2004-06-05 02:06:55 +04:00
}
2007-10-25 03:29:40 +04:00
static const char * serial_mode_list [ ] = {
2004-07-28 23:36:42 +04:00
" null " ,
" file " ,
2008-05-22 12:13:22 +04:00
" pipe " ,
" pipe-client " ,
" pipe-server " ,
2004-07-28 23:36:42 +04:00
" term " ,
" raw " ,
2004-11-27 13:09:41 +03:00
" mouse " ,
2005-07-10 20:51:09 +04:00
" socket " ,
2008-05-22 12:13:22 +04:00
" socket-client " ,
" socket-server " ,
2004-07-28 23:36:42 +04:00
NULL
} ;
2004-06-05 02:06:55 +04:00
// serial ports
2006-03-01 20:14:36 +03:00
bx_list_c * serial = new bx_list_c ( ports , " serial " , " Serial Port Options " ) ;
2009-03-16 00:16:17 +03:00
serial - > set_options ( serial - > SHOW_PARENT ) ;
2004-06-05 02:06:55 +04:00
for ( i = 0 ; i < BX_N_SERIAL_PORTS ; i + + ) {
2006-03-01 20:14:36 +03:00
sprintf ( name , " %d " , i + 1 ) ;
sprintf ( label , " Serial Port %d " , i + 1 ) ;
2006-05-30 02:33:38 +04:00
menu = new bx_list_c ( serial , name , label ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SERIES_ASK ) ;
2006-03-01 20:14:36 +03:00
sprintf ( label , " Enable serial port #%d (COM%d) " , i + 1 , i + 1 ) ;
sprintf ( descr , " Controls whether COM%d is installed or not " , i + 1 ) ;
2008-02-06 01:57:43 +03:00
enabled = new bx_param_bool_c ( menu , " enabled " , label , descr ,
2006-03-01 20:14:36 +03:00
( i = = 0 ) ? 1 : 0 ) ; // only enable the first by default
sprintf ( label , " I/O mode of the serial device for COM%d " , i + 1 ) ;
2008-05-22 12:13:22 +04:00
sprintf ( descr , " The mode can be one these: 'null', 'file', 'pipe', 'term', 'raw', 'mouse', 'socket' " ) ;
2006-05-30 21:01:27 +04:00
mode = new bx_param_enum_c ( menu , " mode " , label , descr ,
serial_mode_list , 0 , 0 ) ;
2006-03-01 20:14:36 +03:00
mode - > set_ask_format ( " Choose I/O mode of the serial device [%s] " ) ;
sprintf ( label , " Pathname of the serial device for COM%d " , i + 1 ) ;
sprintf ( descr , " The path can be a real serial device or a pty (X/Unix only) " ) ;
2008-02-06 01:57:43 +03:00
path = new bx_param_filename_c ( menu , " dev " , label , descr ,
2006-03-01 20:14:36 +03:00
" " , BX_PATHNAME_LEN ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 2 ) ;
2006-03-01 20:14:36 +03:00
deplist - > add ( mode ) ;
deplist - > add ( path ) ;
enabled - > set_dependent_list ( deplist ) ;
2004-06-05 02:06:55 +04:00
}
2009-01-19 16:13:32 +03:00
// usb subtree
2009-01-20 00:39:03 +03:00
bx_list_c * usb = new bx_list_c ( ports , " usb " , " USB Configuration " ) ;
2009-03-16 00:16:17 +03:00
usb - > set_options ( usb - > SHOW_PARENT ) ;
2007-03-18 20:52:15 +03:00
bx_param_string_c * port ;
2006-03-01 20:14:36 +03:00
2009-01-19 16:13:32 +03:00
// UHCI options
strcpy ( group , " USB UHCI " ) ;
menu = new bx_list_c ( usb , " uhci " , " UHCI Configuration " ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
2009-01-19 16:13:32 +03:00
menu - > set_enabled ( BX_SUPPORT_USB_UHCI ) ;
enabled = new bx_param_bool_c ( menu ,
" enabled " ,
" Enable UHCI emulation " ,
" Enables the UHCI emulation " ,
0 ) ;
enabled - > set_enabled ( BX_SUPPORT_USB_UHCI ) ;
2009-03-15 15:54:59 +03:00
deplist = new bx_list_c ( NULL , 2 ) ;
for ( i = 0 ; i < BX_N_USB_UHCI_PORTS ; i + + ) {
sprintf ( name , " port%d " , i + 1 ) ;
sprintf ( label , " Port #%d device " , i + 1 ) ;
sprintf ( descr , " Device connected to UHCI port #%d " , i + 1 ) ;
port = new bx_param_string_c ( menu , name , label , descr , " " , BX_PATHNAME_LEN ) ;
port - > set_group ( group ) ;
deplist - > add ( port ) ;
}
enabled - > set_dependent_list ( deplist ) ;
2009-01-19 16:13:32 +03:00
// OHCI options
strcpy ( group , " USB OHCI " ) ;
menu = new bx_list_c ( usb , " ohci " , " OHCI Configuration " ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
2009-01-19 16:13:32 +03:00
menu - > set_enabled ( BX_SUPPORT_USB_OHCI ) ;
enabled = new bx_param_bool_c ( menu ,
" enabled " ,
" Enable OHCI emulation " ,
" Enables the OHCI emulation " ,
0 ) ;
enabled - > set_enabled ( BX_SUPPORT_USB_OHCI ) ;
2009-03-15 15:54:59 +03:00
deplist = new bx_list_c ( NULL , 2 ) ;
for ( i = 0 ; i < BX_N_USB_OHCI_PORTS ; i + + ) {
sprintf ( name , " port%d " , i + 1 ) ;
sprintf ( label , " Port #%d device " , i + 1 ) ;
sprintf ( descr , " Device connected to OHCI port #%d " , i + 1 ) ;
port = new bx_param_string_c ( menu , name , label , descr , " " , BX_PATHNAME_LEN ) ;
port - > set_group ( group ) ;
deplist - > add ( port ) ;
}
enabled - > set_dependent_list ( deplist ) ;
2004-06-05 02:06:55 +04:00
2006-03-02 23:13:14 +03:00
// network subtree
bx_list_c * network = new bx_list_c ( root_param , " network " , " Network Configuration " ) ;
2009-03-16 00:16:17 +03:00
network - > set_options ( network - > USE_TAB_WINDOW | network - > SHOW_PARENT ) ;
2006-03-02 23:13:14 +03:00
// ne2k & pnic options
2007-10-25 03:29:40 +04:00
static const char * eth_module_list [ ] = {
2004-06-05 02:06:55 +04:00
" null " ,
# if defined(ETH_LINUX)
" linux " ,
# endif
# if HAVE_ETHERTAP
" tap " ,
# endif
# if HAVE_TUNTAP
" tuntap " ,
# endif
# if defined(ETH_WIN32)
" win32 " ,
# endif
# if defined(ETH_FBSD)
" fbsd " ,
# endif
# ifdef ETH_ARPBACK
" arpback " ,
2004-10-07 21:38:03 +04:00
# endif
# if HAVE_VDE
" vde " ,
2004-06-05 02:06:55 +04:00
# endif
" vnet " ,
NULL
} ;
2006-03-02 23:13:14 +03:00
// ne2k options
menu = new bx_list_c ( network , " ne2k " , " NE2000 " , 7 ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
2006-03-02 00:24:20 +03:00
menu - > set_enabled ( BX_SUPPORT_NE2K ) ;
2006-03-02 23:13:14 +03:00
enabled = new bx_param_bool_c ( menu ,
" enabled " ,
" Enable NE2K NIC emulation " ,
" Enables the NE2K NIC emulation " ,
0 ) ;
enabled - > set_enabled ( BX_SUPPORT_NE2K ) ;
ioaddr = new bx_param_num_c ( menu ,
" ioaddr " ,
" NE2K I/O Address " ,
" I/O base address of the emulated NE2K device " ,
0 , 0xffff ,
2006-09-12 23:26:12 +04:00
0x300 ) ;
2006-03-02 23:13:14 +03:00
ioaddr - > set_base ( 16 ) ;
irq = new bx_param_num_c ( menu ,
" irq " ,
" NE2K Interrupt " ,
" IRQ used by the NE2K device " ,
0 , 15 ,
9 ) ;
2009-03-16 00:16:17 +03:00
irq - > set_options ( irq - > USE_SPIN_CONTROL ) ;
2006-03-02 23:13:14 +03:00
macaddr = new bx_param_string_c ( menu ,
" macaddr " ,
" MAC Address " ,
" MAC address of the NE2K device. Don't use an address of a machine on your net. " ,
2009-01-02 17:16:16 +03:00
" " , 6 ) ;
2009-03-16 00:16:17 +03:00
macaddr - > set_options ( macaddr - > RAW_BYTES ) ;
2009-01-02 17:16:16 +03:00
macaddr - > set_initial_val ( " \xfe \xfd \xde \xad \xbe \xef " ) ;
2006-03-02 23:13:14 +03:00
macaddr - > set_separator ( ' : ' ) ;
ethmod = new bx_param_enum_c ( menu ,
" ethmod " ,
" Ethernet module " ,
" Module used for the connection to the real net. " ,
eth_module_list ,
0 ,
0 ) ;
ethmod - > set_by_name ( " null " ) ;
ethmod - > set_ask_format ( " Choose ethernet module for the NE2K [%s] " ) ;
ethdev = new bx_param_string_c ( menu ,
" ethdev " ,
" Ethernet device " ,
" Device used for the connection to the real net. This is only valid if an ethernet module other than 'null' is used. " ,
" xl0 " , BX_PATHNAME_LEN ) ;
path = new bx_param_filename_c ( menu ,
" script " ,
" Device configuration script " ,
" Name of the script that is executed after Bochs initializes the network interface (optional). " ,
" none " , BX_PATHNAME_LEN ) ;
2009-03-17 22:37:20 +03:00
path - > set_ask_format ( " Enter new script name, or 'none': [%s] " ) ;
2006-03-02 23:13:14 +03:00
enabled - > set_dependent_list ( menu - > clone ( ) ) ;
// pnic options
menu = new bx_list_c ( network , " pnic " , " PCI Pseudo NIC " ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
2006-03-02 00:24:20 +03:00
menu - > set_enabled ( BX_SUPPORT_PCIPNIC ) ;
2006-03-02 23:13:14 +03:00
enabled = new bx_param_bool_c ( menu ,
" enabled " ,
" Enable Pseudo NIC emulation " ,
" Enables the Pseudo NIC emulation " ,
0 ) ;
enabled - > set_enabled ( BX_SUPPORT_PCIPNIC ) ;
macaddr = new bx_param_string_c ( menu ,
" macaddr " ,
" MAC Address " ,
" MAC address of the Pseudo NIC device. Don't use an address of a machine on your net. " ,
2009-01-02 17:16:16 +03:00
" " , 6 ) ;
2009-03-16 00:16:17 +03:00
macaddr - > set_options ( macaddr - > RAW_BYTES ) ;
2009-01-02 17:16:16 +03:00
macaddr - > set_initial_val ( " \xfe \xfd \xde \xad \xbe \xef " ) ;
2006-03-02 23:13:14 +03:00
macaddr - > set_separator ( ' : ' ) ;
ethmod = new bx_param_enum_c ( menu ,
" ethmod " ,
" Ethernet module " ,
" Module used for the connection to the real net. " ,
eth_module_list ,
0 ,
0 ) ;
ethmod - > set_by_name ( " null " ) ;
ethmod - > set_ask_format ( " Choose ethernet module for the Pseudo NIC [%s] " ) ;
ethdev = new bx_param_string_c ( menu ,
" ethdev " ,
" Ethernet device " ,
" Device used for the connection to the real net. This is only valid if an ethernet module other than 'null' is used. " ,
" xl0 " , BX_PATHNAME_LEN ) ;
path = new bx_param_filename_c ( menu ,
" script " ,
" Device configuration script " ,
" Name of the script that is executed after Bochs initializes the network interface (optional). " ,
" none " , BX_PATHNAME_LEN ) ;
path - > set_ask_format ( " Enter new script name, or 'none': [%s] " ) ;
enabled - > set_dependent_list ( menu - > clone ( ) ) ;
2004-06-05 02:06:55 +04:00
2006-03-03 23:29:50 +03:00
// sound subtree
bx_list_c * sound = new bx_list_c ( root_param , " sound " , " Sound Configuration " ) ;
2009-03-16 00:16:17 +03:00
sound - > set_options ( sound - > SHOW_PARENT ) ;
2006-03-03 23:29:50 +03:00
menu = new bx_list_c ( sound , " sb16 " , " SB16 Configuration " , 8 ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT ) ;
2006-03-03 23:29:50 +03:00
menu - > set_enabled ( BX_SUPPORT_SB16 ) ;
2004-06-05 02:06:55 +04:00
// SB16 options
2006-03-03 23:29:50 +03:00
enabled = new bx_param_bool_c ( menu ,
" enabled " ,
" Enable SB16 emulation " ,
" Enables the SB16 emulation " ,
0 ) ;
enabled - > set_enabled ( BX_SUPPORT_SB16 ) ;
bx_param_num_c * midimode = new bx_param_num_c ( menu ,
" midimode " ,
" Midi mode " ,
" Controls the MIDI output format. " ,
0 , 3 ,
0 ) ;
bx_param_filename_c * midifile = new bx_param_filename_c ( menu ,
" midifile " ,
" MIDI file " ,
" The filename is where the MIDI data is sent. This can be device or just a file. " ,
" " , BX_PATHNAME_LEN ) ;
bx_param_num_c * wavemode = new bx_param_num_c ( menu ,
" wavemode " ,
" Wave mode " ,
" Controls the wave output format. " ,
0 , 3 ,
0 ) ;
bx_param_filename_c * wavefile = new bx_param_filename_c ( menu ,
" wavefile " ,
" Wave file " ,
" This is the device/file where the wave output is stored " ,
" " , BX_PATHNAME_LEN ) ;
bx_param_num_c * loglevel = new bx_param_num_c ( menu ,
" loglevel " ,
" Log level " ,
" Controls how verbose the SB16 emulation is (0 = no log, 5 = all errors and infos). " ,
0 , 5 ,
0 ) ;
bx_param_filename_c * logfile = new bx_param_filename_c ( menu ,
" logfile " ,
" Log file " ,
" The file to write the SB16 emulator messages to. " ,
" " , BX_PATHNAME_LEN ) ;
2009-03-16 00:16:17 +03:00
logfile - > set_extension ( " log " ) ;
2006-03-03 23:29:50 +03:00
bx_param_num_c * dmatimer = new bx_param_num_c ( menu ,
" dmatimer " ,
" DMA timer " ,
" Microseconds per second for a DMA cycle. " ,
0 , BX_MAX_BIT32U ,
0 ) ;
2004-06-05 02:06:55 +04:00
2009-03-16 00:16:17 +03:00
midimode - > set_options ( midimode - > USE_SPIN_CONTROL ) ;
wavemode - > set_options ( wavemode - > USE_SPIN_CONTROL ) ;
loglevel - > set_options ( loglevel - > USE_SPIN_CONTROL ) ;
2006-03-03 23:29:50 +03:00
loglevel - > set_group ( " SB16 " ) ;
dmatimer - > set_group ( " SB16 " ) ;
2009-03-17 22:37:20 +03:00
deplist = new bx_list_c ( NULL , 4 ) ;
2009-03-17 00:07:44 +03:00
deplist - > add ( midimode ) ;
deplist - > add ( wavemode ) ;
deplist - > add ( loglevel ) ;
2009-03-17 22:37:20 +03:00
deplist - > add ( dmatimer ) ;
2009-03-17 00:07:44 +03:00
enabled - > set_dependent_list ( deplist ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
2006-03-03 23:29:50 +03:00
deplist - > add ( midifile ) ;
midimode - > set_dependent_list ( deplist ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
2006-03-03 23:29:50 +03:00
deplist - > add ( wavefile ) ;
wavemode - > set_dependent_list ( deplist ) ;
2006-03-07 23:32:07 +03:00
deplist = new bx_list_c ( NULL , 1 ) ;
2006-03-03 23:29:50 +03:00
deplist - > add ( logfile ) ;
loglevel - > set_dependent_list ( deplist ) ;
2004-06-05 02:06:55 +04:00
2006-03-04 15:43:47 +03:00
// misc options subtree
bx_list_c * misc = new bx_list_c ( root_param , " misc " , " Configure Everything Else " ) ;
2009-03-16 00:16:17 +03:00
misc - > set_options ( misc - > SHOW_PARENT ) ;
2006-03-04 15:43:47 +03:00
bx_param_num_c * gdbstub_opt ;
2009-04-26 10:56:28 +04:00
// port e9 hack
new bx_param_bool_c ( misc ,
" port_e9_hack " ,
" Enable port 0xE9 hack " ,
" Debug messages written to i/o port 0xE9 will be displayed on console " ,
0 ) ;
2006-03-04 15:43:47 +03:00
// text snapshot check panic
new bx_param_bool_c ( misc ,
" text_snapshot_check " ,
2006-03-02 23:13:14 +03:00
" Enable text snapshot check panic " ,
2006-03-02 00:24:20 +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. " ,
0 ) ;
2009-04-26 10:56:28 +04:00
2004-06-05 02:06:55 +04:00
// GDB stub
2006-03-04 15:43:47 +03:00
menu = new bx_list_c ( misc , " gdbstub " , " GDB Stub Options " ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT | menu - > USE_BOX_TITLE ) ;
2006-03-04 15:43:47 +03:00
menu - > set_enabled ( BX_GDBSTUB ) ;
enabled = new bx_param_bool_c ( menu ,
" enabled " ,
" Enable GDB stub " ,
" " ,
0 ) ;
enabled - > set_enabled ( BX_GDBSTUB ) ;
gdbstub_opt = new bx_param_num_c ( menu ,
" port " ,
" Port " ,
" TCP/IP port for GDB stub " ,
0 , 65535 ,
1234 ) ;
gdbstub_opt = new bx_param_num_c ( menu ,
" text_base " ,
" Text base " ,
" " ,
0 , BX_MAX_BIT32U ,
0 ) ;
gdbstub_opt = new bx_param_num_c ( menu ,
" data_base " ,
" Data base " ,
" " ,
0 , BX_MAX_BIT32U ,
0 ) ;
gdbstub_opt = new bx_param_num_c ( menu ,
" bss_base " ,
" BSS base " ,
" " ,
0 , BX_MAX_BIT32U ,
0 ) ;
enabled - > set_dependent_list ( menu - > clone ( ) ) ;
2004-06-05 02:06:55 +04:00
2009-02-21 14:43:18 +03:00
// optional plugin control
2009-02-22 13:44:50 +03:00
menu = new bx_list_c ( misc , " plugin_ctrl " , " Optional Plugin Control " , 9 ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT | menu - > USE_BOX_TITLE ) ;
2009-02-22 20:05:40 +03:00
new bx_param_bool_c ( menu , " unmapped " , " Enable 'unmapped' " , " " , 1 ) ;
new bx_param_bool_c ( menu , " biosdev " , " Enable 'biosdev' " , " " , 1 ) ;
new bx_param_bool_c ( menu , " speaker " , " Enable 'speaker' " , " " , 1 ) ;
new bx_param_bool_c ( menu , " extfpuirq " , " Enable 'extfpuirq' " , " " , 1 ) ;
2009-02-21 14:43:18 +03:00
# if BX_SUPPORT_GAMEPORT
2009-02-22 20:05:40 +03:00
new bx_param_bool_c ( menu , " gameport " , " Enable 'gameport' " , " " , 1 ) ;
2009-02-21 14:43:18 +03:00
# endif
# if BX_SUPPORT_IODEBUG
2009-02-22 20:05:40 +03:00
new bx_param_bool_c ( menu , " iodebug " , " Enable 'iodebug' " , " " , 1 ) ;
2009-02-21 14:43:18 +03:00
# endif
# if BX_SUPPORT_PCI
2009-02-22 20:05:40 +03:00
new bx_param_bool_c ( menu , " pci_ide " , " Enable 'pci_ide' " , " " , 1 ) ;
2009-02-21 14:43:18 +03:00
# endif
# if BX_SUPPORT_ACPI
2009-02-22 20:05:40 +03:00
new bx_param_bool_c ( menu , " acpi " , " Enable 'acpi' " , " " , 1 ) ;
2009-02-21 14:43:18 +03:00
# endif
2009-02-22 13:44:50 +03:00
# if BX_SUPPORT_APIC
2009-02-22 20:05:40 +03:00
new bx_param_bool_c ( menu , " ioapic " , " Enable 'ioapic' " , " " , 1 ) ;
2009-02-22 13:44:50 +03:00
# endif
2009-02-21 14:43:18 +03:00
2009-01-02 14:51:03 +03:00
# if BX_PLUGINS
// user plugin options
menu = new bx_list_c ( misc , " user_plugin " , " User Plugin Options " , BX_N_USER_PLUGINS ) ;
2009-03-16 00:16:17 +03:00
menu - > set_options ( menu - > SHOW_PARENT | menu - > USE_BOX_TITLE ) ;
2009-01-02 14:51:03 +03:00
for ( i = 0 ; i < BX_N_USER_PLUGINS ; i + + ) {
sprintf ( name , " %d " , i + 1 ) ;
sprintf ( label , " User Plugin #%d " , i + 1 ) ;
2009-01-05 00:46:20 +03:00
sprintf ( descr , " User-defined plugin device #%d " , i + 1 ) ;
bx_param_string_c * plugin = new bx_param_string_c ( menu , name , label , descr ,
2009-01-02 14:51:03 +03:00
" " , BX_PATHNAME_LEN ) ;
2009-01-05 00:46:20 +03:00
plugin - > set_handler ( bx_param_string_handler ) ;
2009-01-02 14:51:03 +03:00
}
2009-01-05 00:46:20 +03:00
// user-defined options subtree
bx_list_c * user = new bx_list_c ( root_param , " user " , " User-defined options " , 16 ) ;
2009-03-16 00:16:17 +03:00
user - > set_options ( user - > SHOW_PARENT ) ;
2009-01-02 14:51:03 +03:00
# endif
2006-03-05 13:24:29 +03:00
// log options subtree
menu = new bx_list_c ( root_param , " log " , " Logfile Options " ) ;
2006-03-03 23:29:50 +03:00
// log options
2006-03-05 13:24:29 +03:00
path = new bx_param_filename_c ( menu ,
" filename " ,
2006-03-03 23:29:50 +03:00
" Log filename " ,
" Pathname of bochs log file " ,
" - " , BX_PATHNAME_LEN ) ;
2006-03-05 13:24:29 +03:00
path - > set_ask_format ( " Enter log filename: [%s] " ) ;
2009-03-16 00:16:17 +03:00
path - > set_extension ( " txt " ) ;
2006-03-03 23:29:50 +03:00
2006-03-05 13:24:29 +03:00
bx_param_string_c * prefix = new bx_param_string_c ( menu ,
" prefix " ,
2006-03-03 23:29:50 +03:00
" Log output prefix " ,
" Prefix prepended to log output " ,
" %t%e%d " , BX_PATHNAME_LEN ) ;
2006-03-05 13:24:29 +03:00
prefix - > set_ask_format ( " Enter log prefix: [%s] " ) ;
2006-03-03 23:29:50 +03:00
2006-03-05 13:24:29 +03:00
path = new bx_param_filename_c ( menu ,
" debugger_filename " ,
2006-03-03 23:29:50 +03:00
" Debugger Log filename " ,
" Pathname of debugger log file " ,
" - " , BX_PATHNAME_LEN ) ;
2006-03-05 13:24:29 +03:00
path - > set_ask_format ( " Enter debugger log filename: [%s] " ) ;
2009-03-16 00:16:17 +03:00
path - > set_extension ( " log " ) ;
2006-03-05 13:24:29 +03:00
path - > set_enabled ( BX_DEBUGGER ) ;
2006-03-03 23:29:50 +03:00
2009-03-30 00:48:17 +04:00
// runtime options
menu = new bx_list_c ( special_menus , " runtime " , " Runtime options " ) ;
bx_list_c * cdrom = new bx_list_c ( menu , " cdrom " , " CD-ROM options " , 10 ) ;
cdrom - > set_options ( cdrom - > SHOW_PARENT ) ;
usb = new bx_list_c ( menu , " usb " , " USB options " , 10 ) ;
usb - > set_options ( usb - > SHOW_PARENT | usb - > SHOW_GROUP_NAME ) ;
2009-03-04 21:20:50 +03:00
// misc runtime options
2009-03-30 00:48:17 +04:00
bx_param_c * rt_misc_init_list [ ] = {
2006-02-22 00:35:09 +03:00
SIM - > get_param_num ( BXPN_VGA_UPDATE_INTERVAL ) ,
2006-02-22 22:18:29 +03:00
SIM - > get_param_bool ( BXPN_MOUSE_ENABLED ) ,
SIM - > get_param_num ( BXPN_KBD_PASTE_DELAY ) ,
SIM - > get_param_string ( BXPN_USER_SHORTCUT ) ,
2006-03-03 23:29:50 +03:00
SIM - > get_param_num ( BXPN_SB16_DMATIMER ) ,
SIM - > get_param_num ( BXPN_SB16_LOGLEVEL ) ,
2004-06-05 02:06:55 +04:00
NULL
} ;
2009-03-30 00:48:17 +04:00
misc = new bx_list_c ( menu , " misc " , " Misc options " , rt_misc_init_list ) ;
misc - > set_options ( misc - > SHOW_PARENT | misc - > SHOW_GROUP_NAME ) ;
2004-06-05 02:06:55 +04:00
}
2006-03-02 23:13:14 +03:00
void bx_reset_options ( )
2004-06-05 02:06:55 +04:00
{
2006-02-18 19:53:18 +03:00
// cpu
SIM - > get_param ( " cpu " ) - > reset ( ) ;
2010-02-26 01:04:31 +03:00
// cpuid
SIM - > get_param ( " cpuid " ) - > reset ( ) ;
2005-08-07 19:50:07 +04:00
// memory (ram & rom)
2006-02-17 00:44:17 +03:00
SIM - > get_param ( " memory " ) - > reset ( ) ;
2004-06-05 02:06:55 +04:00
2006-02-19 18:43:03 +03:00
// clock & cmos
SIM - > get_param ( " clock_cmos " ) - > reset ( ) ;
2006-02-20 00:35:50 +03:00
// pci
SIM - > get_param ( " pci " ) - > reset ( ) ;
2006-02-22 00:35:09 +03:00
// display & interface
SIM - > get_param ( " display " ) - > reset ( ) ;
2006-02-22 22:18:29 +03:00
// keyboard & mouse
SIM - > get_param ( " keyboard_mouse " ) - > reset ( ) ;
2006-02-24 01:48:57 +03:00
// boot
SIM - > get_param ( " boot_params " ) - > reset ( ) ;
2006-02-25 01:35:46 +03:00
// floppy drives
SIM - > get_param ( " floppy " ) - > reset ( ) ;
2006-02-26 22:11:20 +03:00
// ata/atapi drives
SIM - > get_param ( " ata " ) - > reset ( ) ;
2009-01-20 12:26:26 +03:00
// serial/parallel/usb
2006-03-01 20:14:36 +03:00
SIM - > get_param ( " ports " ) - > reset ( ) ;
2004-06-05 02:06:55 +04:00
2006-03-02 23:13:14 +03:00
// ne2k & pnic
SIM - > get_param ( " network " ) - > reset ( ) ;
2005-09-23 01:12:26 +04:00
2004-06-05 02:06:55 +04:00
// SB16
2006-03-03 23:29:50 +03:00
SIM - > get_param ( " sound " ) - > reset ( ) ;
// misc
2006-03-04 15:43:47 +03:00
SIM - > get_param ( " misc " ) - > reset ( ) ;
2004-06-05 02:06:55 +04:00
// logfile
2006-03-05 13:24:29 +03:00
SIM - > get_param ( " log " ) - > reset ( ) ;
2009-01-02 14:51:03 +03:00
# if BX_PLUGINS
2009-01-05 00:46:20 +03:00
// user-defined options
SIM - > get_param ( " user " ) - > reset ( ) ;
2009-01-02 14:51:03 +03:00
bx_user_plugin_count = 0 ;
# endif
2004-06-05 02:06:55 +04:00
}
2006-03-13 21:55:53 +03:00
int bx_read_configuration ( const char * rcfile )
2004-06-05 02:06:55 +04:00
{
// parse rcfile first, then parse arguments in order.
BX_INFO ( ( " reading configuration from %s " , rcfile ) ) ;
if ( parse_bochsrc ( rcfile ) < 0 ) {
BX_PANIC ( ( " reading from %s failed " , rcfile ) ) ;
return - 1 ;
}
// update log actions
for ( int level = 0 ; level < N_LOGLEV ; level + + ) {
2008-09-13 01:05:49 +04:00
int action = SIM - > get_default_log_action ( level ) ;
io - > set_log_action ( level , action ) ;
2004-06-05 02:06:55 +04:00
}
return 0 ;
}
2008-03-30 18:32:14 +04:00
int bx_parse_cmdline ( int arg , int argc , char * argv [ ] )
2004-06-05 02:06:55 +04:00
{
//if (arg < argc) BX_INFO (("parsing command line arguments"));
while ( arg < argc ) {
BX_INFO ( ( " parsing arg %d, %s " , arg , argv [ arg ] ) ) ;
parse_line_unformatted ( " cmdline args " , argv [ arg ] ) ;
arg + + ;
}
// update log actions
for ( int level = 0 ; level < N_LOGLEV ; level + + ) {
2008-09-13 01:05:49 +04:00
int action = SIM - > get_default_log_action ( level ) ;
io - > set_log_action ( level , action ) ;
2004-06-05 02:06:55 +04:00
}
return 0 ;
}
2006-06-05 23:06:36 +04:00
char * bx_find_bochsrc ( )
2004-06-05 02:06:55 +04:00
{
FILE * fd = NULL ;
char rcfile [ 512 ] ;
Bit32u retry = 0 , found = 0 ;
// try several possibilities for the bochsrc before giving up
while ( ! found ) {
rcfile [ 0 ] = 0 ;
switch ( retry + + ) {
case 0 : strcpy ( rcfile , " .bochsrc " ) ; break ;
case 1 : strcpy ( rcfile , " bochsrc " ) ; break ;
case 2 : strcpy ( rcfile , " bochsrc.txt " ) ; break ;
# ifdef WIN32
case 3 : strcpy ( rcfile , " bochsrc.bxrc " ) ; break ;
# elif !BX_WITH_MACOS
// only try this on unix
case 3 :
{
2006-01-23 21:39:10 +03:00
char * ptr = getenv ( " HOME " ) ;
if ( ptr ) snprintf ( rcfile , sizeof ( rcfile ) , " %s/.bochsrc " , ptr ) ;
2004-06-05 02:06:55 +04:00
}
break ;
2006-01-23 21:39:10 +03:00
case 4 : strcpy ( rcfile , " /etc/bochsrc " ) ; break ;
2004-06-05 02:06:55 +04:00
# endif
default :
return NULL ;
}
if ( rcfile [ 0 ] ) {
BX_DEBUG ( ( " looking for configuration in %s " , rcfile ) ) ;
fd = fopen ( rcfile , " r " ) ;
if ( fd ) found = 1 ;
}
}
assert ( fd ! = NULL & & rcfile [ 0 ] ! = 0 ) ;
fclose ( fd ) ;
2006-05-30 21:01:27 +04:00
return strdup ( rcfile ) ;
2004-06-05 02:06:55 +04:00
}
2006-03-13 21:55:53 +03:00
static int parse_bochsrc ( const char * rcfile )
2004-06-05 02:06:55 +04:00
{
FILE * fd = NULL ;
char * ret ;
char line [ 512 ] ;
2007-04-03 19:47:23 +04:00
char context [ BX_PATHNAME_LEN ] ;
Bit32u linenum = 1 ;
2004-06-05 02:06:55 +04:00
// try several possibilities for the bochsrc before giving up
bochsrc_include_count + + ;
fd = fopen ( rcfile , " r " ) ;
if ( fd = = NULL ) return - 1 ;
int retval = 0 ;
do {
ret = fgets ( line , sizeof ( line ) - 1 , fd ) ;
line [ sizeof ( line ) - 1 ] = ' \0 ' ;
2007-12-23 20:21:28 +03:00
size_t len = strlen ( line ) ;
2004-08-01 23:17:18 +04:00
if ( ( len > 0 ) & & ( line [ len - 1 ] < ' ' ) )
2004-06-05 02:06:55 +04:00
line [ len - 1 ] = ' \0 ' ;
if ( ( ret ! = NULL ) & & strlen ( line ) ) {
2007-04-03 19:47:23 +04:00
sprintf ( context , " %s:%u " , rcfile , linenum ) ;
if ( parse_line_unformatted ( context , line ) < 0 ) {
2004-06-05 02:06:55 +04:00
retval = - 1 ;
break ; // quit parsing after first error
}
2007-04-03 19:47:23 +04:00
}
linenum + + ;
} while ( ! feof ( fd ) ) ;
2004-06-05 02:06:55 +04:00
fclose ( fd ) ;
bochsrc_include_count - - ;
return retval ;
}
2007-10-25 03:29:40 +04:00
static const char * get_builtin_variable ( const char * varname )
2004-06-05 02:06:55 +04:00
{
# ifdef WIN32
int code ;
DWORD size ;
DWORD type = 0 ;
HKEY hkey ;
char keyname [ 80 ] ;
static char data [ MAX_PATH ] ;
# endif
if ( strlen ( varname ) < 1 ) return NULL ;
else {
if ( ! strcmp ( varname , " BXSHARE " ) ) {
# 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 ,
2008-02-16 01:05:43 +03:00
( LPDWORD ) & size ) = = ERROR_SUCCESS ) {
2004-06-05 02:06:55 +04:00
RegCloseKey ( hkey ) ;
return data ;
} else {
RegCloseKey ( hkey ) ;
return NULL ;
}
} else {
return NULL ;
}
# else
return BX_SHARE_PATH ;
# endif
}
return NULL ;
}
}
2008-03-30 18:32:14 +04:00
static int parse_line_unformatted ( const char * context , char * line )
2004-06-05 02:06:55 +04:00
{
# define MAX_PARAMS_LEN 40
char * ptr ;
unsigned i , string_i = 0 ;
char string [ 512 ] ;
char * params [ MAX_PARAMS_LEN ] ;
int num_params ;
bx_bool inquotes = 0 ;
bx_bool comment = 0 ;
memset ( params , 0 , sizeof ( params ) ) ;
if ( line = = NULL ) return 0 ;
// if passed nothing but whitespace, just return
for ( i = 0 ; i < strlen ( line ) ; i + + ) {
if ( ! isspace ( line [ i ] ) ) break ;
2009-11-20 00:28:25 +03:00
}
2004-06-05 02:06:55 +04:00
if ( i > = strlen ( line ) )
return 0 ;
num_params = 0 ;
if ( ! strncmp ( line , " #include " , 8 ) )
ptr = strtok ( line , " " ) ;
else
ptr = strtok ( line , " : " ) ;
while ( ( ptr ) & & ( ! comment ) ) {
if ( ! inquotes ) {
string_i = 0 ;
} else {
string [ string_i + + ] = ' , ' ;
}
for ( i = 0 ; i < strlen ( ptr ) ; i + + ) {
if ( ptr [ i ] = = ' " ' )
inquotes = ! inquotes ;
else if ( ( ptr [ i ] = = ' # ' ) & & ( strncmp ( line + i , " #include " , 8 ) ) & & ! inquotes ) {
comment = 1 ;
break ;
} else {
# if BX_HAVE_GETENV
// substitute environment variables.
if ( ptr [ i ] = = ' $ ' ) {
char varname [ 512 ] ;
char * pv = varname ;
2007-10-25 03:29:40 +04:00
const char * value ;
2004-06-05 02:06:55 +04:00
* pv = 0 ;
i + + ;
while ( isalpha ( ptr [ i ] ) | | ptr [ i ] = = ' _ ' ) {
* pv = ptr [ i ] ; pv + + ; i + + ;
}
* pv = 0 ;
if ( strlen ( varname ) < 1 | | ! ( value = getenv ( varname ) ) ) {
if ( ( value = get_builtin_variable ( varname ) ) ) {
// append value to the string
2007-10-25 03:29:40 +04:00
for ( pv = ( char * ) value ; * pv ; pv + + )
2004-06-05 02:06:55 +04:00
string [ string_i + + ] = * pv ;
} else {
BX_PANIC ( ( " could not look up environment variable '%s' " , varname ) ) ;
}
} else {
// append value to the string
2007-10-25 03:29:40 +04:00
for ( pv = ( char * ) value ; * pv ; pv + + )
2004-06-05 02:06:55 +04:00
string [ string_i + + ] = * pv ;
}
}
# endif
if ( ! isspace ( ptr [ i ] ) | | inquotes ) {
string [ string_i + + ] = ptr [ i ] ;
}
}
}
string [ string_i ] = ' \0 ' ;
if ( string_i = = 0 ) break ;
if ( ! inquotes ) {
if ( params [ num_params ] ! = NULL ) {
free ( params [ num_params ] ) ;
params [ num_params ] = NULL ;
}
if ( num_params < MAX_PARAMS_LEN ) {
2006-05-30 02:33:38 +04:00
params [ num_params + + ] = strdup ( string ) ;
2004-06-05 02:06:55 +04:00
} else {
BX_PANIC ( ( " too many parameters, max is %d \n " , MAX_PARAMS_LEN ) ) ;
}
}
ptr = strtok ( NULL , " , " ) ;
}
Bit32s retval = parse_line_formatted ( context , num_params , & params [ 0 ] ) ;
for ( i = 0 ; i < MAX_PARAMS_LEN ; i + + )
{
2008-02-15 22:03:54 +03:00
if ( params [ i ] ! = NULL )
2004-06-05 02:06:55 +04:00
{
free ( params [ i ] ) ;
params [ i ] = NULL ;
}
}
return retval ;
}
// These macros are called for all parse errors, so that we can easily
// change the behavior of all occurrences.
# define PARSE_ERR(x) \
do { BX_PANIC ( x ) ; return - 1 ; } while ( 0 )
# define PARSE_WARN(x) \
BX_ERROR ( x )
2004-09-07 22:02:29 +04:00
/*
* this supports the " floppyx: image= " option .
* the functions returns the type of the floppy
* image ( 1.44 , 360 , etc . ) , based on the image file size .
*/
int get_floppy_type_from_image ( const char * filename )
{
struct stat stat_buf ;
if ( stat ( filename , & stat_buf ) )
{
return BX_FLOPPY_NONE ;
}
switch ( stat_buf . st_size )
{
case 163840 :
return BX_FLOPPY_160K ;
case 184320 :
return BX_FLOPPY_180K ;
case 327680 :
return BX_FLOPPY_320K ;
case 368640 :
return BX_FLOPPY_360K ;
case 737280 :
return BX_FLOPPY_720K ;
case 1228800 :
return BX_FLOPPY_1_2 ;
case 1474560 :
case 1720320 :
case 1763328 :
2005-11-20 20:22:44 +03:00
case 1884160 :
2004-09-07 22:02:29 +04:00
return BX_FLOPPY_1_44 ;
case 2949120 :
return BX_FLOPPY_2_88 ;
default :
return BX_FLOPPY_UNKNOWN ;
}
}
2006-03-13 21:55:53 +03:00
static Bit32s parse_log_options ( const char * context , char * loglev , char * param1 )
2005-11-17 23:35:38 +03:00
{
int level ;
if ( ! strcmp ( loglev , " panic " ) ) {
level = LOGLEV_PANIC ;
} else if ( ! strcmp ( loglev , " pass " ) ) {
level = LOGLEV_PASS ;
} else if ( ! strcmp ( loglev , " error " ) ) {
level = LOGLEV_ERROR ;
} else if ( ! strcmp ( loglev , " info " ) ) {
level = LOGLEV_INFO ;
} else { /* debug */
level = LOGLEV_DEBUG ;
}
if ( strncmp ( param1 , " action= " , 7 ) ) {
PARSE_ERR ( ( " %s: %s directive malformed. " , context , loglev ) ) ;
}
char * action = param1 + 7 ;
if ( ! strcmp ( action , " fatal " ) )
2008-09-13 01:05:49 +04:00
SIM - > set_default_log_action ( level , ACT_FATAL ) ;
2005-11-17 23:35:38 +03:00
else if ( ! strcmp ( action , " report " ) )
2008-09-13 01:05:49 +04:00
SIM - > set_default_log_action ( level , ACT_REPORT ) ;
2005-11-17 23:35:38 +03:00
else if ( ! strcmp ( action , " ignore " ) )
2008-09-13 01:05:49 +04:00
SIM - > set_default_log_action ( level , ACT_IGNORE ) ;
2005-11-17 23:35:38 +03:00
else if ( ! strcmp ( action , " ask " ) )
2008-09-13 01:05:49 +04:00
SIM - > set_default_log_action ( level , ACT_ASK ) ;
2005-11-17 23:35:38 +03:00
else {
PARSE_ERR ( ( " %s: %s directive malformed. " , context , loglev ) ) ;
}
return 0 ;
}
2009-05-03 23:21:38 +04:00
static int parse_debug_symbols ( const char * context , const char * * params , int num_params )
2008-03-30 18:32:14 +04:00
{
# if BX_DEBUGGER
Bit32u offset = 0 ;
2009-05-03 23:21:38 +04:00
const char * filename = 0 ;
2008-03-30 18:32:14 +04:00
while ( num_params > 0 )
{
if ( ! strncmp ( * params , " file= " , 5 ) ) {
filename = * params + 5 ;
}
else if ( ! strncmp ( * params , " offset= " , 7 ) ) {
char * end ;
offset = strtoul ( * params + 7 , & end , 0 ) ;
if ( * end )
PARSE_ERR ( ( " %s: debug_symbols: invalid parameter %s " , context , * params ) ) ;
}
else {
PARSE_ERR ( ( " %s: debug_symbols: invalid parameter %s " , context , * params ) ) ;
}
params + + ; num_params - - ;
}
if ( ! filename )
PARSE_ERR ( ( " %s: debug_symbols: missing file name " , context ) ) ;
if ( bx_dbg_symbol_command ( filename , 1 , offset ) < 0 )
PARSE_ERR ( ( " %s: debug_symbols: failed to load symbols from '%s' " , context , filename ) ) ;
# endif
return 0 ;
}
2010-03-01 21:53:53 +03:00
static int parse_param_bool ( const char * input , int len , const char * param )
{
if ( input [ len ] = = ' 0 ' | | input [ len ] = = ' 1 ' ) {
SIM - > get_param_bool ( param ) - > set ( input [ len ] - ' 0 ' ) ;
return 0 ;
}
return - 1 ;
}
2008-03-30 18:32:14 +04:00
static int parse_line_formatted ( const char * context , int num_params , char * params [ ] )
2004-06-05 02:06:55 +04:00
{
2004-09-07 22:02:29 +04:00
int i , slot , t ;
2005-04-03 19:00:44 +04:00
Bit8u idx ;
2006-02-26 22:11:20 +03:00
bx_list_c * base ;
2004-06-05 02:06:55 +04:00
if ( num_params < 1 ) return 0 ;
if ( num_params < 2 ) {
PARSE_ERR ( ( " %s: a bochsrc option needs at least one parameter " , context ) ) ;
}
if ( ! strcmp ( params [ 0 ] , " #include " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: ignoring malformed #include directive. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( ! strcmp ( params [ 1 ] , context ) ) {
PARSE_ERR ( ( " %s: cannot include this file again. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( bochsrc_include_count = = 2 ) {
PARSE_ERR ( ( " %s: include directive in an included file not supported yet. " , context ) ) ;
}
2006-01-23 21:39:10 +03:00
bx_read_configuration ( params [ 1 ] ) ;
}
2009-03-24 14:20:17 +03:00
else if ( ( ! strcmp ( params [ 0 ] , " floppya " ) ) | |
( ! strcmp ( params [ 0 ] , " floppyb " ) ) ) {
if ( ! strcmp ( params [ 0 ] , " floppya " ) ) {
base = ( bx_list_c * ) SIM - > get_param ( BXPN_FLOPPYA ) ;
} else {
base = ( bx_list_c * ) SIM - > get_param ( BXPN_FLOPPYB ) ;
2004-06-05 02:06:55 +04:00
}
for ( i = 1 ; i < num_params ; i + + ) {
2009-03-24 14:20:17 +03:00
if ( ! strncmp ( params [ i ] , " type= " , 5 ) ) {
if ( ! strcmp ( params [ i ] + 5 , " 2_88 " ) ) {
SIM - > get_param_enum ( " devtype " , base ) - > set ( BX_FDD_350ED ) ;
}
else if ( ! strcmp ( params [ i ] + 5 , " 1_44 " ) ) {
SIM - > get_param_enum ( " devtype " , base ) - > set ( BX_FDD_350HD ) ;
}
else if ( ! strcmp ( params [ i ] + 5 , " 1_2 " ) ) {
SIM - > get_param_enum ( " devtype " , base ) - > set ( BX_FDD_525HD ) ;
}
else if ( ! strcmp ( params [ i ] + 5 , " 720k " ) ) {
SIM - > get_param_enum ( " devtype " , base ) - > set ( BX_FDD_350DD ) ;
}
else if ( ! strcmp ( params [ i ] + 5 , " 360k " ) ) {
SIM - > get_param_enum ( " devtype " , base ) - > set ( BX_FDD_525DD ) ;
}
else {
PARSE_ERR ( ( " %s: %s: unknown type '%s'. " , context , params [ 0 ] ,
params [ i ] + 5 ) ) ;
}
}
else if ( ! strncmp ( params [ i ] , " 2_88= " , 5 ) ) {
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_2_88 ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " 1_44= " , 5 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_1_44 ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " 1_2= " , 4 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 4 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_1_2 ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " 720k= " , 5 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_720K ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " 360k= " , 5 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_360K ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
// use CMOS reserved types?
else if ( ! strncmp ( params [ i ] , " 160k= " , 5 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_160K ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " 180k= " , 5 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_180K ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " 320k= " , 5 ) ) {
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_enum ( " type " , base ) - > set ( BX_FLOPPY_320K ) ;
2006-01-23 21:39:10 +03:00
}
2004-09-07 22:02:29 +04:00
else if ( ! strncmp ( params [ i ] , " image= " , 6 ) ) {
/* "image=" means we should get floppy type from image */
2009-03-24 14:20:17 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 6 ] ) ;
2004-09-07 22:02:29 +04:00
t = get_floppy_type_from_image ( & params [ i ] [ 6 ] ) ;
if ( t ! = BX_FLOPPY_UNKNOWN )
2009-03-24 14:20:17 +03:00
SIM - > get_param_enum ( " type " , base ) - > set ( t ) ;
2004-09-07 22:02:29 +04:00
else
2009-03-24 14:20:17 +03:00
PARSE_ERR ( ( " %s: %s image size doesn't match one of the supported types. " ,
context , params [ 0 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2009-03-25 21:33:43 +03:00
else if ( ! strcmp ( params [ i ] , " status=inserted " ) ) {
SIM - > get_param_bool ( " status " , base ) - > set ( 1 ) ;
}
else if ( ! strcmp ( params [ i ] , " status=ejected " ) ) {
SIM - > get_param_bool ( " status " , base ) - > set ( 0 ) ;
2006-01-23 21:39:10 +03:00
}
2010-07-03 09:34:27 +04:00
else if ( ! strncmp ( params [ i ] , " write_protected= " , 16 ) ) {
SIM - > get_param_bool ( " readonly " , base ) - > set ( atol ( & params [ i ] [ 16 ] ) ) ;
}
2004-06-05 02:06:55 +04:00
else {
2009-03-24 14:20:17 +03:00
PARSE_ERR ( ( " %s: %s attribute '%s' not understood. " , context , params [ 0 ] ,
2004-06-05 02:06:55 +04:00
params [ i ] ) ) ;
}
}
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ( ! strncmp ( params [ 0 ] , " ata " , 3 ) ) & & ( strlen ( params [ 0 ] ) = = 4 ) ) {
2006-02-26 22:11:20 +03:00
char tmpname [ 80 ] ;
2004-06-05 02:06:55 +04:00
Bit8u channel = params [ 0 ] [ 3 ] ;
if ( ( channel < ' 0 ' ) | | ( channel > ' 9 ' ) ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
channel - = ' 0 ' ;
if ( channel > = BX_MAX_ATA_CHANNEL ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( ( num_params < 2 ) | | ( num_params > 5 ) ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2006-02-26 22:11:20 +03:00
sprintf ( tmpname , " ata.%d.resources " , channel ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmpname ) ;
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-02-26 22:11:20 +03:00
} else {
SIM - > get_param_bool ( " enabled " , base ) - > set ( atol ( & params [ 1 ] [ 8 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( num_params > 2 ) {
if ( strncmp ( params [ 2 ] , " ioaddr1= " , 8 ) ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
2006-06-22 00:42:26 +04:00
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
SIM - > get_param_num ( " ioaddr1 " , base ) - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2004-06-05 02:06:55 +04:00
else
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( " ioaddr1 " , base ) - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( num_params > 3 ) {
if ( strncmp ( params [ 3 ] , " ioaddr2= " , 8 ) ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
2006-06-22 00:42:26 +04:00
if ( ( params [ 3 ] [ 8 ] = = ' 0 ' ) & & ( params [ 3 ] [ 9 ] = = ' x ' ) )
SIM - > get_param_num ( " ioaddr2 " , base ) - > set ( strtoul ( & params [ 3 ] [ 8 ] , NULL , 16 ) ) ;
2004-06-05 02:06:55 +04:00
else
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( " ioaddr2 " , base ) - > set ( strtoul ( & params [ 3 ] [ 8 ] , NULL , 10 ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( num_params > 4 ) {
if ( strncmp ( params [ 4 ] , " irq= " , 4 ) ) {
PARSE_ERR ( ( " %s: ataX directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
2006-02-26 22:11:20 +03:00
SIM - > get_param_num ( " irq " , base ) - > set ( atol ( & params [ 4 ] [ 4 ] ) ) ;
2004-06-05 02:06:55 +04:00
}
}
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
// ataX-master, ataX-slave
else if ( ( ! strncmp ( params [ 0 ] , " ata " , 3 ) ) & & ( strlen ( params [ 0 ] ) > 4 ) ) {
2006-03-02 00:24:20 +03:00
Bit8u channel = params [ 0 ] [ 3 ] ;
2009-03-24 14:20:17 +03:00
int type = - 1 , mode = BX_ATA_MODE_FLAT , biosdetect = BX_ATA_BIOSDETECT_AUTO ;
2005-08-06 22:29:36 +04:00
Bit32u cylinders = 0 , heads = 0 , sectors = 0 ;
2006-02-26 22:11:20 +03:00
char tmpname [ 80 ] ;
2004-06-05 02:06:55 +04:00
if ( ( channel < ' 0 ' ) | | ( channel > ' 9 ' ) ) {
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
channel - = ' 0 ' ;
if ( channel > = BX_MAX_ATA_CHANNEL ) {
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( ( strcmp ( & params [ 0 ] [ 4 ] , " -slave " ) ) & &
( strcmp ( & params [ 0 ] [ 4 ] , " -master " ) ) ) {
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
2006-02-26 22:11:20 +03:00
sprintf ( tmpname , " ata.%d.%s " , channel , & params [ 0 ] [ 5 ] ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmpname ) ;
2004-06-05 02:06:55 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
2006-03-02 00:24:20 +03:00
if ( ! strncmp ( params [ i ] , " type= " , 5 ) ) {
type = SIM - > get_param_enum ( " type " , base ) - > find_by_name ( & params [ i ] [ 5 ] ) ;
if ( type < 0 ) {
PARSE_ERR ( ( " %s: ataX-master/slave: unknown type '%s' " , context , & params [ i ] [ 5 ] ) ) ;
}
2005-10-28 17:49:24 +04:00
} else if ( ! strcmp ( params [ i ] , " mode=z-undoable " ) ) {
PARSE_ERR ( ( " %s: ataX-master/slave mode 'z-undoable' not implemented yet " , context ) ) ;
} else if ( ! strcmp ( params [ i ] , " mode=z-volatile " ) ) {
PARSE_ERR ( ( " %s: ataX-master/slave mode 'z-volatile' not implemented yet " , context ) ) ;
2006-03-02 00:24:20 +03:00
} else if ( ! strncmp ( params [ i ] , " mode= " , 5 ) ) {
mode = SIM - > get_param_enum ( " mode " , base ) - > find_by_name ( & params [ i ] [ 5 ] ) ;
if ( mode < 0 ) {
PARSE_ERR ( ( " %s: ataX-master/slave: unknown mode '%s' " , context , & params [ i ] [ 5 ] ) ) ;
}
2005-08-06 22:29:36 +04:00
} else if ( ! strncmp ( params [ i ] , " path= " , 5 ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_string ( " path " , base ) - > set ( & params [ i ] [ 5 ] ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strncmp ( params [ i ] , " cylinders= " , 10 ) ) {
cylinders = atol ( & params [ i ] [ 10 ] ) ;
} else if ( ! strncmp ( params [ i ] , " heads= " , 6 ) ) {
heads = atol ( & params [ i ] [ 6 ] ) ;
} else if ( ! strncmp ( params [ i ] , " spt= " , 4 ) ) {
sectors = atol ( & params [ i ] [ 4 ] ) ;
} else if ( ! strncmp ( params [ i ] , " model= " , 6 ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_string ( " model " , base ) - > set ( & params [ i ] [ 6 ] ) ;
2006-03-02 00:24:20 +03:00
} else if ( ! strncmp ( params [ i ] , " biosdetect= " , 11 ) ) {
biosdetect = SIM - > get_param_enum ( " biosdetect " , base ) - > find_by_name ( & params [ i ] [ 11 ] ) ;
if ( biosdetect < 0 ) {
PARSE_ERR ( ( " %s: ataX-master/slave: unknown biosdetect '%s' " , context , & params [ i ] [ 11 ] ) ) ;
}
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " translation=none " ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " translation " , base ) - > set ( BX_ATA_TRANSLATION_NONE ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " translation=lba " ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " translation " , base ) - > set ( BX_ATA_TRANSLATION_LBA ) ;
2008-02-06 01:57:43 +03:00
} else if ( ! strcmp ( params [ i ] , " translation=large " ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " translation " , base ) - > set ( BX_ATA_TRANSLATION_LARGE ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " translation=echs " ) ) { // synonym of large
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " translation " , base ) - > set ( BX_ATA_TRANSLATION_LARGE ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " translation=rechs " ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " translation " , base ) - > set ( BX_ATA_TRANSLATION_RECHS ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " translation=auto " ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " translation " , base ) - > set ( BX_ATA_TRANSLATION_AUTO ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " status=ejected " ) ) {
2009-03-22 23:18:17 +03:00
SIM - > get_param_bool ( " status " , base ) - > set ( 0 ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ i ] , " status=inserted " ) ) {
2009-03-22 23:18:17 +03:00
SIM - > get_param_bool ( " status " , base ) - > set ( 1 ) ;
2005-08-06 22:29:36 +04:00
} else if ( ! strncmp ( params [ i ] , " journal= " , 8 ) ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_string ( " journal " , base ) - > set ( & params [ i ] [ 8 ] ) ;
2005-08-06 22:29:36 +04:00
} else {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: ataX-master/slave directive malformed. " , context ) ) ;
}
2005-08-06 22:29:36 +04:00
}
2004-06-05 02:06:55 +04:00
// Enables the ata device
2009-03-24 14:20:17 +03:00
if ( type > = 0 ) {
2006-02-26 22:11:20 +03:00
SIM - > get_param_enum ( " type " , base ) - > set ( type ) ;
2006-03-02 00:24:20 +03:00
SIM - > get_param_num ( " biosdetect " , base ) - > set ( biosdetect ) ;
2009-03-24 14:20:17 +03:00
if ( type = = BX_ATA_DEVICE_DISK ) {
if ( strlen ( SIM - > get_param_string ( " path " , base ) - > getptr ( ) ) > 0 ) {
SIM - > get_param_bool ( " present " , base ) - > set ( 1 ) ;
SIM - > get_param_enum ( " mode " , base ) - > set ( mode ) ;
if ( ( cylinders = = 0 ) & & ( heads = = 0 ) & & ( sectors = = 0 ) ) {
PARSE_WARN ( ( " %s: ataX-master/slave CHS set to 0/0/0 - autodetection enabled " , context ) ) ;
// using heads = 16 and spt = 63 for autodetection (bximage defaults)
SIM - > get_param_num ( " heads " , base ) - > set ( 16 ) ;
SIM - > get_param_num ( " spt " , base ) - > set ( 63 ) ;
} else {
SIM - > get_param_num ( " cylinders " , base ) - > set ( cylinders ) ;
SIM - > get_param_num ( " heads " , base ) - > set ( heads ) ;
SIM - > get_param_num ( " spt " , base ) - > set ( sectors ) ;
}
} else {
SIM - > get_param_bool ( " present " , base ) - > set ( 0 ) ;
}
} else if ( type = = BX_ATA_DEVICE_CDROM ) {
SIM - > get_param_bool ( " present " , base ) - > set ( 1 ) ;
}
2006-12-29 21:47:58 +03:00
} else {
SIM - > get_param_bool ( " present " , base ) - > set ( 0 ) ;
2005-08-06 22:29:36 +04:00
}
2004-06-05 02:06:55 +04:00
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ 0 ] , " boot " ) ) {
2006-02-24 01:48:57 +03:00
char tmppath [ 80 ] ;
2004-10-16 19:44:00 +04:00
if ( num_params < 2 ) {
PARSE_ERR ( ( " %s: boot directive malformed. " , context ) ) ;
2005-08-06 22:29:36 +04:00
}
2004-10-16 19:44:00 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
2006-02-24 01:48:57 +03:00
sprintf ( tmppath , " boot_params.boot_drive%d " , i ) ;
2004-10-16 19:44:00 +04:00
if ( ! strcmp ( params [ i ] , " none " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_NONE ) ;
2004-10-16 19:44:00 +04:00
} else if ( ! strcmp ( params [ i ] , " a " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_FLOPPYA ) ;
2004-10-16 19:44:00 +04:00
} else if ( ! strcmp ( params [ i ] , " floppy " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_FLOPPYA ) ;
2004-10-16 19:44:00 +04:00
} else if ( ! strcmp ( params [ i ] , " c " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_DISKC ) ;
2004-10-16 19:44:00 +04:00
} else if ( ! strcmp ( params [ i ] , " disk " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_DISKC ) ;
2004-10-16 19:44:00 +04:00
} else if ( ! strcmp ( params [ i ] , " cdrom " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_CDROM ) ;
2008-02-01 23:38:50 +03:00
} else if ( ! strcmp ( params [ i ] , " network " ) ) {
SIM - > get_param_enum ( tmppath ) - > set ( BX_BOOT_NETWORK ) ;
2004-10-16 19:44:00 +04:00
} else {
2008-02-01 23:38:50 +03:00
PARSE_ERR ( ( " %s: boot directive with unknown boot drive '%s'. use 'floppy', 'disk', 'cdrom' or 'network'. " , context , params [ i ] ) ) ;
2004-10-16 19:44:00 +04:00
}
2005-08-06 22:29:36 +04:00
}
2006-02-24 01:48:57 +03:00
if ( SIM - > get_param_enum ( BXPN_BOOTDRIVE1 ) - > get ( ) = = BX_BOOT_NONE ) {
2004-10-16 19:44:00 +04:00
PARSE_ERR ( ( " %s: first boot drive must be one of 'floppy', 'disk' or 'cdrom'. " , context ) ) ;
2005-08-06 22:29:36 +04:00
}
2006-02-24 01:48:57 +03:00
if ( ( SIM - > get_param_enum ( BXPN_BOOTDRIVE1 ) - > get ( ) = = SIM - > get_param_enum ( BXPN_BOOTDRIVE2 ) - > get ( ) ) | |
( SIM - > get_param_enum ( BXPN_BOOTDRIVE1 ) - > get ( ) = = SIM - > get_param_enum ( BXPN_BOOTDRIVE3 ) - > get ( ) ) | |
( ( SIM - > get_param_enum ( BXPN_BOOTDRIVE3 ) - > get ( ) ! = BX_BOOT_NONE ) & &
( SIM - > get_param_enum ( BXPN_BOOTDRIVE2 ) - > get ( ) = = SIM - > get_param_enum ( BXPN_BOOTDRIVE3 ) - > get ( ) ) ) ) {
2004-10-16 19:44:00 +04:00
PARSE_ERR ( ( " %s: a boot drive appears twice in boot sequence. " , context ) ) ;
2004-06-05 02:06:55 +04:00
}
2005-08-06 22:29:36 +04:00
} else if ( ! strcmp ( params [ 0 ] , " floppy_bootsig_check " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: floppy_bootsig_check directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " disabled= " , 9 ) ) {
PARSE_ERR ( ( " %s: floppy_bootsig_check directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ 1 ] , 9 , BXPN_FLOPPYSIGCHECK ) < 0 ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: floppy_bootsig_check directive malformed. " , context ) ) ;
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " log " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: log directive has wrong # args. " , context ) ) ;
}
2006-03-05 13:24:29 +03:00
SIM - > get_param_string ( BXPN_LOG_FILENAME ) - > set ( params [ 1 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " logprefix " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: logprefix directive has wrong # args. " , context ) ) ;
}
2006-03-05 13:24:29 +03:00
SIM - > get_param_string ( BXPN_LOG_PREFIX ) - > set ( params [ 1 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " debugger_log " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: debugger_log directive has wrong # args. " , context ) ) ;
}
2006-03-05 13:24:29 +03:00
SIM - > get_param_string ( BXPN_DEBUGGER_LOG_FILENAME ) - > set ( params [ 1 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " panic " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: panic directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2005-11-17 23:35:38 +03:00
if ( parse_log_options ( context , params [ 0 ] , params [ 1 ] ) < 0 ) {
return - 1 ;
2004-06-05 02:06:55 +04:00
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " pass " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: pass directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2005-11-17 23:35:38 +03:00
if ( parse_log_options ( context , params [ 0 ] , params [ 1 ] ) < 0 ) {
return - 1 ;
2004-06-05 02:06:55 +04:00
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " error " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: error directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2005-11-17 23:35:38 +03:00
if ( parse_log_options ( context , params [ 0 ] , params [ 1 ] ) < 0 ) {
return - 1 ;
2004-06-05 02:06:55 +04:00
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " info " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: info directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2005-11-17 23:35:38 +03:00
if ( parse_log_options ( context , params [ 0 ] , params [ 1 ] ) < 0 ) {
return - 1 ;
2004-06-05 02:06:55 +04:00
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " debug " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: debug directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2005-11-17 23:35:38 +03:00
if ( parse_log_options ( context , params [ 0 ] , params [ 1 ] ) < 0 ) {
return - 1 ;
2004-06-05 02:06:55 +04:00
}
2006-01-18 21:35:38 +03:00
} else if ( ! strcmp ( params [ 0 ] , " cpu " ) ) {
if ( num_params < 2 ) {
PARSE_ERR ( ( " %s: cpu directive malformed. " , context ) ) ;
}
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " count= " , 6 ) ) {
2006-02-11 18:28:43 +03:00
unsigned processors = 1 , cores = 1 , threads = 1 ;
sscanf ( & params [ i ] [ 6 ] , " %u:%u:%u " , & processors , & cores , & threads ) ;
unsigned smp_threads = cores * threads * processors ;
if ( smp_threads < 1 ) {
PARSE_ERR ( ( " %s: at least one CPU thread should be defined, cpu directive malformed " , context ) ) ;
}
2006-02-18 19:53:18 +03:00
SIM - > get_param_num ( BXPN_CPU_NPROCESSORS ) - > set ( processors ) ;
SIM - > get_param_num ( BXPN_CPU_NCORES ) - > set ( cores ) ;
SIM - > get_param_num ( BXPN_CPU_NTHREADS ) - > set ( threads ) ;
2006-01-22 13:03:38 +03:00
} else if ( ! strncmp ( params [ i ] , " ips= " , 4 ) ) {
2006-06-05 23:06:36 +04:00
SIM - > get_param_num ( BXPN_IPS ) - > set ( atol ( & params [ i ] [ 4 ] ) ) ;
2006-06-22 00:42:26 +04:00
# if BX_SUPPORT_SMP
} else if ( ! strncmp ( params [ i ] , " quantum= " , 8 ) ) {
SIM - > get_param_num ( BXPN_SMP_QUANTUM ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
# endif
2006-02-01 21:12:08 +03:00
} else if ( ! strncmp ( params [ i ] , " reset_on_triple_fault= " , 22 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 22 , BXPN_RESET_ON_TRIPLE_FAULT ) < 0 ) {
2008-09-23 01:38:15 +04:00
PARSE_ERR ( ( " %s: cpu directive malformed. " , context ) ) ;
}
2009-11-13 18:55:46 +03:00
# if BX_CPU_LEVEL >= 5
} else if ( ! strncmp ( params [ i ] , " ignore_bad_msrs= " , 16 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 16 , BXPN_IGNORE_BAD_MSRS ) < 0 ) {
2009-11-13 18:55:46 +03:00
PARSE_ERR ( ( " %s: cpu directive malformed. " , context ) ) ;
}
# endif
2008-12-28 23:30:48 +03:00
} else if ( ! strncmp ( params [ i ] , " msrs= " , 5 ) ) {
2008-12-28 23:53:31 +03:00
SIM - > get_param_string ( BXPN_CONFIGURABLE_MSRS_PATH ) - > set ( & params [ i ] [ 5 ] ) ;
2010-02-26 01:04:31 +03:00
} else {
PARSE_ERR ( ( " %s: cpu directive malformed. " , context ) ) ;
}
}
} else if ( ! strcmp ( params [ 0 ] , " cpuid " ) ) {
if ( num_params < 2 ) {
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " vendor_string= " , 14 ) ) {
2008-08-19 20:43:07 +04:00
if ( strlen ( & params [ i ] [ 14 ] ) ! = BX_CPUID_VENDOR_LEN ) {
2010-02-26 01:04:31 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
2008-08-19 20:43:07 +04:00
}
SIM - > get_param_string ( BXPN_VENDOR_STRING ) - > set ( & params [ i ] [ 14 ] ) ;
} else if ( ! strncmp ( params [ i ] , " brand_string= " , 13 ) ) {
if ( strlen ( & params [ i ] [ 13 ] ) > BX_CPUID_BRAND_LEN ) {
2010-02-26 01:04:31 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
2008-08-19 20:43:07 +04:00
}
SIM - > get_param_string ( BXPN_BRAND_STRING ) - > set ( & params [ i ] [ 13 ] ) ;
2010-07-17 01:03:52 +04:00
} else if ( ! strncmp ( params [ i ] , " stepping= " , 9 ) ) {
SIM - > get_param_num ( BXPN_CPUID_STEPPING ) - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2010-02-26 01:04:31 +03:00
} else if ( ! strncmp ( params [ i ] , " cpuid_limit_winnt= " , 18 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 18 , BXPN_CPUID_LIMIT_WINNT ) < 0 ) {
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
# if BX_CPU_LEVEL >= 5
} else if ( ! strncmp ( params [ i ] , " mmx= " , 4 ) ) {
if ( parse_param_bool ( params [ i ] , 4 , BXPN_CPUID_MMX ) < 0 ) {
2010-02-26 01:04:31 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-03-01 21:53:53 +03:00
# endif
2010-02-26 01:04:31 +03:00
# if BX_CPU_LEVEL >= 6
} else if ( ! strncmp ( params [ i ] , " sse= " , 4 ) ) {
if ( ! SIM - > get_param_enum ( BXPN_CPUID_SSE ) - > set_by_name ( & params [ i ] [ 4 ] ) )
PARSE_ERR ( ( " %s: unsupported sse option. " , context ) ) ;
} else if ( ! strncmp ( params [ i ] , " aes= " , 4 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 4 , BXPN_CPUID_AES ) < 0 ) {
2010-02-26 01:04:31 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
} else if ( ! strncmp ( params [ i ] , " movbe= " , 6 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 6 , BXPN_CPUID_MOVBE ) < 0 ) {
2010-02-26 01:04:31 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-02-26 14:44:50 +03:00
} else if ( ! strncmp ( params [ i ] , " sep= " , 4 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 4 , BXPN_CPUID_SEP ) < 0 ) {
2010-02-26 14:44:50 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-02-27 01:53:43 +03:00
} else if ( ! strncmp ( params [ i ] , " xsave= " , 6 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 6 , BXPN_CPUID_XSAVE ) < 0 ) {
2010-02-27 01:53:43 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-02-28 17:52:17 +03:00
} else if ( ! strncmp ( params [ i ] , " xapic= " , 6 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ i ] , 6 , BXPN_CPUID_XAPIC ) < 0 ) {
2010-02-28 17:52:17 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-04-24 13:36:04 +04:00
# if BX_SUPPORT_X86_64
} else if ( ! strncmp ( params [ i ] , " 1g_pages= " , 9 ) ) {
if ( parse_param_bool ( params [ i ] , 9 , BXPN_CPUID_1G_PAGES ) < 0 ) {
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-04-29 23:34:32 +04:00
} else if ( ! strncmp ( params [ i ] , " pcid= " , 5 ) ) {
if ( parse_param_bool ( params [ i ] , 5 , BXPN_CPUID_PCID ) < 0 ) {
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
2010-04-24 13:36:04 +04:00
# endif
2010-03-12 14:28:59 +03:00
# if BX_SUPPORT_MONITOR_MWAIT
} else if ( ! strncmp ( params [ i ] , " mwait_is_nop= " , 13 ) ) {
2010-03-12 14:42:34 +03:00
if ( parse_param_bool ( params [ i ] , 13 , BXPN_CPUID_MWAIT_IS_NOP ) < 0 ) {
2010-03-12 14:28:59 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
}
# endif
2010-02-26 01:04:31 +03:00
# endif
2006-01-18 21:35:38 +03:00
} else {
2010-02-26 01:04:31 +03:00
PARSE_ERR ( ( " %s: cpuid directive malformed. " , context ) ) ;
2006-01-18 21:35:38 +03:00
}
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " megs " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: megs directive: wrong # args. " , context ) ) ;
}
2006-02-18 01:27:38 +03:00
SIM - > get_param_num ( BXPN_MEM_SIZE ) - > set ( atol ( params [ 1 ] ) ) ;
2009-10-17 21:38:58 +04:00
SIM - > get_param_num ( BXPN_HOST_MEM_SIZE ) - > set ( atol ( params [ 1 ] ) ) ;
} else if ( ! strcmp ( params [ 0 ] , " memory " ) ) {
if ( num_params < 3 ) {
PARSE_ERR ( ( " %s: memory directive malformed. " , context ) ) ;
}
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " host= " , 5 ) ) {
SIM - > get_param_num ( BXPN_HOST_MEM_SIZE ) - > set ( atol ( & params [ i ] [ 5 ] ) ) ;
} else if ( ! strncmp ( params [ i ] , " guest= " , 6 ) ) {
SIM - > get_param_num ( BXPN_MEM_SIZE ) - > set ( atol ( & params [ i ] [ 6 ] ) ) ;
} else {
PARSE_ERR ( ( " %s: memory directive malformed. " , context ) ) ;
}
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " romimage " ) ) {
2005-12-27 19:59:27 +03:00
if ( ( num_params < 2 ) | | ( num_params > 3 ) ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: romimage directive: wrong # args. " , context ) ) ;
}
2005-12-27 19:59:27 +03:00
if ( ! strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2006-02-18 01:27:38 +03:00
SIM - > get_param_string ( BXPN_ROM_PATH ) - > set ( & params [ 1 ] [ 5 ] ) ;
2005-12-27 19:59:27 +03:00
} else {
PARSE_ERR ( ( " %s: romimage directive malformed. " , context ) ) ;
}
if ( num_params = = 3 ) {
if ( ! strncmp ( params [ 2 ] , " address= " , 8 ) ) {
if ( ( params [ 2 ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( BXPN_ROM_ADDRESS ) - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 16 ) ) ;
2004-09-28 21:37:52 +04:00
else
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( BXPN_ROM_ADDRESS ) - > set ( strtoul ( & params [ 2 ] [ 8 ] , NULL , 10 ) ) ;
2005-08-07 19:50:07 +04:00
} else {
2004-09-28 21:37:52 +04:00
PARSE_ERR ( ( " %s: romimage directive malformed. " , context ) ) ;
2004-06-05 02:06:55 +04:00
}
2005-12-27 19:59:27 +03:00
} else {
2008-09-23 01:38:15 +04:00
SIM - > get_param_num ( BXPN_ROM_ADDRESS ) - > set ( 0 ) ;
2004-06-05 02:06:55 +04:00
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " vgaromimage " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: vgaromimage directive: wrong # args. " , context ) ) ;
}
if ( ! strncmp ( params [ 1 ] , " file= " , 5 ) ) {
2006-02-18 01:27:38 +03:00
SIM - > get_param_string ( BXPN_VGA_ROM_PATH ) - > set ( & params [ 1 ] [ 5 ] ) ;
2005-08-07 19:50:07 +04:00
} else {
2009-05-07 22:46:12 +04:00
PARSE_ERR ( ( " %s: vgaromimage directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
} else if ( ! strncmp ( params [ 0 ] , " optromimage " , 11 ) ) {
2004-09-28 21:37:52 +04:00
int num = atoi ( & params [ 0 ] [ 11 ] ) ;
2006-02-18 01:27:38 +03:00
char tmppath [ 80 ] , tmpaddr [ 80 ] ;
2005-10-28 10:33:53 +04:00
if ( ( num < 1 ) | | ( num > BX_N_OPTROM_IMAGES ) ) {
2004-09-28 21:37:52 +04:00
PARSE_ERR ( ( " %s: optromimage%d: not supported " , context , num ) ) ;
2005-08-07 19:50:07 +04:00
}
2004-06-05 02:06:55 +04:00
if ( num_params ! = 3 ) {
2004-09-28 21:37:52 +04:00
PARSE_ERR ( ( " %s: optromimage%d directive: wrong # args. " , context , num ) ) ;
2005-08-07 19:50:07 +04:00
}
2006-02-18 01:27:38 +03:00
sprintf ( tmppath , " memory.optrom.%d.path " , num ) ;
sprintf ( tmpaddr , " memory.optrom.%d.addr " , num ) ;
2004-09-28 21:37:52 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " file= " , 5 ) ) {
2006-02-18 01:27:38 +03:00
SIM - > get_param_string ( tmppath ) - > set ( & params [ i ] [ 5 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " address= " , 8 ) ) {
2004-09-28 21:37:52 +04:00
if ( ( params [ i ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( tmpaddr ) - > set ( strtoul ( & params [ i ] [ 8 ] , NULL , 16 ) ) ;
2004-09-28 21:37:52 +04:00
else
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( tmpaddr ) - > set ( strtoul ( & params [ i ] [ 8 ] , NULL , 10 ) ) ;
2005-08-07 19:50:07 +04:00
} else {
2004-09-28 21:37:52 +04:00
PARSE_ERR ( ( " %s: optromimage%d directive malformed. " , context , num ) ) ;
2004-06-05 02:06:55 +04:00
}
}
2005-10-28 04:12:27 +04:00
} else if ( ! strncmp ( params [ 0 ] , " optramimage " , 11 ) ) {
int num = atoi ( & params [ 0 ] [ 11 ] ) ;
2006-02-18 01:27:38 +03:00
char tmppath [ 80 ] , tmpaddr [ 80 ] ;
2006-02-17 00:44:17 +03:00
if ( ( num < 1 ) | | ( num > BX_N_OPTRAM_IMAGES ) ) {
2006-03-07 01:03:16 +03:00
PARSE_ERR ( ( " %s: optramimage%d: not supported " , context , num ) ) ;
2005-10-28 04:12:27 +04:00
}
if ( num_params ! = 3 ) {
2006-03-07 01:03:16 +03:00
PARSE_ERR ( ( " %s: optramimage%d directive: wrong # args. " , context , num ) ) ;
2005-10-28 04:12:27 +04:00
}
2006-02-18 01:27:38 +03:00
sprintf ( tmppath , " memory.optram.%d.path " , num ) ;
sprintf ( tmpaddr , " memory.optram.%d.addr " , num ) ;
2005-10-28 04:12:27 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " file= " , 5 ) ) {
2006-02-18 01:27:38 +03:00
SIM - > get_param_string ( tmppath ) - > set ( & params [ i ] [ 5 ] ) ;
2005-10-28 04:12:27 +04:00
} else if ( ! strncmp ( params [ i ] , " address= " , 8 ) ) {
if ( ( params [ i ] [ 8 ] = = ' 0 ' ) & & ( params [ 2 ] [ 9 ] = = ' x ' ) )
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( tmpaddr ) - > set ( strtoul ( & params [ i ] [ 8 ] , NULL , 16 ) ) ;
2005-10-28 04:12:27 +04:00
else
2006-06-22 00:42:26 +04:00
SIM - > get_param_num ( tmpaddr ) - > set ( strtoul ( & params [ i ] [ 8 ] , NULL , 10 ) ) ;
2005-10-28 04:12:27 +04:00
} else {
2006-03-07 01:03:16 +03:00
PARSE_ERR ( ( " %s: optramimage%d directive malformed. " , context , num ) ) ;
2005-10-28 04:12:27 +04:00
}
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " vga_update_interval " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: vga_update_interval directive: wrong # args. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2006-02-22 00:35:09 +03:00
SIM - > get_param_num ( BXPN_VGA_UPDATE_INTERVAL ) - > set ( atol ( params [ 1 ] ) ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " vga " ) ) {
2005-02-01 22:16:39 +03:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: vga directive: wrong # args. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2005-02-01 22:16:39 +03:00
if ( ! strncmp ( params [ 1 ] , " extension= " , 10 ) ) {
2006-02-22 00:35:09 +03:00
SIM - > get_param_string ( BXPN_VGA_EXTENSION ) - > set ( & params [ 1 ] [ 10 ] ) ;
2005-02-01 22:16:39 +03:00
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " keyboard_serial_delay " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: keyboard_serial_delay directive: wrong # args. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2006-02-22 22:18:29 +03:00
SIM - > get_param_num ( BXPN_KBD_SERIAL_DELAY ) - > set ( atol ( params [ 1 ] ) ) ;
if ( SIM - > get_param_num ( BXPN_KBD_SERIAL_DELAY ) - > get ( ) < 5 ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: keyboard_serial_delay not big enough! " , context ) ) ;
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " keyboard_paste_delay " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: keyboard_paste_delay directive: wrong # args. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2006-02-22 22:18:29 +03:00
SIM - > get_param_num ( BXPN_KBD_PASTE_DELAY ) - > set ( atol ( params [ 1 ] ) ) ;
if ( SIM - > get_param_num ( BXPN_KBD_PASTE_DELAY ) - > get ( ) < 1000 ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: keyboard_paste_delay not big enough! " , context ) ) ;
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " text_snapshot_check " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: text_snapshot_check directive: wrong # args. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2006-03-04 15:43:47 +03:00
if ( ! strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ 1 ] , 8 , BXPN_TEXT_SNAPSHOT_CHECK ) < 0 ) {
2006-03-04 15:43:47 +03:00
PARSE_ERR ( ( " %s: text_snapshot_check directive malformed. " , context ) ) ;
2010-03-01 21:53:53 +03:00
}
2006-03-04 15:43:47 +03:00
} else {
PARSE_ERR ( ( " %s: text_snapshot_check directive malformed. " , context ) ) ;
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " mouse " ) ) {
2004-12-01 00:03:16 +03:00
if ( num_params < 2 ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: mouse directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2004-12-01 00:03:16 +03:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ 1 ] , 8 , BXPN_MOUSE_ENABLED ) < 0 ) {
2004-12-01 00:03:16 +03:00
PARSE_ERR ( ( " %s: mouse directive malformed. " , context ) ) ;
2010-03-01 21:53:53 +03:00
}
2004-12-01 00:03:16 +03:00
} else if ( ! strncmp ( params [ i ] , " type= " , 5 ) ) {
2006-02-28 17:02:06 +03:00
if ( ! SIM - > get_param_enum ( BXPN_MOUSE_TYPE ) - > set_by_name ( & params [ i ] [ 5 ] ) )
2006-06-05 23:06:36 +04:00
PARSE_ERR ( ( " %s: mouse type '%s' not available " , context , & params [ i ] [ 5 ] ) ) ;
2010-05-16 13:01:36 +04:00
} else if ( ! strncmp ( params [ i ] , " toggle= " , 7 ) ) {
if ( ! SIM - > get_param_enum ( BXPN_MOUSE_TOGGLE ) - > set_by_name ( & params [ i ] [ 7 ] ) )
PARSE_ERR ( ( " %s: mouse toggle method '%s' not available " , context , & params [ i ] [ 7 ] ) ) ;
2005-08-07 19:50:07 +04:00
} else {
2004-12-01 00:03:16 +03:00
PARSE_ERR ( ( " %s: mouse directive malformed. " , context ) ) ;
2004-06-05 02:06:55 +04:00
}
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " private_colormap " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: private_colormap directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
PARSE_ERR ( ( " %s: private_colormap directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ 1 ] , 8 , BXPN_PRIVATE_COLORMAP ) < 0 ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: private_colormap directive malformed. " , context ) ) ;
}
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " fullscreen " ) ) {
2004-06-05 02:06:55 +04:00
# if BX_WITH_AMIGAOS
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: fullscreen directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
PARSE_ERR ( ( " %s: fullscreen directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ 1 ] , 8 , BXPN_FULLSCREEN ) < 0 ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: fullscreen directive malformed. " , context ) ) ;
}
2005-08-07 19:50:07 +04:00
# endif
} else if ( ! strcmp ( params [ 0 ] , " screenmode " ) ) {
2004-06-05 02:06:55 +04:00
# if BX_WITH_AMIGAOS
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: screenmode directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " name= " , 5 ) ) {
PARSE_ERR ( ( " %s: screenmode directive malformed. " , context ) ) ;
2005-08-07 19:50:07 +04:00
}
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_SCREENMODE ) - > set ( & params [ 1 ] [ 5 ] ) ;
2004-06-05 02:06:55 +04:00
# endif
2005-08-07 19:50:07 +04:00
} else if ( ! strcmp ( params [ 0 ] , " sb16 " ) ) {
2004-12-14 22:27:42 +03:00
int enable = 1 ;
2006-03-03 23:29:50 +03:00
base = ( bx_list_c * ) SIM - > get_param ( BXPN_SB16 ) ;
2004-06-05 02:06:55 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
2004-12-14 22:27:42 +03:00
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
enable = atol ( & params [ i ] [ 8 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " midi= " , 5 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_string ( " midifile " , base ) - > set ( & params [ i ] [ 5 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " midimode= " , 9 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_num ( " midimode " , base ) - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " wave= " , 5 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_string ( " wavefile " , base ) - > set ( & params [ i ] [ 5 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " wavemode= " , 9 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_num ( " wavemode " , base ) - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " log= " , 4 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_string ( " logfile " , base ) - > set ( & params [ i ] [ 4 ] ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " loglevel= " , 9 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_num ( " loglevel " , base ) - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2005-08-07 19:50:07 +04:00
} else if ( ! strncmp ( params [ i ] , " dmatimer= " , 9 ) ) {
2006-03-03 23:29:50 +03:00
SIM - > get_param_num ( " dmatimer " , base ) - > set ( atol ( & params [ i ] [ 9 ] ) ) ;
2005-08-07 19:50:07 +04:00
} else {
2004-09-28 21:37:52 +04:00
BX_ERROR ( ( " %s: unknown parameter for sb16 ignored. " , context ) ) ;
2004-06-05 02:06:55 +04:00
}
2005-08-07 19:50:07 +04:00
}
2006-03-03 23:29:50 +03:00
if ( ( enable ! = 0 ) & & ( SIM - > get_param_num ( " dmatimer " , base ) - > get ( ) > 0 ) )
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
2004-12-14 22:27:42 +03:00
else
2006-03-03 23:29:50 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 0 ) ;
2005-08-07 19:50:07 +04:00
} else if ( ( ! strncmp ( params [ 0 ] , " com " , 3 ) ) & & ( strlen ( params [ 0 ] ) = = 4 ) ) {
2006-03-01 20:14:36 +03:00
char tmpname [ 80 ] ;
2005-04-03 19:00:44 +04:00
idx = params [ 0 ] [ 3 ] ;
if ( ( idx < ' 1 ' ) | | ( idx > ' 9 ' ) ) {
PARSE_ERR ( ( " %s: comX directive malformed. " , context ) ) ;
}
2006-03-01 20:14:36 +03:00
idx - = ' 0 ' ;
if ( idx > BX_N_SERIAL_PORTS ) {
2005-04-03 19:00:44 +04:00
PARSE_ERR ( ( " %s: comX port number out of range. " , context ) ) ;
}
2006-03-01 20:14:36 +03:00
sprintf ( tmpname , " ports.serial.%d " , idx ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmpname ) ;
2004-06-05 02:06:55 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2006-03-01 20:14:36 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2005-04-03 19:00:44 +04:00
} else if ( ! strncmp ( params [ i ] , " mode= " , 5 ) ) {
2006-03-01 20:14:36 +03:00
if ( ! SIM - > get_param_enum ( " mode " , base ) - > set_by_name ( & params [ i ] [ 5 ] ) )
2006-06-05 23:06:36 +04:00
PARSE_ERR ( ( " %s: com%d serial port mode '%s' not available " , context , idx , & params [ i ] [ 5 ] ) ) ;
2006-03-01 20:14:36 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
2005-04-03 19:00:44 +04:00
} else if ( ! strncmp ( params [ i ] , " dev= " , 4 ) ) {
2006-03-01 20:14:36 +03:00
SIM - > get_param_string ( " dev " , base ) - > set ( & params [ i ] [ 4 ] ) ;
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
2005-04-03 19:00:44 +04:00
} else {
2006-03-01 20:14:36 +03:00
PARSE_ERR ( ( " %s: unknown parameter for com%d ignored. " , context , idx ) ) ;
2005-04-03 19:00:44 +04:00
}
}
} else if ( ( ! strncmp ( params [ 0 ] , " parport " , 7 ) ) & & ( strlen ( params [ 0 ] ) = = 8 ) ) {
2006-03-01 20:14:36 +03:00
char tmpname [ 80 ] ;
2005-04-03 19:00:44 +04:00
idx = params [ 0 ] [ 7 ] ;
if ( ( idx < ' 1 ' ) | | ( idx > ' 9 ' ) ) {
PARSE_ERR ( ( " %s: parportX directive malformed. " , context ) ) ;
}
2006-03-01 20:14:36 +03:00
idx - = ' 0 ' ;
if ( idx > BX_N_PARALLEL_PORTS ) {
2005-04-03 19:00:44 +04:00
PARSE_ERR ( ( " %s: parportX port number out of range. " , context ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-03-01 20:14:36 +03:00
sprintf ( tmpname , " ports.parallel.%d " , idx ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmpname ) ;
2004-06-05 02:06:55 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2006-03-01 20:14:36 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2005-04-03 19:00:44 +04:00
} else if ( ! strncmp ( params [ i ] , " file= " , 5 ) ) {
2006-03-01 20:14:36 +03:00
SIM - > get_param_string ( " outfile " , base ) - > set ( & params [ i ] [ 5 ] ) ;
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
2005-04-03 19:00:44 +04:00
} else {
2006-03-01 20:14:36 +03:00
BX_ERROR ( ( " %s: unknown parameter for parport%d ignored. " , context , idx ) ) ;
2005-04-03 19:00:44 +04:00
}
2004-06-05 02:06:55 +04:00
}
2009-01-19 16:13:32 +03:00
} else if ( ! strcmp ( params [ 0 ] , " usb1 " ) ) {
PARSE_ERR ( ( " %s: 'usb1' directive is now deprecated, use 'usb_uhci' instead " , context ) ) ;
} else if ( ! strcmp ( params [ 0 ] , " usb_uhci " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
SIM - > get_param_bool ( BXPN_UHCI_ENABLED ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
} else if ( ! strncmp ( params [ i ] , " port1= " , 6 ) ) {
SIM - > get_param_string ( BXPN_UHCI_PORT1 ) - > set ( & params [ i ] [ 6 ] ) ;
} else if ( ! strncmp ( params [ i ] , " port2= " , 6 ) ) {
SIM - > get_param_string ( BXPN_UHCI_PORT2 ) - > set ( & params [ i ] [ 6 ] ) ;
} else {
PARSE_WARN ( ( " %s: unknown parameter '%s' for usb_uhci ignored. " , context , params [ i ] ) ) ;
}
2005-04-03 19:00:44 +04:00
}
2009-01-19 16:13:32 +03:00
} else if ( ! strcmp ( params [ 0 ] , " usb_ohci " ) ) {
2005-04-03 19:00:44 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2009-01-19 16:13:32 +03:00
SIM - > get_param_bool ( BXPN_OHCI_ENABLED ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2005-04-03 19:00:44 +04:00
} else if ( ! strncmp ( params [ i ] , " port1= " , 6 ) ) {
2009-01-19 16:13:32 +03:00
SIM - > get_param_string ( BXPN_OHCI_PORT1 ) - > set ( & params [ i ] [ 6 ] ) ;
2005-04-03 19:00:44 +04:00
} else if ( ! strncmp ( params [ i ] , " port2= " , 6 ) ) {
2009-01-19 16:13:32 +03:00
SIM - > get_param_string ( BXPN_OHCI_PORT2 ) - > set ( & params [ i ] [ 6 ] ) ;
2005-04-03 19:00:44 +04:00
} else {
2009-01-19 16:13:32 +03:00
PARSE_WARN ( ( " %s: unknown parameter '%s' for usb_ohci ignored. " , context , params [ i ] ) ) ;
2005-04-03 19:00:44 +04:00
}
}
} else if ( ! strcmp ( params [ 0 ] , " i440fxsupport " ) ) {
2006-02-20 00:35:50 +03:00
char tmpdev [ 80 ] ;
2005-11-13 17:26:02 +03:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
2006-02-20 00:35:50 +03:00
SIM - > get_param_bool ( BXPN_I440FX_SUPPORT ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2005-11-13 17:26:02 +03:00
} else if ( ( ! strncmp ( params [ i ] , " slot " , 4 ) ) & & ( params [ i ] [ 5 ] = = ' = ' ) ) {
2006-02-20 00:35:50 +03:00
slot = atol ( & params [ i ] [ 4 ] ) ;
if ( ( slot > 0 ) & & ( slot < 6 ) ) {
sprintf ( tmpdev , " pci.slot.%d " , slot ) ;
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( tmpdev ) - > set ( & params [ i ] [ 6 ] ) ;
2005-11-13 17:26:02 +03:00
} else {
BX_ERROR ( ( " %s: unknown pci slot number ignored. " , context ) ) ;
2004-06-29 23:24:34 +04:00
}
2005-11-13 17:26:02 +03:00
} else {
PARSE_ERR ( ( " %s: i440fxsupport: unknown parameter '%s'. " , context , params [ i ] ) ) ;
2004-06-29 23:24:34 +04:00
}
2004-06-05 02:06:55 +04:00
}
2005-11-13 17:26:02 +03:00
} else if ( ! strcmp ( params [ 0 ] , " pcidev " ) ) {
2004-06-05 02:06:55 +04:00
if ( num_params ! = 3 ) {
PARSE_ERR ( ( " %s: pcidev directive malformed. " , context ) ) ;
}
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " vendor= " , 7 ) ) {
2008-02-15 22:03:54 +03:00
if ( ( params [ i ] [ 7 ] = = ' 0 ' ) & & ( toupper ( params [ i ] [ 8 ] ) = = ' X ' ) )
2006-02-21 00:29:13 +03:00
SIM - > get_param_num ( BXPN_PCIDEV_VENDOR ) - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 16 ) ) ;
2004-06-05 02:06:55 +04:00
else
2006-02-21 00:29:13 +03:00
SIM - > get_param_num ( BXPN_PCIDEV_VENDOR ) - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 10 ) ) ;
2004-06-05 02:06:55 +04:00
}
else if ( ! strncmp ( params [ i ] , " device= " , 7 ) ) {
2008-02-15 22:03:54 +03:00
if ( ( params [ i ] [ 7 ] = = ' 0 ' ) & & ( toupper ( params [ i ] [ 8 ] ) = = ' X ' ) )
2006-02-21 00:29:13 +03:00
SIM - > get_param_num ( BXPN_PCIDEV_DEVICE ) - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 16 ) ) ;
2004-06-05 02:06:55 +04:00
else
2006-02-21 00:29:13 +03:00
SIM - > get_param_num ( BXPN_PCIDEV_DEVICE ) - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 10 ) ) ;
2004-06-05 02:06:55 +04:00
}
else {
BX_ERROR ( ( " %s: unknown parameter for pcidev ignored. " , context ) ) ;
}
}
2005-09-12 00:03:56 +04:00
} else if ( ! strcmp ( params [ 0 ] , " cmosimage " ) ) {
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " file= " , 5 ) ) {
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_CMOSIMAGE_PATH ) - > set ( & params [ i ] [ 5 ] ) ;
2005-09-18 11:16:28 +04:00
} else if ( ! strcmp ( params [ i ] , " rtc_init=time0 " ) ) {
2006-02-19 18:43:03 +03:00
SIM - > get_param_bool ( BXPN_CMOSIMAGE_RTC_INIT ) - > set ( 0 ) ;
2005-09-18 11:16:28 +04:00
} else if ( ! strcmp ( params [ i ] , " rtc_init=image " ) ) {
2006-02-19 18:43:03 +03:00
SIM - > get_param_bool ( BXPN_CMOSIMAGE_RTC_INIT ) - > set ( 1 ) ;
2005-09-12 00:03:56 +04:00
} else {
// for backward compatiblity
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_CMOSIMAGE_PATH ) - > set ( params [ i ] ) ;
2004-06-05 02:06:55 +04:00
}
}
2006-02-19 18:43:03 +03:00
if ( strlen ( SIM - > get_param_string ( BXPN_CMOSIMAGE_PATH ) - > getptr ( ) ) > 0 ) {
SIM - > get_param_bool ( BXPN_CMOSIMAGE_ENABLED ) - > set ( 1 ) ;
2005-09-12 00:03:56 +04:00
}
} else if ( ! strcmp ( params [ 0 ] , " clock " ) ) {
2004-06-05 02:06:55 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " sync= " , 5 ) ) {
2006-02-19 18:43:03 +03:00
SIM - > get_param_enum ( BXPN_CLOCK_SYNC ) - > set_by_name ( & params [ i ] [ 5 ] ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( params [ i ] , " time0=local " ) ) {
2006-02-19 18:43:03 +03:00
SIM - > get_param_num ( BXPN_CLOCK_TIME0 ) - > set ( BX_CLOCK_TIME0_LOCAL ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( params [ i ] , " time0=utc " ) ) {
2006-02-19 18:43:03 +03:00
SIM - > get_param_num ( BXPN_CLOCK_TIME0 ) - > set ( BX_CLOCK_TIME0_UTC ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " time0= " , 6 ) ) {
2006-02-19 18:43:03 +03:00
SIM - > get_param_num ( BXPN_CLOCK_TIME0 ) - > set ( atoi ( & params [ i ] [ 6 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
BX_ERROR ( ( " %s: unknown parameter for clock ignored. " , context ) ) ;
}
}
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else if ( ! strcmp ( params [ 0 ] , " gdbstub " ) ) {
2005-03-16 19:36:31 +03:00
# if BX_GDBSTUB
2004-11-06 13:50:03 +03:00
if ( num_params < 2 ) {
PARSE_ERR ( ( " %s: gdbstub directive: wrong # args. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2006-03-04 15:43:47 +03:00
base = ( bx_list_c * ) SIM - > get_param ( BXPN_GDBSTUB ) ;
2004-11-06 13:50:03 +03:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
if ( params [ i ] [ 8 ] = = ' 0 ' ) {
2006-03-04 15:43:47 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 0 ) ;
2004-11-06 13:50:03 +03:00
BX_INFO ( ( " Disabled gdbstub " ) ) ;
bx_dbg . gdbstub_enabled = 0 ;
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else if ( params [ i ] [ 8 ] = = ' 1 ' ) {
2006-03-04 15:43:47 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
2004-11-06 13:50:03 +03:00
BX_INFO ( ( " Enabled gdbstub " ) ) ;
bx_dbg . gdbstub_enabled = 1 ;
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else {
PARSE_ERR ( ( " %s: gdbstub directive malformed. " , context ) ) ;
}
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else if ( ! strncmp ( params [ i ] , " port= " , 5 ) ) {
2006-04-25 19:59:20 +04:00
SIM - > get_param_num ( " port " , base ) - > set ( atoi ( & params [ i ] [ 5 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else if ( ! strncmp ( params [ i ] , " text_base= " , 10 ) ) {
2006-04-25 19:59:20 +04:00
SIM - > get_param_num ( " text_base " , base ) - > set ( atoi ( & params [ i ] [ 10 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else if ( ! strncmp ( params [ i ] , " data_base= " , 10 ) ) {
2006-04-25 19:59:20 +04:00
SIM - > get_param_num ( " data_base " , base ) - > set ( atoi ( & params [ i ] [ 10 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else if ( ! strncmp ( params [ i ] , " bss_base= " , 9 ) ) {
2006-04-25 19:59:20 +04:00
SIM - > get_param_num ( " bss_base " , base ) - > set ( atoi ( & params [ i ] [ 9 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
else {
PARSE_ERR ( ( " %s: gdbstub directive malformed. " , context ) ) ;
}
2006-01-23 21:39:10 +03:00
}
2004-11-06 13:50:03 +03:00
# else
PARSE_ERR ( ( " %s: Bochs is not compiled with gdbstub support " , context ) ) ;
# endif
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( params [ 0 ] , " magic_break " ) ) {
2008-01-22 00:36:58 +03:00
# if BX_DEBUGGER
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: magic_break directive: wrong # args. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
PARSE_ERR ( ( " %s: magic_break directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( params [ 1 ] [ 8 ] = = ' 0 ' ) {
BX_INFO ( ( " Ignoring magic break points " ) ) ;
bx_dbg . magic_break_enabled = 0 ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( params [ 1 ] [ 8 ] = = ' 1 ' ) {
BX_INFO ( ( " Stopping on magic break points " ) ) ;
bx_dbg . magic_break_enabled = 1 ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
PARSE_ERR ( ( " %s: magic_break directive malformed. " , context ) ) ;
}
2008-01-22 00:36:58 +03:00
# else
2010-02-10 01:14:54 +03:00
PARSE_WARN ( ( " %s: Bochs is not compiled with internal debugger support " , context ) ) ;
2004-06-05 02:06:55 +04:00
# endif
2008-01-22 00:36:58 +03:00
}
2008-03-30 18:32:14 +04:00
else if ( ! strcmp ( params [ 0 ] , " debug_symbols " ) ) {
2009-05-03 23:21:38 +04:00
if ( parse_debug_symbols ( context , ( const char * * ) ( params + 1 ) , num_params - 1 ) < 0 ) {
2008-03-30 18:32:14 +04:00
return - 1 ;
}
}
2007-11-20 21:36:26 +03:00
else if ( ! strcmp ( params [ 0 ] , " print_timestamps " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: print_timestamps directive: wrong # args. " , context ) ) ;
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
PARSE_ERR ( ( " %s: print_timestamps directive malformed. " , context ) ) ;
}
if ( params [ 1 ] [ 8 ] = = ' 0 ' | | params [ 1 ] [ 8 ] = = ' 1 ' ) {
bx_dbg . print_timestamps = params [ 1 ] [ 8 ] - ' 0 ' ;
}
else {
PARSE_ERR ( ( " %s: print_timestamps directive malformed. " , context ) ) ;
}
}
2009-04-23 22:28:17 +04:00
else if ( ! strcmp ( params [ 0 ] , " port_e9_hack " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: port_e9_hack directive: wrong # args. " , context ) ) ;
}
if ( strncmp ( params [ 1 ] , " enabled= " , 8 ) ) {
PARSE_ERR ( ( " %s: port_e9_hack directive malformed. " , context ) ) ;
}
2010-03-01 21:53:53 +03:00
if ( parse_param_bool ( params [ 1 ] , 8 , BXPN_PORT_E9_HACK ) < 0 ) {
2009-04-23 22:28:17 +04:00
PARSE_ERR ( ( " %s: port_e9_hack directive malformed. " , context ) ) ;
}
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( params [ 0 ] , " ne2k " ) ) {
int tmp [ 6 ] ;
char tmpchar [ 6 ] ;
2009-05-05 21:16:31 +04:00
char tmpdev [ 80 ] ;
2004-06-05 02:06:55 +04:00
int valid = 0 ;
int n ;
2006-03-02 23:13:14 +03:00
base = ( bx_list_c * ) SIM - > get_param ( BXPN_NE2K ) ;
if ( ! SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
SIM - > get_param_enum ( " ethmod " , base ) - > set_by_name ( " null " ) ;
2006-01-23 21:39:10 +03:00
}
2009-05-05 21:16:31 +04:00
if ( SIM - > get_param_bool ( BXPN_I440FX_SUPPORT ) - > get ( ) ) {
for ( slot = 1 ; slot < 6 ; slot + + ) {
sprintf ( tmpdev , " pci.slot.%d " , slot ) ;
if ( ! strcmp ( SIM - > get_param_string ( tmpdev ) - > getptr ( ) , " ne2k " ) ) {
valid | = 0x03 ;
break ;
}
}
}
2004-06-05 02:06:55 +04:00
for ( i = 1 ; i < num_params ; i + + ) {
2004-12-14 22:27:42 +03:00
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
if ( atol ( & params [ i ] [ 8 ] ) = = 0 ) valid | = 0x80 ;
2006-01-23 21:39:10 +03:00
}
2004-12-14 22:27:42 +03:00
else if ( ! strncmp ( params [ i ] , " ioaddr= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_num ( " ioaddr " , base ) - > set ( strtoul ( & params [ i ] [ 7 ] , NULL , 16 ) ) ;
2004-06-05 02:06:55 +04:00
valid | = 0x01 ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " irq= " , 4 ) ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_num ( " irq " , base ) - > set ( atol ( & params [ i ] [ 4 ] ) ) ;
2004-06-05 02:06:55 +04:00
valid | = 0x02 ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " mac= " , 4 ) ) {
n = sscanf ( & params [ i ] [ 4 ] , " %x:%x:%x:%x:%x:%x " ,
& tmp [ 0 ] , & tmp [ 1 ] , & tmp [ 2 ] , & tmp [ 3 ] , & tmp [ 4 ] , & tmp [ 5 ] ) ;
if ( n ! = 6 ) {
PARSE_ERR ( ( " %s: ne2k mac address malformed. " , context ) ) ;
}
for ( n = 0 ; n < 6 ; n + + )
tmpchar [ n ] = ( unsigned char ) tmp [ n ] ;
2006-03-02 23:13:14 +03:00
SIM - > get_param_string ( " macaddr " , base ) - > set ( tmpchar ) ;
2004-06-05 02:06:55 +04:00
valid | = 0x04 ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " ethmod= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
if ( ! SIM - > get_param_enum ( " ethmod " , base ) - > set_by_name ( & params [ i ] [ 7 ] ) )
2006-06-05 23:06:36 +04:00
PARSE_ERR ( ( " %s: ethernet module '%s' not available " , context , & params [ i ] [ 7 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " ethdev= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_string ( " ethdev " , base ) - > set ( & params [ i ] [ 7 ] ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " script= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_string ( " script " , base ) - > set ( & params [ i ] [ 7 ] ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
2004-12-14 22:27:42 +03:00
PARSE_WARN ( ( " %s: unknown parameter '%s' for ne2k ignored. " , context , params [ i ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
}
2006-03-02 23:13:14 +03:00
if ( ! SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
2004-06-05 02:06:55 +04:00
if ( valid = = 0x07 ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
} else if ( valid < 0x80 ) {
2009-05-05 21:16:31 +04:00
if ( ( valid & 0x03 ) ! = 0x03 ) {
PARSE_ERR ( ( " %s: ne2k directive incomplete (ioaddr and irq are required) " , context ) ) ;
}
if ( ( valid & 0x04 ) = = 0 ) {
PARSE_ERR ( ( " %s: ne2k directive incomplete (mac address is required) " , context ) ) ;
}
2004-06-05 02:06:55 +04:00
}
2006-03-02 23:13:14 +03:00
} else {
2004-12-14 22:27:42 +03:00
if ( valid & 0x80 ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 0 ) ;
2004-12-14 22:27:42 +03:00
}
}
2005-09-23 01:12:26 +04:00
} else if ( ! strcmp ( params [ 0 ] , " pnic " ) ) {
2004-12-14 22:27:42 +03:00
int tmp [ 6 ] ;
char tmpchar [ 6 ] ;
int valid = 0 ;
int n ;
2006-03-02 23:13:14 +03:00
base = ( bx_list_c * ) SIM - > get_param ( BXPN_PNIC ) ;
if ( ! SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
SIM - > get_param_enum ( " ethmod " , base ) - > set_by_name ( " null " ) ;
2005-09-23 01:12:26 +04:00
}
2004-12-14 22:27:42 +03:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " enabled= " , 8 ) ) {
if ( atol ( & params [ i ] [ 8 ] ) = = 0 ) valid | = 0x80 ;
2005-09-23 01:12:26 +04:00
} else if ( ! strncmp ( params [ i ] , " mac= " , 4 ) ) {
2004-12-14 22:27:42 +03:00
n = sscanf ( & params [ i ] [ 4 ] , " %x:%x:%x:%x:%x:%x " ,
& tmp [ 0 ] , & tmp [ 1 ] , & tmp [ 2 ] , & tmp [ 3 ] , & tmp [ 4 ] , & tmp [ 5 ] ) ;
if ( n ! = 6 ) {
PARSE_ERR ( ( " %s: pnic mac address malformed. " , context ) ) ;
}
for ( n = 0 ; n < 6 ; n + + )
tmpchar [ n ] = ( unsigned char ) tmp [ n ] ;
2006-03-02 23:13:14 +03:00
SIM - > get_param_string ( " macaddr " , base ) - > set ( tmpchar ) ;
2005-09-23 01:12:26 +04:00
valid | = 0x07 ;
} else if ( ! strncmp ( params [ i ] , " ethmod= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
if ( ! SIM - > get_param_enum ( " ethmod " , base ) - > set_by_name ( & params [ i ] [ 7 ] ) )
2006-06-05 23:06:36 +04:00
PARSE_ERR ( ( " %s: ethernet module '%s' not available " , context , & params [ i ] [ 7 ] ) ) ;
2005-09-23 01:12:26 +04:00
} else if ( ! strncmp ( params [ i ] , " ethdev= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_string ( " ethdev " , base ) - > set ( & params [ i ] [ 7 ] ) ;
2005-09-23 01:12:26 +04:00
} else if ( ! strncmp ( params [ i ] , " script= " , 7 ) ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_string ( " script " , base ) - > set ( & params [ i ] [ 7 ] ) ;
2005-09-23 01:12:26 +04:00
} else {
2004-12-14 22:27:42 +03:00
PARSE_WARN ( ( " %s: unknown parameter '%s' for pnic ignored. " , context , params [ i ] ) ) ;
}
2005-09-23 01:12:26 +04:00
}
2006-03-02 23:13:14 +03:00
if ( ! SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
2004-12-14 22:27:42 +03:00
if ( valid = = 0x07 ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 1 ) ;
2005-09-23 01:12:26 +04:00
} else if ( valid < 0x80 ) {
2006-03-02 23:13:14 +03:00
PARSE_ERR ( ( " %s: pnic directive incomplete (mac is required) " , context ) ) ;
2004-12-14 22:27:42 +03:00
}
2005-09-23 01:12:26 +04:00
} else {
2004-12-14 22:27:42 +03:00
if ( valid & 0x80 ) {
2006-03-02 23:13:14 +03:00
SIM - > get_param_bool ( " enabled " , base ) - > set ( 0 ) ;
2004-12-14 22:27:42 +03:00
}
2004-06-05 02:06:55 +04:00
}
2005-09-23 01:12:26 +04:00
} else if ( ! strcmp ( params [ 0 ] , " load32bitOSImage " ) ) {
2008-02-15 22:03:54 +03:00
if ( ( num_params ! = 4 ) & & ( num_params ! = 5 ) ) {
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: load32bitOSImage directive: wrong # args. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 1 ] , " os= " , 3 ) ) {
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( ! strcmp ( & params [ 1 ] [ 3 ] , " nullkernel " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( BXPN_LOAD32BITOS_WHICH ) - > set ( Load32bitOSNullKernel ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( & params [ 1 ] [ 3 ] , " linux " ) ) {
2006-02-24 01:48:57 +03:00
SIM - > get_param_enum ( BXPN_LOAD32BITOS_WHICH ) - > set ( Load32bitOSLinux ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else {
PARSE_ERR ( ( " %s: load32bitOSImage: unsupported OS. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 2 ] , " path= " , 5 ) ) {
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
if ( strncmp ( params [ 3 ] , " iolog= " , 6 ) ) {
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_LOAD32BITOS_PATH ) - > set ( & params [ 2 ] [ 5 ] ) ;
SIM - > get_param_string ( BXPN_LOAD32BITOS_IOLOG ) - > set ( & params [ 3 ] [ 6 ] ) ;
2004-06-05 02:06:55 +04:00
if ( num_params = = 5 ) {
if ( strncmp ( params [ 4 ] , " initrd= " , 7 ) ) {
PARSE_ERR ( ( " %s: load32bitOSImage: directive malformed. " , context ) ) ;
}
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_LOAD32BITOS_INITRD ) - > set ( & params [ 4 ] [ 7 ] ) ;
2004-06-05 02:06:55 +04:00
}
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( params [ 0 ] , " keyboard_type " ) ) {
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: keyboard_type directive: wrong # args. " , context ) ) ;
2006-01-23 21:39:10 +03:00
}
2006-02-24 15:05:24 +03:00
if ( ! SIM - > get_param_enum ( BXPN_KBD_TYPE ) - > set_by_name ( params [ 1 ] ) ) {
PARSE_ERR ( ( " %s: keyboard_type directive: wrong arg '%s'. " , context , params [ 1 ] ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04: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 ) ) {
2006-02-22 22:18:29 +03:00
SIM - > get_param_bool ( BXPN_KBD_USEMAPPING ) - > set ( atol ( & params [ i ] [ 8 ] ) ) ;
2006-01-23 21:39:10 +03:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strncmp ( params [ i ] , " map= " , 4 ) ) {
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_KBD_KEYMAP ) - > set ( & params [ i ] [ 4 ] ) ;
2004-06-05 02:06:55 +04:00
}
}
2006-01-23 21:39:10 +03:00
}
2005-10-10 23:32:53 +04:00
else if ( ! strcmp ( params [ 0 ] , " user_shortcut " ) )
{
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: user_shortcut directive: wrong # args. " , context ) ) ;
2005-10-10 23:32:53 +04:00
}
2004-06-05 02:06:55 +04:00
if ( ! strncmp ( params [ 1 ] , " keys= " , 4 ) ) {
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_USER_SHORTCUT ) - > set ( & params [ 1 ] [ 5 ] ) ;
2005-10-22 12:07:53 +04:00
if ( ( strchr ( & params [ 1 ] [ 5 ] , ' - ' ) = = NULL ) & & ( strlen ( & params [ 1 ] [ 5 ] ) > 5 ) )
2005-10-10 23:32:53 +04:00
PARSE_WARN ( ( " user_shortcut: old-style syntax detected " ) ) ;
} else {
PARSE_ERR ( ( " %s: user_shortcut directive malformed. " , context ) ) ;
2004-06-05 02:06:55 +04:00
}
2005-10-10 23:32:53 +04:00
}
else if ( ! strcmp ( params [ 0 ] , " config_interface " ) )
{
2004-06-05 02:06:55 +04:00
if ( num_params ! = 2 ) {
PARSE_ERR ( ( " %s: config_interface directive: wrong # args. " , context ) ) ;
2005-10-10 23:32:53 +04:00
}
2006-02-22 00:35:09 +03:00
if ( ! SIM - > get_param_enum ( BXPN_SEL_CONFIG_INTERFACE ) - > set_by_name ( params [ 1 ] ) )
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: config_interface '%s' not available " , context , params [ 1 ] ) ) ;
2005-10-10 23:32:53 +04:00
}
2004-06-05 02:06:55 +04:00
else if ( ! strcmp ( params [ 0 ] , " display_library " ) ) {
if ( ( num_params < 2 ) | | ( num_params > 3 ) ) {
PARSE_ERR ( ( " %s: display_library directive: wrong # args. " , context ) ) ;
2005-10-10 23:32:53 +04:00
}
2006-02-22 00:35:09 +03:00
if ( ! SIM - > get_param_enum ( BXPN_SEL_DISPLAY_LIBRARY ) - > set_by_name ( params [ 1 ] ) )
2004-06-05 02:06:55 +04:00
PARSE_ERR ( ( " %s: display library '%s' not available " , context , params [ 1 ] ) ) ;
if ( num_params = = 3 ) {
if ( ! strncmp ( params [ 2 ] , " options= " , 8 ) ) {
2006-02-28 17:02:06 +03:00
SIM - > get_param_string ( BXPN_DISPLAYLIB_OPTIONS ) - > set ( & params [ 2 ] [ 8 ] ) ;
2004-06-05 02:06:55 +04:00
}
}
2005-10-10 23:32:53 +04:00
}
2009-01-02 14:51:03 +03:00
# if BX_PLUGINS
else if ( ! strcmp ( params [ 0 ] , " user_plugin " ) ) {
char tmpname [ 80 ] ;
2009-01-05 00:46:20 +03:00
for ( i = 1 ; i < num_params ; i + + ) {
if ( ! strncmp ( params [ i ] , " name= " , 5 ) ) {
if ( bx_user_plugin_count < BX_N_USER_PLUGINS ) {
sprintf ( tmpname , " misc.user_plugin.%d " , + + bx_user_plugin_count ) ;
SIM - > get_param_string ( tmpname ) - > set ( & params [ i ] [ 5 ] ) ;
2009-01-02 14:51:03 +03:00
} else {
2009-01-05 00:46:20 +03:00
PARSE_ERR ( ( " %s: too many user plugins " , context ) ) ;
2009-01-02 14:51:03 +03:00
}
2009-01-05 00:46:20 +03:00
} else {
PARSE_ERR ( ( " %s: unknown user plugin parameter '%s' " , context , params [ i ] ) ) ;
2009-01-02 14:51:03 +03:00
}
}
}
# endif
2009-02-21 14:43:18 +03:00
else if ( ! strcmp ( params [ 0 ] , " plugin_ctrl " ) ) {
char * pname , * val ;
bx_param_bool_c * plugin ;
for ( i = 1 ; i < num_params ; i + + ) {
pname = strtok ( params [ i ] , " = " ) ;
val = strtok ( NULL , " " ) ;
base = ( bx_list_c * ) SIM - > get_param ( BXPN_PLUGIN_CTRL ) ;
plugin = ( bx_param_bool_c * ) base - > get_by_name ( pname ) ;
if ( plugin ! = NULL ) {
plugin - > set ( atoi ( val ) ) ;
} else {
PARSE_ERR ( ( " %s: unknown optional plugin '%s' " , context , pname ) ) ;
}
}
}
2006-03-29 23:27:31 +04:00
// user-defined options handled by registered functions
2009-01-06 23:35:39 +03:00
else if ( SIM - > is_user_option ( params [ 0 ] ) )
2006-03-29 23:27:31 +04:00
{
2009-01-06 23:35:39 +03:00
return SIM - > parse_user_option ( context , num_params , & params [ 0 ] ) ;
2006-03-29 23:27:31 +04:00
}
2005-10-10 23:32:53 +04:00
else
{
2008-02-16 01:05:43 +03:00
PARSE_ERR ( ( " %s: directive '%s' not understood " , context , params [ 0 ] ) ) ;
2005-10-10 23:32:53 +04:00
}
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-02-25 01:35:46 +03:00
2007-10-25 03:29:40 +04:00
static const char * fdtypes [ ] = {
2004-06-05 02:06:55 +04:00
" none " , " 1_2 " , " 1_44 " , " 2_88 " , " 720k " , " 360k " , " 160k " , " 180k " , " 320k "
} ;
2006-03-01 20:14:36 +03:00
int bx_write_floppy_options ( FILE * fp , int drive )
2004-06-05 02:06:55 +04:00
{
2010-07-03 15:13:40 +04:00
char devtype [ 80 ] , path [ 80 ] , type [ 80 ] , status [ 80 ] , readonly [ 80 ] ;
2009-03-24 14:20:17 +03:00
int ftype ;
2006-02-25 01:35:46 +03:00
BX_ASSERT ( drive = = 0 | | drive = = 1 ) ;
2009-03-24 14:20:17 +03:00
sprintf ( devtype , " floppy.%d.devtype " , drive ) ;
2006-02-25 01:35:46 +03:00
sprintf ( path , " floppy.%d.path " , drive ) ;
sprintf ( type , " floppy.%d.type " , drive ) ;
sprintf ( status , " floppy.%d.status " , drive ) ;
2010-07-03 15:13:40 +04:00
sprintf ( readonly , " floppy.%d.readonly " , drive ) ;
2009-03-24 14:20:17 +03:00
ftype = SIM - > get_param_enum ( devtype ) - > get ( ) ;
if ( ftype = = BX_FDD_NONE ) {
2006-02-25 01:35:46 +03:00
fprintf ( fp , " # no floppy%c \n " , ( char ) ' a ' + drive ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
2009-03-24 14:20:17 +03:00
} else {
fprintf ( fp , " floppy%c: type= " , ( char ) ' a ' + drive ) ;
if ( ftype = = BX_FDD_350ED ) {
fprintf ( fp , " 2_88 " ) ;
} else if ( ftype = = BX_FDD_350HD ) {
fprintf ( fp , " 1_44 " ) ;
} else if ( ftype = = BX_FDD_525HD ) {
fprintf ( fp , " 1_2 " ) ;
} else if ( ftype = = BX_FDD_350DD ) {
fprintf ( fp , " 720k " ) ;
} else if ( ftype = = BX_FDD_525DD ) {
fprintf ( fp , " 360k " ) ;
}
}
if ( ( SIM - > get_param_enum ( type ) - > get ( ) > BX_FLOPPY_NONE ) & &
( SIM - > get_param_enum ( type ) - > get ( ) < = BX_FLOPPY_LAST ) ) {
2010-07-03 15:13:40 +04:00
fprintf ( fp , " , %s= \" %s \" , status=%s, write_protected=%d " ,
2009-03-24 14:20:17 +03:00
fdtypes [ SIM - > get_param_enum ( type ) - > get ( ) - BX_FLOPPY_NONE ] ,
SIM - > get_param_string ( path ) - > getptr ( ) ,
2010-07-03 15:13:40 +04:00
SIM - > get_param_bool ( status ) - > get ( ) ? " inserted " : " ejected " ,
SIM - > get_param_bool ( readonly ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
}
2009-03-24 14:20:17 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-03-01 20:14:36 +03:00
int bx_write_ata_options ( FILE * fp , Bit8u channel , bx_list_c * base )
2004-06-05 02:06:55 +04:00
{
2006-02-26 22:11:20 +03:00
fprintf ( fp , " ata%d: enabled=%d " , channel , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
2006-02-26 22:11:20 +03:00
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
2008-02-06 01:57:43 +03:00
fprintf ( fp , " , ioaddr1=0x%x, ioaddr2=0x%x, irq=%d " , SIM - > get_param_num ( " ioaddr1 " , base ) - > get ( ) ,
2006-02-26 22:11:20 +03:00
SIM - > get_param_num ( " ioaddr2 " , base ) - > get ( ) , SIM - > get_param_num ( " irq " , base ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-02-26 22:11:20 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-03-01 20:14:36 +03:00
int bx_write_atadevice_options ( FILE * fp , Bit8u channel , Bit8u drive , bx_list_c * base )
2004-06-05 02:06:55 +04:00
{
2006-02-26 22:11:20 +03:00
if ( SIM - > get_param_bool ( " present " , base ) - > get ( ) ) {
fprintf ( fp , " ata%d-%s: " , channel , drive = = 0 ? " master " : " slave " ) ;
2004-06-05 02:06:55 +04:00
2006-02-26 22:11:20 +03:00
if ( SIM - > get_param_enum ( " type " , base ) - > get ( ) = = BX_ATA_DEVICE_DISK ) {
fprintf ( fp , " type=disk " ) ;
2004-06-05 02:06:55 +04:00
2006-03-02 00:24:20 +03:00
fprintf ( fp , " , mode=%s " , SIM - > get_param_enum ( " mode " , base ) - > get_selected ( ) ) ;
fprintf ( fp , " , translation=%s " , SIM - > get_param_enum ( " translation " , base ) - > get_selected ( ) ) ;
fprintf ( fp , " , path= \" %s \" , cylinders=%d, heads=%d, spt=%d " ,
2006-02-26 22:11:20 +03:00
SIM - > get_param_string ( " path " , base ) - > getptr ( ) ,
SIM - > get_param_num ( " cylinders " , base ) - > get ( ) ,
SIM - > get_param_num ( " heads " , base ) - > get ( ) ,
SIM - > get_param_num ( " spt " , base ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
2006-02-26 22:11:20 +03:00
if ( SIM - > get_param_string ( " journal " , base ) - > getptr ( ) ! = NULL )
if ( strcmp ( SIM - > get_param_string ( " journal " , base ) - > getptr ( ) , " " ) ! = 0 )
2006-03-02 00:24:20 +03:00
fprintf ( fp , " , journal= \" %s \" " , SIM - > get_param_string ( " journal " , base ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
2006-02-26 22:11:20 +03:00
} else if ( SIM - > get_param_enum ( " type " , base ) - > get ( ) = = BX_ATA_DEVICE_CDROM ) {
2008-02-06 01:57:43 +03:00
fprintf ( fp , " type=cdrom, path= \" %s \" , status=%s " ,
2006-02-26 22:11:20 +03:00
SIM - > get_param_string ( " path " , base ) - > getptr ( ) ,
2009-03-22 23:18:17 +03:00
SIM - > get_param_bool ( " status " , base ) - > get ( ) ? " inserted " : " ejected " ) ;
2006-02-26 22:11:20 +03:00
}
2004-06-05 02:06:55 +04:00
2006-03-02 00:24:20 +03:00
fprintf ( fp , " , biosdetect=%s " , SIM - > get_param_enum ( " biosdetect " , base ) - > get_selected ( ) ) ;
2006-02-26 22:11:20 +03:00
if ( SIM - > get_param_string ( " model " , base ) - > getptr ( ) > 0 ) {
2006-03-02 00:24:20 +03:00
fprintf ( fp , " , model= \" %s \" " , SIM - > get_param_string ( " model " , base ) - > getptr ( ) ) ;
}
2004-06-05 02:06:55 +04:00
2006-03-02 00:24:20 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
}
return 0 ;
}
2006-03-01 20:14:36 +03:00
int bx_write_parport_options ( FILE * fp , bx_list_c * base , int n )
2004-06-05 02:06:55 +04:00
{
2006-03-01 20:14:36 +03:00
fprintf ( fp , " parport%d: enabled=%d " , n , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
fprintf ( fp , " , file= \" %s \" " , SIM - > get_param_string ( " outfile " , base ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-03-01 20:14:36 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-03-01 20:14:36 +03:00
int bx_write_serial_options ( FILE * fp , bx_list_c * base , int n )
2004-06-05 02:06:55 +04:00
{
2006-03-01 20:14:36 +03:00
fprintf ( fp , " com%d: enabled=%d " , n , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
fprintf ( fp , " , mode=%s " , SIM - > get_param_enum ( " mode " , base ) - > get_selected ( ) ) ;
fprintf ( fp , " , dev= \" %s \" " , SIM - > get_param_string ( " dev " , base ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-03-01 20:14:36 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2009-01-19 16:13:32 +03:00
int bx_write_usb_options ( FILE * fp , bx_list_c * base )
2004-06-05 02:06:55 +04:00
{
2009-01-19 16:13:32 +03:00
fprintf ( fp , " usb_%s: enabled=%d " , base - > get_name ( ) , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
2006-03-01 20:14:36 +03:00
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
2007-03-18 20:52:15 +03:00
fprintf ( fp , " , port1=%s " , SIM - > get_param_string ( " port1 " , base ) - > getptr ( ) ) ;
fprintf ( fp , " , port2=%s " , SIM - > get_param_string ( " port2 " , base ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-03-01 20:14:36 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-03-02 23:13:14 +03:00
int bx_write_pnic_options ( FILE * fp , bx_list_c * base )
2004-06-05 02:06:55 +04:00
{
2006-03-02 23:13:14 +03:00
fprintf ( fp , " pnic: enabled=%d " , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
char * ptr = SIM - > get_param_string ( " macaddr " , base ) - > getptr ( ) ;
2005-09-23 01:12:26 +04:00
fprintf ( fp , " , mac=%02x:%02x:%02x:%02x:%02x:%02x, ethmod=%s, ethdev=%s, script=%s " ,
2004-12-14 22:27:42 +03: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 ] ) ,
2006-03-02 23:13:14 +03:00
SIM - > get_param_enum ( " ethmod " , base ) - > get_selected ( ) ,
SIM - > get_param_string ( " ethdev " , base ) - > getptr ( ) ,
SIM - > get_param_string ( " script " , base ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
}
fprintf ( fp , " \n " ) ;
return 0 ;
}
2009-05-08 12:15:33 +04:00
int bx_write_ne2k_options ( FILE * fp , bx_list_c * base )
2004-06-05 02:06:55 +04:00
{
2006-03-02 23:13:14 +03:00
fprintf ( fp , " ne2k: enabled=%d " , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
2006-06-05 23:06:36 +04:00
char * ptr = SIM - > get_param_string ( " macaddr " , base ) - > getptr ( ) ;
2006-03-02 23:13:14 +03:00
fprintf ( fp , " , ioaddr=0x%x, irq=%d, mac=%02x:%02x:%02x:%02x:%02x:%02x, ethmod=%s, ethdev=%s, script=%s " ,
2008-02-06 01:57:43 +03:00
SIM - > get_param_num ( " ioaddr " , base ) - > get ( ) ,
2006-03-02 23:13:14 +03:00
SIM - > get_param_num ( " irq " , base ) - > get ( ) ,
2004-06-05 02:06:55 +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 ] ) ,
2006-03-02 23:13:14 +03:00
SIM - > get_param_enum ( " ethmod " , base ) - > get_selected ( ) ,
SIM - > get_param_string ( " ethdev " , base ) - > getptr ( ) ,
SIM - > get_param_string ( " script " , base ) - > getptr ( ) ) ;
2004-12-14 22:27:42 +03:00
}
2006-03-02 23:13:14 +03:00
fprintf ( fp , " \n " ) ;
2004-12-14 22:27:42 +03:00
return 0 ;
}
2009-05-08 12:15:33 +04:00
int bx_write_sb16_options ( FILE * fp , bx_list_c * base )
2004-12-14 22:27:42 +03:00
{
2006-03-03 23:29:50 +03:00
fprintf ( fp , " sb16: enabled=%d " , SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) ;
if ( SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ) {
fprintf ( fp , " , midimode=%d, midi=%s, wavemode=%d, wave=%s, loglevel=%d, log=%s, dmatimer=%d " ,
SIM - > get_param_num ( " midimode " , base ) - > get ( ) ,
SIM - > get_param_string ( " midifile " , base ) - > getptr ( ) ,
SIM - > get_param_num ( " wavemode " , base ) - > get ( ) ,
SIM - > get_param_string ( " wavefile " , base ) - > getptr ( ) ,
SIM - > get_param_num ( " loglevel " , base ) - > get ( ) ,
SIM - > get_param_string ( " logfile " , base ) - > getptr ( ) ,
SIM - > get_param_num ( " dmatimer " , base ) - > get ( ) ) ;
2004-12-14 22:27:42 +03:00
}
2006-03-03 23:29:50 +03:00
fprintf ( fp , " \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-02-24 01:48:57 +03:00
int bx_write_loader_options ( FILE * fp )
2004-06-05 02:06:55 +04:00
{
2006-02-24 01:48:57 +03:00
if ( SIM - > get_param_enum ( BXPN_LOAD32BITOS_WHICH ) - > get ( ) = = Load32bitOSNone ) {
fprintf ( fp , " # no loader \n " ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-02-24 01:48:57 +03:00
BX_ASSERT ( ( SIM - > get_param_enum ( BXPN_LOAD32BITOS_WHICH ) - > get ( ) = = Load32bitOSLinux ) | |
( SIM - > get_param_enum ( BXPN_LOAD32BITOS_WHICH ) - > get ( ) = = Load32bitOSNullKernel ) ) ;
2004-06-05 02:06:55 +04:00
fprintf ( fp , " load32bitOSImage: os=%s, path=%s, iolog=%s, initrd=%s \n " ,
2006-02-24 01:48:57 +03:00
( SIM - > get_param_enum ( BXPN_LOAD32BITOS_WHICH ) - > get ( ) = = Load32bitOSLinux ) ? " linux " : " nullkernel " ,
SIM - > get_param_string ( BXPN_LOAD32BITOS_PATH ) - > getptr ( ) ,
SIM - > get_param_string ( BXPN_LOAD32BITOS_IOLOG ) - > getptr ( ) ,
SIM - > get_param_string ( BXPN_LOAD32BITOS_INITRD ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-02-19 18:43:03 +03:00
int bx_write_clock_cmos_options ( FILE * fp )
2004-06-05 02:06:55 +04:00
{
2006-02-19 18:43:03 +03:00
fprintf ( fp , " clock: " ) ;
2004-06-05 02:06:55 +04:00
2006-02-19 18:43:03 +03:00
switch ( SIM - > get_param_enum ( BXPN_CLOCK_SYNC ) - > get ( ) ) {
2004-06-05 02:06:55 +04:00
case BX_CLOCK_SYNC_NONE :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " sync=none " ) ;
2004-06-05 02:06:55 +04:00
break ;
case BX_CLOCK_SYNC_REALTIME :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " sync=realtime " ) ;
2004-06-05 02:06:55 +04:00
break ;
case BX_CLOCK_SYNC_SLOWDOWN :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " sync=slowdown " ) ;
2004-06-05 02:06:55 +04:00
break ;
case BX_CLOCK_SYNC_BOTH :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " sync=both " ) ;
2004-06-05 02:06:55 +04:00
break ;
default :
BX_PANIC ( ( " Unknown value for sync method " ) ) ;
}
2006-02-19 18:43:03 +03:00
switch ( SIM - > get_param_num ( BXPN_CLOCK_TIME0 ) - > get ( ) ) {
2004-06-05 02:06:55 +04:00
case 0 : break ;
2008-02-06 01:57:43 +03:00
case BX_CLOCK_TIME0_LOCAL :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " , time0=local " ) ;
2004-06-05 02:06:55 +04:00
break ;
2008-02-06 01:57:43 +03:00
case BX_CLOCK_TIME0_UTC :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " , time0=utc " ) ;
2004-06-05 02:06:55 +04:00
break ;
2008-02-06 01:57:43 +03:00
default :
2006-02-19 18:43:03 +03:00
fprintf ( fp , " , time0=%u " , SIM - > get_param_num ( BXPN_CLOCK_TIME0 ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
}
2006-02-19 18:43:03 +03:00
fprintf ( fp , " \n " ) ;
if ( strlen ( SIM - > get_param_string ( BXPN_CMOSIMAGE_PATH ) - > getptr ( ) ) > 0 ) {
fprintf ( fp , " cmosimage: file=%s, " , SIM - > get_param_string ( BXPN_CMOSIMAGE_PATH ) - > getptr ( ) ) ;
2007-12-07 01:21:40 +03:00
fprintf ( fp , " rtc_init=%s \n " , SIM - > get_param_bool ( BXPN_CMOSIMAGE_RTC_INIT ) - > get ( ) ? " image " : " time0 " ) ;
2006-02-19 18:43:03 +03:00
} else {
fprintf ( fp , " # no cmosimage \n " ) ;
}
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-03-05 13:24:29 +03:00
int bx_write_log_options ( FILE * fp , bx_list_c * base )
2004-06-05 02:06:55 +04:00
{
2006-03-05 13:24:29 +03:00
fprintf ( fp , " log: %s \n " , SIM - > get_param_string ( " filename " , base ) - > getptr ( ) ) ;
fprintf ( fp , " logprefix: %s \n " , SIM - > get_param_string ( " prefix " , base ) - > getptr ( ) ) ;
fprintf ( fp , " panic: action=%s \n " ,
2008-09-13 01:05:49 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_PANIC ) ) ) ;
2006-03-05 13:24:29 +03:00
fprintf ( fp , " error: action=%s \n " ,
2008-09-13 01:05:49 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_ERROR ) ) ) ;
2006-03-05 13:24:29 +03:00
fprintf ( fp , " info: action=%s \n " ,
2008-09-13 01:05:49 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_INFO ) ) ) ;
2006-03-05 13:24:29 +03:00
fprintf ( fp , " debug: action=%s \n " ,
2008-09-13 01:05:49 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_DEBUG ) ) ) ;
2006-03-05 13:24:29 +03:00
fprintf ( fp , " pass: action=%s \n " ,
2008-09-13 01:05:49 +04:00
io - > getaction ( logfunctions : : get_default_action ( LOGLEV_PASS ) ) ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2006-02-22 22:18:29 +03:00
int bx_write_keyboard_options ( FILE * fp )
2004-06-05 02:06:55 +04:00
{
2006-02-24 15:05:24 +03:00
fprintf ( fp , " keyboard_type: %s \n " , SIM - > get_param_enum ( BXPN_KBD_TYPE ) - > get_selected ( ) ) ;
2006-02-22 22:18:29 +03:00
fprintf ( fp , " keyboard_serial_delay: %u \n " , SIM - > get_param_num ( BXPN_KBD_SERIAL_DELAY ) - > get ( ) ) ;
fprintf ( fp , " keyboard_paste_delay: %u \n " , SIM - > get_param_num ( BXPN_KBD_PASTE_DELAY ) - > get ( ) ) ;
fprintf ( fp , " keyboard_mapping: enabled=%d, map=%s \n " ,
SIM - > get_param_bool ( BXPN_KBD_USEMAPPING ) - > get ( ) ,
SIM - > get_param_string ( BXPN_KBD_KEYMAP ) - > getptr ( ) ) ;
fprintf ( fp , " user_shortcut: keys=%s \n " , SIM - > get_param_string ( BXPN_USER_SHORTCUT ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}
2009-05-08 18:53:45 +04:00
int bx_write_debugger_options ( FILE * fp )
{
# if BX_DEBUGGER
fprintf ( fp , " debugger_log: %s \n " , SIM - > get_param_string ( BXPN_DEBUGGER_LOG_FILENAME ) - > getptr ( ) ) ;
fprintf ( fp , " magic_break: enabled=%d \n " , bx_dbg . magic_break_enabled ) ;
// TODO: debug symbols
# endif
# if BX_GDBSTUB
bx_list_c * base = ( bx_list_c * ) SIM - > get_param ( BXPN_GDBSTUB ) ;
bx_bool enabled = SIM - > get_param_bool ( " enabled " , base ) - > get ( ) ;
if ( enabled ) {
fprintf ( fp , " gdbstub: enabled=%d, port=%d, text_base=%d, data_base=%d, bss_base=%d \n " ,
enabled , SIM - > get_param_num ( " port " , base ) - > get ( ) , SIM - > get_param_num ( " text_base " , base ) - > get ( ) ,
SIM - > get_param_num ( " data_base " , base ) - > get ( ) , SIM - > get_param_num ( " bss_base " , base ) - > get ( ) ) ;
} else {
fprintf ( fp , " # no gdb stub \n " ) ;
}
# endif
return 0 ;
}
2004-06-05 02:06:55 +04:00
// return values:
// 0: written ok
// -1: failed
// -2: already exists, and overwrite was off
2006-03-13 21:55:53 +03:00
int bx_write_configuration ( const char * rc , int overwrite )
2004-06-05 02:06:55 +04:00
{
2004-07-03 03:18:21 +04:00
int i ;
2006-02-20 00:35:50 +03:00
char * strptr , tmppath [ 80 ] , tmpaddr [ 80 ] , tmpdev [ 80 ] ;
2006-02-26 22:11:20 +03:00
bx_list_c * base ;
2006-06-05 21:33:25 +04:00
BX_INFO ( ( " write current configuration to %s " , rc ) ) ;
2004-06-05 02:06:55 +04:00
// check if it exists. If so, only proceed if overwrite is set.
2006-02-22 00:35:09 +03:00
FILE * fp = fopen ( rc , " r " ) ;
2004-06-05 02:06:55 +04:00
if ( fp ! = NULL ) {
2006-02-22 00:35:09 +03:00
fclose ( fp ) ;
2004-06-05 02:06:55 +04:00
if ( ! overwrite ) return - 2 ;
}
2006-02-22 00:35:09 +03:00
fp = fopen ( rc , " w " ) ;
2004-06-05 02:06:55 +04:00
if ( fp = = NULL ) return - 1 ;
// finally it's open and we can start writing.
2006-02-22 00:35:09 +03:00
fprintf ( fp , " # configuration file generated by Bochs \n " ) ;
2009-01-02 14:51:03 +03:00
# if BX_PLUGINS
// user plugins
for ( i = 0 ; i < BX_N_USER_PLUGINS ; i + + ) {
sprintf ( tmpdev , " misc.user_plugin.%d " , i + 1 ) ;
2009-01-19 16:13:32 +03:00
if ( strlen ( SIM - > get_param_string ( tmpdev ) - > getptr ( ) ) > 0 ) {
fprintf ( fp , " user_plugin: name=%s \n " ,
SIM - > get_param_string ( tmpdev ) - > getptr ( ) ) ;
}
2009-01-02 14:51:03 +03:00
}
# endif
2009-05-08 18:53:45 +04:00
fprintf ( fp , " plugin_ctrl: " ) ;
base = ( bx_list_c * ) SIM - > get_param ( BXPN_PLUGIN_CTRL ) ;
for ( i = 0 ; i < base - > get_size ( ) ; i + + ) {
if ( i > 0 ) fprintf ( fp , " , " ) ;
bx_param_bool_c * plugin = ( bx_param_bool_c * ) ( base - > get ( i ) ) ;
fprintf ( fp , " %s=%d " , plugin - > get_name ( ) , plugin - > get ( ) ) ;
}
fprintf ( fp , " \n " ) ;
2006-02-22 00:35:09 +03:00
fprintf ( fp , " config_interface: %s \n " , SIM - > get_param_enum ( BXPN_SEL_CONFIG_INTERFACE ) - > get_selected ( ) ) ;
fprintf ( fp , " display_library: %s " , SIM - > get_param_enum ( BXPN_SEL_DISPLAY_LIBRARY ) - > get_selected ( ) ) ;
strptr = SIM - > get_param_string ( BXPN_DISPLAYLIB_OPTIONS ) - > getptr ( ) ;
if ( strlen ( strptr ) > 0 )
fprintf ( fp , " , options= \" %s \" \n " , strptr ) ;
2004-06-05 02:06:55 +04:00
else
2006-02-26 22:11:20 +03:00
fprintf ( fp , " \n " ) ;
2009-10-17 21:38:58 +04:00
fprintf ( fp , " memory: host=%d, guest=%d \n " , SIM - > get_param_num ( BXPN_HOST_MEM_SIZE ) - > get ( ) ,
SIM - > get_param_num ( BXPN_MEM_SIZE ) - > get ( ) ) ;
2006-02-18 01:27:38 +03:00
strptr = SIM - > get_param_string ( BXPN_ROM_PATH ) - > getptr ( ) ;
2007-03-19 01:27:37 +03:00
if ( strlen ( strptr ) > 0 ) {
fprintf ( fp , " romimage: file= \" %s \" " , strptr ) ;
if ( SIM - > get_param_num ( BXPN_ROM_ADDRESS ) - > get ( ) ! = 0 )
fprintf ( fp , " , address=0x%08x \n " , ( unsigned int ) SIM - > get_param_num ( BXPN_ROM_ADDRESS ) - > get ( ) ) ;
else
2007-04-08 19:02:50 +04:00
fprintf ( fp , " \n " ) ;
2007-03-19 01:27:37 +03:00
}
else {
2006-02-22 00:35:09 +03:00
fprintf ( fp , " # no romimage \n " ) ;
2007-03-19 01:27:37 +03:00
}
2006-02-18 01:27:38 +03:00
strptr = SIM - > get_param_string ( BXPN_VGA_ROM_PATH ) - > getptr ( ) ;
if ( strlen ( strptr ) > 0 )
2006-02-22 00:35:09 +03:00
fprintf ( fp , " vgaromimage: file= \" %s \" \n " , strptr ) ;
2004-06-05 02:06:55 +04:00
else
2006-02-22 00:35:09 +03:00
fprintf ( fp , " # no vgaromimage \n " ) ;
2006-02-24 01:48:57 +03:00
fprintf ( fp , " boot: %s " , SIM - > get_param_enum ( BXPN_BOOTDRIVE1 ) - > get_selected ( ) ) ;
2004-10-16 19:44:00 +04:00
for ( i = 1 ; i < 3 ; i + + ) {
2006-02-24 01:48:57 +03:00
sprintf ( tmppath , " boot_params.boot_drive%d " , i + 1 ) ;
if ( SIM - > get_param_enum ( tmppath ) - > get ( ) ! = BX_BOOT_NONE ) {
fprintf ( fp , " , %s " , SIM - > get_param_enum ( tmppath ) - > get_selected ( ) ) ;
2004-10-16 19:44:00 +04:00
}
}
2006-02-24 01:48:57 +03:00
fprintf ( fp , " \n " ) ;
fprintf ( fp , " floppy_bootsig_check: disabled=%d \n " , SIM - > get_param_bool ( BXPN_FLOPPYSIGCHECK ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
// it would be nice to put this type of function as methods on
// the structs like bx_floppy_options::print or something.
2006-02-25 01:35:46 +03:00
bx_write_floppy_options ( fp , 0 ) ;
bx_write_floppy_options ( fp , 1 ) ;
2004-06-05 02:06:55 +04:00
for ( Bit8u channel = 0 ; channel < BX_MAX_ATA_CHANNEL ; channel + + ) {
2006-02-26 22:11:20 +03:00
sprintf ( tmppath , " ata.%d " , channel ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmppath ) ;
bx_write_ata_options ( fp , channel , ( bx_list_c * ) SIM - > get_param ( " resources " , base ) ) ;
bx_write_atadevice_options ( fp , channel , 0 , ( bx_list_c * ) SIM - > get_param ( " master " , base ) ) ;
bx_write_atadevice_options ( fp , channel , 1 , ( bx_list_c * ) SIM - > get_param ( " slave " , base ) ) ;
2006-01-23 21:39:10 +03:00
}
2005-10-28 10:33:53 +04:00
for ( i = 0 ; i < BX_N_OPTROM_IMAGES ; i + + ) {
2006-02-18 01:27:38 +03:00
sprintf ( tmppath , " memory.optrom.%d.path " , i + 1 ) ;
sprintf ( tmpaddr , " memory.optrom.%d.addr " , i + 1 ) ;
strptr = SIM - > get_param_string ( tmppath ) - > getptr ( ) ;
if ( strlen ( strptr ) > 0 )
fprintf ( fp , " optromimage%d: file= \" %s \" , address=0x%05x \n " , i + 1 , strptr ,
( unsigned int ) SIM - > get_param_num ( tmpaddr ) - > get ( ) ) ;
2004-09-28 21:37:52 +04:00
}
2006-02-17 00:44:17 +03:00
for ( i = 0 ; i < BX_N_OPTRAM_IMAGES ; i + + ) {
2006-02-18 01:27:38 +03:00
sprintf ( tmppath , " memory.optram.%d.path " , i + 1 ) ;
sprintf ( tmpaddr , " memory.optram.%d.addr " , i + 1 ) ;
strptr = SIM - > get_param_string ( tmppath ) - > getptr ( ) ;
if ( strlen ( strptr ) > 0 )
fprintf ( fp , " optramimage%d: file= \" %s \" , address=0x%05x \n " , i + 1 , strptr ,
( unsigned int ) SIM - > get_param_num ( tmpaddr ) - > get ( ) ) ;
2005-10-28 04:12:27 +04:00
}
2004-07-03 03:18:21 +04:00
// parallel ports
for ( i = 0 ; i < BX_N_PARALLEL_PORTS ; i + + ) {
2006-03-01 20:14:36 +03:00
sprintf ( tmpdev , " ports.parallel.%d " , i + 1 ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmpdev ) ;
bx_write_parport_options ( fp , base , i + 1 ) ;
2004-07-03 03:18:21 +04:00
}
// serial ports
for ( i = 0 ; i < BX_N_SERIAL_PORTS ; i + + ) {
2006-03-01 20:14:36 +03:00
sprintf ( tmpdev , " ports.serial.%d " , i + 1 ) ;
base = ( bx_list_c * ) SIM - > get_param ( tmpdev ) ;
bx_write_serial_options ( fp , base , i + 1 ) ;
2004-07-03 03:18:21 +04:00
}
2009-01-19 16:13:32 +03:00
// usb
2009-01-20 00:39:03 +03:00
base = ( bx_list_c * ) SIM - > get_param ( " ports.usb.uhci " ) ;
2009-01-19 16:13:32 +03:00
bx_write_usb_options ( fp , base ) ;
2009-01-20 00:39:03 +03:00
base = ( bx_list_c * ) SIM - > get_param ( " ports.usb.ohci " ) ;
2009-01-19 16:13:32 +03:00
bx_write_usb_options ( fp , base ) ;
2004-07-03 03:18:21 +04:00
// pci
2006-02-20 00:35:50 +03:00
fprintf ( fp , " i440fxsupport: enabled=%d " ,
SIM - > get_param_bool ( BXPN_I440FX_SUPPORT ) - > get ( ) ) ;
if ( SIM - > get_param_bool ( BXPN_I440FX_SUPPORT ) - > get ( ) ) {
2004-07-03 03:18:21 +04:00
for ( i = 0 ; i < BX_N_PCI_SLOTS ; i + + ) {
2006-02-20 00:35:50 +03:00
sprintf ( tmpdev , " pci.slot.%d " , i + 1 ) ;
strptr = SIM - > get_param_string ( tmpdev ) - > getptr ( ) ;
if ( strlen ( strptr ) > 0 ) {
2006-02-26 22:11:20 +03:00
fprintf ( fp , " , slot%d=%s " , i + 1 , strptr ) ;
2004-07-03 03:18:21 +04:00
}
}
}
2006-02-26 22:11:20 +03:00
fprintf ( fp , " \n " ) ;
2006-02-24 01:48:57 +03:00
if ( SIM - > get_param_num ( BXPN_PCIDEV_VENDOR ) - > get ( ) ! = 0xffff ) {
2006-02-21 00:29:13 +03:00
fprintf ( fp , " pcidev: vendor=0x%04x, device=0x%04x \n " ,
2006-02-24 01:48:57 +03:00
SIM - > get_param_num ( BXPN_PCIDEV_VENDOR ) - > get ( ) ,
SIM - > get_param_num ( BXPN_PCIDEV_DEVICE ) - > get ( ) ) ;
2006-02-21 00:29:13 +03:00
}
2006-02-26 22:11:20 +03:00
fprintf ( fp , " vga_update_interval: %u \n " , SIM - > get_param_num ( BXPN_VGA_UPDATE_INTERVAL ) - > get ( ) ) ;
fprintf ( fp , " vga: extension=%s \n " , SIM - > get_param_string ( BXPN_VGA_EXTENSION ) - > getptr ( ) ) ;
2006-02-11 18:28:43 +03:00
# if BX_SUPPORT_SMP
2008-12-28 23:49:03 +03:00
fprintf ( fp , " cpu: count=%u:%u:%u, ips=%u, quantum=%d, " ,
2006-02-18 19:53:18 +03:00
SIM - > get_param_num ( BXPN_CPU_NPROCESSORS ) - > get ( ) , SIM - > get_param_num ( BXPN_CPU_NCORES ) - > get ( ) ,
SIM - > get_param_num ( BXPN_CPU_NTHREADS ) - > get ( ) , SIM - > get_param_num ( BXPN_IPS ) - > get ( ) ,
2008-12-28 23:49:03 +03:00
SIM - > get_param_num ( BXPN_SMP_QUANTUM ) - > get ( ) ) ;
2006-02-11 18:28:43 +03:00
# else
2008-12-28 23:49:03 +03:00
fprintf ( fp , " cpu: count=1, ips=%u, " , SIM - > get_param_num ( BXPN_IPS ) - > get ( ) ) ;
# endif
2010-02-26 01:04:31 +03:00
fprintf ( fp , " reset_on_triple_fault=%d " ,
SIM - > get_param_bool ( BXPN_RESET_ON_TRIPLE_FAULT ) - > get ( ) ) ;
2009-11-13 18:55:46 +03:00
# if BX_CPU_LEVEL >= 5
fprintf ( fp , " , ignore_bad_msrs=%d " , SIM - > get_param_bool ( BXPN_IGNORE_BAD_MSRS ) - > get ( ) ) ;
# endif
2008-12-28 23:49:03 +03:00
# if BX_CONFIGURE_MSRS
strptr = SIM - > get_param_string ( BXPN_CONFIGURABLE_MSRS_PATH ) - > getptr ( ) ;
if ( strlen ( strptr ) > 0 )
2009-04-23 22:28:17 +04:00
fprintf ( fp , " , msrs= \" %s \" " , strptr ) ;
2010-02-26 01:04:31 +03:00
# endif
fprintf ( fp , " \n " ) ;
fprintf ( fp , " cpuid: cpuid_limit_winnt=%d " , SIM - > get_param_bool ( BXPN_CPUID_LIMIT_WINNT ) - > get ( ) ) ;
2010-03-01 21:53:53 +03:00
# if BX_CPU_LEVEL >= 5
fprintf ( fp , " , mmx=%d " , SIM - > get_param_bool ( BXPN_CPUID_MMX ) - > get ( ) ) ;
# endif
2010-02-26 01:04:31 +03:00
# if BX_CPU_LEVEL >= 6
2010-02-28 17:52:17 +03:00
fprintf ( fp , " , sse=%s, xapic=%d, sep=%d, aes=%d, xsave=%d, movbe=%d " ,
2010-02-26 01:04:31 +03:00
SIM - > get_param_enum ( BXPN_CPUID_SSE ) - > get_selected ( ) ,
2010-02-28 17:52:17 +03:00
SIM - > get_param_bool ( BXPN_CPUID_XAPIC ) - > get ( ) ,
2010-02-26 14:44:50 +03:00
SIM - > get_param_bool ( BXPN_CPUID_SEP ) - > get ( ) ,
2010-02-26 01:04:31 +03:00
SIM - > get_param_bool ( BXPN_CPUID_AES ) - > get ( ) ,
2010-02-27 01:53:43 +03:00
SIM - > get_param_bool ( BXPN_CPUID_XSAVE ) - > get ( ) ,
2010-02-26 01:04:31 +03:00
SIM - > get_param_bool ( BXPN_CPUID_MOVBE ) - > get ( ) ) ;
2010-04-24 13:36:04 +04:00
# if BX_SUPPORT_X86_64
2010-04-29 23:34:32 +04:00
fprintf ( fp , " , 1g_pages=%d, pcid=%d " ,
SIM - > get_param_bool ( BXPN_CPUID_1G_PAGES ) - > get ( ) ,
SIM - > get_param_bool ( BXPN_CPUID_PCID ) - > get ( ) ) ;
2010-04-24 13:36:04 +04:00
# endif
2010-03-12 14:28:59 +03:00
# if BX_SUPPORT_MONITOR_MWAIT
fprintf ( fp , " , mwait_is_nop=%d " , SIM - > get_param_bool ( BXPN_CPUID_MWAIT_IS_NOP ) - > get ( ) ) ;
# endif
2009-05-08 18:53:45 +04:00
# endif
2010-07-17 01:03:52 +04:00
fprintf ( fp , " , stepping=%d " , SIM - > get_param_num ( BXPN_CPUID_STEPPING ) - > get ( ) ) ;
const char * vendor_string = SIM - > get_param_string ( BXPN_VENDOR_STRING ) - > getptr ( ) ;
if ( vendor_string )
fprintf ( fp , " , vendor_string= \" %s \" " , vendor_string ) ;
const char * brand_string = SIM - > get_param_string ( BXPN_BRAND_STRING ) - > getptr ( ) ;
if ( brand_string )
fprintf ( fp , " , brand_string= \" %s \" " , brand_string ) ;
2008-12-28 23:49:03 +03:00
fprintf ( fp , " \n " ) ;
2010-07-17 01:03:52 +04:00
2009-04-23 22:28:17 +04:00
fprintf ( fp , " print_timestamps: enabled=%d \n " , bx_dbg . print_timestamps ) ;
2009-05-08 18:53:45 +04:00
bx_write_debugger_options ( fp ) ;
2009-04-26 10:56:28 +04:00
fprintf ( fp , " port_e9_hack: enabled=%d \n " , SIM - > get_param_bool ( BXPN_PORT_E9_HACK ) - > get ( ) ) ;
2006-03-04 15:43:47 +03:00
fprintf ( fp , " text_snapshot_check: enabled=%d \n " , SIM - > get_param_bool ( BXPN_TEXT_SNAPSHOT_CHECK ) - > get ( ) ) ;
2006-02-26 22:11:20 +03:00
fprintf ( fp , " private_colormap: enabled=%d \n " , SIM - > get_param_bool ( BXPN_PRIVATE_COLORMAP ) - > get ( ) ) ;
2004-06-05 02:06:55 +04:00
# if BX_WITH_AMIGAOS
2006-02-26 22:11:20 +03:00
fprintf ( fp , " fullscreen: enabled=%d \n " , SIM - > get_param_bool ( BXPN_FULLSCREEN ) - > get ( ) ) ;
fprintf ( fp , " screenmode: name= \" %s \" \n " , SIM - > get_param_string ( BXPN_SCREENMODE ) - > getptr ( ) ) ;
2004-06-05 02:06:55 +04:00
# endif
2006-02-19 18:43:03 +03:00
bx_write_clock_cmos_options ( fp ) ;
2006-03-02 23:13:14 +03:00
bx_write_ne2k_options ( fp , ( bx_list_c * ) SIM - > get_param ( BXPN_NE2K ) ) ;
bx_write_pnic_options ( fp , ( bx_list_c * ) SIM - > get_param ( BXPN_PNIC ) ) ;
2006-03-03 23:29:50 +03:00
bx_write_sb16_options ( fp , ( bx_list_c * ) SIM - > get_param ( BXPN_SB16 ) ) ;
2006-02-24 01:48:57 +03:00
bx_write_loader_options ( fp ) ;
2006-03-05 13:24:29 +03:00
bx_write_log_options ( fp , ( bx_list_c * ) SIM - > get_param ( " log " ) ) ;
2006-02-24 01:48:57 +03:00
bx_write_keyboard_options ( fp ) ;
2010-05-16 13:01:36 +04:00
fprintf ( fp , " mouse: enabled=%d, type=%s, toggle=%s \n " ,
2006-02-22 22:18:29 +03:00
SIM - > get_param_bool ( BXPN_MOUSE_ENABLED ) - > get ( ) ,
2010-05-16 13:01:36 +04:00
SIM - > get_param_enum ( BXPN_MOUSE_TYPE ) - > get_selected ( ) ,
SIM - > get_param_enum ( BXPN_MOUSE_TOGGLE ) - > get_selected ( ) ) ;
2006-04-14 12:07:24 +04:00
SIM - > save_user_options ( fp ) ;
2006-02-26 22:11:20 +03:00
fclose ( fp ) ;
2004-06-05 02:06:55 +04:00
return 0 ;
}