NetBSD/sys/arch/mips/include/pte.h
jonathan 6ac1fdec40 Merge mips1 and mips3 pte/pmap code, pass 0;
* Move mips-I pte (TLBlo) definitions from pmax/include/pte.h
      to mips/include/mips1_pte.h

    * Move mips-III pte (TLBlo) definitions from  pica/include/pte.h
      to mips/include/mips3_pte.h

    * Add new mips/include/pte.h, which includes exactly one of
      mips1_pte.h or mips3_pte.h (which still have namespace collisions),
      depending on "options MIPS1" or "options MIPS3". (hack).
      Move soft kvtopte(), ptetovk() definitions to mips/include/pte.h

    * Add macro PTE_TO_PADDR() to hide the different hardware TLB formats
      when mapping from pte to physical address.

   * Add macro PTE_READONLY() to hide lack of SW read-only bit in mips-III
     tlb. (mips1 pmap uses a sw bit in the PTE, mips3 looks up RO bit in
     the kernel pmap.)

   * Use macros (not direct TLB frobbing) in mips/trap.c, to make it
     mips-1/mips-III indepenndet.

    * Change {pmax,pica}/include/pte.h to just do #include <mips/pte.h>.
1996-10-13 09:28:53 +00:00

47 lines
1.3 KiB
C

/* $NetBSD: pte.h,v 1.1 1996/10/13 09:28:56 jonathan Exp $ */
/*
* Copyright 1996 The Board of Trustees of The Leland Stanford
* Junior University. All Rights Reserved.
*
* 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 appear in all copies. Stanford University
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*/
#ifndef __MIPS_PTE_H__
#define __MIPS_PTE_H__
#if defined(MIPS1) && defined(MIPS3)
#error Cannot yet upport both "MIPS1" (r2000 family) and "MIP3" (r4000 family) in the same kernel.
#endif
#ifdef MIPS1
#include <mips/mips1_pte.h>
#endif
#ifdef MIPS3
#include <mips/mips3_pte.h>
#endif
#if defined(_KERNEL) && !defined(_LOCORE)
/*
* Kernel virtual address to page table entry and visa versa.
*/
#define kvtopte(va) \
(Sysmap + (((vm_offset_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT))
#define ptetokv(pte) \
((((pt_entry_t *)(pte) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
extern pt_entry_t *Sysmap; /* kernel pte table */
extern u_int Sysmapsize; /* number of pte's in Sysmap */
#endif /* defined(_KERNEL) && !defined(_LOCORE) */
#endif /* __MIPS_PTE_H__ */