From: Toni Wilen Date: Fri, 20 Jul 2007 12:20:18 +0000 (+0300) Subject: imported winuaesrc1430b11.zip X-Git-Tag: 2100~210 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=834249e51d9e2caeeb515b8ebca12ce9a5dc2e43;p=francis%2Fwinuae.git imported winuaesrc1430b11.zip --- diff --git a/akiko.c b/akiko.c index ed796537..f0f899fc 100755 --- a/akiko.c +++ b/akiko.c @@ -1442,6 +1442,9 @@ static void patchrom (void) { int i; uae_u8 *p = (uae_u8*)extendedkickmemory; + + if (!p) + return; for (i = 0; i < 524288 - sizeof (patchdata1); i++) { if (!memcmp (p + i, patchdata1, sizeof(patchdata1))) { p[i + 6] = 0x4e; diff --git a/compemu_raw_x86.c b/compemu_raw_x86.c index 4a8ecba5..e1bc1113 100755 --- a/compemu_raw_x86.c +++ b/compemu_raw_x86.c @@ -5,40 +5,70 @@ * Some basic information about the the target CPU * *************************************************************************/ -#define EAX 0 -#define ECX 1 -#define EDX 2 -#define EBX 3 +#define EAX_INDEX 0 +#define ECX_INDEX 1 +#define EDX_INDEX 2 +#define EBX_INDEX 3 +#define ESP_INDEX 4 +#define EBP_INDEX 5 +#define ESI_INDEX 6 +#define EDI_INDEX 7 +#if defined(__x86_64__) +#define R8_INDEX 8 +#define R9_INDEX 9 +#define R10_INDEX 10 +#define R11_INDEX 11 +#define R12_INDEX 12 +#define R13_INDEX 13 +#define R14_INDEX 14 +#define R15_INDEX 15 +#endif +/* XXX this has to match X86_Reg8H_Base + 4 */ +#define AH_INDEX (0x10+4+EAX_INDEX) +#define CH_INDEX (0x10+4+ECX_INDEX) +#define DH_INDEX (0x10+4+EDX_INDEX) +#define BH_INDEX (0x10+4+EBX_INDEX) /* The register in which subroutines return an integer return value */ -#define REG_RESULT EAX +#define REG_RESULT EAX_INDEX /* The registers subroutines take their first and second argument in */ -#ifdef _WIN32 -/* MSVC __fastcall registers are ECX and EDX */ -#define REG_PAR1 ECX -#define REG_PAR2 EDX +#if defined(_WIN32) +/* Handle the _fastcall parameters of ECX and EDX */ +#define REG_PAR1 ECX_INDEX +#define REG_PAR2 EDX_INDEX +#elif defined(__x86_64__) +#define REG_PAR1 EDI_INDEX +#define REG_PAR2 ESI_INDEX #else -#define REG_PAR1 EAX -#define REG_PAR2 EDX +#define REG_PAR1 EAX_INDEX +#define REG_PAR2 EDX_INDEX #endif -/* Three registers that are not used for any of the above */ -#define REG_NOPAR1 6 -#define REG_NOPAR2 5 -#define REG_NOPAR3 3 +#if defined(_WIN32) +#define REG_PC_PRE EAX_INDEX /* The register we use for preloading regs.pc_p */ +#define REG_PC_TMP ECX_INDEX +#define SHIFTCOUNT_NREG ECX_INDEX /* Register that can be used for shiftcount. -1 if any reg will do */ +#else +#define REG_PC_PRE EAX_INDEX /* The register we use for preloading regs.pc_p */ +#define REG_PC_TMP ECX_INDEX /* Another register that is not the above */ +#define SHIFTCOUNT_NREG ECX_INDEX /* Register that can be used for shiftcount. -1 if any reg will do */ +#endif -#define REG_PC_PRE 0 /* The register we use for preloading regs.pc_p */ -#define REG_PC_TMP 1 /* Another register that is not the above */ +#define MUL_NREG1 EAX_INDEX /* %eax will hold the low 32 bits after a 32x32 mul */ +#define MUL_NREG2 EDX_INDEX /* %edx will hold the high 32 bits */ -#define SHIFTCOUNT_NREG 1 /* Register that can be used for shiftcount. - -1 if any reg will do */ -#define MUL_NREG1 0 /* %eax will hold the low 32 bits after a 32x32 mul */ -#define MUL_NREG2 2 /* %edx will hold the high 32 bits */ +#define STACK_ALIGN 16 +#define STACK_OFFSET sizeof(void *) uae_s8 always_used[]={4,-1}; +#if defined(__x86_64__) +uae_s8 can_byte[]={0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,-1}; +uae_s8 can_word[]={0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,-1}; +#else uae_s8 can_byte[]={0,1,2,3,-1}; uae_s8 can_word[]={0,1,2,3,5,6,7,-1}; +#endif uae_u8 call_saved[]={0,0,0,0,1,0,0,0}; diff --git a/custom.c b/custom.c index 80880caf..7015b7e8 100755 --- a/custom.c +++ b/custom.c @@ -2469,7 +2469,17 @@ STATIC_INLINE uae_u16 VHPOSR (void) return vp; } -static void perform_copper_write (int old_hpos); +static int test_copper_dangerous (unsigned int address) +{ + if ((address & 0x1fe) < ((copcon & 2) ? ((currprefs.chipset_mask & CSMASK_AGA) ? 0 : 0x40u) : 0x80u)) { + cop_state.state = COP_stop; + copper_enabled_thisline = 0; + unset_special (®s, SPCFLAG_COPPER); + return 1; + } + return 0; +} + static void immediate_copper (int num) { int pos = 0; @@ -2502,7 +2512,9 @@ static void immediate_copper (int num) cop_state.ip = cop2lc; continue; } - perform_copper_write (0); + if (test_copper_dangerous (cop_state.i1)) + break; + custom_wput_1 (0, cop_state.i1, cop_state.i2, 0); } else { // wait or skip if ((cop_state.i1 >> 8) > ((pos >> 5) & 0xff)) pos = (((pos >> 5) & 0x100) | ((cop_state.i1 >> 8)) << 5) | ((cop_state.i1 & 0xff) >> 3); @@ -3382,17 +3394,6 @@ STATIC_INLINE int dangerous_reg (int reg) return 1; } -static int test_copper_dangerous (unsigned int address) -{ - if ((address & 0x1fe) < ((copcon & 2) ? ((currprefs.chipset_mask & CSMASK_AGA) ? 0 : 0x40u) : 0x80u)) { - cop_state.state = COP_stop; - copper_enabled_thisline = 0; - unset_special (®s, SPCFLAG_COPPER); - return 1; - } - return 0; -} - static int custom_wput_copper(int hpos, uaecptr addr, uae_u32 value, int noget) { debug_wputpeek (0xdff000 + (cop_state.saved_i1 & 0x1fe), cop_state.saved_i2); diff --git a/debug.c b/debug.c index b5ac9497..b888a25e 100755 --- a/debug.c +++ b/debug.c @@ -358,9 +358,11 @@ int safe_addr(uaecptr addr, int size) addrbank *ab = &get_mem_bank (addr); if (!ab) return 0; + if (ab->flags & ABFLAG_SAFE) + return 1; if (!ab->check (addr, size)) return 0; - if (ab->flags == ABFLAG_RAM || ab->flags == ABFLAG_ROM || ab->flags == ABFLAG_ROMIN) + if (ab->flags & (ABFLAG_RAM | ABFLAG_ROM | ABFLAG_ROMIN | ABFLAG_SAFE)) return 1; return 0; } @@ -1025,18 +1027,27 @@ static struct memwatch_node mwhit; static uae_u8 *illgdebug; static int illgdebug_break; +static void illg_free (void) +{ + free (illgdebug); + illgdebug = NULL; +} + static void illg_init (void) { int i; + uae_u8 c = 3; + uaecptr addr, end; - free (illgdebug); - illgdebug = (uae_u8*)xmalloc (0x1000000); + illgdebug = (uae_u8*)xcalloc (0x01000000, 1); if (!illgdebug) return; - memset (illgdebug, 3, 0x1000000); - memset (illgdebug, 0, currprefs.chipmem_size); - memset (illgdebug + 0xc00000, 0, currprefs.bogomem_size); - memset (illgdebug + 0x200000, 0, currprefs.fastmem_size); + addr = 0xffffffff; + while ((addr = nextaddr(addr, &end)) != 0xffffffff) { + if (end < 0x01000000) + memset (illgdebug + addr, c, end - addr); + addr = end - 1; + } i = 0; while (custd[i].name) { int rw = custd[i].rw; @@ -1047,20 +1058,20 @@ static void illg_init (void) for (i = 0; i < 16; i++) { /* CIAs */ if (i == 11) continue; - illgdebug[0xbfe001 + i * 0x100] = 0; - illgdebug[0xbfd000 + i * 0x100] = 0; + illgdebug[0xbfe001 + i * 0x100] = c; + illgdebug[0xbfd000 + i * 0x100] = c; } memset (illgdebug + 0xf80000, 1, 512 * 1024); /* KS ROM */ - memset (illgdebug + 0xdc0000, 0, 0x3f); /* clock */ + memset (illgdebug + 0xdc0000, c, 0x3f); /* clock */ #ifdef CDTV if (currprefs.cs_cdtvram) { - memset (illgdebug + 0xdc8000, 0, 4096); /* CDTV batt RAM */ + memset (illgdebug + 0xdc8000, c, 4096); /* CDTV batt RAM */ memset (illgdebug + 0xf00000, 1, 256 * 1024); /* CDTV ext ROM */ } #endif #ifdef CD32 if (currprefs.cs_cd32cd) { - memset (illgdebug + AKIKO_BASE, 0, AKIKO_BASE_END - AKIKO_BASE); + memset (illgdebug + AKIKO_BASE, c, AKIKO_BASE_END - AKIKO_BASE); memset (illgdebug + 0xe00000, 1, 512 * 1024); /* CD32 ext ROM */ } #endif @@ -1087,26 +1098,26 @@ static void illg_debug_do (uaecptr addr, int rwi, int size, uae_u32 val) for (i = size - 1; i >= 0; i--) { uae_u8 v = val >> (i * 8); uae_u32 ad = addr + i; - if (ad >= 0x1000000) + if (ad >= 0x01000000) mask = 7; else mask = illgdebug[ad]; - if (!mask) - continue; + if ((mask & 3) == 3) + return; if (mask & 0x80) { illg_debug_check (ad, rwi, size, val); - } else if ((mask & 3) == 3) { + } else if ((mask & 3) == 0) { if (rwi & 2) console_out ("W: %08.8X=%02.2X PC=%08.8X\n", ad, v, pc); else if (rwi & 1) console_out ("R: %08.8X PC=%08.8X\n", ad, pc); if (illgdebug_break) activate_debugger (); - } else if ((mask & 1) && (rwi & 1)) { + } else if (!(mask & 1) && (rwi & 1)) { console_out ("RO: %08.8X=%02.2X PC=%08.8X\n", ad, v, pc); if (illgdebug_break) activate_debugger (); - } else if ((mask & 2) && (rwi & 2)) { + } else if (!(mask & 2) && (rwi & 2)) { console_out ("WO: %08.8X PC=%08.8X\n", ad, pc); if (illgdebug_break) activate_debugger (); @@ -1138,6 +1149,7 @@ static void smc_reset(void) } } +static void initialize_memwatch (int mode); static void smc_detect_init(void) { xfree(smc_table); @@ -1147,7 +1159,11 @@ static void smc_detect_init(void) smc_size = currprefs.z3fastmem_start + currprefs.z3fastmem_size; smc_size += 4; smc_table = (struct smc_item*)xmalloc (smc_size * sizeof (struct smc_item)); + if (!smc_table) + return; smc_reset(); + if (!memwatch_enabled) + initialize_memwatch (0); console_out("SMCD enabled\n"); } @@ -1562,10 +1578,13 @@ static void memwatch (char **c) console_out ("cleared logging addresses %08.8X - %08.8X\n", addr, addr + len); while (len > 0) { addr &= 0xffffff; - illgdebug[addr] = 0; + illgdebug[addr] = 7; addr++; len--; } + } else { + illg_free(); + console_out("Illegal memory access logging disabled\n"); } } else { illg_init (); @@ -1645,7 +1664,6 @@ static void writeintoreg (char **c) } } - static void writeintomem (char **c) { uae_u32 addr = 0; diff --git a/expansion.c b/expansion.c index cf0a61b2..99d6a064 100755 --- a/expansion.c +++ b/expansion.c @@ -201,34 +201,31 @@ addrbank expamem_bank = { expamem_lget, expamem_wget, expamem_bget, expamem_lput, expamem_wput, expamem_bput, default_xlate, default_check, NULL, "Autoconfig", - dummy_lgeti, dummy_wgeti, ABFLAG_IO + dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE }; static uae_u32 REGPARAM2 expamem_lget (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif write_log ("warning: READ.L from address $%lx \n", addr); - return 0xfffffffful; + return (expamem_wget (addr) << 16) | expamem_wget (addr + 2); } static uae_u32 REGPARAM2 expamem_wget (uaecptr addr) { -#ifdef JIT - special_mem |= S_READ; -#endif write_log ("warning: READ.W from address $%lx \n", addr); - return 0xffff; + return (expamem_bget (addr) << 8) | expamem_bget (addr + 1); } static uae_u32 REGPARAM2 expamem_bget (uaecptr addr) { + uae_u8 b; #ifdef JIT special_mem |= S_READ; #endif addr &= 0xFFFF; - return expamem[addr]; + b = expamem[addr]; + //write_log("%08x=%02.2X\n", addr, b); + return b; } static void REGPARAM2 expamem_write (uaecptr addr, uae_u32 value) @@ -264,6 +261,7 @@ static void REGPARAM2 expamem_wput (uaecptr addr, uae_u32 value) #ifdef JIT special_mem |= S_WRITE; #endif + value &= 0xffff; if (expamem_type() != zorroIII) write_log ("warning: WRITE.W to address $%lx : value $%x\n", addr, value); else { @@ -278,8 +276,8 @@ static void REGPARAM2 expamem_wput (uaecptr addr, uae_u32 value) // Z3 P96 RAM value = p96ram_start >> 16; } - chipmem_wput (regs.regs[11] + 0x20, value); - chipmem_wput (regs.regs[11] + 0x28, value); + put_word (regs.regs[11] + 0x20, value); + put_word (regs.regs[11] + 0x28, value); // -Bernd Roesch expamem_hi = value; (*card_map[ecard]) (); @@ -300,6 +298,7 @@ static void REGPARAM2 expamem_bput (uaecptr addr, uae_u32 value) #ifdef JIT special_mem |= S_WRITE; #endif + value &= 0xff; switch (addr & 0xff) { case 0x30: case 0x32: @@ -310,7 +309,7 @@ static void REGPARAM2 expamem_bput (uaecptr addr, uae_u32 value) case 0x48: if (expamem_type () == zorroII) { - expamem_hi = value & 0xFF; + expamem_hi = value; (*card_map[ecard]) (); write_log (" Card %d (Zorro%s) done.\n", ecard + 1, expamem_type() == 0xc0 ? "II" : "III"); ++ecard; @@ -636,7 +635,7 @@ static addrbank filesys_bank = { filesys_lget, filesys_wget, filesys_bget, filesys_lput, filesys_wput, filesys_bput, default_xlate, default_check, NULL, "Filesystem Autoconfig Area", - dummy_lgeti, dummy_wgeti, ABFLAG_IO + dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE }; #endif /* FILESYS */ diff --git a/gencomp.c b/gencomp.c index c2a9de2a..ccc19db0 100755 --- a/gencomp.c +++ b/gencomp.c @@ -2023,13 +2023,13 @@ gen_opcode (unsigned long int opcode) break; case i_ASR: - mayfail; + mayfail; if (curi->smode==Dreg) { - comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" - " FAIL(1);\n" - " return 0;\n" - "} \n"); - start_brace(); + comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" + " FAIL(1);\n" + " return 0;\n" + "} \n"); + start_brace(); } comprintf("\tdont_care_flags();\n"); @@ -2042,45 +2042,51 @@ gen_opcode (unsigned long int opcode) comprintf("\tint highmask;\n" "\tint width;\n" "\tint cdata=scratchie++;\n" - "\tint sdata=scratchie++;\n" - "\tint tmpcnt=scratchie++;\n"); - comprintf("\tmov_l_rr(sdata,data);\n" - "\tmov_l_rr(cdata,data);\n" - "\tmov_l_rr(tmpcnt,cnt);\n"); - switch (curi->size) { - case sz_byte: comprintf("\tshra_b_ri(sdata,7);\n"); break; - case sz_word: comprintf("\tshra_w_ri(sdata,15);\n"); break; - case sz_long: comprintf("\tshra_l_ri(sdata,31);\n"); break; - default: abort(); + "\tint tmpcnt=scratchie++;\n" + "\tint highshift=scratchie++;\n"); + comprintf("\tmov_l_rr(tmpcnt,cnt);\n" + "\tand_l_ri(tmpcnt,63);\n" + "\tmov_l_ri(cdata,0);\n" + "\tcmov_l_rr(cdata,data,5);\n"); + /* cdata is now either data (for shift count!=0) or + 0 (for shift count==0) */ + switch(curi->size) { + case sz_byte: comprintf("\tshra_b_rr(data,cnt);\n" + "\thighmask=0x38;\n" + "\twidth=8;\n"); + break; + case sz_word: comprintf("\tshra_w_rr(data,cnt);\n" + "\thighmask=0x30;\n" + "\twidth=16;\n"); + break; + case sz_long: comprintf("\tshra_l_rr(data,cnt);\n" + "\thighmask=0x20;\n" + "\twidth=32;\n"); + break; + default: abort(); } - /* sdata is now the MSB propagated to all bits for the - register of specified size */ - comprintf("\tand_l_ri(tmpcnt,63);\n"); + comprintf("test_l_ri(cnt,highmask);\n" + "mov_l_ri(highshift,0);\n" + "mov_l_ri(scratchie,width/2);\n" + "cmov_l_rr(highshift,scratchie,5);\n"); + /* The x86 masks out bits, so we now make sure that things + really get shifted as much as planned */ switch(curi->size) { - case sz_byte: comprintf("\tshra_b_rr(data,tmpcnt);\n" - "\thighmask=0x38;\n"); - break; - case sz_word: comprintf("\tshra_w_rr(data,tmpcnt);\n" - "\thighmask=0x30;\n"); - break; - case sz_long: comprintf("\tshra_l_rr(data,tmpcnt);\n" - "\thighmask=0x20;\n"); - break; + case sz_byte: comprintf("\tshra_b_rr(data,highshift);\n");break; + case sz_word: comprintf("\tshra_w_rr(data,highshift);\n");break; + case sz_long: comprintf("\tshra_l_rr(data,highshift);\n");break; + default: abort(); } - comprintf("\ttest_l_ri(tmpcnt,highmask);\n"); - switch (curi->size) { - case sz_byte: comprintf("\tcmov_b_rr(data,sdata,NATIVE_CC_NE);\n"); break; - case sz_word: comprintf("\tcmov_w_rr(data,sdata,NATIVE_CC_NE);\n"); break; - case sz_long: comprintf("\tcmov_l_rr(data,sdata,NATIVE_CC_NE);\n"); break; + /* And again */ + switch(curi->size) { + case sz_byte: comprintf("\tshra_b_rr(data,highshift);\n");break; + case sz_word: comprintf("\tshra_w_rr(data,highshift);\n");break; + case sz_long: comprintf("\tshra_l_rr(data,highshift);\n");break; + default: abort(); } - + /* Result of shift is now in data. Now we need to determine the carry by shifting cdata one less */ - /* NOTE: carry bit is cleared if shift count is zero */ - comprintf("\tmov_l_ri(scratchie,0);\n" - "\ttest_l_rr(tmpcnt,tmpcnt);\n" - "\tcmov_l_rr(sdata,scratchie,NATIVE_CC_EQ);\n" - "\tforget_about(scratchie);\n"); comprintf("\tsub_l_ri(tmpcnt,1);\n"); switch(curi->size) { case sz_byte: comprintf("\tshra_b_rr(cdata,tmpcnt);\n");break; @@ -2089,16 +2095,10 @@ gen_opcode (unsigned long int opcode) default: abort(); } /* If the shift count was higher than the width, we need - to pick up the sign from original data (sdata) */ - /* NOTE: for shift count of zero, the following holds - true and cdata contains 0 so that carry bit is cleared */ - comprintf("\ttest_l_ri(tmpcnt,highmask);\n" - "\tforget_about(tmpcnt);\n" - "\tcmov_l_rr(cdata,sdata,NATIVE_CC_NE);\n"); - - /* And create the flags (preserve X flag if shift count is zero) */ - comprintf("\ttest_l_ri(cnt,63);\n" - "\tcmov_l_rr(FLAGX,cdata,NATIVE_CC_NE);\n"); + to pick up the sign from data */ + comprintf("test_l_ri(tmpcnt,highmask);\n" + "cmov_l_rr(cdata,data,5);\n"); + /* And create the flags */ comprintf("\tstart_needflags();\n"); comprintf("\tif (needed_flags & FLAG_ZNV)\n"); switch(curi->size) { @@ -2109,6 +2109,7 @@ gen_opcode (unsigned long int opcode) comprintf("\t bt_l_ri(cdata,0);\n"); /* Set C */ comprintf("\t live_flags();\n"); comprintf("\t end_needflags();\n"); + comprintf("\t duplicate_carry();\n"); comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n"); genastore ("data", curi->dmode, "dstreg", curi->size, "data"); } @@ -2121,15 +2122,15 @@ gen_opcode (unsigned long int opcode) switch(curi->size) { case sz_byte: comprintf("\tshra_b_rr(data,cnt);\n" "\thighmask=0x38;\n" - "\twidth=8;\n"); + "\twidth=8;\n"); break; case sz_word: comprintf("\tshra_w_rr(data,cnt);\n" "\thighmask=0x30;\n" - "\twidth=16;\n"); + "\twidth=16;\n"); break; case sz_long: comprintf("\tshra_l_rr(data,cnt);\n" "\thighmask=0x20;\n" - "\twidth=32;\n"); + "\twidth=32;\n"); break; default: abort(); } @@ -2335,13 +2336,13 @@ gen_opcode (unsigned long int opcode) break; case i_LSR: - mayfail; + mayfail; if (curi->smode==Dreg) { - comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" - " FAIL(1);\n" - " return 0;\n" - "} \n"); - start_brace(); + comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" + " FAIL(1);\n" + " return 0;\n" + "} \n"); + start_brace(); } comprintf("\tdont_care_flags();\n"); @@ -2357,46 +2358,43 @@ gen_opcode (unsigned long int opcode) comprintf("\tmov_l_rr(tmpcnt,cnt);\n" "\tand_l_ri(tmpcnt,63);\n" "\tmov_l_ri(cdata,0);\n" - "\tcmov_l_rr(cdata,data,NATIVE_CC_NE);\n"); + "\tcmov_l_rr(cdata,data,5);\n"); /* cdata is now either data (for shift count!=0) or 0 (for shift count==0) */ switch(curi->size) { - case sz_byte: comprintf("\tshrl_b_rr(data,tmpcnt);\n" - "\thighmask=0x38;\n"); + case sz_byte: comprintf("\tshrl_b_rr(data,cnt);\n" + "\thighmask=0x38;\n"); break; - case sz_word: comprintf("\tshrl_w_rr(data,tmpcnt);\n" - "\thighmask=0x30;\n"); + case sz_word: comprintf("\tshrl_w_rr(data,cnt);\n" + "\thighmask=0x30;\n"); break; - case sz_long: comprintf("\tshrl_l_rr(data,tmpcnt);\n" - "\thighmask=0x20;\n"); + case sz_long: comprintf("\tshrl_l_rr(data,cnt);\n" + "\thighmask=0x20;\n"); break; default: abort(); } - comprintf("\ttest_l_ri(tmpcnt,highmask);\n" - "\rmov_l_ri(scratchie,0);\n"); - if (curi->size == sz_long) - comprintf("\tcmov_l_rr(data,scratchie,NATIVE_CC_NE);\n"); - else { - comprintf("\tcmov_l_rr(scratchie,data,NATIVE_CC_EQ);\n"); - switch(curi->size) { - case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break; - case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break; - default: abort(); - } + comprintf("test_l_ri(cnt,highmask);\n" + "mov_l_ri(scratchie,0);\n" + "cmov_l_rr(scratchie,data,4);\n"); + switch(curi->size) { + case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break; + case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break; + case sz_long: comprintf("\tmov_l_rr(data,scratchie);\n");break; + default: abort(); } /* Result of shift is now in data. Now we need to determine the carry by shifting cdata one less */ comprintf("\tsub_l_ri(tmpcnt,1);\n"); - comprintf("\tshrl_l_rr(cdata,tmpcnt);\n"); - comprintf("\ttest_l_ri(tmpcnt,highmask);\n"); - comprintf("\tforget_about(tmpcnt);\n"); - if (curi->size != sz_long) /* scratchie is still live for LSR.L */ - comprintf("\tmov_l_ri(scratchie,0);\n"); - comprintf("\tcmov_l_rr(cdata,scratchie,NATIVE_CC_NE);\n"); - comprintf("\tforget_about(scratchie);\n"); - /* And create the flags (preserve X flag if shift count is zero) */ - comprintf("\ttest_l_ri(cnt,63);\n" - "\tcmov_l_rr(FLAGX,cdata,NATIVE_CC_NE);\n"); + switch(curi->size) { + case sz_byte: comprintf("\tshrl_b_rr(cdata,tmpcnt);\n");break; + case sz_word: comprintf("\tshrl_w_rr(cdata,tmpcnt);\n");break; + case sz_long: comprintf("\tshrl_l_rr(cdata,tmpcnt);\n");break; + default: abort(); + } + comprintf("test_l_ri(tmpcnt,highmask);\n" + "mov_l_ri(scratchie,0);\n" + "cmov_l_rr(cdata,scratchie,5);\n"); + /* And create the flags */ comprintf("\tstart_needflags();\n"); comprintf("\tif (needed_flags & FLAG_ZNV)\n"); switch(curi->size) { @@ -2407,6 +2405,7 @@ gen_opcode (unsigned long int opcode) comprintf("\t bt_l_ri(cdata,0);\n"); /* Set C */ comprintf("\t live_flags();\n"); comprintf("\t end_needflags();\n"); + comprintf("\t duplicate_carry();\n"); comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n"); genastore ("data", curi->dmode, "dstreg", curi->size, "data"); } @@ -2416,13 +2415,13 @@ gen_opcode (unsigned long int opcode) comprintf("\tint highmask;\n"); switch(curi->size) { case sz_byte: comprintf("\tshrl_b_rr(data,cnt);\n" - "\thighmask=0x38;\n"); + "\thighmask=0x38;\n"); break; case sz_word: comprintf("\tshrl_w_rr(data,cnt);\n" - "\thighmask=0x30;\n"); + "\thighmask=0x30;\n"); break; case sz_long: comprintf("\tshrl_l_rr(data,cnt);\n" - "\thighmask=0x20;\n"); + "\thighmask=0x20;\n"); break; default: abort(); } @@ -2472,14 +2471,6 @@ gen_opcode (unsigned long int opcode) break; case i_LSL: - mayfail; - if (curi->smode==Dreg) { - comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" - " FAIL(1);\n" - " return 0;\n" - "} \n"); - start_brace(); - } comprintf("\tdont_care_flags();\n"); genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0); @@ -2494,61 +2485,56 @@ gen_opcode (unsigned long int opcode) comprintf("\tmov_l_rr(tmpcnt,cnt);\n" "\tand_l_ri(tmpcnt,63);\n" "\tmov_l_ri(cdata,0);\n" - "\tcmov_l_rr(cdata,data,NATIVE_CC_NE);\n"); + "\tcmov_l_rr(cdata,data,5);\n"); /* cdata is now either data (for shift count!=0) or 0 (for shift count==0) */ switch(curi->size) { - case sz_byte: comprintf("\tshll_b_rr(data,tmpcnt);\n" - "\thighmask=0x38;\n"); + case sz_byte: comprintf("\tshll_b_rr(data,cnt);\n" + "\thighmask=0x38;\n"); break; - case sz_word: comprintf("\tshll_w_rr(data,tmpcnt);\n" - "\thighmask=0x30;\n"); + case sz_word: comprintf("\tshll_w_rr(data,cnt);\n" + "\thighmask=0x30;\n"); break; - case sz_long: comprintf("\tshll_l_rr(data,tmpcnt);\n" - "\thighmask=0x20;\n"); + case sz_long: comprintf("\tshll_l_rr(data,cnt);\n" + "\thighmask=0x20;\n"); break; default: abort(); } - comprintf("\ttest_l_ri(tmpcnt,highmask);\n" - "\tmov_l_ri(scratchie,0);\n"); - if (curi->size == sz_long) - comprintf("\tcmov_l_rr(data,scratchie,NATIVE_CC_NE);\n"); - else { - comprintf("\tcmov_l_rr(scratchie,data,NATIVE_CC_EQ);\n"); - switch(curi->size) { - case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break; - case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break; - default: abort(); - } + comprintf("test_l_ri(cnt,highmask);\n" + "mov_l_ri(scratchie,0);\n" + "cmov_l_rr(scratchie,data,4);\n"); + switch(curi->size) { + case sz_byte: comprintf("\tmov_b_rr(data,scratchie);\n");break; + case sz_word: comprintf("\tmov_w_rr(data,scratchie);\n");break; + case sz_long: comprintf("\tmov_l_rr(data,scratchie);\n");break; + default: abort(); } /* Result of shift is now in data. Now we need to determine the carry by shifting cdata one less */ comprintf("\tsub_l_ri(tmpcnt,1);\n"); - comprintf("\tshll_l_rr(cdata,tmpcnt);\n"); - comprintf("\ttest_l_ri(tmpcnt,highmask);\n"); - comprintf("\tforget_about(tmpcnt);\n"); - if (curi->size != sz_long) /* scratchie is still live for LSL.L */ - comprintf("\tmov_l_ri(scratchie,0);\n"); - comprintf("\tcmov_l_rr(cdata,scratchie,NATIVE_CC_NE);\n"); - comprintf("\tforget_about(scratchie);\n"); - /* And create the flags (preserve X flag if shift count is zero) */ - switch (curi->size) { - case sz_byte: comprintf("\tshrl_l_ri(cdata,7);\n"); break; - case sz_word: comprintf("\tshrl_l_ri(cdata,15);\n"); break; - case sz_long: comprintf("\tshrl_l_ri(cdata,31);\n"); break; + switch(curi->size) { + case sz_byte: comprintf("\tshll_b_rr(cdata,tmpcnt);\n");break; + case sz_word: comprintf("\tshll_w_rr(cdata,tmpcnt);\n");break; + case sz_long: comprintf("\tshll_l_rr(cdata,tmpcnt);\n");break; + default: abort(); } - comprintf("\ttest_l_ri(cnt,63);\n" - "\tcmov_l_rr(FLAGX,cdata,NATIVE_CC_NE);\n"); + comprintf("test_l_ri(tmpcnt,highmask);\n" + "mov_l_ri(scratchie,0);\n" + "cmov_l_rr(cdata,scratchie,5);\n"); + /* And create the flags */ comprintf("\tstart_needflags();\n"); comprintf("\tif (needed_flags & FLAG_ZNV)\n"); switch(curi->size) { - case sz_byte: comprintf("\t test_b_rr(data,data);\n"); break; - case sz_word: comprintf("\t test_w_rr(data,data);\n"); break; - case sz_long: comprintf("\t test_l_rr(data,data);\n"); break; + case sz_byte: comprintf("\t test_b_rr(data,data);\n"); + comprintf("\t bt_l_ri(cdata,7);\n"); break; + case sz_word: comprintf("\t test_w_rr(data,data);\n"); + comprintf("\t bt_l_ri(cdata,15);\n"); break; + case sz_long: comprintf("\t test_l_rr(data,data);\n"); + comprintf("\t bt_l_ri(cdata,31);\n"); break; } - comprintf("\t bt_l_ri(cdata,0);\n"); comprintf("\t live_flags();\n"); comprintf("\t end_needflags();\n"); + comprintf("\t duplicate_carry();\n"); comprintf("if (!(needed_flags & FLAG_CZNV)) dont_care_flags();\n"); genastore ("data", curi->dmode, "dstreg", curi->size, "data"); } @@ -2558,13 +2544,13 @@ gen_opcode (unsigned long int opcode) comprintf("\tint highmask;\n"); switch(curi->size) { case sz_byte: comprintf("\tshll_b_rr(data,cnt);\n" - "\thighmask=0x38;\n"); + "\thighmask=0x38;\n"); break; case sz_word: comprintf("\tshll_w_rr(data,cnt);\n" - "\thighmask=0x30;\n"); + "\thighmask=0x30;\n"); break; case sz_long: comprintf("\tshll_l_rr(data,cnt);\n" - "\thighmask=0x20;\n"); + "\thighmask=0x20;\n"); break; default: abort(); } @@ -2613,7 +2599,6 @@ gen_opcode (unsigned long int opcode) } break; - case i_ROL: mayfail; if (curi->smode==Dreg) { diff --git a/include/memory.h b/include/memory.h index 737994f9..9b3e72a8 100755 --- a/include/memory.h +++ b/include/memory.h @@ -68,7 +68,7 @@ extern int uae_boot_rom, uae_boot_rom_size; extern uae_u8* baseaddr[]; -enum { ABFLAG_UNK = 0, ABFLAG_RAM, ABFLAG_ROM, ABFLAG_ROMIN, ABFLAG_IO, ABFLAG_NONE }; +enum { ABFLAG_UNK = 0, ABFLAG_RAM = 1, ABFLAG_ROM = 2, ABFLAG_ROMIN = 4, ABFLAG_IO = 8, ABFLAG_NONE = 16, ABFLAG_SAFE = 32 }; typedef struct { /* These ones should be self-explanatory... */ mem_get_func lget, wget, bget; diff --git a/memory.c b/memory.c index 250f7cdb..ca896816 100755 --- a/memory.c +++ b/memory.c @@ -805,7 +805,7 @@ __inline__ void byteput (uaecptr addr, uae_u32 b) int addr_valid(char *txt, uaecptr addr, uae_u32 len) { addrbank *ab = &get_mem_bank(addr); - if (ab == 0 || ab->flags != ABFLAG_RAM || addr < 0x100 || len < 0 || len > 16777215 || !valid_address(addr, len)) { + if (ab == 0 || !(ab->flags & ABFLAG_RAM) || addr < 0x100 || len < 0 || len > 16777215 || !valid_address(addr, len)) { write_log("corrupt %s pointer %x (%d) detected!\n", txt, addr, len); return 0; } @@ -950,14 +950,6 @@ static int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size) #ifdef JIT special_mem |= S_READ; #endif - if (currprefs.illegal_mem) { - if (illegal_count < MAX_ILG || MAX_ILG < 0) { - if (MAX_ILG >= 0) - illegal_count++; - write_log ("Illegal check at %08lx PC=%x\n", addr, M68K_GETPC); - } - } - return 0; } @@ -1712,7 +1704,7 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr a) write_log ("%08.8X ", i >= 5 ? a3 : a2); for (j = 0; j < 16; j += 2) { write_log (" %04.4X", get_word (i >= 5 ? a3 : a2)); - if (i >= 5) a3 +=2; else a2 += 2; + if (i >= 5) a3 += 2; else a2 += 2; } write_log ("\n"); } @@ -1803,7 +1795,7 @@ addrbank kickram_bank = { kickmem_lget, kickmem_wget, kickmem_bget, kickmem2_lput, kickmem2_wput, kickmem2_bput, kickmem_xlate, kickmem_check, NULL, "Kickstart Shadow RAM", - kickmem_lget, kickmem_wget, ABFLAG_UNK + kickmem_lget, kickmem_wget, ABFLAG_UNK | ABFLAG_SAFE }; addrbank extendedkickmem_bank = { diff --git a/missing.c b/missing.c index 429dde8c..47ba7f84 100755 --- a/missing.c +++ b/missing.c @@ -26,18 +26,12 @@ char *my_strdup (const char *s) void *xmalloc (size_t n) { void *a = malloc (n); - if (a == NULL) { - abort (); - } return a; } void *xcalloc (size_t n, size_t size) { void *a = calloc (n, size); - if (a == NULL) { - abort (); - } return a; } diff --git a/od-win32/mman.c b/od-win32/mman.c index cfa5bcc8..ae654525 100755 --- a/od-win32/mman.c +++ b/od-win32/mman.c @@ -177,7 +177,7 @@ void mapped_free(uae_u8 *mem) { shmpiece *x = shm_start; - if (!p96mode && mem == p96fakeram) { + if (mem == filesysory || (!p96mode && mem == p96fakeram)) { xfree (p96fakeram); p96fakeram = NULL; while(x) { @@ -315,12 +315,7 @@ void *shmat(int shmid, void *shmaddr, int shmflg) size+=32; } if(!strcmp(shmids[shmid].name,"filesys")) { - result=natmem_offset + 0x10000; - shmids[shmid].attached=result; - return result; - } - if(!strcmp(shmids[shmid].name,"arcadia")) { - result=natmem_offset + 0x10000; + result = xmalloc (size); shmids[shmid].attached=result; return result; } diff --git a/od-win32/win32.h b/od-win32/win32.h index a81a8fd9..515f4416 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 10 +#define WINUAEBETA 11 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2007, 7, 19) +#define WINUAEDATE MAKEBD(2007, 7, 20) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 5df4887f..bd7c449e 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,15 @@ +Beta 11: + +- autoconfig memory banks do not show ****'s in debugger anymore +- filesystem not initializing if JIT was enabled and no other + autoconfig expansions enabled (ancient bug..) +- do not crash if CD32 is selected in advanced chipset without + extended ROM +- fixes and updates to illegal address logger +- "faster RTG" "immediate copper" emulation was very broken +- reverted JIT LSL/LSR/ASR change, merge error most likely, later.. + Beta 10: - Arcadia emulation crash fixed