Skip to content

Commit

Permalink
Provide fixed UserSpace function for Kickstart 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cahirwpz committed Dec 16, 2023
1 parent 284862c commit 5020a97
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SOURCES := \
autoinit.c \
debug.c \
dputchar.S \
kickfix.S \
kputchar.S \
effect.c \
loader.c \
Expand Down
11 changes: 9 additions & 2 deletions system/amigaos.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ BootDataT *SaveOS(void) {
return &BootData;
}

extern void UserState34(void *stack);

void RestoreOS(void) {
BootDataT *bd = &BootData;

Expand All @@ -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]);
Expand Down
11 changes: 11 additions & 0 deletions system/kickfix.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <asm.h>

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:

0 comments on commit 5020a97

Please sign in to comment.