diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2003-05-30 03:37:13 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-05-30 03:37:13 +0000 |
commit | 6607fbec94fccc9441cf893a7d908373894aa3e6 (patch) | |
tree | 1527a8b62675ad5e83d83e7fc84bced7ce122136 | |
parent | 139f0c279d460d770ee784a05e70e08717907d45 (diff) |
Fix call to mmap, so that it can be used on sparc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6424 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/ExecutionEngine/JIT/SparcEmitter.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/ExecutionEngine/JIT/SparcEmitter.cpp b/lib/ExecutionEngine/JIT/SparcEmitter.cpp index 3882b19258..601be92857 100644 --- a/lib/ExecutionEngine/JIT/SparcEmitter.cpp +++ b/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; } |