]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix handling of missing low or high memory.
authorToni Wilen <twilen@winuae.net>
Sat, 18 Jan 2020 12:20:51 +0000 (14:20 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 18 Jan 2020 12:20:51 +0000 (14:20 +0200)
cputest.cpp
cputest/main.c

index e8464a08a455fe8e0b205cffd9ab146973e55e25..f9e8283f8877365d947fa3688ff46120610019f3 100644 (file)
@@ -189,7 +189,7 @@ static bool valid_address(uaecptr addr, int size, int w)
 {
        addr &= addressing_mask;
        size--;
-       if (addr + size < low_memory_size) {
+       if (low_memory_size != 0xffffffff && addr + size < low_memory_size) {
                if (addr < test_low_memory_start || test_low_memory_start == 0xffffffff)
                        goto oob;
                // exception vectors needed during tests
@@ -202,7 +202,7 @@ static bool valid_address(uaecptr addr, int size, int w)
                low_memory_accessed = w ? -1 : 1;
                return 1;
        }
-       if (addr >= HIGH_MEMORY_START && addr <= HIGH_MEMORY_START + 0x7fff) {
+       if (high_memory_size != 0xffffffff && addr >= HIGH_MEMORY_START && addr <= HIGH_MEMORY_START + 0x7fff) {
                if (addr < test_high_memory_start || test_high_memory_start == 0xffffffff)
                        goto oob;
                if (addr + size >= test_high_memory_end)
@@ -270,9 +270,9 @@ static uae_u8 *get_addr(uaecptr addr, int size, int w)
        }
        addr &= addressing_mask;
        size--;
-       if (addr + size < low_memory_size) {
+       if (low_memory_size != 0xffffffff && addr + size < low_memory_size) {
                return low_memory + addr;
-       } else if (addr >= HIGH_MEMORY_START && addr <= HIGH_MEMORY_START + 0x7fff) {
+       } else if (high_memory_size != 0xffffffff && addr >= HIGH_MEMORY_START && addr <= HIGH_MEMORY_START + 0x7fff) {
                return high_memory + (addr - HIGH_MEMORY_START);
        } else if (addr >= test_memory_start && addr + size < test_memory_end + EXTRA_RESERVED_SPACE) {
                return test_memory + (addr - test_memory_start);
@@ -1322,8 +1322,10 @@ static void fill_memory_buffer(uae_u8 *p, int size)
 
 static void fill_memory(void)
 {
-       fill_memory_buffer(low_memory_temp, low_memory_size);
-       fill_memory_buffer(high_memory_temp, high_memory_size);
+       if (low_memory_temp)
+               fill_memory_buffer(low_memory_temp, low_memory_size);
+       if (high_memory_temp)
+               fill_memory_buffer(high_memory_temp, high_memory_size);
        fill_memory_buffer(test_memory_temp, test_memory_size);
 }
 
@@ -3282,8 +3284,12 @@ static void test_mnemo(const TCHAR *path, const TCHAR *mnemo, const TCHAR *ovrfi
 
        dst = storage_buffer;
 
-       memcpy(low_memory, low_memory_temp, low_memory_size);
-       memcpy(high_memory, high_memory_temp, high_memory_size);
+       if (low_memory) {
+               memcpy(low_memory, low_memory_temp, low_memory_size);
+       }
+       if (high_memory) {
+               memcpy(high_memory, high_memory_temp, high_memory_size);
+       }
        memcpy(test_memory, test_memory_temp, test_memory_size);
 
        memset(storage_buffer, 0xdd, 1000);
@@ -4861,10 +4867,14 @@ static int test(struct ini_data *ini, const TCHAR *sections, const TCHAR *testna
        if (low_memory_size < 0x8000)
                low_memory_size = 0x8000;
 
-       low_memory = (uae_u8 *)calloc(1, low_memory_size);
-       low_memory_temp = (uae_u8 *)calloc(1, low_memory_size);
-       high_memory = (uae_u8 *)calloc(1, high_memory_size);
-       high_memory_temp = (uae_u8 *)calloc(1, high_memory_size);
+       if (low_memory_size != 0xffffffff) {
+               low_memory = (uae_u8 *)calloc(1, low_memory_size);
+               low_memory_temp = (uae_u8 *)calloc(1, low_memory_size);
+       }
+       if (high_memory_size != 0xffffffff) {
+               high_memory = (uae_u8 *)calloc(1, high_memory_size);
+               high_memory_temp = (uae_u8 *)calloc(1, high_memory_size);
+       }
 
        fill_memory();
 
index 6b0aabaa1e1aa3a0d9dc8b3503046d24c48309db..751d958cd9c6824e2f8909257941a55b0caeff78 100644 (file)
@@ -394,10 +394,12 @@ static void start_test(void)
                                error_vectors[i - 2] = p[i];
                        }
                }
-               for (int i = 24; i < 24 + 8; i++) {
-                       p[i] = (uae_u32)(((uae_u32)&exceptiontable000) + (i - 2) * 2);
-                       if (exception_vectors) {
-                               p[i] = exception_vectors;
+               if (interrupttest) {
+                       for (int i = 24; i < 24 + 8; i++) {
+                               p[i] = (uae_u32)(((uae_u32)&exceptiontable000) + (i - 2) * 2);
+                               if (exception_vectors) {
+                                       p[i] = exception_vectors;
+                               }
                        }
                }
                for (int i = 32; i < 48; i++) {