From: Leon Alrae <leon.alrae@imgtec.com>
To: Yongbok Kim <yongbok.kim@imgtec.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, afaerber@suse.de, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH 1/4] target-mips: add CMGCRBase register
Date: Mon, 19 Oct 2015 16:07:58 +0100 [thread overview]
Message-ID: <5625074E.3020804@imgtec.com> (raw)
In-Reply-To: <1444953129-35040-2-git-send-email-yongbok.kim@imgtec.com>
On 16/10/15 00:52, Yongbok Kim wrote:
> Physical base address for the memory-mapped Coherency Manager Global
> Configuration Register space.
> The MIPS default location for the GCR_BASE address is 0x1FBF_8.
> This register only exists if Config3 CMGCR is set to one.
>
> Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
> ---
> target-mips/cpu.h | 3 ++-
> target-mips/translate.c | 17 +++++++++++++++++
> target-mips/translate_init.c | 3 ++-
> 3 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/target-mips/cpu.h b/target-mips/cpu.h
> index f32a0fd..639ef37 100644
> --- a/target-mips/cpu.h
> +++ b/target-mips/cpu.h
> @@ -389,6 +389,7 @@ struct CPUMIPSState {
> target_ulong CP0_EPC;
> int32_t CP0_PRid;
> int32_t CP0_EBase;
> + target_ulong CP0_CMGCRBase;
> int32_t CP0_Config0;
> #define CP0C0_M 31
> #define CP0C0_K23 28
> @@ -431,7 +432,7 @@ struct CPUMIPSState {
> int32_t CP0_Config3;
> #define CP0C3_M 31
> #define CP0C3_BPG 30
> -#define CP0C3_CMCGR 29
> +#define CP0C3_CMGCR 29
> #define CP0C3_MSAP 28
> #define CP0C3_BP 27
> #define CP0C3_BI 26
> diff --git a/target-mips/translate.c b/target-mips/translate.c
> index 897839c..c74e8e7 100644
> --- a/target-mips/translate.c
> +++ b/target-mips/translate.c
> @@ -1426,6 +1426,7 @@ typedef struct DisasContext {
> bool mvh;
> int CP0_LLAddr_shift;
> bool ps;
> + bool cmgcr;
> } DisasContext;
>
> enum {
> @@ -5273,6 +5274,12 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
> gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_EBase));
> rn = "EBase";
> break;
> + case 3:
> + check_insn(ctx, ISA_MIPS32R2);
> + CP0_CHECK(ctx->cmgcr);
> + gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_CMGCRBase));
gen_mfc0_load32 assumes 32-bit CP0 register whereas this one is
target_ulong. The tcg_gen_ld_tl + tcg_gen_ext32s_tl pair should be used
here.
> @@ -19567,6 +19580,7 @@ void gen_intermediate_code(CPUMIPSState *env, struct TranslationBlock *tb)
> ctx.ulri = (env->CP0_Config3 >> CP0C3_ULRI) & 1;
> ctx.ps = ((env->active_fpu.fcr0 >> FCR0_PS) & 1) ||
> (env->insn_flags & (INSN_LOONGSON2E | INSN_LOONGSON2F));
> + ctx.cmgcr = env->CP0_Config3 & (1 << CP0C3_CMGCR);
Wouldn't it be better to follow the style which is used for other ctx
fields? I.e. (x >> y) & 1
Regards,
Leon
next prev parent reply other threads:[~2015-10-19 15:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 23:52 [Qemu-devel] [PATCH 0/4] mips: add Global Interrupt Controller Yongbok Kim
2015-10-15 23:52 ` [Qemu-devel] [PATCH 1/4] target-mips: add CMGCRBase register Yongbok Kim
2015-10-19 15:07 ` Leon Alrae [this message]
2015-10-15 23:52 ` [Qemu-devel] [PATCH 2/4] mips: add Global Config Register block (part) Yongbok Kim
2015-10-15 23:52 ` [Qemu-devel] [PATCH 3/4] mips: add Global Interrupt Controller Yongbok Kim
2015-10-21 15:49 ` Leon Alrae
2015-10-15 23:52 ` [Qemu-devel] [PATCH 4/4] mips: add gic support to malta Yongbok Kim
2015-10-21 15:53 ` Leon Alrae
2015-10-19 14:36 ` [Qemu-devel] [PATCH 0/4] mips: add Global Interrupt Controller James Hogan
2015-10-19 14:58 ` Yongbok Kim
2015-10-21 16:01 ` Peter Maydell
2015-10-21 16:28 ` Yongbok Kim
2015-10-21 20:13 ` Peter Maydell
2015-10-21 16:36 ` Peter Crosthwaite
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=5625074E.3020804@imgtec.com \
--to=leon.alrae@imgtec.com \
--cc=afaerber@suse.de \
--cc=aurelien@aurel32.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yongbok.kim@imgtec.com \
/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.