diff options
author | Tsuneo Saito <tsnsaito@gmail.com> | 2011-07-22 00:16:30 +0900 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-07-21 19:59:56 +0000 |
commit | b64b64361413808bee8e6213095e2e3a18b3358f (patch) | |
tree | 95da8f5f01383bddd89f0db41fdfacee5f291451 /target-sparc/helper.c | |
parent | 321365ab1734cb151090fc0b5a7bef3b97807115 (diff) |
SPARC64: split cpu_get_phys_page_debug() from cpu_get_phys_page_nofault()
This patch makes cpu_get_phys_page_debug() independent from
cpu_get_phys_page_nofault() in advance of implementing nonfaulting load.
This also modifies cpu_get_phys_page_nofault() to be compiled only on
TARGET_SPARC64 because it is not required on SPARC32.
Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc/helper.c')
-rw-r--r-- | target-sparc/helper.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/target-sparc/helper.c b/target-sparc/helper.c index 9acbcae8c6..cb8d706f78 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -746,6 +746,7 @@ static int cpu_sparc_get_phys_page(CPUState *env, target_phys_addr_t *phys, mmu_idx, &page_size); } +#if defined(TARGET_SPARC64) target_phys_addr_t cpu_get_phys_page_nofault(CPUState *env, target_ulong addr, int mmu_idx) { @@ -760,10 +761,22 @@ target_phys_addr_t cpu_get_phys_page_nofault(CPUState *env, target_ulong addr, return -1; return phys_addr; } +#endif target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr) { - return cpu_get_phys_page_nofault(env, addr, cpu_mmu_index(env)); + target_phys_addr_t phys_addr; + int mmu_idx = cpu_mmu_index(env); + + if (cpu_sparc_get_phys_page(env, &phys_addr, addr, 2, mmu_idx) != 0) { + if (cpu_sparc_get_phys_page(env, &phys_addr, addr, 0, mmu_idx) != 0) { + return -1; + } + } + if (cpu_get_physical_page_desc(phys_addr) == IO_MEM_UNASSIGNED) { + return -1; + } + return phys_addr; } #endif |