From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrwqV-0007R3-NX for qemu-devel@nongnu.org; Thu, 29 Oct 2015 19:43:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrwqS-0000xB-HI for qemu-devel@nongnu.org; Thu, 29 Oct 2015 19:43:03 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:12707 helo=imgpgp01.kl.imgtec.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrwqS-0000wO-8j for qemu-devel@nongnu.org; Thu, 29 Oct 2015 19:43:00 -0400 Date: Thu, 29 Oct 2015 23:42:56 +0000 From: James Hogan Message-ID: <20151029234256.GH5978@jhogan-linux.le.imgtec.org> References: <1446139072-39608-1-git-send-email-yongbok.kim@imgtec.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bO4vSxwwZtUjUWHo" Content-Disposition: inline In-Reply-To: <1446139072-39608-1-git-send-email-yongbok.kim@imgtec.com> Subject: Re: [Qemu-devel] [PATCH v4] target-mips: fix updating XContext on mmu exception List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yongbok Kim Cc: leon.alrae@imgtec.com, qemu-devel@nongnu.org, aurelien@aurel32.net --bO4vSxwwZtUjUWHo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 29, 2015 at 05:17:52PM +0000, Yongbok Kim wrote: > Correct updating XContext.Region field on mmu exceptions. > If Config3.CTXTC =3D 0 then the R field of XContext has to be updated > with the value of bits 63..62 of the virtual address upon a TLB > exception. It wouldn't hurt to mention how the existing behaviour is wrong, since it requires a little staring (and counting of zeros) to see it, i.e. that the old mask incorrectly selected bits 47:46 of the address, and shifted them down into the middle of BadVPN2. > Also fixed the below line which overs 80 characters. >=20 > Signed-off-by: Yongbok Kim Reviewed-by: James Hogan Cheers James > --- > target-mips/helper.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/target-mips/helper.c b/target-mips/helper.c > index 2d86323..b3fe816 100644 > --- a/target-mips/helper.c > +++ b/target-mips/helper.c > @@ -293,9 +293,10 @@ static void raise_mmu_exception(CPUMIPSState *env, t= arget_ulong address, > (env->CP0_EntryHi & 0xFF) | (address & (TARGET_PAGE_MASK << 1)); > #if defined(TARGET_MIPS64) > env->CP0_EntryHi &=3D env->SEGMask; > - env->CP0_XContext =3D (env->CP0_XContext & ((~0ULL) << (env->SEGBITS= - 7))) | > - ((address & 0xC00000000000ULL) >> (55 - env->SEG= BITS)) | > - ((address & ((1ULL << env->SEGBITS) - 1) & 0xFFF= FFFFFFFFFE000ULL) >> 9); > + env->CP0_XContext =3D > + /* PTEBase */ (env->CP0_XContext & ((~0ULL) << (env->SEGBITS -= 7))) | > + /* R */ (extract64(address, 62, 2) << (env->SEGBITS - 9)= ) | > + /* BadVPN2 */ (extract64(address, 13, env->SEGBITS - 13) << 4); > #endif > cs->exception_index =3D exception; > env->error_code =3D error_code; > --=20 > 1.7.1 >=20 >=20 --bO4vSxwwZtUjUWHo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWMq8AAAoJEGwLaZPeOHZ6tdcQAJ2z4FZf28/tsdiG8vAHREvk HY2xL+BHuUzLlwxoAgNm+mh84Gy2WVXJduys6jgqX4FDapTfWPOFzGfhOth7esb4 sZpeeaBCY+DdhMEH9SdXWHpjkBwj1uDr/Qc69wRrtDP1aJS9xDBdbbDJmZZIYzXR RdkwdEicTTPMTYlVhLBK8XPQ3cN01sTYVLHo0Ka0j2jPFy2niY/Ed5Gbkoi8UusP Sx9zzxmWpGIfb4cr1O/8IZya3aNTwoeCoky7xtkrg9SBiwYAyPS58mBBdYf231c6 Hm+Yr+e4gPkGkGmlYfFgVLeN1w1IF8FRDxt4R+UGqntKAdwFFVAWi2r8hVk1JqTO pr8bx6/YKP9nRrNmXmJhwovUPwAGUaa+Y+M2yaaoDjO50Z3MrIV/zA93UpIoCGsY ZZYmoAmR8N1k57DJBR3QiXl8W0TsBjsWdQh8AeWr7//tSy7z+IMvOtF7gS1u2OYw 6vhM8vc046caiOekhGPFQimtHho82z2YlQTR2hthUbZw52C7L4+i2MftC6SMAJJF qwuJ8pB7us/3lnt41eYdGUaps757Se76tQlX68oCf88YfjS3BzjbJU/5aGd/J7tl ro7Kz878bxJULkKvlioBUeox99Al3422ZbUOhqkhhaI0ZfpOFkcs5vjIScVUUZDQ 0CaFu57k0aaHVh9gMvDo =n7kJ -----END PGP SIGNATURE----- --bO4vSxwwZtUjUWHo--