File: hatari-vme-access.patch

package info (click to toggle)
hatari 2.3.1%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 13,812 kB
  • sloc: ansic: 168,918; python: 5,756; objc: 1,913; asm: 1,634; sh: 1,627; javascript: 145; makefile: 101; xml: 32
file content (88 lines) | stat: -rw-r--r-- 3,860 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From 27033e3b200f6e8ac32347fc5ccc0d6f4ec1b67a Mon Sep 17 00:00:00 2001
From: Eero Tamminen <oak@helsinkinet.fi>
Date: Wed, 1 Apr 2020 15:44:48 +0300
Subject: [PATCH] No SCU & VME support -> add option for their IO-register
 access

With SCU/VME IO-registers access prevented:
- Linux boots with MegaSTE & TT emulation
  (when using IDE and 030 or higher CPU model)
- TOS v2 / TOS v3 don't work fully on MegaSTE / TT

With SCU/VME IO-register access allowed:
- Linux boot under MegaSTE & TT emulation fails due to register mask &
  interrupt handling not working (as Hatari doesn't emulate SCU/VME)
- TOS v2 / TOS v3 work fully on MegaSTE / TT

---
 CMakeLists.txt   | 2 ++
 src/ioMem.c      | 9 ++++++++-
 src/ioMemTabTT.c | 7 +++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a62a74ca..4e93c2eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,6 +57,8 @@ set(ENABLE_SMALL_MEM 0
     CACHE BOOL "Enable to use less memory - at the expense of emulation speed")
 set(ENABLE_WINUAE_CPU 1
     CACHE BOOL "Enable WinUAE CPU core")
+set(ENABLE_VME_ACCESS 1
+    CACHE BOOL "Allow access to non-implemented SCU/VME registers (= TOS MegaSTE detection)")
 
 # Run-time checks with GCC / LLVM (Clang) AddressSanitizer:
 # - stack protection
diff --git a/src/ioMem.c b/src/ioMem.c
index b64624e2..21ca0c70 100644
--- a/src/ioMem.c
+++ b/src/ioMem.c
@@ -202,12 +202,19 @@ static void IoMem_FixAccessForMegaSTE(void)
 	pInterceptReadTable[0xff8e23 - 0xff8000] = IoMem_VoidRead;
 	pInterceptWriteTable[0xff8e23 - 0xff8000] = IoMem_VoidWrite;
 
-	/* VME bus - we don't support it yet, but TOS uses FF8E09 to detect the Mega-STE */
+	/* Set ENABLE_VME_ACCESS unless you use m68k Linux.
+	 *
+	 * Linux tries to use SCU/VME interrupts unless these give errors,
+	 * but we don't support it yet.  However, TOS uses FF8E09 to detect
+	 * the Mega-STE.
+	 */
+#if ENABLE_VME_ACCESS
 	for (addr = 0xff8e01; addr <= 0xff8e0f; addr += 2)
 	{
 		pInterceptReadTable[addr - 0xff8000] = IoMem_ReadWithoutInterception;
 		pInterceptWriteTable[addr - 0xff8000] = IoMem_WriteWithoutInterception;
 	}
+#endif
 
 	/* The Mega-STE has a Z85C30 SCC serial port, too: */
 	for (addr = 0xff8c80; addr <= 0xff8c87; addr++)
diff --git a/src/ioMemTabTT.c b/src/ioMemTabTT.c
index 3be06266..c2b3c67b 100644
--- a/src/ioMemTabTT.c
+++ b/src/ioMemTabTT.c
@@ -180,6 +180,12 @@ const INTERCEPT_ACCESS_FUNC IoMemTable_TT[] =
 	{ 0xff8c80, 8, SCC_IoMem_ReadByte, SCC_IoMem_WriteByte },                               /* SCC */
 	{ 0xff8c88, 8, IoMem_VoidRead_00, IoMem_VoidWrite },                                    /* No bus error here */
 
+	/* Set ENABLE_VME_ACCESS unless you use m68k Linux.
+	 *
+	 * (Linux tries to use SCU/VME interrupts unless these give errors,
+	 *  but we don't support it yet)
+	 */
+#if ENABLE_VME_ACCESS
 	{ 0xff8e01, 1, IoMem_ReadWithoutInterception, IoMem_WriteWithoutInterception },         /* SCU system interrupt mask */
 	{ 0xff8e03, 1, IoMem_ReadWithoutInterception, IoMem_WriteWithoutInterception },         /* SCU system interrupt state */
 	{ 0xff8e05, 1, IoMem_ReadWithoutInterception, IoMem_WriteWithoutInterception },         /* SCU system interrupter */
@@ -188,6 +194,7 @@ const INTERCEPT_ACCESS_FUNC IoMemTable_TT[] =
 	{ 0xff8e0b, 1, IoMem_ReadWithoutInterception, IoMem_WriteWithoutInterception },         /* SCU general purpose 2 */
 	{ 0xff8e0d, 1, IoMem_ReadWithoutInterception, IoMem_WriteWithoutInterception },         /* SCU VME interrupt mask */
 	{ 0xff8e0f, 1, IoMem_ReadWithoutInterception, IoMem_WriteWithoutInterception },         /* SCU VME interrupt state */
+#endif
 
 	{ 0xff9000, SIZE_WORD, IoMem_VoidRead, IoMem_VoidWrite },                /* No bus error here */
 	{ 0xff9200, SIZE_WORD, IoMemTabTT_ReadDIPSwitches, IoMem_VoidWrite },    /* DIP switches */
-- 
2.20.1