Skip to content

Commit

Permalink
PPC: Fail on leaking temporaries
Browse files Browse the repository at this point in the history
When QEMU gets compiled with --enable-debug-tcg we can check for temporary
leakage. Implement the necessary target code for this and fail emulation
when we hit a leakage.

This hopefully ensures that we don't get new leaks.

Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
agraf committed Jun 16, 2014
1 parent c80d1df commit 3de3179
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions target-ppc/translate.c
Expand Up @@ -11767,6 +11767,7 @@ static inline void gen_intermediate_code_internal(PowerPCCPU *cpu,
max_insns = CF_COUNT_MASK;

gen_tb_start();
tcg_clear_temp_count();
/* Set env in case of segfault during code fetch */
while (ctx.exception == POWERPC_EXCP_NONE
&& tcg_ctx.gen_opc_ptr < gen_opc_end) {
Expand Down Expand Up @@ -11866,6 +11867,12 @@ static inline void gen_intermediate_code_internal(PowerPCCPU *cpu,
*/
break;
}
if (tcg_check_temp_count()) {
fprintf(stderr, "Opcode %02x %02x %02x (%08x) leaked temporaries\n",
opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode),
ctx.opcode);
exit(1);
}
}
if (tb->cflags & CF_LAST_IO)
gen_io_end();
Expand Down

0 comments on commit 3de3179

Please sign in to comment.