- AmigaOS: implemented XPRAM watchdog thread

- AmigaOS: disabled 68060 Super Bypass mode because of CPU bug triggered
  by MacOS 8
- minor documentation updates
This commit is contained in:
cebix 2001-01-25 22:24:36 +00:00
parent 049092ac3d
commit 81f357c42c
7 changed files with 82 additions and 8 deletions

View File

@ -19,6 +19,9 @@ V0.8 (snapshot) - <date>
[Jürgen Lachmann]
- AmigaOS: added MacsBug support (tested with MacsBug6.6.1),
fixed <move sr,(sp)> bug [Jürgen Lachmann]
- AmigaOS: disabled 68060 Super Bypass mode because of CPU bug triggered
by MacOS 8
- AmigaOS: implemented XPRAM watchdog task
- AmigaOS/Unix/extfs_*.cpp: .finf helper file now stores complete
FInfo/FXInfo, replaced get/set_finder_*() functions by get/set_finfo()
- AmigaOS/Unix: it's possible to specify preferences items on the

View File

@ -2,7 +2,7 @@
Basilisk II, Version 0.8
A 68k Macintosh emulator
Copyright (C) 1997-2000 Christian Bauer et al.
Copyright (C) 1997-2001 Christian Bauer et al.
License

View File

@ -22,7 +22,6 @@ General:
- Write a nice User's Manual with linuxdoc or something similar
AmigaOS:
- XPRAM watchdog task
- "Create Hardfile..." button
- Support for ShapeShifter External Video Drivers
- Direct SCSI transfers, i.e. no buffering for contiguous transfers (can't check if the device
@ -46,6 +45,4 @@ Unix:
- scsi_linux.cpp: adapt to SCSI Generic driver V2.0
- ESD vs. /dev/dsp should be a prefs item
- ESD is also available on Solaris
- open /dev/dsp with O_NONBLOCK?
- serial_unix.cpp: provide a way to pipe input/output to programs
- NetBSD/m68k: FPU support

View File

@ -9,7 +9,7 @@ DEFS =
LDFLAGS = -noixemul
LIBS = /gg/lib/libnix/swapstack.o
AS = PhxAss
ASFLAGS = OPT ! INCPATH GG:os-include MACHINE=68020 FPU=1
ASFLAGS = OPT ! INCPATH GG:os-include FPU=1
## Files
SRCS = ../main.cpp main_amiga.cpp ../prefs.cpp ../prefs_items.cpp \

View File

@ -28,6 +28,7 @@
XDEF _AtomicAnd
XDEF _AtomicOr
XDEF _MoveVBR
XDEF _DisableSuperBypass
XDEF _Execute68k
XDEF _Execute68kTrap
XDEF _TrapHandlerAsm
@ -50,6 +51,8 @@
SECTION text,CODE
MACHINE 68020
*
* Atomic bit operations (don't trust the compiler)
*
@ -106,6 +109,29 @@ getvbr movec vbr,d0
setvbr movec d0,vbr
rte
*
* Disable 68060 Super Bypass mode
*
_DisableSuperBypass
movem.l d0-d1/a0-a1/a5-a6,-(sp)
move.l _SysBase,a6
lea dissb,a5
JSRLIB Supervisor
movem.l (sp)+,d0-d1/a0-a1/a5-a6
rts
MACHINE 68060
dissb movec pcr,d0
bset #5,d0
movec d0,pcr
rte
MACHINE 68020
*
* Execute 68k subroutine (must be ended with rts)
* r->a[7] and r->sr are unused!

View File

@ -108,6 +108,9 @@ static struct timerequest *timereq = NULL; // IORequest for timer
static struct MsgPort *ahi_port = NULL; // Port for AHI
static struct AHIRequest *ahi_io = NULL; // IORequest for AHI
static struct Process *xpram_proc = NULL; // XPRAM watchdog
static volatile bool xpram_proc_active = true; // Flag for quitting the XPRAM watchdog
static struct Process *tick_proc = NULL; // 60Hz process
static volatile bool tick_proc_active = true; // Flag for quitting the 60Hz process
@ -120,6 +123,7 @@ struct trap_regs;
extern "C" void AtomicAnd(uint32 *p, uint32 val);
extern "C" void AtomicOr(uint32 *p, uint32 val);
extern "C" void MoveVBR(void);
extern "C" void DisableSuperBypass(void);
extern "C" void TrapHandlerAsm(void);
extern "C" void ExceptionHandlerAsm(void);
extern "C" void IllInstrHandler(trap_regs *regs);
@ -131,6 +135,7 @@ uint16 EmulatedSR; // Emulated SR (supervisor bit and interrupt mask)
// Prototypes
static void jump_to_rom(void);
static void xpram_func(void);
static void tick_func(void);
@ -303,6 +308,10 @@ int main(int argc, char **argv)
// Move VBR away from 0 if neccessary
MoveVBR();
// On 68060, disable Super Bypass mode because of a CPU bug that is triggered by MacOS 8
if (CPUIs68060)
DisableSuperBypass();
// Install trap handler
EmulatedSR = 0x2700;
OldTrapHandler = MainTask->tc_TrapCode;
@ -315,6 +324,14 @@ int main(int argc, char **argv)
MainTask->tc_ExceptCode = (APTR)ExceptionHandlerAsm;
SetExcept(SIGBREAKF_CTRL_C | IRQSigMask, SIGBREAKF_CTRL_C | IRQSigMask);
// Start XPRAM watchdog process
xpram_proc = CreateNewProcTags(
NP_Entry, (ULONG)xpram_func,
NP_Name, (ULONG)"Basilisk II XPRAM Watchdog",
NP_Priority, 0,
TAG_END
);
// Start 60Hz process
tick_proc = CreateNewProcTags(
NP_Entry, (ULONG)tick_func,
@ -362,13 +379,20 @@ void __saveds quit_emulator(void)
void QuitEmulator(void)
{
// Stop 60Hz thread
// Stop 60Hz process
if (tick_proc) {
SetSignal(0, SIGF_SINGLE);
tick_proc_active = false;
Wait(SIGF_SINGLE);
}
// Stop XPRAM watchdog process
if (xpram_proc) {
SetSignal(0, SIGF_SINGLE);
xpram_proc_active = false;
Wait(SIGF_SINGLE);
}
// Restore stack
if (stack_swapped) {
stack_swapped = false;
@ -475,7 +499,7 @@ void TriggerNMI(void)
/*
* 60Hz thread
* 60Hz thread (really 60.15Hz)
*/
static __saveds void tick_func(void)
@ -541,6 +565,30 @@ static __saveds void tick_func(void)
}
/*
* XPRAM watchdog thread (saves XPRAM every minute)
*/
static __saveds void xpram_func(void)
{
uint8 last_xpram[256];
memcpy(last_xpram, XPRAM, 256);
while (xpram_proc_active) {
for (int i=0; i<60 && xpram_proc_active; i++)
Delay(50); // Only wait 1 second so we quit promptly when xpram_proc_active becomes false
if (memcmp(last_xpram, XPRAM, 256)) {
memcpy(last_xpram, XPRAM, 256);
SaveXPRAM();
}
}
// Main task asked for termination, send signal
Forbid();
Signal(MainTask, SIGF_SINGLE);
}
/*
* Display error alert
*/

View File

@ -774,7 +774,7 @@ static void *xpram_func(void *arg)
{
while (!xpram_thread_cancel) {
for (int i=0; i<60 && !xpram_thread_cancel; i++)
Delay_usec(999999);
Delay_usec(999999); // Only wait 1 second so we quit promptly when xpram_thread_cancel becomes true
xpram_watchdog();
}
return NULL;