]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
CPU tester write bus error automatic memory update.
authorToni Wilen <twilen@winuae.net>
Thu, 21 May 2020 06:48:22 +0000 (09:48 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 21 May 2020 06:48:22 +0000 (09:48 +0300)
cputest/amiga.S
cputest/asm.S
cputest/main.c

index 17f3b945bd1bde2bdb214018e7c76e827dabe3f0..2470430a40a5fad026044ad397864f6ab01fcb18 100644 (file)
@@ -70,7 +70,10 @@ _tosuper:
        move.l 4.w,a6
        jsr -0x78(a6) | Disable
        jsr -0x96(a6) | SuperState
+       tst.l 8+1*4(sp)
+       beq.s .keepdisplay
        move.w #0x0200,0xdff096
+.keepdisplay:
        move.w #0x2700,sr
        move.l (sp)+,a6
        rts
index 102a7cec45313d45564a1c2f31bba65586d5f9f4..b1e22947b3513b76e43ad06162a4af14877b58f0 100644 (file)
@@ -24,6 +24,7 @@
        .globl _cyclereg_address4
        .globl _cyclereg_address5
        .globl _cyclereg_address6
+       .globl _berrcopy
 
 | must match main.c
 S_DREG = 0
@@ -48,6 +49,42 @@ S_FPSR = S_FPCR+4
 S_FSAVE = S_FPSR+4
 S_NEXT = S_FSAVE+216
 
+
+       | src, dst, size, >68000
+_berrcopy:
+       movem.l d2-d4/a2-a4,-(sp)
+       movem.l 7*4+0*4(sp),a0-a1
+       move.l 7*4+2*4(sp),d0
+       sub.l a2,a2
+       tst.l 7*4+3*4(sp)
+       beq.s .novbrbc1
+       movec vbr,a2
+.novbrbc1:
+       addq.l #8,a2
+       lea .berrptr(pc),a4
+       move.l (a2),a3
+       move.l a4,(a2)
+.nextbc2:
+       move.w (a0)+,d1
+       move.w (a1),d2
+       cmp.w d1,d2
+       beq.s .bercopycont
+       move.l sp,a4
+       move.w d1,(a1)
+.berrptr:
+       move.l a4,sp
+.nextbc1:
+       cmp.w (a1),d1
+       bne.s .outbc
+.bercopycont:
+       addq.l #2,a1
+       subq.l #1,d0
+       bne.s .nextbc2
+.outbc:
+       move.l a3,(a2)
+       movem.l (sp)+,d2-d4/a2-a4
+       rts
+
 _callinflate:
        movem.l a4-a6,-(sp)
        movem.l 4+3*4(sp),a4-a6
index 35d93bf929afcfa3f47945bbd2c8af8a2e662919..665be6148d9bd65cbd1ade9d82b39919cb336bd7 100644 (file)
@@ -187,11 +187,11 @@ static void execute_test020(struct registers *regs)
 static void execute_testfpu(struct registers *regs)
 {
 }
-static uae_u32 tosuper(uae_u32 v)
+static uae_u32 tosuper(uae_u32 v, uae_u32 vv)
 {
        return 0;
 }
-static void touser(uae_u32 v)
+static void touser(uae_u32 v, uae_u32 vv)
 {
 }
 static uae_u32 exceptiontable000, exceptiontable010, exceptiontable020, exceptiontablefpu;
@@ -213,6 +213,9 @@ static void setcpu(uae_u32 v, uae_u32 *s, uae_u32 *d)
 static void flushcache(uae_u32 v)
 {
 }
+static void berrcopy(void *src, void *dst, uae_u32 size, uae_u32 hasvbr)
+{
+}
 static void *error_vector;
 #else
 
@@ -227,8 +230,8 @@ extern void execute_test000(struct registers*);
 extern void execute_test010(struct registers *);
 extern void execute_test020(struct registers *);
 extern void execute_testfpu(struct registers *);
-extern uae_u32 tosuper(uae_u32);
-extern void touser(uae_u32);
+extern uae_u32 tosuper(uae_u32, uae_u32);
+extern void touser(uae_u32, uae_u32);
 extern uae_u32 exceptiontable000, exceptiontable010, exceptiontable020, exceptiontablefpu;
 extern uae_u32 testexit(void);
 extern uae_u32 setvbr(uae_u32);
@@ -236,6 +239,7 @@ extern uae_u32 get_cpu_model(void);
 extern void setcpu(uae_u32, uae_u32*, uae_u32*);
 extern void flushcache(uae_u32);
 extern void *error_vector;
+extern void berrcopy(void*, void*, uae_u32, uae_u32);
 
 #endif
 static uae_u32 exceptiontableinuse;
@@ -394,7 +398,7 @@ static void start_test(void)
 
        test_active = 1;
 
-       enable_data = tosuper(0);
+       enable_data = tosuper(0, 1);
 
 #ifdef AMIGA
        main_intena = *((volatile uae_u16*)0xdff01c);
@@ -495,7 +499,7 @@ static void end_test(void)
        *((volatile uae_u16*)0xdff09a) = main_intena | 0x8000;
 #endif
 
-       touser(enable_data);
+       touser(enable_data, 1);
 }
 
 static int readdata(uae_u8 *p, int size, FILE *f, uae_u8 *unpack, int *offsetp)
@@ -698,23 +702,33 @@ static uae_u8 *load_file(const char *path, const char *file, uae_u8 *p, int *siz
                                }
                                readdata(tmp, size2, f, unpack, &unpackoffset);
                                if (memcmp(tmp, p, size2)) {
-                                       int ch = set_berr(0, 1);
-                                       if (ch == 27) {
-                                               exit(0);
-                                       } else if (ch == 32) {
-                                               seekdata(size2, f, unpack, &unpackoffset);
-                                               p += size2;
-                                               size -= size2;
-                                       } else {
-                                               memcpy(p, tmp, size2);
-                                               p += size2;
-                                               size -= size2;
-                                               ch = set_berr(2, 1);
+                                       uae_u32 t = tosuper(0, 0);
+                                       berrcopy(tmp, p, size2 / 2, cpu_lvl > 0);
+                                       touser(t, 0);
+                                       if (memcmp(tmp, p, size2)) {
+                                               // data was still different, do it manually.
+                                               int ch = set_berr(0, 1);
                                                if (ch == 27) {
                                                        exit(0);
+                                               } else if (ch == 32) {
+                                                       seekdata(size2, f, unpack, &unpackoffset);
+                                                       p += size2;
+                                                       size -= size2;
+                                               } else {
+                                                       memcpy(p, tmp, size2);
+                                                       p += size2;
+                                                       size -= size2;
+                                                       ch = set_berr(2, 1);
+                                                       if (ch == 27) {
+                                                               exit(0);
+                                                       }
                                                }
+                                       } else {
+                                               p += size2;
+                                               size -= size2;
                                        }
                                } else {
+                                       // data was identical
                                        printf("Write-only bus error mode, data already correct. Skipping read.\n");
                                        p += size2;
                                        size -= size2;