Commit d656469f44aa541b1e2ca4019fef101b60557aac
1 parent
0019ad53
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
Showing
4 changed files
with
28 additions
and
17 deletions
cpu-defs.h
| ... | ... | @@ -102,6 +102,12 @@ typedef unsigned long ram_addr_t; |
| 102 | 102 | #define CPU_TLB_BITS 8 |
| 103 | 103 | #define CPU_TLB_SIZE (1 << CPU_TLB_BITS) |
| 104 | 104 | |
| 105 | +#if TARGET_PHYS_ADDR_BITS == 32 && TARGET_LONG_BITS == 32 | |
| 106 | +#define CPU_TLB_ENTRY_BITS 4 | |
| 107 | +#else | |
| 108 | +#define CPU_TLB_ENTRY_BITS 5 | |
| 109 | +#endif | |
| 110 | + | |
| 105 | 111 | typedef struct CPUTLBEntry { |
| 106 | 112 | /* bit 31 to TARGET_PAGE_BITS : virtual address |
| 107 | 113 | bit TARGET_PAGE_BITS-1..IO_MEM_SHIFT : if non zero, memory io |
| ... | ... | @@ -113,7 +119,17 @@ typedef struct CPUTLBEntry { |
| 113 | 119 | target_ulong addr_write; |
| 114 | 120 | target_ulong addr_code; |
| 115 | 121 | /* addend to virtual address to get physical address */ |
| 122 | +#if TARGET_PHYS_ADDR_BITS == 64 | |
| 123 | + /* on i386 Linux make sure it is aligned */ | |
| 124 | + target_phys_addr_t addend __attribute__((aligned(8))); | |
| 125 | +#else | |
| 116 | 126 | target_phys_addr_t addend; |
| 127 | +#endif | |
| 128 | + /* padding to get a power of two size */ | |
| 129 | + uint8_t dummy[(1 << CPU_TLB_ENTRY_BITS) - | |
| 130 | + (sizeof(target_ulong) * 3 + | |
| 131 | + ((-sizeof(target_ulong) * 3) & (sizeof(target_phys_addr_t) - 1)) + | |
| 132 | + sizeof(target_phys_addr_t))]; | |
| 117 | 133 | } CPUTLBEntry; |
| 118 | 134 | |
| 119 | 135 | #define CPU_COMMON \ | ... | ... |
osdep.h
softmmu_header.h
| ... | ... | @@ -70,15 +70,13 @@ |
| 70 | 70 | #define ADDR_READ addr_read |
| 71 | 71 | #endif |
| 72 | 72 | |
| 73 | -DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | |
| 73 | +DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | |
| 74 | 74 | int mmu_idx); |
| 75 | -void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, DATA_TYPE v, int mmu_idx); | |
| 75 | +void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, DATA_TYPE v, int mmu_idx); | |
| 76 | 76 | |
| 77 | 77 | #if (DATA_SIZE <= 4) && (TARGET_LONG_BITS == 32) && defined(__i386__) && \ |
| 78 | 78 | (ACCESS_TYPE < NB_MMU_MODES) && defined(ASM_SOFTMMU) |
| 79 | 79 | |
| 80 | -#define CPU_TLB_ENTRY_BITS 4 | |
| 81 | - | |
| 82 | 80 | static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) |
| 83 | 81 | { |
| 84 | 82 | int res; |
| ... | ... | @@ -92,9 +90,8 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) |
| 92 | 90 | "cmpl (%%edx), %%eax\n" |
| 93 | 91 | "movl %1, %%eax\n" |
| 94 | 92 | "je 1f\n" |
| 95 | - "pushl %6\n" | |
| 93 | + "movl %6, %%edx\n" | |
| 96 | 94 | "call %7\n" |
| 97 | - "popl %%edx\n" | |
| 98 | 95 | "movl %%eax, %0\n" |
| 99 | 96 | "jmp 2f\n" |
| 100 | 97 | "1:\n" |
| ... | ... | @@ -135,9 +132,8 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) |
| 135 | 132 | "cmpl (%%edx), %%eax\n" |
| 136 | 133 | "movl %1, %%eax\n" |
| 137 | 134 | "je 1f\n" |
| 138 | - "pushl %6\n" | |
| 135 | + "movl %6, %%edx\n" | |
| 139 | 136 | "call %7\n" |
| 140 | - "popl %%edx\n" | |
| 141 | 137 | #if DATA_SIZE == 1 |
| 142 | 138 | "movsbl %%al, %0\n" |
| 143 | 139 | #elif DATA_SIZE == 2 |
| ... | ... | @@ -189,9 +185,8 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE |
| 189 | 185 | #else |
| 190 | 186 | #error unsupported size |
| 191 | 187 | #endif |
| 192 | - "pushl %6\n" | |
| 188 | + "movl %6, %%ecx\n" | |
| 193 | 189 | "call %7\n" |
| 194 | - "popl %%eax\n" | |
| 195 | 190 | "jmp 2f\n" |
| 196 | 191 | "1:\n" |
| 197 | 192 | "addl 8(%%edx), %%eax\n" | ... | ... |
softmmu_template.h
| ... | ... | @@ -75,8 +75,8 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /* handle all cases except unaligned access which span two pages */ |
| 78 | -DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | |
| 79 | - int mmu_idx) | |
| 78 | +DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | |
| 79 | + int mmu_idx) | |
| 80 | 80 | { |
| 81 | 81 | DATA_TYPE res; |
| 82 | 82 | int index; |
| ... | ... | @@ -209,9 +209,9 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, |
| 209 | 209 | #endif |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | -void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, | |
| 213 | - DATA_TYPE val, | |
| 214 | - int mmu_idx) | |
| 212 | +void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, | |
| 213 | + DATA_TYPE val, | |
| 214 | + int mmu_idx) | |
| 215 | 215 | { |
| 216 | 216 | target_phys_addr_t physaddr; |
| 217 | 217 | target_ulong tlb_addr; | ... | ... |