{
if (valid_address(addr, size, 0))
return;
- wprintf(_T("Trying to store invalid memory address %08x!?\n"), addr);
+ wprintf(_T(" Trying to store invalid memory address %08x!?\n"), addr);
abort();
}
if (!out_of_test_space && !noaccesshistory && !cpu_bus_error_fake) {
previoussame(addr, sz_byte);
if (ahcnt >= MAX_ACCESSHIST) {
- wprintf(_T("ahist overflow!"));
+ wprintf(_T(" ahist overflow!"));
abort();
}
struct accesshistory *ah = &ahist[ahcnt++];
if (!out_of_test_space && !noaccesshistory && !cpu_bus_error_fake) {
previoussame(addr, sz_word);
if (ahcnt >= MAX_ACCESSHIST) {
- wprintf(_T("ahist overflow!"));
+ wprintf(_T(" ahist overflow!"));
abort();
}
struct accesshistory *ah = &ahist[ahcnt++];
if (!out_of_test_space && !noaccesshistory && !cpu_bus_error_fake) {
previoussame(addr, sz_long);
if (ahcnt >= MAX_ACCESSHIST) {
- wprintf(_T("ahist overflow!"));
+ wprintf(_T(" ahist overflow!"));
abort();
}
struct accesshistory *ah = &ahist[ahcnt++];
}
noaccesshistory = 0;
if (out_of_test_space) {
- wprintf(_T("undo_memory out of test space fault!?\n"));
+ wprintf(_T(" undo_memory out of test space fault!?\n"));
abort();
}
}
if (!len)
return dst;
if (len > 32) {
- wprintf(_T("too long byte count!\n"));
+ wprintf(_T(" too long byte count!\n"));
abort();
}
uaecptr oldstart = start;
static uae_u32 generate_stack_return(int cnt)
{
- uae_u32 v = rand32();
- switch (cnt & 3)
- {
- case 0:
- case 3:
- v = opcode_memory_start + 128;
- break;
- case 1:
- v &= 0xffff;
- if (test_low_memory_start == 0xffffffff)
- v |= 0x8000;
- if (test_high_memory_start == 0xffffffff)
- v &= 0x7fff;
- break;
- case 2:
- v = opcode_memory_start + (uae_s16)v;
- break;
+ uae_u32 v;
+ if (target_ea[0] != 0xffffffff) {
+ v = target_ea[0];
+ } else {
+ v = rand32();
+ switch (cnt & 3)
+ {
+ case 0:
+ case 3:
+ v = opcode_memory_start + 128;
+ break;
+ case 1:
+ v &= 0xffff;
+ if (test_low_memory_start == 0xffffffff)
+ v |= 0x8000;
+ if (test_high_memory_start == 0xffffffff)
+ v &= 0x7fff;
+ break;
+ case 2:
+ v = opcode_memory_start + (uae_s16)v;
+ break;
+ }
+ if (!feature_exception3_instruction)
+ v &= ~1;
}
- if (!feature_exception3_instruction)
- v &= ~1;
return v;
}
v = generate_stack_return(imm_special);
put_long_test(addr, v);
if (out_of_test_space) {
- wprintf(_T("handle_specials out of bounds access!?"));
+ wprintf(_T(" handle_specials out of bounds access!?"));
abort();
}
}
{
uae_u16 opw1 = (opcode_memory[2] << 8) | (opcode_memory[3] << 0);
uae_u16 opw2 = (opcode_memory[4] << 8) | (opcode_memory[5] << 0);
- if (opc == 0x6200
- //&& opw1 == 0xffff
+ if (opc == 0x4e72
+ && opw1 == 0xb000
//&& opw2 == 0xf78c
)
printf("");
(*cpufunctbl[opc])(opc);
- if (out_of_test_space) {
+ if (out_of_test_space || cpu_stopped) {
break;
}
if (!valid_address(regs.pc, 2, 0))
break;
- if (targetpc != 0xffffffff && (regs.pc + 2 == targetpc || regs.pc + 2 == endpc)) {
- // trace after jumping to branch target
- // and opcode was NOP
+ if (!feature_loop_mode) {
+ // trace after NOP
if (SPCFLAG_DOTRACE) {
+ if (trace_store_pc != 0xffffffff) {
+ wprintf(_T(" Stand-alone trace detected twice!\n"));
+ abort();
+ }
+ MakeSR();
trace_store_pc = regs.pc;
trace_store_sr = regs.sr;
SPCFLAG_DOTRACE = 0;
+ // STOP can only end with exception, fake prefetch here.
+ if (dp->mnemo == i_STOP) {
+ regs.ir = get_word_test(regs.pc + 0);
+ regs.irc = get_word_test(regs.pc + 2);
+ }
}
opc = regs.ir;
continue;
}
- if (SPCFLAG_DOTRACE) {
- wprintf(_T("Trace not supported in loop mode\n"));
- abort();
- }
-
- if (cpu_lvl < 2) {
- opc = get_word_test_prefetch(2);
- } else {
- opc = get_word_test_prefetch(0);
- }
-
cnt--;
if (!feature_loop_mode && !multi_mode && opc != 0x4e71) {
exception_stack_frame_size = 0x08;
break;
default:
- wprintf(_T("Unknown frame %04x!\n"), frame);
+ wprintf(_T(" Unknown frame %04x!\n"), frame);
abort();
}
}
int isconstant_dst = 0;
int did_out_of_bounds = 0;
uae_u8 *prev_dst2 = dst;
+ int prev_test_count = test_count;
+ int prev_subtest_count = subtest_count;
uae_u32 branch_target_swap_address = 0;
int branch_target_swap_mode = 0;
}
// requested target address but no EA? skip
- if (target_address != 0xffffffff) {
+ if (target_address != 0xffffffff && !isbranchinst(dp)) {
if (srcea != target_address && dstea != target_address) {
memcpy(opcode_memory, oldbytes, sizeof(oldbytes));
continue;
}
if (out_of_test_space) {
- wprintf(_T("Setting up test instruction generated out of bounds error!?\n"));
+ wprintf(_T( "Setting up test instruction generated out of bounds error!?\n"));
abort();
}
}
if ((dflags & 1) && target_ea[0] != 0xffffffff && srcaddr != 0xffffffff && srcaddr != target_ea[0]) {
- wprintf(_T("\nSource address mismatch %08x <> %08x\n"), target_ea[0], srcaddr);
+ wprintf(_T(" Source address mismatch %08x <> %08x\n"), target_ea[0], srcaddr);
abort();
}
if ((dflags & 2) && target_ea[1] != 0xffffffff && dstaddr != target_ea[1]) {
- wprintf(_T("\nDestination address mismatch %08x <> %08x\n"), target_ea[1], dstaddr);
+ wprintf(_T(" Destination address mismatch %08x <> %08x\n"), target_ea[1], dstaddr);
abort();
}
#if 0
// can't test because dp may be empty if instruction is invalid
if (nextpc != pc - 2) {
- wprintf(_T("Disassembler/generator instruction length mismatch!\n"));
+ wprintf(_T(" Disassembler/generator instruction length mismatch!\n"));
abort();
}
#endif
if (regs.sr & 0x2000)
prev_s_cnt++;
- if (subtest_count == 220)
+ if (subtest_count == 2052)
printf("");
execute_ins(opc, pc - endopcodesize, branch_target_pc, dp);
// validate branch instructions
if (isbranchinst(dp)) {
if ((regs.pc != branch_target_pc && regs.pc != pc - endopcodesize) || ((pcaddr[0] != 0x4a && pcaddr[1] != 0xfc) && (pcaddr[0] != 0x4e && pcaddr[1] != 0x71))) {
- wprintf(_T("Branch instruction target fault\n"));
+ wprintf(_T(" Branch instruction target fault\n"));
abort();
}
}
noaccesshistory++;
put_long_test(pc - 4, originalendopcode);
- if (branch_target_data != 0xffffff) {
+ if (branch_target_swap_mode) {
if (branch_target_swap_address == 1) {
put_long_test(branch_target_swap_address, branch_target_data_original);
} else if (branch_target_swap_mode == 2) {
MakeSR();
- if (SPCFLAG_DOTRACE && trace_store_pc != 0xffffffff) {
- wprintf(_T("Trace and stored trace at the same time!\n"));
+ if (SPCFLAG_DOTRACE && test_exception_extra) {
+ wprintf(_T(" Trace and stored trace at the same time!\n"));
abort();
}
dst = prev_dst2;
//*dst++ = CT_END_INIT;
memcpy(opcode_memory, oldbytes, sizeof(oldbytes));
+ test_count = prev_test_count;
+ subtest_count = prev_subtest_count;
} else {
full_format_cnt++;
}
int offset = 0;
int lines = 0;
while (lines++ < 10) {
+ int v = 0;
if (!is_valid_test_addr((uae_u32)p) || !is_valid_test_addr((uae_u32)p + 1))
break;
tmpbuffer[0] = 0;
- int v = disasm_instr(code + offset, tmpbuffer);
- for (int i = 0; i < v; i++) {
- uae_u16 v = (p[i * 2 + 0] << 8) | (p[i * 2 + 1]);
- sprintf(outbp, "%s %08lx %04x", i ? " " : (lines == 0 ? "\t\t" : "\t"), &p[i * 2], v);
+ if (!(((uae_u32)code) & 1)) {
+ v = disasm_instr(code + offset, tmpbuffer);
+ for (int i = 0; i < v; i++) {
+ uae_u16 v = (p[i * 2 + 0] << 8) | (p[i * 2 + 1]);
+ sprintf(outbp, "%s %08lx %04x", i ? " " : (lines == 0 ? "\t\t" : "\t"), &p[i * 2], v);
+ outbp += strlen(outbp);
+ }
+ sprintf(outbp, " %s\n", tmpbuffer);
+ outbp += strlen(outbp);
+ if (v <= 0 || code[offset] == 0x4afc)
+ break;
+ while (v > 0) {
+ offset++;
+ p += 2;
+ v--;
+ }
+ } else {
+ sprintf(outbp, "\t %08lx %02x\n", code, *((uae_u8*)code));
+ code = (uae_u16*)(((uae_u32)code) + 1);
+ p++;
outbp += strlen(outbp);
- }
- sprintf(outbp, " %s\n", tmpbuffer);
- outbp += strlen(outbp);
- if (v <= 0 || code[offset] == 0x4afc)
- break;
- while (v > 0) {
- offset++;
- p += 2;
- v--;
}
if (v < 0)
break;
}
uae_u16 *code = (uae_u16*)opcode_memory;
- if (code[0] == 0x4e73 || code[0] == 0x4e74 || code[0] == 0x4e75) {
+ if (code[0] == 0x4e73 || code[0] == 0x4e74 || code[0] == 0x4e75 || code[0] == 0x4e77) {
addinfo_bytes("P", stackaddr, stackaddr_ptr, -SIZE_STORED_ADDRESS_OFFSET, SIZE_STORED_ADDRESS);
addinfo_bytes(" ", (uae_u8 *)stackaddr_ptr - SIZE_STORED_ADDRESS_OFFSET, stackaddr_ptr, -SIZE_STORED_ADDRESS_OFFSET, SIZE_STORED_ADDRESS);
}
v = opcode_memory_addr;
p = restore_rel_ordered(p, &v);
if (vsr != sr) {
- sprintf(outbp, "Trace (non-stacked) SR mismatch: %04x != %04x\n", sr, vsr);
+ sprintf(outbp, "Trace (non-stacked) SR mismatch: %04x != %04x (PC=%08lx)\n", sr, vsr, v);
outbp += strlen(outbp);
errors = 1;
*experr = 1;
}
if (v != ret) {
- sprintf(outbp, "Trace (non-stacked) PC mismatch: %08lx != %08lx\n", ret, v);
+ sprintf(outbp, "Trace (non-stacked) PC mismatch: %08lx != %08lx (SR=%04x)\n", ret, v, vsr);
outbp += strlen(outbp);
errors = 1;
*experr = 1;
sr_changed = 0;
last_registers.sr = val;
} else if (mode == CT_PC) {
- volatile uae_u16 *c = (volatile uae_u16 *)0x100;
- *c = 0x1234;
uae_u32 val = last_registers.pc;
p = restore_rel(p, &val, 0);
pc_changed = 0;
p = validate_test(p, ignore_errors, ignore_sr);
+ testcnt++;
if (super)
supercnt++;
last_pc = last_registers.pc;
last_fpiar = last_registers.fpiar;
-
}
- testcnt++;
-
if (testexit()) {
end_test();
printf("\nAborted (%ld)\n", testcnt);