Commit 9e31b9e28a894c582b8ecaeb2d40e55e407aacd0
1 parent
d0dc7dc3
Fix remote debugger memory access problems reported by Matthias Stein
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3982 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
12 additions
and
7 deletions
target-sparc/cpu.h
| ... | ... | @@ -338,20 +338,23 @@ void cpu_check_irqs(CPUSPARCState *env); |
| 338 | 338 | #ifdef TARGET_SPARC64 |
| 339 | 339 | #define MMU_MODE2_SUFFIX _hypv |
| 340 | 340 | #endif |
| 341 | -#define MMU_USER_IDX 0 | |
| 341 | +#define MMU_USER_IDX 0 | |
| 342 | +#define MMU_KERNEL_IDX 1 | |
| 343 | +#define MMU_HYPV_IDX 2 | |
| 344 | + | |
| 342 | 345 | static inline int cpu_mmu_index (CPUState *env) |
| 343 | 346 | { |
| 344 | 347 | #if defined(CONFIG_USER_ONLY) |
| 345 | - return 0; | |
| 348 | + return MMU_USER_IDX; | |
| 346 | 349 | #elif !defined(TARGET_SPARC64) |
| 347 | 350 | return env->psrs; |
| 348 | 351 | #else |
| 349 | 352 | if (!env->psrs) |
| 350 | - return 0; | |
| 353 | + return MMU_USER_IDX; | |
| 351 | 354 | else if ((env->hpstate & HS_PRIV) == 0) |
| 352 | - return 1; | |
| 355 | + return MMU_KERNEL_IDX; | |
| 353 | 356 | else |
| 354 | - return 2; | |
| 357 | + return MMU_HYPV_IDX; | |
| 355 | 358 | #endif |
| 356 | 359 | } |
| 357 | 360 | ... | ... |
target-sparc/translate.c
| ... | ... | @@ -4194,8 +4194,10 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr) |
| 4194 | 4194 | target_phys_addr_t phys_addr; |
| 4195 | 4195 | int prot, access_index; |
| 4196 | 4196 | |
| 4197 | - if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 2, 0) != 0) | |
| 4198 | - if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 0, 0) != 0) | |
| 4197 | + if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 2, | |
| 4198 | + MMU_KERNEL_IDX) != 0) | |
| 4199 | + if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, | |
| 4200 | + 0, MMU_KERNEL_IDX) != 0) | |
| 4199 | 4201 | return -1; |
| 4200 | 4202 | if (cpu_get_physical_page_desc(phys_addr) == IO_MEM_UNASSIGNED) |
| 4201 | 4203 | return -1; | ... | ... |