arm64: Make sure COMPAT_FREEBSD32 handles thumb entry point.

If the entry point for the binary executed is a thumb 2 entry point, make
sure we set the PSR_T bit, or the CPU will interpret it as arm32 code and
bad things will happen.

PR: 256899
MFC after: 1 week
This commit is contained in:
Olivier Houchard
2021-06-30 14:50:47 +02:00
parent c1da17a86c
commit 712c060c94
+2
View File
@@ -258,6 +258,8 @@ freebsd32_setregs(struct thread *td, struct image_params *imgp,
tf->tf_x[14] = imgp->entry_addr; tf->tf_x[14] = imgp->entry_addr;
tf->tf_elr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr;
tf->tf_spsr = PSR_M_32; tf->tf_spsr = PSR_M_32;
if ((uint32_t)imgp->entry_addr & 1)
tf->tf_spsr |= PSR_T;
#ifdef VFP #ifdef VFP
vfp_reset_state(td, pcb); vfp_reset_state(td, pcb);