Also save/restore fpu register in vbl interrupt SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sat, 21 Oct 2006 18:53:33 +0000
branchSDL-1.2
changeset 3883 cfe850b334e7
parent 3882 842b03d703c5
child 3884 dba874934f0c
Also save/restore fpu register in vbl interrupt
src/timer/mint/SDL_systimer.c
src/timer/mint/SDL_vbltimer.S
--- a/src/timer/mint/SDL_systimer.c	Sun Oct 01 02:30:03 2006 +0000
+++ b/src/timer/mint/SDL_systimer.c	Sat Oct 21 18:53:33 2006 +0000
@@ -48,6 +48,9 @@
 
 #include "SDL_vbltimer_s.h"
 
+/* from audio/mint */
+void SDL_MintAudio_CheckFpu(void);
+
 /* The first ticks value of the application */
 static Uint32 start;
 static SDL_bool supervisor;
@@ -119,6 +122,8 @@
 
 	supervisor=SDL_FALSE;
 
+	SDL_MintAudio_CheckFpu();
+
 	/* Install RunTimer in vbl vector */
 	oldpile=(void *)Super(0);
 	timer_installed = !SDL_AtariVblInstall(RunTimer);
--- a/src/timer/mint/SDL_vbltimer.S	Sun Oct 01 02:30:03 2006 +0000
+++ b/src/timer/mint/SDL_vbltimer.S	Sat Oct 21 18:53:33 2006 +0000
@@ -33,6 +33,8 @@
 	.globl	_SDL_AtariVblInstall
 	.globl	_SDL_AtariVblUninstall
 
+	.globl	_SDL_MintAudio_hasfpu
+
 /*--- Vector installer ---*/
 
 _SDL_AtariVblInstall:
@@ -113,8 +115,30 @@
 	notw	vbl_mutex
 
 	moveml	d0-d7/a0-a6,sp@-
+
+	/* Save FPU if needed */
+	tstw	_SDL_MintAudio_hasfpu
+	beqs	SDL_AtariVbl_nofpu1
+	.chip	68060
+	fsave	sp@-
+	fmoveml fpcr/fpsr/fpiar,sp@-
+	fmovemx	fp0-fp7,sp@-
+	.chip	68000
+SDL_AtariVbl_nofpu1:
+
 	movel	my_vector,a0
 	jsr		a0@
+
+	/* Restore FPU if needed */
+	tstw	_SDL_MintAudio_hasfpu
+	beqs	SDL_AtariVbl_Xbios_nofpu2
+	.chip	68060
+	fmovemx	sp@+,fp0-fp7
+	fmoveml	sp@+,fpcr/fpsr/fpiar
+	frestore	sp@+
+	.chip	68000
+SDL_AtariVbl_Xbios_nofpu2:
+
 	moveml	sp@+,d0-d7/a0-a6
 
 	clrw	vbl_mutex