Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105275
b: refs/heads/master
c: a352894
h: refs/heads/master
i:
  105273: 926649c
  105271: 387275c
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Linus Torvalds committed Jul 24, 2008
1 parent e29a7e1 commit 2c4310b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1f242ff460e4b50a045fa237c3c56cce9eabf83
refs/heads/master: a352894d07059649398c4769dc8b645e1a1dad88
23 changes: 23 additions & 0 deletions trunk/arch/powerpc/platforms/cell/spufs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,32 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_NOPAGE;
}

static int spufs_mem_mmap_access(struct vm_area_struct *vma,
unsigned long address,
void *buf, int len, int write)
{
struct spu_context *ctx = vma->vm_file->private_data;
unsigned long offset = address - vma->vm_start;
char *local_store;

if (write && !(vma->vm_flags & VM_WRITE))
return -EACCES;
if (spu_acquire(ctx))
return -EINTR;
if ((offset + len) > vma->vm_end)
len = vma->vm_end - offset;
local_store = ctx->ops->get_ls(ctx);
if (write)
memcpy_toio(local_store + offset, buf, len);
else
memcpy_fromio(buf, local_store + offset, len);
spu_release(ctx);
return len;
}

static struct vm_operations_struct spufs_mem_mmap_vmops = {
.fault = spufs_mem_mmap_fault,
.access = spufs_mem_mmap_access,
};

static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
Expand Down

0 comments on commit 2c4310b

Please sign in to comment.