[project @ 2002-02-14 17:21:50 by sof]
[ghc-hetmet.git] / ghc / rts / MBlock.h
1 /* -----------------------------------------------------------------------------
2  * $Id: MBlock.h,v 1.13 2002/02/14 17:21:50 sof Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * MegaBlock Allocator interface.
7  *
8  * ---------------------------------------------------------------------------*/
9 #ifndef __MBLOCK_H__
10 #define __MBLOCK_H__
11 extern lnat mblocks_allocated;
12
13 #if defined(mingw32_TARGET_OS)
14 extern int is_heap_alloced(const void* p);
15 #endif
16
17 extern void * getMBlock(void);
18 extern void * getMBlocks(nat n);
19
20 #if freebsd2_TARGET_OS || freebsd_TARGET_OS
21 /* Executable is loaded from      0x0
22  * Shared libraries are loaded at 0x2000000
23  * Stack is at the top of the address space.  The kernel probably owns
24  * 0x8000000 onwards, so we'll pick 0x5000000.
25  */
26 #define HEAP_BASE 0x50000000
27
28 #elif netbsd_TARGET_OS
29 /* NetBSD i386 shared libs are at 0x40000000
30  */
31 #define HEAP_BASE 0x50000000
32 #elif openbsd_TARGET_OS
33 #define HEAP_BASE 0x50000000
34 #elif linux_TARGET_OS
35 /* Any ideas?
36  */
37 #define HEAP_BASE 0x50000000
38
39 #elif solaris2_TARGET_OS
40 /* guess */
41 #define HEAP_BASE 0x50000000
42
43 #elif osf3_TARGET_OS
44 /* ToDo: Perhaps by adjusting this value we can make linking without
45  * -static work (i.e., not generate a core-dumping executable)? */
46 #if SIZEOF_VOID_P == 8
47 #define HEAP_BASE 0x180000000L
48 #else
49 #error I have no idea where to begin the heap on a non-64-bit osf3 machine.
50 #endif
51
52 #elif hpux_TARGET_OS
53 /* guess */
54 #define HEAP_BASE 0x50000000
55
56 #elif darwin_TARGET_OS
57 /* guess */
58 #define HEAP_BASE 0x50000000
59
60 #elif defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
61 /* doesn't matter, we use a reserve/commit algorithm */
62
63 #else
64 #error Dont know where to get memory from on this architecture
65 /* ToDo: memory locations on other architectures */
66 #endif
67
68 #endif