git: a342ecd326ee - main - arm: Handle thumb2 thread entry point.

Olivier Houchard cognet at FreeBSD.org
Tue Sep 21 21:21:11 UTC 2021


The branch main has been updated by cognet:

URL: https://cgit.FreeBSD.org/src/commit/?id=a342ecd326ee9e021b0a4d6dc8aca1a297c606f8

commit a342ecd326ee9e021b0a4d6dc8aca1a297c606f8
Author:     Olivier Houchard <cognet at FreeBSD.org>
AuthorDate: 2021-09-21 21:19:46 +0000
Commit:     Olivier Houchard <cognet at FreeBSD.org>
CommitDate: 2021-09-21 21:20:27 +0000

    arm: 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/arm/arm/vm_machdep.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c
index 03bbf75ebf71..ba44aa162e8b 100644
--- a/sys/arm/arm/vm_machdep.c
+++ b/sys/arm/arm/vm_machdep.c
@@ -235,6 +235,8 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg,
 	tf->tf_pc = (int)entry;
 	tf->tf_r0 = (int)arg;
 	tf->tf_spsr = PSR_USR32_MODE;
+	if ((register_t)entry & 1)
+		tf->tf_spsr |= PSR_T;
 }
 
 int


More information about the dev-commits-src-main mailing list