sh3_switch_setup: make md_upte[] map uarea pages in reverse order so

that mapping for the bottom of the stack (practically the only page we
ever touch) is found on earlier iterations through md_upte[] in the
tlb miss handler.
This commit is contained in:
uwe 2007-03-17 00:56:46 +00:00
parent 125090f30f
commit cfeed1498f
1 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_c.c,v 1.21 2007/03/16 18:31:36 uwe Exp $ */
/* $NetBSD: locore_c.c,v 1.22 2007/03/17 00:56:46 uwe Exp $ */
/*-
* Copyright (c) 1996, 1997, 2002, 2007 The NetBSD Foundation, Inc.
@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: locore_c.c,v 1.21 2007/03/16 18:31:36 uwe Exp $");
__KERNEL_RCSID(0, "$NetBSD: locore_c.c,v 1.22 2007/03/17 00:56:46 uwe Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -240,7 +240,13 @@ sh3_switch_setup(struct lwp *l)
pt_entry_t *pte;
int i;
md_upte = l->l_md.md_upte;
/*
* md_upte has mapping for uarea pages in reverse order so
* that mapping for the bottom of the stack (used more often)
* is found on earlier iterations through md_upte in the tlb
* miss handler.
*/
md_upte = &l->l_md.md_upte[UPAGES-1];
vpn = sh3_trunc_page(l->l_addr);
for (i = 0; i < UPAGES; ++i) {
@ -249,7 +255,7 @@ sh3_switch_setup(struct lwp *l)
md_upte->addr = vpn;
md_upte->data = (*pte & PG_HW_BITS) | PG_D | PG_V;
++md_upte;
--md_upte;
vpn += PAGE_SIZE;
}