Re: Kernel built with new GCC panics immediately

From: Bruce Evans <bde_at_zeta.org.au>
Date: Sat, 12 Jul 2003 07:37:25 +1000 (EST)
On Fri, 11 Jul 2003, Don Lewis wrote:

> On 11 Jul, Shizuka Kudo wrote:
> >
> > --- Lukas Ertl <l.ertl_at_univie.ac.at> wrote:
> >> Hi there,
> >>
> >> just wanted to report that a kernel built with the new gcc panics
> >> immediately when booting. I've seen this on two machines. Panic and reboot
> >> happens fast that I couldn't get the panic message.
> >
> > Same here for an AMD Athlon & a Pentium III. The panic message for AMD is:
> >

[Trailing whitespace removed]

> > Copyright (c) 1992-2003 The FreeBSD Project.
> > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
> >         The Regents of the University of California. All rights reserved.
> > FreeBSD 5.1-CURRENT #20030712: Sat Jul 12 01:35:44 HKT 2003
> >     root_at_shizuka.gundumv.com:/usr/obj/usr/src/sys/SHIZUKA
> > Preloaded elf kernel "/boot/kernel/kernel" at 0xc058a000.
> > Preloaded elf module "/boot/kernel/acpi.ko" at 0xc058a1f4.
> > Timecounter "i8254"  frequency 1193182 Hz
> > CPU: AMD Unknown (286-class CPU)
>                     ^^^
> That's quite a downgrade ;-)
>
> This smells like a problem in either printcpuinfo(), lowcore.s, or the
> interface between them.
>
> >   Origin = "AuthenticAMD"  Stepping = 0
> > panic: CPU class not configured
> > Debugger("panic")

Try compiling with cc -no-zero-initialized-in-bss.

gcc now puts zero-initialized variables in the bss by default, so an old
bug in locore.s probably just became fatal.  From locore.s:

% 	call	identify_cpu

This sets some variables (in particular, `cpu') which are now mostly in
the bss.

%
% /* clear bss */
% /*
%  * XXX this should be done a little earlier.
%  *
%  * XXX we don't check that there is memory for our bss and page tables
%  * before using it.
%  *
%  * XXX the boot program somewhat bogusly clears the bss.  We still have
%  * to do it in case we were unzipped by kzipboot.  Then the boot program
%  * only clears kzipboot's bss.
%  *
%  * XXX the gdt and idt are still somewhere in the boot program.  We
%  * depend on the convention that the boot program is below 1MB and we
%  * are above 1MB to keep the gdt and idt away from the bss and page
%  * tables.
%  */
% 	movl	$R(end),%ecx
% 	movl	$R(edata),%edi
% 	subl	%edi,%ecx
% 	xorl	%eax,%eax
% 	cld
% 	rep
% 	stosb

This clobbers any bss variables set by identify_cpu.

Bruce
Received on Fri Jul 11 2003 - 12:37:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:14 UTC