On 09/08/2016 03:31 PM, Michael Rolnik wrote:
+static void arc_gen_exec_delayslot(DisasCtxt *ctx) +{ + if (ctx->opt.limm == 0) { + uint32_t cpc = ctx->cpc; + uint32_t npc = ctx->npc; + uint32_t dpc = ctx->dpc; + uint32_t pcl = ctx->pcl; + options_t opt = ctx->opt; + int bstate = ctx->bstate; + + ctx->cpc = ctx->npc; + ctx->pcl = ctx->cpc & 0xfffffffc; + + ++ctx->ds; + + /* TODO: check for illegal instruction sequence */ + + memset(&ctx->opt, 0, sizeof(ctx->opt)); + arc_decode(ctx); + + --ctx->ds; + + ctx->cpc = cpc; + ctx->npc = npc; + ctx->dpc = dpc; + ctx->pcl = pcl; + ctx->opt = opt; + ctx->bstate = bstate; + } +}
It might be easier to put the delay slot into a TB by itself. That will avoid having to duplicate the decoding here.
r~