________________________________________
From: Richard Henderson [rth7...@gmail.com] on behalf of Richard Henderson 
[r...@twiddle.net]
Sent: Tuesday, May 27, 2014 12:53 AM
To: Petar Jovanovic; qemu-devel@nongnu.org
Cc: Petar Jovanovic; aurel...@aurel32.net; James Hogan
Subject: Re: [v2 PATCH] target-mips: implement UserLocal Register

On 05/26/2014 10:28 AM, Petar Jovanovic wrote:
>  void helper_mtc0_hwrena(CPUMIPSState *env, target_ulong arg1)
>  {
> -    env->CP0_HWREna = arg1 & 0x0000000F;
> +    uint32_t mask = 0x0000000F;
> +
> +    if (env->CP0_Config3 & (1 << CP0C3_ULRI)) {
> +        mask |= 0x20000000;
> +    }
> +
> +    env->CP0_HWREna = arg1 & mask;
>  }

> If you're going to force the bit on here...

No bit is forced here. It's only the mask that is set.

> +target_ulong helper_rdhwr_ul(CPUMIPSState *env)
> +{
> +    if ((env->hflags & MIPS_HFLAG_CP0) ||
> +        (env->CP0_HWREna & (1 << 29))) {
> +        return env->active_tc.CP0_UserLocal;
> +    } else {
> +        helper_raise_exception(env, EXCP_RI);
> +    }

> ... why do you need to check it here?


Because we do not know the content of CP0_HWREna.

P.

Reply via email to