]> git.pld-linux.org Git - packages/X11-driver-firegl.git/blob - X11-driver-firegl-ioctl32.patch
- updated for 2.6.14 / tested / works.
[packages/X11-driver-firegl.git] / X11-driver-firegl-ioctl32.patch
1 http://ati.cchtml.com/show_bug.cgi?id=211
2
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 @@ -121,9 +121,8 @@
6  #endif
7  
8  #ifdef __x86_64__
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"
13  #endif
14  #endif
15  
16 @@ -191,6 +190,16 @@ _syscall3( int, modify_ldt, int, func, v
17  // ============================================================
18  /* globals */
19  
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);
23 +struct HandlerList {
24 +       unsigned int cmd;
25 +       void *handler;
26 +       struct HandlerList *next;
27 +};
28 +struct HandlerList *HandlerListHead = 0x0;
29 +
30  char* firegl = NULL;
31  int __ke_debuglevel = 0;
32  int __ke_moduleflags = 0;
33 @@ -258,6 +267,7 @@ static struct file_operations firegl_fop
34      open:    ip_firegl_open,
35      release: ip_firegl_release,
36      ioctl:   ip_firegl_ioctl,
37 +    compat_ioctl: realHandler_compat_ioctl,
38      mmap:    ip_firegl_mmap,
39  };
40  
41 @@ -1475,7 +1485,7 @@ int ATI_API_CALL __ke_copy_to_user(void*
42  
43  int ATI_API_CALL __ke_verify_area(int type, const void * addr, unsigned long size)
44  {
45 -    return verify_area(type, addr, size);
46 +    return access_ok(type, addr, size);
47  }
48  
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);
52  }
53  
54 +
55 + int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*))
56 + {
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;
63 +       return 0;
64 + }
65
66 + long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
67 + {     
68 +       int fd;
69 +       int (*handler)(unsigned int, unsigned int, unsigned long, struct file*);
70 +       struct fdtable *fdt;
71 +       struct HandlerList *HandlerEntry = HandlerListHead;
72
73 +       while(HandlerEntry->cmd != cmd){
74 +               if(HandlerEntry->next == 0x0){ 
75 +                       return -1;
76 +               }
77 +               HandlerEntry = HandlerEntry->next;
78 +       }       
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);
84 +               }
85 +       }
86 +       return -1;
87 +}
88 +
89 +
90 +
91  void ATI_API_CALL __ke_unregister_ioctl32_conversion(unsigned int cmd)
92  {
93      unregister_ioctl32_conversion(cmd);
94  }
95 +
96 + void unregister_ioctl32_conversion(unsigned int cmd)
97 + {
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;
104 +               kfree(behind);
105 +               return;
106 +       }
107 +       while(ahead->cmd != cmd){
108 +               behind = ahead;
109 +               ahead = ahead->next;
110 +       }
111 +       behind->next = ahead->next;
112 +       kfree(ahead);
113 +       return;
114 + }
115 +
116  #endif
117  
118  /* agp_memory related routine for IGP */
This page took 0.088094 seconds and 4 git commands to generate.