diff options
author | Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br> | 2021-07-23 14:56:25 -0300 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-08-27 12:41:13 +1000 |
commit | 5118ebe8396d2b98217b3d4719e3a420dfb0a929 (patch) | |
tree | d8640fe59ca6310a74d8aa477ec048ea1c9777f2 /target/ppc/internal.h | |
parent | a4e4c4b45f39082f581e8bf71fb1cb06bdb8a4c6 (diff) |
target/ppc: divided mmu_helper.c in 2 files
Divided mmu_helper.c in 2 files, functions inside #ifdef CONFIG_SOFTMMU
stayed in mmu_helper.c, other functions moved to mmu_common.c. Updated
meson.build to compile mmu_common.c and only compile mmu_helper.c when
CONFIG_TCG is set.
Moved function declarations, #define and structs used by both files to
internal.h except for functions that use structures defined in cpu.h,
those were moved to cpu.h.
Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Message-Id: <20210723175627.72847-2-lucas.araujo@eldorado.org.br>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target/ppc/internal.h')
-rw-r--r-- | target/ppc/internal.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/target/ppc/internal.h b/target/ppc/internal.h index f1fd3c8d04..b71406fa46 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -245,4 +245,43 @@ static inline int prot_for_access_type(MMUAccessType access_type) g_assert_not_reached(); } +/* PowerPC MMU emulation */ + +typedef struct mmu_ctx_t mmu_ctx_t; +bool ppc_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type, + hwaddr *raddrp, int *psizep, int *protp, + int mmu_idx, bool guest_visible); +int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx, + target_ulong eaddr, + MMUAccessType access_type, int type, + int mmu_idx); +/* Software driven TLB helpers */ +int ppc6xx_tlb_getnum(CPUPPCState *env, target_ulong eaddr, + int way, int is_code); +/* Context used internally during MMU translations */ +struct mmu_ctx_t { + hwaddr raddr; /* Real address */ + hwaddr eaddr; /* Effective address */ + int prot; /* Protection bits */ + hwaddr hash[2]; /* Pagetable hash values */ + target_ulong ptem; /* Virtual segment ID | API */ + int key; /* Access key */ + int nx; /* Non-execute area */ +}; + +/* Common routines used by software and hardware TLBs emulation */ +static inline int pte_is_valid(target_ulong pte0) +{ + return pte0 & 0x80000000 ? 1 : 0; +} + +static inline void pte_invalidate(target_ulong *pte0) +{ + *pte0 &= ~0x80000000; +} + +#define PTE_PTEM_MASK 0x7FFFFFBF +#define PTE_CHECK_MASK (TARGET_PAGE_MASK | 0x7B) + + #endif /* PPC_INTERNAL_H */ |