From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:21:09 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D1C7567B85C; Tue, 21 Sep 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDZ9K5d2xz4bTP; Tue, 21 Sep 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1AC12FED; Tue, 21 Sep 2021 21:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LLL93B053366; Tue, 21 Sep 2021 21:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLL9kF053365; Tue, 21 Sep 2021 21:21:09 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:21:09 GMT Message-Id: <202109212121.18LLL9kF053365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 2191473724fb - main - arm64: Handle thumb2 thread entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2191473724fbac4a7ca6da24bdc23164126ee904 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 21:21:09 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=2191473724fbac4a7ca6da24bdc23164126ee904 commit 2191473724fbac4a7ca6da24bdc23164126ee904 Author: Olivier Houchard AuthorDate: 2021-09-21 21:17:53 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 21:20:27 +0000 arm64: Handle thumb2 thread entry point. In cpu_set_upcall(), if the thread startup routine is a thumb routine, make sure to set PSR_T, so that the CPU will run in thumb mode. MFC After: 1 week --- sys/arm64/arm64/vm_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index bf7641074317..dfc2f8cb267f 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -200,9 +200,11 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, struct trapframe *tf = td->td_frame; /* 32bits processes use r13 for sp */ - if (td->td_frame->tf_spsr & PSR_M_32) + if (td->td_frame->tf_spsr & PSR_M_32) { tf->tf_x[13] = STACKALIGN((uintptr_t)stack->ss_sp + stack->ss_size); - else + if ((register_t)entry & 1) + tf->tf_spsr |= PSR_T; + } else tf->tf_sp = STACKALIGN((uintptr_t)stack->ss_sp + stack->ss_size); tf->tf_elr = (register_t)entry; tf->tf_x[0] = (register_t)arg;