Skip to contentSkip to conversation

protect CU1 bit manipulation from preempt

PATCH In review Atsushi Nemoto 2 participants 2 messages Oct 6, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 protect CU1 bit manipulation from preempt

The ptrace temporarily enable CP1 without fpu-ownership. These regions should be protected from preempt.

arch/mips/kernel/ptrace.c +4 -0
@@ -126,10 +126,12 @@ int ptrace_getfpregs (struct task_struct
 
 		__put_user (child->thread.fpu.hard.fcr31, data + 64);
 
+		preempt_disable();
 		flags = read_c0_status();
 		__enable_fpu();
 		__asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
 		write_c0_status(flags);
+		preempt_enable();
 		__put_user (tmp, data + 65);
 	} else {
 		__put_user (child->thread.fpu.soft.fcr31, data + 64);
@@ -284,10 +286,12 @@ asmlinkage int sys_ptrace(long request, 
 			if (!cpu_has_fpu)
 				break;
 
+			preempt_disable();
 			flags = read_c0_status();
 			__enable_fpu();
 			__asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
 			write_c0_status(flags);
+			preempt_enable();
 			break;
 		}
 		case DSP_BASE ... DSP_BASE + 5: {
arch/mips/kernel/ptrace32.c +2 -0
@@ -191,10 +191,12 @@ asmlinkage int sys32_ptrace(int request,
 			if (!cpu_has_fpu)
 				break;
 
+			preempt_disable();
 			flags = read_c0_status();
 			__enable_fpu();
 			__asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
 			write_c0_status(flags);
+			preempt_enable();
 			break;
 		}
 		case DSP_BASE ... DSP_BASE + 5:
#1 lore raw
Quoted 2 lines · Atsushi Nemoto

The ptrace temporarily enable CP1 without fpu-ownership. These regions should be protected from preempt.

Applied with quite some additions to take care of the MT ASE as well.

Ralf