diff --git a/Makefile b/Makefile index a732dca..bae0444 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ CC += $(shell if [ "`uname -m`" = "sparc64" -o "`uname -m`" = "sun4u" ]; then ec COCOA_LIBS=$(shell if [ "`uname -s`" = "Darwin" ]; then echo "-F/System/Library/Frameworks -framework Cocoa -framework IOKit"; fi) -CFLAGS = -O2 -Wall $(DEBUG) $(INCLUDES) $(DEFINES) +CFLAGS = -O2 -Wall -Werror $(DEBUG) $(INCLUDES) $(DEFINES) LDFLAGS = $(DEBUG) $(X49GP_LDFLAGS) $(GDB_LDFLAGS) LDLIBS = $(X49GP_LIBS) $(GDB_LIBS) $(COCOA_LIBS) @@ -267,6 +267,9 @@ endif %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< +block-vvfat.o: block-vvfat.c + $(CC) $(CFLAGS) -fno-aggressive-loop-optimizations -o $@ -c $< + ifdef QEMU_OLD clean-libs: if [ -n "$(LIBS)" ]; then \ diff --git a/qemu/qemu-git/configure-small b/qemu/qemu-git/configure-small index eb0fd82..2f629e4 100755 --- a/qemu/qemu-git/configure-small +++ b/qemu/qemu-git/configure-small @@ -777,9 +777,9 @@ if test -z "$zero_malloc" ; then fi fi -#if test "$werror" = "yes" ; then -# QEMU_CFLAGS="-Werror $QEMU_CFLAGS" -#fi +if test "$werror" = "yes" ; then + QEMU_CFLAGS="-Werror $QEMU_CFLAGS" +fi if test "$solaris" = "no" ; then if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then diff --git a/qemu/qemu-git/exec.c b/qemu/qemu-git/exec.c index 30930aa..c46d1b1 100644 --- a/qemu/qemu-git/exec.c +++ b/qemu/qemu-git/exec.c @@ -2511,19 +2511,12 @@ void *qemu_get_ram_ptr(ram_addr_t addr) (typically a TLB entry) back to a ram offset. */ ram_addr_t qemu_ram_addr_from_host(void *ptr) { - RAMBlock *prev; - RAMBlock **prevp; RAMBlock *block; uint8_t *host = ptr; - prev = NULL; - prevp = &ram_blocks; block = ram_blocks; while (block && (block->host > host || block->host + block->length <= host)) { - if (prev) - prevp = &prev->next; - prev = block; block = block->next; } if (!block) { diff --git a/qemu/qemu-git/fpu/softfloat.c b/qemu/qemu-git/fpu/softfloat.c index 395f9b1..e6065b4 100644 --- a/qemu/qemu-git/fpu/softfloat.c +++ b/qemu/qemu-git/fpu/softfloat.c @@ -1910,7 +1910,7 @@ float32 float32_div( float32 a, float32 b STATUS_PARAM ) float32 float32_rem( float32 a, float32 b STATUS_PARAM ) { - flag aSign, bSign, zSign; + flag aSign, zSign; int16 aExp, bExp, expDiff; bits32 aSig, bSig; bits32 q; @@ -1923,7 +1923,6 @@ float32 float32_rem( float32 a, float32 b STATUS_PARAM ) aSign = extractFloat32Sign( a ); bSig = extractFloat32Frac( b ); bExp = extractFloat32Exp( b ); - bSign = extractFloat32Sign( b ); if ( aExp == 0xFF ) { if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) { return propagateFloat32NaN( a, b STATUS_VAR ); @@ -3062,7 +3061,7 @@ float64 float64_div( float64 a, float64 b STATUS_PARAM ) float64 float64_rem( float64 a, float64 b STATUS_PARAM ) { - flag aSign, bSign, zSign; + flag aSign, zSign; int16 aExp, bExp, expDiff; bits64 aSig, bSig; bits64 q, alternateASig; @@ -3073,7 +3072,6 @@ float64 float64_rem( float64 a, float64 b STATUS_PARAM ) aSign = extractFloat64Sign( a ); bSig = extractFloat64Frac( b ); bExp = extractFloat64Exp( b ); - bSign = extractFloat64Sign( b ); if ( aExp == 0x7FF ) { if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) { return propagateFloat64NaN( a, b STATUS_VAR ); @@ -4032,7 +4030,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM ) floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM ) { - flag aSign, bSign, zSign; + flag aSign, zSign; int32 aExp, bExp, expDiff; bits64 aSig0, aSig1, bSig; bits64 q, term0, term1, alternateASig0, alternateASig1; @@ -4043,7 +4041,6 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM ) aSign = extractFloatx80Sign( a ); bSig = extractFloatx80Frac( b ); bExp = extractFloatx80Exp( b ); - bSign = extractFloatx80Sign( b ); if ( aExp == 0x7FFF ) { if ( (bits64) ( aSig0<<1 ) || ( ( bExp == 0x7FFF ) && (bits64) ( bSig<<1 ) ) ) { @@ -5144,7 +5141,7 @@ float128 float128_div( float128 a, float128 b STATUS_PARAM ) float128 float128_rem( float128 a, float128 b STATUS_PARAM ) { - flag aSign, bSign, zSign; + flag aSign, zSign; int32 aExp, bExp, expDiff; bits64 aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2; bits64 allZero, alternateASig0, alternateASig1, sigMean1; @@ -5158,7 +5155,6 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM ) bSig1 = extractFloat128Frac1( b ); bSig0 = extractFloat128Frac0( b ); bExp = extractFloat128Exp( b ); - bSign = extractFloat128Sign( b ); if ( aExp == 0x7FFF ) { if ( ( aSig0 | aSig1 ) || ( ( bExp == 0x7FFF ) && ( bSig0 | bSig1 ) ) ) { diff --git a/qemu/qemu-git/i386-dis.c b/qemu/qemu-git/i386-dis.c index b2af033..ec079a9 100644 --- a/qemu/qemu-git/i386-dis.c +++ b/qemu/qemu-git/i386-dis.c @@ -5520,7 +5520,6 @@ static void OP_sI (int bytemode, int sizeflag) { bfd_signed_vma op; - bfd_signed_vma mask = -1; switch (bytemode) { @@ -5529,7 +5528,6 @@ OP_sI (int bytemode, int sizeflag) op = *codep++; if ((op & 0x80) != 0) op -= 0x100; - mask = 0xffffffff; break; case v_mode: USED_REX (REX_W); @@ -5538,11 +5536,9 @@ OP_sI (int bytemode, int sizeflag) else if (sizeflag & DFLAG) { op = get32s (); - mask = 0xffffffff; } else { - mask = 0xffffffff; op = get16 (); if ((op & 0x8000) != 0) op -= 0x10000; @@ -5551,7 +5547,6 @@ OP_sI (int bytemode, int sizeflag) break; case w_mode: op = get16 (); - mask = 0xffffffff; if ((op & 0x8000) != 0) op -= 0x10000; break; diff --git a/qemu/qemu-git/tcg/tcg.c b/qemu/qemu-git/tcg/tcg.c index 3c0e296..e4514dd 100644 --- a/qemu/qemu-git/tcg/tcg.c +++ b/qemu/qemu-git/tcg/tcg.c @@ -549,14 +549,12 @@ void tcg_register_helper(void *func, const char *name) void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, int sizemask, TCGArg ret, int nargs, TCGArg *args) { - int call_type; int i; int real_args; int nb_rets; TCGArg *nparam; *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; - call_type = (flags & TCG_CALL_TYPE_MASK); if (ret != TCG_CALL_DUMMY_ARG) { #if TCG_TARGET_REG_BITS < 64 if (sizemask & 1) { @@ -582,6 +580,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, #if TCG_TARGET_REG_BITS < 64 if (sizemask & (2 << i)) { #ifdef TCG_TARGET_I386 + int call_type = (flags & TCG_CALL_TYPE_MASK); /* REGPARM case: if the third parameter is 64 bit, it is allocated on the stack */ if (i == 2 && call_type == TCG_CALL_TYPE_REGPARM) { diff --git a/s3c2410_arm.c b/s3c2410_arm.c index 82d8bc0..2f4f813 100644 --- a/s3c2410_arm.c +++ b/s3c2410_arm.c @@ -34,7 +34,7 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) cpu_reset(env); tlb_flush(env, 1); - for (i = 0; i < 16; i++) { + for (i = 0; i < (sizeof(env->regs) / sizeof(env->regs[0])); i++) { sprintf(name, "reg-%02u", i); if (x49gp_module_get_u32(module, key, name, 0, &env->regs[i])) error = -EAGAIN; @@ -43,7 +43,7 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "spsr", 0, &env->spsr)) error = -EAGAIN; - for (i = 0; i < 6; i++) { + for (i = 0; i < (sizeof(env->banked_spsr) / sizeof(env->banked_spsr[0])); i++) { sprintf(name, "banked-spsr-%02u", i); if (x49gp_module_get_u32(module, key, name, 0, &env->banked_spsr[i])) error = -EAGAIN; @@ -54,7 +54,7 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) if (x49gp_module_get_u32(module, key, name, 0, &env->banked_r14[i])) error = -EAGAIN; } - for (i = 8; i < 12; i++) { + for (i = 0; i < (sizeof(env->usr_regs) / sizeof(env->usr_regs[0])); i++) { sprintf(name, "reg-usr-%02u", i); if (x49gp_module_get_u32(module, key, name, 0, &env->usr_regs[i])) @@ -80,7 +80,7 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) #endif if (x49gp_module_get_u32(module, key, "QF", 0, &env->QF)) error = -EAGAIN; - if (x49gp_module_get_int(module, key, "thumb", 0, &env->thumb)) + if (x49gp_module_get_u32(module, key, "thumb", 0, &env->thumb)) error = -EAGAIN; if (x49gp_module_get_u32(module, key, "cp15-c0-cpuid", 0, &env->cp15.c0_cpuid)) @@ -132,9 +132,9 @@ s3c2410_arm_load(x49gp_module_t *module, GKeyFile *key) if (x49gp_module_get_int(module, key, "exception-index", 0, &env->exception_index)) error = -EAGAIN; - if (x49gp_module_get_int(module, key, "interrupt-request", 0, &env->interrupt_request)) + if (x49gp_module_get_u32(module, key, "interrupt-request", 0, &env->interrupt_request)) error = -EAGAIN; - if (x49gp_module_get_int(module, key, "halted", 0, &env->halted)) + if (x49gp_module_get_u32(module, key, "halted", 0, &env->halted)) error = -EAGAIN; env->exception_index = -1; @@ -162,13 +162,13 @@ s3c2410_arm_save(x49gp_module_t *module, GKeyFile *key) printf("%s: %s:%u\n", module->name, __FUNCTION__, __LINE__); #endif - for (i = 0; i < 16; i++) { + for (i = 0; i < (sizeof(env->regs) / sizeof(env->regs[0])); i++) { sprintf(name, "reg-%02u", i); x49gp_module_set_u32(module, key, name, env->regs[i]); } x49gp_module_set_u32(module, key, "cpsr", env->uncached_cpsr); x49gp_module_set_u32(module, key, "spsr", env->spsr); - for (i = 0; i < 6; i++) { + for (i = 0; i < (sizeof(env->banked_spsr) / sizeof(env->banked_spsr[0])); i++) { sprintf(name, "banked-spsr-%02u", i); x49gp_module_set_u32(module, key, name, env->banked_spsr[i]); sprintf(name, "banked-r13-%02u", i); @@ -176,7 +176,7 @@ s3c2410_arm_save(x49gp_module_t *module, GKeyFile *key) sprintf(name, "banked-r14-%02u", i); x49gp_module_set_u32(module, key, name, env->banked_r14[i]); } - for (i = 8; i < 12; i++) { + for (i = 0; i < (sizeof(env->usr_regs) / sizeof(env->usr_regs[0])); i++) { sprintf(name, "reg-usr-%02u", i); x49gp_module_set_u32(module, key, name, env->usr_regs[i]); sprintf(name, "reg-fiq-%02u", i); diff --git a/s3c2410_intc.c b/s3c2410_intc.c index 211c97a..df28da5 100644 --- a/s3c2410_intc.c +++ b/s3c2410_intc.c @@ -138,12 +138,12 @@ intmod_put_word(s3c2410_intc_t *intc, uint32_t data) static void intmsk_put_word(s3c2410_intc_t *intc, uint32_t data) { - uint32_t change; #ifdef DEBUG_X49GP_ENABLE_IRQ + uint32_t change; int i; -#endif change = intc->intmsk ^ data; +#endif intc->intmsk = data | 0x01000040; @@ -525,8 +525,10 @@ s3c2410_intc_read(void *opaque, target_phys_addr_t offset) static void s3c2410_intc_write(void *opaque, target_phys_addr_t offset, uint32_t data) { - s3c2410_intc_t *intc = opaque; +#ifdef DEBUG_S3C2410_INTC s3c2410_offset_t *reg; +#endif + s3c2410_intc_t *intc = opaque; #ifdef QEMU_OLD offset -= S3C2410_INTC_BASE; @@ -535,9 +537,9 @@ s3c2410_intc_write(void *opaque, target_phys_addr_t offset, uint32_t data) return; } +#ifdef DEBUG_S3C2410_INTC reg = S3C2410_OFFSET_ENTRY(intc, offset); -#ifdef DEBUG_S3C2410_INTC printf("write %s [%08x] %s [%08x] data %08x\n", "s3c2410-intc", S3C2410_INTC_BASE, reg->name, offset, data); diff --git a/s3c2410_io_port.c b/s3c2410_io_port.c index 8aac85d..74e2a95 100644 --- a/s3c2410_io_port.c +++ b/s3c2410_io_port.c @@ -195,8 +195,8 @@ s3c2410_io_port_read(void *opaque, target_phys_addr_t offset) offset -= S3C2410_IO_PORT_BASE; #endif if (! S3C2410_OFFSET_OK(io, offset)) { -fprintf(stderr, "%s:%u: offset %08x not OK\n", __FUNCTION__, __LINE__, offset); -abort(); + fprintf(stderr, "%s:%u: offset %08lx not OK\n", __FUNCTION__, __LINE__, (unsigned long) offset); + abort(); return ~(0); } @@ -360,7 +360,10 @@ s3c2410_io_port_g_set_bit(x49gp_t *x49gp, int n, uint32_t set) { s3c2410_io_port_t *io = x49gp->s3c2410_io_port; uint32_t value, change; - int pending, level; + int pending; +#ifdef DEBUG_S3C2410_IO_PORT + int level = 0; +#endif if (n > 7) return; @@ -412,17 +415,21 @@ s3c2410_io_port_g_set_bit(x49gp_t *x49gp, int n, uint32_t set) #endif pending = -1; - level = 0; + switch ((io->extint1 >> (4 * n)) & 7) { case 0: /* Low Level */ if (!(io->gpgdat & (1 << n))) pending = n; +#ifdef DEBUG_S3C2410_IO_PORT level = 1; +#endif break; case 1: /* High Level */ if (io->gpgdat & (1 << n)) pending = n; +#ifdef DEBUG_S3C2410_IO_PORT level = 1; +#endif break; case 2: /* Falling Edge */ case 3: diff --git a/s3c2410_lcd.c b/s3c2410_lcd.c index 3753851..fc08bf9 100644 --- a/s3c2410_lcd.c +++ b/s3c2410_lcd.c @@ -84,10 +84,6 @@ s3c2410_lcd_data_init(s3c2410_lcd_t *lcd) void x49gp_schedule_lcd_update(x49gp_t *x49gp) { - unsigned long ticks; - - ticks = (x49gp->emulator_fclk / x49gp->PCLK_ratio) / 100; - if (! x49gp_timer_pending(x49gp->lcd_timer)) { x49gp_mod_timer(x49gp->lcd_timer, x49gp_get_clock() + X49GP_LCD_REFRESH_INTERVAL); diff --git a/s3c2410_uart.c b/s3c2410_uart.c index d743b47..01f5144 100644 --- a/s3c2410_uart.c +++ b/s3c2410_uart.c @@ -188,11 +188,10 @@ s3c2410_uart_write(void *opaque, target_phys_addr_t offset, uint32_t data) s3c2410_uart_reg_t *uart_regs = opaque; x49gp_t *x49gp = uart_regs->x49gp; s3c2410_offset_t *reg; - uint32_t ubrdivn, baud; uint32_t base; #ifdef DEBUG_S3C2410_UART const char *module; - uint32_t mod_offset; + uint32_t mod_offset, ubrdivn, baud; #endif base = (offset & 0x0000c000) >> 14; @@ -239,20 +238,18 @@ s3c2410_uart_write(void *opaque, target_phys_addr_t offset, uint32_t data) break; case S3C2410_UART0_UBRDIV: +#ifdef DEBUG_S3C2410_UART ubrdivn = (data >> 0) & 0xffff; if (uart_regs->ucon & (1 << 10)) { baud = x49gp->UCLK / 16 / (ubrdivn + 1); -#ifdef DEBUG_S3C2410_UART printf("%s: UEXTCLK %u, ubrdivn %u, baud %u\n", module, x49gp->UCLK, ubrdivn, baud); -#endif } else { baud = x49gp->PCLK / 16 / (ubrdivn + 1); -#ifdef DEBUG_S3C2410_UART printf("%s: PCLK %u, ubrdivn %u, baud %u\n", module, x49gp->PCLK, ubrdivn, baud); -#endif } +#endif break; case S3C2410_UART0_UTXH: diff --git a/sram.c b/sram.c index c34b56f..6b87e79 100644 --- a/sram.c +++ b/sram.c @@ -31,6 +31,22 @@ typedef struct { #define SATURN(r) ((target_phys_addr_t) &((saturn_cpu_t *)0)->r) +#if defined(DEBUG_X49GP_SYSRAM_READ) || defined(DEBUG_X49GP_SYSRAM_WRITE) || \ + defined(DEBUG_X49GP_IRAM_READ) || defined(DEBUG_X49GP_IRAM_WRITE) || \ + defined(DEBUG_X49GP_ERAM_READ) || defined(DEBUG_X49GP_ERAM_WRITE) +#define DEBUG_X49GP_SRAM 1 +#endif + +typedef struct { + uint32_t x; + uint32_t ml; + uint32_t mh; + uint8_t m; + uint8_t s; +} hp_real_t; + +#ifdef DEBUG_X49GP_SRAM + static uint32_t saturn_map_s2a(saturn_cpu_t *saturn, uint32_t saddr) { @@ -86,14 +102,6 @@ hxs2real(int hxs) return n; } -typedef struct { - uint32_t x; - uint32_t ml; - uint32_t mh; - uint8_t m; - uint8_t s; -} hp_real_t; - static char * real_number(saturn_cpu_t *saturn, uint32_t saddr, char *buffer, int ml, int xl) { @@ -593,6 +601,8 @@ static CPUWriteMemoryFunc *sram_writefn[] = sram_put_word }; +#endif /* DEBUG_X49GP_SRAM */ + static int sram_load(x49gp_module_t *module, GKeyFile *key) { @@ -723,7 +733,7 @@ sram_init(x49gp_module_t *module) phys_ram_size += S3C2410_SRAM_SIZE; phys_ram_size += S3C2410_SRAM_SIZE; -#if 0 +#ifdef DEBUG_X49GP_SRAM { int iotype; diff --git a/timer.c b/timer.c index 9a5258f..4a2fc2c 100644 --- a/timer.c +++ b/timer.c @@ -32,9 +32,6 @@ struct x49gp_timer_s { x49gp_timer_t *next; }; -#ifdef QEMU_OLD // LD TEMPO HACK -typedef x49gp_timer_t QEMUTimer; -#endif typedef x49gp_timer_cb_t QEMUTimerCB; typedef void * QEMUClock; QEMUClock *rt_clock = (void *) X49GP_TIMER_REALTIME; @@ -150,34 +147,36 @@ x49gp_timer_expired(x49gp_timer_t *timer_head, int64_t current_time) return (timer_head->expires <= current_time); } +#ifndef QEMU_OLD // LD TEMPO HACK + QEMUTimer * qemu_new_timer(QEMUClock *clock, QEMUTimerCB cb, void *opaque) { - return x49gp_new_timer((long) clock, cb, opaque); + return (void *) x49gp_new_timer((long) clock, cb, opaque); } void qemu_free_timer(QEMUTimer *ts) { - return x49gp_free_timer(ts); + return x49gp_free_timer((void *) ts); } void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time) { - return x49gp_mod_timer(ts, expire_time); + return x49gp_mod_timer((void *) ts, expire_time); } void qemu_del_timer(QEMUTimer *ts) { - return x49gp_del_timer(ts); + return x49gp_del_timer((void *) ts); } int qemu_timer_pending(QEMUTimer *ts) { - return x49gp_timer_pending(ts); + return x49gp_timer_pending((void *) ts); } int64_t @@ -186,6 +185,8 @@ qemu_get_clock(QEMUClock *clock) return x49gp_get_clock(); } +#endif /* QEMU_OLD */ + static void x49gp_run_timers(x49gp_timer_t **ptimer_head, int64_t current_time) {