On 2/7/21 9:46 PM, Taylor Simpson wrote:
> +static inline void ctx_log_reg_write(DisasContext *ctx, int rnum)
Drop the inline markup throughout.
> +static int read_packet_words(CPUHexagonState *env, DisasContext *ctx,
> + uint32_t words[])
> +{
> + bool found_end = false;
> + int nwords, max_words;
> +
> + memset(words, 0, PACKET_WORDS_MAX * sizeof(uint32_t));
> + for (nwords = 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) {
> + words[nwords] = cpu_ldl_code(env,
> + ctx->base.pc_next + nwords *
> sizeof(uint32_t));
translate_ldl, so that a plugin has access to the packet data. (Note that
pkt_crosses_page is fine, because that's read-ahead, not reads for the current
packet.)
> +#if HEX_DEBUG
> +static inline void gen_check_store_width(DisasContext *ctx, int slot_num)
> +{
> + TCGv slot = tcg_const_tl(slot_num);
> + TCGv check = tcg_const_tl(ctx->store_width[slot_num]);
> + gen_helper_debug_check_store_width(cpu_env, slot, check);
> + tcg_temp_free(slot);
> + tcg_temp_free(check);
> +}
> +#define HEX_DEBUG_GEN_CHECK_STORE_WIDTH(ctx, slot_num) \
> + gen_check_store_width(ctx, slot_num)
> +#else
> +#define HEX_DEBUG_GEN_CHECK_STORE_WIDTH(ctx, slot_num) /* nothing */
> +#endif
Fold this to a simple function call:
static void gen_check_store_width(...)
{
if (HEX_DEBUG) {
....
}
}
> +#if HEX_DEBUG
> + /* When debugging, only put one packet per TB */
> + ctx->base.is_jmp = DISAS_TOO_MANY;
> +#endif
Why? You can always add -singlestep to the command-line.
> + case DISAS_NORETURN:
> + gen_exec_counters(ctx);
> + tcg_gen_mov_tl(hex_gpr[HEX_REG_PC], hex_next_PC);
> + if (ctx->base.singlestep_enabled) {
> + gen_exception_debug();
> + } else {
> + tcg_gen_exit_tb(NULL, 0);
> + }
DISAS_NORETURN says that we have *already* exited the TB. None of the code you
emit here will be reachable.
r~