diff -r dd0e72071a3c sys/arch/m68k/m68k/fpu.c --- a/sys/arch/m68k/m68k/fpu.c Tue Apr 08 01:29:08 2025 +0000 +++ b/sys/arch/m68k/m68k/fpu.c Tue Apr 08 22:08:01 2025 +1000 @@ -57,12 +57,17 @@ fpu_probe(void) * We, of course, need to have enough room for either. */ struct fpframe fpframe; + static int fpu_cached = FPU_UNKNOWN; label_t faultbuf; uint8_t b; + if (fpu_cached != FPU_UNKNOWN) + return fpu_cached; + nofault = (int *)&faultbuf; if (setjmp(&faultbuf)) { nofault = (int *)0; + fpu_cached = FPU_NONE; return FPU_NONE; } @@ -72,6 +77,7 @@ fpu_probe(void) * state, so we can determine which we have by * examining the size of the FP state frame */ + __asm("nop"); /* For buggy LC040 compatability. */ __asm("fnop"); nofault = NULL; @@ -80,10 +86,14 @@ fpu_probe(void) * Presumably, if we're an 040/060 and did not take exception * above, we have an FPU. Don't bother probing. */ - if (cputype == CPU_68060) + if (cputype == CPU_68060) { + fpu_cached = FPU_68060; return FPU_68060; - if (cputype == CPU_68040) + } + if (cputype == CPU_68040) { + fpu_cached = FPU_68040; return FPU_68040; + } /* * Presumably, this will not cause a fault--the fnop should @@ -105,10 +115,14 @@ fpu_probe(void) * The size of a 68881 IDLE frame is 0x18 * and a 68882 frame is 0x38 */ - if (b == 0x18) + if (b == 0x18) { + fpu_cached = FPU_68881; return FPU_68881; - if (b == 0x38) + } + if (b == 0x38) { + fpu_cached = FPU_68882; return FPU_68882; + } /* * If it's not one of the above, we have no clue what it is.