static uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr) { #ifdef JIT if (addr >= 0x00F10000 && addr <= 0x00F7FFFF) { if (!warned_JIT_0xF10000) { warned_JIT_0xF10000 = 1; enforcer_display_hit (_T("LONG READ from"), m68k_getpc (), addr); } return 0; } #endif enforcer_display_hit (_T("WORD READ from"), m68k_getpc (), addr); if (enforcermode & 1) { set_special (SPCFLAG_TRAP); return 0; } return 0xbadf; }
static void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w) { uae_u16 *m; addr -= chipmem_start_addr & chipmem_bank.mask; addr &= chipmem_bank.mask; m = (uae_u16 *)(chipmem_bank.baseaddr + addr); if (ISILLEGAL_WORD (addr)) { enforcer_display_hit (_T("WORD WRITE to"), m68k_getpc (), addr); if (enforcermode & 1) set_special (SPCFLAG_TRAP); } if (ISEXEC (addr) || ISEXEC (addr + 1)) return; do_put_mem_word (m, w); }
static void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w) { uae_u16 *m; addr -= chipmem_start & chipmem_mask; addr &= chipmem_mask; m = (uae_u16 *)(chipmemory + addr); if (ISILLEGAL_WORD (addr)) { enforcer_display_hit (_T("WORD WRITE to"),(uae_u32)(regs.pc_p - NMEM_OFFSET),addr); if (enforcermode & 1) set_special (SPCFLAG_TRAP); } if (ISEXEC (addr) || ISEXEC (addr + 1)) return; do_put_mem_word (m, w); }
static void test2ui (int (*testfunc)(mpfr_ptr, mpfr_srcptr, unsigned long int, mp_rnd_t), char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref2; unsigned int ref3; mpfr_t res1; int i; #ifdef DEBUG printf("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref2, prec); mpfr_init2 (res1, prec); /* ref2 can be NaN, +Inf, -Inf, +0, -0 or any number ref3 can be 0 or any number */ for (i=0; i<SPECIAL_MAX*2; i++) { set_special (ref2, i%SPECIAL_MAX); ref3 = i/SPECIAL_MAX == 0 ? 0 : randlimb (); /* reference call: foo(a, b, c) */ testfunc (ref1, ref2, ref3, rnd); /* foo(a, a, c) */ mpfr_set (res1, ref2, rnd); /* exact operation */ testfunc (res1, res1, ref3, rnd); if (mpfr_compare (res1, ref1)) { printf ("Error for %s(a, a, c) for c=%u\n", foo, ref3); DISP2("a=",ref2); printf ("expected "); mpfr_print_binary (ref1); puts (""); printf ("got "); mpfr_print_binary (res1); puts (""); exit (1); } } mpfr_clear (ref1); mpfr_clear (ref2); mpfr_clear (res1); }
static void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l) { uae_u32 *m; addr -= chipmem_start_addr & chipmem_bank.mask; addr &= chipmem_bank.mask; m = (uae_u32 *)(chipmem_bank.baseaddr + addr); if (ISILLEGAL_LONG (addr)) { enforcer_display_hit (_T("LONG WRITE to"), m68k_getpc (), addr); if (enforcermode & 1) if (addr != 0x100) set_special (SPCFLAG_TRAP); } if (ISEXEC (addr) || ISEXEC (addr + 1) || ISEXEC (addr + 2) || ISEXEC (addr + 3)) return; do_put_mem_long (m, l); }
static void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l) { uae_u32 *m; addr -= chipmem_start & chipmem_mask; addr &= chipmem_mask; m = (uae_u32 *)(chipmemory + addr); if (ISILLEGAL_LONG (addr)) { enforcer_display_hit (_T("LONG WRITE to"),(uae_u32)(regs.pc_p - NMEM_OFFSET),addr); if (enforcermode & 1) if (addr != 0x100) set_special (SPCFLAG_TRAP); } if (ISEXEC (addr) || ISEXEC (addr + 1) || ISEXEC (addr + 2) || ISEXEC (addr + 3)) return; do_put_mem_long (m, l); }
static void testui2 (int (*testfunc)(mpfr_ptr, unsigned long int, mpfr_srcptr, mpfr_rnd_t), const char *foo, mpfr_prec_t prec, mpfr_rnd_t rnd) { mpfr_t ref1, ref3; unsigned int ref2; mpfr_t res1; int i; #ifdef DEBUG printf("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref3, prec); mpfr_init2 (res1, prec); for (i=0; i<SPECIAL_MAX*2; i++) { set_special (ref3, i%SPECIAL_MAX); ref2 = i/SPECIAL_MAX==0 ? 0 : randlimb (); /* reference call: foo(a, b, c) */ testfunc (ref1, ref2, ref3, rnd); /* foo(a, b, a) */ mpfr_set (res1, ref3, rnd); /* exact operation */ testfunc (res1, ref2, res1, rnd); if (mpfr_compare (res1, ref1)) { printf ("Error for %s(a, b, a) for b=%u \n", foo, ref2); DISP2("a=", ref3); DISP("expected", ref1); DISP2(", got ", res1); exit (1); } } mpfr_clear (ref1); mpfr_clear (ref3); mpfr_clear (res1); }
/* foo(mpfr_ptr, mpfr_srcptr) */ static void test2a (int (*testfunc)(mpfr_ptr, mpfr_srcptr), char *foo, mp_prec_t prec) { mpfr_t ref1, ref2; mpfr_t res1; int i; #ifdef DEBUG printf ("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref2, prec); mpfr_init2 (res1, prec); for (i=0; i<SPECIAL_MAX; i++) { set_special (ref2, i); /* reference call: foo(a, b) */ testfunc (ref1, ref2); /* foo(a, a) */ mpfr_set (res1, ref2, GMP_RNDN); /* exact operation */ testfunc (res1, res1); if (mpfr_compare (res1, ref1)) { printf ("Error for %s(a, a) for ", foo); DISP2("a=",ref2); DISP("expected", ref1); DISP2(", got ", res1); exit (1); } } mpfr_clear (ref1); mpfr_clear (ref2); mpfr_clear (res1); }
static void test3 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t), char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref1, ref2, ref3; mpfr_t res1; int i; #ifdef DEBUG printf("checking %s\n", foo); #endif mpfr_init2 (ref1, prec); mpfr_init2 (ref2, prec); mpfr_init2 (ref3, prec); mpfr_init2 (res1, prec); /* for each variable, consider each of the following 6 possibilities: NaN, +Infinity, -Infinity, +0, -0 or a random number */ for (i=0; i < SPECIAL_MAX*SPECIAL_MAX ; i++) { set_special (ref2, i%SPECIAL_MAX); set_special (ref3, i/SPECIAL_MAX); /* reference call: foo(a, b, c) */ testfunc (ref1, ref2, ref3, rnd); /* foo(a, a, c) */ mpfr_set (res1, ref2, rnd); /* exact operation */ testfunc (res1, res1, ref3, rnd); if (mpfr_compare (res1, ref1)) { printf ("Error for %s(a, a, c) for ", foo); DISP("a=",ref2); DISP2(", c=",ref3); printf ("expected "); mpfr_print_binary (ref1); puts (""); printf ("got "); mpfr_print_binary (res1); puts (""); exit (1); } /* foo(a, b, a) */ mpfr_set (res1, ref3, rnd); testfunc (res1, ref2, res1, rnd); if (mpfr_compare (res1, ref1)) { printf ("Error for %s(a, b, a) for ", foo); DISP("b=",ref2); DISP2(", a=", ref3); DISP("expected ", ref1); DISP2(", got ",res1); exit (1); } /* foo(a, a, a) */ mpfr_set (ref3, ref2, rnd); testfunc (ref1, ref2, ref3, rnd); mpfr_set (res1, ref2, rnd); testfunc (res1, res1, res1, rnd); if (mpfr_compare (res1, ref1)) { printf ("Error for %s(a, a, a) for ", foo); DISP2("a=",ref2); DISP("expected ", ref1); DISP2(", got", res1); exit (1); } } mpfr_clear (ref1); mpfr_clear (ref2); mpfr_clear (ref3); mpfr_clear (res1); }
static void test4 (int (*testfunc)(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t), char *foo, mp_prec_t prec, mp_rnd_t rnd) { mpfr_t ref, op1, op2, op3; mpfr_t res; int i, j, k; #ifdef DEBUG printf("checking %s\n", foo); #endif mpfr_init2 (ref, prec); mpfr_init2 (op1, prec); mpfr_init2 (op2, prec); mpfr_init2 (op3, prec); mpfr_init2 (res, prec); /* for each variable, consider each of the following 6 possibilities: NaN, +Infinity, -Infinity, +0, -0 or a random number */ for (i=0; i<SPECIAL_MAX; i++) { set_special (op1, i); for (j=0; j<SPECIAL_MAX; j++) { set_special (op2, j); for (k=0; k<SPECIAL_MAX; k++) { set_special (op3, k); /* reference call: foo(s, a, b, c) */ testfunc (ref, op1, op2, op3, rnd); /* foo(a, a, b, c) */ mpfr_set (res, op1, rnd); /* exact operation */ testfunc (res, res, op2, op3, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); DISP("expected ", ref); DISP2(", got", res); exit (1); } /* foo(b, a, b, c) */ mpfr_set (res, op2, rnd); testfunc (res, op1, res, op3, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); DISP("expected ", ref); DISP2(", got", res); exit (1); } /* foo(c, a, b, c) */ mpfr_set (res, op3, rnd); testfunc (res, op1, op2, res, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", b=", op2); DISP2(", c=", op3); DISP("expected ", ref); DISP2(", got", res); exit (1); } /* foo(a, a, a,c) */ testfunc (ref, op1, op1, op3, rnd); mpfr_set (res, op1, rnd); testfunc (res, res, res, op3, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); DISP("expected ", ref); DISP2(", got", res); exit (1); } /* foo(a, a, b,a) */ testfunc (ref, op1, op2, op1, rnd); mpfr_set (res, op1, rnd); testfunc (res, res, op2, res, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); DISP("expected ", ref); DISP2(", got", res); exit (1); } /* foo(b, a, b, b) */ testfunc (ref, op1, op2, op2, rnd); mpfr_set (res, op2, rnd); testfunc (res, op1, res, res, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, b, c) for ", foo); DISP("a=", op1); DISP(", a=", op2); DISP2(", c=", op3); DISP("expected ", ref); DISP2(", got", res); exit (1); } /* foo (a, a, a, a) */ testfunc (ref, op1, op1, op1 ,rnd); mpfr_set (res, op1, rnd); testfunc (res, res, res, res, rnd); if (mpfr_compare (res, ref)) { printf ("Error for %s(a, a, a, a) for ", foo); DISP2("a=", op1); DISP("expected ", ref); DISP2(", got", res); exit (1); } } } } mpfr_clear (ref); mpfr_clear (op1); mpfr_clear (op2); mpfr_clear (op3); mpfr_clear (res); }
static int do_specialties (int cycles) { if (mispcflags & SPCFLAG_COPPER) { #ifdef DEBUG_M68K dbg("do_specialties -> do_copper"); #endif do_copper (); } /*n_spcinsns++;*/ while ((mispcflags & SPCFLAG_BLTNASTY) && cycles > 0) { int c = blitnasty(); if (!c) { cycles -= 2 * CYCLE_UNIT; if (cycles < CYCLE_UNIT) cycles = 0; c = 1; } #ifdef DEBUG_M68K dbgf("do_specialties -> do_cycles BLTNASTY %i\n",c); #endif do_cycles(c * CYCLE_UNIT); if (mispcflags & SPCFLAG_COPPER) { #ifdef DEBUG_M68K dbg("do_specialties -> do_copper BLTNASTY"); #endif do_copper (); } } #ifdef DEBUG_M68K while (M68KCONTEXT.execinfo & 0x0080) { if (mispcflags & SPCFLAG_BRK) break; else if (M68KCONTEXT.execinfo & 0x0080) { int intr = intlev (); if (intr != -1 && intr > _68k_intmask) { M68KCONTEXT.execinfo &= 0xFF7F; break; } } dbg("CPU STOPPED !"); do_cycles(4 * CYCLE_UNIT); if (mispcflags & SPCFLAG_COPPER) { dbg("do_specialties -> do_copper STOPPED"); do_copper (); } } unset_special (SPCFLAG_STOP); #endif #if 0 // !defined(FAME_INTERRUPTS_SECURE_PATCH) && defined(FAME_INTERRUPTS_PATCH) if (uae4all_go_interrupt) { /*if (verb)*/ printf("uae4all_go_interrupt (s): %02x\n", uae4all_go_interrupt); M68KCONTEXT.interrupts[0]=uae4all_go_interrupt; M68KCONTEXT.execinfo&=0xFF67; uae4all_go_interrupt=0; m68k_irq_update(0); } #endif #ifdef SPECIAL_DEBUG_INTERRUPTS if ((mispcflags & SPCFLAG_DOINT)&&(!(mispcflags & SPCFLAG_INT))) { int intr = intlev (); #ifdef DEBUG_INTERRUPTS_EXTRA dbgf("DOINT : intr = %i, intmask=%i\n", intr, _68k_intmask); #endif unset_special (SPCFLAG_DOINT); if (intr != -1 && intr > _68k_intmask) { M68KCONTEXT.execinfo&=0xFF6F; m68k_raise_irq(intr,M68K_AUTOVECTORED_IRQ); // m68k_emulate(0); } } if (mispcflags & SPCFLAG_INT) { #ifdef DEBUG_INTERRUPTS_EXTRA dbg("ESTAMOS EN INT -> PASAMOS A DOINT"); #endif unset_special (SPCFLAG_INT); set_special (SPCFLAG_DOINT); } #endif if (mispcflags & SPCFLAG_BRK) { unset_special (SPCFLAG_BRK); return 1; } return 0; }