svn commit: r285334 - head/sys/arm64/arm64

Andrew Turner andrew at FreeBSD.org
Thu Jul 9 17:26:57 UTC 2015


Author: andrew
Date: Thu Jul  9 17:26:56 2015
New Revision: 285334
URL: https://svnweb.freebsd.org/changeset/base/285334

Log:
  Clear the carry bit on the saved program state register when asked to
  clear the return value, it's used to indicate an error.
  
  Obtained from:	ABT Systems Ltd
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/machdep.c

Modified: head/sys/arm64/arm64/machdep.c
==============================================================================
--- head/sys/arm64/arm64/machdep.c	Thu Jul  9 17:25:02 2015	(r285333)
+++ head/sys/arm64/arm64/machdep.c	Thu Jul  9 17:26:56 2015	(r285334)
@@ -266,10 +266,13 @@ get_mcontext(struct thread *td, mcontext
 {
 	struct trapframe *tf = td->td_frame;
 
-	if (clear_ret & GET_MC_CLEAR_RET)
+	if (clear_ret & GET_MC_CLEAR_RET) {
 		mcp->mc_gpregs.gp_x[0] = 0;
-	else
+		mcp->mc_gpregs.gp_spsr = tf->tf_spsr & ~PSR_C;
+	} else {
 		mcp->mc_gpregs.gp_x[0] = tf->tf_x[0];
+		mcp->mc_gpregs.gp_spsr = tf->tf_spsr;
+	}
 
 	memcpy(&mcp->mc_gpregs.gp_x[1], &tf->tf_x[1],
 	    sizeof(mcp->mc_gpregs.gp_x[1]) * (nitems(mcp->mc_gpregs.gp_x) - 1));
@@ -277,7 +280,6 @@ get_mcontext(struct thread *td, mcontext
 	mcp->mc_gpregs.gp_sp = tf->tf_sp;
 	mcp->mc_gpregs.gp_lr = tf->tf_lr;
 	mcp->mc_gpregs.gp_elr = tf->tf_elr;
-	mcp->mc_gpregs.gp_spsr = tf->tf_spsr;
 
 	return (0);
 }


More information about the svn-src-head mailing list