Author: hailfinger Date: 2007-12-03 21:41:02 +0100 (Mon, 03 Dec 2007) New Revision: 535
Added: LinuxBIOSv3/mainboard/emulation/qemu-x86/initram_printktest.c Modified: LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c Log: Ron mentioned he had strange hangs in pll_reset on various targets. This may be due to miscompilation of XIP objects which do not have _MAINBOBJECT defined. This issue was impossible to see on qemu because no such object existed. Introduce initram_printktest.c in the Qemu target, which will test for miscompilation and crash with a descriptive error message.
This has been build tested and runtime tested on Qemu, and with my compiler/linker combination it indeed crashes. gcc (GCC) 4.2.1 (SUSE Linux) GNU ld (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux)
Trying with gcc-4.1 (GCC) 4.1.3 20070724 (prerelease) (SUSE Linux) and the linker above had exactly the same results.
Unless we manage to fix the bug uncovered by this patch, leaving the Qemu target in crashing state is the best thing we can do because this behaviour mirrors the state of all other targets.
Ron says: I am comfortable with this. If hardware is broken, qemu should be broken. I avidly wait the fix :-)
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Ronald G. Minnich rminnich@gmail.com
Modified: LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile =================================================================== --- LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile 2007-12-03 20:32:53 UTC (rev 534) +++ LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile 2007-12-03 20:41:02 UTC (rev 535) @@ -28,7 +28,8 @@ # directory and is built from what was auto.c in v2. #
-INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o +INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o \ + $(obj)/mainboard/$(MAINBOARDDIR)/initram_printktest.o
STAGE2_MAINBOARD_OBJ = vga.o
Modified: LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c =================================================================== --- LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c 2007-12-03 20:32:53 UTC (rev 534) +++ LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c 2007-12-03 20:41:02 UTC (rev 535) @@ -2,6 +2,7 @@ * This file is part of the LinuxBIOS project. * * Copyright (C) 2007 Stefan Reinauer stepan@coresystems.de + * Copyright (C) 2007 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +22,8 @@
#include <console.h>
+int printktest(void); + /* printktest1() is here to increase the likelihood of main() not ending up at * the beginning of the file, so we can check whether the entry point at main() * was honored. @@ -39,6 +42,9 @@ printk(BIOS_INFO, "RAM init code started.\n"); printk(BIOS_INFO, "Nothing to do.\n"); printktest1(); + printk(BIOS_INFO, "Trying absolute call from non-_MAINOBJECT XIP code.\n"); + printktest(); + printk(BIOS_INFO, "Done.\n");
return 0; }
Added: LinuxBIOSv3/mainboard/emulation/qemu-x86/initram_printktest.c =================================================================== --- LinuxBIOSv3/mainboard/emulation/qemu-x86/initram_printktest.c (rev 0) +++ LinuxBIOSv3/mainboard/emulation/qemu-x86/initram_printktest.c 2007-12-03 20:41:02 UTC (rev 535) @@ -0,0 +1,31 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 Carl-Daniel Hailfinger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <console.h> + +int printktest(void) +{ + /* If printk succeeds, it will print the message below. This is not a + * success message after a test, but a success message used as test. + * In case of compiler/linker bugs the printk call is likely to crash. + */ + printk(BIOS_INFO, "Absolute call successful.\n"); + + return 0; +}