From owner-freebsd-riscv@freebsd.org Mon Oct 26 05:21:29 2020 Return-Path: Delivered-To: freebsd-riscv@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C65B43A4F7 for ; Mon, 26 Oct 2020 05:21:29 +0000 (UTC) (envelope-from ah@melesmeles.cz) Received: from mx-9.mail.web4u.cz (smtp10.web4u.cz [81.91.87.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CKNVH6ldHz3TtP for ; Mon, 26 Oct 2020 05:21:27 +0000 (UTC) (envelope-from ah@melesmeles.cz) Received: from mx-9.mail.web4u.cz (localhost [127.0.0.1]) by mx-9.mail.web4u.cz (Postfix) with ESMTP id 750BF200BF2 for ; Mon, 26 Oct 2020 06:21:17 +0100 (CET) Received: from antos (unknown [85.207.122.76]) (Authenticated sender: ah@melesmeles.cz) by mx-9.mail.web4u.cz (Postfix) with ESMTPA id 45782200B2F for ; Mon, 26 Oct 2020 06:21:17 +0100 (CET) From: Antonin Houska To: freebsd-riscv@freebsd.org Subject: locore.S - two cosmetic changes X-Mailer: MH-E 8.6+git; nmh 1.7; GNU Emacs 26.3.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Mon, 26 Oct 2020 07:23:22 +0100 Message-ID: <65290.1603693402@antos> X-W4U-Auth: 89d19b40d669ac68bf9f42ecb7af7048973f1fcb X-Rspamd-Queue-Id: 4CKNVH6ldHz3TtP X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of ah@melesmeles.cz has no SPF policy when checking 81.91.87.90) smtp.mailfrom=ah@melesmeles.cz X-Spamd-Result: default: False [1.25 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.19)[-0.191]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.34)[-0.341]; HAS_ATTACHMENT(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-diff]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; PREVIOUSLY_DELIVERED(0.00)[freebsd-riscv@freebsd.org]; NEURAL_SPAM_SHORT(0.38)[0.383]; DMARC_NA(0.00)[melesmeles.cz]; MID_RHS_NOT_FQDN(0.50)[]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+]; ASN(0.00)[asn:39790, ipnet:81.91.80.0/20, country:CZ]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[freebsd-riscv] X-BeenThere: freebsd-riscv@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: FreeBSD on the RISC-V instruction set architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2020 05:21:29 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, while trying to understand the code, I've spotted two things that might need to be improved - please see the attachments. remove_useless_assignment.patch removes setting of register value which is = not used until the next value is set. use_constant_not_literal.patch probably needs no explanation. --=20 Anton=C3=ADn Houska www.melesmeles.cz --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=remove_useless_assignment.patch Index: sys/riscv/riscv/locore.S =================================================================== --- sys/riscv/riscv/locore.S (revision 366768) +++ sys/riscv/riscv/locore.S (working copy) @@ -138,7 +138,6 @@ srli t4, s9, 21 /* Div physmem base by 2 MiB */ li t2, 512 /* Build 512 entries */ add t3, t4, t2 - li t5, 0 li t0, (PTE_KERN | PTE_X) 1: slli t2, t4, PTE_PPN1_S /* << PTE_PPN1_S */ --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=use_constant_not_literal.patch Index: sys/riscv/riscv/locore.S =================================================================== --- sys/riscv/riscv/locore.S (revision 366768) +++ sys/riscv/riscv/locore.S (working copy) @@ -135,7 +135,7 @@ /* Level 2 superpages (512 x 2MiB) */ lla s1, pagetable_l2 - srli t4, s9, 21 /* Div physmem base by 2 MiB */ + srli t4, s9, L2_SHIFT /* Div physmem base by 2 MiB */ li t2, 512 /* Build 512 entries */ add t3, t4, t2 li t5, 0 --=-=-=--