Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified)) by mollari.NetBSD.org (Postfix) with ESMTPS id 239EF1A921F for ; Fri, 1 Jan 2021 12:31:22 +0000 (UTC) Received: by mail.netbsd.org (Postfix, from userid 605) id 5647D85110; Fri, 1 Jan 2021 12:31:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 87FA88510C for ; Fri, 1 Jan 2021 12:31:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id FP_OHADUNNmx for ; Fri, 1 Jan 2021 12:31:20 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id D7DA584D69 for ; Fri, 1 Jan 2021 12:31:19 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id D5365FA9D; Fri, 1 Jan 2021 12:31:19 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Fri, 1 Jan 2021 12:31:19 +0000 From: "Martin Husemann" Subject: CVS commit: [netbsd-9] src/sys/arch/aarch64/aarch64 To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20210101123119.D5365FA9D@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Martin Husemann" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: martin Date: Fri Jan 1 12:31:19 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64 [netbsd-9]: trap.c Log Message: Pull up following revision(s) (requested by rin in ticket #1169): sys/arch/aarch64/aarch64/trap.c: revision 1.21 sys/arch/aarch64/aarch64/trap.c: revision 1.26 PR port-arm/54702 Add support for earmv6hf binaries on COMPAT_NETBSD32 for aarch64: - Emulate ARMv6 instructions with cache operations register (c7), that are deprecated since ARMv7, and disabled on ARMv8 with LP64 kernel. Many thanks to ryo@ for helping me to add support of Thumb-mode, as well as providing exhaustive test cases: https://github.com/ryo/mcr_test/ We've confirmed: - Emulation works in Thumb-mode. - T32 16-bit length illegal instruction results in SIGILL, even if it is located nearby a boundary b/w mapped and unmapped pages. - T32 32-bit instruction results in SIGSEGV if it is located across a boundary b/w mapped and unmapped pages. When emulating obsoleted arm32 instructions, use ufetch(9) rather than dereference tf_pc directly to retrieve an instruction. Even if tf_pc is valid when processor decodes the instruction, someone can unmap its page before tf_pc is read in the exception handler. Now, SIGSEGV is delivered correctly to the process in this case, rather than kernel panic. Pointed out by maxv. Discussed with ryo and skrll. To generate a diff of this commit: cvs rdiff -u -r1.17.4.2 -r1.17.4.3 src/sys/arch/aarch64/aarch64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.