From owner-p4-projects@FreeBSD.ORG Mon Mar 15 00:01:20 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A553416A4E4; Mon, 15 Mar 2004 00:01:15 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4685016A4E4 for ; Mon, 15 Mar 2004 00:01:15 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2846643D1D for ; Mon, 15 Mar 2004 00:01:15 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2F81EGe083790 for ; Mon, 15 Mar 2004 00:01:14 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2F81Ev8083786 for perforce@freebsd.org; Mon, 15 Mar 2004 00:01:14 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Mon, 15 Mar 2004 00:01:14 -0800 (PST) Message-Id: <200403150801.i2F81Ev8083786@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 49012 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2004 08:01:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=49012 Change 49012 by jmallett@jmallett_oingo on 2004/03/15 00:00:18 Put the stack pointer in the trapframe. Affected files ... .. //depot/projects/mips/sys/mips/include/cpu.h#16 edit .. //depot/projects/mips/sys/mips/include/frame.h#4 edit .. //depot/projects/mips/sys/mips/mips/exception.S#23 edit .. //depot/projects/mips/sys/mips/mips/genassym.c#11 edit Differences ... ==== //depot/projects/mips/sys/mips/include/cpu.h#16 (text+ko) ==== @@ -47,13 +47,8 @@ #define TRAPF_PC(tframe) ((tframe)->tf_regs[TF_EPC]) #define TRAPF_USERMODE(tframe) ((tframe)->tf_regs[TF_SR] & MIPS_SR_KSU_USER) -#if notyet /* XXX */ #define cpu_getstack(p) ((p)->td_frame->tf_regs[TF_SP]) #define cpu_setstack(p,sp) ((p)->td_frame->tf_regs[TF_SP] = (sp)) -#else -#define cpu_getstack(p) (0) -#define cpu_setstack(p,sp) (0) -#endif /* * Arrange to handle pending profiling ticks before returning to user mode. ==== //depot/projects/mips/sys/mips/include/frame.h#4 (text+ko) ==== @@ -65,7 +65,9 @@ #define TF_MULHI 20 #define TF_EPC 21 /* may be changed by trap() call */ -#define TF_NREGS 22 +#define TF_SP 22 + +#define TF_NREGS 23 struct trapframe { __register_t tf_regs[TF_NREGS]; ==== //depot/projects/mips/sys/mips/mips/exception.S#23 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/mips/sys/mips/mips/exception.S#22 $ + * $P4: //depot/projects/mips/sys/mips/mips/exception.S#23 $ */ #include "opt_ddb.h" @@ -316,6 +316,12 @@ ld v0, TF_REG_V0(k1) /* + * Restore the stack minus TF_SIZE, to account for sp twiddle. + */ + ld sp, TF_REG_SP(k1) + dsubu sp, TF_SIZE + + /* * We are done with the assembler temporary, restore it, and * return with it disabled, just in case. */ @@ -379,6 +385,16 @@ sd a1, TF_REG_EPC(k1) /* + * When restore returns, TF_SIZE gets added to the SP for + * return. So in restore, we subtract TF_SIZE, which means + * the value stored herein will be the value returned to. + * To accomodate this, we add TF_SIZE, which makes up for the + * initial subtraction for the trapframe. + */ + daddu t0, sp, TF_SIZE + sd t0, TF_REG_SP(k1) + + /* * All done. */ jr k0 ==== //depot/projects/mips/sys/mips/mips/genassym.c#11 (text+ko) ==== @@ -163,6 +163,7 @@ ASSYM(TF_REG_MULLO, offsetof(struct trapframe, tf_regs[TF_MULLO])); ASSYM(TF_REG_MULHI, offsetof(struct trapframe, tf_regs[TF_MULHI])); ASSYM(TF_REG_EPC, offsetof(struct trapframe, tf_regs[TF_EPC])); +ASSYM(TF_REG_SP, offsetof(struct trapframe, tf_regs[TF_SP])); ASSYM(TF_PPL, offsetof(struct trapframe, tf_ppl)); ASSYM(CTXSWFRAME_SIZ, sizeof(label_t));