summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-05-30 03:37:13 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-05-30 03:37:13 +0000
commita0967e52e932fcc0e560fc2104e8d6498847008c (patch)
tree8b411954617dfbaa610623d1ebf3649b295143f7 /llvm
parent856ee9154fb4dc5bff11d271c925734f06677cce (diff)
downloadbcm5719-llvm-a0967e52e932fcc0e560fc2104e8d6498847008c.tar.gz
bcm5719-llvm-a0967e52e932fcc0e560fc2104e8d6498847008c.zip
Fix call to mmap, so that it can be used on sparc.
llvm-svn: 6424
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/SparcEmitter.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/SparcEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/SparcEmitter.cpp
index 3882b192582..601be92857d 100644
--- a/llvm/lib/ExecutionEngine/JIT/SparcEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/SparcEmitter.cpp
@@ -77,20 +77,15 @@ MachineCodeEmitter *VM::createSparcEmitter(VM &V) {
// FIXME: This should be rewritten to support a real memory manager for
// executable memory pages!
void * SparcEmitter::getMemory(unsigned NumPages) {
-#if 0
- void *pa = mmap(0, 4096*NumPages, PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+ void *pa;
+ if (NumPages == 0) return 0;
+ static const long pageSize = sysconf (_SC_PAGESIZE);
+ pa = mmap(0, pageSize*NumPages, PROT_READ|PROT_WRITE|PROT_EXEC,
+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (pa == MAP_FAILED) {
perror("mmap");
abort();
}
-#endif
- void *pa = malloc(4096*NumPages);
- if (!pa) {
- perror("malloc");
- abort();
- }
- funcMemory.push_back(pa);
return pa;
}
OpenPOWER on IntegriCloud