Received: from eggs.gnu.org ([2001:4830:134:3::10]:47741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0y8S-0004wA-II for qemu-devel@nongnu.org; Tue, 16 Dec 2014 14:50:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0y8N-0002ll-53 for qemu-devel@nongnu.org; Tue, 16 Dec 2014 14:50:20 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:20336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0y8M-0002kX-U0 for qemu-devel@nongnu.org; Tue, 16 Dec 2014 14:50:15 -0500 From: Leon Alrae Date: Tue, 16 Dec 2014 19:49:08 +0000 Message-ID: <1418759356-14242-23-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1418759356-14242-1-git-send-email-leon.alrae@imgtec.com> References: <1418759356-14242-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PULL 22/30] target-mips: Also apply the CP0.Status mask to MTTC0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Maciej W. Rozycki" From: "Maciej W. Rozycki" Make CP0.Status writes made with the MTTC0 instruction respect this register's mask just like all the other places. Also preserve the current values of masked out bits. Signed-off-by: Maciej W. Rozycki Reviewed-by: Leon Alrae Signed-off-by: Leon Alrae --- target-mips/op_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index 1267ef2..7e632f6 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -1413,9 +1413,10 @@ void helper_mtc0_status(CPUMIPSState *env, target_ulong arg1) void helper_mttc0_status(CPUMIPSState *env, target_ulong arg1) { int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC); + uint32_t mask = env->CP0_Status_rw_bitmask & ~0xf1000018; CPUMIPSState *other = mips_cpu_map_tc(env, &other_tc); - other->CP0_Status = arg1 & ~0xf1000018; + other->CP0_Status = (other->CP0_Status & ~mask) | (arg1 & mask); sync_c0_status(env, other, other_tc); } -- 2.1.0