diff --git a/system/Makefile b/system/Makefile index d0b39ca4..0e0a2510 100644 --- a/system/Makefile +++ b/system/Makefile @@ -8,6 +8,7 @@ SOURCES := \ autoinit.c \ debug.c \ dputchar.S \ + kickfix.S \ kputchar.S \ effect.c \ loader.c \ diff --git a/system/amigaos.c b/system/amigaos.c index b1bbd33e..32a34306 100644 --- a/system/amigaos.c +++ b/system/amigaos.c @@ -250,6 +250,8 @@ BootDataT *SaveOS(void) { return &BootData; } +extern void UserState34(void *stack); + void RestoreOS(void) { BootDataT *bd = &BootData; @@ -266,8 +268,13 @@ void RestoreOS(void) { /* Restore exception vector and leave supervisor mode. */ memcpy(bd->bd_vbr, old.excVec, sizeof(old.excVec)); - /* TODO: This function is broken in V33/34 Kickstart, hangs on 68010. */ - UserState(old.sysStack); + + /* UserState is broken on V33/34 Kickstart, hangs on 68010. */ + if (ExecVer <= 34) { + UserState34(old.sysStack); + } else { + UserState(old.sysStack); + } /* CIA-A & CIA-B: Restore state of all timers. */ SetTimerState(&ciaa->ciacra, &ciaa->ciatalo, &ciaa->ciatahi, &old.timer[0]); diff --git a/system/kickfix.S b/system/kickfix.S new file mode 100644 index 00000000..84d2518f --- /dev/null +++ b/system/kickfix.S @@ -0,0 +1,11 @@ +#include + +ENTRY(UserState34) + movea.l (sp)+,a1 + move.l sp,usp + movea.l a0,sp + and.w #0xdfff,sr + jmp (a1) +END(UserState34) + +# vim: ft=gas:ts=8:sw=8:noet: