Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3526023pxb; Tue, 12 Jan 2021 17:36:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjCHtUAxavyLf9e5FD5yeETIxBlo8IIeNXqAlNK7VGrNuEsjOlQ1XbU+t5vg9d0+Mjwf2a X-Received: by 2002:a17:906:6d0b:: with SMTP id m11mr1071189ejr.230.1610501790783; Tue, 12 Jan 2021 17:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610501790; cv=none; d=google.com; s=arc-20160816; b=I9NfGV0X7L9JlOoa7ldrOKetmHxKq4hgUJSXk6v8PsoZVaWTqXpJtgXNo6TJrf7Qrv TL/3wmLXZZwDmlrKZtoC+ZYrWqAD0qkdzcJ9vI1v1GsV0vpgG22xA7Uj+gV57eJ7FUH9 9Qe6nemF2B5CePZuo8df5vzXqN6Bpn/DE9p4KOBJnxrnOG4tPRWiFEFxXi5g7//pumZ3 cJXcKm9GUJVHTvxuJzzzwYNDk/EemSKZWrgOO/ZOs3xx4xphtZj5Z4euMfsmcPdfixap 2qy9BfR6a7wzRCibwNq00fRddwIaW0yySrZA7+aJKTYF1E5t2oSn9BYqqHbAtssgS0JW sjwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=46rfBw4bEDcUYcR8avoNjWx1ed7rr2MUbn7c1joxrbw=; b=B+7YgRZorQdHU3i3YYoVSvhUQwfPKrWcYnq+koCDviYXHBlrzzZ+lLVboca0vYgXy0 7e1Z6SsSYsFJRQZDvPGo21m348B3ErA/0cnDpUzqQoLY6wKDmWzC+cS2KgQrDwBxXnCC FGM6eBv/Ix/XWLRWU0aSKzh0npZWVeoVmKsnJXS8yRxErfDkEUw6jkDG/qicJ9A2jNJn ZlPooSgGN7Ky3bQAoEl+EQdsk9FM31nRee8q6hCKb2nuJLGnA80DD1E86grY/JMo+9GK N6m5y/iY5ICCkjmJov2+zI5AIPxS5yl3PCT+RL1qfQ4rueIWxnlisA9xF5/OcBaowCFM RMhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si183121ejw.546.2021.01.12.17.36.07; Tue, 12 Jan 2021 17:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387758AbhALMaG (ORCPT + 99 others); Tue, 12 Jan 2021 07:30:06 -0500 Received: from mail.loongson.cn ([114.242.206.163]:34334 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731468AbhALMaF (ORCPT ); Tue, 12 Jan 2021 07:30:05 -0500 Received: from loongson.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx6L0dlv1fsycDAA--.5569S4; Tue, 12 Jan 2021 20:29:18 +0800 (CST) From: Jinyang He To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Burton , Jun-Ru Chang Subject: [PATCH 2/4] MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op Date: Tue, 12 Jan 2021 20:29:15 +0800 Message-Id: <1610454557-25867-3-git-send-email-hejinyang@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1610454557-25867-1-git-send-email-hejinyang@loongson.cn> References: <1610454557-25867-1-git-send-email-hejinyang@loongson.cn> X-CM-TRANSID: AQAAf9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7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUyg10UUUUU X-CM-SenderInfo: pkhmx0p1dqwqxorr0wxvrqhubq/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mm16_r5_format.rt is 5 bits, so directly judge the value if equal or not. mm_jalr_op requires 7th to 16th bits. These 10 which bits generated by shifting u_format.uimmediate by 6 may be affected by sign extension. Thus, take out the 10 bits for comparison. Without this patch, errors may occur, such as these bits are all ones. Signed-off-by: Jinyang He --- arch/mips/kernel/process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 361bd28..94dfdf4 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -311,8 +311,8 @@ static inline int is_jump_ins(union mips_instruction *ip) * microMIPS is kind of more fun... */ if (mm_insn_16bit(ip->word >> 16)) { - if ((ip->mm16_r5_format.opcode == mm_pool16c_op && - (ip->mm16_r5_format.rt & mm_jr16_op) == mm_jr16_op)) + if (ip->mm16_r5_format.opcode == mm_pool16c_op && + ip->mm16_r5_format.rt == mm_jr16_op) return 1; return 0; } @@ -324,7 +324,7 @@ static inline int is_jump_ins(union mips_instruction *ip) if (ip->r_format.opcode != mm_pool32a_op || ip->r_format.func != mm_pool32axf_op) return 0; - return ((ip->u_format.uimmediate >> 6) & mm_jalr_op) == mm_jalr_op; + return ((ip->u_format.uimmediate >> 6) & GENMASK(9,0)) == mm_jalr_op; #else if (ip->j_format.opcode == j_op) return 1; -- 2.1.0