Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MHOYK-0002ZK-OG for qemu-devel@nongnu.org; Thu, 18 Jun 2009 16:49:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MHOYG-0002Yp-7X for qemu-devel@nongnu.org; Thu, 18 Jun 2009 16:49:44 -0400 Received: from [199.232.76.173] (port=46653 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MHOYG-0002Ym-1T for qemu-devel@nongnu.org; Thu, 18 Jun 2009 16:49:40 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:50583) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MHOYF-0006nh-KA for qemu-devel@nongnu.org; Thu, 18 Jun 2009 16:49:39 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e39.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n5IKjS5R002200 for ; Thu, 18 Jun 2009 14:45:28 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n5IKnODF176416 for ; Thu, 18 Jun 2009 14:49:25 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n5IKnDM8031856 for ; Thu, 18 Jun 2009 14:49:24 -0600 Subject: Re: [Qemu-devel] [PATCH] Win32: Fix compilation with SDL. From: Hollis Blanchard In-Reply-To: <4A3A9CCE.4060005@codemonkey.ws> References: <1245348663-9022-1-git-send-email-weil@mail.berlios.de> <4A3A8B77.2020109@codemonkey.ws> <4A3A8F22.2080907@mail.berlios.de> <4A3A91A5.4080209@codemonkey.ws> <4A3A92BD.2080708@mail.berlios.de> <4A3A9CCE.4060005@codemonkey.ws> Content-Type: text/plain Date: Thu, 18 Jun 2009 15:49:13 -0500 Message-Id: <1245358153.2246.34.camel@slate.austin.ibm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: QEMU Developers On Thu, 2009-06-18 at 15:00 -0500, Anthony Liguori wrote: > Stefan Weil wrote: > > Ah, ok: it's simply a bad prototype of SDL_config: > > > > extern C_LINKAGE int SDL_main(int argc, char *argv[]); > > > > QEMU's main does not match: > > int main(int argc, char **argv, char **envp) > > > > So just redefining main will result in a wrong SDL_main > > with 3 instead of 2 arguments. > > > > Can we not use getenv() instead of envp in main()? This was introduced > for cache-utils which looks to be PPC specific. ppc_init_cacheline_sizes() doesn't actually want env; if you look closely you'll see it walks off the end of that array. What it really wants is the AUX vector defined in the PowerPC ABI, which is a way for the kernel to expose capabilities to userland. (IIRC this code should really be written "main(int argc, char *argv, char **envp, unsigned long **auxv)", but anyways...) The only way to access the AUX vector without changing the prototype of main() is to read /proc/self/auxv. I hear the glibc maintainer has obstinately refused to add a proper interface to it. (This issue has come up before because the AUX vector also informs userspace if Altivec is available. It's typically codec libraries that want to know, but by the time libraries are loaded, the pointer passed to main() is long gone.) -- Hollis Blanchard IBM Linux Technology Center