qemu-e2k/target-ppc
Julio Guerra f0cc4aa845 PPC: Fix missing TRACE exception
This patch fixes bug 1031698 :
https://bugs.launchpad.net/qemu/+bug/1031698

If we look at the (truncated) translation of the conditional branch
instruction in the test submitted in the bug post, the call to the
exception helper is missing in the "bne-false" chunk of translated
code :

IN:
bne-    0x1800278

OUT:
0xb544236d:  jne    0xb5442396

0xb5442373:  mov    %ebp,(%esp)
0xb5442376:  mov    $0x44,%ebx
0xb544237b:  mov    %ebx,0x4(%esp)
0xb544237f:  mov    $0x1800278,%ebx
0xb5442384:  mov    %ebx,0x25c(%ebp)
0xb544238a:  call   0x827475a
                     ^^^^^^^^^^^^^^^^^^

0xb5442396:  mov    %ebp,(%esp)
0xb5442399:  mov    $0x44,%ebx
0xb544239e:  mov    %ebx,0x4(%esp)
0xb54423a2:  mov    $0x1800270,%ebx
0xb54423a7:  mov    %ebx,0x25c(%ebp)

Indeed, gen_exception(ctx, excp) called by gen_goto_tb (called by
gen_bcond) changes ctx->exception's value to excp's :

gen_bcond()
{
  gen_goto_tb(ctx, 0, ctx->nip + li - 4);
  /* ctx->exception value is POWERPC_EXCP_BRANCH */

  gen_goto_tb(ctx, 1, ctx->nip);
  /* ctx->exception now value is POWERPC_EXCP_TRACE */
}

Making the following gen_goto_tb()'s test false during the second call :

if ((ctx->singlestep_enabled &
    (CPU_BRANCH_STEP | CPU_SINGLE_STEP)) &&
    ctx->exception == POWERPC_EXCP_BRANCH /* false...*/) {
         target_ulong tmp = ctx->nip;
         ctx->nip = dest;
         /* ... and this is the missing call */
         gen_exception(ctx, POWERPC_EXCP_TRACE);
         ctx->nip = tmp;
}

So the patch simply adds the missing matching case, fixing our problem.

Signed-off-by: Julio Guerra <guerr@julio.in>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-11-26 19:53:26 +01:00
..
cpu-qom.h target-ppc: QOM'ify CPU 2012-04-15 17:10:30 +02:00
cpu.h Merge branch 'trivial-patches' of git://github.com/stefanha/qemu 2012-11-03 12:55:05 +00:00
excp_helper.c target-ppc: Pass PowerPCCPU to cpu_ppc_hypercall 2012-10-31 01:02:45 +01:00
fpu_helper.c ppc: Add missing break 2012-06-24 01:04:43 +02:00
helper_regs.h
helper.c ppc: Move misc helpers from helper.c to misc_helper.c 2012-06-24 01:04:43 +02:00
helper.h target-ppc: rename helper flags 2012-10-28 14:54:24 +01:00
int_helper.c target-ppc: get rid of the HANDLE_NAN{1, 2, 3} macros 2012-10-04 15:54:17 +02:00
kvm_ppc.c Replace Qemu by QEMU in comments 2012-04-07 14:00:45 +00:00
kvm_ppc.h pseries: Add support for new KVM hash table control call 2012-10-04 15:54:17 +02:00
kvm.c spapr: Pass PowerPCCPU to spapr_hypercall() 2012-10-31 01:02:45 +01:00
machine.c target-ppc: Extend FPU state for newer POWER CPUs 2012-11-01 13:02:22 +01:00
Makefile.objs PPC: BookE: Implement EPR SPR 2012-06-24 01:04:52 +02:00
mem_helper.c PPC: Add support for MSR_CM 2012-06-24 01:04:51 +02:00
mfrom_table_gen.c
mfrom_table.c
misc_helper.c ppc: Move misc helpers from helper.c to misc_helper.c 2012-06-24 01:04:43 +02:00
mmu_helper.c target-ppc: make some functions static 2012-11-01 19:49:45 +01:00
mpic_helper.c PPC: BookE: Implement EPR SPR 2012-06-24 01:04:52 +02:00
STATUS
timebase_helper.c ppc: Avoid AREG0 for timebase helpers 2012-06-24 01:04:43 +02:00
translate_init.c target-ppc: Rework storage of VPA registration state 2012-10-29 11:45:54 +01:00
translate.c PPC: Fix missing TRACE exception 2012-11-26 19:53:26 +01:00