From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54228 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhXZE-0004RK-5B for qemu-devel@nongnu.org; Mon, 24 Jan 2011 20:19:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhXZC-0003GO-FB for qemu-devel@nongnu.org; Mon, 24 Jan 2011 20:19:31 -0500 Received: from mail-gx0-f173.google.com ([209.85.161.173]:60351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhXZC-0003Fx-Ce for qemu-devel@nongnu.org; Mon, 24 Jan 2011 20:19:30 -0500 Received: by gxk28 with SMTP id 28so1733688gxk.4 for ; Mon, 24 Jan 2011 17:19:28 -0800 (PST) Message-ID: <4D3E251D.3040302@landley.net> Date: Mon, 24 Jan 2011 19:19:25 -0600 From: Rob Landley MIME-Version: 1.0 Subject: Re: [Qemu-devel] TCG flow vs dyngen References: <000001cbb58c$221f5a00$011aa8c0@side35ya3cah0n> <4D330D01.9060801@gmail.com> <4D3CA28C.5080907@landley.net> <4D3CAAF3.2080600@gmail.com> <4D3CBC65.5070007@landley.net> <4D3D51A8.3060903@gmail.com> <4D3DC2D4.5010504@landley.net> <4D3DEC40.7020302@gmail.com> In-Reply-To: <4D3DEC40.7020302@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Bonifazi Cc: =?ISO-8859-1?Q?Rapha=EBl_Lef=E8vre?= , qemu-devel@nongnu.org On 01/24/2011 03:16 PM, Stefano Bonifazi wrote: > Hi! Thanks for replying me! >> The thing is, the kernel currently _does_ work, so studying the relevant >> kernel code (and possibly the dynamic loader code) is one way to learn >> how it currently works. > Sorry what kernel? Qemu's? Linux's? QEMU isn't a kernel, it's an emulator. Linux is a kernel. I meant Linux loads and runs Linux ELF executables. That's pretty much the definition of "how to do it". So if there's ever a conflict between "how qemu does it" and "how the Linux kernel does it", the Linux kernel is going to win. (And yes, this has come up before, for me it was http://www.mail-archive.com/qemu-devel@nongnu.org/msg25336.html ) That said, QEMU's currently working fairly well on this front too, so studying either should work pretty well... One advantage of the kernel is "cat /proc/$PID/maps" which lets you know what the mappings are, and then you can look up the appropriate chunks of the executable and read the elf spec: http://refspecs.freestandards.org/elf/elf.pdf And to be honest, the best way to get up to speed on this is to read this: http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html Where some guy asked "ok, what do we actually NEED" and then set out to prove it. This book is pretty good too, although so dry it's almost unreadable. You might have better luck getting a paper copy out of the library: http://www.iecc.com/linker/ Rob