aboutsummaryrefslogtreecommitdiff
path: root/cpu-defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpu-defs.h')
-rw-r--r--cpu-defs.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpu-defs.h b/cpu-defs.h
index 5e0f04674e..b581d949f2 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -102,6 +102,12 @@ typedef unsigned long ram_addr_t;
#define CPU_TLB_BITS 8
#define CPU_TLB_SIZE (1 << CPU_TLB_BITS)
+#if TARGET_PHYS_ADDR_BITS == 32 && TARGET_LONG_BITS == 32
+#define CPU_TLB_ENTRY_BITS 4
+#else
+#define CPU_TLB_ENTRY_BITS 5
+#endif
+
typedef struct CPUTLBEntry {
/* bit 31 to TARGET_PAGE_BITS : virtual address
bit TARGET_PAGE_BITS-1..IO_MEM_SHIFT : if non zero, memory io
@@ -113,7 +119,17 @@ typedef struct CPUTLBEntry {
target_ulong addr_write;
target_ulong addr_code;
/* addend to virtual address to get physical address */
+#if TARGET_PHYS_ADDR_BITS == 64
+ /* on i386 Linux make sure it is aligned */
+ target_phys_addr_t addend __attribute__((aligned(8)));
+#else
target_phys_addr_t addend;
+#endif
+ /* padding to get a power of two size */
+ uint8_t dummy[(1 << CPU_TLB_ENTRY_BITS) -
+ (sizeof(target_ulong) * 3 +
+ ((-sizeof(target_ulong) * 3) & (sizeof(target_phys_addr_t) - 1)) +
+ sizeof(target_phys_addr_t))];
} CPUTLBEntry;
#define CPU_COMMON \