diff --git a/common/lib/modules/fglrx/build_mod/2.6.x/Makefile b/common/lib/modules/fglrx/build_mod/2.6.x/Makefile index c7ba037..2c041f9 100644 --- a/common/lib/modules/fglrx/build_mod/2.6.x/Makefile +++ b/common/lib/modules/fglrx/build_mod/2.6.x/Makefile @@ -6,7 +6,7 @@ obj-m += fglrx.o fglrx-libs += libfglrx_ip.a.GCC$(GCC_VER_MAJ) fglrx-c-objs += firegl_public.o fglrx-objs += $(fglrx-c-objs) $(fglrx-libs) -fglrx-hdrs += firegl_public.h +fglrx-hdrs += firegl_public.h syscall.h drm-hdrs += drm.h drmP.h drm_os_linux.h drm_proc.h drm_compat.h ifeq ($(PAGE_ATTR_FIX),) diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.h b/common/lib/modules/fglrx/build_mod/firegl_public.h index 0c81d09..0c4d3ce 100644 --- a/common/lib/modules/fglrx/build_mod/firegl_public.h +++ b/common/lib/modules/fglrx/build_mod/firegl_public.h @@ -17,6 +17,8 @@ #ifndef _FIREGL_PUBLIC_H_ #define _FIREGL_PUBLIC_H_ +#include "syscall.h" + #ifdef DEBUG #include #endif diff --git a/common/lib/modules/fglrx/build_mod/syscall.h b/common/lib/modules/fglrx/build_mod/syscall.h new file mode 100644 index 0000000..d4dd9a7 --- /dev/null +++ b/common/lib/modules/fglrx/build_mod/syscall.h @@ -0,0 +1,62 @@ +// x86_64 +//#define __syscall_clobber "r11","rcx","memory" +//#endif + +#include + +/* + * user-visible error numbers are in the range -1 - -MAX_ERRNO: see + * + */ +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ + errno = -(res); \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) + +/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ +#define _syscall0(type,name) \ +type name(void) \ +{ \ +long __res; \ +__asm__ volatile ("int $0x80" \ + : "=a" (__res) \ + : "0" (__NR_##name)); \ +__syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"ri" ((long)(arg1)) : "memory"); \ +__syscall_return(type,__res); \ +} + +#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); \ +} +