Search
lxdream.org :: lxdream/src/sh4/mmu.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/mmu.c
changeset 597:87cbdf62aa35
prev586:2a3ba82cf243
next669:ab344e42bca9
author nkeynes
date Tue Jan 22 09:45:21 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Initial VMA support for the SH4 disassembly
file annotate diff log raw
1.1 --- a/src/sh4/mmu.c Tue Jan 15 20:50:23 2008 +0000
1.2 +++ b/src/sh4/mmu.c Tue Jan 22 09:45:21 2008 +0000
1.3 @@ -849,6 +849,41 @@
1.4 }
1.5 }
1.6
1.7 +/**
1.8 + * Translate address for disassembly purposes (ie performs an instruction
1.9 + * lookup) - does not raise exceptions or modify any state, and ignores
1.10 + * protection bits. Returns the translated address, or MMU_VMA_ERROR
1.11 + * on translation failure.
1.12 + */
1.13 +sh4addr_t mmu_vma_to_phys_disasm( sh4vma_t vma )
1.14 +{
1.15 + if( vma & 0x80000000 ) {
1.16 + if( vma < 0xC0000000 ) {
1.17 + /* P1, P2 and P4 regions are pass-through (no translation) */
1.18 + return VMA_TO_EXT_ADDR(vma);
1.19 + } else if( vma >= 0xE0000000 && vma < 0xFFFFFF00 ) {
1.20 + /* Not translatable */
1.21 + return MMU_VMA_ERROR;
1.22 + }
1.23 + }
1.24 +
1.25 + uint32_t mmucr = MMIO_READ(MMU,MMUCR);
1.26 + if( (mmucr & MMUCR_AT) == 0 ) {
1.27 + return VMA_TO_EXT_ADDR(vma);
1.28 + }
1.29 +
1.30 + int entryNo = mmu_itlb_lookup_vpn( vma );
1.31 + if( entryNo == -2 ) {
1.32 + entryNo = mmu_itlb_lookup_vpn_asid( vma );
1.33 + }
1.34 + if( entryNo < 0 ) {
1.35 + return MMU_VMA_ERROR;
1.36 + } else {
1.37 + return (mmu_itlb[entryNo].ppn & mmu_itlb[entryNo].mask) |
1.38 + (vma & (~mmu_itlb[entryNo].mask));
1.39 + }
1.40 +}
1.41 +
1.42 gboolean sh4_flush_store_queue( sh4addr_t addr )
1.43 {
1.44 uint32_t mmucr = MMIO_READ(MMU,MMUCR);
.