git: 2191473724fb - main - arm64: Handle thumb2 thread entry point.
Olivier Houchard
cognet at FreeBSD.org
Tue Sep 21 21:21:09 UTC 2021
The branch main has been updated by cognet:
URL: https://cgit.FreeBSD.org/src/commit/?id=2191473724fbac4a7ca6da24bdc23164126ee904
commit 2191473724fbac4a7ca6da24bdc23164126ee904
Author: Olivier Houchard <cognet at FreeBSD.org>
AuthorDate: 2021-09-21 21:17:53 +0000
Commit: Olivier Houchard <cognet at 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;
More information about the dev-commits-src-main
mailing list