projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Buggy optimizations caused function-call return to share the function's entry point
[ghc-hetmet.git]
/
rts
/
posix
/
OSMem.c
diff --git
a/rts/posix/OSMem.c
b/rts/posix/OSMem.c
index
9e6e62b
..
51737ad
100644
(file)
--- a/
rts/posix/OSMem.c
+++ b/
rts/posix/OSMem.c
@@
-25,6
+25,9
@@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
#include <errno.h>
#include <errno.h>
@@
-93,7
+96,7
@@
my_mmap (void *addr, lnat size)
// Let's just use the underlying Mach Microkernel calls directly,
// they're much nicer.
// Let's just use the underlying Mach Microkernel calls directly,
// they're much nicer.
- kern_return_t err;
+ kern_return_t err = 0;
ret = addr;
if(addr) // try to allocate at adress
err = vm_allocate(mach_task_self(),(vm_address_t*) &ret, size, FALSE);
ret = addr;
if(addr) // try to allocate at adress
err = vm_allocate(mach_task_self(),(vm_address_t*) &ret, size, FALSE);
@@
-109,8
+112,8
@@
my_mmap (void *addr, lnat size)
vm_protect(mach_task_self(),(vm_address_t)ret,size,FALSE,VM_PROT_READ|VM_PROT_WRITE);
}
#else
vm_protect(mach_task_self(),(vm_address_t)ret,size,FALSE,VM_PROT_READ|VM_PROT_WRITE);
}
#else
- ret = mmap(addr, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_ANON | MAP_PRIVATE, -1, 0);
+ ret = mmap(addr, size, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
if (ret == (void *)-1) {
#endif
if (ret == (void *)-1) {
@@
-173,7
+176,7
@@
void *
osGetMBlocks(nat n)
{
caddr_t ret;
osGetMBlocks(nat n)
{
caddr_t ret;
- lnat size = MBLOCK_SIZE * n;
+ lnat size = MBLOCK_SIZE * (lnat)n;
if (next_request == 0) {
// use gen_map_mblocks the first time.
if (next_request == 0) {
// use gen_map_mblocks the first time.
@@
-234,6
+237,6
@@
void setExecutable (void *p, lnat len, rtsBool exec)
StgWord size = startOfLastPage - startOfFirstPage + pageSize;
if (mprotect((void*)startOfFirstPage, (size_t)size,
(exec ? PROT_EXEC : 0) | PROT_READ | PROT_WRITE) != 0) {
StgWord size = startOfLastPage - startOfFirstPage + pageSize;
if (mprotect((void*)startOfFirstPage, (size_t)size,
(exec ? PROT_EXEC : 0) | PROT_READ | PROT_WRITE) != 0) {
- barf("makeExecutable: failed to protect 0x%p\n", p);
+ barf("setExecutable: failed to protect 0x%p\n", p);
}
}
}
}