--- trunk/src/cpus/memory_sh.c 2007/10/08 16:20:58 32 +++ trunk/src/cpus/memory_sh.c 2007/10/08 16:21:17 34 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Anders Gavare. All rights reserved. + * Copyright (C) 2006-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: memory_sh.c,v 1.12 2006/10/28 04:00:32 debug Exp $ + * $Id: memory_sh.c,v 1.15 2007/01/29 18:06:37 debug Exp $ */ #include @@ -156,6 +156,15 @@ */ if (i >= 0) { int r = random() % SH_N_ITLB_ENTRIES; + + /* NOTE: Make sure that the old mapping for + that itlb entry is invalidated: */ + cpu->invalidate_translation_caches(cpu, + cpu->cd.sh.itlb_hi[r] & ~0xfff, INVALIDATE_VADDR); + + cpu->invalidate_code_translation(cpu, + cpu->cd.sh.utlb_lo[i] & ~0xfff, INVALIDATE_PADDR); + cpu->cd.sh.itlb_hi[r] = cpu->cd.sh.utlb_hi[i]; cpu->cd.sh.itlb_lo[r] = cpu->cd.sh.utlb_lo[i]; }