From 6ad8f1d68665a1d6becba9c8fdfda7dbac38db54 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 21 Oct 2009 19:37:41 +0000 Subject: [PATCH] 32x: drc: ARM implementation, start unification with SVP (untested) git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@821 be3aeb3a-fb24-0410-a615-afba39da0efa --- linux/Makefile | 23 ++++++++++++++++++++--- linux/gp2x.c | 12 ++++++++++++ linux/host_dasm.c | 20 +++++++++++++++++--- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/linux/Makefile b/linux/Makefile index 1adb5da..e2eaf46 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -9,6 +9,10 @@ drc_debug = 1 -include Makefile.local +ifndef ARCH +ARCH = x86 +endif + ifeq "$(profile)" "1" CFLAGS += -O3 -Wall CFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math @@ -18,7 +22,15 @@ CFLAGS += -ggdb -Wall -falign-functions=2 endif DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV CFLAGS += -I../.. -I. -LDFLAGS += -lX11 -lpthread +LDFLAGS += -lpthread +ifeq "$(ARCH)" "arm" +CFLAGS += -mcpu=arm920t +DEFINES += ARM +else +LDFLAGS += -lX11 +endif + +CC = $(CROSS)gcc # frontend OBJS += platform/gp2x/emu.o blit.o in_evdev.o plat.o sndout_oss.o gp2x.o log_io.o @@ -50,6 +62,9 @@ OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/m # Pico - carthw OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \ pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o +ifeq "$(ARCH)" "arm" +OBJS += pico/carthw/svp/stub_arm.o +endif # zlib OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o @@ -79,7 +94,7 @@ ifeq "$(use_sh2drc)" "1" DEFINES += DRC_SH2 DRC_TMP OBJS += cpu/sh2/mame/sh2pico.o OBJS += cpu/sh2/compiler.o -OBJS += cpu/sh2/stub_x86.o +OBJS += cpu/sh2/stub_$(ARCH).o ifeq "$(drc_debug)" "1" DEFINES += DRC_DEBUG=1 OBJS += cpu/sh2/mame/sh2dasm.o @@ -100,6 +115,8 @@ endif CFLAGS += $(addprefix -D,$(DEFINES)) vpath %.c = ../.. +vpath %.s = ../.. +vpath %.S = ../.. vpath %.asm = ../.. DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \ @@ -122,7 +139,7 @@ mkdirs: include ../common/revision.mak -pico/carthw/svp/compiler.o : ../../pico/carthw/svp/gen_arm.c +pico/carthw/svp/compiler.o : ../../cpu/drc/emit_arm.c pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h diff --git a/linux/gp2x.c b/linux/gp2x.c index 4da98a5..6eb252b 100644 --- a/linux/gp2x.c +++ b/linux/gp2x.c @@ -33,6 +33,9 @@ int crashed_940 = 0; int default_cpu_clock = 123; void *gp2x_memregs = NULL; +/* ifndef is for qemu build without video out */ +#ifndef ARM + /* faking GP2X pad */ enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40, GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11, @@ -252,6 +255,7 @@ static void xlib_init(void) sem_wait(&xlib_sem); sem_destroy(&xlib_sem); } +#endif // !ARM /* --- */ @@ -272,6 +276,7 @@ static void realloc_screen(void) /* gp2x/emu.c stuff, most to be rm'd */ static void gp2x_video_flip_(void) { +#ifndef ARM unsigned int *image; int pixel_count, i; @@ -311,6 +316,7 @@ static void gp2x_video_flip_(void) realloc_screen(); ximage_realloc(xlib_display, DefaultVisual(xlib_display, 0)); } +#endif } static void gp2x_video_changemode_ll_(int bpp) @@ -405,7 +411,9 @@ void plat_init(void) // snd sndout_oss_init(); +#ifndef ARM xlib_init(); +#endif } void plat_finish(void) @@ -459,6 +467,10 @@ void mp3_update(int *buffer, int length, int stereo) { } +void cache_flush_d_inval_i() +{ +} + /* lprintf */ void lprintf(const char *fmt, ...) { diff --git a/linux/host_dasm.c b/linux/host_dasm.c index 38a7e47..9947689 100644 --- a/linux/host_dasm.c +++ b/linux/host_dasm.c @@ -11,6 +11,20 @@ extern char **g_argv; static struct disassemble_info di; +#ifdef ARM +#define print_insn_func print_insn_little_arm +#define BFD_ARCH bfd_arch_arm +#define BFD_MACH bfd_mach_arm_4T +#else +#define print_insn_func print_insn_i386_intel +#define BFD_ARCH bfd_arch_i386 +#define BFD_MACH bfd_mach_i386_i386_intel_syntax +#endif + +/* hacks for ARM */ +int floatformat_to_double; +int floatformat_ieee_single_little; + /* symbols */ static asymbol **symbols; static long symcount; @@ -141,8 +155,8 @@ static void host_dasm_init(void) di.print_address_func = dis_asm_print_address; // di.symbol_at_address_func = dis_asm_symbol_at_address; di.read_memory_func = dis_asm_read_memory; - di.arch = bfd_arch_i386; - di.mach = bfd_mach_i386_i386_intel_syntax; + di.arch = BFD_ARCH; + di.mach = BFD_MACH; di.endian = BFD_ENDIAN_LITTLE; disassemble_init_for_target(&di); } @@ -160,7 +174,7 @@ void host_dasm(void *addr, int len) vma_end = vma + len; while (vma < vma_end) { printf(" %p ", (void *)(long)vma); - vma += print_insn_i386_intel(vma, &di); + vma += print_insn_func(vma, &di); printf("\n"); } } -- 2.39.5