Revision 8a40a180 exec-all.h
b/exec-all.h | ||
---|---|---|
105 | 105 |
#define CODE_GEN_MAX_SIZE 65536 |
106 | 106 |
#define CODE_GEN_ALIGN 16 /* must be >= of the size of a icache line */ |
107 | 107 |
|
108 |
#define CODE_GEN_HASH_BITS 15 |
|
109 |
#define CODE_GEN_HASH_SIZE (1 << CODE_GEN_HASH_BITS) |
|
110 |
|
|
111 | 108 |
#define CODE_GEN_PHYS_HASH_BITS 15 |
112 | 109 |
#define CODE_GEN_PHYS_HASH_SIZE (1 << CODE_GEN_PHYS_HASH_BITS) |
113 | 110 |
|
... | ... | |
167 | 164 |
#define CF_SINGLE_INSN 0x0008 /* compile only a single instruction */ |
168 | 165 |
|
169 | 166 |
uint8_t *tc_ptr; /* pointer to the translated code */ |
170 |
struct TranslationBlock *hash_next; /* next matching tb for virtual address */ |
|
171 | 167 |
/* next matching tb for physical address. */ |
172 | 168 |
struct TranslationBlock *phys_hash_next; |
173 | 169 |
/* first and second physical page containing code. The lower bit |
... | ... | |
191 | 187 |
struct TranslationBlock *jmp_first; |
192 | 188 |
} TranslationBlock; |
193 | 189 |
|
194 |
static inline unsigned int tb_hash_func(target_ulong pc) |
|
190 |
static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
|
|
195 | 191 |
{ |
196 |
return pc & (CODE_GEN_HASH_SIZE - 1);
|
|
192 |
return (pc ^ (pc >> TB_JMP_CACHE_BITS)) & (TB_JMP_CACHE_SIZE - 1);
|
|
197 | 193 |
} |
198 | 194 |
|
199 | 195 |
static inline unsigned int tb_phys_hash_func(unsigned long pc) |
... | ... | |
203 | 199 |
|
204 | 200 |
TranslationBlock *tb_alloc(target_ulong pc); |
205 | 201 |
void tb_flush(CPUState *env); |
206 |
void tb_link(TranslationBlock *tb); |
|
207 | 202 |
void tb_link_phys(TranslationBlock *tb, |
208 | 203 |
target_ulong phys_pc, target_ulong phys_page2); |
209 | 204 |
|
210 |
extern TranslationBlock *tb_hash[CODE_GEN_HASH_SIZE]; |
|
211 | 205 |
extern TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE]; |
212 | 206 |
|
213 | 207 |
extern uint8_t code_gen_buffer[CODE_GEN_BUFFER_SIZE]; |
214 | 208 |
extern uint8_t *code_gen_ptr; |
215 | 209 |
|
216 |
/* find a translation block in the translation cache. If not found, |
|
217 |
return NULL and the pointer to the last element of the list in pptb */ |
|
218 |
static inline TranslationBlock *tb_find(TranslationBlock ***pptb, |
|
219 |
target_ulong pc, |
|
220 |
target_ulong cs_base, |
|
221 |
unsigned int flags) |
|
222 |
{ |
|
223 |
TranslationBlock **ptb, *tb; |
|
224 |
unsigned int h; |
|
225 |
|
|
226 |
h = tb_hash_func(pc); |
|
227 |
ptb = &tb_hash[h]; |
|
228 |
for(;;) { |
|
229 |
tb = *ptb; |
|
230 |
if (!tb) |
|
231 |
break; |
|
232 |
if (tb->pc == pc && tb->cs_base == cs_base && tb->flags == flags) |
|
233 |
return tb; |
|
234 |
ptb = &tb->hash_next; |
|
235 |
} |
|
236 |
*pptb = ptb; |
|
237 |
return NULL; |
|
238 |
} |
|
239 |
|
|
240 |
|
|
241 | 210 |
#if defined(USE_DIRECT_JUMP) |
242 | 211 |
|
243 | 212 |
#if defined(__powerpc__) |
Also available in: Unified diff