Don't pass the stack pointer to zImage's start() function
At present, the zImage entry code passes a copy of the stack pointer to the start() function. There's no real reason for this; the only thing start() does with it is print it out. It appears to be a leftover debugging hack, so, this patch removes it.
---
As requested, a cleanup for this wart. Please apply.
arch/powerpc/boot/crt0.S +0 -1
@@ -86,5 +86,4 @@ _zimage_start: bl platform_init /* Call start */ - mr r3,r1 b start
arch/powerpc/boot/main.c +2 -3
@@ -256,7 +256,7 @@ struct dt_ops dt_ops;struct console_ops console_ops;struct loader_info loader_info; -void start (void *sp) +void start (void ) {struct addr_range vmlinux, initrd;kernel_entry_t kentry;
@@ -268,8 +268,7 @@ void start(void *sp)if (platform_ops.fixups) platform_ops.fixups (); -printf ("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r" , - _start, sp); +printf ("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r" , _start); vmlinux =prep_kernel (); initrd = prep_initrd(vmlinux, loader_info.initrd_addr,
arch/powerpc/boot/ops.h +1 -1
@@ -66,7 +66,7 @@ struct loader_info { };extern struct loader_info loader_info; -void start (void *sp); +void start (void );int ft_init (void *dt_blob,unsigned int max_size,unsigned int max_find_device);int serial_console_init (void );int ns16550_console_init (void *devp,struct serial_console_data *scdp);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 4 lines · David Gibson
At present, the zImage entry code passes a copy of the stack pointer to the
start()function. There's no real reason for this; the only thingstart()does with it is print it out. It appears to be a leftover debugging hack, so, this patch removes it.
<snip>
Quoted 12 lines
arch/powerpc/boot/main.c +1
-1@@ -256,7 +256,7 @@ struct dt_ops dt_ops;struct console_ops console_ops;struct loader_info loader_info; -void start (void *sp) +void start (void ) {struct addr_range vmlinux, initrd;kernel_entry_t kentry;
arch/powerpc/boot/main.c void start(void *sp) · line 271
Quoted 6 lines
arch/powerpc/boot/main.c +1
-2@@ -268,8 +268,7 @@ void start(void *sp)if (platform_ops.fixups) platform_ops.fixups (); -printf ("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r" , - _start, sp); +printf ("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r" , _start);
Shouldn't that be:
+ printf("\n\rzImage starting: loaded at 0x%p\n\r", _start);
or similar?
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
Quoted 31 lines · Tony Breeds
Quoted 4 lines · David Gibson
At present, the zImage entry code passes a copy of the stack pointer to the
start()function. There's no real reason for this; the only thingstart()does with it is print it out. It appears to be a leftover debugging hack, so, this patch removes it.<snip>
Quoted 12 lines
arch/powerpc/boot/main.c +1
-1@@ -256,7 +256,7 @@ struct dt_ops dt_ops;struct console_ops console_ops;struct loader_info loader_info; -void start (void *sp) +void start (void ) {struct addr_range vmlinux, initrd;kernel_entry_t kentry;arch/powerpc/boot/main.c void start(void *sp) · line 271
Quoted 6 lines
arch/powerpc/boot/main.c +1
-2@@ -268,8 +268,7 @@ void start(void *sp)if (platform_ops.fixups) platform_ops.fixups (); -printf ("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r" , - _start, sp); +printf ("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r" , _start);Shouldn't that be:
(quoted diff) +1
-0+ printf("\n\rzImage starting: loaded at 0x%p\n\r", _start);
Quoted 1 line
or similar?
Crap, yes, I suck.
Fixed version coming, plus a patch to turn on gcc printf format warnings for the zImage.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Olaf Hering
NAKQuoted 6 lines · David Gibson
At present, the zImage entry code passes a copy of the stack pointer to the
start()function. There's no real reason for this; the only thingstart()does with it is print it out. It appears to be a leftover debugging hack, so, this patch removes it.Signed-off-by David Gibson <[email protected]>
NACK.
It helps to determine the firmware memory layout.
Quoted 11 lines · Olaf Hering
Quoted 6 lines · David Gibson
At present, the zImage entry code passes a copy of the stack pointer to the
start()function. There's no real reason for this; the only thingstart()does with it is print it out. It appears to be a leftover debugging hack, so, this patch removes it.Signed-off-by David Gibson <[email protected]>NACK.
It helps to determine the firmware memory layout.
How, why is that useful, and where is that ever used?
josh
Quoted 1 line · Josh Boyer
How, why is that useful, and where is that ever used?
prom_init runs with the stack passed from the firmware (unless that changed in since 2.6.13). Its better to know where the stack is when looking at early boot bugreports.