mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-23 05:25:11 +00:00
target/arm: Cache the Tagged bit for a page in MemTxAttrs
This "bit" is a particular value of the page's MemAttr. Backports commit 337a03f07ff0f9e6295662f4094e03a045b60bdc from qemu
This commit is contained in:
parent
28cd096d67
commit
2ea0b53c1a
|
@ -11798,10 +11798,34 @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
|
|||
/* Definitely a real MMU, not an MPU */
|
||||
|
||||
if (regime_translation_disabled(env, mmu_idx)) {
|
||||
uint64_t hcr;
|
||||
uint8_t memattr;
|
||||
|
||||
/* MMU disabled. */
|
||||
*phys_ptr = address;
|
||||
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
|
||||
*page_size = TARGET_PAGE_SIZE;
|
||||
|
||||
/* Fill in cacheattr a-la AArch64.TranslateAddressS1Off. */
|
||||
hcr = arm_hcr_el2_eff(env);
|
||||
cacheattrs->shareability = 0;
|
||||
if (hcr & HCR_DC) {
|
||||
if (hcr & HCR_DCT) {
|
||||
memattr = 0xf0; /* Tagged, Normal, WB, RWA */
|
||||
} else {
|
||||
memattr = 0xff; /* Normal, WB, RWA */
|
||||
}
|
||||
} else if (access_type == MMU_INST_FETCH) {
|
||||
if (regime_sctlr(env, mmu_idx) & SCTLR_I) {
|
||||
memattr = 0xee; /* Normal, WT, RA, NT */
|
||||
} else {
|
||||
memattr = 0x44; /* Normal, NC, No */
|
||||
}
|
||||
cacheattrs->shareability = 2; /* outer sharable */
|
||||
} else {
|
||||
memattr = 0x00; /* Device, nGnRnE */
|
||||
}
|
||||
cacheattrs->attrs = memattr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,11 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|||
phys_addr &= TARGET_PAGE_MASK;
|
||||
address &= TARGET_PAGE_MASK;
|
||||
}
|
||||
/* Notice and record tagged memory. */
|
||||
if (cpu_isar_feature(aa64_mte, cpu) && cacheattrs.attrs == 0xf0) {
|
||||
arm_tlb_mte_tagged(&attrs) = true;
|
||||
}
|
||||
|
||||
tlb_set_page_with_attrs(cs, address, phys_addr, attrs,
|
||||
prot, mmu_idx, page_size);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue