Don't panic for misalignment traps when the onfault handler is set.

Not all transfers between kernel and user space are byte oriented
and thus alignment safe. Especially fuword*() and suword*() are
sensitive to alignment but in general more optimal than block copies.
By catching the misalignment trap we avoid pessimizing the common
case of properly aligned memory accesses which we would do if we
were to use byte copies or adding tests for proper alignment.

Note that the expectation that the kernel produces aligned pointers
is unchanged. This change therefore relates to possible unaligned
pointers generated in userland.
This commit is contained in:
Marcel Moolenaar 2003-12-09 09:52:14 +00:00
parent 8c307294e6
commit b291daba6f

View file

@ -648,8 +648,17 @@ trap(int vector, struct trapframe *framep)
if (sig == 0)
goto out;
ucode = framep->tf_special.ifa; /* VA */
} else
} else {
/* Check for copyin/copyout fault. */
if (td != NULL && td->td_pcb->pcb_onfault != 0) {
framep->tf_special.iip =
td->td_pcb->pcb_onfault;
framep->tf_special.psr &= ~IA64_PSR_RI;
td->td_pcb->pcb_onfault = 0;
goto out;
}
trap_panic(vector, framep);
}
break;
case IA64_VEC_FLOATING_POINT_FAULT: