[project @ 2002-05-14 08:15:49 by matthewc]
[ghc-hetmet.git] / ghc / rts / MBlock.h
1 /* -----------------------------------------------------------------------------
2  * $Id: MBlock.h,v 1.14 2002/05/14 08:15:49 matthewc 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
35 #elif linux_TARGET_OS
36 #if ia64_TARGET_ARCH
37 /* Shared libraries are in region 1, text in region 2, data in region 3.
38  * Stack is at the top of region 4.  We use the bottom.
39  */
40 #define HEAP_BASE (4L<<61)
41 #else
42 /* Any ideas?
43  */
44 #define HEAP_BASE 0x50000000
45 #endif
46
47 #elif solaris2_TARGET_OS
48 /* guess */
49 #define HEAP_BASE 0x50000000
50
51 #elif osf3_TARGET_OS
52 /* ToDo: Perhaps by adjusting this value we can make linking without
53  * -static work (i.e., not generate a core-dumping executable)? */
54 #if SIZEOF_VOID_P == 8
55 #define HEAP_BASE 0x180000000L
56 #else
57 #error I have no idea where to begin the heap on a non-64-bit osf3 machine.
58 #endif
59
60 #elif hpux_TARGET_OS
61 /* guess */
62 #define HEAP_BASE 0x50000000
63
64 #elif darwin_TARGET_OS
65 /* guess */
66 #define HEAP_BASE 0x50000000
67
68 #elif defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
69 /* doesn't matter, we use a reserve/commit algorithm */
70
71 #else
72 #error Dont know where to get memory from on this architecture
73 /* ToDo: memory locations on other architectures */
74 #endif
75
76 #endif