Revision 2e70f6ef exec-all.h
b/exec-all.h | ||
---|---|---|
27 | 27 |
#define DISAS_UPDATE 2 /* cpu state was modified dynamically */ |
28 | 28 |
#define DISAS_TB_JUMP 3 /* only pc was modified statically */ |
29 | 29 |
|
30 |
struct TranslationBlock;
|
|
30 |
typedef struct TranslationBlock TranslationBlock;
|
|
31 | 31 |
|
32 | 32 |
/* XXX: make safe guess about sizes */ |
33 | 33 |
#define MAX_OP_PER_INSTR 64 |
... | ... | |
48 | 48 |
extern target_ulong gen_opc_npc[OPC_BUF_SIZE]; |
49 | 49 |
extern uint8_t gen_opc_cc_op[OPC_BUF_SIZE]; |
50 | 50 |
extern uint8_t gen_opc_instr_start[OPC_BUF_SIZE]; |
51 |
extern uint16_t gen_opc_icount[OPC_BUF_SIZE]; |
|
51 | 52 |
extern target_ulong gen_opc_jump_pc[2]; |
52 | 53 |
extern uint32_t gen_opc_hflags[OPC_BUF_SIZE]; |
53 | 54 |
|
... | ... | |
75 | 76 |
CPUState *env, unsigned long searched_pc, |
76 | 77 |
void *puc); |
77 | 78 |
void cpu_resume_from_signal(CPUState *env1, void *puc); |
79 |
void cpu_io_recompile(CPUState *env, void *retaddr); |
|
80 |
TranslationBlock *tb_gen_code(CPUState *env, |
|
81 |
target_ulong pc, target_ulong cs_base, int flags, |
|
82 |
int cflags); |
|
78 | 83 |
void cpu_exec_init(CPUState *env); |
79 | 84 |
int page_unprotect(target_ulong address, unsigned long pc, void *puc); |
80 | 85 |
void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t end, |
... | ... | |
117 | 122 |
#define USE_DIRECT_JUMP |
118 | 123 |
#endif |
119 | 124 |
|
120 |
typedef struct TranslationBlock {
|
|
125 |
struct TranslationBlock { |
|
121 | 126 |
target_ulong pc; /* simulated PC corresponding to this block (EIP + CS base) */ |
122 | 127 |
target_ulong cs_base; /* CS base for this block */ |
123 | 128 |
uint64_t flags; /* flags defining in which context the code was generated */ |
124 | 129 |
uint16_t size; /* size of target code for this block (1 <= |
125 | 130 |
size <= TARGET_PAGE_SIZE) */ |
126 | 131 |
uint16_t cflags; /* compile flags */ |
127 |
#define CF_TB_FP_USED 0x0002 /* fp ops are used in the TB */ |
|
128 |
#define CF_FP_USED 0x0004 /* fp ops are used in the TB or in a chained TB */ |
|
129 |
#define CF_SINGLE_INSN 0x0008 /* compile only a single instruction */ |
|
132 |
#define CF_COUNT_MASK 0x7fff |
|
133 |
#define CF_LAST_IO 0x8000 /* Last insn may be an IO access. */ |
|
130 | 134 |
|
131 | 135 |
uint8_t *tc_ptr; /* pointer to the translated code */ |
132 | 136 |
/* next matching tb for physical address. */ |
... | ... | |
150 | 154 |
jmp_first */ |
151 | 155 |
struct TranslationBlock *jmp_next[2]; |
152 | 156 |
struct TranslationBlock *jmp_first; |
153 |
} TranslationBlock; |
|
157 |
uint32_t icount; |
|
158 |
}; |
|
154 | 159 |
|
155 | 160 |
static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc) |
156 | 161 |
{ |
... | ... | |
173 | 178 |
} |
174 | 179 |
|
175 | 180 |
TranslationBlock *tb_alloc(target_ulong pc); |
181 |
void tb_free(TranslationBlock *tb); |
|
176 | 182 |
void tb_flush(CPUState *env); |
177 | 183 |
void tb_link_phys(TranslationBlock *tb, |
178 | 184 |
target_ulong phys_pc, target_ulong phys_page2); |
185 |
void tb_phys_invalidate(TranslationBlock *tb, target_ulong page_addr); |
|
179 | 186 |
|
180 | 187 |
extern TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE]; |
181 | 188 |
extern uint8_t *code_gen_ptr; |
... | ... | |
364 | 371 |
} |
365 | 372 |
return addr + env1->tlb_table[mmu_idx][page_index].addend - (unsigned long)phys_ram_base; |
366 | 373 |
} |
374 |
|
|
375 |
/* Deterministic execution requires that IO only be performaed on the last |
|
376 |
instruction of a TB so that interrupts take effect immediately. */ |
|
377 |
static inline int can_do_io(CPUState *env) |
|
378 |
{ |
|
379 |
if (!use_icount) |
|
380 |
return 1; |
|
381 |
|
|
382 |
/* If not executing code then assume we are ok. */ |
|
383 |
if (!env->current_tb) |
|
384 |
return 1; |
|
385 |
|
|
386 |
return env->can_do_io != 0; |
|
387 |
} |
|
367 | 388 |
#endif |
368 | 389 |
|
369 | 390 |
#ifdef USE_KQEMU |
Also available in: Unified diff