[U-Boot-Users] [PATCH v2] Add call command on PPC

Wolfgang Denk wd at denx.de
Fri Feb 15 09:41:04 CET 2008


In message <Pine.LNX.4.64.0802150001460.1512 at blarg.am.freescale.net> you wrote:
> The call command tries to mimic a function call in that the 'arg's to
> the command are passed in registers according to the PPC ABI.
> 
> The prototype that call mimics is some variation of the following
> depending on how many arguments are passed to the command:
> 
> void func(void)
> void func(unsigned long r3)
> void func(unsigned long r3, unsigned long r4)
> ...
> void func(unsigned long r3, unsigned long r4, ... unsigned long r10)
> 
> The maximum number of 'arg's is 8.  There are no arguments passed on
> a stack, no floating point or vector arguments.

This really makes zero sense to me.

> +	img = (int (*)(ulong, ulong, ulong, ulong,
> +			ulong, ulong, ulong, ulong)) addr;
> +
> +	for (i = 2; i < argc; i++)
> +		r[i-2] = simple_strtoul(argv[i], NULL, 16);
> +
> +	return (*img)(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]);

This looks not clean. Either  this  is  a  function  with  exactly  8
arguments,  or  it  isn't. And where is the code that makes sure that
``the 'arg's to the command are passed in  registers''  ?  I  see  no
difference between this call and what "go" does. 

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"More software projects have gone awry for lack of calendar time than
for all other causes combined."
                         - Fred Brooks, Jr., _The Mythical Man Month_




More information about the U-Boot mailing list