From owner-p4-projects@FreeBSD.ORG Mon Jul 9 17:35:42 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 454EA16A46F; Mon, 9 Jul 2007 17:35:42 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0532416A46B for ; Mon, 9 Jul 2007 17:35:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id D31D613C469 for ; Mon, 9 Jul 2007 17:35:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l69HZfN3084769 for ; Mon, 9 Jul 2007 17:35:41 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l69HZfsh084766 for perforce@freebsd.org; Mon, 9 Jul 2007 17:35:41 GMT (envelope-from gonzo@FreeBSD.org) Date: Mon, 9 Jul 2007 17:35:41 GMT Message-Id: <200707091735.l69HZfsh084766@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 123217 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2007 17:35:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=123217 Change 123217 by gonzo@gonzo_jeeves on 2007/07/09 17:35:07 o Set EXL in status register in exec_setreg to prevent early switch to user mode in cpu_throw. o Get call to exception_restore_registers back. Pointed out by: Neelkanth Natu Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/machdep.c#33 edit .. //depot/projects/mips2/src/sys/mips/mips/swtch.S#13 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/machdep.c#33 (text+ko) ==== @@ -453,6 +453,7 @@ tf->tf_regs[TF_SP] = (register_t)stack; tf->tf_regs[TF_SR] |= MIPS_SR_KSU_USER; tf->tf_regs[TF_SR] |= MIPS_SR_COP_0_BIT; + tf->tf_regs[TF_SR] |= MIPS_SR_EXL; tf->tf_regs[TF_T9] = (register_t)entry; /* Used by PIC code */ } ==== //depot/projects/mips2/src/sys/mips/mips/swtch.S#13 (text+ko) ==== @@ -193,67 +193,7 @@ .set noat lw t3, PC_CURTHREAD(t2) lw k1, TD_FRAME(t3) - - /* - * Load extended registers into some GPRs, and start unrolling - * the trapframe, putting back the extended registers just - * before we need to restore those GPRs. This doesn't do any - * special ordering like the save_registers routine might, - * but it keeps the flow relatively consistent. - */ - lw a1, TF_REG_EPC(k1) - lw a0, TF_REG_MULHI(k1) - lw v1, TF_REG_MULLO(k1) - - lw ra, TF_REG_RA(k1) - lw t9, TF_REG_T9(k1) - lw t8, TF_REG_T8(k1) - lw ta3, TF_REG_TA3(k1) - lw ta2, TF_REG_TA2(k1) - lw ta1, TF_REG_TA1(k1) - lw ta0, TF_REG_TA0(k1) - lw t3, TF_REG_T3(k1) - lw t2, TF_REG_T2(k1) - lw t1, TF_REG_T1(k1) - lw t0, TF_REG_T0(k1) - - lw s0, TF_REG_S0(k1) - lw s1, TF_REG_S1(k1) - lw s2, TF_REG_S2(k1) - lw s3, TF_REG_S3(k1) - lw s4, TF_REG_S4(k1) - lw s5, TF_REG_S5(k1) - lw s6, TF_REG_S6(k1) - lw s7, TF_REG_S7(k1) - lw s8, TF_REG_S8(k1) - - /* - * Brief interlude. - */ - mtc0 a1, MIPS_COP_0_EXC_PC - mthi a0 - mtlo v1 - - /* - * Now restore the registers we used for scratch, and nearby - * GPRs. - */ - lw a3, TF_REG_A3(k1) - lw a2, TF_REG_A2(k1) - lw a1, TF_REG_A1(k1) - lw a0, TF_REG_A0(k1) - lw v1, TF_REG_V1(k1) - lw v0, TF_REG_V0(k1) - lw gp, TF_REG_GP(k1) - lw sp, TF_REG_SP(k1) - - /* - * We are done with the assembler temporary, restore it, and - * return with it disabled, just in case. - */ - .set noat - lw AT, TF_REG_AST(k1) - lw k1, TF_REG_SR(k1) + jal exception_restore_registers + nop eret - mtc0 k1, MIPS_COP_0_STATUS END(fork_trampoline)