qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Win32: Fix compilation with SDL.


From: Hollis Blanchard
Subject: Re: [Qemu-devel] [PATCH] Win32: Fix compilation with SDL.
Date: Thu, 18 Jun 2009 15:49:13 -0500

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]