Skip to contentSkip to conversation

fpu enabling/disabling in ptrace.c

PATCH New Jun Sun 1 participant 1 message Sep 16, 2002

Subsystems (2)
lore
Share & tools
lore

Jun Sun

author
#0 lore raw

PATCH 1/1 fpu enabling/disabling in ptrace.c

I think the original intention is to enable FPU, read the FPU id register and restore original FPU state. Unfortnately restore_flags() does not achieve it.

Following patch fixes that. Applies to both 2.4 and 2.5 branch.

Jun

P.S., I am still waiting for comments or check-in of the following patches:

020417.kgdb-compile-warning.patch
020722.malta-kgdb
020826.swarm-rtc-m41t81.patch

arch/mips/kernel/ptrace.c renamed from arch/mips/kernel/ptrace.c.orig +2 -2
diff -Nru link/arch/mips/kernel/ptrace.c.orig link/arch/mips/kernel/ptrace.c
@@ -168,10 +168,10 @@
 				break;
 			}
 
-			__save_flags(flags);
+			flags = read_32bit_cp0_register(CP0_STATUS);
 			__enable_fpu();
 			__asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
-			__restore_flags(flags);
+			write_32bit_cp0_register(CP0_STATUS, flags);
 			break;
 		}
 		default:
arch/mips64/kernel/ptrace.c renamed from arch/mips64/kernel/ptrace.c.orig +2 -2
diff -Nru link/arch/mips64/kernel/ptrace.c.orig link/arch/mips64/kernel/ptrace.c
@@ -165,10 +165,10 @@
 			break;
 		case FPC_EIR: { /* implementation / version register */
 			unsigned int flags;
-			__save_flags(flags);
+			flags = read_32bit_cp0_register(CP0_STATUS);
 			__enable_fpu();
 			__asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
-			__restore_flags(flags);
+			write_32bit_cp0_register(CP0_STATUS, flags);
 			break;
 		}
 		default: