Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138476
b: refs/heads/master
c: 60ee031
h: refs/heads/master
v: v3
  • Loading branch information
Jeremy Kerr authored and Benjamin Herrenschmidt committed Feb 22, 2009
1 parent 74d3f89 commit 9ece3ad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 13870b657578bcce167978ee93dc02bf54e3beb0
refs/heads/master: 60ee031940c1b09c137b617a8829e2f081961fe0
48 changes: 22 additions & 26 deletions trunk/arch/powerpc/platforms/cell/spu_fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,60 +39,56 @@ int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
unsigned long is_write;
int ret;

#if 0
if (!IS_VALID_EA(ea)) {
if (mm == NULL)
return -EFAULT;
}
#endif /* XXX */
if (mm == NULL) {
return -EFAULT;
}
if (mm->pgd == NULL) {

if (mm->pgd == NULL)
return -EFAULT;
}

down_read(&mm->mmap_sem);
ret = -EFAULT;
vma = find_vma(mm, ea);
if (!vma)
goto bad_area;
if (vma->vm_start <= ea)
goto good_area;
if (!(vma->vm_flags & VM_GROWSDOWN))
goto bad_area;
if (expand_stack(vma, ea))
goto bad_area;
good_area:
goto out_unlock;

if (ea < vma->vm_start) {
if (!(vma->vm_flags & VM_GROWSDOWN))
goto out_unlock;
if (expand_stack(vma, ea))
goto out_unlock;
}

is_write = dsisr & MFC_DSISR_ACCESS_PUT;
if (is_write) {
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
goto out_unlock;
} else {
if (dsisr & MFC_DSISR_ACCESS_DENIED)
goto bad_area;
goto out_unlock;
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
goto out_unlock;
}

ret = 0;
*flt = handle_mm_fault(mm, vma, ea, is_write);
if (unlikely(*flt & VM_FAULT_ERROR)) {
if (*flt & VM_FAULT_OOM) {
ret = -ENOMEM;
goto bad_area;
goto out_unlock;
} else if (*flt & VM_FAULT_SIGBUS) {
ret = -EFAULT;
goto bad_area;
goto out_unlock;
}
BUG();
}

if (*flt & VM_FAULT_MAJOR)
current->maj_flt++;
else
current->min_flt++;
up_read(&mm->mmap_sem);
return ret;

bad_area:
out_unlock:
up_read(&mm->mmap_sem);
return -EFAULT;
return ret;
}
EXPORT_SYMBOL_GPL(spu_handle_mm_fault);

0 comments on commit 9ece3ad

Please sign in to comment.