diff options
Diffstat (limited to 'meta/recipes-graphics/xorg-xserver/xserver-xf86-lite/revert_make_sys_c_use_unaligned_access_functions.patch')
-rw-r--r-- | meta/recipes-graphics/xorg-xserver/xserver-xf86-lite/revert_make_sys_c_use_unaligned_access_functions.patch | 256 |
1 files changed, 256 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xf86-lite/revert_make_sys_c_use_unaligned_access_functions.patch b/meta/recipes-graphics/xorg-xserver/xserver-xf86-lite/revert_make_sys_c_use_unaligned_access_functions.patch new file mode 100644 index 0000000000..235b55153a --- /dev/null +++ b/meta/recipes-graphics/xorg-xserver/xserver-xf86-lite/revert_make_sys_c_use_unaligned_access_functions.patch | |||
@@ -0,0 +1,256 @@ | |||
1 | From 74ab27f64a747ee45810f99cdc6e29b82cf8035e Mon Sep 17 00:00:00 2001 | ||
2 | From: Tiago Vignatti <tiago.vignatti@nokia.com> | ||
3 | Date: Mon, 28 Dec 2009 16:00:28 +0000 | ||
4 | Subject: Revert "Make sys.c use unaligned access functions provided in compiler." | ||
5 | |||
6 | This reverts commit da923d0bc15e99a8ed1986bd6f5df37f7af7284b. | ||
7 | |||
8 | Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> | ||
9 | Signed-off-by: Keith Packard <keithp@keithp.com> | ||
10 | --- | ||
11 | diff --git a/hw/xfree86/x86emu/Makefile.am b/hw/xfree86/x86emu/Makefile.am | ||
12 | index e7368f5..df96977 100644 | ||
13 | --- a/hw/xfree86/x86emu/Makefile.am | ||
14 | +++ b/hw/xfree86/x86emu/Makefile.am | ||
15 | @@ -11,7 +11,7 @@ libx86emu_la_SOURCES = debug.c \ | ||
16 | sys.c \ | ||
17 | x86emu.h | ||
18 | |||
19 | -INCLUDES = $(XORG_INCS) | ||
20 | +INCLUDES = | ||
21 | |||
22 | AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) | ||
23 | |||
24 | diff --git a/hw/xfree86/x86emu/sys.c b/hw/xfree86/x86emu/sys.c | ||
25 | index 2ebf6f1..e15fb09 100644 | ||
26 | --- a/hw/xfree86/x86emu/sys.c | ||
27 | +++ b/hw/xfree86/x86emu/sys.c | ||
28 | @@ -48,13 +48,168 @@ | ||
29 | #ifndef NO_SYS_HEADERS | ||
30 | #include <string.h> | ||
31 | #endif | ||
32 | -#include "compiler.h" /* for unaligned access functions */ | ||
33 | /*------------------------- Global Variables ------------------------------*/ | ||
34 | |||
35 | X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */ | ||
36 | X86EMU_intrFuncs _X86EMU_intrTab[256]; | ||
37 | |||
38 | /*----------------------------- Implementation ----------------------------*/ | ||
39 | +#if defined(__alpha__) || defined(__alpha) | ||
40 | +/* to cope with broken egcs-1.1.2 :-(((( */ | ||
41 | + | ||
42 | +#define ALPHA_UALOADS | ||
43 | +/* | ||
44 | + * inline functions to do unaligned accesses | ||
45 | + * from linux/include/asm-alpha/unaligned.h | ||
46 | + */ | ||
47 | + | ||
48 | +/* | ||
49 | + * EGCS 1.1 knows about arbitrary unaligned loads. Define some | ||
50 | + * packed structures to talk about such things with. | ||
51 | + */ | ||
52 | + | ||
53 | +#if defined(__GNUC__) | ||
54 | +struct __una_u64 { unsigned long x __attribute__((packed)); }; | ||
55 | +struct __una_u32 { unsigned int x __attribute__((packed)); }; | ||
56 | +struct __una_u16 { unsigned short x __attribute__((packed)); }; | ||
57 | +#endif | ||
58 | + | ||
59 | +static __inline__ unsigned long ldq_u(unsigned long * r11) | ||
60 | +{ | ||
61 | +#if defined(__GNUC__) | ||
62 | + const struct __una_u64 *ptr = (const struct __una_u64 *) r11; | ||
63 | + return ptr->x; | ||
64 | +#else | ||
65 | + unsigned long r1,r2; | ||
66 | + __asm__("ldq_u %0,%3\n\t" | ||
67 | + "ldq_u %1,%4\n\t" | ||
68 | + "extql %0,%2,%0\n\t" | ||
69 | + "extqh %1,%2,%1" | ||
70 | + :"=&r" (r1), "=&r" (r2) | ||
71 | + :"r" (r11), | ||
72 | + "m" (*r11), | ||
73 | + "m" (*(const unsigned long *)(7+(char *) r11))); | ||
74 | + return r1 | r2; | ||
75 | +#endif | ||
76 | +} | ||
77 | + | ||
78 | +static __inline__ unsigned long ldl_u(unsigned int * r11) | ||
79 | +{ | ||
80 | +#if defined(__GNUC__) | ||
81 | + const struct __una_u32 *ptr = (const struct __una_u32 *) r11; | ||
82 | + return ptr->x; | ||
83 | +#else | ||
84 | + unsigned long r1,r2; | ||
85 | + __asm__("ldq_u %0,%3\n\t" | ||
86 | + "ldq_u %1,%4\n\t" | ||
87 | + "extll %0,%2,%0\n\t" | ||
88 | + "extlh %1,%2,%1" | ||
89 | + :"=&r" (r1), "=&r" (r2) | ||
90 | + :"r" (r11), | ||
91 | + "m" (*r11), | ||
92 | + "m" (*(const unsigned long *)(3+(char *) r11))); | ||
93 | + return r1 | r2; | ||
94 | +#endif | ||
95 | +} | ||
96 | + | ||
97 | +static __inline__ unsigned long ldw_u(unsigned short * r11) | ||
98 | +{ | ||
99 | +#if defined(__GNUC__) | ||
100 | + const struct __una_u16 *ptr = (const struct __una_u16 *) r11; | ||
101 | + return ptr->x; | ||
102 | +#else | ||
103 | + unsigned long r1,r2; | ||
104 | + __asm__("ldq_u %0,%3\n\t" | ||
105 | + "ldq_u %1,%4\n\t" | ||
106 | + "extwl %0,%2,%0\n\t" | ||
107 | + "extwh %1,%2,%1" | ||
108 | + :"=&r" (r1), "=&r" (r2) | ||
109 | + :"r" (r11), | ||
110 | + "m" (*r11), | ||
111 | + "m" (*(const unsigned long *)(1+(char *) r11))); | ||
112 | + return r1 | r2; | ||
113 | +#endif | ||
114 | +} | ||
115 | + | ||
116 | +/* | ||
117 | + * Elemental unaligned stores | ||
118 | + */ | ||
119 | + | ||
120 | +static __inline__ void stq_u(unsigned long r5, unsigned long * r11) | ||
121 | +{ | ||
122 | +#if defined(__GNUC__) | ||
123 | + struct __una_u64 *ptr = (struct __una_u64 *) r11; | ||
124 | + ptr->x = r5; | ||
125 | +#else | ||
126 | + unsigned long r1,r2,r3,r4; | ||
127 | + | ||
128 | + __asm__("ldq_u %3,%1\n\t" | ||
129 | + "ldq_u %2,%0\n\t" | ||
130 | + "insqh %6,%7,%5\n\t" | ||
131 | + "insql %6,%7,%4\n\t" | ||
132 | + "mskqh %3,%7,%3\n\t" | ||
133 | + "mskql %2,%7,%2\n\t" | ||
134 | + "bis %3,%5,%3\n\t" | ||
135 | + "bis %2,%4,%2\n\t" | ||
136 | + "stq_u %3,%1\n\t" | ||
137 | + "stq_u %2,%0" | ||
138 | + :"=m" (*r11), | ||
139 | + "=m" (*(unsigned long *)(7+(char *) r11)), | ||
140 | + "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) | ||
141 | + :"r" (r5), "r" (r11)); | ||
142 | +#endif | ||
143 | +} | ||
144 | + | ||
145 | +static __inline__ void stl_u(unsigned long r5, unsigned int * r11) | ||
146 | +{ | ||
147 | +#if defined(__GNUC__) | ||
148 | + struct __una_u32 *ptr = (struct __una_u32 *) r11; | ||
149 | + ptr->x = r5; | ||
150 | +#else | ||
151 | + unsigned long r1,r2,r3,r4; | ||
152 | + | ||
153 | + __asm__("ldq_u %3,%1\n\t" | ||
154 | + "ldq_u %2,%0\n\t" | ||
155 | + "inslh %6,%7,%5\n\t" | ||
156 | + "insll %6,%7,%4\n\t" | ||
157 | + "msklh %3,%7,%3\n\t" | ||
158 | + "mskll %2,%7,%2\n\t" | ||
159 | + "bis %3,%5,%3\n\t" | ||
160 | + "bis %2,%4,%2\n\t" | ||
161 | + "stq_u %3,%1\n\t" | ||
162 | + "stq_u %2,%0" | ||
163 | + :"=m" (*r11), | ||
164 | + "=m" (*(unsigned long *)(3+(char *) r11)), | ||
165 | + "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) | ||
166 | + :"r" (r5), "r" (r11)); | ||
167 | +#endif | ||
168 | +} | ||
169 | + | ||
170 | +static __inline__ void stw_u(unsigned long r5, unsigned short * r11) | ||
171 | +{ | ||
172 | +#if defined(__GNUC__) | ||
173 | + struct __una_u16 *ptr = (struct __una_u16 *) r11; | ||
174 | + ptr->x = r5; | ||
175 | +#else | ||
176 | + unsigned long r1,r2,r3,r4; | ||
177 | + | ||
178 | + __asm__("ldq_u %3,%1\n\t" | ||
179 | + "ldq_u %2,%0\n\t" | ||
180 | + "inswh %6,%7,%5\n\t" | ||
181 | + "inswl %6,%7,%4\n\t" | ||
182 | + "mskwh %3,%7,%3\n\t" | ||
183 | + "mskwl %2,%7,%2\n\t" | ||
184 | + "bis %3,%5,%3\n\t" | ||
185 | + "bis %2,%4,%2\n\t" | ||
186 | + "stq_u %3,%1\n\t" | ||
187 | + "stq_u %2,%0" | ||
188 | + :"=m" (*r11), | ||
189 | + "=m" (*(unsigned long *)(1+(char *) r11)), | ||
190 | + "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) | ||
191 | + :"r" (r5), "r" (r11)); | ||
192 | +#endif | ||
193 | +} | ||
194 | +#endif | ||
195 | |||
196 | /**************************************************************************** | ||
197 | PARAMETERS: | ||
198 | @@ -107,7 +262,13 @@ u16 X86API rdw( | ||
199 | } | ||
200 | else | ||
201 | #endif | ||
202 | +#if defined(ALPHA_UALOADS) | ||
203 | val = ldw_u((u16*)(M.mem_base + addr)); | ||
204 | +#elif defined(IA64_UALOADS) | ||
205 | + val = uldw((u16*)(M.mem_base + addr)); | ||
206 | +#else | ||
207 | + val = *(u16*)(M.mem_base + addr); | ||
208 | +#endif | ||
209 | DB( if (DEBUG_MEM_TRACE()) | ||
210 | printk("%#08x 2 -> %#x\n", addr, val);) | ||
211 | return val; | ||
212 | @@ -140,7 +301,13 @@ u32 X86API rdl( | ||
213 | } | ||
214 | else | ||
215 | #endif | ||
216 | +#if defined(ALPHA_UALOADS) | ||
217 | val = ldl_u((u32*)(M.mem_base + addr)); | ||
218 | +#elif defined(IA64_UALOADS) | ||
219 | + val = uldl((u32*)(M.mem_base + addr)); | ||
220 | +#else | ||
221 | + val = *(u32*)(M.mem_base + addr); | ||
222 | +#endif | ||
223 | DB( if (DEBUG_MEM_TRACE()) | ||
224 | printk("%#08x 4 -> %#x\n", addr, val);) | ||
225 | return val; | ||
226 | @@ -192,7 +359,13 @@ DB( if (DEBUG_MEM_TRACE()) | ||
227 | } | ||
228 | else | ||
229 | #endif | ||
230 | +#if defined(ALPHA_UALOADS) | ||
231 | stw_u(val,(u16*)(M.mem_base + addr)); | ||
232 | +#elif defined(IA64_UALOADS) | ||
233 | + ustw(val,(u16*)(M.mem_base + addr)); | ||
234 | +#else | ||
235 | + *(u16*)(M.mem_base + addr) = val; | ||
236 | +#endif | ||
237 | } | ||
238 | |||
239 | /**************************************************************************** | ||
240 | @@ -222,7 +395,13 @@ DB( if (DEBUG_MEM_TRACE()) | ||
241 | } | ||
242 | else | ||
243 | #endif | ||
244 | +#if defined(ALPHA_UALOADS) | ||
245 | stl_u(val,(u32*)(M.mem_base + addr)); | ||
246 | +#elif defined(IA64_UALOADS) | ||
247 | + ustl(val,(u32*)(M.mem_base + addr)); | ||
248 | +#else | ||
249 | + *(u32*)(M.mem_base + addr) = val; | ||
250 | +#endif | ||
251 | } | ||
252 | |||
253 | /**************************************************************************** | ||
254 | -- | ||
255 | cgit v0.8.3-6-g21f6 | ||
256 | |||