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
5 @@ -191,6 +190,16 @@ _syscall3( int, modify_ldt, int, func, v
6 // ============================================================
9 +int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*));
10 +long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
11 +void unregister_ioctl32_conversion(unsigned int cmd);
15 + struct HandlerList *next;
17 +struct HandlerList *HandlerListHead = 0x0;
20 int __ke_debuglevel = 0;
21 int __ke_moduleflags = 0;
22 @@ -258,6 +267,7 @@ static struct file_operations firegl_fop
24 release: ip_firegl_release,
25 ioctl: ip_firegl_ioctl,
26 + compat_ioctl: realHandler_compat_ioctl,
30 @@ -1475,7 +1485,7 @@ int ATI_API_CALL __ke_copy_to_user(void*
32 int ATI_API_CALL __ke_verify_area(int type, const void * addr, unsigned long size)
34 - return verify_area(type, addr, size);
35 + return (access_ok(type, addr, size) ? 0 : -EFAULT);
38 int ATI_API_CALL __ke_get_pci_device_info(__ke_pci_dev_t* dev, __ke_pci_device_info_t *pinfo)
39 @@ -2220,10 +2230,68 @@ int ATI_API_CALL __ke_register_ioctl32_c
40 return register_ioctl32_conversion(cmd, handler);
44 + int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*))
46 + sizeof(struct HandlerList);
47 + struct HandlerList *newHandler = kmalloc(sizeof(struct HandlerList), 0);
48 + newHandler->cmd = cmd;
49 + newHandler->handler = handler;
50 + newHandler->next = HandlerListHead;
51 + HandlerListHead = newHandler;
55 + long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
58 + int (*handler)(unsigned int, unsigned int, unsigned long, struct file*);
59 + struct fdtable *fdt;
60 + struct HandlerList *HandlerEntry = HandlerListHead;
62 + while(HandlerEntry->cmd != cmd){
63 + if(HandlerEntry->next == 0x0){
66 + HandlerEntry = HandlerEntry->next;
68 + handler = HandlerEntry->handler;
69 + fdt = files_fdtable(current->files);
70 + for(fd=0;fd<fdt->max_fds;fd++){
71 + if(fdt->fd[fd] == filp){
72 + return handler(fd, cmd, arg, filp);
80 void ATI_API_CALL __ke_unregister_ioctl32_conversion(unsigned int cmd)
82 unregister_ioctl32_conversion(cmd);
85 + void unregister_ioctl32_conversion(unsigned int cmd)
87 + struct HandlerList *ahead, *behind;
88 + if(HandlerListHead == 0x0) return;
89 + behind = HandlerListHead;
90 + ahead = HandlerListHead->next;
91 + if(behind->cmd == cmd){
92 + HandlerListHead = ahead;
96 + while(ahead->cmd != cmd){
98 + ahead = ahead->next;
100 + behind->next = ahead->next;
107 /* agp_memory related routine for IGP */