Search
lxdream.org :: lxdream :: r1091:186558374345
lxdream 0.9.1
released Jun 29
Download Now
changeset1091:186558374345
parent1090:71e28626b358
child1092:7c4ffe27e7b5
authornkeynes
dateTue Dec 15 08:46:37 2009 +1000 (10 years ago)
Add side-by-side x86+sh4 disassembly output
Print SH4 state information and disassembly of the current block when
crashing.
Fix delay slot instruction in conditional branch not being marked as a
delay-slot instruction in the branch-not-taken path.
Rename REG_* defines in cpu.h to avoid conflict with translation defs
src/Makefile.am
src/Makefile.in
src/aica/armdasm.c
src/cpu.c
src/cpu.h
src/gtkui/gtk_debug.c
src/sh4/sh4.c
src/sh4/sh4.h
src/sh4/sh4trans.c
src/sh4/sh4trans.h
src/sh4/sh4x86.in
src/test/testsh4x86.c
src/util.c
src/x86dasm/x86dasm.c
src/x86dasm/x86dasm.h
src/xlat/xltcache.c
src/xlat/xltcache.h
1.1 --- a/src/Makefile.am Mon Dec 07 17:44:27 2009 +1000
1.2 +++ b/src/Makefile.am Tue Dec 15 08:46:37 2009 +1000
1.3 @@ -40,7 +40,7 @@
1.4 lxdream_LINK = $(LINK) @LXDREAMLDFLAGS@
1.5 lxdream_LDADD = @LXDREAM_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@ $(INTLLIBS)
1.6 lxdream_SOURCES = \
1.7 - main.c version.c config.c config.h lxdream.h dream.h gui.h cpu.h hook.h \
1.8 + main.c version.c config.c config.h lxdream.h dream.h gui.h cpu.c cpu.h hook.h \
1.9 gettext.h mem.c mem.h sdram.c mmio.h watch.c \
1.10 asic.c asic.h clock.h serial.h \
1.11 syscall.c syscall.h bios.c dcload.c gdbserver.c \
1.12 @@ -91,8 +91,8 @@
1.13 test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \
1.14 x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
1.15 x86dasm/dis-buf.c \
1.16 - sh4/sh4trans.c sh4/sh4x86.c xlat/xltcache.c \
1.17 - xlat/xltcache.h mem.c util.c
1.18 + sh4/sh4trans.c sh4/sh4x86.c xlat/xltcache.c sh4/sh4dasm.c \
1.19 + xlat/xltcache.h mem.c util.c cpu.c
1.20
1.21 check_PROGRAMS += test/testsh4x86
1.22 endif
2.1 --- a/src/Makefile.in Mon Dec 07 17:44:27 2009 +1000
2.2 +++ b/src/Makefile.in Tue Dec 15 08:46:37 2009 +1000
2.3 @@ -139,8 +139,8 @@
2.4 @BUILD_SHARED_TRUE@@INPUT_LIRC_TRUE@input_lirc_@SOEXT@_DEPENDENCIES = \
2.5 @BUILD_SHARED_TRUE@@INPUT_LIRC_TRUE@ input_lirc.lo
2.6 am__lxdream_SOURCES_DIST = main.c version.c config.c config.h \
2.7 - lxdream.h dream.h gui.h cpu.h hook.h gettext.h mem.c mem.h \
2.8 - sdram.c mmio.h watch.c asic.c asic.h clock.h serial.h \
2.9 + lxdream.h dream.h gui.h cpu.c cpu.h hook.h gettext.h mem.c \
2.10 + mem.h sdram.c mmio.h watch.c asic.c asic.h clock.h serial.h \
2.11 syscall.c syscall.h bios.c dcload.c gdbserver.c ioutil.c \
2.12 ioutil.h lxpaths.c lxpaths.h gdrom/ide.c gdrom/ide.h \
2.13 gdrom/packet.h gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h \
2.14 @@ -232,48 +232,48 @@
2.15 @CDROM_NONE_TRUE@am__objects_17 = lxdream-cd_none.$(OBJEXT)
2.16 @JOY_LINUX_TRUE@am__objects_18 = lxdream-joy_linux.$(OBJEXT)
2.17 am_lxdream_OBJECTS = lxdream-main.$(OBJEXT) lxdream-version.$(OBJEXT) \
2.18 - lxdream-config.$(OBJEXT) lxdream-mem.$(OBJEXT) \
2.19 - lxdream-sdram.$(OBJEXT) lxdream-watch.$(OBJEXT) \
2.20 - lxdream-asic.$(OBJEXT) lxdream-syscall.$(OBJEXT) \
2.21 - lxdream-bios.$(OBJEXT) lxdream-dcload.$(OBJEXT) \
2.22 - lxdream-gdbserver.$(OBJEXT) lxdream-ioutil.$(OBJEXT) \
2.23 - lxdream-lxpaths.$(OBJEXT) lxdream-ide.$(OBJEXT) \
2.24 - lxdream-gdimage.$(OBJEXT) lxdream-gdrom.$(OBJEXT) \
2.25 - lxdream-nrg.$(OBJEXT) lxdream-cdi.$(OBJEXT) \
2.26 - lxdream-gdi.$(OBJEXT) lxdream-edc_ecc.$(OBJEXT) \
2.27 - lxdream-dreamcast.$(OBJEXT) lxdream-eventq.$(OBJEXT) \
2.28 - lxdream-sh4.$(OBJEXT) lxdream-intc.$(OBJEXT) \
2.29 - lxdream-sh4mem.$(OBJEXT) lxdream-timer.$(OBJEXT) \
2.30 - lxdream-dmac.$(OBJEXT) lxdream-mmu.$(OBJEXT) \
2.31 - lxdream-sh4core.$(OBJEXT) lxdream-sh4dasm.$(OBJEXT) \
2.32 - lxdream-sh4mmio.$(OBJEXT) lxdream-scif.$(OBJEXT) \
2.33 - lxdream-sh4stat.$(OBJEXT) lxdream-xltcache.$(OBJEXT) \
2.34 - lxdream-pmm.$(OBJEXT) lxdream-cache.$(OBJEXT) \
2.35 - lxdream-armcore.$(OBJEXT) lxdream-armdasm.$(OBJEXT) \
2.36 - lxdream-armmem.$(OBJEXT) lxdream-aica.$(OBJEXT) \
2.37 - lxdream-audio.$(OBJEXT) lxdream-pvr2.$(OBJEXT) \
2.38 - lxdream-pvr2mem.$(OBJEXT) lxdream-tacore.$(OBJEXT) \
2.39 - lxdream-rendsort.$(OBJEXT) lxdream-texcache.$(OBJEXT) \
2.40 - lxdream-yuv.$(OBJEXT) lxdream-rendsave.$(OBJEXT) \
2.41 - lxdream-scene.$(OBJEXT) lxdream-gl_sl.$(OBJEXT) \
2.42 - lxdream-gl_slsrc.$(OBJEXT) lxdream-glutil.$(OBJEXT) \
2.43 - lxdream-glrender.$(OBJEXT) lxdream-maple.$(OBJEXT) \
2.44 - lxdream-controller.$(OBJEXT) lxdream-kbd.$(OBJEXT) \
2.45 - lxdream-mouse.$(OBJEXT) lxdream-lightgun.$(OBJEXT) \
2.46 - lxdream-vmu.$(OBJEXT) lxdream-loader.$(OBJEXT) \
2.47 - lxdream-bootstrap.$(OBJEXT) lxdream-util.$(OBJEXT) \
2.48 - lxdream-gdlist.$(OBJEXT) lxdream-vmuvol.$(OBJEXT) \
2.49 - lxdream-vmulist.$(OBJEXT) lxdream-display.$(OBJEXT) \
2.50 - lxdream-audio_null.$(OBJEXT) lxdream-video_null.$(OBJEXT) \
2.51 - lxdream-cd_mmc.$(OBJEXT) lxdream-video_gl.$(OBJEXT) \
2.52 - lxdream-gl_fbo.$(OBJEXT) lxdream-serial_unix.$(OBJEXT) \
2.53 - lxdream-hotkeys.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
2.54 - $(am__objects_3) $(am__objects_4) $(am__objects_5) \
2.55 - $(am__objects_6) $(am__objects_7) $(am__objects_8) \
2.56 - $(am__objects_9) $(am__objects_10) $(am__objects_11) \
2.57 - $(am__objects_12) $(am__objects_13) $(am__objects_14) \
2.58 - $(am__objects_15) $(am__objects_16) $(am__objects_17) \
2.59 - $(am__objects_18)
2.60 + lxdream-config.$(OBJEXT) lxdream-cpu.$(OBJEXT) \
2.61 + lxdream-mem.$(OBJEXT) lxdream-sdram.$(OBJEXT) \
2.62 + lxdream-watch.$(OBJEXT) lxdream-asic.$(OBJEXT) \
2.63 + lxdream-syscall.$(OBJEXT) lxdream-bios.$(OBJEXT) \
2.64 + lxdream-dcload.$(OBJEXT) lxdream-gdbserver.$(OBJEXT) \
2.65 + lxdream-ioutil.$(OBJEXT) lxdream-lxpaths.$(OBJEXT) \
2.66 + lxdream-ide.$(OBJEXT) lxdream-gdimage.$(OBJEXT) \
2.67 + lxdream-gdrom.$(OBJEXT) lxdream-nrg.$(OBJEXT) \
2.68 + lxdream-cdi.$(OBJEXT) lxdream-gdi.$(OBJEXT) \
2.69 + lxdream-edc_ecc.$(OBJEXT) lxdream-dreamcast.$(OBJEXT) \
2.70 + lxdream-eventq.$(OBJEXT) lxdream-sh4.$(OBJEXT) \
2.71 + lxdream-intc.$(OBJEXT) lxdream-sh4mem.$(OBJEXT) \
2.72 + lxdream-timer.$(OBJEXT) lxdream-dmac.$(OBJEXT) \
2.73 + lxdream-mmu.$(OBJEXT) lxdream-sh4core.$(OBJEXT) \
2.74 + lxdream-sh4dasm.$(OBJEXT) lxdream-sh4mmio.$(OBJEXT) \
2.75 + lxdream-scif.$(OBJEXT) lxdream-sh4stat.$(OBJEXT) \
2.76 + lxdream-xltcache.$(OBJEXT) lxdream-pmm.$(OBJEXT) \
2.77 + lxdream-cache.$(OBJEXT) lxdream-armcore.$(OBJEXT) \
2.78 + lxdream-armdasm.$(OBJEXT) lxdream-armmem.$(OBJEXT) \
2.79 + lxdream-aica.$(OBJEXT) lxdream-audio.$(OBJEXT) \
2.80 + lxdream-pvr2.$(OBJEXT) lxdream-pvr2mem.$(OBJEXT) \
2.81 + lxdream-tacore.$(OBJEXT) lxdream-rendsort.$(OBJEXT) \
2.82 + lxdream-texcache.$(OBJEXT) lxdream-yuv.$(OBJEXT) \
2.83 + lxdream-rendsave.$(OBJEXT) lxdream-scene.$(OBJEXT) \
2.84 + lxdream-gl_sl.$(OBJEXT) lxdream-gl_slsrc.$(OBJEXT) \
2.85 + lxdream-glutil.$(OBJEXT) lxdream-glrender.$(OBJEXT) \
2.86 + lxdream-maple.$(OBJEXT) lxdream-controller.$(OBJEXT) \
2.87 + lxdream-kbd.$(OBJEXT) lxdream-mouse.$(OBJEXT) \
2.88 + lxdream-lightgun.$(OBJEXT) lxdream-vmu.$(OBJEXT) \
2.89 + lxdream-loader.$(OBJEXT) lxdream-bootstrap.$(OBJEXT) \
2.90 + lxdream-util.$(OBJEXT) lxdream-gdlist.$(OBJEXT) \
2.91 + lxdream-vmuvol.$(OBJEXT) lxdream-vmulist.$(OBJEXT) \
2.92 + lxdream-display.$(OBJEXT) lxdream-audio_null.$(OBJEXT) \
2.93 + lxdream-video_null.$(OBJEXT) lxdream-cd_mmc.$(OBJEXT) \
2.94 + lxdream-video_gl.$(OBJEXT) lxdream-gl_fbo.$(OBJEXT) \
2.95 + lxdream-serial_unix.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \
2.96 + $(am__objects_1) $(am__objects_2) $(am__objects_3) \
2.97 + $(am__objects_4) $(am__objects_5) $(am__objects_6) \
2.98 + $(am__objects_7) $(am__objects_8) $(am__objects_9) \
2.99 + $(am__objects_10) $(am__objects_11) $(am__objects_12) \
2.100 + $(am__objects_13) $(am__objects_14) $(am__objects_15) \
2.101 + $(am__objects_16) $(am__objects_17) $(am__objects_18)
2.102 lxdream_OBJECTS = $(am_lxdream_OBJECTS)
2.103 lxdream_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
2.104 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
2.105 @@ -285,7 +285,7 @@
2.106 am__test_testsh4x86_SOURCES_DIST = test/testsh4x86.c x86dasm/x86dasm.c \
2.107 x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
2.108 x86dasm/dis-buf.c sh4/sh4trans.c sh4/sh4x86.c xlat/xltcache.c \
2.109 - xlat/xltcache.h mem.c util.c
2.110 + sh4/sh4dasm.c xlat/xltcache.h mem.c util.c cpu.c
2.111 @BUILD_SH4X86_TRUE@am_test_testsh4x86_OBJECTS = \
2.112 @BUILD_SH4X86_TRUE@ test_testsh4x86-testsh4x86.$(OBJEXT) \
2.113 @BUILD_SH4X86_TRUE@ test_testsh4x86-x86dasm.$(OBJEXT) \
2.114 @@ -295,8 +295,10 @@
2.115 @BUILD_SH4X86_TRUE@ test_testsh4x86-sh4trans.$(OBJEXT) \
2.116 @BUILD_SH4X86_TRUE@ test_testsh4x86-sh4x86.$(OBJEXT) \
2.117 @BUILD_SH4X86_TRUE@ test_testsh4x86-xltcache.$(OBJEXT) \
2.118 +@BUILD_SH4X86_TRUE@ test_testsh4x86-sh4dasm.$(OBJEXT) \
2.119 @BUILD_SH4X86_TRUE@ test_testsh4x86-mem.$(OBJEXT) \
2.120 -@BUILD_SH4X86_TRUE@ test_testsh4x86-util.$(OBJEXT)
2.121 +@BUILD_SH4X86_TRUE@ test_testsh4x86-util.$(OBJEXT) \
2.122 +@BUILD_SH4X86_TRUE@ test_testsh4x86-cpu.$(OBJEXT)
2.123 test_testsh4x86_OBJECTS = $(am_test_testsh4x86_OBJECTS)
2.124 test_testsh4x86_DEPENDENCIES =
2.125 am__dirstamp = $(am__leading_dot)dirstamp
2.126 @@ -541,7 +543,7 @@
2.127 $(INTLLIBS) $(am__append_18) $(am__append_20) $(am__append_22) \
2.128 $(am__append_24) $(am__append_26)
2.129 lxdream_SOURCES = main.c version.c config.c config.h lxdream.h dream.h \
2.130 - gui.h cpu.h hook.h gettext.h mem.c mem.h sdram.c mmio.h \
2.131 + gui.h cpu.c cpu.h hook.h gettext.h mem.c mem.h sdram.c mmio.h \
2.132 watch.c asic.c asic.h clock.h serial.h syscall.c syscall.h \
2.133 bios.c dcload.c gdbserver.c ioutil.c ioutil.h lxpaths.c \
2.134 lxpaths.h gdrom/ide.c gdrom/ide.h gdrom/packet.h \
2.135 @@ -582,8 +584,8 @@
2.136 @BUILD_SH4X86_TRUE@test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \
2.137 @BUILD_SH4X86_TRUE@ x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
2.138 @BUILD_SH4X86_TRUE@ x86dasm/dis-buf.c \
2.139 -@BUILD_SH4X86_TRUE@ sh4/sh4trans.c sh4/sh4x86.c xlat/xltcache.c \
2.140 -@BUILD_SH4X86_TRUE@ xlat/xltcache.h mem.c util.c
2.141 +@BUILD_SH4X86_TRUE@ sh4/sh4trans.c sh4/sh4x86.c xlat/xltcache.c sh4/sh4dasm.c \
2.142 +@BUILD_SH4X86_TRUE@ xlat/xltcache.h mem.c util.c cpu.c
2.143
2.144 @BUILD_SHARED_TRUE@lxdream_dummy_@SOEXT@_SOURCES =
2.145 @BUILD_SHARED_TRUE@lxdream_dummy_@SOEXT@_LDADD = lxdream_dummy.lo @SDL_LIBS@
2.146 @@ -767,6 +769,7 @@
2.147 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoaui.Po@am__quote@
2.148 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-config.Po@am__quote@
2.149 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-controller.Po@am__quote@
2.150 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cpu.Po@am__quote@
2.151 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dcload.Po@am__quote@
2.152 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dis-buf.Po@am__quote@
2.153 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dis-init.Po@am__quote@
2.154 @@ -855,10 +858,12 @@
2.155 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-x86dasm.Po@am__quote@
2.156 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-xltcache.Po@am__quote@
2.157 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-yuv.Po@am__quote@
2.158 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-cpu.Po@am__quote@
2.159 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-dis-buf.Po@am__quote@
2.160 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-dis-init.Po@am__quote@
2.161 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-i386-dis.Po@am__quote@
2.162 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-mem.Po@am__quote@
2.163 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-sh4dasm.Po@am__quote@
2.164 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-sh4trans.Po@am__quote@
2.165 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-sh4x86.Po@am__quote@
2.166 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-testsh4x86.Po@am__quote@
2.167 @@ -980,6 +985,20 @@
2.168 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.169 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`
2.170
2.171 +lxdream-cpu.o: cpu.c
2.172 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cpu.o -MD -MP -MF "$(DEPDIR)/lxdream-cpu.Tpo" -c -o lxdream-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c; \
2.173 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cpu.Tpo" "$(DEPDIR)/lxdream-cpu.Po"; else rm -f "$(DEPDIR)/lxdream-cpu.Tpo"; exit 1; fi
2.174 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu.c' object='lxdream-cpu.o' libtool=no @AMDEPBACKSLASH@
2.175 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.176 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c
2.177 +
2.178 +lxdream-cpu.obj: cpu.c
2.179 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cpu.obj -MD -MP -MF "$(DEPDIR)/lxdream-cpu.Tpo" -c -o lxdream-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`; \
2.180 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cpu.Tpo" "$(DEPDIR)/lxdream-cpu.Po"; else rm -f "$(DEPDIR)/lxdream-cpu.Tpo"; exit 1; fi
2.181 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu.c' object='lxdream-cpu.obj' libtool=no @AMDEPBACKSLASH@
2.182 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.183 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`
2.184 +
2.185 lxdream-mem.o: mem.c
2.186 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-mem.o -MD -MP -MF "$(DEPDIR)/lxdream-mem.Tpo" -c -o lxdream-mem.o `test -f 'mem.c' || echo '$(srcdir)/'`mem.c; \
2.187 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-mem.Tpo" "$(DEPDIR)/lxdream-mem.Po"; else rm -f "$(DEPDIR)/lxdream-mem.Tpo"; exit 1; fi
2.188 @@ -2506,6 +2525,20 @@
2.189 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.190 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_testsh4x86-xltcache.obj `if test -f 'xlat/xltcache.c'; then $(CYGPATH_W) 'xlat/xltcache.c'; else $(CYGPATH_W) '$(srcdir)/xlat/xltcache.c'; fi`
2.191
2.192 +test_testsh4x86-sh4dasm.o: sh4/sh4dasm.c
2.193 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_testsh4x86-sh4dasm.o -MD -MP -MF "$(DEPDIR)/test_testsh4x86-sh4dasm.Tpo" -c -o test_testsh4x86-sh4dasm.o `test -f 'sh4/sh4dasm.c' || echo '$(srcdir)/'`sh4/sh4dasm.c; \
2.194 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_testsh4x86-sh4dasm.Tpo" "$(DEPDIR)/test_testsh4x86-sh4dasm.Po"; else rm -f "$(DEPDIR)/test_testsh4x86-sh4dasm.Tpo"; exit 1; fi
2.195 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4dasm.c' object='test_testsh4x86-sh4dasm.o' libtool=no @AMDEPBACKSLASH@
2.196 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.197 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_testsh4x86-sh4dasm.o `test -f 'sh4/sh4dasm.c' || echo '$(srcdir)/'`sh4/sh4dasm.c
2.198 +
2.199 +test_testsh4x86-sh4dasm.obj: sh4/sh4dasm.c
2.200 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_testsh4x86-sh4dasm.obj -MD -MP -MF "$(DEPDIR)/test_testsh4x86-sh4dasm.Tpo" -c -o test_testsh4x86-sh4dasm.obj `if test -f 'sh4/sh4dasm.c'; then $(CYGPATH_W) 'sh4/sh4dasm.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4dasm.c'; fi`; \
2.201 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_testsh4x86-sh4dasm.Tpo" "$(DEPDIR)/test_testsh4x86-sh4dasm.Po"; else rm -f "$(DEPDIR)/test_testsh4x86-sh4dasm.Tpo"; exit 1; fi
2.202 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sh4/sh4dasm.c' object='test_testsh4x86-sh4dasm.obj' libtool=no @AMDEPBACKSLASH@
2.203 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.204 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_testsh4x86-sh4dasm.obj `if test -f 'sh4/sh4dasm.c'; then $(CYGPATH_W) 'sh4/sh4dasm.c'; else $(CYGPATH_W) '$(srcdir)/sh4/sh4dasm.c'; fi`
2.205 +
2.206 test_testsh4x86-mem.o: mem.c
2.207 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_testsh4x86-mem.o -MD -MP -MF "$(DEPDIR)/test_testsh4x86-mem.Tpo" -c -o test_testsh4x86-mem.o `test -f 'mem.c' || echo '$(srcdir)/'`mem.c; \
2.208 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_testsh4x86-mem.Tpo" "$(DEPDIR)/test_testsh4x86-mem.Po"; else rm -f "$(DEPDIR)/test_testsh4x86-mem.Tpo"; exit 1; fi
2.209 @@ -2534,6 +2567,20 @@
2.210 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.211 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_testsh4x86-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
2.212
2.213 +test_testsh4x86-cpu.o: cpu.c
2.214 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_testsh4x86-cpu.o -MD -MP -MF "$(DEPDIR)/test_testsh4x86-cpu.Tpo" -c -o test_testsh4x86-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c; \
2.215 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_testsh4x86-cpu.Tpo" "$(DEPDIR)/test_testsh4x86-cpu.Po"; else rm -f "$(DEPDIR)/test_testsh4x86-cpu.Tpo"; exit 1; fi
2.216 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu.c' object='test_testsh4x86-cpu.o' libtool=no @AMDEPBACKSLASH@
2.217 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.218 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_testsh4x86-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c
2.219 +
2.220 +test_testsh4x86-cpu.obj: cpu.c
2.221 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_testsh4x86-cpu.obj -MD -MP -MF "$(DEPDIR)/test_testsh4x86-cpu.Tpo" -c -o test_testsh4x86-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`; \
2.222 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_testsh4x86-cpu.Tpo" "$(DEPDIR)/test_testsh4x86-cpu.Po"; else rm -f "$(DEPDIR)/test_testsh4x86-cpu.Tpo"; exit 1; fi
2.223 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpu.c' object='test_testsh4x86-cpu.obj' libtool=no @AMDEPBACKSLASH@
2.224 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.225 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_testsh4x86-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`
2.226 +
2.227 testxlt.o: test/testxlt.c
2.228 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testxlt.o -MD -MP -MF "$(DEPDIR)/testxlt.Tpo" -c -o testxlt.o `test -f 'test/testxlt.c' || echo '$(srcdir)/'`test/testxlt.c; \
2.229 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testxlt.Tpo" "$(DEPDIR)/testxlt.Po"; else rm -f "$(DEPDIR)/testxlt.Tpo"; exit 1; fi
3.1 --- a/src/aica/armdasm.c Mon Dec 07 17:44:27 2009 +1000
3.2 +++ b/src/aica/armdasm.c Tue Dec 15 08:46:37 2009 +1000
3.3 @@ -49,25 +49,25 @@
3.4
3.5
3.6 const struct reg_desc_struct arm_reg_map[] =
3.7 -{ {"R0", REG_INT, &armr.r[0]}, {"R1", REG_INT, &armr.r[1]},
3.8 - {"R2", REG_INT, &armr.r[2]}, {"R3", REG_INT, &armr.r[3]},
3.9 - {"R4", REG_INT, &armr.r[4]}, {"R5", REG_INT, &armr.r[5]},
3.10 - {"R6", REG_INT, &armr.r[6]}, {"R7", REG_INT, &armr.r[7]},
3.11 - {"R8", REG_INT, &armr.r[8]}, {"R9", REG_INT, &armr.r[9]},
3.12 - {"R10",REG_INT, &armr.r[10]}, {"R11",REG_INT, &armr.r[11]},
3.13 - {"R12",REG_INT, &armr.r[12]}, {"R13",REG_INT, &armr.r[13]},
3.14 - {"R14",REG_INT, &armr.r[14]}, {"R15",REG_INT, &armr.r[15]},
3.15 +{ {"R0", REG_TYPE_INT, &armr.r[0]}, {"R1", REG_TYPE_INT, &armr.r[1]},
3.16 + {"R2", REG_TYPE_INT, &armr.r[2]}, {"R3", REG_TYPE_INT, &armr.r[3]},
3.17 + {"R4", REG_TYPE_INT, &armr.r[4]}, {"R5", REG_TYPE_INT, &armr.r[5]},
3.18 + {"R6", REG_TYPE_INT, &armr.r[6]}, {"R7", REG_TYPE_INT, &armr.r[7]},
3.19 + {"R8", REG_TYPE_INT, &armr.r[8]}, {"R9", REG_TYPE_INT, &armr.r[9]},
3.20 + {"R10",REG_TYPE_INT, &armr.r[10]}, {"R11",REG_TYPE_INT, &armr.r[11]},
3.21 + {"R12",REG_TYPE_INT, &armr.r[12]}, {"R13",REG_TYPE_INT, &armr.r[13]},
3.22 + {"R14",REG_TYPE_INT, &armr.r[14]}, {"R15",REG_TYPE_INT, &armr.r[15]},
3.23
3.24 /* Block of FPA registers (arm-elf-gdb seems to expect these).
3.25 * Oddly enough the ARM7TDMI doesn't have them */
3.26 - {"F0",REG_NONE, NULL}, {"F1",REG_NONE, NULL},
3.27 - {"F2",REG_NONE, NULL}, {"F3",REG_NONE, NULL},
3.28 - {"F4",REG_NONE, NULL}, {"F5",REG_NONE, NULL},
3.29 - {"F6",REG_NONE, NULL}, {"F7",REG_NONE, NULL},
3.30 - {"FPS",REG_NONE, NULL},
3.31 + {"F0",REG_TYPE_NONE, NULL}, {"F1",REG_TYPE_NONE, NULL},
3.32 + {"F2",REG_TYPE_NONE, NULL}, {"F3",REG_TYPE_NONE, NULL},
3.33 + {"F4",REG_TYPE_NONE, NULL}, {"F5",REG_TYPE_NONE, NULL},
3.34 + {"F6",REG_TYPE_NONE, NULL}, {"F7",REG_TYPE_NONE, NULL},
3.35 + {"FPS",REG_TYPE_NONE, NULL},
3.36
3.37 /* System registers */
3.38 - {"CPSR", REG_INT, &armr.cpsr}, {"SPSR", REG_INT, &armr.spsr},
3.39 + {"CPSR", REG_TYPE_INT, &armr.cpsr}, {"SPSR", REG_TYPE_INT, &armr.spsr},
3.40 {NULL, 0, NULL} };
3.41
3.42 /* Implementation of get_register - ARM has no pseudo registers so this
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/cpu.c Tue Dec 15 08:46:37 2009 +1000
4.3 @@ -0,0 +1,50 @@
4.4 +/**
4.5 + * $Id$
4.6 + *
4.7 + * Generic CPU utility functions
4.8 + *
4.9 + * Copyright (c) 2009 Nathan Keynes.
4.10 + *
4.11 + * This program is free software; you can redistribute it and/or modify
4.12 + * it under the terms of the GNU General Public License as published by
4.13 + * the Free Software Foundation; either version 2 of the License, or
4.14 + * (at your option) any later version.
4.15 + *
4.16 + * This program is distributed in the hope that it will be useful,
4.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.19 + * GNU General Public License for more details.
4.20 + */
4.21 +
4.22 +#include "cpu.h"
4.23 +
4.24 +void cpu_print_registers( FILE *f, cpu_desc_t cpu )
4.25 +{
4.26 + int i;
4.27 + int column = 0;
4.28 +
4.29 + fprintf( f, "%s registers:\n", cpu->name );
4.30 + for( i=0; cpu->regs_info[i].name != NULL; i++ ) {
4.31 + void *value = cpu->get_register(i);
4.32 + if( value != NULL ) {
4.33 + column++;
4.34 + switch( cpu->regs_info[i].type ) {
4.35 + case REG_TYPE_INT:
4.36 + fprintf( f, "%5s: %08x ", cpu->regs_info[i].name, *(uint32_t *)value );
4.37 + break;
4.38 + case REG_TYPE_FLOAT:
4.39 + fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, (double)*(float *)value );
4.40 + break;
4.41 + case REG_TYPE_DOUBLE:
4.42 + fprintf( f, "%5s: %.8f ", cpu->regs_info[i].name, *(double *)value );
4.43 + break;
4.44 + case REG_TYPE_NONE:
4.45 + column = 4;
4.46 + }
4.47 + }
4.48 + if( column == 4 ) {
4.49 + fprintf( f, "\n" );
4.50 + column = 0;
4.51 + }
4.52 + }
4.53 +}
5.1 --- a/src/cpu.h Mon Dec 07 17:44:27 2009 +1000
5.2 +++ b/src/cpu.h Tue Dec 15 08:46:37 2009 +1000
5.3 @@ -19,6 +19,8 @@
5.4 #ifndef lxdream_cpu_H
5.5 #define lxdream_cpu_H 1
5.6
5.7 +#include <stdio.h>
5.8 +
5.9 #include "lxdream.h"
5.10 #include "mem.h"
5.11
5.12 @@ -36,10 +38,10 @@
5.13 */
5.14 typedef uint32_t (*disasm_func_t)(uint32_t pc, char *buffer, int buflen, char *opcode );
5.15
5.16 -#define REG_INT 0
5.17 -#define REG_FLOAT 1
5.18 -#define REG_DOUBLE 2
5.19 -#define REG_NONE 3 /* Used for empty/separator field */
5.20 +#define REG_TYPE_INT 0
5.21 +#define REG_TYPE_FLOAT 1
5.22 +#define REG_TYPE_DOUBLE 2
5.23 +#define REG_TYPE_NONE 3 /* Used for empty/separator field */
5.24
5.25 /**
5.26 * Structure that defines a single register in a CPU for display purposes.
5.27 @@ -94,5 +96,6 @@
5.28 #endif
5.29
5.30 gboolean gdb_init_server( const char *interface, int port, cpu_desc_t cpu, gboolean mmu );
5.31 +void cpu_print_registers( FILE *out, cpu_desc_t cpu );
5.32
5.33 #endif /* !lxdream_cpu_H */
6.1 --- a/src/gtkui/gtk_debug.c Mon Dec 07 17:44:27 2009 +1000
6.2 +++ b/src/gtkui/gtk_debug.c Tue Dec 15 08:46:37 2009 +1000
6.3 @@ -202,10 +202,10 @@
6.4 arr[0] = data->cpu->regs_info[i].name;
6.5 void *value = data->cpu->get_register(i);
6.6 if( value != NULL ) {
6.7 - if( data->cpu->regs_info->type == REG_INT ) {
6.8 + if( data->cpu->regs_info->type == REG_TYPE_INT ) {
6.9 sprintf( buf, "%08X", *((uint32_t *)value) );
6.10 gtk_clist_append( data->regs_list, arr );
6.11 - } else if( data->cpu->regs_info->type == REG_FLOAT ) {
6.12 + } else if( data->cpu->regs_info->type == REG_TYPE_FLOAT ) {
6.13 sprintf( buf, "%f", *((float *)value) );
6.14 gtk_clist_append( data->regs_list, arr );
6.15 }
6.16 @@ -223,7 +223,7 @@
6.17 for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
6.18 void *value = data->cpu->get_register(i);
6.19 if( value != NULL ) {
6.20 - if( data->cpu->regs_info[i].type == REG_INT ) {
6.21 + if( data->cpu->regs_info[i].type == REG_TYPE_INT ) {
6.22 /* Yes this _is_ probably fairly evil */
6.23 if( *((uint32_t *)value) !=
6.24 *((uint32_t *)((char *)data->saved_regs + ((char *)value - (char *)data->cpu->regs))) ) {
7.1 --- a/src/sh4/sh4.c Mon Dec 07 17:44:27 2009 +1000
7.2 +++ b/src/sh4/sh4.c Tue Dec 15 08:46:37 2009 +1000
7.3 @@ -42,7 +42,6 @@
7.4 #endif
7.5
7.6 void sh4_init( void );
7.7 -void sh4_xlat_init( void );
7.8 void sh4_poweron_reset( void );
7.9 void sh4_start( void );
7.10 void sh4_stop( void );
7.11 @@ -54,54 +53,53 @@
7.12 size_t sh4_debug_write_vma( uint32_t addr, unsigned char *buf, size_t length );
7.13
7.14 uint32_t sh4_run_slice( uint32_t );
7.15 -uint32_t sh4_xlat_run_slice( uint32_t );
7.16
7.17 /* Note: this must match GDB's ordering */
7.18 const struct reg_desc_struct sh4_reg_map[] =
7.19 - { {"R0", REG_INT, &sh4r.r[0]}, {"R1", REG_INT, &sh4r.r[1]},
7.20 - {"R2", REG_INT, &sh4r.r[2]}, {"R3", REG_INT, &sh4r.r[3]},
7.21 - {"R4", REG_INT, &sh4r.r[4]}, {"R5", REG_INT, &sh4r.r[5]},
7.22 - {"R6", REG_INT, &sh4r.r[6]}, {"R7", REG_INT, &sh4r.r[7]},
7.23 - {"R8", REG_INT, &sh4r.r[8]}, {"R9", REG_INT, &sh4r.r[9]},
7.24 - {"R10",REG_INT, &sh4r.r[10]}, {"R11",REG_INT, &sh4r.r[11]},
7.25 - {"R12",REG_INT, &sh4r.r[12]}, {"R13",REG_INT, &sh4r.r[13]},
7.26 - {"R14",REG_INT, &sh4r.r[14]}, {"R15",REG_INT, &sh4r.r[15]},
7.27 - {"PC", REG_INT, &sh4r.pc}, {"PR", REG_INT, &sh4r.pr},
7.28 - {"GBR", REG_INT, &sh4r.gbr}, {"VBR",REG_INT, &sh4r.vbr},
7.29 - {"MACH",REG_INT, ((uint32_t *)&sh4r.mac)+1}, {"MACL",REG_INT, &sh4r.mac},
7.30 - {"SR", REG_INT, &sh4r.sr},
7.31 - {"FPUL", REG_INT, &sh4r.fpul.i}, {"FPSCR", REG_INT, &sh4r.fpscr},
7.32 + { {"R0", REG_TYPE_INT, &sh4r.r[0]}, {"R1", REG_TYPE_INT, &sh4r.r[1]},
7.33 + {"R2", REG_TYPE_INT, &sh4r.r[2]}, {"R3", REG_TYPE_INT, &sh4r.r[3]},
7.34 + {"R4", REG_TYPE_INT, &sh4r.r[4]}, {"R5", REG_TYPE_INT, &sh4r.r[5]},
7.35 + {"R6", REG_TYPE_INT, &sh4r.r[6]}, {"R7", REG_TYPE_INT, &sh4r.r[7]},
7.36 + {"R8", REG_TYPE_INT, &sh4r.r[8]}, {"R9", REG_TYPE_INT, &sh4r.r[9]},
7.37 + {"R10",REG_TYPE_INT, &sh4r.r[10]}, {"R11",REG_TYPE_INT, &sh4r.r[11]},
7.38 + {"R12",REG_TYPE_INT, &sh4r.r[12]}, {"R13",REG_TYPE_INT, &sh4r.r[13]},
7.39 + {"R14",REG_TYPE_INT, &sh4r.r[14]}, {"R15",REG_TYPE_INT, &sh4r.r[15]},
7.40 + {"PC", REG_TYPE_INT, &sh4r.pc}, {"PR", REG_TYPE_INT, &sh4r.pr},
7.41 + {"GBR", REG_TYPE_INT, &sh4r.gbr}, {"VBR",REG_TYPE_INT, &sh4r.vbr},
7.42 + {"MACH",REG_TYPE_INT, ((uint32_t *)&sh4r.mac)+1}, {"MACL",REG_TYPE_INT, &sh4r.mac},
7.43 + {"SR", REG_TYPE_INT, &sh4r.sr},
7.44 + {"FPUL", REG_TYPE_INT, &sh4r.fpul.i}, {"FPSCR", REG_TYPE_INT, &sh4r.fpscr},
7.45
7.46 - {"FR0", REG_FLOAT, &sh4r.fr[0][1] },{"FR1", REG_FLOAT, &sh4r.fr[0][0]},
7.47 - {"FR2", REG_FLOAT, &sh4r.fr[0][3] },{"FR3", REG_FLOAT, &sh4r.fr[0][2]},
7.48 - {"FR4", REG_FLOAT, &sh4r.fr[0][5] },{"FR5", REG_FLOAT, &sh4r.fr[0][4]},
7.49 - {"FR6", REG_FLOAT, &sh4r.fr[0][7] },{"FR7", REG_FLOAT, &sh4r.fr[0][6]},
7.50 - {"FR8", REG_FLOAT, &sh4r.fr[0][9] },{"FR9", REG_FLOAT, &sh4r.fr[0][8]},
7.51 - {"FR10", REG_FLOAT, &sh4r.fr[0][11] },{"FR11", REG_FLOAT, &sh4r.fr[0][10]},
7.52 - {"FR12", REG_FLOAT, &sh4r.fr[0][13] },{"FR13", REG_FLOAT, &sh4r.fr[0][12]},
7.53 - {"FR14", REG_FLOAT, &sh4r.fr[0][15] },{"FR15", REG_FLOAT, &sh4r.fr[0][14]},
7.54 + {"FR0", REG_TYPE_FLOAT, &sh4r.fr[0][1] },{"FR1", REG_TYPE_FLOAT, &sh4r.fr[0][0]},
7.55 + {"FR2", REG_TYPE_FLOAT, &sh4r.fr[0][3] },{"FR3", REG_TYPE_FLOAT, &sh4r.fr[0][2]},
7.56 + {"FR4", REG_TYPE_FLOAT, &sh4r.fr[0][5] },{"FR5", REG_TYPE_FLOAT, &sh4r.fr[0][4]},
7.57 + {"FR6", REG_TYPE_FLOAT, &sh4r.fr[0][7] },{"FR7", REG_TYPE_FLOAT, &sh4r.fr[0][6]},
7.58 + {"FR8", REG_TYPE_FLOAT, &sh4r.fr[0][9] },{"FR9", REG_TYPE_FLOAT, &sh4r.fr[0][8]},
7.59 + {"FR10", REG_TYPE_FLOAT, &sh4r.fr[0][11] },{"FR11", REG_TYPE_FLOAT, &sh4r.fr[0][10]},
7.60 + {"FR12", REG_TYPE_FLOAT, &sh4r.fr[0][13] },{"FR13", REG_TYPE_FLOAT, &sh4r.fr[0][12]},
7.61 + {"FR14", REG_TYPE_FLOAT, &sh4r.fr[0][15] },{"FR15", REG_TYPE_FLOAT, &sh4r.fr[0][14]},
7.62
7.63 - {"SSR",REG_INT, &sh4r.ssr}, {"SPC", REG_INT, &sh4r.spc},
7.64 + {"SSR",REG_TYPE_INT, &sh4r.ssr}, {"SPC", REG_TYPE_INT, &sh4r.spc},
7.65
7.66 - {"R0B0", REG_INT, NULL}, {"R1B0", REG_INT, NULL},
7.67 - {"R2B0", REG_INT, NULL}, {"R3B0", REG_INT, NULL},
7.68 - {"R4B0", REG_INT, NULL}, {"R5B0", REG_INT, NULL},
7.69 - {"R6B0", REG_INT, NULL}, {"R7B0", REG_INT, NULL},
7.70 - {"R0B1", REG_INT, NULL}, {"R1B1", REG_INT, NULL},
7.71 - {"R2B1", REG_INT, NULL}, {"R3B1", REG_INT, NULL},
7.72 - {"R4B1", REG_INT, NULL}, {"R5B1", REG_INT, NULL},
7.73 - {"R6B1", REG_INT, NULL}, {"R7B1", REG_INT, NULL},
7.74 + {"R0B0", REG_TYPE_INT, NULL}, {"R1B0", REG_TYPE_INT, NULL},
7.75 + {"R2B0", REG_TYPE_INT, NULL}, {"R3B0", REG_TYPE_INT, NULL},
7.76 + {"R4B0", REG_TYPE_INT, NULL}, {"R5B0", REG_TYPE_INT, NULL},
7.77 + {"R6B0", REG_TYPE_INT, NULL}, {"R7B0", REG_TYPE_INT, NULL},
7.78 + {"R0B1", REG_TYPE_INT, NULL}, {"R1B1", REG_TYPE_INT, NULL},
7.79 + {"R2B1", REG_TYPE_INT, NULL}, {"R3B1", REG_TYPE_INT, NULL},
7.80 + {"R4B1", REG_TYPE_INT, NULL}, {"R5B1", REG_TYPE_INT, NULL},
7.81 + {"R6B1", REG_TYPE_INT, NULL}, {"R7B1", REG_TYPE_INT, NULL},
7.82
7.83 - {"SGR",REG_INT, &sh4r.sgr}, {"DBR", REG_INT, &sh4r.dbr},
7.84 + {"SGR",REG_TYPE_INT, &sh4r.sgr}, {"DBR", REG_TYPE_INT, &sh4r.dbr},
7.85
7.86 - {"XF0", REG_FLOAT, &sh4r.fr[1][1] },{"XF1", REG_FLOAT, &sh4r.fr[1][0]},
7.87 - {"XF2", REG_FLOAT, &sh4r.fr[1][3] },{"XF3", REG_FLOAT, &sh4r.fr[1][2]},
7.88 - {"XF4", REG_FLOAT, &sh4r.fr[1][5] },{"XF5", REG_FLOAT, &sh4r.fr[1][4]},
7.89 - {"XF6", REG_FLOAT, &sh4r.fr[1][7] },{"XF7", REG_FLOAT, &sh4r.fr[1][6]},
7.90 - {"XF8", REG_FLOAT, &sh4r.fr[1][9] },{"XF9", REG_FLOAT, &sh4r.fr[1][8]},
7.91 - {"XF10", REG_FLOAT, &sh4r.fr[1][11] },{"XF11", REG_FLOAT, &sh4r.fr[1][10]},
7.92 - {"XF12", REG_FLOAT, &sh4r.fr[1][13] },{"XF13", REG_FLOAT, &sh4r.fr[1][12]},
7.93 - {"XF14", REG_FLOAT, &sh4r.fr[1][15] },{"XF15", REG_FLOAT, &sh4r.fr[1][14]},
7.94 + {"XF0", REG_TYPE_FLOAT, &sh4r.fr[1][1] },{"XF1", REG_TYPE_FLOAT, &sh4r.fr[1][0]},
7.95 + {"XF2", REG_TYPE_FLOAT, &sh4r.fr[1][3] },{"XF3", REG_TYPE_FLOAT, &sh4r.fr[1][2]},
7.96 + {"XF4", REG_TYPE_FLOAT, &sh4r.fr[1][5] },{"XF5", REG_TYPE_FLOAT, &sh4r.fr[1][4]},
7.97 + {"XF6", REG_TYPE_FLOAT, &sh4r.fr[1][7] },{"XF7", REG_TYPE_FLOAT, &sh4r.fr[1][6]},
7.98 + {"XF8", REG_TYPE_FLOAT, &sh4r.fr[1][9] },{"XF9", REG_TYPE_FLOAT, &sh4r.fr[1][8]},
7.99 + {"XF10", REG_TYPE_FLOAT, &sh4r.fr[1][11] },{"XF11", REG_TYPE_FLOAT, &sh4r.fr[1][10]},
7.100 + {"XF12", REG_TYPE_FLOAT, &sh4r.fr[1][13] },{"XF13", REG_TYPE_FLOAT, &sh4r.fr[1][12]},
7.101 + {"XF14", REG_TYPE_FLOAT, &sh4r.fr[1][15] },{"XF15", REG_TYPE_FLOAT, &sh4r.fr[1][14]},
7.102
7.103 {NULL, 0, NULL} };
7.104
7.105 @@ -390,6 +388,19 @@
7.106 sh4r.new_pc = pc+2;
7.107 }
7.108
7.109 +/**
7.110 + * Dump all SH4 core information for crash-dump purposes
7.111 + */
7.112 +void sh4_crashdump()
7.113 +{
7.114 + cpu_print_registers( stderr, &sh4_cpu_desc );
7.115 +#ifdef SH4_TRANSLATOR
7.116 + if( sh4_use_translator ) {
7.117 + sh4_translate_crashdump();
7.118 + } /* Nothing really to print for emu core */
7.119 +#endif
7.120 +}
7.121 +
7.122
7.123 /******************************* Support methods ***************************/
7.124
8.1 --- a/src/sh4/sh4.h Mon Dec 07 17:44:27 2009 +1000
8.2 +++ b/src/sh4/sh4.h Tue Dec 15 08:46:37 2009 +1000
8.3 @@ -128,6 +128,9 @@
8.4 gboolean sh4_clear_breakpoint( uint32_t pc, breakpoint_type_t type );
8.5 int sh4_get_breakpoint( uint32_t pc );
8.6
8.7 +/** Dump current SH4 core state (for crashdump purposes) */
8.8 +void sh4_crashdump();
8.9 +
8.10 #ifdef __cplusplus
8.11 }
8.12 #endif
9.1 --- a/src/sh4/sh4trans.c Mon Dec 07 17:44:27 2009 +1000
9.2 +++ b/src/sh4/sh4trans.c Tue Dec 15 08:46:37 2009 +1000
9.3 @@ -240,3 +240,37 @@
9.4 return result;
9.5 }
9.6
9.7 +/**
9.8 + * Crashdump translation information.
9.9 + *
9.10 + * Print out the currently executing block (if any), in source and target
9.11 + * assembly.
9.12 + *
9.13 + * Note: we want to be _really_ careful not to cause a second-level crash
9.14 + * at this point (e.g. if the lookup tables are corrupted...)
9.15 + */
9.16 +void sh4_translate_crashdump()
9.17 +{
9.18 + if( !IS_IN_ICACHE(sh4r.pc) ) {
9.19 + /** If we're crashing due to an icache lookup failure, we'll probably
9.20 + * hit this case - just complain and return.
9.21 + */
9.22 + fprintf( stderr, "** SH4 PC not in current instruction region **\n" );
9.23 + return;
9.24 + }
9.25 + uint32_t pma = GET_ICACHE_PHYS(sh4r.pc);
9.26 + void *code = xlat_get_code( pma );
9.27 + if( code == NULL ) {
9.28 + fprintf( stderr, "** No translated block for current SH4 PC **\n" );
9.29 + return;
9.30 + }
9.31 +
9.32 + /* Sanity check on the code pointer */
9.33 + if( !xlat_is_code_pointer(code) ) {
9.34 + fprintf( stderr, "** Possibly corrupt translation cache **\n" );
9.35 + return;
9.36 + }
9.37 +
9.38 + void *native_pc = xlat_get_native_pc( code, xlat_get_code_size(code) );
9.39 + sh4_translate_disasm_block( stderr, code, sh4r.pc, native_pc );
9.40 +}
10.1 --- a/src/sh4/sh4trans.h Mon Dec 07 17:44:27 2009 +1000
10.2 +++ b/src/sh4/sh4trans.h Tue Dec 15 08:46:37 2009 +1000
10.3 @@ -43,18 +43,13 @@
10.4
10.5 /**
10.6 */
10.7 -uint32_t sh4_xlat_run_slice( uint32_t nanosecs );
10.8 -
10.9 -/**
10.10 - * Return true if translated code is currently running
10.11 - */
10.12 -gboolean sh4_xlat_is_running();
10.13 +uint32_t sh4_translate_run_slice( uint32_t nanosecs );
10.14
10.15 /**
10.16 * Initialize the translation engine (if required). Note xlat cache
10.17 * must already be initialized.
10.18 */
10.19 -void sh4_xlat_init();
10.20 +void sh4_translate_init( void);
10.21
10.22 /**
10.23 * Translate the specified block of code starting from the specified start
10.24 @@ -80,19 +75,19 @@
10.25
10.26 #define TARGET_X86 1
10.27
10.28 -void sh4_translate_init( void );
10.29 void sh4_translate_begin_block( sh4addr_t pc );
10.30 uint32_t sh4_translate_instruction( sh4addr_t pc );
10.31 void sh4_translate_end_block( sh4addr_t pc );
10.32 uint32_t sh4_translate_end_block_size();
10.33 void sh4_translate_emit_breakpoint( sh4vma_t pc );
10.34 +void sh4_translate_crashdump();
10.35
10.36 typedef void (*unwind_thunk_t)(void);
10.37
10.38 /**
10.39 * From within the translator, (typically called from MMU exception handling routines)
10.40 * immediately exit the current translation block (performing cleanup as necessary) and
10.41 - * return to sh4_xlat_run_slice(). Effectively a fast longjmp w/ xlat recovery.
10.42 + * return to sh4_translate_run_slice(). Effectively a fast longjmp w/ xlat recovery.
10.43 *
10.44 * Note: The correct working of this method depends on the translator anticipating the
10.45 * exception and generating the appropriate recovery block(s) - currently this means
10.46 @@ -132,6 +127,12 @@
10.47 */
10.48 void FASTCALL sh4_translate_breakpoint_hit( sh4vma_t pc );
10.49
10.50 +/**
10.51 + * Disassemble the given translated code block, and it's source SH4 code block
10.52 + * side-by-side. The current native pc will be marked if non-null.
10.53 + */
10.54 +void sh4_translate_disasm_block( FILE *out, void *code, sh4addr_t source_start, void *native_pc );
10.55 +
10.56 #ifdef __cplusplus
10.57 }
10.58 #endif
11.1 --- a/src/sh4/sh4x86.in Mon Dec 07 17:44:27 2009 +1000
11.2 +++ b/src/sh4/sh4x86.in Tue Dec 15 08:46:37 2009 +1000
11.3 @@ -27,12 +27,14 @@
11.4
11.5 #include "lxdream.h"
11.6 #include "sh4/sh4core.h"
11.7 +#include "sh4/sh4dasm.h"
11.8 #include "sh4/sh4trans.h"
11.9 #include "sh4/sh4stat.h"
11.10 #include "sh4/sh4mmio.h"
11.11 #include "sh4/mmu.h"
11.12 #include "xlat/xltcache.h"
11.13 #include "xlat/x86/x86op.h"
11.14 +#include "x86dasm/x86dasm.h"
11.15 #include "clock.h"
11.16
11.17 #define DEFAULT_BACKPATCH_SIZE 4096
11.18 @@ -107,6 +109,25 @@
11.19 static uint32_t save_fcw; /* save value for fpu control word */
11.20 static uint32_t trunc_fcw = 0x0F7F; /* fcw value for truncation mode */
11.21
11.22 +static struct x86_symbol x86_symbol_table[] = {
11.23 + { "sh4r+128", ((char *)&sh4r)+128 },
11.24 + { "sh4_cpu_period", &sh4_cpu_period },
11.25 + { "sh4_address_space", NULL },
11.26 + { "sh4_user_address_space", NULL },
11.27 + { "sh4_write_fpscr", sh4_write_fpscr },
11.28 + { "sh4_write_sr", sh4_write_sr },
11.29 + { "sh4_read_sr", sh4_read_sr },
11.30 + { "sh4_sleep", sh4_sleep },
11.31 + { "sh4_fsca", sh4_fsca },
11.32 + { "sh4_ftrv", sh4_ftrv },
11.33 + { "sh4_switch_fr_banks", sh4_switch_fr_banks },
11.34 + { "sh4_execute_instruction", sh4_execute_instruction },
11.35 + { "signsat48", signsat48 },
11.36 + { "xlat_get_code_by_vma", xlat_get_code_by_vma },
11.37 + { "xlat_get_code", xlat_get_code }
11.38 +};
11.39 +
11.40 +
11.41 gboolean is_sse3_supported()
11.42 {
11.43 uint32_t features;
11.44 @@ -122,8 +143,57 @@
11.45 sh4_x86.backpatch_list = malloc(DEFAULT_BACKPATCH_SIZE);
11.46 sh4_x86.backpatch_size = DEFAULT_BACKPATCH_SIZE / sizeof(struct backpatch_record);
11.47 sh4_x86.sse3_enabled = is_sse3_supported();
11.48 + x86_symbol_table[2].ptr = sh4_address_space;
11.49 + x86_symbol_table[3].ptr = sh4_user_address_space;
11.50 + x86_disasm_init();
11.51 + x86_set_symtab( x86_symbol_table, sizeof(x86_symbol_table)/sizeof(struct x86_symbol) );
11.52 }
11.53
11.54 +/**
11.55 + * Disassemble the given translated code block, and it's source SH4 code block
11.56 + * side-by-side. The current native pc will be marked if non-null.
11.57 + */
11.58 +void sh4_translate_disasm_block( FILE *out, void *code, sh4addr_t source_start, void *native_pc )
11.59 +{
11.60 + char buf[256];
11.61 + char op[256];
11.62 +
11.63 + uintptr_t target_start = (uintptr_t)code, target_pc;
11.64 + uintptr_t target_end = target_start + xlat_get_code_size(code);
11.65 + uint32_t source_pc = source_start;
11.66 + uint32_t source_end = source_pc;
11.67 + xlat_recovery_record_t source_recov_table = XLAT_RECOVERY_TABLE(code);
11.68 + xlat_recovery_record_t source_recov_end = source_recov_table + XLAT_BLOCK_FOR_CODE(code)->recover_table_size;
11.69 +
11.70 + for( target_pc = target_start; target_pc < target_end; ) {
11.71 + uintptr_t pc2 = x86_disasm_instruction( target_pc, buf, sizeof(buf), op );
11.72 + fprintf( out, "%c%08X: %-20s %-40s", (target_pc == (uintptr_t)native_pc ? '*' : ' '),
11.73 + (unsigned int)target_pc, op, buf );
11.74 +
11.75 + if( source_recov_table < source_recov_end &&
11.76 + target_pc >= (target_start + source_recov_table->xlat_offset) ) {
11.77 + source_recov_table++;
11.78 + if( source_end < (source_start + (source_recov_table->sh4_icount)*2) )
11.79 + source_end = source_start + (source_recov_table->sh4_icount)*2;
11.80 + }
11.81 +
11.82 + if( source_pc < source_end ) {
11.83 + uint32_t source_pc2 = sh4_disasm_instruction( source_pc, buf, sizeof(buf), op );
11.84 + fprintf( out, " %08X: %s %s\n", source_pc, op, buf );
11.85 + source_pc = source_pc2;
11.86 + } else {
11.87 + fprintf( out, "\n" );
11.88 + }
11.89 +
11.90 + target_pc = pc2;
11.91 + }
11.92 +
11.93 + while( source_pc < source_end ) {
11.94 + uint32_t source_pc2 = sh4_disasm_instruction( source_pc, buf, sizeof(buf), op );
11.95 + fprintf( out, "%*c %08X: %s %s\n", 72,' ', source_pc, op, buf );
11.96 + source_pc = source_pc2;
11.97 + }
11.98 +}
11.99
11.100 static void sh4_x86_add_backpatch( uint8_t *fixup_addr, uint32_t fixup_pc, uint32_t exc_code )
11.101 {
11.102 @@ -1697,6 +1767,7 @@
11.103 uint32_t *patch = ((uint32_t *)xlat_output)-1;
11.104 int save_tstate = sh4_x86.tstate;
11.105 sh4_translate_instruction(pc+2);
11.106 + sh4_x86.in_delay_slot = DELAY_PC; /* Cleared by sh4_translate_instruction */
11.107 exit_block_rel( target, pc+4 );
11.108
11.109 // not taken
11.110 @@ -1834,6 +1905,7 @@
11.111
11.112 int save_tstate = sh4_x86.tstate;
11.113 sh4_translate_instruction(pc+2);
11.114 + sh4_x86.in_delay_slot = DELAY_PC; /* Cleared by sh4_translate_instruction */
11.115 exit_block_rel( disp + pc + 4, pc+4 );
11.116 // not taken
11.117 *patch = (xlat_output - ((uint8_t *)patch)) - 4;
12.1 --- a/src/test/testsh4x86.c Mon Dec 07 17:44:27 2009 +1000
12.2 +++ b/src/test/testsh4x86.c Tue Dec 15 08:46:37 2009 +1000
12.3 @@ -83,6 +83,7 @@
12.4 int sh4_get_breakpoint( uint32_t pc ) { return 0; }
12.5 void sh4_finalize_instruction() { }
12.6 void sh4_core_exit( int exit_code ){}
12.7 +void sh4_crashdump() {}
12.8 void event_execute() {}
12.9 void TMU_run_slice( uint32_t nanos ) {}
12.10 void CCN_set_cache_control( int val ) { }
12.11 @@ -114,6 +115,8 @@
12.12 void MMU_ldtlb() { }
12.13 struct sh4_icache_struct sh4_icache;
12.14 struct mem_region_fn mem_region_unmapped;
12.15 +const struct cpu_desc_struct sh4_cpu_desc;
12.16 +sh4addr_t FASTCALL mmu_vma_to_phys_disasm( sh4vma_t vma ) { return vma; }
12.17
12.18 void usage()
12.19 {
13.1 --- a/src/util.c Mon Dec 07 17:44:27 2009 +1000
13.2 +++ b/src/util.c Tue Dec 15 08:46:37 2009 +1000
13.3 @@ -42,6 +42,7 @@
13.4 char buf[128];
13.5
13.6 fprintf( stderr, "--- Aborting with signal %d ---\n", signo );
13.7 + sh4_crashdump();
13.8 // Get gdb to print a nice backtrace for us
13.9 snprintf( buf, 128, "gdb -batch -f --quiet --pid=%d -ex bt", getpid() );
13.10 system(buf);
14.1 --- a/src/x86dasm/x86dasm.c Mon Dec 07 17:44:27 2009 +1000
14.2 +++ b/src/x86dasm/x86dasm.c Tue Dec 15 08:46:37 2009 +1000
14.3 @@ -65,7 +65,7 @@
14.4 }
14.5 }
14.6
14.7 -void x86_disasm_init(unsigned char *buf, uintptr_t vma, int buflen)
14.8 +void x86_disasm_init()
14.9 {
14.10 init_disassemble_info( &x86_disasm_info, NULL, x86_disasm_output );
14.11 x86_disasm_info.arch = bfd_arch_i386;
14.12 @@ -75,9 +75,9 @@
14.13 x86_disasm_info.mach = bfd_mach_i386_i386_intel_syntax;
14.14 #endif
14.15 x86_disasm_info.endian = BFD_ENDIAN_LITTLE;
14.16 - x86_disasm_info.buffer = buf;
14.17 - x86_disasm_info.buffer_vma = vma;
14.18 - x86_disasm_info.buffer_length = buflen;
14.19 + x86_disasm_info.buffer = 0;
14.20 + x86_disasm_info.buffer_vma = 0;
14.21 + x86_disasm_info.buffer_length = -1;
14.22 x86_disasm_info.print_address_func = x86_print_address;
14.23 }
14.24
15.1 --- a/src/x86dasm/x86dasm.h Mon Dec 07 17:44:27 2009 +1000
15.2 +++ b/src/x86dasm/x86dasm.h Tue Dec 15 08:46:37 2009 +1000
15.3 @@ -29,6 +29,6 @@
15.4
15.5 void x86_disasm_block( FILE *out, void *block, uint32_t len );
15.6 void x86_set_symtab( x86_symbol *symtab, int num_symbols );
15.7 -void x86_disasm_init(unsigned char *buf, uintptr_t vma, int buflen);
15.8 +void x86_disasm_init();
15.9 uintptr_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode );
15.10 void x86_print_symbolic_operand( char *buf, int hex, unsigned int disp );
16.1 --- a/src/xlat/xltcache.c Mon Dec 07 17:44:27 2009 +1000
16.2 +++ b/src/xlat/xltcache.c Tue Dec 15 08:46:37 2009 +1000
16.3 @@ -486,6 +486,44 @@
16.4 assert( foundptr == 1 || tail == ptr );
16.5 }
16.6
16.7 +/**
16.8 + * Sanity check that the given pointer is at least contained in one of cache
16.9 + * regions, and has a sane-ish size. We don't do a full region walk atm.
16.10 + */
16.11 +gboolean xlat_is_code_pointer( void *p )
16.12 +{
16.13 + char *region;
16.14 + uintptr_t region_size;
16.15 +
16.16 + xlat_cache_block_t block = XLAT_BLOCK_FOR_CODE(p);
16.17 + if( (((char *)block) - (char *)xlat_new_cache) < XLAT_NEW_CACHE_SIZE ) {
16.18 + /* Pointer is in new cache */
16.19 + region = (char *)xlat_new_cache;
16.20 + region_size = XLAT_NEW_CACHE_SIZE;
16.21 + }
16.22 +#ifdef XLAT_GENERATIONAL_CACHE
16.23 + else if( (((char *)block) - (char *)xlat_temp_cache) < XLAT_TEMP_CACHE_SIZE ) {
16.24 + /* Pointer is in temp cache */
16.25 + region = (char *)xlat_temp_cache;
16.26 + region_size = XLAT_TEMP_CACHE_SIZE;
16.27 + } else if( (((char *)block) - (char *)xlat_odl_cache) < XLAT_OLD_CACHE_SIZE ) {
16.28 + /* Pointer is in old cache */
16.29 + region = (char *)xlat_old_cache;
16.30 + region_size = XLAT_OLD_CACHE_SIZE;
16.31 + }
16.32 +#endif
16.33 + else {
16.34 + /* Not a valid cache pointer */
16.35 + return FALSE;
16.36 + }
16.37 +
16.38 + /* Make sure the whole block is in the region */
16.39 + if( (((char *)p) - region) >= region_size ||
16.40 + (((char *)(NEXT(block))) - region) >= region_size )
16.41 + return FALSE;
16.42 + return TRUE;
16.43 +}
16.44 +
16.45 void xlat_check_integrity( )
16.46 {
16.47 xlat_check_cache_integrity( xlat_new_cache, xlat_new_cache_ptr, XLAT_NEW_CACHE_SIZE );
17.1 --- a/src/xlat/xltcache.h Mon Dec 07 17:44:27 2009 +1000
17.2 +++ b/src/xlat/xltcache.h Tue Dec 15 08:46:37 2009 +1000
17.3 @@ -51,7 +51,8 @@
17.4
17.5 #define XLAT_BLOCK_FOR_CODE(code) (((xlat_cache_block_t)code)-1)
17.6
17.7 -#define XLAT_BLOCK_MODE(code) (XLAT_BLOCK_FOR_CODE(code)->xlat_sh4_mode)
17.8 +#define XLAT_BLOCK_MODE(code) (XLAT_BLOCK_FOR_CODE(code)->xlat_sh4_mode)
17.9 +#define XLAT_RECOVERY_TABLE(code) ((xlat_recovery_record_t)(((char *)code) + XLAT_BLOCK_FOR_CODE(code)->recover_table_offset))
17.10
17.11 /**
17.12 * Initialize the translation cache
17.13 @@ -169,6 +170,12 @@
17.14 void xlat_flush_cache();
17.15
17.16 /**
17.17 + * Test if the given pointer is within the translation cache, and (is likely)
17.18 + * the start of a code block
17.19 + */
17.20 +gboolean xlat_is_code_pointer( void *p );
17.21 +
17.22 +/**
17.23 * Check the internal integrity of the cache
17.24 */
17.25 void xlat_check_integrity();
.