fix radeon setparam on 32/64 systems, harder.

Commit 9b01bd5b284bbf519b726b39f1352023cb5e9e69 introduced a
    compat_ioctl handler for RADEON_SETPARAM, the sole purpose of which was
    to handle the fact that on i386, alignof(uint64_t)==4.

    Unfortunately, this handler was installed for _all_ 64-bit
    architectures, instead of only x86_64 and ia64.  And thus it breaks
    32-bit compatibility on every other arch, where 64-bit integers are
    aligned to 8 bytes in 32-bit mode just the same as in 64-bit mode.

    Arnd has a cunning plan to use 'compat_u64' with appropriate alignment
    attributes according to the 32-bit ABI, but for now let's just make the
    compat_radeon_cp_setparam routine entirely disappear on 64-bit machines
    whose 32-bit compat support isn't for i386.  It would be a no-op with
    compat_u64 anyway.

    Signed-off-by: David Woodhouse <dwmw2@infradead.org>
main
David Woodhouse 2007-06-18 12:45:20 +10:00 committed by Dave Airlie
parent 3d5d41fa98
commit 638ebbab54
1 changed files with 5 additions and 1 deletions

View File

@ -349,6 +349,8 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long) request); DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long) request);
} }
/* The two 64-bit arches where alignof(u64)==4 in 32-bit code */
#if defined (CONFIG_X86_64) || defined(CONFIG_IA64)
typedef struct drm_radeon_setparam32 { typedef struct drm_radeon_setparam32 {
int param; int param;
u64 value; u64 value;
@ -373,7 +375,9 @@ static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd,
return drm_ioctl(file->f_dentry->d_inode, file, return drm_ioctl(file->f_dentry->d_inode, file,
DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request); DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
} }
#else
#define compat_radeon_cp_setparam NULL
#endif /* X86_64 || IA64 */
drm_ioctl_compat_t *radeon_compat_ioctls[] = { drm_ioctl_compat_t *radeon_compat_ioctls[] = {
[DRM_RADEON_CP_INIT] = compat_radeon_cp_init, [DRM_RADEON_CP_INIT] = compat_radeon_cp_init,