195 |
int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
196 |
int is_user, int is_softmmu) |
int is_user, int is_softmmu) |
197 |
{ |
{ |
|
target_ulong virt_addr; |
|
198 |
target_phys_addr_t paddr; |
target_phys_addr_t paddr; |
199 |
unsigned long vaddr; |
unsigned long vaddr; |
200 |
int error_code = 0, prot, ret = 0, access_index; |
int error_code = 0, prot, ret = 0, access_index; |
201 |
|
|
202 |
error_code = get_physical_address(env, &paddr, &prot, &access_index, address, rw, is_user); |
error_code = get_physical_address(env, &paddr, &prot, &access_index, address, rw, is_user); |
203 |
if (error_code == 0) { |
if (error_code == 0) { |
204 |
virt_addr = address & TARGET_PAGE_MASK; |
vaddr = address & TARGET_PAGE_MASK; |
205 |
vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1)); |
paddr &= TARGET_PAGE_MASK; |
206 |
|
#ifdef DEBUG_MMU |
207 |
|
printf("Translate at 0x%lx -> 0x%lx, vaddr 0x%lx\n", (long)address, (long)paddr, (long)vaddr); |
208 |
|
#endif |
209 |
ret = tlb_set_page(env, vaddr, paddr, prot, is_user, is_softmmu); |
ret = tlb_set_page(env, vaddr, paddr, prot, is_user, is_softmmu); |
210 |
return ret; |
return ret; |
211 |
} |
} |