[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 31/43] PPC: Fix missing TRACE exception
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 31/43] PPC: Fix missing TRACE exception |
Date: |
Mon, 3 Dec 2012 16:25:47 -0600 |
From: Julio Guerra <address@hidden>
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 <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
(cherry picked from commit f0cc4aa8450376ca2aee3ebb09db71f9f2ff333b)
Signed-off-by: Michael Roth <address@hidden>
---
target-ppc/translate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index ac915cc..3c49ca9 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -3466,7 +3466,8 @@ static inline void gen_goto_tb(DisasContext *ctx, int n,
target_ulong dest)
if (unlikely(ctx->singlestep_enabled)) {
if ((ctx->singlestep_enabled &
(CPU_BRANCH_STEP | CPU_SINGLE_STEP)) &&
- ctx->exception == POWERPC_EXCP_BRANCH) {
+ (ctx->exception == POWERPC_EXCP_BRANCH ||
+ ctx->exception == POWERPC_EXCP_TRACE)) {
target_ulong tmp = ctx->nip;
ctx->nip = dest;
gen_exception(ctx, POWERPC_EXCP_TRACE);
--
1.7.9.5
- [Qemu-devel] [PATCH 19/43] nbd: fixes to read-only handling, (continued)
- [Qemu-devel] [PATCH 19/43] nbd: fixes to read-only handling, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 18/43] m68k: Return semihosting errno values correctly, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 20/43] mips/malta: fix CBUS UART interrupt pin, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 21/43] target-mips: fix wrong microMIPS opcode encoding, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 23/43] tcg/arm: fix cross-endian qemu_st16, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 22/43] tcg/arm: fix TLB access in qemu-ld/st ops, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 28/43] block: Fix regression for MinGW (assertion caused by short string), Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 27/43] tci: Fix type of tci_read_label, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 26/43] qcow2: Fix refcount table size calculation, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 34/43] qapi: fix qapi_dealloc_type_size parameter type, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 33/43] qapi: handle visitor->type_size() in QapiDeallocVisitor, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 35/43] iscsi: fix segfault in url parsing, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 37/43] iscsi: do not assume device is zero initialized, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 36/43] iscsi: fix deadlock during login, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 39/43] virtio-scsi: Fix subtle (guest) endian bug, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 40/43] qxl: reload memslots after migration, when qxl is in UNDEFINED mode, Michael Roth, 2012/12/03
- [Qemu-devel] [PATCH 38/43] virtio-scsi: Fix some endian bugs with virtio-scsi, Michael Roth, 2012/12/03