Add a hack at the end of setregs() which works around a bug which can,

under some circumstances, leave turds in the icache following vmspace
teardown.

It's not yet clear if this is a pmap bug or a toolchain problem since
the hack is unecessary when the kernel is compiled with -O0. Of course
that could just be masking the problem due to increased icache pressure...
This commit is contained in:
scw 2002-12-06 10:22:15 +00:00
parent f051850107
commit 57c2c2b87f
1 changed files with 17 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.8 2002/10/31 14:20:39 scw Exp $ */
/* $NetBSD: process_machdep.c,v 1.9 2002/12/06 10:22:15 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -44,6 +44,7 @@
#include <sys/user.h>
#include <machine/cpu.h>
#include <machine/cacheops.h>
#include <machine/pcb.h>
#include <machine/frame.h>
#include <machine/reg.h>
@ -110,6 +111,21 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack)
sh5_fprestore(SH5_CONREG_USR_FPRS_MASK << SH5_CONREG_USR_FPRS_SHIFT,
&p->p_addr->u_pcb);
/*
* XXX: This is a disgusting hack to work-around an unknown
* problem with the pmap which results in stale icache data
* during process exec.
*
* It seems that tearing down the original vmspace can, under some
* circumstances, leave turds in the icache, leading to random
* lossage in the new executable.
*
* Until such time as the cause is determined and fixed, this works
* around the problem.
*/
if (__cpu_cache_iinv_all)
__cpu_cache_iinv_all();
}
int