PERFORCE change 107824 for review
M. Warner Losh
imp at bsdimp.com
Mon Oct 16 15:27:42 PDT 2006
In message: <200610131444.k9DEi74J035961 at repoman.freebsd.org>
Oleksandr Tymoshenko <gonzo at freebsd.org> writes:
: http://perforce.freebsd.org/chv.cgi?CH=107824
:
: Change 107824 by gonzo at gonzo_hq on 2006/10/13 14:43:46
:
: o Tweak exception handlers to conform new pmap model. Kernel map
: works fine, userland still in action.
Did this code come from the NetBSD code, or was it just the idea?
Seems odd that these small changes would require adding a NetBSD
license...
Warner
: Affected files ...
:
: .. //depot/projects/mips2/src/sys/mips/mips/exception.S#11 edit
:
: Differences ...
:
: ==== //depot/projects/mips2/src/sys/mips/mips/exception.S#11 (text+ko) ====
:
: @@ -23,9 +23,128 @@
: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
: * SUCH DAMAGE.
: *
: - * $P4: //depot/projects/mips2/src/sys/mips/mips/exception.S#10 $
: + * $P4: //depot/projects/mips2/src/sys/mips/mips/exception.S#11 $
: + */
: +
: +/* $NetBSD: mipsX_subr.S,v 1.19 2005/12/11 12:18:09 christos Exp $ */
: +
: +/*
: + * Copyright 2002 Wasabi Systems, Inc.
: + * All rights reserved.
: + *
: + * Written by Simon Burge for Wasabi Systems, Inc.
: + *
: + * Redistribution and use in source and binary forms, with or without
: + * modification, are permitted provided that the following conditions
: + * are met:
: + * 1. Redistributions of source code must retain the above copyright
: + * notice, this list of conditions and the following disclaimer.
: + * 2. Redistributions in binary form must reproduce the above copyright
: + * notice, this list of conditions and the following disclaimer in the
: + * documentation and/or other materials provided with the distribution.
: + * 3. All advertising materials mentioning features or use of this software
: + * must display the following acknowledgement:
: + * This product includes software developed for the NetBSD Project by
: + * Wasabi Systems, Inc.
: + * 4. The name of Wasabi Systems, Inc. may not be used to endorse
: + * or promote products derived from this software without specific prior
: + * written permission.
: + *
: + * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
: + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
: + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
: + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
: + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
: + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
: + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
: + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
: + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
: + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
: + * POSSIBILITY OF SUCH DAMAGE.
: + */
: +
: +/*
: + * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
: + * All rights reserved.
: + *
: + * Redistribution and use in source and binary forms, with or without
: + * modification, are permitted provided that the following conditions
: + * are met:
: + * 1. Redistributions of source code must retain the above copyright
: + * notice, this list of conditions and the following disclaimer.
: + * 2. Redistributions in binary form must reproduce the above copyright
: + * notice, this list of conditions and the following disclaimer in the
: + * documentation and/or other materials provided with the distribution.
: + * 3. All advertising materials mentioning features or use of this software
: + * must display the following acknowledgement:
: + * This product includes software developed by Jonathan R. Stone for
: + * the NetBSD Project.
: + * 4. The name of the author may not be used to endorse or promote products
: + * derived from this software without specific prior written permission.
: + *
: + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
: + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
: + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
: + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
: + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
: + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
: + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
: + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
: + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
: + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
: + * SUCH DAMAGE.
: + */
: +
: +/*
: + * Copyright (c) 1992, 1993
: + * The Regents of the University of California. All rights reserved.
: + *
: + * This code is derived from software contributed to Berkeley by
: + * Digital Equipment Corporation and Ralph Campbell.
: + *
: + * Redistribution and use in source and binary forms, with or without
: + * modification, are permitted provided that the following conditions
: + * are met:
: + * 1. Redistributions of source code must retain the above copyright
: + * notice, this list of conditions and the following disclaimer.
: + * 2. Redistributions in binary form must reproduce the above copyright
: + * notice, this list of conditions and the following disclaimer in the
: + * documentation and/or other materials provided with the distribution.
: + * 3. Neither the name of the University nor the names of its contributors
: + * may be used to endorse or promote products derived from this software
: + * without specific prior written permission.
: + *
: + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
: + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
: + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
: + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
: + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
: + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
: + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
: + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
: + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
: + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
: + * SUCH DAMAGE.
: + *
: + * Copyright (C) 1989 Digital Equipment Corporation.
: + * Permission to use, copy, modify, and distribute this software and
: + * its documentation for any purpose and without fee is hereby granted,
: + * provided that the above copyright notice appears in all copies.
: + * Digital Equipment Corporation makes no representations about the
: + * suitability of this software for any purpose. It is provided "as is"
: + * without express or implied warranty.
: + *
: + * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/loMem.s,
: + * v 1.1 89/07/11 17:55:04 nelson Exp SPRITE (DECWRL)
: + * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsm.s,
: + * v 9.2 90/01/29 18:00:39 shirriff Exp SPRITE (DECWRL)
: + * from: Header: /sprite/src/kernel/vm/ds3100.md/vmPmaxAsm.s,
: + * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL)
: + *
: + * @(#)locore.s 8.5 (Berkeley) 1/4/94
: */
:
: +
: #include "opt_ddb.h"
:
: #include <machine/asm.h>
: @@ -201,38 +320,31 @@
: LEAF(TLBMissVector)
: .set noat
:
: - mfc0 k0, MIPS_COP_0_BAD_VADDR
: + mfc0 k0, MIPS_COP_0_BAD_VADDR # k0=badaddr
: + bltz k0, 5f # k0<0 -> 5f (kernel fault)
: nop
: - bltz k0, 5f
: - nop
:
: +6:
: /* Userland */
: -6:
: - /* XXX We should switch stack elsewhere. */
: - subu sp, sp, TF_SIZE
: - lw k1, PC_CURTHREAD(t2)
: - lw k1, TD_KSTACK(k1)
: - subu k1, k1, TF_SIZE
: + lui k1, %hi(segtab_active)
: + lw k1, %lo(segtab_active)(k1)
: + srl k0, 20
: + andi k0, k0, 0xffc
: + addu k1, k0, k1
: + lw k1, 0(k1)
:
: - la k0, 4f
: - j exception_save_registers
: - nop
: + mfc0 k0, MIPS_COP_0_BAD_VADDR # k0=bad address (again)
: + beq k1, zero, 7f # ==0 -- no page table
: + srl k0, 10 # k0=VPN (aka va>>10)
:
: - move sp, k1
: -
: -4: mfc0 a1, MIPS_COP_0_CAUSE
: - mfc0 a2, MIPS_COP_0_BAD_VADDR
: - jal trap
: - move a0, k1
: + break # XXX: Not ready yet
:
: - move k1, sp
: - jal exception_restore_registers
: - nop
: -
: - addu sp, sp, TF_SIZE
: eret
: 5:
: - j kernfault
: + j KVATLBMiss
: + nop
: +7: j GenericException
: + nop
:
: VEND(TLBMissVector)
: .data
: @@ -240,7 +352,8 @@
: .text
:
:
: -kernfault:
: +LEAF(KVATLBMiss)
: + .set noat
: /*
: * Shift right logical to get a page index, but leaving
: * enough bits to index an array of 64 bit values, plus
: @@ -281,32 +394,17 @@
:
: tlbp
:
: - mfc0 k1, MIPS_COP_0_BAD_VADDR
: - srl k1, PAGE_SHIFT
: - andi k1, k1, 1
: - bne k1, zero, 2f
: + mfc0 k0, MIPS_COP_0_TLB_INDEX
: + nop
: + bltz k0, 2f
: nop
:
: - mfc0 k1, MIPS_COP_0_TLB_LO0
: - b 3f
: - nop
: + tlbwi
: + eret
: 2:
: - mfc0 k1, MIPS_COP_0_TLB_LO1
: - nop
: -3:
: - andi k1, 2
: - bne k1, zero, 4f
: - nop
: - /*
: - * The PTE that triggered the fault is not valid. We need to do a
: - * "real" page fault.
: - *
: - * XXX Maybe we should just ignore the fact that it's not valid here
: - * and just let the TLB Invalid Exception (vector 0x80000180) handler
: - * deal with it.
: - */
: - j 6b
: - nop
: + tlbwr
: + eret
: +
:
: 4:
: mfc0 k0, MIPS_COP_0_TLB_INDEX
: @@ -322,6 +420,7 @@
:
: eret
: .set at
: +END(KVATLBMiss)
:
:
: LEAF(XTLBMissVector)
:
More information about the p4-projects
mailing list