diff -urN fglrx.orig/drm.h fglrx/drm.h --- fglrx.orig/drm.h 2007-02-11 21:34:52.000000000 +0100 +++ fglrx/drm.h 2007-02-11 22:17:24.000000000 +0100 @@ -38,7 +38,7 @@ #define _DRM_H_ #if defined(__linux__) -#include +#include #include /* For _IO* macros */ #define DRM_IOCTL_NR(n) _IOC_NR(n) #define DRM_IOC_VOID _IOC_NONE diff -urN fglrx.orig/drmP.h fglrx/drmP.h --- fglrx.orig/drmP.h 2007-02-11 21:34:52.000000000 +0100 +++ fglrx/drmP.h 2007-02-11 22:17:23.000000000 +0100 @@ -42,7 +42,7 @@ * can build the DRM (part of PI DRI). 4/21/2000 S + B */ #include #endif /* __alpha__ */ -#include +#include #include #include #include diff -urN fglrx.orig/firegl_public.c fglrx/firegl_public.c --- fglrx.orig/firegl_public.c 2007-02-11 21:34:52.000000000 +0100 +++ fglrx/firegl_public.c 2007-02-11 22:18:07.000000000 +0100 @@ -69,7 +69,7 @@ #ifdef CONFIG_MEM_MIRROR /* Prevent linux/config.h from being included again in subsequent * kernel headers as that would redefine CONFIG_MEM_MIRROR. */ -#include +#include #warning "Disabling CONFIG_MEM_MIRROR because it does not work with non-GPL modules." #warning "This will break page tracking when the fglrx kernel module is used." #undef CONFIG_MEM_MIRROR @@ -86,7 +86,7 @@ #include /* for installing the patch wrapper */ #include -#include +#include #include #include #include @@ -185,6 +185,70 @@ int errno; #endif // __ia64__ +#if defined(__i386__) +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ + errno = -(res); \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)) : "memory"); \ +__syscall_return(type,__res); \ +} +#elif defined(__x86_64__) +#define __syscall_clobber "r11","rcx","memory" +#define __syscall "syscall" + +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-127)) { \ + errno = -(res); \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ + "d" ((long)(arg3)) : __syscall_clobber); \ +__syscall_return(type,__res); \ +} +#endif + // int mlock(const void *addr, size_t len); _syscall2(int, mlock, const void *, addr, size_t, len ) // int munlock(const void *addr, size_t len);