diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c index b400189..296ffa9 100644 --- a/libs/wine/mmap.c +++ b/libs/wine/mmap.c @@ -200,11 +200,6 @@ void *wine_anon_mmap( void *start, size_t size, int prot, int flags ) if (!(flags & MAP_FIXED)) { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - /* Even FreeBSD 5.3 does not properly support NULL here. */ - if( start == NULL ) start = (void *)0x110000; -#endif - #ifdef MAP_TRYFIXED /* If available, this will attempt a fixed mapping in-kernel */ flags |= MAP_TRYFIXED; diff --git a/loader/main.c b/loader/main.c index 628a0fa..2b731a2 100644 --- a/loader/main.c +++ b/loader/main.c @@ -164,14 +164,30 @@ static int pre_exec(void) return 1; } -#elif defined(__FreeBSD__) && defined(__i386__) +#elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(__i386__) + +#include + +static void *_mmap_init( void *addr, size_t len, int prot, int flags, int fd, off_t offset ); +static void *( *_mmap )( void *addr, size_t len, int prot, int flags, int fd, off_t offset ) = _mmap_init; + +static void *_mmap_init( void *addr, size_t len, int prot, int flags, int fd, off_t offset ) { + _mmap = ( void *( * )( void *, size_t, int, int, int, off_t )) dlsym( RTLD_NEXT, "mmap" ); + return( _mmap( addr, len, prot, flags, fd, offset )); +} + +void *mmap( void *addr, size_t len, int prot, int flags, int fd, off_t offset ) { + if ((flags & MAP_FIXED) == 0 && addr == NULL ) + addr = (void *)0x110000; + return( _mmap( addr, len, prot, flags, fd, offset )); +} static int pre_exec(void) { struct rlimit rl; - rl.rlim_cur = 0x02000000; - rl.rlim_max = 0x02000000; + rl.rlim_cur = 0x01000000; + rl.rlim_max = 0x01000000; setrlimit( RLIMIT_DATA, &rl ); return 1; }