From owner-freebsd-emulation@FreeBSD.ORG Thu Nov 1 15:26:24 2007 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D64D16A469 for ; Thu, 1 Nov 2007 15:26:24 +0000 (UTC) (envelope-from cracauer@koef.zs64.net) Received: from koef.zs64.net (koef.zs64.net [212.12.50.230]) by mx1.freebsd.org (Postfix) with ESMTP id CDBC013C4B8 for ; Thu, 1 Nov 2007 15:26:23 +0000 (UTC) (envelope-from cracauer@koef.zs64.net) Received: from koef.zs64.net (koef.zs64.net [212.12.50.230]) by koef.zs64.net (8.14.1/8.14.1) with ESMTP id lA1FPoQj011081; Thu, 1 Nov 2007 16:25:50 +0100 (CET) (envelope-from cracauer@koef.zs64.net) Received: (from cracauer@localhost) by koef.zs64.net (8.14.1/8.14.1/Submit) id lA1FPoax011080; Thu, 1 Nov 2007 11:25:50 -0400 (EDT) (envelope-from cracauer) Date: Thu, 1 Nov 2007 11:25:50 -0400 From: Martin Cracauer To: "Valery V.Chikalov" Message-ID: <20071101152550.GA10868@cons.org> References: <4721AB07.20708@novakom.com.ua> <4723A8D6.6020002@chikalov.dp.ua> <20071031180639.GA93259@cons.org> <47298F10.4050301@chikalov.dp.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47298F10.4050301@chikalov.dp.ua> User-Agent: Mutt/1.4.2.3i Cc: Martin Cracauer , freebsd-emulation@freebsd.org Subject: Re: Linux emulation on FreeBSD AMD64 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2007 15:26:24 -0000 Valery V.Chikalov wrote on Thu, Nov 01, 2007 at 10:32:16AM +0200: > Martin Cracauer wrote: > >Valery V.Chikalov wrote on Sun, Oct 28, 2007 at 12:08:38AM +0300: > >>Oct 27 19:42:59 tiger kernel: mprotect addr:2a27d000, return 0 > >>Oct 27 19:42:59 tiger kernel: mprotect addr:2a7c1000, return 0 > >>Oct 27 19:42:59 tiger kernel: mprotect addr:2a7cd000, return 0 > >>Oct 27 19:42:59 tiger kernel: mprotect addr:2a7e2000, return 0 > >>Oct 27 19:42:59 tiger kernel: mprotect addr:2a7ef000, return 0 > >>Oct 27 19:43:09 tiger kernel: mprotect addr:55c00000, return 13 > >>Oct 27 19:43:09 tiger kernel: mprotect addr:55c81000, return 13 > > > >You need to check whether these is anything mapped there in the first > >place and what the permissions are. > > > >This is probably best done by changing your debugging code in the > >Linuxulator to print amessage, then sleep for 10 seconds giving you > >time to copy the memory map to a safe place, then look up what the > >mapping at the position was. > > > >Martin > > Hi, Martin. > > Thank you for the hint. > But I'm not sure that I understanding you right. > I'm not a kernel hacker, just C-programmer with ability to read > documentation. :-) > Do the "memory map" about you told is some C-struct I can deal with and > which can be accessed by some system call, or that task ("copy the > memory map") can be achieved by some userland utility like "ipcs" or > "vmstat -m". No, you need the contents of /proc//map and /compat/linux/proc//maps This is why you hack up the kernel to wait a while, before the syscall is actually executed you want the time to grab both these files for the process and save them somewhere (cp /proc... /tmp/ is sufficient). I suspect the difference between Linux and FreeBSD here is what kind of existing mapping you are allowed to change in permissions. Should be reasonably easy to fix once we know both side, what permissions you had before (from the maps) and where you want to go (from the syscall arguments). Might be more hairy if some special kind of memory is involved but we'll see. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer http://www.cons.org/cracauer/ FreeBSD - where you want to go, today. http://www.freebsd.org/