~ubuntu-bugs-auftrags-killer/qemu/proper-error-characters

« back to all changes in this revision

Viewing changes to target-sh4/translate.c

  • Committer: bellard
  • Date: 2008-02-01 10:50:11 UTC
  • Revision ID: git-v1:57fec1fee94aa9f7d2519e8c354f100fc36bc9fa
use the TCG code generator


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3944 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "cpu.h"
32
32
#include "exec-all.h"
33
33
#include "disas.h"
34
 
 
35
 
enum {
36
 
#define DEF(s, n, copy_size) INDEX_op_ ## s,
37
 
#include "opc.h"
38
 
#undef DEF
39
 
    NB_OPS,
40
 
};
41
 
 
42
 
#ifdef USE_DIRECT_JUMP
43
 
#define TBPARAM(x)
44
 
#else
45
 
#define TBPARAM(x) ((long)(x))
46
 
#endif
47
 
 
48
 
static uint16_t *gen_opc_ptr;
49
 
static uint32_t *gen_opparam_ptr;
50
 
 
51
 
#include "gen-op.h"
 
34
#include "tcg-op.h"
52
35
 
53
36
typedef struct DisasContext {
54
37
    struct TranslationBlock *tb;
172
155
    if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) &&
173
156
        !ctx->singlestep_enabled) {
174
157
        /* Use a direct jump if in same page and singlestep not enabled */
175
 
        if (n == 0)
176
 
            gen_op_goto_tb0(TBPARAM(tb));
177
 
        else
178
 
            gen_op_goto_tb1(TBPARAM(tb));
179
 
        gen_op_movl_imm_T0((long) tb + n);
 
158
        tcg_gen_goto_tb(n);
 
159
        gen_op_movl_imm_PC(dest);
 
160
        tcg_gen_exit_tb((long) tb + n);
180
161
    } else {
181
 
        gen_op_movl_imm_T0(0);
 
162
        gen_op_movl_imm_PC(dest);
 
163
        if (ctx->singlestep_enabled)
 
164
            gen_op_debug();
 
165
        tcg_gen_exit_tb(0);
182
166
    }
183
 
    gen_op_movl_imm_PC(dest);
184
 
    if (ctx->singlestep_enabled)
185
 
        gen_op_debug();
186
 
    gen_op_exit_tb();
187
167
}
188
168
 
189
169
static void gen_jump(DisasContext * ctx)
192
172
        /* Target is not statically known, it comes necessarily from a
193
173
           delayed jump as immediate jump are conditinal jumps */
194
174
        gen_op_movl_delayed_pc_PC();
195
 
        gen_op_movl_imm_T0(0);
196
175
        if (ctx->singlestep_enabled)
197
176
            gen_op_debug();
198
 
        gen_op_exit_tb();
 
177
        tcg_gen_exit_tb(0);
199
178
    } else {
200
179
        gen_goto_tb(ctx, 0, ctx->delayed_pc);
201
180
    }
1176
1155
    int i, ii;
1177
1156
 
1178
1157
    pc_start = tb->pc;
1179
 
    gen_opc_ptr = gen_opc_buf;
1180
1158
    gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
1181
 
    gen_opparam_ptr = gen_opparam_buf;
1182
1159
    ctx.pc = pc_start;
1183
1160
    ctx.flags = (uint32_t)tb->flags;
1184
1161
    ctx.bstate = BS_NONE;
1190
1167
    ctx.delayed_pc = -1; /* use delayed pc from env pointer */
1191
1168
    ctx.tb = tb;
1192
1169
    ctx.singlestep_enabled = env->singlestep_enabled;
1193
 
    nb_gen_labels = 0;
1194
1170
 
1195
1171
#ifdef DEBUG_DISAS
1196
1172
    if (loglevel & CPU_LOG_TB_CPU) {
1254
1230
            break;
1255
1231
        case BS_EXCP:
1256
1232
            /* gen_op_interrupt_restart(); */
1257
 
            gen_op_movl_imm_T0(0);
1258
 
            gen_op_exit_tb();
 
1233
            tcg_gen_exit_tb(0);
1259
1234
            break;
1260
1235
        case BS_BRANCH:
1261
1236
        default:
1283
1258
        target_disas(logfile, pc_start, ctx.pc - pc_start, 0);
1284
1259
        fprintf(logfile, "\n");
1285
1260
    }
1286
 
    if (loglevel & CPU_LOG_TB_OP) {
1287
 
        fprintf(logfile, "OP:\n");
1288
 
        dump_ops(gen_opc_buf, gen_opparam_buf);
1289
 
        fprintf(logfile, "\n");
1290
 
    }
1291
1261
#endif
1292
1262
    return 0;
1293
1263
}