Fw: Re: [RFC/PATCH] Updated: ppc64: Add mem=X option
Anton Blanchard
anton at samba.org
Thu Mar 17 16:52:17 EST 2005
Hi,
> +unsigned long prom_memparse(const char *ptr, const char **retptr)
> +{
> + unsigned long ret = prom_strtoul(ptr, retptr);
> +
> + switch (**retptr) {
> + case 'G':
> + case 'g':
> + ret <<= 10;
> + case 'M':
> + case 'm':
> + ret <<= 10;
> + case 'K':
> + case 'k':
> + ret <<= 10;
> + (*retptr)++;
> + default:
> + break;
> + }
> + return ret;
> +}
>
> I get following exception with the above switch statement in place.
That makes me think gcc is using a particular switch statement
optimisation. You create a table indexed by the switch values (or part of
them). This table contains target addresses for the particular switch
case. You throw it in the count register then do a bctr.
Come to think of it, Im not sure how this optimisation can be safe
before we copy the kernel down.
Anton
More information about the Linuxppc64-dev
mailing list