From: "Andreas Färber" <afaerber@suse.de>
To: liguang <lig.fnst@cn.fujitsu.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
imammedo@redhat.com, Jan Kiszka <jan.kiszka@siemens.com>,
ehabkost@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 2/3] target-i386:define hw_{global, local}breakpoint_enabled function
Date: Fri, 11 Jan 2013 17:16:08 +0100 [thread overview]
Message-ID: <50F03AC8.9090603@suse.de> (raw)
In-Reply-To: <1355106144-30846-2-git-send-email-lig.fnst@cn.fujitsu.com>
Am 10.12.2012 03:22, schrieb liguang:
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
> target-i386/cpu.h | 15 +++++++++++++--
> 1 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 29245d1..c69f81f 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -996,9 +996,20 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
> #define cpu_handle_mmu_fault cpu_x86_handle_mmu_fault
> void cpu_x86_set_a20(CPUX86State *env, int a20_state);
>
> -static inline int hw_breakpoint_enabled(unsigned long dr7, int index)
> +static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index)
> {
> - return (dr7 >> (index * 2)) & 3;
> + return ((dr7 >> (index * 2)) & 1);
There's no need to add parenthesis around this expression.
Shouldn't this ...
> +}
> +
> +static inline bool hw_global_breakpoint_enabled(unsigned long dr7, int index)
> +{
> + return ((dr7 >> (index * 2)) & 2);
... and this use defines from 1/3 now rather than magic numbers?
Otherwise the logic seems to match what was discussed.
Andreas
> +}
> +
> +static inline bool hw_breakpoint_enabled(unsigned long dr7, int index)
> +{
> + return (hw_global_breakpoint_enabled(dr7, index) ||
> + hw_local_breakpoint_enabled(dr7, index));
> }
>
> static inline int hw_breakpoint_type(unsigned long dr7, int index)
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-01-11 16:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-10 2:22 [Qemu-devel] [PATCH v4 1/3] target-i386:define name of breakpoint bit in dr7 liguang
2012-12-10 2:22 ` [Qemu-devel] [PATCH v4 2/3] target-i386:define hw_{global, local}breakpoint_enabled function liguang
2013-01-11 16:16 ` Andreas Färber [this message]
2012-12-10 2:22 ` [Qemu-devel] [PATCH v4 3/3] target-i386:slightly refactor dr7 related function liguang
2013-01-11 16:30 ` Andreas Färber
2012-12-14 1:32 ` [Qemu-devel] [PATCH v4 1/3] target-i386:define name of breakpoint bit in dr7 li guang
2013-01-11 1:47 ` li guang
2013-01-11 16:00 ` Andreas Färber
2013-01-11 16:10 ` Andreas Färber
2013-01-14 2:39 ` li guang
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=50F03AC8.9090603@suse.de \
--to=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.