Revision 2e70f6ef target-alpha/translate.c
b/target-alpha/translate.c | ||
---|---|---|
43 | 43 |
uint32_t amask; |
44 | 44 |
}; |
45 | 45 |
|
46 |
TCGv cpu_env; |
|
47 |
|
|
48 |
#include "gen-icount.h" |
|
49 |
|
|
50 |
void alpha_translate_init() |
|
51 |
{ |
|
52 |
static int done_init = 0; |
|
53 |
if (done_init) |
|
54 |
return; |
|
55 |
cpu_env = tcg_global_reg_new(TCG_TYPE_PTR, TCG_AREG0, "env"); |
|
56 |
done_init = 1; |
|
57 |
} |
|
58 |
|
|
46 | 59 |
static always_inline void gen_op_nop (void) |
47 | 60 |
{ |
48 | 61 |
#if defined(GENERATE_NOP) |
... | ... | |
1970 | 1983 |
uint16_t *gen_opc_end; |
1971 | 1984 |
int j, lj = -1; |
1972 | 1985 |
int ret; |
1986 |
int num_insns; |
|
1987 |
int max_insns; |
|
1973 | 1988 |
|
1974 | 1989 |
pc_start = tb->pc; |
1975 | 1990 |
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; |
... | ... | |
1981 | 1996 |
ctx.mem_idx = ((env->ps >> 3) & 3); |
1982 | 1997 |
ctx.pal_mode = env->ipr[IPR_EXC_ADDR] & 1; |
1983 | 1998 |
#endif |
1999 |
num_insns = 0; |
|
2000 |
max_insns = tb->cflags & CF_COUNT_MASK; |
|
2001 |
if (max_insns == 0) |
|
2002 |
max_insns = CF_COUNT_MASK; |
|
2003 |
|
|
2004 |
gen_icount_start(); |
|
1984 | 2005 |
for (ret = 0; ret == 0;) { |
1985 | 2006 |
if (env->nb_breakpoints > 0) { |
1986 | 2007 |
for(j = 0; j < env->nb_breakpoints; j++) { |
... | ... | |
1998 | 2019 |
gen_opc_instr_start[lj++] = 0; |
1999 | 2020 |
gen_opc_pc[lj] = ctx.pc; |
2000 | 2021 |
gen_opc_instr_start[lj] = 1; |
2022 |
gen_opc_icount[lj] = num_insns; |
|
2001 | 2023 |
} |
2002 | 2024 |
} |
2025 |
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) |
|
2026 |
gen_io_start(); |
|
2003 | 2027 |
#if defined ALPHA_DEBUG_DISAS |
2004 | 2028 |
insn_count++; |
2005 | 2029 |
if (logfile != NULL) { |
... | ... | |
2014 | 2038 |
fprintf(logfile, "opcode %08x %d\n", insn, insn_count); |
2015 | 2039 |
} |
2016 | 2040 |
#endif |
2041 |
num_insns++; |
|
2017 | 2042 |
ctx.pc += 4; |
2018 | 2043 |
ret = translate_one(ctxp, insn); |
2019 | 2044 |
if (ret != 0) |
... | ... | |
2022 | 2047 |
* generation |
2023 | 2048 |
*/ |
2024 | 2049 |
if (((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) || |
2025 |
(env->singlestep_enabled)) { |
|
2050 |
(env->singlestep_enabled) || |
|
2051 |
num_insns >= max_insns) { |
|
2026 | 2052 |
break; |
2027 | 2053 |
} |
2028 | 2054 |
#if defined (DO_SINGLE_STEP) |
... | ... | |
2035 | 2061 |
#if defined (DO_TB_FLUSH) |
2036 | 2062 |
gen_op_tb_flush(); |
2037 | 2063 |
#endif |
2064 |
if (tb->cflags & CF_LAST_IO) |
|
2065 |
gen_io_end(); |
|
2038 | 2066 |
/* Generate the return instruction */ |
2039 | 2067 |
tcg_gen_exit_tb(0); |
2068 |
gen_icount_end(tb, num_insns); |
|
2040 | 2069 |
*gen_opc_ptr = INDEX_op_end; |
2041 | 2070 |
if (search_pc) { |
2042 | 2071 |
j = gen_opc_ptr - gen_opc_buf; |
... | ... | |
2045 | 2074 |
gen_opc_instr_start[lj++] = 0; |
2046 | 2075 |
} else { |
2047 | 2076 |
tb->size = ctx.pc - pc_start; |
2077 |
tb->icount = num_insns; |
|
2048 | 2078 |
} |
2049 | 2079 |
#if defined ALPHA_DEBUG_DISAS |
2050 | 2080 |
if (loglevel & CPU_LOG_TB_CPU) { |
... | ... | |
2079 | 2109 |
if (!env) |
2080 | 2110 |
return NULL; |
2081 | 2111 |
cpu_exec_init(env); |
2112 |
alpha_translate_init(); |
|
2082 | 2113 |
tlb_flush(env, 1); |
2083 | 2114 |
/* XXX: should not be hardcoded */ |
2084 | 2115 |
env->implver = IMPLVER_2106x; |
Also available in: Unified diff