]> git.pld-linux.org Git - packages/XFree86.git/blob - XFree86-libGL-exec-shield-fixes-v2.patch
- updated
[packages/XFree86.git] / XFree86-libGL-exec-shield-fixes-v2.patch
1 diff -urN xc.org/extras/Mesa/src/glapi.c xc/extras/Mesa/src/glapi.c
2 --- xc.org/extras/Mesa/src/glapi.c      2004-06-07 22:45:05.571381120 +0200
3 +++ xc/extras/Mesa/src/glapi.c  2004-06-07 23:11:34.201872576 +0200
4 @@ -546,7 +547,7 @@
5        0xe8, 0x00, 0x00, 0x00, 0x00,
6        0xff, 0xa0, 0x00, 0x00, 0x00, 0x00
7     };
8 -   unsigned char *code = (unsigned char *) malloc(sizeof(insn_template));
9 +   unsigned char *code = EXEC_MALLOC(sizeof(insn_template), 16);
10     unsigned int next_insn;
11     if (code) {
12        memcpy(code, insn_template, sizeof(insn_template));
13 @@ -587,7 +588,7 @@
14            0x01000000   /*  nop                                           */
15     };
16  #endif
17 -   unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
18 +   unsigned int *code = EXEC_MALLOC(sizeof(insn_template), 16);
19     unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
20     if (code) {
21        memcpy(code, insn_template, sizeof(insn_template));
22 diff -urN xc.org/extras/Mesa/src/imports.c xc/extras/Mesa/src/imports.c
23 --- xc.org/extras/Mesa/src/imports.c    2004-06-07 22:45:05.943324576 +0200
24 +++ xc/extras/Mesa/src/imports.c        2004-06-07 23:08:05.289632064 +0200
25 @@ -59,6 +59,19 @@
26  extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
27  #endif
28  
29 +/* Define a struct for our private data. This is preferred over pointer
30 + * arithmetic to access individual pieces of our private data because the
31 + * compiler will help us get alignment correct in a portable way and it
32 + * makes it much easier to add or remove items from our private data */
33 +
34 +typedef struct align_malloc_header {
35 +  void  *alloc_ptr;           /* actual allocation ptr */
36 +  size_t alloc_size;          /* actual allocation size */
37 +  void  *user_ptr;            /* ptr returned to caller */
38 +  size_t user_size;           /* size caller requested */
39 +} align_malloc_header;
40 +
41 +static unsigned long RoundUpPowerOf2(unsigned long val);
42  
43  /**********************************************************************/
44  /* Wrappers for standard C library functions                          */
45 @@ -175,6 +188,310 @@
46  #endif
47  }
48  
49 +/*
50 + * Execute permission implementation notes:
51 + * John Dennis - jdennis@redhat.com - Red Hat Inc.
52 + *
53 + * Overview:
54 + *
55 + * Various parts of Mesa generate machine code during run time and
56 + * then executes that code. We will use the term code gen to refer to
57 + * this process. Some operating systems in an attempt to achieve
58 + * better security enforce restrictions on which memory areas may
59 + * contain executable code. In general execute permission is granted
60 + * to .text sections and removed on stack or heap memory. It's the
61 + * heap (and possibly the stack) where code is run time
62 + * generated. This means on systems that enforce execute memory
63 + * security you will get either a SEGV or SIGBUS exception when run
64 + * time generated code executes and the process will be terminated.
65 + *
66 + * Implementation:
67 + *
68 + * The solution is to provide unique malloc/free functions which
69 + * return memory with execute permission and to make sure these
70 + * allocation functions are called for code gen.
71 + *
72 + * There are 3 possible implementation solutions.
73 + *
74 + * Solution A: use mprotect on malloc block.
75 + * 
76 + *   In this scenario after a block is allocated via malloc we call
77 + *   mprotect on the pages containing the block and add execute
78 + *   permission. In theory a free of the block removes the execute
79 + *   permission. 
80 + *
81 + *   Pros: Simple to implement
82 + *
83 + *   Cons: Because execute permission is granted memory pages when
84 + *         mprotect is called on the page containing the malloc block
85 + *         every other malloc block in that page also receives execute
86 + *         permission, this is insecure.
87 + * 
88 + *         When a malloc block is freed that had been allocated for
89 + *         execute permission we should remove the execute permission
90 + *         from that block so that when the heap manager resuses that
91 + *         memory it will not be executable. But Because exectue
92 + *         permission is granted to memory pages and a page may have
93 + *         more than one malloc block with execute permission we
94 + *         cannot remove execute permission because that would remove
95 + *         execute permission on any executable malloc blocks still in
96 + *         that page. By not removing the execution permission on free
97 + *         we will tend to "leak" executable memory as more and more
98 + *         heap pages accumulate execute permission, possible without
99 + *         needing it.
100 + *
101 + * Solution B: use mmap to allocate block
102 + *
103 + *   In this scenario every call to alloc an executable block is
104 + *   performed with anonymous mmap. Mmap always allocates pages of
105 + *   memory. When free is called we unmap the pages.
106 + *
107 + *   Pros: This is much more secure. The kernel places the allocation
108 + *         in special pages that have additional protection. These
109 + *         pages are not near any other pages.
110 + *
111 + *         The pages used do not contain any heap allocation that is
112 + *         not susposed to be executable, therefore we are not
113 + *         inadvertantly granting execute permission to a malloc block
114 + *         that happens to live in the same page as a execute malloc
115 + *         block.
116 + *
117 + *         The allocation can be freed without affecting anyother
118 + *         allocation and it will be reused by the kernel.
119 + *
120 + *         Its simple to implement. As simple as solution A.
121 + *
122 + *   Cons: Mmap only allocates in units of pages. Thus even a small
123 + *         allocation will use an entire page. However note, only a
124 + *         small number exec malloc's are done so the wasted memory
125 + *         is not likely to be an issue.
126 + *
127 + *         Because every code generated function will live alone in
128 + *         its own page this will probably introduce more cache misses
129 + *         and page faults than if the all the code coalesced together
130 + *         into one or more pages as would be the case with regular
131 + *         .text sections.
132 + *         
133 + * Solution C: use separate malloc implementation using mmap'ed heap arena
134 + * 
135 + *   In this scenario a new heap manager is introduced which manages a
136 + *   heap arena usning anonymous mmap with execute permission. All
137 + *   executable allocations are provided using only this heap arena.
138 + *
139 + *   Pros: This is the ideal solution. As in Solution B executable and
140 + *         non-executable allocations are never mixed. Executable
141 + *         allocations are provided using the most secure pages the
142 + *         kernel manages.
143 + *
144 + *         Pages will likely contain multiple allocations as opposed
145 + *         to Solution B where pages will be sparsely used. This
146 + *         improves cache and page fault behavior.
147 + *
148 + *   Cons: This is the most involved implementation and requires the
149 + *         introduction of a heap manger implementation that has been
150 + *         modified to work with anonymous mmap. However, note that
151 + *         the GNU malloc implementation has been modified to work
152 + *         with anonymous mmap.
153 + */
154 +
155 +#if 1
156 +#define EXEC_ALLOC_USE_MMAP
157 +#else
158 +#define EXEC_ALLOC_USE_MALLOC
159 +#endif
160 +
161 +/* If input is power of 2 return that, else round up to next power of 2 */
162 +static unsigned long RoundUpPowerOf2(unsigned long val)
163 +{
164 +  int i, setBits;
165 +
166 +  if (val == 0) return(1UL);
167 +  if (val > (1UL << (sizeof(unsigned long) * 8 - 1))) {
168 +    /* out of range, should be fatal error?, for now return max power of 2 */
169 +    return (1UL << (sizeof(unsigned long) * 8 - 1));
170 +  }
171 +
172 +  for (i = setBits = 0; val && i < sizeof(unsigned long) * 8; i++, val >>= 1) {
173 +    if (val & 1UL) setBits++;
174 +  }
175 +  if (setBits > 1) 
176 +    return (1UL << i);         /* input was not power of 2 */
177 +  else
178 +    return (1UL << (i-1));     /* input was power of 2 */
179 +}
180 +
181 +/*
182 + * Allocate N-byte aligned memory in executable region (uninitialized)
183 + */
184 +
185 +#ifdef EXEC_ALLOC_USE_MALLOC
186 +void *
187 +_mesa_exec_malloc(size_t user_size, unsigned long user_align)
188 +{
189 +   unsigned long alloc_ptr, user_ptr, alloc_size, alloc_align;
190 +   align_malloc_header *pHeader;
191 +
192 +   ASSERT( user_align > 0 );
193 +
194 +   /* We store the pointer to the acutal address and size in a private
195 +    * header before the address the client sees. We need the actual 
196 +    * pointer to free with and we need the size to remove execute permission
197 +    * on the block */
198 +
199 +   if (user_align < sizeof(align_malloc_header))
200 +     alloc_align = RoundUpPowerOf2(sizeof(align_malloc_header));
201 +   else
202 +     alloc_align = user_align;
203 +   alloc_size = user_size + alloc_align;
204 +
205 +   alloc_ptr = (unsigned long) MALLOC(alloc_size);
206 +
207 +   if (!alloc_ptr) return(NULL);
208 +
209 +   user_ptr            = (alloc_ptr + alloc_align) & ~(unsigned long)(alloc_align - 1);
210 +   pHeader             = (align_malloc_header *) (user_ptr - sizeof(align_malloc_header));
211 +   pHeader->alloc_ptr  = (void *) alloc_ptr;
212 +   pHeader->alloc_size = alloc_size;
213 +   pHeader->user_ptr   = (void *) user_ptr;
214 +   pHeader->user_size  = user_size;
215 +
216 +   {
217 +     unsigned page_size, round;
218 +
219 +     page_size = getpagesize();
220 +     round = user_ptr & (page_size-1);
221 +     mprotect((void *)(user_ptr - round), (user_size + round + page_size-1) & ~(page_size-1),
222 +             PROT_READ | PROT_WRITE | PROT_EXEC);
223 +   }
224 +
225 +#ifdef DEBUG
226 +   {
227 +     unsigned char *p    = (unsigned char *) alloc_ptr;
228 +     unsigned char *stop = (unsigned char *) pHeader;
229 +
230 +     /* mark the non-aligned area */
231 +     for(; p < stop; p++) {
232 +       *p = 0xcd;
233 +     }
234 +   }
235 +#endif
236 +
237 +   return (void *)user_ptr;
238 +}
239 +
240 +/*
241 + * Free N-byte executable aligned memory
242 + */
243 +void
244 +_mesa_exec_free(void *user_ptr)
245 +{
246 +   /* The header giving the real address and size is just prior to the address the client sees. */
247 +   align_malloc_header *pHeader;
248 +   void *alloc_ptr;
249 +   size_t user_size;
250 +
251 +   pHeader = (align_malloc_header *)((char *)user_ptr - sizeof(align_malloc_header));
252 +   alloc_ptr = pHeader->alloc_ptr;
253 +   user_size = pHeader->user_size;
254 +
255 +#if 0
256 +   /*
257 +    * Unfortunately we cannot remove the execute permission on this
258 +    * malloc block because execute permission is granted on a page
259 +    * basis. If the page containing this malloc block also contained
260 +    * another malloc block with execute permission that was still in
261 +    * effect then we will remove execute permission on a malloc block
262 +    * that should still be enforce. This does mean we will tend to
263 +    * "leak" execute permission in the heap. See above block comment
264 +    * on implementation issues.
265 +    *
266 +    * Note, we could keep a ref count on each page and when the ref count
267 +    * fell to zero we could remove the execute permission.
268 +    *
269 +    * If we did remove the execute permission this is how it would be done.
270 +    */
271 +   {
272 +     unsigned page_size, round;
273 +
274 +     page_size = getpagesize();
275 +     round = (unsigned long)user_ptr & (page_size-1);
276 +     mprotect((char *)user_ptr - round, (user_size + round + page_size-1) & ~(page_size-1),
277 +             PROT_READ | PROT_WRITE);
278 +   }
279 +#endif
280 +   FREE(alloc_ptr);
281 +}
282 +
283 +#elif defined(EXEC_ALLOC_USE_MMAP)
284 +
285 +void *
286 +_mesa_exec_malloc(size_t user_size, unsigned long user_align)
287 +{
288 +   unsigned long alloc_ptr, user_ptr, alloc_size, alloc_align;
289 +   align_malloc_header *pHeader;
290 +
291 +   ASSERT( user_align > 0 );
292 +
293 +   /* We store the pointer to the acutal address and size in a private
294 +    * header before the address the client sees. We need the actual 
295 +    * pointer to free with and we need the size to unmap the region */
296 +
297 +   if (user_align < sizeof(align_malloc_header))
298 +     alloc_align = RoundUpPowerOf2(sizeof(align_malloc_header));
299 +   else
300 +     alloc_align = user_align;
301 +   alloc_size = user_size + alloc_align;
302 +
303 +   /* Note, I'm not sure how portable MAP_ANONYMOUS with fd=0 is, on some POSIX
304 +    * systems you may need to remove the MAP_ANONYMOUS flag and pass the 
305 +    * result of posix_typed_mem_open with POSIX_TYPED_MEM_ALLOCATE as the fd. */
306 +
307 +   alloc_ptr = (unsigned long) mmap(0, alloc_size,
308 +                                   PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
309 +   if ((void *)alloc_ptr == MAP_FAILED) {
310 +     return(NULL);
311 +   }
312 +
313 +   user_ptr            = (alloc_ptr + alloc_align) & ~(unsigned long)(alloc_align - 1);
314 +   pHeader             = (align_malloc_header *) (user_ptr - sizeof(align_malloc_header));
315 +   pHeader->alloc_ptr  = (void *) alloc_ptr;
316 +   pHeader->alloc_size = alloc_size;
317 +   pHeader->user_ptr   = (void *) user_ptr;
318 +   pHeader->user_size  = user_size;
319 +
320 +#ifdef DEBUG
321 +   {
322 +     unsigned char *p    = (unsigned char *) alloc_ptr;
323 +     unsigned char *stop = (unsigned char *) pHeader;
324 +
325 +     /* mark the non-aligned area */
326 +     for(; p < stop; p++) {
327 +       *p = 0xcd;
328 +     }
329 +   }
330 +#endif
331 +
332 +   return (void *)user_ptr;
333 +}
334 +
335 +/*
336 + * Free N-byte executable aligned memory
337 + */
338 +void
339 +_mesa_exec_free(void *user_ptr)
340 +{
341 +   /* The header giving the real address and size is just prior to the address the client sees. */
342 +   align_malloc_header *pHeader;
343 +   void *alloc_ptr;
344 +   size_t alloc_size;
345 +
346 +   pHeader    = (align_malloc_header *)((char *)user_ptr - sizeof(align_malloc_header));
347 +   alloc_ptr  = pHeader->alloc_ptr;
348 +   alloc_size = pHeader->alloc_size;
349 +
350 +   munmap(alloc_ptr, alloc_size);
351 +}
352 +#endif
353  
354  void *
355  _mesa_memcpy(void *dest, const void *src, size_t n)
356 diff -urN xc.org/extras/Mesa/src/imports.h xc/extras/Mesa/src/imports.h
357 --- xc.org/extras/Mesa/src/imports.h    2004-06-07 22:45:05.944324424 +0200
358 +++ xc/extras/Mesa/src/imports.h        2004-06-07 23:04:42.561451432 +0200
359 @@ -50,6 +50,9 @@
360  #define ALIGN_MALLOC_STRUCT(T, N)  (struct T *) _mesa_align_malloc(sizeof(struct T), N)
361  #define ALIGN_CALLOC_STRUCT(T, N)  (struct T *) _mesa_align_calloc(sizeof(struct T), N)
362  #define ALIGN_FREE(PTR)            _mesa_align_free(PTR)
363 +/* These allocate aligned memory in a area with execute permission, used for code generation. */
364 +#define EXEC_MALLOC(BYTES, N)     (void *) _mesa_exec_malloc(BYTES, N)
365 +#define EXEC_FREE(PTR)            _mesa_exec_free(PTR)
366  
367  #define MEMCPY( DST, SRC, BYTES)   _mesa_memcpy(DST, SRC, BYTES)
368  #define MEMSET( DST, VAL, N )      _mesa_memset(DST, VAL, N)
369 @@ -120,6 +123,11 @@
370  _mesa_align_free( void *ptr );
371  
372  extern void *
373 +_mesa_exec_malloc(size_t bytes, unsigned long alignment);
374 +extern void 
375 +_mesa_exec_free(void *ptr);
376 +
377 +extern void *
378  _mesa_memcpy( void *dest, const void *src, size_t n );
379  
380  extern void
381 diff -urN xc.org/extras/Mesa/src/tnl/t_vtx_exec.c xc/extras/Mesa/src/tnl/t_vtx_exec.c
382 --- xc.org/extras/Mesa/src/tnl/t_vtx_exec.c     2004-06-07 22:45:06.597225168 +0200
383 +++ xc/extras/Mesa/src/tnl/t_vtx_exec.c 2004-06-07 23:17:12.494444288 +0200
384 @@ -593,7 +593,7 @@
385     struct dynfn *f, *tmp;
386     foreach_s (f, tmp, l) {
387        remove_from_list( f );
388 -      ALIGN_FREE( f->code );
389 +      EXEC_FREE( f->code );
390        FREE( f );
391     }
392  }
393 diff -urN xc.org/extras/Mesa/src/tnl/t_vtx_x86.c xc/extras/Mesa/src/tnl/t_vtx_x86.c
394 --- xc.org/extras/Mesa/src/tnl/t_vtx_x86.c      2004-06-07 22:45:06.608223496 +0200
395 +++ xc/extras/Mesa/src/tnl/t_vtx_x86.c  2004-06-07 23:16:32.268559552 +0200
396 @@ -75,7 +75,7 @@
397          0xff, 0x25, 0, 0, 0, 0         /* jmp    NOTIFY */
398        };
399  
400 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
401 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
402        memcpy (dfn->code, temp, sizeof(temp));
403        FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[2]);
404        FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr);
405 @@ -126,7 +126,7 @@
406          0xff, 0x25, 0,0,0,0            /* jmp    *NOTIFY */
407        };
408  
409 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
410 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
411        memcpy (dfn->code, temp, sizeof(temp));
412        FIXUP(dfn->code, 2, 0x0, (int)&tnl->dmaptr);
413        FIXUP(dfn->code, 25, 0x0, (int)&tnl->vertex[3]);
414 @@ -163,7 +163,7 @@
415          0xff, 0x25, 0,0,0,0,           /* jmp    *NOTIFY */
416        };
417  
418 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
419 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
420        memcpy (dfn->code, temp, sizeof(temp));
421        FIXUP(dfn->code, 3, 0x0, (int)&tnl->dmaptr);
422        FIXUP(dfn->code, 28, 0x0, (int)&tnl->vertex[3]);
423 @@ -205,7 +205,7 @@
424          0xff, 0x25, 0, 0, 0, 0         /* jmp    NOTIFY */
425        };
426  
427 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
428 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
429        memcpy (dfn->code, temp, sizeof(temp));
430        FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[3]);
431        FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr);
432 @@ -259,7 +259,7 @@
433          0xff, 0x25, 0x08, 0, 0, 0,     /* jmp    *0x8 */
434        };
435  
436 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
437 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
438        memcpy (dfn->code, temp, sizeof(temp));
439        FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr);
440        FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]);
441 @@ -303,7 +303,7 @@
442          0xff, 0x25, 0x08, 0, 0, 0,     /* jmp    *0x8 */
443        };
444  
445 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
446 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
447        memcpy (dfn->code, temp, sizeof(temp));
448        FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr);
449        FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]);
450 @@ -351,7 +351,7 @@
451          0xff, 0x25, 0, 0, 0, 0         /* jmp    NOTIFY */
452        };
453  
454 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
455 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
456        memcpy (dfn->code, temp, sizeof(temp));
457        FIXUP(dfn->code, 8, 0x01010101, (int)&tnl->dmaptr);
458        FIXUP(dfn->code, 32, 0x00000006, tnl->vertex_size-3);
459 @@ -393,7 +393,7 @@
460  
461     insert_at_head( &tnl->dfn_cache.Normal3fv, dfn );
462     dfn->key = key;
463 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
464 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
465     memcpy (dfn->code, temp, sizeof(temp));
466     FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); 
467     return dfn;
468 @@ -421,7 +421,7 @@
469  
470     insert_at_head( &tnl->dfn_cache.Normal3f, dfn );
471     dfn->key = key;
472 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
473 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
474     memcpy (dfn->code, temp, sizeof(temp));
475     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); 
476     return dfn;
477 @@ -449,7 +449,7 @@
478  
479     insert_at_head( &tnl->dfn_cache.Normal3fv, dfn );
480     dfn->key = key;
481 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
482 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
483     memcpy (dfn->code, temp, sizeof(temp));
484     FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); 
485     return dfn;
486 @@ -475,7 +475,7 @@
487  
488     insert_at_head( &tnl->dfn_cache.Normal3f, dfn );
489     dfn->key = key;
490 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
491 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
492     memcpy (dfn->code, temp, sizeof(temp));
493     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); 
494     return dfn;
495 @@ -499,7 +499,7 @@
496          0xc3,                          /*  ret     */
497        };
498  
499 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
500 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
501        memcpy (dfn->code, temp, sizeof(temp));
502        FIXUP(dfn->code, 5, 0x12345678, (int)tnl->ubytecolorptr); 
503        return dfn;
504 @@ -531,7 +531,7 @@
505          0xc3,                                  /* ret     */
506        };
507  
508 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
509 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
510        memcpy (dfn->code, temp, sizeof(temp));
511        FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); 
512        FIXUP(dfn->code, 27, 0xdeadbeaf, (int)tnl->floatcolorptr); 
513 @@ -567,7 +567,7 @@
514        insert_at_head( &tnl->dfn_cache.Color4ub, dfn );
515        dfn->key = key;
516  
517 -      dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
518 +      dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
519        memcpy (dfn->code, temp, sizeof(temp));
520        FIXUP(dfn->code, 18, 0x0, (int)tnl->ubytecolorptr); 
521        FIXUP(dfn->code, 24, 0x0, (int)tnl->ubytecolorptr+1); 
522 @@ -600,7 +600,7 @@
523  
524     insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn );
525     dfn->key = key;
526 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
527 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
528     memcpy (dfn->code, temp, sizeof(temp));
529     FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); 
530     return dfn;
531 @@ -624,7 +624,7 @@
532  
533     insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn );
534     dfn->key = key;
535 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
536 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
537     memcpy (dfn->code, temp, sizeof(temp));
538     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); 
539     return dfn;
540 @@ -648,7 +648,7 @@
541  
542     insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn );
543     dfn->key = key;
544 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
545 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
546     memcpy (dfn->code, temp, sizeof(temp));
547     FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); 
548     return dfn;
549 @@ -670,7 +670,7 @@
550  
551     insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn );
552     dfn->key = key;
553 -   dfn->code = ALIGN_MALLOC( sizeof(temp), 16 );
554 +   dfn->code = EXEC_MALLOC( sizeof(temp), 16 );
555     memcpy (dfn->code, temp, sizeof(temp));
556     FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); 
557     return dfn;
558 diff -urN xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c
559 --- xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c       2004-06-07 22:44:55.376930912 +0200
560 +++ xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c   2004-06-07 22:48:38.196057256 +0200
561 @@ -1074,7 +1074,7 @@
562     struct dynfn *f, *tmp;
563     foreach_s (f, tmp, l) {
564        remove_from_list( f );
565 -      ALIGN_FREE( f->code );
566 +      EXEC_FREE( f->code );
567        FREE( f );
568     }
569  }
570 diff -urN xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h
571 --- xc.org/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h       2004-06-07 22:44:55.377930760 +0200
572 +++ xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h   2004-06-07 22:48:38.192057864 +0200
573 @@ -60,7 +60,7 @@
574     insert_at_head( &CACHE, dfn );                      \
575     dfn->key[0] = key[0];                                       \
576     dfn->key[1] = key[1];                                       \
577 -   dfn->code = ALIGN_MALLOC( end - start, 16 );                \
578 +   dfn->code = EXEC_MALLOC( end - start, 16 );         \
579     memcpy (dfn->code, start, end - start);             \
580  }                                                      \
581  while ( 0 )
582 diff -urN xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c
583 --- xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c   2004-06-07 22:44:55.473916168 +0200
584 +++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c       2004-06-07 22:48:38.218053912 +0200
585 @@ -1042,7 +1042,7 @@
586     struct dynfn *f, *tmp;
587     foreach_s (f, tmp, l) {
588        remove_from_list( f );
589 -      ALIGN_FREE( f->code );
590 +      EXEC_FREE( f->code );
591        FREE( f );
592     }
593  }
594 diff -urN xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h
595 --- xc.org/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h   2004-06-07 22:44:55.473916168 +0200
596 +++ xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h       2004-06-07 22:48:38.214054520 +0200
597 @@ -58,7 +58,7 @@
598     char *end = (char *)&FUNC##_end;                    \
599     insert_at_head( &CACHE, dfn );                      \
600     dfn->key = key;                                     \
601 -   dfn->code = ALIGN_MALLOC( end - start, 16 );                \
602 +   dfn->code = EXEC_MALLOC( end - start, 16 );         \
603     memcpy (dfn->code, start, end - start);             \
604  }                                                      \
605  while ( 0 )
606
This page took 0.072544 seconds and 3 git commands to generate.