aboutsummaryrefslogtreecommitdiff
path: root/cpu-defs.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-01-31 09:22:27 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-01-31 09:22:27 +0000
commitd656469f44aa541b1e2ca4019fef101b60557aac (patch)
treed58e5d8571d1a1fd93faf25d89f97887752eec2d /cpu-defs.h
parent0019ad5346509406e93373b58d3066868ea30b96 (diff)
use simpler REGPARM convention - make CPUTLBEntry size a power of two
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3935 c046a42c-6fe2-441c-8c8c-71466251a162
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 \