1 |
/* |
/* |
2 |
* Copyright (C) 2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2006-2007 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $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 $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
156 |
*/ |
*/ |
157 |
if (i >= 0) { |
if (i >= 0) { |
158 |
int r = random() % SH_N_ITLB_ENTRIES; |
int r = random() % SH_N_ITLB_ENTRIES; |
159 |
|
|
160 |
|
/* NOTE: Make sure that the old mapping for |
161 |
|
that itlb entry is invalidated: */ |
162 |
|
cpu->invalidate_translation_caches(cpu, |
163 |
|
cpu->cd.sh.itlb_hi[r] & ~0xfff, INVALIDATE_VADDR); |
164 |
|
|
165 |
|
cpu->invalidate_code_translation(cpu, |
166 |
|
cpu->cd.sh.utlb_lo[i] & ~0xfff, INVALIDATE_PADDR); |
167 |
|
|
168 |
cpu->cd.sh.itlb_hi[r] = cpu->cd.sh.utlb_hi[i]; |
cpu->cd.sh.itlb_hi[r] = cpu->cd.sh.utlb_hi[i]; |
169 |
cpu->cd.sh.itlb_lo[r] = cpu->cd.sh.utlb_lo[i]; |
cpu->cd.sh.itlb_lo[r] = cpu->cd.sh.utlb_lo[i]; |
170 |
} |
} |