Commit a352894d authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds
Browse files

spufs: use new vm_ops->access to allow local state access from gdb

This uses the new vm_ops->access to allow gdb to access the SPU local
store.  We currently prevent access to problem state registers, this can
be done later if really needed but it's safer not to.

[ fix typo]
Signed-off-by: default avatarBenjamin Herrenschmidt <>
Signed-off-by: default avatarRik van Riel <>
Cc: Dave Airlie <>
Cc: Hugh Dickins <>
Cc: Paul Mackerras <>
Cc: Arnd Bergmann <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent a1f242ff
......@@ -288,9 +288,32 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
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);
memcpy_fromio(buf, local_store + offset, len);
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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment