forked from OSchip/llvm-project
Fix call to mmap, so that it can be used on sparc.
llvm-svn: 6424
This commit is contained in:
parent
856ee9154f
commit
a0967e52e9
|
@ -77,20 +77,15 @@ MachineCodeEmitter *VM::createSparcEmitter(VM &V) {
|
||||||
// FIXME: This should be rewritten to support a real memory manager for
|
// FIXME: This should be rewritten to support a real memory manager for
|
||||||
// executable memory pages!
|
// executable memory pages!
|
||||||
void * SparcEmitter::getMemory(unsigned NumPages) {
|
void * SparcEmitter::getMemory(unsigned NumPages) {
|
||||||
#if 0
|
void *pa;
|
||||||
void *pa = mmap(0, 4096*NumPages, PROT_READ|PROT_WRITE|PROT_EXEC,
|
if (NumPages == 0) return 0;
|
||||||
MAP_PRIVATE|MAP_ANONYMOUS, 0, 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) {
|
if (pa == MAP_FAILED) {
|
||||||
perror("mmap");
|
perror("mmap");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
void *pa = malloc(4096*NumPages);
|
|
||||||
if (!pa) {
|
|
||||||
perror("malloc");
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
funcMemory.push_back(pa);
|
|
||||||
return pa;
|
return pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue