Date: Wed, 7 Jul 2021 20:25:28 GMT From: Olivier Houchard <cognet@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 9bc7bbcf214b - stable/12 - arm: Make sure we can handle a thumb entry point. Message-ID: <202107072025.167KPSqH080704@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=9bc7bbcf214b9e15b67e42706cef770ede541913 commit 9bc7bbcf214b9e15b67e42706cef770ede541913 Author: Olivier Houchard <cognet@FreeBSD.org> AuthorDate: 2021-06-30 20:56:50 +0000 Commit: Olivier Houchard <cognet@FreeBSD.org> CommitDate: 2021-07-07 20:24:56 +0000 arm: Make sure we can handle a thumb entry point. Similarly to what's been done on arm64 with commit 712c060c94fd447c91b0e6218c12a431206b487a, 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 (cherry picked from commit 8c3bd133dd52824e427e350c65eae1fd9eb5a3cd) Signed-off-by: Olivier Houchard <cognet@FreeBSD.org> --- sys/arm/arm/machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index f24df96ca3d6..a1354f303b3a 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -425,6 +425,8 @@ exec_setregs(struct thread *td, struct image_params *imgp, u_long 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107072025.167KPSqH080704>