At Sun, 30 Mar 2025 04:44:26 +0000, Nathanial Sloss wrote: > Module Name: src > Committed By: nat > Date: Sun Mar 30 04:44:26 UTC 2025 > > Modified Files: > src/sys/arch/m68k/m68k: switch_subr.s > > Log Message: > Sprinkle nop. > > This is the kernel part of addressing the issue with fpu emulation on lc040 > cpus.
The originator of this PR port-mac68k/13078 said (in 2001): | Workaround: place a NOP before the F-line instruction. And you responded (in Nov 2024): | The submitter is indeed right adding a nop before an fpu | instruction does fix the fpu emulation on the lc040... But you add a NOP before RET. Why? Furthermore, > --- switch_subr.s 31 Oct 2024 07:30:28 -0000 1.38 > +++ switch_subr.s 30 Mar 2025 04:44:26 -0000 1.39 > @@ -80,6 +80,7 @@ > ASENTRY_NOPROFILE(cpu_idle) > stop #PSL_LOWIPL > GLOBAL(_Idle) /* For sun2/sun3's clock.c ... */ > + nop > rts 68LC040 runs this part but there are no FPU instructions. Is your 68LC040 affected if you remove this NOP? > @@ -207,6 +208,7 @@ > .Lcpu_switch_nofprest: > movl %d1,%d0 | return outgoing lwp > movl %d0,%a0 | (in a0, too) > + nop > rts This is in cpu_switchto. 68LC040 runs this part but never encounters FPU instructions. Is your 68LC040 affected if you remove this NOP? > @@ -255,6 +257,7 @@ > #endif /* FPCOPROC */ > #endif /* !_M68K_CUSTOM_FPU_CTX */ > moveq #0,%d0 | return 0 > + nop > rts This is in savectx. 68LC040 runs this part but never encounters FPU instructions. Is your 68LC040 affected if you remove this NOP? > @@ -286,6 +289,7 @@ > frestore (%sp) > fnop > addql #4,%sp > + nop > rts > #endif This is in m68k_make_fpu_idle_frame(). 68LC040 doesn't seem to call it. Is your 68LC040 affected if you remove this NOP? > @@ -307,6 +311,7 @@ > fmovem %fp0-%fp7,FPF_REGS(%a0) | save FP general registers > fmovem %fpcr/%fpsr/%fpi,FPF_FPCR(%a0) | save FP control registers > .Lm68881sdone: > + nop > rts > #endif > #if defined(M68060) > @@ -318,6 +323,7 @@ > fmovem %fpsr,FPF_FPSR(%a0) > fmovem %fpi,FPF_FPI(%a0) > .Lm68060sdone: > + nop > rts > #endif These are in m68881_save(). 68LC040 doesn't seem to call it. In addition, the second chunk is not compiled because M68060 is not defined on mac68k. Is your 68LC040 affected if you remove these NOPs? > @@ -335,6 +341,7 @@ > fmovem FPF_REGS(%a0),%fp0-%fp7 | restore FP general registers > .Lm68881rdone: > frestore (%a0) | restore state > + nop > rts > #endif > #if defined(M68060) > @@ -347,6 +354,7 @@ > fmovem FPF_REGS(%a0),%fp0-%fp7 | restore FP general registers > .Lm68060fprdone: > frestore (%a0) | restore state > + nop > rts > #endif > #endif These are in m68881_restore(). Same as above. You may be observing something different... --- Tetsuya Isaki <is...@pastel-flower.jp / is...@netbsd.org>