From owner-svn-src-head@freebsd.org Tue Jan 14 18:00:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90EC11F2207; Tue, 14 Jan 2020 18:00:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47xysd3NK8z4T2d; Tue, 14 Jan 2020 18:00:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3162174B; Tue, 14 Jan 2020 18:00:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00EI05Fc072367; Tue, 14 Jan 2020 18:00:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00EI05Nf072366; Tue, 14 Jan 2020 18:00:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202001141800.00EI05Nf072366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 14 Jan 2020 18:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356737 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 356737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2020 18:00:05 -0000 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)