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 idea is that we might be switch from or to an f-line (MMU/FPU Trap)
instruction so prepend a nop to flush the caches.

Addresses part of PR/13078.

The second part to this (patch to binutils/gas) has been submitted upstream
and will be fixed when this part is reviewed and included in our local copy
of binutils or (hopefully) in a later version of binutils from upstream.

See:
https://sourceware.org/pipermail/binutils/2025-March/140270.html


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/m68k/m68k/switch_subr.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/m68k/m68k/switch_subr.s
diff -u src/sys/arch/m68k/m68k/switch_subr.s:1.38 src/sys/arch/m68k/m68k/switch_subr.s:1.39
--- src/sys/arch/m68k/m68k/switch_subr.s:1.38	Thu Oct 31 07:30:28 2024
+++ src/sys/arch/m68k/m68k/switch_subr.s	Sun Mar 30 04:44:26 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: switch_subr.s,v 1.38 2024/10/31 07:30:28 isaki Exp $	*/
+/*	$NetBSD: switch_subr.s,v 1.39 2025/03/30 04:44:26 nat Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation.
@@ -80,6 +80,7 @@ GLOBAL(masterpaddr)		| XXXcompatibility 
 ASENTRY_NOPROFILE(cpu_idle)
 	stop	#PSL_LOWIPL
 GLOBAL(_Idle)				/* For sun2/sun3's clock.c ... */
+	nop
 	rts
 
 /*
@@ -207,6 +208,7 @@ ENTRY(cpu_switchto)
 .Lcpu_switch_nofprest:
 	movl	%d1,%d0			| return outgoing lwp
 	movl	%d0,%a0			| (in a0, too)
+	nop
 	rts
 
 /*
@@ -255,6 +257,7 @@ ENTRY(savectx)
 #endif /* FPCOPROC */
 #endif /* !_M68K_CUSTOM_FPU_CTX */
 	moveq	#0,%d0			| return 0
+	nop
 	rts
 
 #if !defined(M68010)
@@ -286,6 +289,7 @@ ENTRY(m68k_make_fpu_idle_frame)
 	frestore (%sp)
 	fnop
 	addql	#4,%sp
+	nop
 	rts
 #endif
 
@@ -307,6 +311,7 @@ ENTRY(m68881_save)
 	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 @@ ENTRY(m68881_save)
 	fmovem	%fpsr,FPF_FPSR(%a0)
 	fmovem	%fpi,FPF_FPI(%a0)
 .Lm68060sdone:
+	nop
         rts
 #endif
 
@@ -335,6 +341,7 @@ ENTRY(m68881_restore)
 	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 @@ ENTRY(m68881_restore)
 	fmovem	FPF_REGS(%a0),%fp0-%fp7 | restore FP general registers
 .Lm68060fprdone:
 	frestore (%a0)			| restore state
+	nop
 	rts
 #endif
 #endif

Reply via email to