From: "Andreas Färber" <afaerber@suse.de>
To: liguang <lig.fnst@cn.fujitsu.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 1/2] target-i386: define dr7 bit field
Date: Tue, 15 Jan 2013 09:28:09 +0100 [thread overview]
Message-ID: <50F51319.8080109@suse.de> (raw)
In-Reply-To: <1358228396-17552-2-git-send-email-lig.fnst@cn.fujitsu.com>
Am 15.01.2013 06:39, schrieb liguang:
> implictly use of dr7 bit field is a little hard
> to understand, so try to define them and use the
> defined name.
>
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
> target-i386/cpu.h | 6 ++++++
> target-i386/machine.c | 5 +++--
> target-i386/misc_helper.c | 4 ++--
> target-i386/seg_helper.c | 9 +++++----
> 4 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 1283537..64fd7a5 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -231,6 +231,12 @@
> #define DR7_TYPE_SHIFT 16
> #define DR7_LEN_SHIFT 18
> #define DR7_FIXED_1 0x00000400
> +#define DR7_LOCAL_BP_MASK 0x55
> +#define DR7_MAX_BP 4
> +#define DR7_TYPE_BP_INST 0x0
> +#define DR7_TYPE_DATA_WR 0x1
> +#define DR7_TYPE_IO_RW 0x2
> +#define DR7_TYPE_DATA_RW 0x3
>
> #define PG_PRESENT_BIT 0
> #define PG_RW_BIT 1
> diff --git a/target-i386/machine.c b/target-i386/machine.c
> index 8354572..8df6a6b 100644
> --- a/target-i386/machine.c
> +++ b/target-i386/machine.c
> @@ -265,10 +265,11 @@ static int cpu_post_load(void *opaque, int version_id)
>
> cpu_breakpoint_remove_all(env, BP_CPU);
> cpu_watchpoint_remove_all(env, BP_CPU);
> - for (i = 0; i < 4; i++)
> + for (i = 0; i < DR7_MAX_BP; i++) {
> hw_breakpoint_insert(env, i);
> -
> + }
> tlb_flush(env, 1);
> +
> return 0;
> }
>
> diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c
> index db3126b..9b0f7b3 100644
> --- a/target-i386/misc_helper.c
> +++ b/target-i386/misc_helper.c
> @@ -197,11 +197,11 @@ void helper_movl_drN_T0(CPUX86State *env, int reg, target_ulong t0)
> env->dr[reg] = t0;
> hw_breakpoint_insert(env, reg);
> } else if (reg == 7) {
> - for (i = 0; i < 4; i++) {
> + for (i = 0; i < DR7_MAX_BP; i++) {
> hw_breakpoint_remove(env, i);
> }
> env->dr[7] = t0;
> - for (i = 0; i < 4; i++) {
> + for (i = 0; i < DR7_MAX_BP; i++) {
> hw_breakpoint_insert(env, i);
> }
> } else {
> diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
> index c2a99ee..3247dee 100644
> --- a/target-i386/seg_helper.c
> +++ b/target-i386/seg_helper.c
> @@ -465,13 +465,14 @@ static void switch_tss(CPUX86State *env, int tss_selector,
>
> #ifndef CONFIG_USER_ONLY
> /* reset local breakpoints */
> - if (env->dr[7] & 0x55) {
> - for (i = 0; i < 4; i++) {
> - if (hw_breakpoint_enabled(env->dr[7], i) == 0x1) {
> + if (env->dr[7] & DR7_LOCAL_BP_MASK) {
> + for (i = 0; i < DR7_MAX_BP; i++) {
> + if (hw_local_breakpoint_enabled(env->dr[7], i) &&
> + !hw_global_breakpoint_enabled(env->dr[7], i)) {
Does not build.
> hw_breakpoint_remove(env, i);
> }
> }
> - env->dr[7] &= ~0x55;
> + env->dr[7] &= ~DR7_LOCAL_BP_MASK;
> }
> #endif
> }
>
--
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-15 8:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 5:39 [Qemu-devel] [PATCH v5 0/2] target-i386: define dr7 bit filed and change dr7 related functions liguang
2013-01-15 5:39 ` [Qemu-devel] [PATCH v5 1/2] target-i386: define dr7 bit field liguang
2013-01-15 8:28 ` Andreas Färber [this message]
2013-01-15 5:39 ` [Qemu-devel] [PATCH v5 2/2] target-i386: change some dr7 related functions liguang
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=50F51319.8080109@suse.de \
--to=afaerber@suse.de \
--cc=imammedo@redhat.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.