25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: memory_sh.c,v 1.18 2007/04/13 07:06:31 debug Exp $ |
* $Id: memory_sh.c,v 1.19 2007/04/16 15:11:31 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
157 |
* If a matching entry wasn't found in the ITLB, but in the |
* If a matching entry wasn't found in the ITLB, but in the |
158 |
* UTLB, then copy it to a random place in the ITLB. |
* UTLB, then copy it to a random place in the ITLB. |
159 |
*/ |
*/ |
160 |
if (i >= 0) { |
if (i >= 0 && !(flags & FLAG_NOEXCEPTIONS)) { |
161 |
int r = random() % SH_N_ITLB_ENTRIES; |
int r = random() % SH_N_ITLB_ENTRIES; |
162 |
|
|
163 |
/* NOTE: Make sure that the old mapping for |
/* NOTE: Make sure that the old mapping for |
243 |
* available as read-only. |
* available as read-only. |
244 |
* 2 Same as 1, but the page is available as read/write. |
* 2 Same as 1, but the page is available as read/write. |
245 |
*/ |
*/ |
246 |
int sh_translate_v2p(struct cpu *cpu, uint64_t vaddr, uint64_t *return_paddr, |
int sh_translate_v2p(struct cpu *cpu, uint64_t vaddr64, uint64_t *return_paddr, |
247 |
int flags) |
int flags) |
248 |
{ |
{ |
249 |
int user = cpu->cd.sh.sr & SH_SR_MD? 0 : 1; |
int user = cpu->cd.sh.sr & SH_SR_MD? 0 : 1; |
250 |
|
uint32_t vaddr = vaddr64; |
|
vaddr = (uint32_t)vaddr; |
|
251 |
|
|
252 |
/* U0/P0: Userspace addresses, or P3: Kernel virtual memory. */ |
/* U0/P0: Userspace addresses, or P3: Kernel virtual memory. */ |
253 |
if (!(vaddr & 0x80000000) || |
if (!(vaddr & 0x80000000) || |