linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Don't pass the stack pointer to zImage's start() function
@ 2007-03-15  4:29 David Gibson
  2007-03-15  4:35 ` Tony Breeds
  2007-03-16 18:37 ` Olaf Hering
  0 siblings, 2 replies; 6+ messages in thread
From: David Gibson @ 2007-03-15  4:29 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

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.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---

As requested, a cleanup for this wart.  Please apply.

Index: working-2.6/arch/powerpc/boot/crt0.S
===================================================================
--- working-2.6.orig/arch/powerpc/boot/crt0.S	2007-03-15 14:04:14.000000000 +1100
+++ working-2.6/arch/powerpc/boot/crt0.S	2007-03-15 14:04:23.000000000 +1100
@@ -86,5 +86,4 @@ _zimage_start:
 	bl	platform_init
 
 	/* Call start */
-	mr	r3,r1
 	b	start
Index: working-2.6/arch/powerpc/boot/main.c
===================================================================
--- working-2.6.orig/arch/powerpc/boot/main.c	2007-03-15 14:03:09.000000000 +1100
+++ working-2.6/arch/powerpc/boot/main.c	2007-03-15 14:07:05.000000000 +1100
@@ -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,
Index: working-2.6/arch/powerpc/boot/ops.h
===================================================================
--- working-2.6.orig/arch/powerpc/boot/ops.h	2007-03-15 14:07:13.000000000 +1100
+++ working-2.6/arch/powerpc/boot/ops.h	2007-03-15 14:07:17.000000000 +1100
@@ -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);

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Don't pass the stack pointer to zImage's start() function
  2007-03-15  4:29 Don't pass the stack pointer to zImage's start() function David Gibson
@ 2007-03-15  4:35 ` Tony Breeds
  2007-03-15  5:18   ` David Gibson
  2007-03-16 18:37 ` Olaf Hering
  1 sibling, 1 reply; 6+ messages in thread
From: Tony Breeds @ 2007-03-15  4:35 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev

On Thu, Mar 15, 2007 at 03:29:04PM +1100, David Gibson wrote:
> 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.

<snip>

> --- working-2.6.orig/arch/powerpc/boot/main.c	2007-03-15 14:03:09.000000000 +1100
> +++ working-2.6/arch/powerpc/boot/main.c	2007-03-15 14:07:05.000000000 +1100
> @@ -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);

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!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Don't pass the stack pointer to zImage's start() function
  2007-03-15  4:35 ` Tony Breeds
@ 2007-03-15  5:18   ` David Gibson
  0 siblings, 0 replies; 6+ messages in thread
From: David Gibson @ 2007-03-15  5:18 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev

On Thu, Mar 15, 2007 at 03:35:46PM +1100, Tony Breeds wrote:
> On Thu, Mar 15, 2007 at 03:29:04PM +1100, David Gibson wrote:
> > 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.
> 
> <snip>
> 
> > --- working-2.6.orig/arch/powerpc/boot/main.c	2007-03-15 14:03:09.000000000 +1100
> > +++ working-2.6/arch/powerpc/boot/main.c	2007-03-15 14:07:05.000000000 +1100
> > @@ -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);
> 
> Shouldn't that be:
> 
> +	printf("\n\rzImage starting: loaded at 0x%p\n\r", _start);
> 
> or similar?

Crap, yes, I suck.

Fixed version coming, plus a patch to turn on gcc printf format
warnings for the zImage.

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Don't pass the stack pointer to zImage's start() function
  2007-03-15  4:29 Don't pass the stack pointer to zImage's start() function David Gibson
  2007-03-15  4:35 ` Tony Breeds
@ 2007-03-16 18:37 ` Olaf Hering
  2007-03-16 19:26   ` Josh Boyer
  1 sibling, 1 reply; 6+ messages in thread
From: Olaf Hering @ 2007-03-16 18:37 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev

On Thu, Mar 15, David Gibson wrote:

> 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.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

NACK.
It helps to determine the firmware memory layout.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Don't pass the stack pointer to zImage's start() function
  2007-03-16 18:37 ` Olaf Hering
@ 2007-03-16 19:26   ` Josh Boyer
  2007-03-16 20:04     ` Olaf Hering
  0 siblings, 1 reply; 6+ messages in thread
From: Josh Boyer @ 2007-03-16 19:26 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev, Paul Mackerras

On Fri, 2007-03-16 at 19:37 +0100, Olaf Hering wrote:
> On Thu, Mar 15, David Gibson wrote:
> 
> > 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.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> 
> NACK.
> It helps to determine the firmware memory layout.

How, why is that useful, and where is that ever used?

josh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Don't pass the stack pointer to zImage's start() function
  2007-03-16 19:26   ` Josh Boyer
@ 2007-03-16 20:04     ` Olaf Hering
  0 siblings, 0 replies; 6+ messages in thread
From: Olaf Hering @ 2007-03-16 20:04 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, Paul Mackerras

On Fri, Mar 16, Josh Boyer wrote:

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-16 20:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-15  4:29 Don't pass the stack pointer to zImage's start() function David Gibson
2007-03-15  4:35 ` Tony Breeds
2007-03-15  5:18   ` David Gibson
2007-03-16 18:37 ` Olaf Hering
2007-03-16 19:26   ` Josh Boyer
2007-03-16 20:04     ` Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).