From patchwork Thu Oct 29 15:27:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongbok Kim X-Patchwork-Id: 537913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0FBAD1402CC for ; Fri, 30 Oct 2015 02:28:05 +1100 (AEDT) Received: from localhost ([::1]:44771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrp7S-0001cl-UM for incoming@patchwork.ozlabs.org; Thu, 29 Oct 2015 11:28:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrp76-0001BH-0F for qemu-devel@nongnu.org; Thu, 29 Oct 2015 11:27:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zrp71-0007li-NB for qemu-devel@nongnu.org; Thu, 29 Oct 2015 11:27:39 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:62384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrp71-0007lc-HZ for qemu-devel@nongnu.org; Thu, 29 Oct 2015 11:27:35 -0400 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email Security Gateway with ESMTPS id 463A1A7EFE6DC; Thu, 29 Oct 2015 15:27:24 +0000 (GMT) Received: from localhost.localdomain (192.168.14.192) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.235.1; Thu, 29 Oct 2015 15:27:26 +0000 From: Yongbok Kim To: Date: Thu, 29 Oct 2015 15:27:08 +0000 Message-ID: <1446132428-36981-1-git-send-email-yongbok.kim@imgtec.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 X-Originating-IP: [192.168.14.192] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Cc: leon.alrae@imgtec.com, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v3] target-mips: fix updating XContext on mmu exception X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Correct updating XContext.Region field on mmu exceptions. If Config3.CTXTC = 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. Also fixed the below line which overs 80 characters. Signed-off-by: Yongbok Kim --- target-mips/helper.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/target-mips/helper.c b/target-mips/helper.c index 2d86323..33f2be9 100644 --- a/target-mips/helper.c +++ b/target-mips/helper.c @@ -293,9 +293,10 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address, (env->CP0_EntryHi & 0xFF) | (address & (TARGET_PAGE_MASK << 1)); #if defined(TARGET_MIPS64) env->CP0_EntryHi &= env->SEGMask; - env->CP0_XContext = (env->CP0_XContext & ((~0ULL) << (env->SEGBITS - 7))) | - ((address & 0xC00000000000ULL) >> (55 - env->SEGBITS)) | - ((address & ((1ULL << env->SEGBITS) - 1) & 0xFFFFFFFFFFFFE000ULL) >> 9); + env->CP0_XContext = + /* PTEBase */ (env->CP0_XContext & ((~0ULL) << (env->SEGBITS - 7))) | + /* R */ (extract64(address, 62, 2) << (env->SEGBITS - 9)) | + /* BadVPN2 */ (extract64(address, 13, env->SEGBITS - 14) << 4); #endif cs->exception_index = exception; env->error_code = error_code;