make port_e9_hack runtime option (and not configure time)

clean-up a bit in bx_dbg struct in bochs.h
This commit is contained in:
Stanislav Shwartsman 2009-04-23 18:28:17 +00:00
parent c85367fe80
commit cb312c9470
13 changed files with 113 additions and 127 deletions

View File

@ -787,6 +787,21 @@ i440fxsupport: enabled=1
#=======================================================================
#magic_break: enabled=1
#=======================================================================
# PORT_E9_HACK:
# The 0xE9 port doesn't exists in normal ISA architecture. However, we
# define a convention here, to display on the console of the system running
# Bochs anything that is written to it. The idea is to provide debug output
# very early when writing BIOS or OS code for example, without having to
# bother with setting up a serial port or etc. Reading from port 0xE9 will
# will return 0xe9 to let you know if the feature is available.
# Leave this 0 unless you have a reason to use it.
#
# Example:
# port_e9_hack: enabled=1
#=======================================================================
#port_e9_hack: enabled=1
#=======================================================================
# DEBUG_SYMBOLS:
# This loads symbols from the specified file for use in Bochs' internal

View File

@ -15,7 +15,6 @@
--enable-1g-pages \
--enable-ignore-bad-msr \
--enable-configurable-msrs \
--enable-port-e9-hack \
--enable-debugger \
--enable-disasm \
--enable-debugger-gui \

View File

