Switch amiga to common m68k include files, pcb.h, pmap_motorola.h, and

pte_motrola.h.
This commit is contained in:
mhitch 2007-06-05 04:46:27 +00:00
parent f82d990bc1
commit f8884f1979
5 changed files with 51 additions and 526 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: amiga_init.c,v 1.96 2007/05/31 22:16:48 mhitch Exp $ */
/* $NetBSD: amiga_init.c,v 1.97 2007/06/05 04:46:27 mhitch Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@ -36,7 +36,7 @@
#include "opt_devreload.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.96 2007/05/31 22:16:48 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.97 2007/06/05 04:46:27 mhitch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -580,7 +580,7 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync,
/*
* invalidate remainder of kernel PT
*/
while (pg < (u_int *) (ptpa + ptsize))
while (pg < (pt_entry_t *) (ptpa + ptsize))
*pg++ = PG_NV;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.129 2007/06/01 04:05:05 mhitch Exp $ */
/* $NetBSD: pmap.c,v 1.130 2007/06/05 04:46:27 mhitch Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.129 2007/06/01 04:05:05 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.130 2007/06/05 04:46:27 mhitch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -203,7 +203,7 @@ static void pmap_pvdump(paddr_t);
#define pmap_ste1(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG4_SHIFT1]))
/* XXX assumes physically contiguous ST pages (if more than one) */
#define pmap_ste2(m, v) \
(&((m)->pm_stab[(u_int *)(*(u_int *)pmap_ste1(m,v) & SG4_ADDR1) \
(&((m)->pm_stab[(st_entry_t *)(*(u_int *)pmap_ste1(m,v) & SG4_ADDR1) \
- (m)->pm_stpa + (((v) & SG4_MASK2) >> SG4_SHIFT2)]))
#define pmap_ste_v(m, v) \
(mmutype == MMU_68040 \
@ -276,11 +276,11 @@ struct kpt_page *kpt_pages;
* reference something.
*/
u_int *Sysseg, *Sysseg_pa;
u_int *Sysmap, *Sysptmap;
u_int *Segtabzero, *Segtabzeropa;
pt_entry_t *Sysmap, *Sysptmap;
st_entry_t *Segtabzero, *Segtabzeropa;
vsize_t Sysptsize = VM_KERNEL_PT_PAGES;
pv_entry_t pv_table; /* array of entries, one per page */
struct pv_entry *pv_table; /* array of entries, one per page */
struct pmap kernel_pmap_store;
struct vm_map *pt_map;
@ -337,7 +337,8 @@ void pmap_collect1(pmap_t, paddr_t, paddr_t);
/*
* All those kernel PT submaps that BSD is so fond of
*/
void *CADDR1, *CADDR2, *vmmap;
void *CADDR1, *CADDR2;
char *vmmap;
#define PAGE_IS_MANAGED(pa) (pmap_initialized \
&& vm_physseg_find(atop((pa)), NULL) != -1)
@ -538,7 +539,7 @@ pmap_init()
vm_physmem[bank].end << PGSHIFT, page_cnt << PGSHIFT);
#endif
}
s = AMIGA_STSIZE; /* Segtabzero */
s = M68K_STSIZE; /* Segtabzero */
s += page_cnt * sizeof(struct pv_entry); /* pv table */
s += page_cnt * sizeof(char); /* attribute table */
s = round_page(s);
@ -548,9 +549,9 @@ pmap_init()
panic("pmap_init: can't allocate data structures");
Segtabzero = (u_int *) addr;
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)(void *)&Segtabzeropa);
addr += AMIGA_STSIZE;
addr += M68K_STSIZE;
pv_table = (pv_entry_t) addr;
pv_table = (struct pv_entry *) addr;
addr += page_cnt * sizeof(struct pv_entry);
pmap_attributes = (char *) addr;
@ -581,7 +582,7 @@ pmap_init()
* we need enough pages to map the page tables for each process
* plus some slop.
*/
npg = howmany(((maxproc + 16) * AMIGA_UPTSIZE / NPTEPG), PAGE_SIZE);
npg = howmany(((maxproc + 16) * M68K_MAX_PTSIZE / NPTEPG), PAGE_SIZE);
#ifdef NKPTADD
npg += NKPTADD;
#else
@ -636,8 +637,8 @@ pmap_init()
* Allocate the segment table map and the page table map.
*/
addr = amiga_uptbase;
if (AMIGA_UPTMAXSIZE / AMIGA_UPTSIZE < maxproc) {
s = AMIGA_UPTMAXSIZE;
if (M68K_PTMAXSIZE / M68K_MAX_PTSIZE < maxproc) {
s = M68K_PTMAXSIZE;
/*
* XXX We don't want to hang when we run out of page
@ -645,9 +646,9 @@ pmap_init()
* instead. Note that root could still raise this
* value through sysctl(3).
*/
maxproc = AMIGA_UPTMAXSIZE / AMIGA_UPTSIZE;
maxproc = M68K_PTMAXSIZE / M68K_MAX_PTSIZE;
} else
s = maxproc * AMIGA_UPTSIZE;
s = maxproc * M68K_MAX_PTSIZE;
pt_map = uvm_km_suballoc(kernel_map, &addr, &addr2, s, 0,
true, &pt_map_store);
@ -679,7 +680,7 @@ pmap_init()
}
paddr = (paddr_t)Segtabzeropa;
while (paddr < (paddr_t)Segtabzeropa + AMIGA_STSIZE) {
while (paddr < (paddr_t)Segtabzeropa + M68K_STSIZE) {
pmap_changebit(paddr, PG_CCB, 0);
pmap_changebit(paddr, PG_CI, 1);
paddr += PAGE_SIZE;
@ -879,11 +880,11 @@ pmap_release(pmap)
#endif
if (pmap->pm_ptab) {
pmap_remove(pmap_kernel(), (vaddr_t)pmap->pm_ptab,
(vaddr_t)pmap->pm_ptab + AMIGA_UPTSIZE);
(vaddr_t)pmap->pm_ptab + M68K_MAX_PTSIZE);
uvm_km_pgremove((vaddr_t)pmap->pm_ptab,
(vaddr_t)pmap->pm_ptab + AMIGA_UPTSIZE);
(vaddr_t)pmap->pm_ptab + M68K_MAX_PTSIZE);
uvm_km_free(pt_map, (vaddr_t)pmap->pm_ptab,
AMIGA_UPTSIZE, UVM_KMF_VAONLY);
M68K_MAX_PTSIZE, UVM_KMF_VAONLY);
}
KASSERT(pmap->pm_stab == Segtabzero);
}
@ -958,7 +959,7 @@ pmap_page_protect(pg, prot)
struct vm_page *pg;
vm_prot_t prot;
{
pv_entry_t pv;
struct pv_entry *pv;
int s;
paddr_t pa = VM_PAGE_TO_PHYS(pg);
@ -1113,7 +1114,7 @@ pmap_enter(pmap, va, pa, prot, flags)
*/
if (pmap->pm_ptab == NULL)
pmap->pm_ptab = (pt_entry_t *)
uvm_km_alloc(pt_map, AMIGA_UPTSIZE, 0,
uvm_km_alloc(pt_map, M68K_MAX_PTSIZE, 0,
UVM_KMF_VAONLY |
(can_fail ? UVM_KMF_NOWAIT : UVM_KMF_WAITVA));
if (pmap->pm_ptab == NULL)
@ -1200,7 +1201,7 @@ pmap_enter(pmap, va, pa, prot, flags)
* since pmap_enter can be called at interrupt time.
*/
if (PAGE_IS_MANAGED(pa)) {
pv_entry_t pv, npv;
struct pv_entry *pv, *npv;
int s;
#ifdef DEBUG
@ -1282,18 +1283,18 @@ validate:
const char *s;
struct proc *cp = curproc;
if (va >= amiga_uptbase &&
va < (amiga_uptbase + AMIGA_UPTMAXSIZE))
va < (amiga_uptbase + M68K_PTMAXSIZE))
s = "UPT";
else if (va >= (u_int)Sysmap &&
va < ((u_int)Sysmap + AMIGA_KPTSIZE))
va < ((u_int)Sysmap + M68K_MAX_KPTSIZE))
s = "KPT";
else if (va >= (u_int)pmap->pm_stab &&
va < ((u_int)pmap->pm_stab + AMIGA_STSIZE))
va < ((u_int)pmap->pm_stab + M68K_STSIZE))
s = "KST";
else if (cp &&
va >= (u_int)cp->p_vmspace->vm_map.pmap->pm_stab &&
va < ((u_int)cp->p_vmspace->vm_map.pmap->pm_stab +
AMIGA_STSIZE))
M68K_STSIZE))
s = "UST";
else
s = "other";
@ -1303,8 +1304,8 @@ validate:
}
#endif
if (mmutype == MMU_68040 && pmap == pmap_kernel() && (
(va >= amiga_uptbase && va < (amiga_uptbase + AMIGA_UPTMAXSIZE)) ||
(va >= (u_int)Sysmap && va < ((u_int)Sysmap + AMIGA_KPTSIZE))))
(va >= amiga_uptbase && va < (amiga_uptbase + M68K_PTMAXSIZE)) ||
(va >= (u_int)Sysmap && va < ((u_int)Sysmap + M68K_MAX_KPTSIZE))))
cacheable = false; /* don't cache user page tables */
#endif
npte = (pa & PG_FRAME) | pte_prot(pmap, prot) | PG_V;
@ -1658,7 +1659,7 @@ pmap_collect1(pmap, startpa, endpa)
pt_entry_t *pte;
paddr_t kpa;
#ifdef DEBUG
int *ste;
st_entry_t *ste;
int opmapdebug = 0;
#endif
@ -1680,7 +1681,7 @@ pmap_collect1(pmap, startpa, endpa)
continue;
#ifdef DEBUG
if (pv->pv_va < (vaddr_t)Sysmap ||
pv->pv_va >= (vaddr_t)Sysmap + AMIGA_KPTSIZE)
pv->pv_va >= (vaddr_t)Sysmap + M68K_MAX_KPTSIZE)
printf("collect: kernel PT VA out of range\n");
else
goto ok;
@ -1741,7 +1742,7 @@ ok:
if (*ste)
printf("collect: kernel STE at %p still valid (%x)\n",
ste, *ste);
ste = (int *)&Sysptmap[(u_int *)ste-pmap_ste(pmap_kernel(), 0)];
ste = &Sysptmap[ste - pmap_ste(pmap_kernel(), 0)];
if (*ste)
printf("collect: kernel PTmap at %p still valid (%x)\n",
ste, *ste);
@ -2208,7 +2209,7 @@ pmap_remove_mapping(pmap, va, pte, flags)
ptpmap->pm_stab);
#endif
uvm_km_free(kernel_map,
(vaddr_t)ptpmap->pm_stab, AMIGA_STSIZE,
(vaddr_t)ptpmap->pm_stab, M68K_STSIZE,
UVM_KMF_WIRED);
ptpmap->pm_stab = Segtabzero;
ptpmap->pm_stpa = Segtabzeropa;
@ -2224,10 +2225,6 @@ pmap_remove_mapping(pmap, va, pte, flags)
if (active_user_pmap(ptpmap))
PMAP_ACTIVATE(ptpmap, 1);
}
#ifdef DEBUG
else if (ptpmap->pm_sref < 0)
panic("remove: sref < 0");
#endif
}
#if 0
/*
@ -2317,7 +2314,7 @@ pmap_testbit(pa, bit)
paddr_t pa;
int bit;
{
pv_entry_t pv;
struct pv_entry *pv;
int *pte;
int s;
@ -2357,7 +2354,7 @@ pmap_changebit(pa, bit, setem)
int bit;
bool setem;
{
pv_entry_t pv;
struct pv_entry *pv;
int *pte, npte;
vaddr_t va;
bool firstpage;
@ -2430,11 +2427,11 @@ pmap_enter_ptpage(pmap, va, can_fail)
{
paddr_t ptpa;
struct vm_page *pg;
pv_entry_t pv;
struct pv_entry *pv;
#ifdef M68060
u_int stpa;
#endif
u_int *ste;
st_entry_t *ste;
int s;
#ifdef DEBUG
@ -2452,7 +2449,7 @@ pmap_enter_ptpage(pmap, va, can_fail)
if (pmap->pm_stab == Segtabzero) {
/* XXX Atari uses kernel_map here: */
pmap->pm_stab = (st_entry_t *)
uvm_km_alloc(kernel_map, AMIGA_STSIZE, 0,
uvm_km_alloc(kernel_map, M68K_STSIZE, 0,
UVM_KMF_WIRED | UVM_KMF_ZERO |
(can_fail ? UVM_KMF_NOWAIT : 0));
if (pmap->pm_stab == NULL) {
@ -2470,7 +2467,7 @@ pmap_enter_ptpage(pmap, va, can_fail)
pte = pmap_pte(pmap_kernel(), pmap->pm_stab);
while (stpa < (u_int)pmap->pm_stpa +
AMIGA_STSIZE) {
M68K_STSIZE) {
*pte = (*pte & ~PG_CMASK) | PG_CI;
++pte;
stpa += PAGE_SIZE;
@ -2664,7 +2661,7 @@ pmap_enter_ptpage(pmap, va, can_fail)
*/
#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
u_int *este;
st_entry_t *este;
for (este = &ste[NPTEPG / SG4_LEV3SIZE]; ste < este; ++ste) {
*ste = ptpa | SG_U | SG_RW | SG_V;
@ -2699,7 +2696,7 @@ void
pmap_pvdump(pa)
paddr_t pa;
{
pv_entry_t pv;
struct pv_entry *pv;
printf("pa %lx", pa);
for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next)
@ -2777,7 +2774,7 @@ void
pmap_procwr(p, va, len)
struct proc *p;
vaddr_t va;
u_long len;
size_t len;
{
(void)cachectl1(0x80000004, va, len, p);
}

View File

@ -1,113 +1,3 @@
/* $NetBSD: pcb.h,v 1.15 2007/05/22 20:29:31 mhitch Exp $ */
/* $NetBSD: pcb.h,v 1.16 2007/06/05 04:46:27 mhitch Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*
* from: Utah $Hdr: pcb.h 1.13 89/04/23$
*
* @(#)pcb.h 7.4 (Berkeley) 5/4/91
*/
/*
* Copyright (c) 1988 University of Utah.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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 the University of
* California, Berkeley and its contributors.
* 4. 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.
*
* from: Utah $Hdr: pcb.h 1.13 89/04/23$
*
* @(#)pcb.h 7.4 (Berkeley) 5/4/91
*/
#ifndef _MACHINE_PCB_H_
#define _MACHINE_PCB_H_
#include <machine/frame.h>
/*
* AMIGA process control block
*/
struct pcb
{
short pcb_flags; /* misc. process flags (+0) */
short pcb_ps; /* processor status word (+2) */
int __pcb_spare0;
int pcb_usp; /* user stack pointer (+8) */
int pcb_regs[12]; /* D2-D7, A2-A7 (+C) */
void * pcb_onfault; /* for copyin/out faults */
struct fpframe pcb_fpregs; /* 68881/2 context save area */
int pcb_exec[16]; /* exec structure for core dumps */
};
/* Positions within pcb_regs[] of A6 and A7 (FP and SP). For m68k DDB. */
#define PCB_REGS_FP 10
#define PCB_REGS_SP 11
/* flags (none currently used) */
/*
* The pcb is augmented with machine-dependent additional data for
* core dumps. For the hp300, this includes an HP-UX exec header
* which is dumped for HP-UX processes.
*/
struct md_coredump {
int md_exec[16]; /* exec structure for HP-UX core dumps */
};
#endif /* !_MACHINE_PCB_H_ */
#include <m68k/pcb.h>

View File

@ -1,186 +1,3 @@
/* $NetBSD: pmap.h,v 1.43 2007/03/04 05:59:30 christos Exp $ */
/* $NetBSD: pmap.h,v 1.44 2007/06/05 04:46:27 mhitch Exp $ */
/*
* Copyright (c) 1991 Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*
* @(#)pmap.h 7.6 (Berkeley) 5/10/91
*/
/*
* Copyright (c) 1987 Carnegie-Mellon University
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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 the University of
* California, Berkeley and its contributors.
* 4. 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.
*
* @(#)pmap.h 7.6 (Berkeley) 5/10/91
*/
#ifndef _MACHINE_PMAP_H_
#define _MACHINE_PMAP_H_
/*
* Pmap stuff
*/
struct pmap {
pt_entry_t *pm_ptab; /* KVA of page table */
st_entry_t *pm_stab; /* KVA of segment table */
int pm_stfree; /* 040: free lev2 blocks */
u_int *pm_stpa; /* 040: ST phys addr */
short pm_sref; /* segment table ref count */
short pm_count; /* pmap reference count */
long pm_ptpages; /* more stats: PT pages */
struct simplelock pm_lock; /* lock on pmap */
struct pmap_statistics pm_stats; /* pmap statistics */
};
typedef struct pmap *pmap_t;
/*
* On the 040 we keep track of which level 2 blocks are already in use
* with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB
* (block 31). For convenience, the level 1 table is considered to be
* block 0.
*
* MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed.
* for the kernel and users. 16 implies only the initial "segment table"
* page is used. WARNING: don't change MAXUL2SIZE unless you can allocate
* physically contiguous pages for the ST in pmap.c!
*/
#define MAXKL2SIZE 32
#define MAXUL2SIZE 16
#define l2tobm(n) (1 << (n))
#define bmtol2(n) (ffs(n) - 1)
/*
* Macros for speed
*/
#define PMAP_ACTIVATE(pmap, loadhw) \
{ \
if ((loadhw)) \
loadustp(m68k_btop((paddr_t)(pmap)->pm_stpa)); \
}
/*
* For each struct vm_page, there is a list of all currently valid virtual
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
*/
typedef struct pv_entry {
struct pv_entry *pv_next; /* next pv_entry */
struct pmap *pv_pmap; /* pmap where mapping lies */
vaddr_t pv_va; /* virtual address for mapping */
u_int *pv_ptste; /* non-zero if VA maps a PT page */
struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */
int pv_flags; /* flags */
} *pv_entry_t;
#define PV_CI 0x01 /* all entries must be cache inhibited */
#define PV_PTPAGE 0x02 /* entry maps a page table page */
struct pv_page;
struct pv_page_info {
TAILQ_ENTRY(pv_page) pgi_list;
struct pv_entry *pgi_freelist;
int pgi_nfree;
};
/*
* This is basically:
* ((PAGE_SIZE - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
*/
#define NPVPPG 340
struct pv_page {
struct pv_page_info pvp_pgi;
struct pv_entry pvp_pv[NPVPPG];
};
#ifdef _KERNEL
extern u_int *Sysmap;
extern void * vmmap; /* map for mem, dumps, etc. */
extern struct pmap kernel_pmap_store;
#define pmap_kernel() (&kernel_pmap_store)
#define active_pmap(pm) \
((pm) == pmap_kernel() || \
(pm) == curproc->p_vmspace->vm_map.pmap)
#define active_user_pmap(pm) \
(curproc && \
(pm) != pmap_kernel() && \
(pm) == curproc->p_vmspace->vm_map.pmap)
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
#define pmap_update(pmap) /* nothing (yet) */
static __inline void
pmap_remove_all(struct pmap *pmap)
{
/* Nothing. */
}
vaddr_t pmap_map __P((vaddr_t, paddr_t, paddr_t, int));
void pmap_procwr __P((struct proc *, vaddr_t, u_long));
#define PMAP_NEED_PROCWR
#endif /* _KERNEL */
#endif /* !_MACHINE_PMAP_H_ */
#include <m68k/pmap_motorola.h>

View File

@ -1,182 +1,3 @@
/* $NetBSD: pte.h,v 1.18 2005/12/11 12:16:36 christos Exp $ */
/* $NetBSD: pte.h,v 1.19 2007/06/05 04:46:27 mhitch Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*
* from: Utah $Hdr: pte.h 1.11 89/09/03$
*
* @(#)pte.h 7.3 (Berkeley) 5/8/91
*/
/*
* Copyright (c) 1988 University of Utah.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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 the University of
* California, Berkeley and its contributors.
* 4. 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.
*
* from: Utah $Hdr: pte.h 1.11 89/09/03$
*
* @(#)pte.h 7.3 (Berkeley) 5/8/91
*/
#ifndef _MACHINE_PTE_H_
#define _MACHINE_PTE_H_
/*
* AMIGA hardware segment/page table entries
*/
struct pte {
u_int pte;
};
typedef u_int pt_entry_t; /* Mach page table entry */
struct ste {
u_int ste;
};
typedef u_int st_entry_t; /* segment table entry */
#define PT_ENTRY_NULL ((pt_entry_t *) 0)
#define ST_ENTRY_NULL ((st_entry_t *) 0)
#define SG_V 0x00000002 /* segment is valid */
#define SG_NV 0x00000000
#define SG_PROT 0x00000004 /* access protection mask */
#define SG_RO 0x00000004
#define SG_RW 0x00000000
#define SG_U 0x00000008 /* modified bit (68040) */
#define SG_FRAME 0xffffe000
#define SG_IMASK 0xff000000
#define SG_ISHIFT 24
#define SG_PMASK 0x00ffe000
#define SG_PSHIFT 13
/* 68040 additions */
#define SG4_MASK1 0xfe000000 /* pointer table 1 index mask */
#define SG4_SHIFT1 25
#define SG4_MASK2 0x01fc0000 /* pointer table 2 index mask */
#define SG4_SHIFT2 18
#define SG4_MASK3 0x0003e000 /* page table index mask */
#define SG4_SHIFT3 13
#define SG4_ADDR1 0xfffffe00 /* pointer table address mask */
#define SG4_ADDR2 0xffffff80 /* page table address mask */
#define SG4_LEV1SIZE 128 /* entries in pointer table 1 */
#define SG4_LEV2SIZE 128 /* entries in pointer table 2 */
#define SG4_LEV3SIZE 32 /* entries in page table */
#define PG_V 0x00000001
#define PG_NV 0x00000000
#define PG_PROT 0x00000004
#define PG_U 0x00000008
#define PG_M 0x00000010
#define PG_W 0x00000100
#define PG_RO 0x00000004
#define PG_RW 0x00000000
#define PG_FRAME 0xffffe000
#define PG_CI 0x00000040
#define PG_SHIFT 13
#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT)
/* 68040 additions */
#define PG_CMASK 0x00000060 /* cache mode mask */
#define PG_CWT 0x00000000 /* writethrough caching */
#define PG_CCB 0x00000020 /* copyback caching */
#define PG_CIS 0x00000040 /* cache inhibited serialized */
#define PG_CIN 0x00000060 /* cache inhibited nonserialized */
#define PG_SO 0x00000080 /* supervisor only */
#define AMIGA_040RTSIZE 512 /* root (level 1) table size */
#define AMIGA_040STSIZE 512 /* segment (level 2) table size */
#define AMIGA_040PTSIZE 128 /* page (level 3) table size */
#if 0
#define AMIGA_STSIZE 1024 /* segment table size */
#else
#define AMIGA_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t))
#endif
/*
* AMIGA_MAX_COREUPT maximum number of incore user page tables
* AMIGA_USER_PTSIZE the number of bytes for user pagetables
* AMIGA_PTBASE the VA start of the map from which upt's are allocated
* AMIGA_PTSIZE the size of the map from which upt's are allocated
* AMIGA_KPTSIZE size of kernel page table
* AMIGA_MAX_KPTSIZE the most number of bytes for kpt pages
* AMIGA_MAX_PTSIZE the number of bytes to map everything
*/
#define AMIGA_MAX_COREUPT 1024
#define AMIGA_UPTSIZE roundup(VM_MAXUSER_ADDRESS / NPTEPG, PAGE_SIZE)
#define AMIGA_UPTMAXSIZE \
roundup((AMIGA_MAX_COREUPT * AMIGA_UPTSIZE), PAGE_SIZE)
#define AMIGA_MAX_KPTSIZE \
(AMIGA_MAX_COREUPT * AMIGA_UPTSIZE / NPTEPG)
#define AMIGA_KPTSIZE \
roundup((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / NPTEPG, PAGE_SIZE)
#define AMIGA_MAX_PTSIZE roundup(0xffffffff / NPTEPG, PAGE_SIZE)
/*
* Kernel virtual address to page table entry and to physical address.
*/
#define kvtopte(va) \
(&Sysmap[((unsigned)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT])
#define ptetokv(pt) \
((((u_int *)(pt) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
#define kvtophys(va) \
((kvtopte(va)->pg_pfnum << PGSHIFT) | ((int)(va) & PGOFSET))
#endif /* !_MACHINE_PTE_H_ */
#include <m68k/pte_motorola.h>