From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgZta-000594-SS for qemu-devel@nongnu.org; Tue, 21 Oct 2014 09:54:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgZtU-00054I-JD for qemu-devel@nongnu.org; Tue, 21 Oct 2014 09:54:42 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:48538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgZtU-000541-DU for qemu-devel@nongnu.org; Tue, 21 Oct 2014 09:54:36 -0400 Message-ID: <54466597.60405@imgtec.com> Date: Tue, 21 Oct 2014 14:54:31 +0100 From: Leon Alrae MIME-Version: 1.0 References: <1405354795-25884-1-git-send-email-leon.alrae@imgtec.com> <1405354795-25884-5-git-send-email-leon.alrae@imgtec.com> <5444E1CB.8000009@imgtec.com> In-Reply-To: <5444E1CB.8000009@imgtec.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/6] target-mips: add restrictions for possible values in registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yongbok Kim , "qemu-devel@nongnu.org" Cc: "aurelien@aurel32.net" On 20/10/2014 11:19, Yongbok Kim wrote: >> void helper_mtc0_wired(CPUMIPSState *env, target_ulong arg1) >> { >> - env->CP0_Wired = arg1 % env->tlb->nb_tlb; >> + if (env->insn_flags & ISA_MIPS32R6) { >> + if (arg1 < env->tlb->nb_tlb) { >> + env->CP0_Wired = arg1; > > Wired field should be compared with Limit field (and as a result, number > of entries in the TLB). >>From spec's point of view the implementation is correct. It supports "Limit = 0" - maximum number of wired entries is equal to the number of TLB entries minus one. Obviously we will have to add Limit field once we decide to support Limit > 0. > >> + } >> + } else { >> + env->CP0_Wired = arg1 % env->tlb->nb_tlb; >> + } >> } >> >> void helper_mtc0_srsconf0(CPUMIPSState *env, target_ulong arg1) >> @@ -1368,11 +1379,14 @@ void helper_mtc0_entryhi(CPUMIPSState *env, target_ulong arg1) >> } >> >> /* 1k pages not implemented */ >> - val = arg1 & mask; >> #if defined(TARGET_MIPS64) >> - val &= env->SEGMask; >> + if ((env->insn_flags & ISA_MIPS32R6) && extract64(arg1, 62, 2) == 0x2) { >> + mask &= ~(0x3ull << 62); > > If Config0_AT = 1, R field is restricted for 1 as well. Good spot, thanks. Regards, Leon