From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GEsC9-0000Wr-PY for qemu-devel@nongnu.org; Sun, 20 Aug 2006 14:38:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GEsC7-0000UL-Qe for qemu-devel@nongnu.org; Sun, 20 Aug 2006 14:38:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GEsC7-0000U8-9T for qemu-devel@nongnu.org; Sun, 20 Aug 2006 14:38:47 -0400 Received: from [64.233.166.178] (helo=py-out-1112.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GEsJK-0001E0-EC for qemu-devel@nongnu.org; Sun, 20 Aug 2006 14:46:14 -0400 Received: by py-out-1112.google.com with SMTP id x31so1958078pye for ; Sun, 20 Aug 2006 11:38:46 -0700 (PDT) Message-ID: Date: Sun, 20 Aug 2006 20:38:45 +0200 From: "Thomas Steffen" Subject: Re: [Qemu-devel] x86_64 vs. i386 In-Reply-To: <200607311258.48456.pg@futureware.at> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200607311258.48456.pg@futureware.at> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 7/31/06, Philipp G=FChring wrote: [32bit vs 64bit libraries] > Now I am wondering, whether it would be possible to integrate the process= or > emulator of qemu into the Linux kernel, so that applications can > transparently use different-bitsized libraries by qemulating them on dema= nd? The problem is not running 32bit code, a 64bit kernel can do that perfectly fine (with the correct 32bit libraries). The problem is that 32bit and 64bit code has a different ABI. Basically, if you call a library function with an integer on the pointer, both are put on the stack. In the 32bit ABI, they are both 4 byte values, but in the 64bit ABI the pointer needs 8 bytes. So when you want to call 64bit libraries from 32bit code, you would need to convert the parameters on the stack, and for that you would need to know what the parameters are. However, the library and the code have no information on this, because it is only in the source code, not in the binary. There are more problems (address space, different register allocation etc), but the function call sequence is the main problem. And qemu cannot solve it. Thomas