1 http://ati.cchtml.com/show_bug.cgi?id=211
3 --- X11-driver-firegl-8.16.20/lib/modules/fglrx/build_mod/firegl_public.c.orig 2005-11-02 20:29:43.535048712 -0800
4 +++ X11-driver-firegl-8.16.20/lib/modules/fglrx/build_mod/firegl_public.c 2005-11-02 20:27:19.013019400 -0800
9 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
10 #include "asm/ioctl32.h"
11 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
12 -#include "linux/syscalls.h"
16 @@ -191,6 +190,16 @@ _syscall3( int, modify_ldt, int, func, v
17 // ============================================================
20 +int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*));
21 +long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
22 +void unregister_ioctl32_conversion(unsigned int cmd);
26 + struct HandlerList *next;
28 +struct HandlerList *HandlerListHead = 0x0;
31 int __ke_debuglevel = 0;
32 int __ke_moduleflags = 0;
33 @@ -258,6 +267,7 @@ static struct file_operations firegl_fop
35 release: ip_firegl_release,
36 ioctl: ip_firegl_ioctl,
37 + compat_ioctl: realHandler_compat_ioctl,
41 @@ -1475,7 +1485,7 @@ int ATI_API_CALL __ke_copy_to_user(void*
43 int ATI_API_CALL __ke_verify_area(int type, const void * addr, unsigned long size)
45 - return verify_area(type, addr, size);
46 + return access_ok(type, addr, size);
49 int ATI_API_CALL __ke_get_pci_device_info(__ke_pci_dev_t* dev, __ke_pci_device_info_t *pinfo)
50 @@ -2220,10 +2230,68 @@ int ATI_API_CALL __ke_register_ioctl32_c
51 return register_ioctl32_conversion(cmd, handler);
55 + int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*))
57 + sizeof(struct HandlerList);
58 + struct HandlerList *newHandler = kmalloc(sizeof(struct HandlerList), 0);
59 + newHandler->cmd = cmd;
60 + newHandler->handler = handler;
61 + newHandler->next = HandlerListHead;
62 + HandlerListHead = newHandler;
66 + long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
69 + int (*handler)(unsigned int, unsigned int, unsigned long, struct file*);
70 + struct fdtable *fdt;
71 + struct HandlerList *HandlerEntry = HandlerListHead;
73 + while(HandlerEntry->cmd != cmd){
74 + if(HandlerEntry->next == 0x0){
77 + HandlerEntry = HandlerEntry->next;
79 + handler = HandlerEntry->handler;
80 + fdt = files_fdtable(current->files);
81 + for(fd=0;fd<fdt->max_fds;fd++){
82 + if(fdt->fd[fd] == filp){
83 + return handler(fd, cmd, arg, filp);
91 void ATI_API_CALL __ke_unregister_ioctl32_conversion(unsigned int cmd)
93 unregister_ioctl32_conversion(cmd);
96 + void unregister_ioctl32_conversion(unsigned int cmd)
98 + struct HandlerList *ahead, *behind;
99 + if(HandlerListHead == 0x0) return;
100 + behind = HandlerListHead;
101 + ahead = HandlerListHead->next;
102 + if(behind->cmd == cmd){
103 + HandlerListHead = ahead;
107 + while(ahead->cmd != cmd){
109 + ahead = ahead->next;
111 + behind->next = ahead->next;
118 /* agp_memory related routine for IGP */