Fw: Re: [RFC/PATCH] Updated: ppc64: Add mem=X option

Maneesh Soni maneesh at in.ibm.com
Thu Mar 17 15:08:43 EST 2005


Just re-sending, don't know why it didn't appear in the list for almost a day

----- Forwarded message from Maneesh Soni <maneesh at in.ibm.com> -----

Date: Wed, 16 Mar 2005 11:18:26 +0530
From: Maneesh Soni <maneesh at in.ibm.com>
To: Michael Ellerman <michael at ellerman.id.au>
Cc: linuxppc64-dev at ozlabs.org
Subject: Re: [RFC/PATCH] Updated: ppc64: Add mem=X option
Reply-To: maneesh at in.ibm.com

On Fri, Feb 25, 2005 at 07:14:08PM +1100, Michael Ellerman wrote:
[..]
> +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. 

=======================================

Welcome to yaboot version 1.3.11.SuSE
Enter "help" to get some basic usage information
boot: t mem=512M
Please wait, loading kernel...
   Elf64 kernel loaded...
Loading ramdisk...
ramdisk loaded at 04200000, size: 2616 Kbytes
OF stdout device is: /pci at 400000000110/isa at 3/serial at i3f8
klimit=0xc0000000006b0000
offset=0xbffffffffc600000
initrd_start=0x0000000004200000
initrd_end=0x000000000448e000
command line: root=/dev/sdd3 selinux=0 elevator=cfq splash=silent desktop profile=0 mem=512M
DEFAULT CATCH!, handler-entered=fff00700
Open Firmware exception handler entered from non-OF code

Client's Fix Pt Regs:
 00 0000000000000018 000000000291f7c0 0000000003fe15f8 0000000000000200
 04 000000000291fb58 0000000000000200 000000000000000a 000000000000001d
 08 000000000000004d c00000000002c050 0000000003e4faa5 c00000000002c050
 0c 2000000000000000 0000000000000000 0000000000000000 0000000000000000
 10 0000000000000000 0000000000000000 0000000003a00000 0000000003e4f798
 14 0000000000230000 000000000028e000 bffffffffc600000 0000000004200000
 18 0000000003e4fa50 000000000291f8f0 000000000000000d 000000000000000d
 1c 000000000000000c 0000000003dca588 000000000291fb58 000000000291f7c0
Special Regs:
    %IV: 00000700     %CR: 84004048    %XER: 20000000  %DSISR: 00000000
  %SRR0: c00000000002c050   %SRR1: 9000000000083000
    %LR: 0000000003a2c024    %CTR: c00000000002c050
   %DAR: 0000000000000000
PID = 18

 ok
0 >

===========================================

It worked fine if I replace the "switch" statement with the following "if"
block

		:
		:
	if ((**retptr == 'G') || (**retptr == 'g')) {
		ret <<= 10;
		ret <<= 10;
		ret <<= 10;
	}

	if ((**retptr == 'M') || (**retptr == 'm')) {
		ret <<= 10;
		ret <<= 10;
	}

	if ((**retptr == 'K') || (**retptr == 'k'))
		ret <<= 10;

	(*retptr)++;
		:
		:


I suspect this could be some compiler issue but not sure exactly what is the 
issue. I am tryng this on SLES9 system with gcc 3.3.3 version.

llm15:~ # gcc --version
gcc (GCC) 3.3.3 (SuSE Linux)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



Thanks
Maneesh

-- 
Maneesh Soni
Linux Technology Center, 
IBM India Software Labs,
Bangalore, India
email: maneesh at in.ibm.com
Phone: 91-80-25044990

----- End forwarded message -----



More information about the Linuxppc64-dev mailing list