- Add back calls to setfault that were removed when these functions were moved.

This commit is contained in:
Benno Rice 2002-04-29 09:28:56 +00:00
parent dbe620d321
commit d809b79220
2 changed files with 148 additions and 28 deletions

View File

@ -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,6 +207,7 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done)
*done = l;
}
td->td_pcb->pcb_onfault = NULL;
return (rv);
}
@ -189,16 +216,23 @@ subyte(void *addr, int byte)
{
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);
}
@ -214,16 +248,23 @@ suword(void *addr, long word)
{
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);
}
@ -232,15 +273,25 @@ fubyte(const void *addr)
{
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
@ -248,13 +299,22 @@ fuword(const void *addr)
{
struct thread *td;
pmap_t pm;
long *p;
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);
}

View File

@ -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,6 +207,7 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done)
*done = l;
}
td->td_pcb->pcb_onfault = NULL;
return (rv);
}
@ -189,16 +216,23 @@ subyte(void *addr, int byte)
{
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);
}
@ -214,16 +248,23 @@ suword(void *addr, long word)
{
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);
}
@ -232,15 +273,25 @@ fubyte(const void *addr)
{
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
@ -248,13 +299,22 @@ fuword(const void *addr)
{
struct thread *td;
pmap_t pm;
long *p;
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);
}