/* -----------------------------------------------------------------------------
- * $Id: MBlock.c,v 1.11 1999/03/11 11:21:47 simonm Exp $
+ * $Id: MBlock.c,v 1.16 2000/08/04 23:31:44 lewie Exp $
*
* (c) The GHC Team 1998-1999
*
#include <windows.h>
#endif
-#if freebsd2_TARGET_OS || freebsd3_TARGET_OS
+#if freebsd2_TARGET_OS || freebsd_TARGET_OS
/* Executable is loaded from 0x0
* Shared libraries are loaded at 0x2000000
* Stack is at the top of the address space. The kernel probably owns
*/
#define ASK_FOR_MEM_AT 0x50000000
+#elif netbsd_TARGET_OS
+/* NetBSD i386 shared libs are at 0x40000000
+ */
+#define ASK_FOR_MEM_AT 0x50000000
+#elif openbsd_TARGET_OS
+#define ASK_FOR_MEM_AT 0x50000000
#elif linux_TARGET_OS
/* Any ideas?
*/
#define SIZE_RESERVED_POOL ( 128 * 1024 * 1024 )
/* This predicate should be inlined, really. */
+/* TODO: this only works for a single chunk */
int
is_heap_alloced(const void* x)
{
return (((char*)(x) >= base_non_committed) &&
- ((char*)(x) <= (base_non_committed + 128 * 1024 * 1024)));
+ ((char*)(x) <= (base_non_committed + SIZE_RESERVED_POOL)));
}
void *
ret=(void*)-1;
} else {
/* The returned pointer is not aligned on a mega-block boundary. Make it. */
- base_mblocks = (char*)((unsigned)base_non_committed & (unsigned)0xfff00000) + 0x100000;
+ base_mblocks = (char*)((unsigned long)base_non_committed & (unsigned long)0xfff00000) + MBLOCK_SIZE;
# if 0
fprintf(stderr, "Dropping %d bytes off of 128M chunk\n",
(unsigned)base_mblocks - (unsigned)base_non_committed);