svn commit: r283887 - head/sys/arm/arm
Andrew Turner
andrew at FreeBSD.org
Mon Jun 1 18:13:33 UTC 2015
Author: andrew
Date: Mon Jun 1 18:13:32 2015
New Revision: 283887
URL: https://svnweb.freebsd.org/changeset/base/283887
Log:
Clear the C bit of the saved program state register when also clearing the
return value. We use this bit to signal when a syscall has failed, and
without this getcontext/setcontext may fail.
MFC after: 1 week
Modified:
head/sys/arm/arm/machdep.c
Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c Mon Jun 1 18:08:56 2015 (r283886)
+++ head/sys/arm/arm/machdep.c Mon Jun 1 18:13:32 2015 (r283887)
@@ -741,10 +741,13 @@ get_mcontext(struct thread *td, mcontext
struct trapframe *tf = td->td_frame;
__greg_t *gr = mcp->__gregs;
- if (clear_ret & GET_MC_CLEAR_RET)
+ if (clear_ret & GET_MC_CLEAR_RET) {
gr[_REG_R0] = 0;
- else
+ gr[_REG_CPSR] = tf->tf_spsr & ~PSR_C;
+ } else {
gr[_REG_R0] = tf->tf_r0;
+ gr[_REG_CPSR] = tf->tf_spsr;
+ }
gr[_REG_R1] = tf->tf_r1;
gr[_REG_R2] = tf->tf_r2;
gr[_REG_R3] = tf->tf_r3;
@@ -760,7 +763,6 @@ get_mcontext(struct thread *td, mcontext
gr[_REG_SP] = tf->tf_usr_sp;
gr[_REG_LR] = tf->tf_usr_lr;
gr[_REG_PC] = tf->tf_pc;
- gr[_REG_CPSR] = tf->tf_spsr;
return (0);
}
More information about the svn-src-all
mailing list