summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-05-01 20:31:16 -0700
committerKeith Packard <keithp@keithp.com>2008-05-01 20:31:16 -0700
commit30efad5113944681c1abd6452e10355c105e9c39 (patch)
treed2e5963cd0e8b7ad32c71cfcec66e5aab2f97099 /linux-core
parentabc896638fdcd8ccb457ad7b43dbe7ad229ba501 (diff)
Fix gem ioctls to be 32/64-bit clean.
mixed 32/64 bit systems need 'special' help for ioctl where the user-space and kernel-space datatypes differ. Fixing the datatypes to be the same size, and align the same way for both 32 and 64-bit ppc and x86 environments will elimiante the need to have magic 32/64-bit ioctl translation code.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_gem.c6
-rw-r--r--linux-core/i915_gem.c14
2 files changed, 11 insertions, 9 deletions
diff --git a/linux-core/drm_gem.c b/linux-core/drm_gem.c
index d39585e9..41976bc7 100644
--- a/linux-core/drm_gem.c
+++ b/linux-core/drm_gem.c
@@ -233,7 +233,7 @@ drm_gem_pread_ioctl(struct drm_device *dev, void *data,
offset = args->offset;
- read = obj->filp->f_op->read(obj->filp, (char __user *)args->data,
+ read = obj->filp->f_op->read(obj->filp, (char __user *)(uintptr_t)args->data_ptr,
args->size, &offset);
if (read != args->size) {
drm_gem_object_unreference(dev, obj);
@@ -270,7 +270,7 @@ drm_gem_mmap_ioctl(struct drm_device *dev, void *data,
offset = args->offset;
down_write(&current->mm->mmap_sem);
- args->addr = (void *)do_mmap(obj->filp, 0, args->size,
+ args->addr_ptr = (uint64_t) do_mmap(obj->filp, 0, args->size,
PROT_READ | PROT_WRITE, MAP_SHARED,
args->offset);
up_write(&current->mm->mmap_sem);
@@ -300,7 +300,7 @@ drm_gem_pwrite_ioctl(struct drm_device *dev, void *data,
offset = args->offset;
- written = obj->filp->f_op->write(obj->filp, (char __user *)args->data,
+ written = obj->filp->f_op->write(obj->filp, (char __user *)args->data_ptr,
args->size, &offset);
if (written != args->size) {
drm_gem_object_unreference(dev, obj);
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c
index 29b2d894..335f0618 100644
--- a/linux-core/i915_gem.c
+++ b/linux-core/i915_gem.c
@@ -167,6 +167,7 @@ i915_gem_reloc_and_validate_object(struct drm_device *dev,
struct drm_gem_object *obj)
{
struct drm_i915_gem_relocation_entry reloc;
+ struct drm_i915_gem_relocation_entry __user *relocs;
struct drm_i915_gem_object *obj_priv = obj->driver_private;
int i;
@@ -177,6 +178,7 @@ i915_gem_reloc_and_validate_object(struct drm_device *dev,
return -ENOMEM;
}
+ relocs = (struct drm_i915_gem_relocation_entry __user *) (uintptr_t) entry->relocs_ptr;
/* Apply the relocations, using the GTT aperture to avoid cache
* flushing requirements.
*/
@@ -187,7 +189,7 @@ i915_gem_reloc_and_validate_object(struct drm_device *dev,
uint32_t reloc_val, *reloc_entry;
int ret;
- ret = copy_from_user(&reloc, entry->relocs + i, sizeof(reloc));
+ ret = copy_from_user(&reloc, relocs + i, sizeof(reloc));
if (ret != 0)
return ret;
@@ -229,7 +231,7 @@ i915_gem_reloc_and_validate_object(struct drm_device *dev,
reloc_val = target_obj_priv->gtt_offset + reloc.delta;
DRM_DEBUG("Applied relocation: %p@0x%08x = 0x%08x\n",
- obj, reloc.offset, reloc_val);
+ obj, (unsigned int) reloc.offset, reloc_val);
*reloc_entry = reloc_val;
iounmap(reloc_page);
@@ -299,8 +301,8 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
goto err;
}
ret = copy_from_user(validate_list,
- (struct drm_i915_relocation_entry __user*)
- args->buffers,
+ (struct drm_i915_relocation_entry __user*)(uintptr_t)
+ args->buffers_ptr,
sizeof(*validate_list) * args->buffer_count);
if (ret != 0)
goto err;
@@ -329,8 +331,8 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
validate_list[i].buffer_offset = obj_priv->gtt_offset;
}
ret = copy_to_user(validate_list,
- (struct drm_i915_relocation_entry __user*)
- args->buffers,
+ (struct drm_i915_relocation_entry __user*)(uintptr_t)
+ args->buffers_ptr,
sizeof(*validate_list) * args->buffer_count);
/* Clean up and return */