Save/restore FPU registers in interrupt
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402091
This commit is contained in:
parent
5baf894ec9
commit
0fee077381
8 changed files with 95 additions and 2 deletions
|
@ -145,6 +145,26 @@ SDL_MintAudio_SearchFrequency(_THIS, int desired_freq)
|
||||||
return MINTAUDIO_freqcount - 1;
|
return MINTAUDIO_freqcount - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if FPU is present */
|
||||||
|
void SDL_MintAudio_CheckFpu(void)
|
||||||
|
{
|
||||||
|
unsigned long cookie_fpu;
|
||||||
|
|
||||||
|
SDL_MintAudio_hasfpu = 0;
|
||||||
|
if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch ((cookie_fpu>>16)&0xfffe) {
|
||||||
|
case 2:
|
||||||
|
case 4:
|
||||||
|
case 6:
|
||||||
|
case 8:
|
||||||
|
case 16:
|
||||||
|
SDL_MintAudio_hasfpu = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* The thread function, used under MiNT with xbios */
|
/* The thread function, used under MiNT with xbios */
|
||||||
int
|
int
|
||||||
SDL_MintAudio_Thread(long param)
|
SDL_MintAudio_Thread(long param)
|
||||||
|
|
|
@ -128,6 +128,7 @@ extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
|
||||||
extern volatile unsigned short SDL_MintAudio_mutex;
|
extern volatile unsigned short SDL_MintAudio_mutex;
|
||||||
extern cookie_stfa_t *SDL_MintAudio_stfa;
|
extern cookie_stfa_t *SDL_MintAudio_stfa;
|
||||||
extern volatile unsigned long SDL_MintAudio_clocktics;
|
extern volatile unsigned long SDL_MintAudio_clocktics;
|
||||||
|
extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
|
||||||
|
|
||||||
/* MiNT thread variables */
|
/* MiNT thread variables */
|
||||||
extern SDL_bool SDL_MintAudio_mint_present;
|
extern SDL_bool SDL_MintAudio_mint_present;
|
||||||
|
@ -140,6 +141,7 @@ void SDL_MintAudio_Callback(void);
|
||||||
void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
|
void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
|
||||||
Uint32 prediv, int gpio_bits);
|
Uint32 prediv, int gpio_bits);
|
||||||
int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
|
int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
|
||||||
|
void SDL_MintAudio_CheckFpu(void);
|
||||||
|
|
||||||
/* MiNT thread functions */
|
/* MiNT thread functions */
|
||||||
int SDL_MintAudio_Thread(long param);
|
int SDL_MintAudio_Thread(long param);
|
||||||
|
|
|
@ -367,6 +367,8 @@ Mint_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
||||||
SDL_MintAudio_audiobuf[1]));
|
SDL_MintAudio_audiobuf[1]));
|
||||||
|
|
||||||
|
SDL_MintAudio_CheckFpu();
|
||||||
|
|
||||||
/* Setup audio hardware */
|
/* Setup audio hardware */
|
||||||
Mint_InitAudio(this, spec);
|
Mint_InitAudio(this, spec);
|
||||||
|
|
||||||
|
|
|
@ -438,6 +438,8 @@ Mint_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
||||||
SDL_MintAudio_audiobuf[1]));
|
SDL_MintAudio_audiobuf[1]));
|
||||||
|
|
||||||
|
SDL_MintAudio_CheckFpu();
|
||||||
|
|
||||||
/* Setup audio hardware */
|
/* Setup audio hardware */
|
||||||
Mint_InitAudio(this, spec);
|
Mint_InitAudio(this, spec);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
.globl _SDL_MintAudio_numbuf
|
.globl _SDL_MintAudio_numbuf
|
||||||
.globl _SDL_MintAudio_audiosize
|
.globl _SDL_MintAudio_audiosize
|
||||||
.globl _SDL_MintAudio_clocktics
|
.globl _SDL_MintAudio_clocktics
|
||||||
|
.globl _SDL_MintAudio_hasfpu
|
||||||
|
|
||||||
.globl _SDL_MintAudio_stfa
|
.globl _SDL_MintAudio_stfa
|
||||||
|
|
||||||
|
@ -85,9 +86,29 @@ _SDL_MintAudio_XbiosInterrupt:
|
||||||
|
|
||||||
moveml d0-d7/a0-a6,sp@-
|
moveml d0-d7/a0-a6,sp@-
|
||||||
|
|
||||||
|
/* Save FPU if needed */
|
||||||
|
tstw _SDL_MintAudio_hasfpu
|
||||||
|
beqs SDL_MintAudio_Xbios_nofpu1
|
||||||
|
.chip 68060
|
||||||
|
fsave sp@-
|
||||||
|
fmoveml fpcr/fpsr/fpiar,sp@-
|
||||||
|
fmovemx fp0-fp7,sp@-
|
||||||
|
.chip 68000
|
||||||
|
SDL_MintAudio_Xbios_nofpu1:
|
||||||
|
|
||||||
/* Callback */
|
/* Callback */
|
||||||
jsr _SDL_MintAudio_Callback
|
jsr _SDL_MintAudio_Callback
|
||||||
|
|
||||||
|
/* Restore FPU if needed */
|
||||||
|
tstw _SDL_MintAudio_hasfpu
|
||||||
|
beqs SDL_MintAudio_Xbios_nofpu2
|
||||||
|
.chip 68060
|
||||||
|
fmovemx sp@+,fp0-fp7
|
||||||
|
fmoveml sp@+,fpcr/fpsr/fpiar
|
||||||
|
frestore sp@+
|
||||||
|
.chip 68000
|
||||||
|
SDL_MintAudio_Xbios_nofpu2:
|
||||||
|
|
||||||
/* Reserve space for registers */
|
/* Reserve space for registers */
|
||||||
subl #savamt,savptr
|
subl #savamt,savptr
|
||||||
|
|
||||||
|
@ -137,11 +158,31 @@ _SDL_MintAudio_Dma8Interrupt:
|
||||||
/* Swap buffers */
|
/* Swap buffers */
|
||||||
eorw #1,_SDL_MintAudio_numbuf
|
eorw #1,_SDL_MintAudio_numbuf
|
||||||
|
|
||||||
moveml d0-d7/a0-a6,sp@-
|
moveml d0-d1/a0-a1,sp@-
|
||||||
|
|
||||||
|
/* Save FPU if needed */
|
||||||
|
tstw _SDL_MintAudio_hasfpu
|
||||||
|
beqs SDL_MintAudio_Dma8_nofpu1
|
||||||
|
.chip 68060
|
||||||
|
fsave sp@-
|
||||||
|
fmoveml fpcr/fpsr/fpiar,sp@-
|
||||||
|
fmovemx fp0-fp7,sp@-
|
||||||
|
.chip 68000
|
||||||
|
SDL_MintAudio_Dma8_nofpu1:
|
||||||
|
|
||||||
/* Callback */
|
/* Callback */
|
||||||
jsr _SDL_MintAudio_Callback
|
jsr _SDL_MintAudio_Callback
|
||||||
|
|
||||||
|
/* Restore FPU if needed */
|
||||||
|
tstw _SDL_MintAudio_hasfpu
|
||||||
|
beqs SDL_MintAudio_Dma8_nofpu2
|
||||||
|
.chip 68060
|
||||||
|
fmovemx sp@+,fp0-fp7
|
||||||
|
fmoveml sp@+,fpcr/fpsr/fpiar
|
||||||
|
frestore sp@+
|
||||||
|
.chip 68000
|
||||||
|
SDL_MintAudio_Dma8_nofpu2:
|
||||||
|
|
||||||
/* Set new buffer */
|
/* Set new buffer */
|
||||||
|
|
||||||
moveq #0,d0
|
moveq #0,d0
|
||||||
|
@ -169,7 +210,7 @@ _SDL_MintAudio_Dma8Interrupt:
|
||||||
rorl #8,d1
|
rorl #8,d1
|
||||||
moveb d1,a0@(0x0f)
|
moveb d1,a0@(0x0f)
|
||||||
|
|
||||||
moveml sp@+,d0-d7/a0-a6
|
moveml sp@+,d0-d1/a0-a1
|
||||||
|
|
||||||
clrw _SDL_MintAudio_mutex
|
clrw _SDL_MintAudio_mutex
|
||||||
SDL_MintAudio_Dma8End:
|
SDL_MintAudio_Dma8End:
|
||||||
|
@ -195,9 +236,29 @@ _SDL_MintAudio_StfaInterrupt:
|
||||||
|
|
||||||
moveml d0-d7/a0-a6,sp@-
|
moveml d0-d7/a0-a6,sp@-
|
||||||
|
|
||||||
|
/* Save FPU if needed */
|
||||||
|
tstw _SDL_MintAudio_hasfpu
|
||||||
|
beqs SDL_MintAudio_Stfa_nofpu1
|
||||||
|
.chip 68060
|
||||||
|
fsave sp@-
|
||||||
|
fmoveml fpcr/fpsr/fpiar,sp@-
|
||||||
|
fmovemx fp0-fp7,sp@-
|
||||||
|
.chip 68000
|
||||||
|
SDL_MintAudio_Stfa_nofpu1:
|
||||||
|
|
||||||
/* Callback */
|
/* Callback */
|
||||||
jsr _SDL_MintAudio_Callback
|
jsr _SDL_MintAudio_Callback
|
||||||
|
|
||||||
|
/* Restore FPU if needed */
|
||||||
|
tstw _SDL_MintAudio_hasfpu
|
||||||
|
beqs SDL_MintAudio_Stfa_nofpu2
|
||||||
|
.chip 68060
|
||||||
|
fmovemx sp@+,fp0-fp7
|
||||||
|
fmoveml sp@+,fpcr/fpsr/fpiar
|
||||||
|
frestore sp@+
|
||||||
|
.chip 68000
|
||||||
|
SDL_MintAudio_Stfa_nofpu2:
|
||||||
|
|
||||||
/* Set new buffer */
|
/* Set new buffer */
|
||||||
|
|
||||||
moveq #0,d0
|
moveq #0,d0
|
||||||
|
|
|
@ -415,6 +415,8 @@ Mint_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
||||||
SDL_MintAudio_audiobuf[1]));
|
SDL_MintAudio_audiobuf[1]));
|
||||||
|
|
||||||
|
SDL_MintAudio_CheckFpu();
|
||||||
|
|
||||||
/* Setup audio hardware */
|
/* Setup audio hardware */
|
||||||
Mint_InitAudio(this, spec);
|
Mint_InitAudio(this, spec);
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,8 @@ Mint_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
||||||
SDL_MintAudio_audiobuf[1]));
|
SDL_MintAudio_audiobuf[1]));
|
||||||
|
|
||||||
|
SDL_MintAudio_CheckFpu();
|
||||||
|
|
||||||
/* Setup audio hardware */
|
/* Setup audio hardware */
|
||||||
Mint_InitAudio(this, spec);
|
Mint_InitAudio(this, spec);
|
||||||
|
|
||||||
|
|
|
@ -519,6 +519,8 @@ Mint_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
|
||||||
SDL_MintAudio_audiobuf[1]));
|
SDL_MintAudio_audiobuf[1]));
|
||||||
|
|
||||||
|
SDL_MintAudio_CheckFpu();
|
||||||
|
|
||||||
/* Setup audio hardware */
|
/* Setup audio hardware */
|
||||||
Mint_InitAudio(this, spec);
|
Mint_InitAudio(this, spec);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue