revision 363:7d0bab24016c
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 363:7d0bab24016c |
parent | 362:dc40e2064dc4 |
child | 364:d738f6883d4a |
author | nkeynes |
date | Tue Aug 28 08:47:35 2007 +0000 (16 years ago) |
Add initial unit test programs
src/Makefile.am | view | annotate | diff | log | ||
src/Makefile.in | view | annotate | diff | log | ||
src/test/testsh4x86.c | view | annotate | diff | log | ||
src/test/testxlt.c | view | annotate | diff | log |
1.1 --- a/src/Makefile.am Tue Aug 28 08:46:54 2007 +00001.2 +++ b/src/Makefile.am Tue Aug 28 08:47:35 2007 +00001.3 @@ -49,10 +49,17 @@1.5 TESTS = test/testxlt1.7 -check_PROGRAMS = test/testxlt1.8 +check_PROGRAMS = test/testxlt test/testsh4x861.10 test_testxlt_SOURCES = test/testxlt.c sh4/xltcache.c sh4/xltcache.h1.12 +test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \1.13 + x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \1.14 + x86dasm/dis-buf.c \1.15 + sh4/sh4dasm.c sh4/sh4trans.c sh4/sh4x86.c sh4/xltcache.c \1.16 + sh4/xltcache.h mem.c util.c1.17 +test_testsh4x86_LDADD = @PACKAGE_LIBS@1.18 +1.19 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE1.21 sh4/sh4core.c: gendec sh4/sh4.def sh4/sh4core.in
2.1 --- a/src/Makefile.in Tue Aug 28 08:46:54 2007 +00002.2 +++ b/src/Makefile.in Tue Aug 28 08:47:35 2007 +00002.3 @@ -184,10 +184,18 @@2.5 TESTS = test/testxlt2.7 -check_PROGRAMS = test/testxlt2.8 +check_PROGRAMS = test/testxlt test/testsh4x862.10 test_testxlt_SOURCES = test/testxlt.c sh4/xltcache.c sh4/xltcache.h2.12 +test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \2.13 + x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \2.14 + x86dasm/dis-buf.c \2.15 + sh4/sh4dasm.c sh4/sh4trans.c sh4/sh4x86.c sh4/xltcache.c \2.16 + sh4/xltcache.h mem.c util.c2.17 +2.18 +test_testsh4x86_LDADD = @PACKAGE_LIBS@2.19 +2.20 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE2.21 subdir = src2.22 ACLOCAL_M4 = $(top_srcdir)/aclocal.m42.23 @@ -195,7 +203,7 @@2.24 CONFIG_HEADER = $(top_builddir)/config.h2.25 CONFIG_CLEAN_FILES =2.26 bin_PROGRAMS = gendec$(EXEEXT) lxdream$(EXEEXT)2.27 -check_PROGRAMS = test/testxlt$(EXEEXT)2.28 +check_PROGRAMS = test/testxlt$(EXEEXT) test/testsh4x86$(EXEEXT)2.29 PROGRAMS = $(bin_PROGRAMS)2.31 am_gendec_OBJECTS = gendec.$(OBJEXT) insparse.$(OBJEXT) \2.32 @@ -226,12 +234,19 @@2.33 lxdream_OBJECTS = $(am_lxdream_OBJECTS)2.34 lxdream_DEPENDENCIES =2.35 lxdream_LDFLAGS =2.36 +am_test_testsh4x86_OBJECTS = testsh4x86.$(OBJEXT) x86dasm.$(OBJEXT) \2.37 + i386-dis.$(OBJEXT) dis-init.$(OBJEXT) dis-buf.$(OBJEXT) \2.38 + sh4dasm.$(OBJEXT) sh4trans.$(OBJEXT) sh4x86.$(OBJEXT) \2.39 + xltcache.$(OBJEXT) mem.$(OBJEXT) util.$(OBJEXT)2.40 +test_testsh4x86_OBJECTS = $(am_test_testsh4x86_OBJECTS)2.41 +test_testsh4x86_DEPENDENCIES =2.42 +test_testsh4x86_LDFLAGS =2.43 +am__dirstamp = $(am__leading_dot)dirstamp2.44 am_test_testxlt_OBJECTS = testxlt.$(OBJEXT) xltcache.$(OBJEXT)2.45 test_testxlt_OBJECTS = $(am_test_testxlt_OBJECTS)2.46 test_testxlt_LDADD = $(LDADD)2.47 test_testxlt_DEPENDENCIES =2.48 test_testxlt_LDFLAGS =2.49 -am__dirstamp = $(am__leading_dot)dirstamp2.51 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)2.52 depcomp = $(SHELL) $(top_srcdir)/depcomp2.53 @@ -244,39 +259,41 @@2.54 @AMDEP_TRUE@ ./$(DEPDIR)/bootstrap.Po ./$(DEPDIR)/callbacks.Po \2.55 @AMDEP_TRUE@ ./$(DEPDIR)/cdi.Po ./$(DEPDIR)/controller.Po \2.56 @AMDEP_TRUE@ ./$(DEPDIR)/dcload.Po ./$(DEPDIR)/debug_win.Po \2.57 +@AMDEP_TRUE@ ./$(DEPDIR)/dis-buf.Po ./$(DEPDIR)/dis-init.Po \2.58 @AMDEP_TRUE@ ./$(DEPDIR)/display.Po ./$(DEPDIR)/dmac.Po \2.59 @AMDEP_TRUE@ ./$(DEPDIR)/dreamcast.Po ./$(DEPDIR)/dump_win.Po \2.60 @AMDEP_TRUE@ ./$(DEPDIR)/eventq.Po ./$(DEPDIR)/gdimage.Po \2.61 @AMDEP_TRUE@ ./$(DEPDIR)/gdrom.Po ./$(DEPDIR)/gendec.Po \2.62 @AMDEP_TRUE@ ./$(DEPDIR)/gl_common.Po ./$(DEPDIR)/gl_fbo.Po \2.63 -@AMDEP_TRUE@ ./$(DEPDIR)/gui.Po ./$(DEPDIR)/ide.Po \2.64 -@AMDEP_TRUE@ ./$(DEPDIR)/insparse.Po ./$(DEPDIR)/intc.Po \2.65 -@AMDEP_TRUE@ ./$(DEPDIR)/interface.Po ./$(DEPDIR)/linux.Po \2.66 -@AMDEP_TRUE@ ./$(DEPDIR)/loader.Po ./$(DEPDIR)/main.Po \2.67 -@AMDEP_TRUE@ ./$(DEPDIR)/maple.Po ./$(DEPDIR)/mem.Po \2.68 -@AMDEP_TRUE@ ./$(DEPDIR)/mmr_win.Po ./$(DEPDIR)/nrg.Po \2.69 -@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/pvr2mem.Po \2.70 -@AMDEP_TRUE@ ./$(DEPDIR)/rendbkg.Po ./$(DEPDIR)/rendcore.Po \2.71 -@AMDEP_TRUE@ ./$(DEPDIR)/render.Po ./$(DEPDIR)/rendsave.Po \2.72 -@AMDEP_TRUE@ ./$(DEPDIR)/rendsort.Po ./$(DEPDIR)/scif.Po \2.73 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \2.74 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4mem.Po ./$(DEPDIR)/sh4mmio.Po \2.75 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4trans.Po ./$(DEPDIR)/sh4x86.Po \2.76 -@AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/syscall.Po \2.77 -@AMDEP_TRUE@ ./$(DEPDIR)/tacore.Po ./$(DEPDIR)/testxlt.Po \2.78 +@AMDEP_TRUE@ ./$(DEPDIR)/gui.Po ./$(DEPDIR)/i386-dis.Po \2.79 +@AMDEP_TRUE@ ./$(DEPDIR)/ide.Po ./$(DEPDIR)/insparse.Po \2.80 +@AMDEP_TRUE@ ./$(DEPDIR)/intc.Po ./$(DEPDIR)/interface.Po \2.81 +@AMDEP_TRUE@ ./$(DEPDIR)/linux.Po ./$(DEPDIR)/loader.Po \2.82 +@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/maple.Po \2.83 +@AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/mmr_win.Po \2.84 +@AMDEP_TRUE@ ./$(DEPDIR)/nrg.Po ./$(DEPDIR)/pvr2.Po \2.85 +@AMDEP_TRUE@ ./$(DEPDIR)/pvr2mem.Po ./$(DEPDIR)/rendbkg.Po \2.86 +@AMDEP_TRUE@ ./$(DEPDIR)/rendcore.Po ./$(DEPDIR)/render.Po \2.87 +@AMDEP_TRUE@ ./$(DEPDIR)/rendsave.Po ./$(DEPDIR)/rendsort.Po \2.88 +@AMDEP_TRUE@ ./$(DEPDIR)/scif.Po ./$(DEPDIR)/sh4core.Po \2.89 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4dasm.Po ./$(DEPDIR)/sh4mem.Po \2.90 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/sh4trans.Po \2.91 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4x86.Po ./$(DEPDIR)/support.Po \2.92 +@AMDEP_TRUE@ ./$(DEPDIR)/syscall.Po ./$(DEPDIR)/tacore.Po \2.93 +@AMDEP_TRUE@ ./$(DEPDIR)/testsh4x86.Po ./$(DEPDIR)/testxlt.Po \2.94 @AMDEP_TRUE@ ./$(DEPDIR)/texcache.Po ./$(DEPDIR)/timer.Po \2.95 @AMDEP_TRUE@ ./$(DEPDIR)/util.Po ./$(DEPDIR)/video_gtk.Po \2.96 @AMDEP_TRUE@ ./$(DEPDIR)/video_null.Po ./$(DEPDIR)/video_x11.Po \2.97 -@AMDEP_TRUE@ ./$(DEPDIR)/watch.Po ./$(DEPDIR)/xltcache.Po \2.98 -@AMDEP_TRUE@ ./$(DEPDIR)/yuv.Po2.99 +@AMDEP_TRUE@ ./$(DEPDIR)/watch.Po ./$(DEPDIR)/x86dasm.Po \2.100 +@AMDEP_TRUE@ ./$(DEPDIR)/xltcache.Po ./$(DEPDIR)/yuv.Po2.101 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \2.102 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)2.103 CCLD = $(CC)2.104 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@2.105 DIST_SOURCES = $(gendec_SOURCES) $(lxdream_SOURCES) \2.106 - $(test_testxlt_SOURCES)2.107 + $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)2.108 DIST_COMMON = $(srcdir)/Makefile.in Makefile.am2.109 -SOURCES = $(gendec_SOURCES) $(lxdream_SOURCES) $(test_testxlt_SOURCES)2.110 +SOURCES = $(gendec_SOURCES) $(lxdream_SOURCES) $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)2.112 all: $(BUILT_SOURCES)2.113 $(MAKE) $(AM_MAKEFLAGS) all-am2.114 @@ -324,6 +341,9 @@2.115 test/$(am__dirstamp):2.116 @$(mkinstalldirs) test2.117 @: > test/$(am__dirstamp)2.118 +test/testsh4x86$(EXEEXT): $(test_testsh4x86_OBJECTS) $(test_testsh4x86_DEPENDENCIES) test/$(am__dirstamp)2.119 + @rm -f test/testsh4x86$(EXEEXT)2.120 + $(LINK) $(test_testsh4x86_LDFLAGS) $(test_testsh4x86_OBJECTS) $(test_testsh4x86_LDADD) $(LIBS)2.121 test/testxlt$(EXEEXT): $(test_testxlt_OBJECTS) $(test_testxlt_DEPENDENCIES) test/$(am__dirstamp)2.122 @rm -f test/testxlt$(EXEEXT)2.123 $(LINK) $(test_testxlt_LDFLAGS) $(test_testxlt_OBJECTS) $(test_testxlt_LDADD) $(LIBS)2.124 @@ -350,6 +370,8 @@2.125 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@2.126 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcload.Po@am__quote@2.127 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_win.Po@am__quote@2.128 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dis-buf.Po@am__quote@2.129 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dis-init.Po@am__quote@2.130 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/display.Po@am__quote@2.131 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmac.Po@am__quote@2.132 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dreamcast.Po@am__quote@2.133 @@ -361,6 +383,7 @@2.134 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_common.Po@am__quote@2.135 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_fbo.Po@am__quote@2.136 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui.Po@am__quote@2.137 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-dis.Po@am__quote@2.138 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ide.Po@am__quote@2.139 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insparse.Po@am__quote@2.140 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intc.Po@am__quote@2.141 @@ -389,6 +412,7 @@2.142 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@2.143 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syscall.Po@am__quote@2.144 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tacore.Po@am__quote@2.145 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testsh4x86.Po@am__quote@2.146 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testxlt.Po@am__quote@2.147 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texcache.Po@am__quote@2.148 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@2.149 @@ -397,6 +421,7 @@2.150 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_null.Po@am__quote@2.151 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_x11.Po@am__quote@2.152 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watch.Po@am__quote@2.153 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86dasm.Po@am__quote@2.154 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xltcache.Po@am__quote@2.155 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yuv.Po@am__quote@2.157 @@ -1544,6 +1569,116 @@2.158 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.159 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_fbo.obj `if test -f 'drivers/gl_fbo.c'; then $(CYGPATH_W) 'drivers/gl_fbo.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_fbo.c'; fi`2.161 +testsh4x86.o: test/testsh4x86.c2.162 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsh4x86.o -MD -MP -MF "$(DEPDIR)/testsh4x86.Tpo" \2.163 +@am__fastdepCC_TRUE@ -c -o testsh4x86.o `test -f 'test/testsh4x86.c' || echo '$(srcdir)/'`test/testsh4x86.c; \2.164 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testsh4x86.Tpo" "$(DEPDIR)/testsh4x86.Po"; \2.165 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/testsh4x86.Tpo"; exit 1; \2.166 +@am__fastdepCC_TRUE@ fi2.167 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test/testsh4x86.c' object='testsh4x86.o' libtool=no @AMDEPBACKSLASH@2.168 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/testsh4x86.Po' tmpdepfile='$(DEPDIR)/testsh4x86.TPo' @AMDEPBACKSLASH@2.169 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.170 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsh4x86.o `test -f 'test/testsh4x86.c' || echo '$(srcdir)/'`test/testsh4x86.c2.171 +2.172 +testsh4x86.obj: test/testsh4x86.c2.173 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsh4x86.obj -MD -MP -MF "$(DEPDIR)/testsh4x86.Tpo" \2.174 +@am__fastdepCC_TRUE@ -c -o testsh4x86.obj `if test -f 'test/testsh4x86.c'; then $(CYGPATH_W) 'test/testsh4x86.c'; else $(CYGPATH_W) '$(srcdir)/test/testsh4x86.c'; fi`; \2.175 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testsh4x86.Tpo" "$(DEPDIR)/testsh4x86.Po"; \2.176 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/testsh4x86.Tpo"; exit 1; \2.177 +@am__fastdepCC_TRUE@ fi2.178 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test/testsh4x86.c' object='testsh4x86.obj' libtool=no @AMDEPBACKSLASH@2.179 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/testsh4x86.Po' tmpdepfile='$(DEPDIR)/testsh4x86.TPo' @AMDEPBACKSLASH@2.180 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.181 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsh4x86.obj `if test -f 'test/testsh4x86.c'; then $(CYGPATH_W) 'test/testsh4x86.c'; else $(CYGPATH_W) '$(srcdir)/test/testsh4x86.c'; fi`2.182 +2.183 +x86dasm.o: x86dasm/x86dasm.c2.184 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86dasm.o -MD -MP -MF "$(DEPDIR)/x86dasm.Tpo" \2.185 +@am__fastdepCC_TRUE@ -c -o x86dasm.o `test -f 'x86dasm/x86dasm.c' || echo '$(srcdir)/'`x86dasm/x86dasm.c; \2.186 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/x86dasm.Tpo" "$(DEPDIR)/x86dasm.Po"; \2.187 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/x86dasm.Tpo"; exit 1; \2.188 +@am__fastdepCC_TRUE@ fi2.189 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/x86dasm.c' object='x86dasm.o' libtool=no @AMDEPBACKSLASH@2.190 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/x86dasm.Po' tmpdepfile='$(DEPDIR)/x86dasm.TPo' @AMDEPBACKSLASH@2.191 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.192 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86dasm.o `test -f 'x86dasm/x86dasm.c' || echo '$(srcdir)/'`x86dasm/x86dasm.c2.193 +2.194 +x86dasm.obj: x86dasm/x86dasm.c2.195 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT x86dasm.obj -MD -MP -MF "$(DEPDIR)/x86dasm.Tpo" \2.196 +@am__fastdepCC_TRUE@ -c -o x86dasm.obj `if test -f 'x86dasm/x86dasm.c'; then $(CYGPATH_W) 'x86dasm/x86dasm.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/x86dasm.c'; fi`; \2.197 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/x86dasm.Tpo" "$(DEPDIR)/x86dasm.Po"; \2.198 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/x86dasm.Tpo"; exit 1; \2.199 +@am__fastdepCC_TRUE@ fi2.200 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/x86dasm.c' object='x86dasm.obj' libtool=no @AMDEPBACKSLASH@2.201 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/x86dasm.Po' tmpdepfile='$(DEPDIR)/x86dasm.TPo' @AMDEPBACKSLASH@2.202 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.203 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o x86dasm.obj `if test -f 'x86dasm/x86dasm.c'; then $(CYGPATH_W) 'x86dasm/x86dasm.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/x86dasm.c'; fi`2.204 +2.205 +i386-dis.o: x86dasm/i386-dis.c2.206 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT i386-dis.o -MD -MP -MF "$(DEPDIR)/i386-dis.Tpo" \2.207 +@am__fastdepCC_TRUE@ -c -o i386-dis.o `test -f 'x86dasm/i386-dis.c' || echo '$(srcdir)/'`x86dasm/i386-dis.c; \2.208 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/i386-dis.Tpo" "$(DEPDIR)/i386-dis.Po"; \2.209 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/i386-dis.Tpo"; exit 1; \2.210 +@am__fastdepCC_TRUE@ fi2.211 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/i386-dis.c' object='i386-dis.o' libtool=no @AMDEPBACKSLASH@2.212 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/i386-dis.Po' tmpdepfile='$(DEPDIR)/i386-dis.TPo' @AMDEPBACKSLASH@2.213 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.214 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o i386-dis.o `test -f 'x86dasm/i386-dis.c' || echo '$(srcdir)/'`x86dasm/i386-dis.c2.215 +2.216 +i386-dis.obj: x86dasm/i386-dis.c2.217 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT i386-dis.obj -MD -MP -MF "$(DEPDIR)/i386-dis.Tpo" \2.218 +@am__fastdepCC_TRUE@ -c -o i386-dis.obj `if test -f 'x86dasm/i386-dis.c'; then $(CYGPATH_W) 'x86dasm/i386-dis.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/i386-dis.c'; fi`; \2.219 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/i386-dis.Tpo" "$(DEPDIR)/i386-dis.Po"; \2.220 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/i386-dis.Tpo"; exit 1; \2.221 +@am__fastdepCC_TRUE@ fi2.222 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/i386-dis.c' object='i386-dis.obj' libtool=no @AMDEPBACKSLASH@2.223 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/i386-dis.Po' tmpdepfile='$(DEPDIR)/i386-dis.TPo' @AMDEPBACKSLASH@2.224 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.225 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o i386-dis.obj `if test -f 'x86dasm/i386-dis.c'; then $(CYGPATH_W) 'x86dasm/i386-dis.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/i386-dis.c'; fi`2.226 +2.227 +dis-init.o: x86dasm/dis-init.c2.228 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dis-init.o -MD -MP -MF "$(DEPDIR)/dis-init.Tpo" \2.229 +@am__fastdepCC_TRUE@ -c -o dis-init.o `test -f 'x86dasm/dis-init.c' || echo '$(srcdir)/'`x86dasm/dis-init.c; \2.230 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dis-init.Tpo" "$(DEPDIR)/dis-init.Po"; \2.231 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/dis-init.Tpo"; exit 1; \2.232 +@am__fastdepCC_TRUE@ fi2.233 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/dis-init.c' object='dis-init.o' libtool=no @AMDEPBACKSLASH@2.234 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/dis-init.Po' tmpdepfile='$(DEPDIR)/dis-init.TPo' @AMDEPBACKSLASH@2.235 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.236 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dis-init.o `test -f 'x86dasm/dis-init.c' || echo '$(srcdir)/'`x86dasm/dis-init.c2.237 +2.238 +dis-init.obj: x86dasm/dis-init.c2.239 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dis-init.obj -MD -MP -MF "$(DEPDIR)/dis-init.Tpo" \2.240 +@am__fastdepCC_TRUE@ -c -o dis-init.obj `if test -f 'x86dasm/dis-init.c'; then $(CYGPATH_W) 'x86dasm/dis-init.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/dis-init.c'; fi`; \2.241 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dis-init.Tpo" "$(DEPDIR)/dis-init.Po"; \2.242 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/dis-init.Tpo"; exit 1; \2.243 +@am__fastdepCC_TRUE@ fi2.244 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/dis-init.c' object='dis-init.obj' libtool=no @AMDEPBACKSLASH@2.245 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/dis-init.Po' tmpdepfile='$(DEPDIR)/dis-init.TPo' @AMDEPBACKSLASH@2.246 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.247 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dis-init.obj `if test -f 'x86dasm/dis-init.c'; then $(CYGPATH_W) 'x86dasm/dis-init.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/dis-init.c'; fi`2.248 +2.249 +dis-buf.o: x86dasm/dis-buf.c2.250 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dis-buf.o -MD -MP -MF "$(DEPDIR)/dis-buf.Tpo" \2.251 +@am__fastdepCC_TRUE@ -c -o dis-buf.o `test -f 'x86dasm/dis-buf.c' || echo '$(srcdir)/'`x86dasm/dis-buf.c; \2.252 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dis-buf.Tpo" "$(DEPDIR)/dis-buf.Po"; \2.253 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/dis-buf.Tpo"; exit 1; \2.254 +@am__fastdepCC_TRUE@ fi2.255 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/dis-buf.c' object='dis-buf.o' libtool=no @AMDEPBACKSLASH@2.256 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/dis-buf.Po' tmpdepfile='$(DEPDIR)/dis-buf.TPo' @AMDEPBACKSLASH@2.257 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.258 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dis-buf.o `test -f 'x86dasm/dis-buf.c' || echo '$(srcdir)/'`x86dasm/dis-buf.c2.259 +2.260 +dis-buf.obj: x86dasm/dis-buf.c2.261 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dis-buf.obj -MD -MP -MF "$(DEPDIR)/dis-buf.Tpo" \2.262 +@am__fastdepCC_TRUE@ -c -o dis-buf.obj `if test -f 'x86dasm/dis-buf.c'; then $(CYGPATH_W) 'x86dasm/dis-buf.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/dis-buf.c'; fi`; \2.263 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dis-buf.Tpo" "$(DEPDIR)/dis-buf.Po"; \2.264 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/dis-buf.Tpo"; exit 1; \2.265 +@am__fastdepCC_TRUE@ fi2.266 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86dasm/dis-buf.c' object='dis-buf.obj' libtool=no @AMDEPBACKSLASH@2.267 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/dis-buf.Po' tmpdepfile='$(DEPDIR)/dis-buf.TPo' @AMDEPBACKSLASH@2.268 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.269 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dis-buf.obj `if test -f 'x86dasm/dis-buf.c'; then $(CYGPATH_W) 'x86dasm/dis-buf.c'; else $(CYGPATH_W) '$(srcdir)/x86dasm/dis-buf.c'; fi`2.270 +2.271 testxlt.o: test/testxlt.c2.272 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testxlt.o -MD -MP -MF "$(DEPDIR)/testxlt.Tpo" \2.273 @am__fastdepCC_TRUE@ -c -o testxlt.o `test -f 'test/testxlt.c' || echo '$(srcdir)/'`test/testxlt.c; \
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00003.2 +++ b/src/test/testsh4x86.c Tue Aug 28 08:47:35 2007 +00003.3 @@ -0,0 +1,143 @@3.4 +/**3.5 + * $Id: testsh4x86.c,v 1.1 2007-08-28 08:47:13 nkeynes Exp $3.6 + *3.7 + * Test cases for the SH4 => x86 translator core. Takes as3.8 + * input a binary SH4 object (and VMA), generates the3.9 + * corresponding x86 code, and outputs the disassembly.3.10 + *3.11 + * Copyright (c) 2005 Nathan Keynes.3.12 + *3.13 + * This program is free software; you can redistribute it and/or modify3.14 + * it under the terms of the GNU General Public License as published by3.15 + * the Free Software Foundation; either version 2 of the License, or3.16 + * (at your option) any later version.3.17 + *3.18 + * This program is distributed in the hope that it will be useful,3.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of3.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3.21 + * GNU General Public License for more details.3.22 + */3.23 +3.24 +#include <stdio.h>3.25 +#include <stdarg.h>3.26 +#include <getopt.h>3.27 +#include "sh4/sh4trans.h"3.28 +#include <sys/stat.h>3.29 +#include "sh4/sh4core.h"3.30 +3.31 +#define MAX_INS_SIZE 323.32 +3.33 +char *option_list = "s:o:d:h";3.34 +struct option longopts[1] = { { NULL, 0, 0, 0 } };3.35 +3.36 +char *input_file = NULL;3.37 +char *diff_file = NULL;3.38 +char *output_file = NULL;3.39 +uint32_t start_addr = 0x8C010000;3.40 +3.41 +FILE *in;3.42 +3.43 +char *inbuf;3.44 +char *outbuf;3.45 +3.46 +int32_t sh4_read_byte( uint32_t addr )3.47 +{3.48 + return *(uint8_t *)(inbuf+(addr-start_addr));3.49 +}3.50 +int32_t sh4_read_word( uint32_t addr )3.51 +{3.52 + return *(uint16_t *)(inbuf+(addr-start_addr));3.53 +}3.54 +int32_t sh4_read_long( uint32_t addr )3.55 +{3.56 + return *(uint32_t *)(inbuf+(addr-start_addr));3.57 +}3.58 +// Stubs3.59 +gboolean sh4_execute_instruction( ) { }3.60 +void sh4_accept_interrupt() {}3.61 +void sh4_set_breakpoint( uint32_t pc, int type ) { }3.62 +gboolean sh4_clear_breakpoint( uint32_t pc, int type ) { }3.63 +int sh4_get_breakpoint( uint32_t pc ) { }3.64 +void event_execute() {}3.65 +void TMU_run_slice( uint32_t nanos ) {}3.66 +void SCIF_run_slice( uint32_t nanos ) {}3.67 +void sh4_write_byte( uint32_t addr, uint32_t val ) {}3.68 +void sh4_write_word( uint32_t addr, uint32_t val ) {}3.69 +void sh4_write_long( uint32_t addr, uint32_t val ) {}3.70 +3.71 +void usage()3.72 +{3.73 + fprintf( stderr, "Usage: testsh4x86 [options] <input bin file>\n");3.74 + fprintf( stderr, "Options:\n");3.75 + fprintf( stderr, " -d <filename> Diff results against contents of file\n" );3.76 + fprintf( stderr, " -h Display this help message\n" );3.77 + fprintf( stderr, " -o <filename> Output disassembly to file [stdout]\n" );3.78 + fprintf( stderr, " -s <addr> Specify start address of binary [8C010000]\n" );3.79 +}3.80 +3.81 +void emit( void *ptr, int level, const gchar *source, const char *msg, ... )3.82 +{3.83 + va_list ap;3.84 + va_start( ap, msg );3.85 + vfprintf( stderr, msg, ap );3.86 + fprintf( stderr, "\n" );3.87 + va_end(ap);3.88 +}3.89 +3.90 +3.91 +struct sh4_registers sh4r;3.92 +3.93 +3.94 +int main( int argc, char *argv[] )3.95 +{3.96 + struct stat st;3.97 + int opt;3.98 + while( (opt = getopt_long( argc, argv, option_list, longopts, NULL )) != -1 ) {3.99 + switch( opt ) {3.100 + case 'd':3.101 + diff_file = optarg;3.102 + break;3.103 + case 'o':3.104 + output_file = optarg;3.105 + break;3.106 + case 's':3.107 + start_addr = strtoul(optarg, NULL, 0);3.108 + break;3.109 + case 'h':3.110 + usage();3.111 + exit(0);3.112 + }3.113 + }3.114 + if( optind < argc ) {3.115 + input_file = argv[optind++];3.116 + } else {3.117 + usage();3.118 + exit(1);3.119 + }3.120 +3.121 + in = fopen( input_file, "ro" );3.122 + if( in == NULL ) {3.123 + perror( "Unable to open input file" );3.124 + exit(2);3.125 + }3.126 + fstat( fileno(in), &st );3.127 + inbuf = malloc( st.st_size );3.128 + fread( inbuf, st.st_size, 1, in );3.129 + outbuf = malloc( st.st_size * MAX_INS_SIZE );3.130 + xlat_output = outbuf;3.131 +3.132 + uint32_t pc;3.133 + for( pc = start_addr; pc < start_addr + st.st_size; pc+=2 ) {3.134 + sh4_x86_translate_instruction( pc );3.135 + }3.136 +3.137 + uint32_t buflen = (xlat_output - (uint8_t *)outbuf);3.138 + x86_disasm_init( outbuf, 0x8c010000, buflen );3.139 + for( pc = 0x8c010000; pc < 0x8c010000 + buflen; ) {3.140 + char buf[256];3.141 + char op[256];3.142 + uint32_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );3.143 + fprintf( stdout, "%08X: %-20s %s\n", pc, op, buf );3.144 + pc = pc2;3.145 + }3.146 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/src/test/testxlt.c Tue Aug 28 08:47:35 2007 +00004.3 @@ -0,0 +1,77 @@4.4 +#include <assert.h>4.5 +#include "sh4/xltcache.h"4.6 +#include "dreamcast.h"4.7 +4.8 +extern xlat_cache_block_t xlat_new_cache;4.9 +extern xlat_cache_block_t xlat_new_cache_ptr;4.10 +extern xlat_cache_block_t xlat_temp_cache;4.11 +extern xlat_cache_block_t xlat_temp_cache_ptr;4.12 +4.13 +/**4.14 + * Test initial allocations from the new cache4.15 + */4.16 +void test_initial()4.17 +{4.18 + int i;4.19 + xlat_cache_block_t block = xlat_start_block( 0x0C008000 );4.20 + assert( block->active == 1 );4.21 + assert( block->size == XLAT_NEW_CACHE_SIZE - (2*sizeof(struct xlat_cache_block)) );4.22 + memset( block->code, 0xB5, 8192 );4.23 + xlat_commit_block( 8192 );4.24 + assert( block->active == 1 );4.25 + assert( block->size == 8192 );4.26 +4.27 + int size = XLAT_NEW_CACHE_SIZE - (4*sizeof(struct xlat_cache_block)) - 8192 - 4096;4.28 + xlat_cache_block_t block2 = xlat_start_block( 0x0C009000 );4.29 + assert( block2->active == 1 );4.30 + assert( block2->size == XLAT_NEW_CACHE_SIZE - (3*sizeof(struct xlat_cache_block)) - 8192 );4.31 + memset( block2->code, 0x6D, size );4.32 + xlat_commit_block( size );4.33 + assert( block2->active == 1 );4.34 + assert( block2->size == size );4.35 +4.36 + void *addr = xlat_get_code( 0x0C008000 );4.37 + assert( addr == &block->code );4.38 + addr = xlat_get_code( 0x0C009000 );4.39 + assert( addr == &block2->code );4.40 + addr = xlat_get_code( 0x0C008002 );4.41 + assert( addr == NULL );4.42 +4.43 + xlat_cache_block_t block3 = xlat_start_block( 0x0D009800 );4.44 + assert( block3->active == 1 );4.45 + assert( block3->size == 4096 );4.46 + memset( block3->code, 0x9C, 4096 );4.47 + xlat_cache_block_t block3a = xlat_extend_block();4.48 + assert( block3a != block3 );4.49 + assert( block3a == block );4.50 + assert( block3a->active == 1 );4.51 + assert( block3a->size = 8192 );4.52 + assert( block3->active == 0 );4.53 + assert( block3->size == 4096 );4.54 + for( i=0; i<4096; i++ ) {4.55 + assert( block3a->code[i] == 0x9C );4.56 + }4.57 + for( i=4096; i<8192; i++ ) {4.58 + assert( block3a->code[i] == 0xB5 );4.59 + }4.60 + xlat_commit_block(6142);4.61 + addr = xlat_get_code( 0x0D009800 );4.62 + assert( addr == &block3a->code );4.63 + /* check promoted block in temp cache */4.64 + addr = xlat_get_code( 0x0C008000 );4.65 + assert( addr == &xlat_temp_cache->code );4.66 + assert( xlat_temp_cache->active == 1 );4.67 + assert( xlat_temp_cache->size == 8192 );4.68 + for( i=0; i<8192; i++ ) {4.69 + assert( xlat_temp_cache->code[i] == 0xB5 );4.70 + }4.71 +}4.72 +4.73 +int main()4.74 +{4.75 + xlat_cache_init();4.76 + xlat_check_integrity();4.77 +4.78 + test_initial();4.79 + return 0;4.80 +}
.