projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1b6b0ba
)
avoid platform dependencies: my_uintptr_t ==> StgWord
author
Simon Marlow
<simonmar@microsoft.com>
Mon, 17 Sep 2007 12:01:56 +0000
(12:01 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Mon, 17 Sep 2007 12:01:56 +0000
(12:01 +0000)
rts/posix/OSMem.c
patch
|
blob
|
history
diff --git
a/rts/posix/OSMem.c
b/rts/posix/OSMem.c
index
6e8337b
..
12cb43d
100644
(file)
--- a/
rts/posix/OSMem.c
+++ b/
rts/posix/OSMem.c
@@
-13,14
+13,6
@@
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/mman.h>
-/* no C99 header stdint.h on OpenBSD? */
-#if defined(openbsd_HOST_OS)
-typedef unsigned long my_uintptr_t;
-#else
-#include <stdint.h>
-typedef uintptr_t my_uintptr_t;
-#endif
-
lnat getPageSize (void)
{
static lnat pageSize = 0;
lnat getPageSize (void)
{
static lnat pageSize = 0;
@@
-38,13
+30,13
@@
lnat getPageSize (void)
void setExecutable (void *p, lnat len, rtsBool exec)
{
void setExecutable (void *p, lnat len, rtsBool exec)
{
- my_uintptr_t pageSize = getPageSize();
+ StgWord pageSize = getPageSize();
/* malloced memory isn't executable by default on OpenBSD */
/* malloced memory isn't executable by default on OpenBSD */
- my_uintptr_t mask = ~(pageSize - 1);
- my_uintptr_t startOfFirstPage = ((my_uintptr_t)p ) & mask;
- my_uintptr_t startOfLastPage = ((my_uintptr_t)p + len - 1) & mask;
- my_uintptr_t size = startOfLastPage - startOfFirstPage + pageSize;
+ StgWord mask = ~(pageSize - 1);
+ StgWord startOfFirstPage = ((StgWord)p ) & mask;
+ StgWord startOfLastPage = ((StgWord)p + len - 1) & mask;
+ 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);
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);