From owner-p4-projects@FreeBSD.ORG Fri Oct 13 14:29:56 2006 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 8DAF516A416; Fri, 13 Oct 2006 14:29:56 +0000 (UTC) X-Original-To: perforce@FreeBSD.org 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 68AF316A412 for ; Fri, 13 Oct 2006 14:29:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 533EA43D46 for ; Fri, 13 Oct 2006 14:29:48 +0000 (GMT) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9DETmOL033118 for ; Fri, 13 Oct 2006 14:29:48 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9DETmux033115 for perforce@freebsd.org; Fri, 13 Oct 2006 14:29:48 GMT (envelope-from gonzo@FreeBSD.org) Date: Fri, 13 Oct 2006 14:29:48 GMT Message-Id: <200610131429.k9DETmux033115@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 107823 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: Fri, 13 Oct 2006 14:29:56 -0000 http://perforce.freebsd.org/chv.cgi?CH=107823 Change 107823 by gonzo@gonzo_hq on 2006/10/13 14:29:01 o More symbols in genassym.c for assembler routines: - PTE for realstack - realstack address - segments boundaries o Wire realstack pages to prevent exceptions in TLBMiss'es generated by userland pages access. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips/genassym.c#3 edit .. //depot/projects/mips2/src/sys/mips/mips/swtch.S#5 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips/genassym.c#3 (text+ko) ==== @@ -59,15 +59,14 @@ #include #include #include -#include -#include -#include -#include #include #include #include +ASSYM(MIPS_KSEG0_START, MIPS_KSEG0_START); +ASSYM(MIPS_KSSEG_START, MIPS_KSSEG_START); +ASSYM(MIPS_PG_G, PG_G); ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); @@ -84,6 +83,9 @@ ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_MD_REGS, offsetof(struct thread, td_md.md_regs)); +ASSYM(TD_MD_REALSTACK, offsetof(struct thread, td_md.md_realstack)); +ASSYM(TD_MD_PTE0, offsetof(struct thread, td_md.md_stack_pte[0])); +ASSYM(TD_MD_PTE1, offsetof(struct thread, td_md.md_stack_pte[1])); ASSYM(FRAME_SIZ, sizeof(struct frame)); ASSYM(FRAME_ZERO, offsetof(struct frame, f_regs[ZERO])); ==== //depot/projects/mips2/src/sys/mips/mips/swtch.S#5 (text+ko) ==== @@ -45,6 +45,66 @@ nop lw t3, 0(sp) addu sp, 8 + + lw t1, TD_MD_PTE0(a1) # a1 = stack_pte[0] + lw t2, TD_MD_PTE1(a1) # a2 = stack_pte[1] + lw v0, TD_MD_REALSTACK(a1) # va = md_realstack + li s0, MIPS_KSSEG_START + blt v0, s0, resume + nop + + and s0, v0, 0x1000 + beq s0, zero, entry0 + nop + + break + +entry0: + mtc0 v0, MIPS_COP_0_TLB_HI # VPN = va + COP0_SYNC + nop + nop + tlbp # probe VPN + COP0_SYNC + nop + nop + mfc0 s0, MIPS_COP_0_TLB_INDEX + nop + bltz s0, entry0set + sll s0, s0, 13 # PAGE_SHIFT + 1 + la s0, MIPS_KSEG0_START(s0) + mtc0 s0, MIPS_COP_0_TLB_HI + COP0_SYNC + mtc0 zero, MIPS_COP_0_TLB_LO0 + COP0_SYNC + mtc0 zero, MIPS_COP_0_TLB_LO1 + COP0_SYNC + nop + nop + tlbwi + COP0_SYNC + nop + nop + mtc0 v0, MIPS_COP_0_TLB_HI # set VPN again + COP0_SYNC +entry0set: + mtc0 zero, MIPS_COP_0_TLB_INDEX # TLB entry #0 + COP0_SYNC + or t1, MIPS_PG_G + mtc0 t1, MIPS_COP_0_TLB_LO0 # upte[0] | PG_G + COP0_SYNC + or t2, MIPS_PG_G + mtc0 t2, MIPS_COP_0_TLB_LO1 # upte[1] | PG_G + COP0_SYNC + nop + nop + tlbwi # set TLB entry #0 + COP0_SYNC + nop + nop +resume: + + .set at lw t2, pcpup .set noat