diff options
author | marcel <marcel@FreeBSD.org> | 2003-12-09 09:52:14 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-12-09 09:52:14 +0000 |
commit | b8e9d2beb09dec95b73cc2fa7c5e73bdae39a899 (patch) | |
tree | 38b906373a018da854ce32707d7f540212add6a7 /sys/ia64 | |
parent | 5b310e02edcb92643a0b5d16f1305c1569c509f7 (diff) | |
download | FreeBSD-src-b8e9d2beb09dec95b73cc2fa7c5e73bdae39a899.zip FreeBSD-src-b8e9d2beb09dec95b73cc2fa7c5e73bdae39a899.tar.gz |
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.
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/trap.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c index 96df125..e8622aa 100644 --- a/sys/ia64/ia64/trap.c +++ b/sys/ia64/ia64/trap.c @@ -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: |