linux/drivers/char
Dave Airlie 9a18664506 drm: 32/64-bit DRM ioctl compatibility patch
The patch is against a 2.6.11 kernel tree.  I am running this with a
32-bit X server (compiled up from X.org CVS as of a couple of weeks
ago) and 32-bit DRI libraries and clients.  All the userland stuff is
identical to what I am using under a 32-bit kernel on my G4 powerbook
(which is a 32-bit machine of course).  I haven't tried compiling up a
64-bit X server or clients yet.

In the compatibility routines I have assumed that the kernel can
safely access user addresses after set_fs(KERNEL_DS).  That is, where
an ioctl argument structure contains pointers to other structures, and
those other structures are already compatible between the 32-bit and
64-bit ABIs (i.e. they only contain things like chars, shorts or
ints), I just check the address with access_ok() and then pass it
through to the 64-bit ioctl code.  I believe this approach may not
work on sparc64, but it does work on ppc64 and x86_64 at least.

One tricky area which may need to be revisited is the question of how
to handle the handles which we pass back to userspace to identify
mappings.  These handles are generated in the ADDMAP ioctl and then
passed in as the offset value to mmap.  However, offset values for
mmap seem to be generated in other ways as well, particularly for AGP
mappings.

The approach I have ended up with is to generate a fake 32-bit handle
only for _DRM_SHM mappings.  The handles for other mappings (AGP, REG,
FB) are physical addresses which are already limited to 32 bits, and
generating fake handles for them created all sorts of problems in the
mmap/nopage code.

This patch has been updated to use the new compatibility ioctls.

From: Paul Mackerras <paulus@samba.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-06-23 21:29:18 +10:00
..
agp [PATCH] Replace check_bridge_mode() with (bridge->mode & AGSTAT_MODE_3_0). 2005-06-07 12:35:44 -07:00
drm drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
ftape [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
ip2 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipmi [PATCH] coverity: ipmi: avoid overrun of ipmi_interfaces[] 2005-06-21 18:46:11 -07:00
mwave [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks 2005-06-20 15:15:32 -07:00
pcmcia Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rio [PATCH] make lots of things static 2005-05-01 08:59:29 -07:00
tpm [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks 2005-06-20 15:15:32 -07:00
watchdog [PATCH] ARM: 2701/1: free up ixp2000 timer 4 for the watchdog 2005-06-20 18:51:07 +01:00
amiserial.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
applicom.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
applicom.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cd1865.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ChangeLog Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
consolemap.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cp437.uni Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cyclades.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
decserial.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
defkeymap.c_shipped Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
defkeymap.map Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
digi1.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
digi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
digiFep1.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
digiPCI.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ds1286.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ds1302.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ds1620.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dsp56k.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
dtlk.c [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
ec3104_keyb.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
efirtc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
epca.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
epca.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
epcaconfig.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
esp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
generic_nvram.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
generic_serial.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
genrtc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hangcheck-timer.c [PATCH] hangcheck-timer: Update to 0.9.0. 2005-05-01 08:59:08 -07:00
hpet.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hvc_console.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hvcs.c [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks 2005-06-20 15:15:32 -07:00
hvsi.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hw_random.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i8k.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip2.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip2main.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
ip27-rtc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
isicom.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
istallion.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
ite_gpio.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig [PATCH] mips: add vr41xx gpio support 2005-06-21 18:46:32 -07:00
keyboard.c [PATCH] make some things static 2005-05-05 16:36:47 -07:00
lcd.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
lcd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
lp.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
Makefile [PATCH] mips: add vr41xx gpio support 2005-06-21 18:46:32 -07:00
mbcs.c [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks 2005-06-20 15:15:32 -07:00
mbcs.h [PATCH] mbcs trivial user annotations 2005-05-04 07:33:13 -07:00
mem.c [PATCH] ppc64 iSeries: allow build with no PCI 2005-06-21 18:46:31 -07:00
misc.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
mmtimer.c [PATCH] mmtimer build fix 2005-04-16 15:23:53 -07:00
moxa.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mxser.c [PATCH] moxa: do not ignore input 2005-06-06 14:42:23 -07:00
mxser.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
n_hdlc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
n_r3964.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
n_tty.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nvram.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nwbutton.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nwbutton.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nwflash.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ppdev.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
pty.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
qtronix.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
qtronixmap.c_shipped Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
qtronixmap.map Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
random.c [PATCH] update maintainer for /dev/random 2005-04-16 15:25:56 -07:00
raw.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
riscom8_reg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
riscom8.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
riscom8.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rocket_int.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rocket.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rocket.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rtc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
s3c2410-rtc.c [PATCH] ARM: RTC: allow driver methods to return error 2005-04-30 12:19:28 +01:00
scan_keyb.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scan_keyb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scx200_gpio.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
selection.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ser_a2232.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ser_a2232.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ser_a2232fw.ax Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ser_a2232fw.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
serial167.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
snsc_event.c [IA64-SGI] snsc_event.c new file 2005-04-25 13:29:46 -07:00
snsc.c [PATCH] Fix typo in scdrv_init() 2005-06-20 15:15:27 -07:00
snsc.h [IA64] Altix system controller event handling 2005-04-25 13:28:52 -07:00
sonypi.c [PATCH] sonypi trivial user annotations 2005-05-04 07:33:14 -07:00
specialix_io8.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
specialix.c [PATCH] misc verify_area cleanups 2005-05-01 08:59:08 -07:00
stallion.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
sx.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sxboards.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sxwindow.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
synclink.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
synclinkmp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sysrq.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tb0219.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tipar.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
toshiba.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tty_io.c [PATCH] tty: move to use the new class code, instead of class_simple 2005-06-20 15:15:04 -07:00
tty_ioctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vc_screen.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
viocons.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
viotape.c [PATCH] class: convert drivers/char/* to use the new class api instead of class_simple 2005-06-20 15:15:08 -07:00
vme_scc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vr41xx_giu.c [PATCH] mips: add vr41xx gpio support 2005-06-21 18:46:32 -07:00
vr41xx_rtc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vt_ioctl.c [PATCH] convert that currently tests _NSIG directly to use valid_signal() 2005-05-01 08:59:14 -07:00
vt.c [PATCH] console blanking oops fix 2005-06-18 13:33:01 -07:00