Date: Tue, 21 Sep 2021 21:21:09 GMT From: Olivier Houchard <cognet@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 2191473724fb - main - arm64: Handle thumb2 thread entry point. Message-ID: <202109212121.18LLL9kF053365@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=2191473724fbac4a7ca6da24bdc23164126ee904 commit 2191473724fbac4a7ca6da24bdc23164126ee904 Author: Olivier Houchard <cognet@FreeBSD.org> AuthorDate: 2021-09-21 21:17:53 +0000 Commit: Olivier Houchard <cognet@FreeBSD.org> 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109212121.18LLL9kF053365>