Received: by 10.192.165.156 with SMTP id m28csp200778imm; Tue, 17 Apr 2018 08:44:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/itrepy+1tXyrU3P++NNKiviJtZ3wsPRUpZvQ4K2kzhk9pb5cVmXD78MuPvP1scouuXkWu X-Received: by 10.99.109.65 with SMTP id i62mr2192322pgc.233.1523979848335; Tue, 17 Apr 2018 08:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523979848; cv=none; d=google.com; s=arc-20160816; b=gaJGofxij2ID+bXD0DKm0jyNhXf7UwTLAIZbc6KB2TytUa0yOR+PXXPMdoW2UgNUAp Se/HKHdNFAZ+WIuFFXpDOJ/2fxITJF+Q4Hwojr7ZJ6rPveD+/+kN1C7MhkOIh6EseBbh T4+kAnBYMllO1JJi/KtofxdFDbzZFEjJ4QYksaYztXl0w6f+0XbY7Wg6YMZhCfcsAJIp oIutG0QKdhCX/6XVHWIl4J2DVt43hZdxBkeIlAlbadDhYxN5wFiuNpZJyXEN70dkOnks rLmB85QGQDHrvjrzJKsp6MwZOmMzP3qIyLf3TIX2qBbp811opIg9nCSOCDHNvnJBwdGu BrdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=kkxo535ed8TBA0Gb5Y4dZtKlxb3qZWRfaQ9R1qDbvBg=; b=aqhX49CLZN2cD3dLoqtYsiHMWDr8f5s5Uilvx9eUc15bjbrodyG4fFIIfwJOZMARd6 dSAwi52Rs5gTkp4b598PSqGIKJ+NLxykqd3x1178nF57X6P1vT62+pN4WYyXVqyb+vjW 3auMaCNiuXthdKvpzip5b+9j62OTWFBrROXP5iyLBpy17PkQc+LjzUCcRs8taXBtoCIt 3ggR8oSZqRcFfMkn9Nsi5CNH4NV/I2olUp53TvCWz0MM8xMX6JGcQ57gbqjsliDxPwWa nsuzwHwO5nQUXqpPZBn5TLNxtKFFzVCPoMUUOswbsAeRRgnDntiEvKgkRa6qNL0yHmtf KgfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si13926806ply.119.2018.04.17.08.43.54; Tue, 17 Apr 2018 08:44:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138AbeDQPl1 (ORCPT + 99 others); Tue, 17 Apr 2018 11:41:27 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.150.225]:42663 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753089AbeDQPlZ (ORCPT ); Tue, 17 Apr 2018 11:41:25 -0400 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx29.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Tue, 17 Apr 2018 15:41:18 +0000 Received: from mredfearn-linux.mipstec.com (192.168.155.41) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 17 Apr 2018 08:41:35 -0700 From: Matt Redfearn To: James Hogan , Ralf Baechle CC: , Matt Redfearn , Subject: [PATCH v2 4/4] MIPS: memset.S: Add comments to fault fixup handlers Date: Tue, 17 Apr 2018 16:40:03 +0100 Message-ID: <1523979603-492-4-git-send-email-matt.redfearn@mips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523979603-492-1-git-send-email-matt.redfearn@mips.com> References: <1523979603-492-1-git-send-email-matt.redfearn@mips.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.155.41] X-BESS-ID: 1523979677-637139-30405-48655-1 X-BESS-VER: 2018.4-r1804121647 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.192083 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is not immediately obvious what the expected inputs to these fault handlers is and how they calculate the number of unset bytes. Having stared deeply at this in order to fix some corner cases, add some comments to addist those who follow. Signed-off-by: Matt Redfearn --- Changes in v2: - Add comments to fault handlers in new, separate, patch. arch/mips/lib/memset.S | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S index 1cc306520a55..a06dabe99d4b 100644 --- a/arch/mips/lib/memset.S +++ b/arch/mips/lib/memset.S @@ -231,16 +231,25 @@ #ifdef CONFIG_CPU_MIPSR6 .Lbyte_fixup\@: + /* + * unset_bytes = current_addr + 1 + * a2 = t0 + 1 + */ PTR_SUBU a2, $0, t0 jr ra PTR_ADDIU a2, 1 #endif /* CONFIG_CPU_MIPSR6 */ .Lfirst_fixup\@: + /* unset_bytes already in a2 */ jr ra nop .Lfwd_fixup\@: + /* + * unset_bytes = partial_start_addr + #bytes - fault_addr + * a2 = t1 + (a2 & 3f) - $28->task->BUADDR + */ PTR_L t0, TI_TASK($28) andi a2, 0x3f LONG_L t0, THREAD_BUADDR(t0) @@ -249,6 +258,10 @@ LONG_SUBU a2, t0 .Lpartial_fixup\@: + /* + * unset_bytes = partial_end_addr + #bytes - fault_addr + * a2 = a0 + (a2 & STORMASK) - $28->task->BUADDR + */ PTR_L t0, TI_TASK($28) andi a2, STORMASK LONG_L t0, THREAD_BUADDR(t0) @@ -257,10 +270,15 @@ LONG_SUBU a2, t0 .Llast_fixup\@: + /* unset_bytes already in a2 */ jr ra nop .Lsmall_fixup\@: + /* + * unset_bytes = end_addr - current_addr + 1 + * a2 = t1 - a0 + 1 + */ PTR_SUBU a2, t1, a0 jr ra PTR_ADDIU a2, 1 -- 2.7.4