@ -56,6 +56,8 @@ Detailed change log :
- Added configure option to compile in GUI frontend for Bochs debugger,
to enable configure with --enable-debugger-gui option.
The GUI debugger frontend is enabled by default with Bochs debugger.
- Removed --enable-port-e9-hack configure option. The feature now could be
configured at runtime through .bochsrc.
- Added configure option to enable/disable A20 pin support. Disabling the
A20 pin support slightly speeds up the emulation.
- reduced dependencies between source files for faster code generation

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.243 2009-03-15 12:54:59 vruppert Exp $
// $Id: bochs.h,v 1.244 2009-04-23 18:28:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -432,24 +432,18 @@ int bx_gdbstub_check(unsigned int eip);
typedef struct {
bx_bool floppy;
bx_bool keyboard;
bx_bool video;
bx_bool disk;
bx_bool pit;
bx_bool pic;
bx_bool bios;
bx_bool cmos;
bx_bool a20;
bx_bool interrupts;
bx_bool exceptions;
bx_bool debugger;
bx_bool mouse;
bx_bool a20;
bx_bool io;
bx_bool dma;
bx_bool unsupported_io;
bx_bool serial;
bx_bool cdrom;
bx_bool print_timestamps;
bx_bool port_e9_hack;
#if BX_DEBUGGER
bx_bool magic_break_enabled;
#endif
@ -458,7 +452,6 @@ typedef struct {
#endif
#if BX_SUPPORT_APIC
bx_bool apic;
bx_bool ioapic;
#endif
#if BX_DEBUG_LINUX
bx_bool linux_syscall;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.187 2009-04-21 20:27:35 sshwarts Exp $
// $Id: dbg_main.cc,v 1.188 2009-04-23 18:28:17 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1313,17 +1313,11 @@ void bx_dbg_show_command(const char* arg)
dbg_printf("Disable all show flags\n");
} else if(!strcmp(arg,"dbg-all")) {
bx_dbg.floppy = 1;
bx_dbg.keyboard = 1;
bx_dbg.video = 1;
bx_dbg.disk = 1;
bx_dbg.pit = 1;
bx_dbg.pic = 1;
bx_dbg.bios = 1;
bx_dbg.cmos = 1;
bx_dbg.a20 = 1;
bx_dbg.interrupts = 1;
bx_dbg.exceptions = 1;
bx_dbg.mouse = 1;
bx_dbg.a20 = 1;
bx_dbg.io = 1;
bx_dbg.debugger = 1;
bx_dbg.dma = 1;
@ -1333,17 +1327,11 @@ void bx_dbg_show_command(const char* arg)
return;
} else if(!strcmp(arg,"dbg-none")) {
bx_dbg.floppy = 0;
bx_dbg.keyboard = 0;
bx_dbg.video = 0;
bx_dbg.disk = 0;
bx_dbg.pit = 0;
bx_dbg.pic = 0;
bx_dbg.bios = 0;
bx_dbg.cmos = 0;
bx_dbg.a20 = 0;
bx_dbg.interrupts = 0;
bx_dbg.exceptions = 0;
bx_dbg.mouse = 0;
bx_dbg.a20 = 0;
bx_dbg.io = 0;
bx_dbg.debugger = 0;
bx_dbg.dma = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.174 2009-04-13 16:07:02 vruppert Exp $
// $Id: config.cc,v 1.175 2009-04-23 18:28:16 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -2963,6 +2963,20 @@ static int parse_line_formatted(const char *context, int num_params, char *param
PARSE_ERR(("%s: print_timestamps directive malformed.", context));
}
}
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));
}
if (params[1][8] == '0' || params[1][8] == '1') {
bx_dbg.port_e9_hack = params[1][8] - '0';
}
else {
PARSE_ERR(("%s: port_e9_hack directive malformed.", context));
}
}
else if (!strcmp(params[0], "ne2k")) {
int tmp[6];
char tmpchar[6];
@ -3609,9 +3623,14 @@ int bx_write_configuration(const char *rc, int overwrite)
#if BX_CONFIGURE_MSRS
strptr = SIM->get_param_string(BXPN_CONFIGURABLE_MSRS_PATH)->getptr();
if (strlen(strptr) > 0)
fprintf(fp, "msrs==\"%s\"", strptr);
fprintf(fp, ", msrs=\"%s\"", strptr);
#endif
fprintf(fp, "\n");
fprintf(fp, "print_timestamps: enabled=%d\n", bx_dbg.print_timestamps);
fprintf(fp, "port_e9_hack: enabled=%d\n", bx_dbg.port_e9_hack);
#if BX_DEBUGGER
fprintf(fp, "magic_break: enabled=%d\n", bx_dbg.magic_break_enabled);
#endif
fprintf(fp, "text_snapshot_check: enabled=%d\n", SIM->get_param_bool(BXPN_TEXT_SNAPSHOT_CHECK)->get());
fprintf(fp, "private_colormap: enabled=%d\n", SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get());
#if BX_WITH_AMIGAOS

View File

@ -240,14 +240,6 @@
#define USE_RAW_SERIAL 0
// This enables writing to port 0xe9 and the output
// is sent to the console. Reading from port 0xe9
// will return 0xe9 to let you know this is available.
// Leave this 0 unless you have a reason to use it.
#define BX_PORT_E9_HACK 0
#define BX_GDBSTUB 0
// This option enables compressed (zlib) hd support
#define BX_COMPRESSED_HD_SUPPORT 0
#define BX_HAVE_ZLIB 0
@ -644,6 +636,7 @@ typedef
#endif
#define BX_GDBSTUB 0
#define BX_DEBUGGER 0
#define BX_DISASM 0
#define BX_DEBUGGER_GUI 0

53
bochs/configure vendored
View File

@ -1573,7 +1573,6 @@ Optional Features:
--enable-host-specific-asms support for host specific inline assembly
--enable-configurable-msrs support for configurable MSR registers
--enable-ignore-bad-msr ignore bad MSR references
--enable-port-e9-hack writes to port e9 go to console
--enable-show-ips show IPS in Bochs log file
--enable-cpp use .cpp as C++ suffix
--enable-debugger compile in support for Bochs internal debugger
@ -1614,6 +1613,7 @@ Optional Features:
--enable-guest2host-tlb enables guest to host addr TLB for speed (deprecated)
--enable-icache support instruction cache (deprecated)
--enable-external-debugger enables external debugger interface (deprecated)
--enable-port-e9-hack writes to port e9 go to console (deprecated)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -34853,38 +34853,6 @@ _ACEOF
fi
{ echo "$as_me:$LINENO: checking for port e9 hack" >&5
echo $ECHO_N "checking for port e9 hack... $ECHO_C" >&6; }
# Check whether --enable-port-e9-hack was given.
if test "${enable_port_e9_hack+set}" = set; then
enableval=$enable_port_e9_hack; if test "$enableval" = yes; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define BX_PORT_E9_HACK 1
_ACEOF
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
cat >>confdefs.h <<\_ACEOF
#define BX_PORT_E9_HACK 0
_ACEOF
fi
else
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define BX_PORT_E9_HACK 1
_ACEOF
fi
@ -39528,6 +39496,25 @@ echo "${ECHO_T}no" >&6; }
fi
{ echo "$as_me:$LINENO: checking writes to port e9 go to console (deprecated)" >&5
echo $ECHO_N "checking writes to port e9 go to console (deprecated)... $ECHO_C" >&6; }
# Check whether --enable-port-e9-hack was given.
if test "${enable_port_e9_hack+set}" = set; then
enableval=$enable_port_e9_hack; { echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6; }
{ { echo "$as_me:$LINENO: error: DEPRECATED - PORT_E9_HACK could be configured through .bochsrc" >&5
echo "$as_me: error: DEPRECATED - PORT_E9_HACK could be configured through .bochsrc" >&2;}
{ (exit 1); exit 1; }; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
# Create some subdirectories for when you run configure from some other
# directory.
if test ! -d instrument; then mkdir instrument; fi

View File

@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in,v 1.397 2009-04-21 07:20:25 vruppert Exp $]])
AC_REVISION([[$Id: configure.in,v 1.398 2009-04-23 18:28:17 sshwarts Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -1158,22 +1158,6 @@ AC_ARG_ENABLE(ignore-bad-msr,
]
)
AC_MSG_CHECKING(for port e9 hack)
AC_ARG_ENABLE(port-e9-hack,
[ --enable-port-e9-hack writes to port e9 go to console],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_PORT_E9_HACK, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_PORT_E9_HACK, 0)
fi],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_PORT_E9_HACK, 1)
]
)
AC_MSG_CHECKING(show IPS)
AC_ARG_ENABLE(show-ips,
[ --enable-show-ips show IPS in Bochs log file],
@ -3070,6 +3054,17 @@ AC_ARG_ENABLE(external-debugger,
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(writes to port e9 go to console (deprecated))
AC_ARG_ENABLE(port-e9-hack,
[ --enable-port-e9-hack writes to port e9 go to console (deprecated)],
[AC_MSG_RESULT($enableval)
AC_MSG_ERROR([DEPRECATED - PORT_E9_HACK could be configured through .bochsrc])
],
[
AC_MSG_RESULT(no)
])
# Create some subdirectories for when you run configure from some other
# directory.
if test ! -d instrument; then mkdir instrument; fi

View File

@ -1,7 +1,7 @@
<!--
================================================================
doc/docbook/user/user.dbk
$Id: user.dbk,v 1.253 2009-04-19 13:10:50 vruppert Exp $
$Id: user.dbk,v 1.254 2009-04-23 18:28:17 sshwarts Exp $
This is the top level file for the Bochs Users Manual.
================================================================
@ -4311,6 +4311,22 @@ debugger mode. This might be useful for software development.
</para>
</section>
<section><title>port_e9_hack</title>
<para>
Example:
<screen>
port_e9_hack: enabled=1
</screen>
The 0xE9 port doesn't exists in normal ISA architecture. However, we
define a convention here, to display on the console of the system running
Bochs anything that is written to it. The idea is to provide debug output
very early when writing BIOS or OS code for example, without having to
bother with setting up a serial port or etc. Reading from port 0xE9 will
will return 0xe9 to let you know if the feature is available. Leave
this 0 unless you have a reason to use it.
</para>
</section>
<section><title>debug_symbols</title>
<para>
Example:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cmos.cc,v 1.69 2009-02-08 09:05:52 vruppert Exp $
// $Id: cmos.cc,v 1.70 2009-04-23 18:28:17 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -145,7 +145,7 @@ bx_cmos_c::~bx_cmos_c(void)
void bx_cmos_c::init(void)
{
BX_DEBUG(("Init $Id: cmos.cc,v 1.69 2009-02-08 09:05:52 vruppert Exp $"));
BX_DEBUG(("Init $Id: cmos.cc,v 1.70 2009-04-23 18:28:17 sshwarts Exp $"));
// CMOS RAM & RTC
DEV_register_ioread_handler(this, read_handler, 0x0070, "CMOS RAM", 1);
@ -366,9 +366,7 @@ Bit32u bx_cmos_c::read(Bit32u address, unsigned io_len)
#endif
Bit8u ret8;
if (bx_dbg.cmos)
BX_INFO(("CMOS read of CMOS register 0x%02x",
(unsigned) BX_CMOS_THIS s.cmos_mem_address));
BX_DEBUG(("CMOS read of CMOS register 0x%02x", (unsigned) BX_CMOS_THIS s.cmos_mem_address));
switch (address) {
case 0x0070:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: unmapped.cc,v 1.32 2009-02-08 09:05:52 vruppert Exp $
// $Id: unmapped.cc,v 1.33 2009-04-23 18:28:17 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -102,16 +102,21 @@ Bit32u bx_unmapped_c::read(Bit32u address, unsigned io_len)
case 0x8e:
retval = BX_UM_THIS s.port8e;
break;
#if BX_PORT_E9_HACK
// Unused port on ISA - this can be used by the emulated code
// to detect it is running inside Bochs and that the debugging
// features are available (write 0xFF or something on unused
// port 0x80, then read from 0xe9, if value is 0xe9, debug
// output is available) (see write() for that) -- Andreas and Emmanuel
case 0xe9:
retval = 0xe9;
if (bx_dbg.port_e9_hack) {
retval = 0xe9;
}
else {
retval = 0xffffffff;
}
break;
#endif
case 0x03df:
retval = 0xffffffff;
BX_DEBUG(("unsupported IO read from port %04x (CGA)", address));
@ -159,7 +164,7 @@ return_from_read:
BX_DEBUG(("unmapped: 32-bit read from %04x = %08x", address, retval));
break;
default:
BX_DEBUG(("unmapped: %d-bit read from %04x = %x", io_len * 8, address, retval));
BX_PANIC(("unmapped: %d-bit read from %04x = %x", io_len * 8, address, retval));
}
}
@ -200,7 +205,6 @@ void bx_unmapped_c::write(Bit32u address, Bit32u value, unsigned io_len)
BX_UM_THIS s.port8e = value;
break;
#if BX_PORT_E9_HACK
// This port doesn't exist on normal ISA architecture. However,
// we define a convention here, to display on the console of the
// system running Bochs, anything that is written to it. The
@ -211,10 +215,11 @@ void bx_unmapped_c::write(Bit32u address, Bit32u value, unsigned io_len)
// Idea by Andreas Beck (andreas.beck@ggi-project.org)
case 0xe9:
putchar(value);
fflush(stdout);
if (bx_dbg.port_e9_hack) {
putchar(value);
fflush(stdout);
}
break;
#endif
case 0xed: // Dummy port used as I/O delay
break;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.398 2009-03-26 09:51:22 sshwarts Exp $
// $Id: main.cc,v 1.399 2009-04-23 18:28:17 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1156,31 +1156,7 @@ void bx_init_bx_dbg(void)
#if BX_DEBUGGER
bx_dbg_init_infile();
#endif
bx_dbg.floppy = 0;
bx_dbg.keyboard = 0;
bx_dbg.video = 0;
bx_dbg.disk = 0;
bx_dbg.pit = 0;
bx_dbg.pic = 0;
bx_dbg.bios = 0;
bx_dbg.cmos = 0;
bx_dbg.a20 = 0;
bx_dbg.interrupts = 0;
bx_dbg.exceptions = 0;
bx_dbg.mouse = 0;
bx_dbg.io = 0;
bx_dbg.debugger = 0;
bx_dbg.dma = 0;
bx_dbg.unsupported_io = 0;
bx_dbg.record_io = 0;
bx_dbg.serial = 0;
bx_dbg.cdrom = 0;
#if BX_DEBUGGER
bx_dbg.magic_break_enabled = 0;
#endif
#if BX_GDBSTUB
bx_dbg.gdbstub_enabled = 0;
#endif
memset(&bx_dbg, 0, sizeof(bx_debug_t));
}
int bx_atexit(void)