update PMAP_PREFER
This commit is contained in:
parent
f6925cfbf3
commit
2de7b2e5cb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.h,v 1.17 1995/07/05 18:45:46 pk Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.18 1996/02/28 22:44:33 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -166,7 +166,7 @@ extern vm_offset_t vm_first_phys, vm_num_phys;
|
||||
|
||||
void pmap_bootstrap __P((int nmmu, int nctx, int nregion));
|
||||
int pmap_count_ptes __P((struct pmap *));
|
||||
vm_offset_t pmap_prefer __P((vm_offset_t, vm_offset_t));
|
||||
void pmap_prefer __P((vm_offset_t, vm_offset_t *));
|
||||
int pmap_pa_exists __P((vm_offset_t));
|
||||
int pmap_dumpsize __P((void));
|
||||
int pmap_dumpmmu __P((int (*)__P((dev_t, daddr_t, caddr_t, size_t)),
|
||||
@ -178,7 +178,7 @@ int pmap_dumpmmu __P((int (*)__P((dev_t, daddr_t, caddr_t, size_t)),
|
||||
|
||||
#define PMAP_ACTIVATE(pmap, pcb, iscurproc)
|
||||
#define PMAP_DEACTIVATE(pmap, pcb)
|
||||
#define PMAP_PREFER(pa, va) pmap_prefer((pa), (va))
|
||||
#define PMAP_PREFER(fo, ap) pmap_prefer((fo), (ap))
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.50 1996/02/12 21:15:37 christos Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.51 1996/02/28 22:44:42 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -3612,50 +3612,24 @@ pmap_count_ptes(pm)
|
||||
}
|
||||
|
||||
/*
|
||||
* Find first virtual address >= va that doesn't cause
|
||||
* a cache alias on physical address pa.
|
||||
* Find first virtual address >= *va that is
|
||||
* least likely to cause cache aliases.
|
||||
* (This will just seg-align mappings.)
|
||||
*/
|
||||
vm_offset_t
|
||||
pmap_prefer(pa, va)
|
||||
register vm_offset_t pa;
|
||||
register vm_offset_t va;
|
||||
void
|
||||
pmap_prefer(foff, va)
|
||||
register vm_offset_t foff;
|
||||
register vm_offset_t *va;
|
||||
{
|
||||
register struct pvlist *pv;
|
||||
register long m, d;
|
||||
register long d, m;
|
||||
|
||||
m = CACHE_ALIAS_DIST;
|
||||
if (m == 0) /* m=0 => no cache aliasing */
|
||||
return (va);
|
||||
return;
|
||||
|
||||
if (pa == (vm_offset_t)-1) {
|
||||
/*
|
||||
* Do not consider physical address. Just return
|
||||
* a cache aligned address.
|
||||
*/
|
||||
if (VA_INHOLE(va))
|
||||
va = MMU_HOLE_END;
|
||||
|
||||
/* XXX - knowledge about `exec' formats; can we get by without? */
|
||||
va -= USRTEXT;
|
||||
va = (va + m - 1) & ~(m - 1);
|
||||
return (va + USRTEXT);
|
||||
}
|
||||
|
||||
if ((pa & (PMAP_TNC & ~PMAP_NC)) || !managed(pa))
|
||||
return va;
|
||||
|
||||
pv = pvhead(pa);
|
||||
if (pv->pv_pmap == NULL) {
|
||||
/* Unusable, tell caller to try another one */
|
||||
return (vm_offset_t)-1;
|
||||
}
|
||||
|
||||
d = (long)(pv->pv_va & (m - 1)) - (long)(va & (m - 1));
|
||||
if (d < 0)
|
||||
va += m;
|
||||
va += d;
|
||||
|
||||
return va;
|
||||
d = foff - *va;
|
||||
d &= (m - 1)
|
||||
*va += d;
|
||||
}
|
||||
|
||||
pmap_redzone()
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.h,v 1.13 1995/04/10 12:42:29 mycroft Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.14 1996/02/28 22:50:43 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
@ -59,6 +59,9 @@ struct pmap kernel_pmap_store;
|
||||
#define PMAP_DEACTIVATE(pmap, pcbp) \
|
||||
pmap_deactivate(pmap, pcbp)
|
||||
|
||||
extern void pmap_prefer(vm_offset_t, vm_offset_t *);
|
||||
#define PMAP_PREFER(fo, ap) pmap_prefer((fo), (ap))
|
||||
|
||||
/* XXX - Need a (silly) #define get code in kern_sysctl.c */
|
||||
extern segsz_t pmap_resident_pages(pmap_t);
|
||||
#define pmap_resident_count(pmap) pmap_resident_pages(pmap)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap3.h,v 1.13 1995/04/10 12:42:29 mycroft Exp $ */
|
||||
/* $NetBSD: pmap3.h,v 1.14 1996/02/28 22:50:43 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
@ -59,6 +59,9 @@ struct pmap kernel_pmap_store;
|
||||
#define PMAP_DEACTIVATE(pmap, pcbp) \
|
||||
pmap_deactivate(pmap, pcbp)
|
||||
|
||||
extern void pmap_prefer(vm_offset_t, vm_offset_t *);
|
||||
#define PMAP_PREFER(fo, ap) pmap_prefer((fo), (ap))
|
||||
|
||||
/* XXX - Need a (silly) #define get code in kern_sysctl.c */
|
||||
extern segsz_t pmap_resident_pages(pmap_t);
|
||||
#define pmap_resident_count(pmap) pmap_resident_pages(pmap)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.c,v 1.59 1996/02/12 21:21:15 christos Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.60 1996/02/28 22:51:05 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Gordon W. Ross
|
||||
@ -110,6 +110,8 @@ struct pmap_stats {
|
||||
int ps_changewire; /* useless wiring changes */
|
||||
int ps_npg_prot_all; /* of active pages protected */
|
||||
int ps_npg_prot_actual; /* pages actually affected */
|
||||
int ps_vac_uncached; /* non-cached due to bad alias */
|
||||
int ps_vac_recached; /* re-cached when bad alias gone */
|
||||
} pmap_stats;
|
||||
|
||||
struct context_state {
|
||||
@ -1279,6 +1281,7 @@ pv_link(pmap, pa, va, flags)
|
||||
if (BADALIAS(va, npv->pv_va)) {
|
||||
head->pv_flags |= PV_NC;
|
||||
pv_changepte(head, PG_NC, 0);
|
||||
pmap_stats.ps_vac_uncached++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1370,6 +1373,7 @@ pv_unlink(pmap, pa, va)
|
||||
return;
|
||||
head->pv_flags &= ~PV_NC;
|
||||
pv_changepte(head, 0, PG_NC);
|
||||
pmap_stats.ps_vac_recached++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3196,6 +3200,26 @@ pmap_collect(pmap)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Find first virtual address >= *va that is
|
||||
* least likely to cause cache aliases.
|
||||
* (This will just seg-align mappings.)
|
||||
*/
|
||||
void
|
||||
pmap_prefer(fo, va)
|
||||
register vm_offset_t fo;
|
||||
register vm_offset_t *va;
|
||||
{
|
||||
register long d;
|
||||
|
||||
d = fo - *va;
|
||||
d &= SEGOFSET;
|
||||
*va += d;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper functions for changing unloaded PMEGs
|
||||
*/
|
||||
static int temp_seg_inuse;
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user