Revision 6ebbf390 target-sparc/helper.c
b/target-sparc/helper.c | ||
---|---|---|
49 | 49 |
#if defined(CONFIG_USER_ONLY) |
50 | 50 |
|
51 | 51 |
int cpu_sparc_handle_mmu_fault(CPUState *env, target_ulong address, int rw, |
52 |
int is_user, int is_softmmu)
|
|
52 |
int mmu_idx, int is_softmmu)
|
|
53 | 53 |
{ |
54 | 54 |
if (rw & 2) |
55 | 55 |
env->exception_index = TT_TFAULT; |
... | ... | |
100 | 100 |
|
101 | 101 |
int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot, |
102 | 102 |
int *access_index, target_ulong address, int rw, |
103 |
int is_user)
|
|
103 |
int mmu_idx)
|
|
104 | 104 |
{ |
105 | 105 |
int access_perms = 0; |
106 | 106 |
target_phys_addr_t pde_ptr; |
107 | 107 |
uint32_t pde; |
108 | 108 |
target_ulong virt_addr; |
109 |
int error_code = 0, is_dirty; |
|
109 |
int error_code = 0, is_dirty, is_user;
|
|
110 | 110 |
unsigned long page_offset; |
111 | 111 |
|
112 |
is_user = mmu_idx == MMU_USER_IDX; |
|
112 | 113 |
virt_addr = address & TARGET_PAGE_MASK; |
113 | 114 |
|
114 | 115 |
if ((env->mmuregs[0] & MMU_E) == 0) { /* MMU disabled */ |
... | ... | |
216 | 217 |
|
217 | 218 |
/* Perform address translation */ |
218 | 219 |
int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
219 |
int is_user, int is_softmmu)
|
|
220 |
int mmu_idx, int is_softmmu)
|
|
220 | 221 |
{ |
221 | 222 |
target_phys_addr_t paddr; |
222 | 223 |
target_ulong vaddr; |
223 | 224 |
int error_code = 0, prot, ret = 0, access_index; |
224 | 225 |
|
225 |
error_code = get_physical_address(env, &paddr, &prot, &access_index, address, rw, is_user);
|
|
226 |
error_code = get_physical_address(env, &paddr, &prot, &access_index, address, rw, mmu_idx);
|
|
226 | 227 |
if (error_code == 0) { |
227 | 228 |
vaddr = address & TARGET_PAGE_MASK; |
228 | 229 |
paddr &= TARGET_PAGE_MASK; |
... | ... | |
230 | 231 |
printf("Translate at " TARGET_FMT_lx " -> " TARGET_FMT_plx ", vaddr " |
231 | 232 |
TARGET_FMT_lx "\n", address, paddr, vaddr); |
232 | 233 |
#endif |
233 |
ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu);
|
|
234 |
ret = tlb_set_page_exec(env, vaddr, paddr, prot, mmu_idx, is_softmmu);
|
|
234 | 235 |
return ret; |
235 | 236 |
} |
236 | 237 |
|
... | ... | |
246 | 247 |
// switching to normal mode. |
247 | 248 |
vaddr = address & TARGET_PAGE_MASK; |
248 | 249 |
prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; |
249 |
ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu);
|
|
250 |
ret = tlb_set_page_exec(env, vaddr, paddr, prot, mmu_idx, is_softmmu);
|
|
250 | 251 |
return ret; |
251 | 252 |
} else { |
252 | 253 |
if (rw & 2) |
... | ... | |
484 | 485 |
|
485 | 486 |
int get_physical_address(CPUState *env, target_phys_addr_t *physical, int *prot, |
486 | 487 |
int *access_index, target_ulong address, int rw, |
487 |
int is_user)
|
|
488 |
int mmu_idx)
|
|
488 | 489 |
{ |
490 |
int is_user = mmu_idx == MMU_USER_IDX; |
|
491 |
|
|
489 | 492 |
if (rw == 2) |
490 | 493 |
return get_physical_address_code(env, physical, prot, access_index, address, rw, is_user); |
491 | 494 |
else |
... | ... | |
494 | 497 |
|
495 | 498 |
/* Perform address translation */ |
496 | 499 |
int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
497 |
int is_user, int is_softmmu)
|
|
500 |
int mmu_idx, int is_softmmu)
|
|
498 | 501 |
{ |
499 | 502 |
target_ulong virt_addr, vaddr; |
500 | 503 |
target_phys_addr_t paddr; |
501 | 504 |
int error_code = 0, prot, ret = 0, access_index; |
502 | 505 |
|
503 |
error_code = get_physical_address(env, &paddr, &prot, &access_index, address, rw, is_user);
|
|
506 |
error_code = get_physical_address(env, &paddr, &prot, &access_index, address, rw, mmu_idx);
|
|
504 | 507 |
if (error_code == 0) { |
505 | 508 |
virt_addr = address & TARGET_PAGE_MASK; |
506 | 509 |
vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1)); |
507 | 510 |
#ifdef DEBUG_MMU |
508 | 511 |
printf("Translate at 0x%" PRIx64 " -> 0x%" PRIx64 ", vaddr 0x%" PRIx64 "\n", address, paddr, vaddr); |
509 | 512 |
#endif |
510 |
ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu);
|
|
513 |
ret = tlb_set_page_exec(env, vaddr, paddr, prot, mmu_idx, is_softmmu);
|
|
511 | 514 |
return ret; |
512 | 515 |
} |
513 | 516 |
// XXX |
Also available in: Unified diff