Search
lxdream.org :: lxdream :: r562:e598411b640b
lxdream 0.9.1
released Jun 29
Download Now
changeset562:e598411b640b lxdream-mmu
parent561:533f6b478071
child563:72ccfd1f432b
authornkeynes
dateTue Jan 01 05:48:06 2008 +0000 (11 years ago)
branchlxdream-mmu
Add configure and command-line parameters to perform IO tracing
config.h.in
configure
configure.in
src/gtkui/mmio_win.c
src/main.c
src/mem.c
src/mem.h
src/sh4/sh4mem.c
1.1 --- a/config.h.in Tue Jan 01 05:08:38 2008 +0000
1.2 +++ b/config.h.in Tue Jan 01 05:48:06 2008 +0000
1.3 @@ -13,6 +13,12 @@
1.4 /* always defined to indicate that i18n is enabled */
1.5 #undef ENABLE_NLS
1.6
1.7 +/* Enable IO tracing */
1.8 +#undef ENABLE_TRACE_IO
1.9 +
1.10 +/* Enable watchpoints */
1.11 +#undef ENABLE_WATCH
1.12 +
1.13 /* translation domain */
1.14 #undef GETTEXT_PACKAGE
1.15
2.1 --- a/configure Tue Jan 01 05:08:38 2008 +0000
2.2 +++ b/configure Tue Jan 01 05:48:06 2008 +0000
2.3 @@ -1341,6 +1341,10 @@
2.4 (and sometimes confusing) to the casual installer
2.5 --disable-dependency-tracking Speeds up one-time builds
2.6 --enable-dependency-tracking Do not reject slow dependency extractors
2.7 + --enable-trace Enable generation of IO traces (warning: hurts
2.8 + performance)
2.9 + --enable-watch Enable watchpoints in the debugger (warning: hurts
2.10 + performance)
2.11
2.12 Some influential environment variables:
2.13 CC C compiler command
2.14 @@ -4943,6 +4947,27 @@
2.15 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
2.16
2.17
2.18 +# Check whether --enable-trace was given.
2.19 +if test "${enable_trace+set}" = set; then
2.20 + enableval=$enable_trace; if test "$enableval" == "yes"; then
2.21 +
2.22 +cat >>confdefs.h <<\_ACEOF
2.23 +#define ENABLE_TRACE_IO 1
2.24 +_ACEOF
2.25 +
2.26 + fi
2.27 +fi
2.28 +
2.29 +# Check whether --enable-watch was given.
2.30 +if test "${enable_watch+set}" = set; then
2.31 + enableval=$enable_watch; if test "$enableval" == "yes"; then
2.32 +
2.33 +cat >>confdefs.h <<\_ACEOF
2.34 +#define ENABLE_WATCH 1
2.35 +_ACEOF
2.36 +
2.37 + fi
2.38 +fi
2.39
2.40 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
2.41
3.1 --- a/configure.in Tue Jan 01 05:08:38 2008 +0000
3.2 +++ b/configure.in Tue Jan 01 05:48:06 2008 +0000
3.3 @@ -11,7 +11,16 @@
3.4 AC_HEADER_STDC
3.5 AC_CANONICAL_BUILD
3.6 AC_CANONICAL_HOST
3.7 -
3.8 +AC_ARG_ENABLE( trace,
3.9 + AS_HELP_STRING( [--enable-trace], [Enable generation of IO traces (warning: hurts performance)]),
3.10 + [if test "$enableval" == "yes"; then
3.11 + AC_DEFINE(ENABLE_TRACE_IO, 1, [Enable IO tracing])
3.12 + fi] )
3.13 +AC_ARG_ENABLE( watch,
3.14 + AS_HELP_STRING( [--enable-watch], [Enable watchpoints in the debugger (warning: hurts performance)]),
3.15 + [if test "$enableval" == "yes"; then
3.16 + AC_DEFINE(ENABLE_WATCH, 1, [Enable watchpoints])
3.17 + fi] )
3.18 dnl ----------- Check for mandatory dependencies --------------
3.19 dnl Building on MAC?
3.20 AC_CHECK_HEADER([Carbon/Carbon.h], [
4.1 --- a/src/gtkui/mmio_win.c Tue Jan 01 05:08:38 2008 +0000
4.2 +++ b/src/gtkui/mmio_win.c Tue Jan 01 05:48:06 2008 +0000
4.3 @@ -121,6 +121,8 @@
4.4 gtk_container_add( GTK_CONTAINER(vbox), GTK_WIDGET(scroll) );
4.5
4.6 trace_button = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("Trace access")));
4.7 + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(trace_button),
4.8 + io_rgn->trace_flag ? TRUE : FALSE);
4.9 gtk_container_add( GTK_CONTAINER(vbox), GTK_WIDGET(trace_button) );
4.10 gtk_box_set_child_packing( GTK_BOX(vbox), GTK_WIDGET(trace_button),
4.11 FALSE, FALSE, 0, GTK_PACK_START );
5.1 --- a/src/main.c Tue Jan 01 05:08:38 2008 +0000
5.2 +++ b/src/main.c Tue Jan 01 05:48:06 2008 +0000
5.3 @@ -34,13 +34,14 @@
5.4
5.5 #define S3M_PLAYER "s3mplay.bin"
5.6
5.7 -char *option_list = "a:m:s:A:V:v:puhbd:c:t:xD";
5.8 +char *option_list = "a:m:s:A:V:v:puhbd:c:t:T:xD";
5.9 struct option longopts[1] = { { NULL, 0, 0, 0 } };
5.10 char *aica_program = NULL;
5.11 char *s3m_file = NULL;
5.12 const char *disc_file = NULL;
5.13 char *display_driver_name = NULL;
5.14 char *audio_driver_name = NULL;
5.15 +char *trace_regions = NULL;
5.16 gboolean start_immediately = FALSE;
5.17 gboolean headless = FALSE;
5.18 gboolean without_bios = FALSE;
5.19 @@ -109,6 +110,9 @@
5.20 time_secs = (uint32_t)t;
5.21 time_nanos = (int)((t - time_secs) * 1000000000);
5.22 break;
5.23 + case 'T': /* trace regions */
5.24 + trace_regions = optarg;
5.25 + break;
5.26 case 'v': /* Log verbosity */
5.27 if( !set_global_log_level(optarg) ) {
5.28 ERROR( "Unrecognized log level '%s'", optarg );
5.29 @@ -131,6 +135,7 @@
5.30 mem_load_block( s3m_file, 0x00810000, 2048*1024 - 0x10000 );
5.31 }
5.32 }
5.33 + mem_set_trace( trace_regions, TRUE );
5.34
5.35 if( without_bios ) {
5.36 bios_install();
6.1 --- a/src/mem.c Tue Jan 01 05:08:38 2008 +0000
6.2 +++ b/src/mem.c Tue Jan 01 05:48:06 2008 +0000
6.3 @@ -20,6 +20,7 @@
6.4 #include <sys/types.h>
6.5 #include <sys/mman.h>
6.6 #include <sys/stat.h>
6.7 +#include <glib/gstrfuncs.h>
6.8 #include <assert.h>
6.9 #include <stdint.h>
6.10 #include <stdlib.h>
6.11 @@ -377,10 +378,39 @@
6.12 }
6.13 }
6.14
6.15 -void mem_set_trace( uint32_t addr, int flag )
6.16 +struct mmio_region *mem_get_io_region_by_name( const gchar *name )
6.17 {
6.18 - struct mmio_region *region = mem_get_io_region(addr);
6.19 - if( region != NULL )
6.20 - region->trace_flag = flag;
6.21 + int i;
6.22 + for( i=0; i<num_io_rgns; i++ ) {
6.23 + if( strcasecmp(io_rgn[i]->id, name) == 0 ) {
6.24 + return io_rgn[i];
6.25 + }
6.26 + }
6.27 + return NULL;
6.28 }
6.29
6.30 +void mem_set_trace( const gchar *tracelist, gboolean flag )
6.31 +{
6.32 + if( tracelist != NULL ) {
6.33 + gchar ** tracev = g_strsplit_set( tracelist, ",:; \t\r\n", 0 );
6.34 + int i;
6.35 + for( i=0; tracev[i] != NULL; i++ ) {
6.36 + // Special case "all" - trace everything
6.37 + if( strcasecmp(tracev[i], "all") == 0 ) {
6.38 + int j;
6.39 + for( j=0; j<num_io_rgns; j++ ) {
6.40 + io_rgn[j]->trace_flag = flag ? 1 : 0;
6.41 + }
6.42 + break;
6.43 + }
6.44 + struct mmio_region *region = mem_get_io_region_by_name( tracev[i] );
6.45 + if( region == NULL ) {
6.46 + WARN( "Unknown IO region '%s'", tracev[i] );
6.47 + } else {
6.48 + region->trace_flag = flag ? 1 : 0;
6.49 + }
6.50 + }
6.51 + g_strfreev( tracev );
6.52 + }
6.53 +}
6.54 +
7.1 --- a/src/mem.h Tue Jan 01 05:08:38 2008 +0000
7.2 +++ b/src/mem.h Tue Jan 01 05:48:06 2008 +0000
7.3 @@ -63,7 +63,7 @@
7.4 sh4ptr_t mem_get_page( uint32_t addr );
7.5 int mem_load_block( const gchar *filename, uint32_t base, uint32_t size );
7.6 int mem_save_block( const gchar *filename, uint32_t base, uint32_t size );
7.7 -void mem_set_trace( uint32_t addr, int flag );
7.8 +void mem_set_trace( const gchar *tracelist, int flag );
7.9 void mem_init( void );
7.10 void mem_reset( void );
7.11 void mem_copy_from_sh4( sh4ptr_t dest, sh4addr_t src, size_t count );
8.1 --- a/src/sh4/sh4mem.c Tue Jan 01 05:08:38 2008 +0000
8.2 +++ b/src/sh4/sh4mem.c Tue Jan 01 05:48:06 2008 +0000
8.3 @@ -17,7 +17,6 @@
8.4 */
8.5
8.6 #define MODULE sh4_module
8.7 -#define ENABLE_TRACE_IO 1
8.8
8.9 #include <string.h>
8.10 #include <zlib.h>
.