Date: Mon, 23 May 2005 14:02:19 -0400 From: Martin Cracauer <cracauer@cons.org> To: freebsd-emulation@freebsd.org Subject: My hacks to make the memory map fit Message-ID: <20050523140219.A56902@cons.org>
next in thread | raw e-mail | index | archive | help
--yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Can as well copy it to the list. This is what I have to do to make the memory map, that means the placement of shared libraries and the default place of mmap() calls come out the same way that it does on Linux (where Linux = one where Fedora doesn't play with the maps). 1) apply appended diff (my version not limited to the Linux emulator). Diff is against 5-stable, but same thing works on 6-current 2) sysctl vm.cracauer_mmap_offset=402333696 This introduces a default offset that moves the shared libs high enough. However, ld-xxx.so is still in the way because it has hardcoded addresses, so you need this: 3) get a `prelink` binary, I use the one from Redhat-9, works on linux_base-7 and linux_base-8 4) prelink -r 0x18000000 /compat/linux/lib/ld-2.3.2.so (or whatever ld-2.3.2.so you have) This changes the memory map to what Linux program expect, see appended example map. It makes the Linux binary of CMUCL run, including C and C++ libraries dynamically loaded from CMUCL :-) I think that some of the problems I have running Cedega (commercial version of Wine) or Wine itself are related to this. Didn't test yet whether this fixes it. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/ No warranty. This email is probably produced by one of my cats stepping on the keys. No, I don't have an infinite number of cats. --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=map 08048000-0804c000 r-xp 00006000 00:00 3797278 /mnt/part2/compat/linux/bin/cat 0804c000-0804d000 rw-p 00001000 00:00 0 3fffe000-40001000 r-xp 00003000 00:00 3724064 /mnt/part2/compat/linux/etc/ld.so.cache 4004c000-4005e000 r-xp 00012000 00:00 3721349 /mnt/part2/compat/linux/lib/ld-2.3.2.so 4005e000-4005f000 rw-p 00001000 00:00 0 bfbe0000-bfc00000 rwxp 00020000 00:00 0 --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Permission denied, please try again. Permission denied, please try again. Index: vm/vm_mmap.c =================================================================== RCS file: /home/CVS-FreeBSD/src/sys/vm/vm_mmap.c,v retrieving revision 1.192.2.2 diff -u -r1.192.2.2 vm_mmap.c --- vm/vm_mmap.c 31 Jan 2005 23:27:03 -0000 1.192.2.2 +++ vm/vm_mmap.c 23 May 2005 16:47:54 -0000 @@ -88,6 +88,11 @@ static int max_proc_mmap; SYSCTL_INT(_vm, OID_AUTO, max_proc_mmap, CTLFLAG_RW, &max_proc_mmap, 0, ""); +static vm_offset_t cracauer_mmap_offset; +SYSCTL_INT(_vm, OID_AUTO, cracauer_mmap_offset, CTLFLAG_RW, + &cracauer_mmap_offset, 0, ""); + + /* * Set the maximum number of vm_map_entry structures per process. Roughly * speaking vm_map_entry structures are tiny, so allowing them to eat 1/100 @@ -271,10 +276,12 @@ PROC_LOCK(td->td_proc); if (addr == 0 || (addr >= round_page((vm_offset_t)vms->vm_taddr) && - addr < round_page((vm_offset_t)vms->vm_daddr + - lim_max(td->td_proc, RLIMIT_DATA)))) + addr < round_page((vm_offset_t)vms->vm_daddr + + lim_max(td->td_proc, RLIMIT_DATA)))) { addr = round_page((vm_offset_t)vms->vm_daddr + - lim_max(td->td_proc, RLIMIT_DATA)); + lim_max(td->td_proc, RLIMIT_DATA) + + cracauer_mmap_offset); + } PROC_UNLOCK(td->td_proc); } if (flags & MAP_ANON) { --yrj/dFKFPuw6o+aM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050523140219.A56902>