/*1* Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 20092* The President and Fellows of Harvard College.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. Neither the name of the University nor the names of its contributors13* may be used to endorse or promote products derived from this software14* without specific prior written permission.15*16* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _MIPS_SPECIALREG_H_30#define _MIPS_SPECIALREG_H_313233/*34* Coprocessor 0 (system processor) register numbers35*/36#define c0_index $0 /* TLB entry index register */37#define c0_random $1 /* TLB random slot register */38#define c0_entrylo $2 /* TLB entry contents (low-order half) */39/* c0_entrylo0 $2 */ /* MIPS-II and up only */40/* c0_entrylo1 $3 */ /* MIPS-II and up only */41#define c0_context $4 /* some precomputed pagetable stuff */42/* c0_pagemask $5 */ /* MIPS-II and up only */43/* c0_wired $6 */ /* MIPS-II and up only */44#define c0_vaddr $8 /* virtual addr of failing memory access */45#define c0_count $9 /* cycle counter (MIPS-II and up) */46#define c0_entryhi $10 /* TLB entry contents (high-order half) */47#define c0_compare $11 /* on-chip timer control (MIPS-II and up) */48#define c0_status $12 /* processor status register */49#define c0_cause $13 /* exception cause register */50#define c0_epc $14 /* exception PC register */51#define c0_prid $15 /* processor ID register */52/* c0_config $16 */ /* MIPS-II and up only */53/* c0_lladdr $17 */ /* MIPS-II and up only */54/* c0_watchlo $18 */ /* MIPS-II and up only */55/* c0_watchhi $19 */ /* MIPS-II and up only */5657/*58* Mode bits in c0_status59*/60#define CST_IEc 0x00000001 /* current: interrupt enable */61#define CST_KUc 0x00000002 /* current: user mode */62#define CST_IEp 0x00000004 /* previous: interrupt enable */63#define CST_KUp 0x00000008 /* previous: user mode */64#define CST_IEo 0x00000010 /* old: interrupt enable */65#define CST_KUo 0x00000020 /* old: user mode */66#define CST_MODEMASK 0x0000003f /* mask for the above */67#define CST_IRQMASK 0x0000ff00 /* mask for the individual irq enable bits */68#define CST_BEV 0x00400000 /* bootstrap exception vectors flag */6970/*71* Fields of the c0_cause register72*/73#define CCA_UTLB 0x00000001 /* true if UTLB exception (set by our asm) */74#define CCA_CODE 0x0000003c /* EX_foo in trapframe.h */75#define CCA_IRQS 0x0000ff00 /* Currently pending interrupts */76#define CCA_COPN 0x30000000 /* Coprocessor number for EX_CPU */77#define CCA_JD 0x80000000 /* True if exception happened in jump delay */7879#define CCA_CODESHIFT 2 /* shift for CCA_CODE field */8081/*82* Fields of the c0_index register83*/84#define CIN_P 0x80000000 /* nonzero -> TLB probe found nothing */85#define CIN_INDEX 0x00003f00 /* 6-bit index into TLB */8687#define CIN_INDEXSHIFT 8 /* shift for CIN_INDEX field */8889/*90* Fields of the c0_context register91*92* The intent of c0_context is that you can manage virtually-mapped93* page tables in kseg2; then you load the base address of the current94* page table into c0_context. On a TLB miss the failing address is95* masked and shifted and appears in the VSHIFT field, and c0_context96* thereby contains the address of the page table entry you need to97* load into the TLB. This can be used to make TLB refill very fast.98*99* However, in OS/161 we use CTX_PTBASE to hold the current CPU100* number. This (or something like it) is fairly important to have and101* there's no other good place in the chip to put it. See discussions102* elsewhere.103*/104#define CTX_VSHIFT 0x001ffffc /* shifted/masked copy of c0_vaddr */105#define CTX_PTBASE 0xffe00000 /* page table base address */106107#define CTX_PTBASESHIFT 21 /* shift for CTX_PBASE field */108109/*110* Hardwired exception handler addresses.111*/112#define EXADDR_UTLB 0x80000000113#define EXADDR_GENERAL 0x80000080114115116#endif /* _MIPS_SPECIALREG_H_ */117118119