summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-04-19 13:11:25 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-04-19 13:11:25 +0000
commitedf5e5abd24979eb74e8a9b7ae0c2198743114aa (patch)
treee214aef7cba7e40566e0f91a5b5a7bd7188c8e25
parenta2e08d650ebde3d1adfafe2847d6f6cfe8dacf4d (diff)
When mesa uses sse the current allocator was just using malloc, meaning
that the memory was not set to executable. This caused some horrible segfaults that due to lack of hardware i've been unable to track down for months. Conveniently, there was already a memory allocator that uses mmap to create executable memory, #ifdef linux. Make it usable for us too. Problem solved! Thanks for todd@ for helping me debug, and deraadt@ for noticing the allocator. Makes SiS work with dri, probaby solves a bunch of other people too. ok matthieu@ (who has sent this upstream).
-rw-r--r--dist/Mesa/src/mesa/main/execmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dist/Mesa/src/mesa/main/execmem.c b/dist/Mesa/src/mesa/main/execmem.c
index b7cbc818c..97cb675b9 100644
--- a/dist/Mesa/src/mesa/main/execmem.c
+++ b/dist/Mesa/src/mesa/main/execmem.c
@@ -36,7 +36,7 @@
-#if defined(__linux__) && !defined(XFree86Server)
+#if defined(__linux__) || defined(__OpenBSD__)
/*
* Allocate a large block of memory which can hold code then dole it out
@@ -64,7 +64,7 @@ init_heap(void)
if (!exec_mem)
exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE,
PROT_EXEC | PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE | MAP_ANON, -1, 0);
}