projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add #ifdefs needed to compile Gallium on Solaris with gcc or Sun cc
[mesa.git]
/
src
/
gallium
/
auxiliary
/
rtasm
/
rtasm_execmem.c
diff --git
a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 300c1c2d9d7073d990d265855f5b4f63736c81fc..01811d50114e2c8868285d67b820aaeb29b02c9e 100644
(file)
--- a/
src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/
src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@
-31,27
+31,33
@@
#include "pipe/p_compiler.h"
#include "pipe/p_compiler.h"
-#include "
pipe/p
_debug.h"
+#include "
util/u
_debug.h"
#include "pipe/p_thread.h"
#include "pipe/p_thread.h"
-#include "
pipe/p_util
.h"
+#include "
util/u_memory
.h"
#include "rtasm_execmem.h"
#include "rtasm_execmem.h"
+#if defined(PIPE_OS_BSD)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
-#if defined(__linux__)
/*
* Allocate a large block of memory which can hold code then dole it out
* in pieces by means of the generic memory manager code.
/*
* Allocate a large block of memory which can hold code then dole it out
* in pieces by means of the generic memory manager code.
-*/
+
*/
#include <unistd.h>
#include <sys/mman.h>
#include <unistd.h>
#include <sys/mman.h>
+#include "pipe/p_thread.h"
#include "util/u_mm.h"
#define EXEC_HEAP_SIZE (10*1024*1024)
#include "util/u_mm.h"
#define EXEC_HEAP_SIZE (10*1024*1024)
-
_glthread_DECLARE_STATIC_MUTEX
(exec_mutex);
+
pipe_static_mutex
(exec_mutex);
static struct mem_block *exec_heap = NULL;
static unsigned char *exec_mem = NULL;
static struct mem_block *exec_heap = NULL;
static unsigned char *exec_mem = NULL;
@@
-61,7
+67,7
@@
static void
init_heap(void)
{
if (!exec_heap)
init_heap(void)
{
if (!exec_heap)
- exec_heap = mmInit( 0, EXEC_HEAP_SIZE );
+ exec_heap =
u_
mmInit( 0, EXEC_HEAP_SIZE );
if (!exec_mem)
exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE,
if (!exec_mem)
exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE,
@@
-76,13
+82,13
@@
rtasm_exec_malloc(size_t size)
struct mem_block *block = NULL;
void *addr = NULL;
struct mem_block *block = NULL;
void *addr = NULL;
-
_glthread_LOCK_MUTEX
(exec_mutex);
+
pipe_mutex_lock
(exec_mutex);
init_heap();
if (exec_heap) {
init_heap();
if (exec_heap) {
- size = (size + 31) & ~31;
- block =
mmAllocMem( exec_heap, size, 32, 0 );
+ size = (size + 31) & ~31;
/* next multiple of 32 bytes */
+ block =
u_mmAllocMem( exec_heap, size, 5, 0 ); /* 5 -> 32-byte alignment */
}
if (block)
}
if (block)
@@
-90,7
+96,7
@@
rtasm_exec_malloc(size_t size)
else
debug_printf("rtasm_exec_malloc failed\n");
else
debug_printf("rtasm_exec_malloc failed\n");
-
_glthread_UNLOCK_MUTEX
(exec_mutex);
+
pipe_mutex_unlock
(exec_mutex);
return addr;
}
return addr;
}
@@
-99,20
+105,20
@@
rtasm_exec_malloc(size_t size)
void
rtasm_exec_free(void *addr)
{
void
rtasm_exec_free(void *addr)
{
-
_glthread_LOCK_MUTEX
(exec_mutex);
+
pipe_mutex_lock
(exec_mutex);
if (exec_heap) {
if (exec_heap) {
- struct mem_block *block = mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
+ struct mem_block *block =
u_
mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
if (block)
if (block)
- mmFreeMem(block);
+
u_
mmFreeMem(block);
}
}
-
_glthread_UNLOCK_MUTEX
(exec_mutex);
+
pipe_mutex_unlock
(exec_mutex);
}
}
-#else
+#else
/* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
/*
* Just use regular memory.
/*
* Just use regular memory.
@@
-132,4
+138,4
@@
rtasm_exec_free(void *addr)
}
}
-#endif
+#endif
/* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */