summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-03-31 01:13:21 +0000
committeralc <alc@FreeBSD.org>2002-03-31 01:13:21 +0000
commit3778bbd36ef9d79b54931bf2db445bd0ba1922c6 (patch)
treee029f2dfd08d59442a68f157d4d99b6615bec0a0 /sys/amd64
parentbd314bbdd76976de3bda18d79e3067f0ca77c6e3 (diff)
downloadFreeBSD-src-3778bbd36ef9d79b54931bf2db445bd0ba1922c6.zip
FreeBSD-src-3778bbd36ef9d79b54931bf2db445bd0ba1922c6.tar.gz
Implement i386's (o)sigreturn() like the alpha's: Use copyin() to read
the osigcontext or ucontext_t rather than useracc() followed by direct user- space memory accesses. This reduces (o)sigreturn()'s execution time by 5- 50%. Submitted by: bde
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/machdep.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index b96b93e..6617f17 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -553,15 +553,17 @@ osigreturn(td, uap)
} */ *uap;
{
#ifdef COMPAT_43
+ struct osigcontext sc;
struct trapframe *regs;
struct osigcontext *scp;
struct proc *p = td->td_proc;
- int eflags;
+ int eflags, error;
regs = td->td_frame;
- scp = uap->sigcntxp;
- if (!useracc((caddr_t)scp, sizeof(*scp), VM_PROT_READ))
- return (EFAULT);
+ error = copyin(uap->sigcntxp, &sc, sizeof(sc));
+ if (error != 0)
+ return (error);
+ scp = &sc;
eflags = scp->sc_ps;
if (eflags & PSL_VM) {
struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs;
@@ -667,14 +669,16 @@ sigreturn(td, uap)
const __ucontext *sigcntxp;
} */ *uap;
{
+ ucontext_t uc;
struct proc *p = td->td_proc;
struct trapframe *regs;
const ucontext_t *ucp;
- int cs, eflags;
+ int cs, eflags, error;
- ucp = uap->sigcntxp;
- if (!useracc((caddr_t)(uintptr_t)ucp, sizeof(*ucp), VM_PROT_READ))
- return (EFAULT);
+ error = copyin(uap->sigcntxp, &uc, sizeof(uc));
+ if (error != 0)
+ return (error);
+ ucp = &uc;
regs = td->td_frame;
eflags = ucp->uc_mcontext.mc_eflags;
if (eflags & PSL_VM) {
OpenPOWER on IntegriCloud