mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 18:46:47 +00:00
cpu-defs.h: Document CPUIOTLBEntry 'addr' field
The 'addr' field in the CPUIOTLBEntry struct has a rather non-obvious use; add a comment documenting it (reverse-engineered from what the code that sets it is doing). Backports commit ace4109011b4912b24e76f152e2cf010e78819c5 from qemu
This commit is contained in:
parent
7a6ae26346
commit
61a7ac6948
|
@ -230,6 +230,18 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
|
||||||
env->iotlb_v[mmu_idx][vidx] = env->iotlb[mmu_idx][index];
|
env->iotlb_v[mmu_idx][vidx] = env->iotlb[mmu_idx][index];
|
||||||
|
|
||||||
/* refill the tlb */
|
/* refill the tlb */
|
||||||
|
/*
|
||||||
|
* At this point iotlb contains a physical section number in the lower
|
||||||
|
* TARGET_PAGE_BITS, and either
|
||||||
|
* + the ram_addr_t of the page base of the target RAM (if NOTDIRTY or ROM)
|
||||||
|
* + the offset within section->mr of the page base (otherwise)
|
||||||
|
* We subtract the vaddr (which is page aligned and thus won't
|
||||||
|
* disturb the low bits) to give an offset which can be added to the
|
||||||
|
* (non-page-aligned) vaddr of the eventual memory access to get
|
||||||
|
* the MemoryRegion offset for the access. Note that the vaddr we
|
||||||
|
* subtract here is that of the page base, and not the same as the
|
||||||
|
* vaddr we add back in io_readx()/io_writex()/get_page_addr_code().
|
||||||
|
*/
|
||||||
env->iotlb[mmu_idx][index].addr = iotlb - vaddr;
|
env->iotlb[mmu_idx][index].addr = iotlb - vaddr;
|
||||||
env->iotlb[mmu_idx][index].attrs = attrs;
|
env->iotlb[mmu_idx][index].attrs = attrs;
|
||||||
te->addend = (uintptr_t)(addend - vaddr);
|
te->addend = (uintptr_t)(addend - vaddr);
|
||||||
|
|
|
@ -129,6 +129,15 @@ QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
|
||||||
* structs into one.)
|
* structs into one.)
|
||||||
*/
|
*/
|
||||||
typedef struct CPUIOTLBEntry {
|
typedef struct CPUIOTLBEntry {
|
||||||
|
/*
|
||||||
|
* @addr contains:
|
||||||
|
* - in the lower TARGET_PAGE_BITS, a physical section number
|
||||||
|
* - with the lower TARGET_PAGE_BITS masked off, an offset which
|
||||||
|
* must be added to the virtual address to obtain:
|
||||||
|
* + the ram_addr_t of the target RAM (if the physical section
|
||||||
|
* number is PHYS_SECTION_NOTDIRTY or PHYS_SECTION_ROM)
|
||||||
|
* + the offset within the target MemoryRegion (otherwise)
|
||||||
|
*/
|
||||||
hwaddr addr;
|
hwaddr addr;
|
||||||
MemTxAttrs attrs;
|
MemTxAttrs attrs;
|
||||||
} CPUIOTLBEntry;
|
} CPUIOTLBEntry;
|
||||||
|
|
Loading…
Reference in a new issue