diff options
| author | Olivier Houchard <cognet@FreeBSD.org> | 2021-06-30 12:50:47 +0000 |
|---|---|---|
| committer | Olivier Houchard <cognet@FreeBSD.org> | 2021-07-07 20:22:18 +0000 |
| commit | d2e48ad87d3e0f63f4ac73c524fb18afce4a2d53 (patch) | |
| tree | db5692a5b3c3a8df3c73faf0c679123464f3e53a | |
| parent | 0f4cb36cef406cc7dae7100df82297f1a4b16585 (diff) | |
| download | src-d2e48ad87d3e0f63f4ac73c524fb18afce4a2d53.tar.gz src-d2e48ad87d3e0f63f4ac73c524fb18afce4a2d53.zip | |
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
(cherry picked from commit 712c060c94fd447c91b0e6218c12a431206b487a)
Signed-off-by: Olivier Houchard <cognet@FreeBSD.org>
| -rw-r--r-- | sys/arm64/arm64/elf32_machdep.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index b9669616e1dd..6c98f7c839ca 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -255,6 +255,8 @@ freebsd32_setregs(struct thread *td, struct image_params *imgp, tf->tf_x[14] = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; tf->tf_spsr = PSR_M_32; + if ((uint32_t)imgp->entry_addr & 1) + tf->tf_spsr |= PSR_T; #ifdef VFP vfp_reset_state(td, pcb); |
