ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/vm_alloc.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/vm_alloc.cpp (file contents):
Revision 1.8 by gbeauche, 2003-05-13T16:56:37Z vs.
Revision 1.9 by gbeauche, 2003-10-03T18:18:12Z

# Line 38 | Line 38
38   #endif
39   #endif
40  
41 + /* We want MAP_32BIT, if available, for SheepShaver and BasiliskII
42 +   because the emulated target is 32-bit and this helps to allocate
43 +   memory so that branches could be resolved more easily (32-bit
44 +   displacement to code in .text), on AMD64 for example.  */
45 + #ifndef MAP_32BIT
46 + #define MAP_32BIT 0
47 + #endif
48 +
49 + #define MAP_EXTRA_FLAGS (MAP_32BIT)
50 +
51   #ifdef HAVE_MMAP_VM
52 < static char * next_address = 0;
52 > #if defined(__linux__) && defined(__i386__)
53 > /* Force a reasonnable address below 0x80000000 on x86 so that we
54 >   don't get addresses above when the program is run on AMD64.
55 >   NOTE: this is empirically determined on Linux/x86.  */
56 > #define MAP_BASE        0x10000000
57 > #else
58 > #define MAP_BASE        0x00000000
59 > #endif
60 > static char * next_address = (char *)MAP_BASE;
61   #ifdef HAVE_MMAP_ANON
62 < #define map_flags       (MAP_PRIVATE | MAP_ANON)
62 > #define map_flags       (MAP_PRIVATE | MAP_ANON | MAP_EXTRA_FLAGS)
63   #define zero_fd         -1
64   #else
65   #ifdef HAVE_MMAP_ANONYMOUS
66 < #define map_flags       (MAP_PRIVATE | MAP_ANONYMOUS)
66 > #define map_flags       (MAP_PRIVATE | MAP_ANONYMOUS | MAP_EXTRA_FLAGS)
67   #define zero_fd         -1
68   #else
69   #ifdef HAVE_FCNTL_H
70   #include <fcntl.h>
71   #endif
72 < #define map_flags       (MAP_PRIVATE)
72 > #define map_flags       (MAP_PRIVATE | MAP_EXTRA_FLAGS)
73   static int zero_fd      = -1;
74   #endif
75   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines