Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Aug 2012 12:04:29 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r239947 - stable/9/sys/amd64/amd64
Message-ID:  <201208311204.q7VC4TQM027208@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Aug 31 12:04:29 2012
New Revision: 239947
URL: http://svn.freebsd.org/changeset/base/239947

Log:
  MFC r238669:
  Force clean FPU state in PCB user FPU save area by performing
  getfpuregs(9) before accessing user FPU save area in ptrace_machdep.c
  for PT_I386_{GET,SET}XMMREGS and PT_{GET,SET}XSTATE.

Modified:
  stable/9/sys/amd64/amd64/ptrace_machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/ptrace_machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/ptrace_machdep.c	Fri Aug 31 12:01:35 2012	(r239946)
+++ stable/9/sys/amd64/amd64/ptrace_machdep.c	Fri Aug 31 12:04:29 2012	(r239947)
@@ -50,6 +50,7 @@ cpu_ptrace_xstate(struct thread *td, int
 
 	switch (req) {
 	case PT_GETXSTATE:
+		fpugetregs(td);
 		savefpu = (char *)(get_pcb_user_save_td(td) + 1);
 		error = copyout(savefpu, addr,
 		    cpu_max_ext_state_size - sizeof(struct savefpu));
@@ -62,8 +63,10 @@ cpu_ptrace_xstate(struct thread *td, int
 		}
 		savefpu = malloc(data, M_TEMP, M_WAITOK);
 		error = copyin(addr, savefpu, data);
-		if (error == 0)
+		if (error == 0) {
+			fpugetregs(td);
 			error = fpusetxstate(td, savefpu, data);
+		}
 		free(savefpu, M_TEMP);
 		break;
 
@@ -89,11 +92,13 @@ cpu32_ptrace(struct thread *td, int req,
 
 	switch (req) {
 	case PT_I386_GETXMMREGS:
+		fpugetregs(td);
 		error = copyout(get_pcb_user_save_td(td), addr,
 		    sizeof(*fpstate));
 		break;
 
 	case PT_I386_SETXMMREGS:
+		fpugetregs(td);
 		fpstate = get_pcb_user_save_td(td);
 		error = copyin(addr, fpstate, sizeof(*fpstate));
 		fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208311204.q7VC4TQM027208>