| [e89ec63] | 1 | Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org> | 
|---|
|  | 2 | Date: 2006-11-29 | 
|---|
|  | 3 | Initial Package Version: 2.6.19 | 
|---|
|  | 4 | Origin: Joe Ciccone | 
|---|
|  | 5 | Upstream Status: Unknown | 
|---|
|  | 6 | Description: Fixes a build issue with alpha on some processors. The | 
|---|
|  | 7 | instructions being modified are specific to ev56/ev6. | 
|---|
|  | 8 |  | 
|---|
|  | 9 | diff -Naur linux-2.6.19.orig/include/asm-alpha/compiler.h linux-2.6.19/include/asm-alpha/compiler.h | 
|---|
|  | 10 | --- linux-2.6.19.orig/include/asm-alpha/compiler.h      2006-11-29 13:57:37.000000000 -0800 | 
|---|
|  | 11 | +++ linux-2.6.19/include/asm-alpha/compiler.h   2006-11-29 19:11:54.000000000 -0800 | 
|---|
|  | 12 | @@ -78,16 +78,16 @@ | 
|---|
|  | 13 | #else | 
|---|
|  | 14 | #define __kernel_ldbu(mem)                             \ | 
|---|
|  | 15 | ({ unsigned char __kir;                              \ | 
|---|
|  | 16 | -     __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem));   \ | 
|---|
|  | 17 | +     __asm__(".arch ev6; ldbu %0,%1" : "=r"(__kir) : "m"(mem));        \ | 
|---|
|  | 18 | __kir; }) | 
|---|
|  | 19 | #define __kernel_ldwu(mem)                             \ | 
|---|
|  | 20 | ({ unsigned short __kir;                             \ | 
|---|
|  | 21 | -     __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem));   \ | 
|---|
|  | 22 | +     __asm__(".arch ev6; ldwu %0,%1" : "=r"(__kir) : "m"(mem));        \ | 
|---|
|  | 23 | __kir; }) | 
|---|
|  | 24 | #define __kernel_stb(val,mem) \ | 
|---|
|  | 25 | -  __asm__("stb %1,%0" : "=m"(mem) : "r"(val)) | 
|---|
|  | 26 | +  __asm__(".arch ev6; stb %1,%0" : "=m"(mem) : "r"(val)) | 
|---|
|  | 27 | #define __kernel_stw(val,mem) \ | 
|---|
|  | 28 | -  __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) | 
|---|
|  | 29 | +  __asm__(".arch ev6; stw %1,%0" : "=m"(mem) : "r"(val)) | 
|---|
|  | 30 | #endif | 
|---|
|  | 31 |  | 
|---|
|  | 32 | #ifdef __KERNEL__ | 
|---|
|  | 33 | diff -Naur linux-2.6.19.orig/include/asm-alpha/compiler.h.orig linux-2.6.19/include/asm-alpha/compiler.h.orig | 
|---|
|  | 34 | --- linux-2.6.19.orig/include/asm-alpha/compiler.h.orig 1969-12-31 16:00:00.000000000 -0800 | 
|---|
|  | 35 | +++ linux-2.6.19/include/asm-alpha/compiler.h.orig      2006-11-29 13:57:37.000000000 -0800 | 
|---|
|  | 36 | @@ -0,0 +1,107 @@ | 
|---|
|  | 37 | +#ifndef __ALPHA_COMPILER_H | 
|---|
|  | 38 | +#define __ALPHA_COMPILER_H | 
|---|
|  | 39 | + | 
|---|
|  | 40 | +/* | 
|---|
|  | 41 | + * Herein are macros we use when describing various patterns we want to GCC. | 
|---|
|  | 42 | + * In all cases we can get better schedules out of the compiler if we hide | 
|---|
|  | 43 | + * as little as possible inside inline assembly.  However, we want to be | 
|---|
|  | 44 | + * able to know what we'll get out before giving up inline assembly.  Thus | 
|---|
|  | 45 | + * these tests and macros. | 
|---|
|  | 46 | + */ | 
|---|
|  | 47 | + | 
|---|
|  | 48 | +#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 | 
|---|
|  | 49 | +# define __kernel_insbl(val, shift)    __builtin_alpha_insbl(val, shift) | 
|---|
|  | 50 | +# define __kernel_inswl(val, shift)    __builtin_alpha_inswl(val, shift) | 
|---|
|  | 51 | +# define __kernel_insql(val, shift)    __builtin_alpha_insql(val, shift) | 
|---|
|  | 52 | +# define __kernel_inslh(val, shift)    __builtin_alpha_inslh(val, shift) | 
|---|
|  | 53 | +# define __kernel_extbl(val, shift)    __builtin_alpha_extbl(val, shift) | 
|---|
|  | 54 | +# define __kernel_extwl(val, shift)    __builtin_alpha_extwl(val, shift) | 
|---|
|  | 55 | +# define __kernel_cmpbge(a, b)         __builtin_alpha_cmpbge(a, b) | 
|---|
|  | 56 | +# define __kernel_cttz(x)              __builtin_ctzl(x) | 
|---|
|  | 57 | +# define __kernel_ctlz(x)              __builtin_clzl(x) | 
|---|
|  | 58 | +# define __kernel_ctpop(x)             __builtin_popcountl(x) | 
|---|
|  | 59 | +#else | 
|---|
|  | 60 | +# define __kernel_insbl(val, shift)                                    \ | 
|---|
|  | 61 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 62 | +     __asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));  \ | 
|---|
|  | 63 | +     __kir; }) | 
|---|
|  | 64 | +# define __kernel_inswl(val, shift)                                    \ | 
|---|
|  | 65 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 66 | +     __asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));  \ | 
|---|
|  | 67 | +     __kir; }) | 
|---|
|  | 68 | +# define __kernel_insql(val, shift)                                    \ | 
|---|
|  | 69 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 70 | +     __asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));  \ | 
|---|
|  | 71 | +     __kir; }) | 
|---|
|  | 72 | +# define __kernel_inslh(val, shift)                                    \ | 
|---|
|  | 73 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 74 | +     __asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));  \ | 
|---|
|  | 75 | +     __kir; }) | 
|---|
|  | 76 | +# define __kernel_extbl(val, shift)                                    \ | 
|---|
|  | 77 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 78 | +     __asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));  \ | 
|---|
|  | 79 | +     __kir; }) | 
|---|
|  | 80 | +# define __kernel_extwl(val, shift)                                    \ | 
|---|
|  | 81 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 82 | +     __asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));  \ | 
|---|
|  | 83 | +     __kir; }) | 
|---|
|  | 84 | +# define __kernel_cmpbge(a, b)                                         \ | 
|---|
|  | 85 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 86 | +     __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a));     \ | 
|---|
|  | 87 | +     __kir; }) | 
|---|
|  | 88 | +# define __kernel_cttz(x)                                              \ | 
|---|
|  | 89 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 90 | +     __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));                     \ | 
|---|
|  | 91 | +     __kir; }) | 
|---|
|  | 92 | +# define __kernel_ctlz(x)                                              \ | 
|---|
|  | 93 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 94 | +     __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));                     \ | 
|---|
|  | 95 | +     __kir; }) | 
|---|
|  | 96 | +# define __kernel_ctpop(x)                                             \ | 
|---|
|  | 97 | +  ({ unsigned long __kir;                                              \ | 
|---|
|  | 98 | +     __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));                    \ | 
|---|
|  | 99 | +     __kir; }) | 
|---|
|  | 100 | +#endif | 
|---|
|  | 101 | + | 
|---|
|  | 102 | + | 
|---|
|  | 103 | +/* | 
|---|
|  | 104 | + * Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX | 
|---|
|  | 105 | + * extension is enabled.  Previous versions did not define anything | 
|---|
|  | 106 | + * we could test during compilation -- too bad, so sad. | 
|---|
|  | 107 | + */ | 
|---|
|  | 108 | + | 
|---|
|  | 109 | +#if defined(__alpha_bwx__) | 
|---|
|  | 110 | +#define __kernel_ldbu(mem)     (mem) | 
|---|
|  | 111 | +#define __kernel_ldwu(mem)     (mem) | 
|---|
|  | 112 | +#define __kernel_stb(val,mem)  ((mem) = (val)) | 
|---|
|  | 113 | +#define __kernel_stw(val,mem)  ((mem) = (val)) | 
|---|
|  | 114 | +#else | 
|---|
|  | 115 | +#define __kernel_ldbu(mem)                             \ | 
|---|
|  | 116 | +  ({ unsigned char __kir;                              \ | 
|---|
|  | 117 | +     __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem));   \ | 
|---|
|  | 118 | +     __kir; }) | 
|---|
|  | 119 | +#define __kernel_ldwu(mem)                             \ | 
|---|
|  | 120 | +  ({ unsigned short __kir;                             \ | 
|---|
|  | 121 | +     __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem));   \ | 
|---|
|  | 122 | +     __kir; }) | 
|---|
|  | 123 | +#define __kernel_stb(val,mem) \ | 
|---|
|  | 124 | +  __asm__("stb %1,%0" : "=m"(mem) : "r"(val)) | 
|---|
|  | 125 | +#define __kernel_stw(val,mem) \ | 
|---|
|  | 126 | +  __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) | 
|---|
|  | 127 | +#endif | 
|---|
|  | 128 | + | 
|---|
|  | 129 | +#ifdef __KERNEL__ | 
|---|
|  | 130 | +/* Some idiots over in <linux/compiler.h> thought inline should imply | 
|---|
|  | 131 | +   always_inline.  This breaks stuff.  We'll include this file whenever | 
|---|
|  | 132 | +   we run into such problems.  */ | 
|---|
|  | 133 | + | 
|---|
|  | 134 | +#include <linux/compiler.h> | 
|---|
|  | 135 | +#undef inline | 
|---|
|  | 136 | +#undef __inline__ | 
|---|
|  | 137 | +#undef __inline | 
|---|
|  | 138 | +#undef __always_inline | 
|---|
|  | 139 | +#define __always_inline                inline __attribute__((always_inline)) | 
|---|
|  | 140 | + | 
|---|
|  | 141 | +#endif /* __KERNEL__ */ | 
|---|
|  | 142 | + | 
|---|
|  | 143 | +#endif /* __ALPHA_COMPILER_H */ | 
|---|