+************************************************************
+* For the very latest on DRI development, please see: *
+* http://dri.sourceforge.net/ *
+************************************************************
The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
A Security Analysis of the Direct Rendering Infrastructure
http://precisioninsight.com/dr/security.html
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.2 1999/09/27 14:59:24 dawes Exp $
+************************************************************
+* For the very latest on DRI development, please see: *
+* http://dri.sourceforge.net/ *
+************************************************************
#define module_exit(x) void cleanup_module(void) { x(); }
#endif
+ /* virt_to_page added in 2.4.0-test6 */
+#ifndef virt_to_page
+#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
+#endif
+
/* Generic cmpxchg added in 2.3.x */
#ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
if(address == 0UL)
return 0;
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
if(page == 0UL)
return;
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
drm_ctx_t i810_res_ctx;
static struct file_operations i810_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: i810_open,
drm_ctx_t mga_res_ctx;
static struct file_operations mga_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: mga_open,
drm_ctx_t r128_res_ctx;
static struct file_operations r128_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: r128_open,
drm_ctx_t tdfx_res_ctx;
static struct file_operations tdfx_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: tdfx_open,
+************************************************************
+* For the very latest on DRI development, please see: *
+* http://dri.sourceforge.net/ *
+************************************************************
The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
A Security Analysis of the Direct Rendering Infrastructure
http://precisioninsight.com/dr/security.html
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.2 1999/09/27 14:59:24 dawes Exp $
+************************************************************
+* For the very latest on DRI development, please see: *
+* http://dri.sourceforge.net/ *
+************************************************************
#define module_exit(x) void cleanup_module(void) { x(); }
#endif
+ /* virt_to_page added in 2.4.0-test6 */
+#ifndef virt_to_page
+#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
+#endif
+
/* Generic cmpxchg added in 2.3.x */
#ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
static drm_device_t gamma_device;
static struct file_operations gamma_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: gamma_open,
if(address == 0UL)
return 0;
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
if(page == 0UL)
return;
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
drm_ctx_t i810_res_ctx;
static struct file_operations i810_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: i810_open,
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+#if LINUX_VERSION_CODE >= 0x020400
+ /* Argument type changed in 2.4.0-test6/pre8 */
+ mem_map_reserve(virt_to_page(addr));
+#else
mem_map_reserve(MAP_NR(addr));
+#endif
}
return address;
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+#if LINUX_VERSION_CODE >= 0x020400
+ /* Argument type changed in 2.4.0-test6/pre8 */
+ mem_map_unreserve(virt_to_page(addr));
+#else
mem_map_unreserve(MAP_NR(addr));
+#endif
}
free_pages(address, order);
}
if(address == 0UL) {
return 0;
}
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
if(page == 0UL) {
return;
}
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
drm_ctx_t mga_res_ctx;
static struct file_operations mga_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: mga_open,
drm_ctx_t r128_res_ctx;
static struct file_operations r128_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: r128_open,
drm_ctx_t tdfx_res_ctx;
static struct file_operations tdfx_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: tdfx_open,
offset = address - vma->vm_start;
physical = (unsigned long)map->handle + offset;
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return virt_to_page(physical);
#endif
}
offset = address - vma->vm_start;
page = offset >> PAGE_SHIFT;
physical = (unsigned long)dev->lock.hw_lock + offset;
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return virt_to_page(physical);
#endif
}
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
page = offset >> PAGE_SHIFT;
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return virt_to_page(physical);
#endif
}