[Cbe-oss-dev] [PATCH] libspe: elfspe: set argv[argc] = NULL

Noguchi, Masato Masato.Noguchi at jp.sony.com
Fri May 25 12:34:38 EST 2007


> > I felt too that it's reasonable passing envp. But, it will waste
some
> > kilo-bytes of local storage. So I think it's necessary to define
some
> > environment variables like SPE_NO_ARGS so that users can select.
> > BTW, is there any specification document about elfspe and/or
environment
> > variables used by elfspe.
> 
> Ah, I didn't realize that these are copied to local storage.
> 
> How about simply passing an effective address pointer as the
> third argument to main?
> 
> If we pass the arguments as
> 
> int main(int argc, char *argv[], uint64_t env_ea);
> 
> then those applications that really want to access the environment
> can do that through DMA.

If do so, it become impossible for crt0 to set environ, and getenv() --
and many library routines depends on environ -- will not work well.
I don't know well about environ, but, is it ok that an application
changes environ like below? 

extern char **environ;
char *myenv;
int main(int argc, char *argv[], uint64_t env_ea) {
    myenv = dma_get_environ(env_ea);
    environ = &myenv;
    return do_something_using_getenv(argc, argv, myenv);
}

If it is permissive, I think it can be a meeting point for everyone.
How about it?


Regards,
M.Noguchi





More information about the cbe-oss-dev mailing list