grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix startup bss cleaning
@ 2013-07-15 19:12 Paulo Flabiano Smorigo/Brazil/IBM
  2013-07-16  5:47 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 2+ messages in thread
From: Paulo Flabiano Smorigo/Brazil/IBM @ 2013-07-15 19:12 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 2328 bytes --]

Hi,

The trunk version of GRUB is crashing on power machines. Openfirmware  
returns the following message:
Welcome to GRUB!

DEFAULT CATCH!, exception-handler=fff00700
at   %SRR0: 0000000000003940   %SRR1: 0000000000083002
Open Firmware exception handler entered from non-OF code

Client's Fix Pt Regs:
  00 000000000020a074 0000000001a3ff40 0000000000000000 00000000001e3de0
  04 00000000001e3eb0 0000000000000004 00000000001d1fd0 000000000000007c
  08 0000000000004000 0000000000003940 00000000001d4810 0000000001a3ff40
  0c 0000000040000084 0000000000000000 0000000000000000 0000000000000000
  10 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  14 0000000000c00000 0000000000000008 0000000000000000 0000000000000000
  18 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  1c 0000000000219620 00000000001e3eb0 0000000000219620 00000000001e3de0
Special Regs:
     %IV: 00000700     %CR: 20000084    %XER: 00000000  %DSISR: 00000000
   %SRR0: 0000000000003940   %SRR1: 0000000000083002
     %LR: 000000000020a0a4    %CTR: 0000000000003940
    %DAR: 0000000000000000
Virtual PID = 0
  ok
0 >

After some investigation, my colleague Gustavo Duarte discover that  
the problem is caused by grub_file_filters_enabled. Its initial value  
isn't zero:
grub_file_filters_enabled[0]@0x219614 0x0
grub_file_filters_enabled[1]@0x219618 0x0
grub_file_filters_enabled[2]@0x21961c 0x0
grub_file_filters_enabled[3]@0x219620 0x3940


Using objdump I noticed that this variable is the last one from the  
bss section:
$objdump -t grub-core/kernel.exec | sort
...
00218d14 l     O .bss   00000004 count.2347
00218d18 l     O .bss   00000100 buf.1909
00218e18 l     O .bss   00000100 linebuf
00218f18 g     O .bss   00000100 grub_errmsg
00219018 g     O .bss   00000010 grub_file_filters_all
00219028 g     O .bss   00000010 grub_file_filters_enabled
00219038 g       .bss   00000000 _end

It seems that startup.S for powerpc skips the last bytes, so I made a  
patch to fix it. Tried again and the problem was gone:
grub_file_filters_enabled[0]@0x219614 0x0
grub_file_filters_enabled[1]@0x219618 0x0
grub_file_filters_enabled[2]@0x21961c 0x0
grub_file_filters_enabled[3]@0x219620 0x0



Best regards!
-- 
Paulo Flabiano Smorigo
Software Engineer
Linux Technology Center - IBM Systems & Technology Group

