Date: Mon, 15 Mar 2004 00:01:14 -0800 (PST) From: Juli Mallett <jmallett@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 49012 for review Message-ID: <200403150801.i2F81Ev8083786@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403150801.i2F81Ev8083786>