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.
This commit is contained in:
Olivier Houchard 2020-02-24 16:25:11 +00:00
parent 888810f0fb
commit b0254d9afb

View File

@ -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 trapframe *frame)
{
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);