> Module Name: src > Committed By: nat > Date: Wed Apr 9 00:04:41 UTC 2025 > > Modified Files: > src/sys/arch/m68k/m68k: fpu.c > > Log Message: > Add workaround for fpu test for kernels defined with M68040. > > This is to accomodate kernels built without the -mlcfix option passed to > gas(1). > > As discussed on tech-kern - It would be remiss of me otherwize.
Do you have a certain scenario that the write-pending could happen just before F-line Unimplemented Exception by the fnop in fpu_probe()? On hp300 objdump -d GENERIC/netbsd shows: 000146a4 <fpu_probe>: struct fpframe fpframe; label_t faultbuf; uint8_t b; 146a4: 4e56 fe80 linkw %fp,#-384 146a8: 2f02 movel %d2,%sp@- nofault = (int *)&faultbuf; 146aa: 41ee fe80 lea %fp@(-384),%a0 146ae: 23c8 002d eb00 movel %a0,2deb00 <nofault> if (setjmp(&faultbuf)) { 146b4: 486e fe80 pea %fp@(-384) 146b8: 4eb9 0002 029c jsr 2029c <setjmp> 146be: 588f addql #4,%sp 146c0: 4a80 tstl %d0 146c2: 670a beqs 146ce <fpu_probe+0x2a> nofault = (int *)0; 146c4: 42b9 002d eb00 clrl 2deb00 <nofault> 146ca: 4280 clrl %d0 return FPU_NONE; 146cc: 6054 bras 14722 <fpu_probe+0x7e> } __asm("fnop"); 146ce: f280 0000 fnop nofault = NULL; 146d2: 42b9 002d eb00 clrl 2deb00 <nofault> if (cputype == CPU_68060) 146d8: 2039 002c 5018 movel 2c5018 <cputype>,%d0 146de: 7203 moveq #3,%d1 146e0: b280 cmpl %d0,%d1 return FPU_68060; 146e2: 6730 beqs 14714 <fpu_probe+0x70> if (cputype == CPU_68040) 146e4: 5580 subql #2,%d0 return FPU_68040; 146e6: 6730 beqs 14718 <fpu_probe+0x74> __asm("fsave %0@" : : "a" (&fpframe) : "memory"); 146e8: 41ee febc lea %fp@(-324),%a0 146ec: f310 fsave %a0@ b = fpframe.fpf_fsize; 146ee: 142e febd moveb %fp@(-323),%d2 fpframe.fpf_null = 0; 146f2: 42ae febc clrl %fp@(-324) fpframe.fpf_idle.fpf_ccr = 0; 146f6: 426e fec0 clrw %fp@(-320) m68881_restore(&fpframe); 146fa: 2f08 movel %a0,%sp@- 146fc: 4eb9 0000 1bd6 jsr 1bd6 <m68881_restore> 14702: 588f addql #4,%sp if (b == 0x18) 14704: 0c02 0018 cmpib #24,%d2 return FPU_68881; 14708: 6712 beqs 1471c <fpu_probe+0x78> if (b == 0x38) 1470a: 0c02 0038 cmpib #56,%d2 return FPU_68882; 1470e: 6710 beqs 14720 <fpu_probe+0x7c> return FPU_UNKNOWN; 14710: 7005 moveq #5,%d0 14712: 600e bras 14722 <fpu_probe+0x7e> 14714: 7004 moveq #4,%d0 14716: 600a bras 14722 <fpu_probe+0x7e> 14718: 7003 moveq #3,%d0 1471a: 6006 bras 14722 <fpu_probe+0x7e> 1471c: 7001 moveq #1,%d0 1471e: 6002 bras 14722 <fpu_probe+0x7e> 14720: 7002 moveq #2,%d0 14722: 242e fe7c movel %fp@(-388),%d2 14726: 4e5e unlk %fp 14728: 4e75 rts --- Izumi Tsutsui