diff options
author | benno <benno@FreeBSD.org> | 2002-04-29 09:28:56 +0000 |
---|---|---|
committer | benno <benno@FreeBSD.org> | 2002-04-29 09:28:56 +0000 |
commit | 5ca178fbceba9f4455ec098a72f696929ddc086f (patch) | |
tree | ec57f5777ee2368e5d2c2c3f564a3a3a95fe59b4 /sys | |
parent | 2eb82b93ad637b0d0525d53112535fe89053281c (diff) | |
download | FreeBSD-src-5ca178fbceba9f4455ec098a72f696929ddc086f.zip FreeBSD-src-5ca178fbceba9f4455ec098a72f696929ddc086f.tar.gz |
- Add back calls to setfault that were removed when these functions were moved.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/powerpc/aim/copyinout.c | 88 | ||||
-rw-r--r-- | sys/powerpc/powerpc/copyinout.c | 88 |
2 files changed, 148 insertions, 28 deletions
diff --git a/sys/powerpc/aim/copyinout.c b/sys/powerpc/aim/copyinout.c index c1ec6d3..a7d416c 100644 --- a/sys/powerpc/aim/copyinout.c +++ b/sys/powerpc/aim/copyinout.c @@ -83,6 +83,7 @@ copyout(const void *kaddr, void *udaddr, size_t len) { struct thread *td; pmap_t pm; + faultbuf env; const char *kp; char *up, *p; size_t l; @@ -90,6 +91,14 @@ copyout(const void *kaddr, void *udaddr, size_t len) td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; + printf("copyout: called with %p, %p, %d (td=%p)\n", kaddr, udaddr, len, + td); + + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + kp = kaddr; up = udaddr; @@ -109,6 +118,7 @@ copyout(const void *kaddr, void *udaddr, size_t len) len -= l; } + td->td_pcb->pcb_onfault = NULL; return (0); } @@ -117,6 +127,7 @@ copyin(const void *udaddr, void *kaddr, size_t len) { struct thread *td; pmap_t pm; + faultbuf env; const char *up; char *kp, *p; size_t l; @@ -124,6 +135,14 @@ copyin(const void *udaddr, void *kaddr, size_t len) td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; + printf("copyin: called with %p, %p, %d (td=%p)\n", udaddr, kaddr, len, + td); + + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + kp = kaddr; up = udaddr; @@ -143,6 +162,7 @@ copyin(const void *udaddr, void *kaddr, size_t len) len -= l; } + td->td_pcb->pcb_onfault = NULL; return (0); } @@ -151,6 +171,7 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) { struct thread *td; pmap_t pm; + faultbuf env; const char *up; char *kp; size_t l; @@ -159,6 +180,11 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + kp = kaddr; up = udaddr; @@ -181,24 +207,32 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) *done = l; } + td->td_pcb->pcb_onfault = NULL; return (rv); } int subyte(void *addr, int byte) { - struct thread *td; - pmap_t pm; - char *p; + struct thread *td; + pmap_t pm; + faultbuf env; + char *p; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (char *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); *p = (char)byte; + td->td_pcb->pcb_onfault = NULL; return (0); } @@ -212,49 +246,75 @@ suibyte(void *addr, int byte) int suword(void *addr, long word) { - struct thread *td; - pmap_t pm; - long *p; + struct thread *td; + pmap_t pm; + faultbuf env; + long *p; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); *p = word; + td->td_pcb->pcb_onfault = NULL; return (0); } int fubyte(const void *addr) { - struct thread *td; - pmap_t pm; - char *p; + struct thread *td; + pmap_t pm; + faultbuf env; + char *p; + int val; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (char *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); - return ((int)*p); + val = (int)*p; + + td->td_pcb->pcb_onfault = NULL; + return (val); } long fuword(const void *addr) { - struct thread *td; - pmap_t pm; - long *p; + struct thread *td; + pmap_t pm; + faultbuf env; + long *p, val; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); - return (*p); + val = *p; + + td->td_pcb->pcb_onfault = NULL; + return (val); } diff --git a/sys/powerpc/powerpc/copyinout.c b/sys/powerpc/powerpc/copyinout.c index c1ec6d3..a7d416c 100644 --- a/sys/powerpc/powerpc/copyinout.c +++ b/sys/powerpc/powerpc/copyinout.c @@ -83,6 +83,7 @@ copyout(const void *kaddr, void *udaddr, size_t len) { struct thread *td; pmap_t pm; + faultbuf env; const char *kp; char *up, *p; size_t l; @@ -90,6 +91,14 @@ copyout(const void *kaddr, void *udaddr, size_t len) td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; + printf("copyout: called with %p, %p, %d (td=%p)\n", kaddr, udaddr, len, + td); + + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + kp = kaddr; up = udaddr; @@ -109,6 +118,7 @@ copyout(const void *kaddr, void *udaddr, size_t len) len -= l; } + td->td_pcb->pcb_onfault = NULL; return (0); } @@ -117,6 +127,7 @@ copyin(const void *udaddr, void *kaddr, size_t len) { struct thread *td; pmap_t pm; + faultbuf env; const char *up; char *kp, *p; size_t l; @@ -124,6 +135,14 @@ copyin(const void *udaddr, void *kaddr, size_t len) td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; + printf("copyin: called with %p, %p, %d (td=%p)\n", udaddr, kaddr, len, + td); + + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + kp = kaddr; up = udaddr; @@ -143,6 +162,7 @@ copyin(const void *udaddr, void *kaddr, size_t len) len -= l; } + td->td_pcb->pcb_onfault = NULL; return (0); } @@ -151,6 +171,7 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) { struct thread *td; pmap_t pm; + faultbuf env; const char *up; char *kp; size_t l; @@ -159,6 +180,11 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + kp = kaddr; up = udaddr; @@ -181,24 +207,32 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) *done = l; } + td->td_pcb->pcb_onfault = NULL; return (rv); } int subyte(void *addr, int byte) { - struct thread *td; - pmap_t pm; - char *p; + struct thread *td; + pmap_t pm; + faultbuf env; + char *p; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (char *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); *p = (char)byte; + td->td_pcb->pcb_onfault = NULL; return (0); } @@ -212,49 +246,75 @@ suibyte(void *addr, int byte) int suword(void *addr, long word) { - struct thread *td; - pmap_t pm; - long *p; + struct thread *td; + pmap_t pm; + faultbuf env; + long *p; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); *p = word; + td->td_pcb->pcb_onfault = NULL; return (0); } int fubyte(const void *addr) { - struct thread *td; - pmap_t pm; - char *p; + struct thread *td; + pmap_t pm; + faultbuf env; + char *p; + int val; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (char *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); - return ((int)*p); + val = (int)*p; + + td->td_pcb->pcb_onfault = NULL; + return (val); } long fuword(const void *addr) { - struct thread *td; - pmap_t pm; - long *p; + struct thread *td; + pmap_t pm; + faultbuf env; + long *p, val; td = PCPU_GET(curthread); pm = &td->td_proc->p_vmspace->vm_pmap; p = (long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK)); + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (EFAULT); + } + set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]); - return (*p); + val = *p; + + td->td_pcb->pcb_onfault = NULL; + return (val); } |