Author: cognet Date: Mon Feb 24 16:25:11 2020 New Revision: 358290 URL: https://svnweb.freebsd.org/changeset/base/358290
Log: debug_monitor: Avoid setting the PSR_D flag for 32bits binaries. In dbg_monitor_exit(), avoid setting the PSR_D bit if the process is a 32bits binary. PSR_D is an aarch64-only flags, and for aarch32 processes, it means "run in big endian". This should make COMPAT_FREEBSD32 run much better on arm64. Modified: head/sys/arm64/arm64/debug_monitor.c Modified: head/sys/arm64/arm64/debug_monitor.c ============================================================================== --- head/sys/arm64/arm64/debug_monitor.c Mon Feb 24 15:35:31 2020 (r358289) +++ head/sys/arm64/arm64/debug_monitor.c Mon Feb 24 16:25:11 2020 (r358290) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include <sys/pcpu.h> #include <sys/proc.h> #include <sys/systm.h> +#include <sys/sysent.h> #include <machine/armreg.h> #include <machine/cpu.h> @@ -534,7 +535,13 @@ dbg_monitor_exit(struct thread *thread, struct trapfra { int i; - frame->tf_spsr |= PSR_D; + /* + * PSR_D is an aarch64-only flag. On aarch32, it switches + * the processor to big-endian, so avoid setting it for + * 32bits binaries. + */ + if (!(SV_PROC_FLAG(thread->td_proc, SV_ILP32))) + frame->tf_spsr |= PSR_D; if ((thread->td_pcb->pcb_dbg_regs.dbg_flags & DBGMON_ENABLED) != 0) { /* Install the kernel version of the registers */ dbg_register_sync(&thread->td_pcb->pcb_dbg_regs); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"