mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
tcg: Widen CPUTLBEntry comparators to 64-bits
This makes CPUTLBEntry agnostic to the address size of the guest. When 32-bit addresses are in effect, we can simply read the low 32 bits of the 64-bit field. Similarly when we need to update the field for setting TLB_NOTDIRTY. For TCG backends that could in theory be big-endian, but in practice are not (arm, loongarch, riscv), use QEMU_BUILD_BUG_ON to document and ensure this is not accidentally missed. For s390x, which is always big-endian, use HOST_BIG_ENDIAN anyway, to document the reason for the adjustment. For sparc64 and ppc64, always perform a 64-bit load, and rely on the following 32-bit comparison to ignore the high bits. Rearrange mips and ppc if ladders for clarity. Reviewed-by: Anton Johansson <anjo@rev.ng> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
ff0c61bf35
commit
238f43809a
11 changed files with 67 additions and 51 deletions
|
|
@ -65,11 +65,7 @@
|
|||
/* use a fully associative victim tlb of 8 entries */
|
||||
#define CPU_VTLB_SIZE 8
|
||||
|
||||
#if HOST_LONG_BITS == 32 && TARGET_LONG_BITS == 32
|
||||
#define CPU_TLB_ENTRY_BITS 4
|
||||
#else
|
||||
#define CPU_TLB_ENTRY_BITS 5
|
||||
#endif
|
||||
|
||||
#define CPU_TLB_DYN_MIN_BITS 6
|
||||
#define CPU_TLB_DYN_DEFAULT_BITS 8
|
||||
|
|
@ -95,33 +91,26 @@
|
|||
# endif
|
||||
|
||||
/* Minimalized TLB entry for use by TCG fast path. */
|
||||
typedef struct CPUTLBEntry {
|
||||
/* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address
|
||||
bit TARGET_PAGE_BITS-1..4 : Nonzero for accesses that should not
|
||||
go directly to ram.
|
||||
bit 3 : indicates that the entry is invalid
|
||||
bit 2..0 : zero
|
||||
*/
|
||||
union {
|
||||
struct {
|
||||
target_ulong addr_read;
|
||||
target_ulong addr_write;
|
||||
target_ulong addr_code;
|
||||
/* Addend to virtual address to get host address. IO accesses
|
||||
use the corresponding iotlb value. */
|
||||
uintptr_t addend;
|
||||
};
|
||||
typedef union CPUTLBEntry {
|
||||
struct {
|
||||
uint64_t addr_read;
|
||||
uint64_t addr_write;
|
||||
uint64_t addr_code;
|
||||
/*
|
||||
* Padding to get a power of two size, as well as index
|
||||
* access to addr_{read,write,code}.
|
||||
* Addend to virtual address to get host address. IO accesses
|
||||
* use the corresponding iotlb value.
|
||||
*/
|
||||
target_ulong addr_idx[(1 << CPU_TLB_ENTRY_BITS) / TARGET_LONG_SIZE];
|
||||
uintptr_t addend;
|
||||
};
|
||||
/*
|
||||
* Padding to get a power of two size, as well as index
|
||||
* access to addr_{read,write,code}.
|
||||
*/
|
||||
uint64_t addr_idx[(1 << CPU_TLB_ENTRY_BITS) / sizeof(uint64_t)];
|
||||
} CPUTLBEntry;
|
||||
|
||||
QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
|
||||
|
||||
|
||||
#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue