1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

arm: Make sure we can handle a thumb entry point.

Similarly to what's been done on arm64 with commit
712c060c94, when executing a binary, if the
entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise
the CPU will interpret it in ARM mode, and that will likely leads to an
undefined instruction.

PR:	256899
MFC after: 	1 week
This commit is contained in:
Olivier Houchard 2021-06-30 22:56:50 +02:00
parent d75d33870d
commit 8c3bd133dd

View File

@ -346,6 +346,8 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack)
tf->tf_svc_lr = 0x77777777;
tf->tf_pc = imgp->entry_addr;
tf->tf_spsr = PSR_USR32_MODE;
if ((register_t)imgp->entry_addr & 1)
tf->tf_spsr |= PSR_T;
}
#ifdef VFP