[-- Attachment #2: grub_ppc_fix_bss_cleanup.patch --]
[-- Type: text/x-patch, Size: 971 bytes --]

=== modified file 'ChangeLog'
--- ChangeLog	2013-07-14 21:10:27 +0000
+++ ChangeLog	2013-07-15 19:04:03 +0000
@@ -1,3 +1,6 @@
+2013-07-15  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
+	* grub-core/kern/powerpc/ieee1275/startup.S: Fix bss clean up.
+
 2013-07-14  Vladimir Testov <vladimir.testov@rosalab.ru>
 
 	* grub-core/gfxmenu/gui_list.c: USe viewport when drawing strings.

=== modified file 'grub-core/kern/powerpc/ieee1275/startup.S'
--- grub-core/kern/powerpc/ieee1275/startup.S	2011-10-18 13:21:51 +0000
+++ grub-core/kern/powerpc/ieee1275/startup.S	2013-07-15 18:59:29 +0000
@@ -32,10 +32,10 @@
 	li      13, 0
 
 	/* Stage1 won't zero BSS for us. In other cases, why not do it again?  */
-	lis	6, (__bss_start - 4)@h
-	ori	6, 6, (__bss_start - 4)@l
-	lis	7, (_end - 4)@h
-	ori	7, 7, (_end - 4)@l
+	lis	6, __bss_start@h
+	ori	6, 6, __bss_start@l
+	lis	7, _end@h
+	ori	7, 7, _end@l
 	subf	7, 6, 7
 	srwi	7, 7, 2 /* We store 4 bytes at a time.  */
 	mtctr	7


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

* Re: [PATCH] powerpc: fix startup bss cleaning
  2013-07-15 19:12 [PATCH] powerpc: fix startup bss cleaning Paulo Flabiano Smorigo/Brazil/IBM
@ 2013-07-16  5:47 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-07-16  5:47 UTC (permalink / raw)
  To: The development of GNU GRUB

On 15.07.2013 21:12, Paulo Flabiano Smorigo/Brazil/IBM wrote:
> Hi,
>
> The trunk version of GRUB is crashing on power machines. Openfirmware
> returns the following message:
> Welcome to GRUB!
>
> DEFAULT CATCH!, exception-handler=fff00700
> at   %SRR0: 0000000000003940   %SRR1: 0000000000083002
> Open Firmware exception handler entered from non-OF code
>
> Client's Fix Pt Regs:
>   00 000000000020a074 0000000001a3ff40 0000000000000000 00000000001e3de0
>   04 00000000001e3eb0 0000000000000004 00000000001d1fd0 000000000000007c
>   08 0000000000004000 0000000000003940 00000000001d4810 0000000001a3ff40
>   0c 0000000040000084 0000000000000000 0000000000000000 0000000000000000
>   10 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>   14 0000000000c00000 0000000000000008 0000000000000000 0000000000000000
>   18 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>   1c 0000000000219620 00000000001e3eb0 0000000000219620 00000000001e3de0
> Special Regs:
>      %IV: 00000700     %CR: 20000084    %XER: 00000000  %DSISR: 00000000
>    %SRR0: 0000000000003940   %SRR1: 0000000000083002
>      %LR: 000000000020a0a4    %CTR: 0000000000003940
>     %DAR: 0000000000000000
> Virtual PID = 0
>   ok
> 0 >
>
> After some investigation, my colleague Gustavo Duarte discover that the
> problem is caused by grub_file_filters_enabled. Its initial value isn't
> zero:
> grub_file_filters_enabled[0]@0x219614 0x0
> grub_file_filters_enabled[1]@0x219618 0x0
> grub_file_filters_enabled[2]@0x21961c 0x0
> grub_file_filters_enabled[3]@0x219620 0x3940
>
>
> Using objdump I noticed that this variable is the last one from the bss
> section:
> $objdump -t grub-core/kernel.exec | sort
> ...
> 00218d14 l     O .bss   00000004 count.2347
> 00218d18 l     O .bss   00000100 buf.1909
> 00218e18 l     O .bss   00000100 linebuf
> 00218f18 g     O .bss   00000100 grub_errmsg
> 00219018 g     O .bss   00000010 grub_file_filters_all
> 00219028 g     O .bss   00000010 grub_file_filters_enabled
> 00219038 g       .bss   00000000 _end
>
> It seems that startup.S for powerpc skips the last bytes, so I made a
> patch to fix it. Tried again and the problem was gone:
> grub_file_filters_enabled[0]@0x219614 0x0
> grub_file_filters_enabled[1]@0x219618 0x0
> grub_file_filters_enabled[2]@0x21961c 0x0
> grub_file_filters_enabled[3]@0x219620 0x0
>
As discussed on IRC this patch was wrong. The real problem was handling 
unaligned BSS. Fixed in trunk now.
>
>
> Best regards!
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>



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

end of thread, other threads:[~2013-07-16  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 19:12 [PATCH] powerpc: fix startup bss cleaning Paulo Flabiano Smorigo/Brazil/IBM
2013-07-16  5:47 ` Vladimir 'φ-coder/phcoder' Serbinenko

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