svn commit: r356737 - head/sys/mips/mips

John Baldwin jhb at FreeBSD.org
Tue Jan 14 18:00:05 UTC 2020


Author: jhb
Date: Tue Jan 14 18:00:04 2020
New Revision: 356737
URL: https://svnweb.freebsd.org/changeset/base/356737

Log:
  Preserve the inherited value of the status register in cpu_set_upcall().
  
  Instead of re-deriving the value of SR using logic similar to
  exec_set_regs(), just inherit the value from the existing thread
  similar to fork().
  
  Reviewed by:	brooks
  Obtained from:	CheriBSD
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D23059

Modified:
  head/sys/mips/mips/vm_machdep.c

Modified: head/sys/mips/mips/vm_machdep.c
==============================================================================
--- head/sys/mips/mips/vm_machdep.c	Tue Jan 14 17:56:54 2020	(r356736)
+++ head/sys/mips/mips/vm_machdep.c	Tue Jan 14 18:00:04 2020	(r356737)
@@ -414,7 +414,7 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
     stack_t *stack)
 {
 	struct trapframe *tf;
-	register_t sp;
+	register_t sp, sr;
 
 	sp = (((intptr_t)stack->ss_sp + stack->ss_size) & ~(STACK_ALIGN - 1)) -
 	    CALLFRAME_SIZ;
@@ -424,8 +424,10 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
 	 * function.
 	 */
 	tf = td->td_frame;
+	sr = tf->sr;
 	bzero(tf, sizeof(struct trapframe));
 	tf->sp = sp;
+	tf->sr = sr;
 	tf->pc = (register_t)(intptr_t)entry;
 	/* 
 	 * MIPS ABI requires T9 to be the same as PC 
@@ -434,18 +436,6 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
 	tf->t9 = (register_t)(intptr_t)entry; 
 	tf->a0 = (register_t)(intptr_t)arg;
 
-	/*
-	 * Keep interrupt mask
-	 */
-	td->td_frame->sr = MIPS_SR_KSU_USER | MIPS_SR_EXL | MIPS_SR_INT_IE |
-	    (mips_rd_status() & MIPS_SR_INT_MASK);
-#if defined(__mips_n32) 
-	td->td_frame->sr |= MIPS_SR_PX;
-#elif  defined(__mips_n64)
-	td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX;
-#endif
-/*	tf->sr |= (ALL_INT_MASK & idle_mask) | SR_INT_ENAB; */
-	/**XXX the above may now be wrong -- mips2 implements this as panic */
 	/*
 	 * FREEBSD_DEVELOPERS_FIXME:
 	 * Setup any other CPU-Specific registers (Not MIPS Standard)


More information about the svn-src-head mailing list