qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Bharat Bhushan <Bharat.Bhushan@freescale.com>
Cc: maddy@linux.vnet.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/6 v6] ppc: Add software breakpoint support
Date: Thu, 10 Jul 2014 13:18:00 +0200	[thread overview]
Message-ID: <53BE7668.4070408@suse.de> (raw)
In-Reply-To: <1404989882-17362-6-git-send-email-Bharat.Bhushan@freescale.com>


On 10.07.14 12:58, Bharat Bhushan wrote:
> This patch allow insert/remove software breakpoint
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
> ---
> v5->v6
>   - No change
>
>   target-ppc/kvm.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-----------
>   1 file changed, 59 insertions(+), 14 deletions(-)
>
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index d1239b4..c4a1fa5 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -1320,6 +1320,55 @@ static int kvmppc_handle_dcr_write(CPUPPCState *env, uint32_t dcrn, uint32_t dat
>       return 0;
>   }
>   
> +int kvm_arch_insert_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> +{
> +    /* Mixed endian case is not handled */
> +    uint32_t sc = debug_inst_opcode;
> +
> +    if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn,
> +                            sizeof(sc), 0) ||
> +        cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&sc, sizeof(sc), 1)) {
> +        return -EINVAL;
> +    }
> +
> +    return 0;
> +}
> +
> +int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
> +{
> +    uint32_t sc;
> +
> +    if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&sc, sizeof(sc), 0) ||
> +        sc != debug_inst_opcode ||
> +        cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn,
> +                            sizeof(sc), 1)) {
> +        return -EINVAL;
> +    }
> +
> +    return 0;
> +}
> +
> +void kvm_arch_update_guest_debug(CPUState *cs, struct kvm_guest_debug *dbg)
> +{
> +    /* Software Breakpoint updates */
> +    if (kvm_sw_breakpoints_active(cs)) {
> +        dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
> +    }
> +}
> +
> +static int kvm_handle_debug(PowerPCCPU *cpu, struct kvm_run *run)
> +{
> +    CPUState *cs = CPU(cpu);
> +    struct kvm_debug_exit_arch *arch_info = &run->debug.arch;
> +    int handle = 0;
> +
> +    if (kvm_find_sw_breakpoint(cs, arch_info->address)) {
> +        handle = 1;
> +    }
> +
> +    return handle;
> +}
> +
>   int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
>   {
>       PowerPCCPU *cpu = POWERPC_CPU(cs);
> @@ -1360,6 +1409,16 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
>           ret = 0;
>           break;
>   
> +    case KVM_EXIT_DEBUG:
> +        DPRINTF("handle debug exception\n");
> +        if (kvm_handle_debug(cpu, run)) {
> +            ret = EXCP_DEBUG;
> +            break;
> +        }
> +        /* re-enter, this exception was guest-internal */
> +        ret = 0;

Where do we inject the program interrupt into our guest here?


Alex

  reply	other threads:[~2014-07-10 11:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10 10:57 [Qemu-devel] [PATCH 0/6 v6] ppc: Add debug stub support Bharat Bhushan
2014-07-10 10:57 ` [Qemu-devel] [PATCH 1/6 v6] ppc: debug stub: Get trap instruction opcode from KVM Bharat Bhushan
2014-07-10 14:07   ` Peter Maydell
2014-07-10 14:08     ` Alexander Graf
2014-07-10 10:57 ` [Qemu-devel] [PATCH 2/6 v6] ppc: Add interface to inject interrupt to guest Bharat Bhushan
2014-07-10 11:12   ` Alexander Graf
2014-07-10 10:57 ` [Qemu-devel] [PATCH 3/6 v6] ppc: synchronize excp_vectors for injecting exception Bharat Bhushan
2014-07-10 11:15   ` Alexander Graf
2014-07-10 10:58 ` [Qemu-devel] [PATCH 4/6 v6] ppc: Add program exception injection handler Bharat Bhushan
2014-07-10 10:58 ` [Qemu-devel] [PATCH 5/6 v6] ppc: Add software breakpoint support Bharat Bhushan
2014-07-10 11:18   ` Alexander Graf [this message]
2014-07-10 10:58 ` [Qemu-devel] [PATCH 6/6 v6] ppc: Add hw breakpoint watchpoint support Bharat Bhushan
2014-07-10 11:20   ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53BE7668.4070408@suse.de \
    --to=agraf@suse.de \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).