OpenBIOS
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1994 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1993 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1992 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1991 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1990 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1989 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1988 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1987 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1986 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1985 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1984 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1983 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1982 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1981 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1980 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1979 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1978 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1977 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1976 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1975 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1974 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1973 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1972 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1971 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1970 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1969 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1968 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1967 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1966 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1965 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1964 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1963 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1962 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1961 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1960 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1959 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1958 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1957 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1956 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1955 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1954 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1953 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1952 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1951 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1950 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1949 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1948 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1947 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1946 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1945 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1944 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1943 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1942 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1941 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1940 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1939 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1938 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1937 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1936 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1935 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1934 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1933 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1932 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1931 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1930 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1929 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1928 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1927 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1926 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1925 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1924 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1923 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1922 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1921 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1920 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1919 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1918 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1917 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1916 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1915 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1914 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1913 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1912 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1911 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1910 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1909 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1908 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1907 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1906 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1905 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1904 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
March 2010
- 11 participants
- 56 discussions
[commit] r717 - in trunk/openbios-devel: arch/sparc32 arch/sparc64 arch/x86 config/examples libopenbios packages
by repository service March 28, 2010
by repository service March 28, 2010
March 28, 2010
Author: mcayland
Date: Sun Mar 28 22:18:30 2010
New Revision: 717
URL: http://tracker.coreboot.org/trac/openbios/changeset/717
Log:
Introduce a set of CONFIG_LOADER_* configuration options to allow each architecture to specify the loaders that are to be used.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
Modified:
trunk/openbios-devel/arch/sparc32/boot.c
trunk/openbios-devel/arch/sparc64/boot.c
trunk/openbios-devel/arch/x86/boot.c
trunk/openbios-devel/config/examples/amd64_config.xml
trunk/openbios-devel/config/examples/cross-ppc_config.xml
trunk/openbios-devel/config/examples/cross-sparc32_config.xml
trunk/openbios-devel/config/examples/cross-sparc64_config.xml
trunk/openbios-devel/config/examples/cross-x86_config.xml
trunk/openbios-devel/config/examples/ppc_config.xml
trunk/openbios-devel/config/examples/sparc32_config.xml
trunk/openbios-devel/config/examples/sparc64_config.xml
trunk/openbios-devel/config/examples/x86_config.xml
trunk/openbios-devel/libopenbios/build.xml
trunk/openbios-devel/packages/build.xml
trunk/openbios-devel/packages/elf-loader.c
trunk/openbios-devel/packages/init.c
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/arch/sparc32/boot.c Sun Mar 28 22:18:30 2010 (r717)
@@ -11,6 +11,8 @@
#include "libopenbios/sys_info.h"
#include "libopenbios/elf_load.h"
#include "libopenbios/aout_load.h"
+#include "libopenbios/fcode_load.h"
+#include "libopenbios/forth_load.h"
#include "openprom.h"
#include "boot.h"
@@ -33,22 +35,44 @@
bootpath = pop_fstr_copy();
printk("Trying %s (%s)\n", path, bootpath);
+#ifdef CONFIG_LOADER_ELF
/* ELF Boot loader */
elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
/* Linux loader (not using Forth) */
linux_load(&sys_info, path, param);
+#ifdef CONFIG_LOADER_AOUT
/* a.out loader */
aout_load(&sys_info, path);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
+
+#ifdef CONFIG_LOADER_FCODE
+ /* Fcode loader */
+ fcode_load(path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+#endif
+
+#ifdef CONFIG_LOADER_FORTH
+ /* Forth loader */
+ forth_load(path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+#endif
return 0;
@@ -78,6 +102,23 @@
image_retval = entry(romvec, 0, 0, 0, 0);
break;
+
+ case 0x10:
+ /* Start Fcode image */
+ printk("Evaluating FCode...\n");
+ PUSH(address);
+ PUSH(1);
+ fword("byte-load");
+ image_retval = 0;
+ break;
+
+ case 0x11:
+ /* Start Forth image */
+ PUSH(address);
+ PUSH(size);
+ fword("eval2");
+ image_retval = 0;
+ break;
}
printk("Image returned with return value %#x\n", image_retval);
Modified: trunk/openbios-devel/arch/sparc64/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.c Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/arch/sparc64/boot.c Sun Mar 28 22:18:30 2010 (r717)
@@ -11,6 +11,7 @@
#include "libopenbios/elf_load.h"
#include "libopenbios/aout_load.h"
#include "libopenbios/fcode_load.h"
+#include "libopenbios/forth_load.h"
#include "boot.h"
struct sys_info sys_info;
@@ -28,29 +29,44 @@
ucell valid, address, type, size;
int image_retval = 0;
+#ifdef CONFIG_LOADER_ELF
/* ELF Boot loader */
elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
/* Linux loader (not using Forth) */
linux_load(&sys_info, path, param);
+#ifdef CONFIG_LOADER_AOUT
/* a.out loader */
aout_load(&sys_info, path);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
+#ifdef CONFIG_LOADER_FCODE
/* Fcode loader */
fcode_load(path);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
+
+#ifdef CONFIG_LOADER_FORTH
+ /* Forth loader */
+ forth_load(path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+#endif
return 0;
@@ -85,6 +101,14 @@
fword("byte-load");
image_retval = 0;
break;
+
+ case 0x11:
+ /* Start Forth image */
+ PUSH(address);
+ PUSH(size);
+ fword("eval2");
+ image_retval = 0;
+ break;
}
printk("Image returned with return value %#x\n", image_retval);
Modified: trunk/openbios-devel/arch/x86/boot.c
==============================================================================
--- trunk/openbios-devel/arch/x86/boot.c Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/arch/x86/boot.c Sun Mar 28 22:18:30 2010 (r717)
@@ -13,6 +13,8 @@
#include "libc/diskio.h"
#include "libopenbios/sys_info.h"
#include "libopenbios/elf_load.h"
+#include "libopenbios/aout_load.h"
+#include "libopenbios/fcode_load.h"
#include "libopenbios/forth_load.h"
#include "boot.h"
@@ -24,22 +26,44 @@
ucell valid, address, type, size;
int image_retval = 0;;
+#ifdef CONFIG_LOADER_ELF
/* ELF Boot loader */
elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
/* Linux loader (not using Forth) */
linux_load(&sys_info, path, param);
+#ifdef CONFIG_LOADER_AOUT
+ /* a.out loader */
+ aout_load(&sys_info, path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+#endif
+
+#ifdef CONFIG_LOADER_FCODE
+ /* Fcode loader */
+ fcode_load(path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+#endif
+
+#ifdef CONFIG_LOADER_FORTH
/* Forth loader */
forth_load(path);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
+#endif
return 0;
@@ -61,6 +85,20 @@
image_retval = start_elf(address, (uint32_t)NULL);
break;
+ case 0x5:
+ /* Start a.out image */
+ image_retval = start_elf(address, (uint32_t)NULL);
+ break;
+
+ case 0x10:
+ /* Start Fcode image */
+ printk("Evaluating FCode...\n");
+ PUSH(address);
+ PUSH(1);
+ fword("byte-load");
+ image_retval = 0;
+ break;
+
case 0x11:
/* Start Forth image */
PUSH(address);
Modified: trunk/openbios-devel/config/examples/amd64_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/amd64_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/amd64_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -35,6 +35,11 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/cross-ppc_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/cross-ppc_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/cross-ppc_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -40,6 +40,11 @@
<option name="CONFIG_VGA_WIDTH" type="integer" value="800"/>
<option name="CONFIG_VGA_HEIGHT" type="integer" value="600"/>
<option name="CONFIG_VGA_DEPTH" type="integer" value="8"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="true"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/cross-sparc32_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/cross-sparc32_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/cross-sparc32_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -41,6 +41,11 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/cross-sparc64_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/cross-sparc64_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/cross-sparc64_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -41,6 +41,11 @@
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
<option name="CONFIG_OFMEM" type="boolean" value="true"/>
<option name="CONFIG_OFMEM_MALLOC_ALIGN" type="integer" value="8"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/cross-x86_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/cross-x86_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/cross-x86_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -36,6 +36,11 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/ppc_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/ppc_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/ppc_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -40,7 +40,11 @@
<option name="CONFIG_VGA_WIDTH" type="integer" value="800"/>
<option name="CONFIG_VGA_HEIGHT" type="integer" value="600"/>
<option name="CONFIG_VGA_DEPTH" type="integer" value="8"/>
-
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="true"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/sparc32_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/sparc32_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/sparc32_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -41,6 +41,11 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/sparc64_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/sparc64_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/sparc64_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -41,6 +41,11 @@
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
<option name="CONFIG_OFMEM" type="boolean" value="true"/>
<option name="CONFIG_OFMEM_MALLOC_ALIGN" type="integer" value="8"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/x86_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/x86_config.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/config/examples/x86_config.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -36,6 +36,11 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_AOUT" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_FCODE" type="boolean" value="false"/>
+ <option name="CONFIG_LOADER_FORTH" type="boolean" value="true"/>
+ <option name="CONFIG_LOADER_XCOFF" type="boolean" value="false"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/libopenbios/build.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -1,24 +1,16 @@
<build>
<library name="openbios" type="static" target="target">
- <object source="aout_load.c" condition="SPARC32"/>
- <object source="aout_load.c" condition="SPARC64"/>
+ <object source="aout_load.c" condition="LOADER_AOUT"/>
<object source="bindings.c"/>
<object source="client.c"/>
<object source="console_common.c"/>
- <object source="elf_info.c" condition="X86"/>
- <object source="elf_info.c" condition="AMD64"/>
- <object source="elf_info.c" condition="SPARC32"/>
- <object source="elf_info.c" condition="SPARC64"/>
- <object source="elf_info.c" condition="PPC"/>
- <object source="elf_load.c" condition="X86"/>
- <object source="elf_load.c" condition="SPARC32"/>
- <object source="elf_load.c" condition="SPARC64"/>
- <object source="elf_load.c" condition="AMD64"/>
+ <object source="elf_info.c" />
+ <object source="elf_load.c" condition="LOADER_ELF"/>
<object source="font_8x8.c" condition="FONT_8X8"/>
<object source="font_8x16.c" condition="FONT_8X16"/>
- <object source="fcode_load.c" condition="SPARC64"/>
- <object source="forth_load.c" condition="X86"/>
+ <object source="fcode_load.c" condition="LOADER_FCODE"/>
+ <object source="forth_load.c" condition="LOADER_FORTH"/>
<object source="ipchecksum.c"/>
<object source="linuxbios_info.c" condition="LINUXBIOS"/>
<object source="ofmem_common.c" condition="OFMEM"/>
Modified: trunk/openbios-devel/packages/build.xml
==============================================================================
--- trunk/openbios-devel/packages/build.xml Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/packages/build.xml Sun Mar 28 22:18:30 2010 (r717)
@@ -5,8 +5,7 @@
<object source="cmdline.c" condition="CMDLINE"/>
<object source="deblocker.c" condition="DEBLOCKER"/>
<object source="disk-label.c" condition="DISK_LABEL"/>
- <object source="elf-loader.c" condition="PPC"/>
- <object source="elf-loader.c" condition="SPARC64"/>
+ <object source="elf-loader.c" condition="LOADER_ELF"/>
<object source="init.c"/>
<object source="mac-parts.c" condition="MAC_PARTS"/>
<object source="misc-files.c" condition="FS"/>
@@ -14,7 +13,7 @@
<object source="pc-parts.c" condition="PC_PARTS"/>
<object source="sun-parts.c" condition="SUN_PARTS"/>
<object source="video.c"/>
- <object source="xcoff-loader.c" condition="PPC"/>
+ <object source="xcoff-loader.c" condition="LOADER_XCOFF"/>
</library>
<dictionary name="openbios" target="forth">
Modified: trunk/openbios-devel/packages/elf-loader.c
==============================================================================
--- trunk/openbios-devel/packages/elf-loader.c Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/packages/elf-loader.c Sun Mar 28 22:18:30 2010 (r717)
@@ -49,6 +49,7 @@
Elf_phdr *phdr;
size_t size;
char *addr;
+ cell tmp;
feval("0 state-valid !");
@@ -67,11 +68,16 @@
size = MIN(phdr[i].p_filesz, phdr[i].p_memsz);
if (!size)
continue;
+#if 0
if( ofmem_claim( phdr[i].p_vaddr, phdr[i].p_memsz, 0 ) == -1 ) {
printk("Claim failed!\n");
return;
}
- addr = (char*)phdr[i].p_vaddr;
+#endif
+ /* Workaround for archs where sizeof(int) != pointer size */
+ tmp = phdr[i].p_vaddr;
+ addr = (char *)tmp;
+
memcpy(addr, base + phdr[i].p_offset, size);
#ifdef CONFIG_PPC
flush_icache_range( addr, addr + size );
Modified: trunk/openbios-devel/packages/init.c
==============================================================================
--- trunk/openbios-devel/packages/init.c Sat Mar 27 14:20:54 2010 (r716)
+++ trunk/openbios-devel/packages/init.c Sun Mar 28 22:18:30 2010 (r717)
@@ -42,12 +42,14 @@
#ifdef CONFIG_SUN_PARTS
sunparts_init();
#endif
-#ifdef CONFIG_PPC
- elf_loader_init();
+#ifdef CONFIG_LOADER_XCOFF
xcoff_loader_init();
- bootinfo_loader_init();
#endif
-#ifdef CONFIG_SPARC64
+#ifdef CONFIG_LOADER_ELF
elf_loader_init();
#endif
+#ifdef CONFIG_PPC
+ bootinfo_loader_init();
+#endif
+
}
1
0
Hi all,
Now that I've finished moving the various loaders into libopenbios, I'd
like to set out my plans for the next stage of work. My ultimate aim is
to enable various loaders to be enabled as defined within the main
configuration XML files and to have these work automatically with the
load and go words.
I've broken down my plan into a number of steps below:
i) Define configuration variables for each of the loaders, e.g.
CONFIG_LOADER_ELF, CONFIG_LOADER_AOUT etc. and use these within the
configuration files for the relevant platforms. Note: I see there is
already a CONFIG_IMAGE_ELF option available - should I be using this
instead or is strictly for embedding ELF kernels?
ii) Refactor the existing loaders so that they contain a is_foo(addr)
function for determining whether the specified address contains an image
in the correct format.
iii) Add a foo_init_program() function to each of the loader files that
can be called by init-program to relocate the executable image.
iv) Remove the majority of the Forth code in forth/debugging/client.fs
so that the is_foo(addr) series of functions can be reused from C
instead. Hence write a C version of init-program called (init-program)
that can be called from Forth to do the majority of the work.
v) Rework the boot word so it looks something like:
:boot <path>
load <path>
go
In other words, move the existing platform-boot code into an
implementation of go (or (go)) so that it can be re-used. Oh, and with
all this in place I can try booting a Milax Solaris kernel ;)
Does this sound like a reasonable plan to everyone? If so, I'd like to
start work on the next set of changes.
ATB,
Mark.
--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
Sirius Labs: http://www.siriusit.co.uk/labs
2
1
March 27, 2010
Author: blueswirl
Date: Sat Mar 27 14:20:54 2010
New Revision: 716
URL: http://tracker.coreboot.org/trac/openbios/changeset/716
Log:
Fix linker warning
There were two global symbols named 'entry':
LINK openbios-builtin.elf
libsparc32.a(entry.o): warning: definition of `entry' overriding common
libsparc32.a(boot.o): warning: common is here
Add 'static' to hide the boot.c one.
Signed-off-by: Blue Swirl <blauwirbel(a)gmail.com>
Modified:
trunk/openbios-devel/arch/sparc32/boot.c
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Sat Mar 27 14:20:52 2010 (r715)
+++ trunk/openbios-devel/arch/sparc32/boot.c Sat Mar 27 14:20:54 2010 (r716)
@@ -20,7 +20,7 @@
uint32_t qemu_cmdline;
uint32_t cmdline_size;
char boot_device;
-int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
+static int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
static int try_path(const char *path, char *param, const void *romvec)
{
1
0
March 27, 2010
Author: blueswirl
Date: Sat Mar 27 14:20:52 2010
New Revision: 715
URL: http://tracker.coreboot.org/trac/openbios/changeset/715
Log:
Add missing newlines
Fixes build:
In file included from ../arch/sparc64/boot.c:12:
../include/libopenbios/aout_load.h:24:27: error: no newline at end of file
In file included from ../arch/sparc64/boot.c:13:
../include/libopenbios/fcode_load.h:22:28: error: no newline at end of file
Signed-off-by: Blue Swirl <blauwirbel(a)gmail.com>
Modified:
trunk/openbios-devel/include/libopenbios/aout_load.h
trunk/openbios-devel/include/libopenbios/fcode_load.h
Modified: trunk/openbios-devel/include/libopenbios/aout_load.h
==============================================================================
--- trunk/openbios-devel/include/libopenbios/aout_load.h Sat Mar 27 13:09:16 2010 (r714)
+++ trunk/openbios-devel/include/libopenbios/aout_load.h Sat Mar 27 14:20:52 2010 (r715)
@@ -21,4 +21,4 @@
extern int aout_load(struct sys_info *info, const char *filename);
-#endif /* _H_AOUTLOAD */
\ No newline at end of file
+#endif /* _H_AOUTLOAD */
Modified: trunk/openbios-devel/include/libopenbios/fcode_load.h
==============================================================================
--- trunk/openbios-devel/include/libopenbios/fcode_load.h Sat Mar 27 13:09:16 2010 (r714)
+++ trunk/openbios-devel/include/libopenbios/fcode_load.h Sat Mar 27 14:20:52 2010 (r715)
@@ -19,4 +19,4 @@
extern int fcode_load(const char *filename);
-#endif /* _H_FCODELOAD */
\ No newline at end of file
+#endif /* _H_FCODELOAD */
1
0
[commit] r714 - in trunk/openbios-devel: arch/sparc64 include/libopenbios libopenbios
by repository service March 27, 2010
by repository service March 27, 2010
March 27, 2010
Author: mcayland
Date: Sat Mar 27 13:09:16 2010
New Revision: 714
URL: http://tracker.coreboot.org/trac/openbios/changeset/714
Log:
Move the Fcode loader from arch/*/fcodeload.c to libopenbios/fcode_load.c.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
Added:
trunk/openbios-devel/include/libopenbios/fcode_load.h
trunk/openbios-devel/libopenbios/fcode_load.c
Deleted:
trunk/openbios-devel/arch/sparc64/fcodeload.c
Modified:
trunk/openbios-devel/arch/sparc64/boot.c
trunk/openbios-devel/arch/sparc64/boot.h
trunk/openbios-devel/arch/sparc64/build.xml
trunk/openbios-devel/libopenbios/build.xml
Modified: trunk/openbios-devel/arch/sparc64/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.c Sat Mar 27 12:59:43 2010 (r713)
+++ trunk/openbios-devel/arch/sparc64/boot.c Sat Mar 27 13:09:16 2010 (r714)
@@ -10,6 +10,7 @@
#include "libopenbios/sys_info.h"
#include "libopenbios/elf_load.h"
#include "libopenbios/aout_load.h"
+#include "libopenbios/fcode_load.h"
#include "boot.h"
struct sys_info sys_info;
Modified: trunk/openbios-devel/arch/sparc64/boot.h
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 12:59:43 2010 (r713)
+++ trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 13:09:16 2010 (r714)
@@ -9,9 +9,6 @@
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
-// fcodeload.c
-int fcode_load(const char *filename);
-
// context.c
extern struct context * volatile __context;
uint64_t start_elf(uint64_t entry_point, uint64_t param);
Modified: trunk/openbios-devel/arch/sparc64/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 12:59:43 2010 (r713)
+++ trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 13:09:16 2010 (r714)
@@ -14,7 +14,6 @@
<object source="switch.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="fcodeload.c"/>
<object source="ofmem_sparc64.c"/>
<object source="entry.S"/>
<object source="vectors.S"/>
Added: trunk/openbios-devel/include/libopenbios/fcode_load.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/include/libopenbios/fcode_load.h Sat Mar 27 13:09:16 2010 (r714)
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <fcode_load.h>
+ *
+ * Fcode loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland(a)siriusit.co.uk)
+ *
+ * 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
+ *
+ */
+
+#ifndef _H_FCODELOAD
+#define _H_FCODELOAD
+
+extern int fcode_load(const char *filename);
+
+#endif /* _H_FCODELOAD */
\ No newline at end of file
Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 12:59:43 2010 (r713)
+++ trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 13:09:16 2010 (r714)
@@ -17,6 +17,7 @@
<object source="elf_load.c" condition="AMD64"/>
<object source="font_8x8.c" condition="FONT_8X8"/>
<object source="font_8x16.c" condition="FONT_8X16"/>
+ <object source="fcode_load.c" condition="SPARC64"/>
<object source="forth_load.c" condition="X86"/>
<object source="ipchecksum.c"/>
<object source="linuxbios_info.c" condition="LINUXBIOS"/>
Added: trunk/openbios-devel/libopenbios/fcode_load.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/libopenbios/fcode_load.c Sat Mar 27 13:09:16 2010 (r714)
@@ -0,0 +1,82 @@
+/*
+ * FCode boot loader
+ */
+
+#include "config.h"
+#include "kernel/kernel.h"
+#include "libopenbios/bindings.h"
+#include "libopenbios/fcode_load.h"
+#include "libopenbios/sys_info.h"
+#include "libc/diskio.h"
+#define printf printk
+#define debug printk
+
+static int fd;
+
+int fcode_load(const char *filename)
+{
+ int retval = -1;
+ uint8_t fcode_header[8];
+ unsigned long start, size;
+ unsigned int offset;
+
+ /* Mark the saved-program-state as invalid */
+ feval("0 state-valid !");
+
+ fd = open_io(filename);
+ if (!fd)
+ goto out;
+
+ for (offset = 0; offset < 16 * 512; offset += 512) {
+ seek_io(fd, offset);
+ if (read_io(fd, &fcode_header, sizeof(fcode_header))
+ != sizeof(fcode_header)) {
+ debug("Can't read FCode header from file %s\n", filename);
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+ }
+ switch (fcode_header[0]) {
+ case 0xf0: // start0
+ case 0xf1: // start1
+ case 0xf2: // start2
+ case 0xf3: // start4
+ case 0xfd: // version1
+ goto found;
+ }
+ }
+
+ debug("Not a bootable FCode image\n");
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+
+ found:
+ size = (fcode_header[4] << 24) | (fcode_header[5] << 16) |
+ (fcode_header[6] << 8) | fcode_header[7];
+
+ start = 0x4000;
+
+ printf("Loading FCode image...\n");
+
+ seek_io(fd, offset + sizeof(fcode_header));
+
+ if ((size_t)read_io(fd, (void *)start, size) != size) {
+ printf("Can't read file (size 0x%lx)\n", size);
+ goto out;
+ }
+
+ debug("Loaded %lu bytes\n", size);
+ debug("entry point is %#lx\n", start);
+
+ // Initialise saved-program-state
+ PUSH(start);
+ feval("saved-program-state >sps.entry !");
+ PUSH(size);
+ feval("saved-program-state >sps.file-size !");
+ feval("fcode saved-program-state >sps.file-type !");
+
+ feval("-1 state-valid !");
+
+out:
+ close_io(fd);
+ return retval;
+}
1
0
[commit] r713 - in trunk/openbios-devel: arch/sparc32 arch/sparc64 config/scripts
by repository service March 27, 2010
by repository service March 27, 2010
March 27, 2010
Author: mcayland
Date: Sat Mar 27 12:59:43 2010
New Revision: 713
URL: http://tracker.coreboot.org/trac/openbios/changeset/713
Log:
Fix a couple of minor omissions (and an incorrect switch-arch alteration) from the previous commit.
Modified:
trunk/openbios-devel/arch/sparc32/boot.h
trunk/openbios-devel/arch/sparc64/boot.h
trunk/openbios-devel/config/scripts/switch-arch
Modified: trunk/openbios-devel/arch/sparc32/boot.h
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.h Sat Mar 27 12:53:59 2010 (r712)
+++ trunk/openbios-devel/arch/sparc32/boot.h Sat Mar 27 12:59:43 2010 (r713)
@@ -6,9 +6,6 @@
* the copyright and warranty status of this work.
*/
-// forthload.c
-int forth_load(const char *filename);
-
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
Modified: trunk/openbios-devel/arch/sparc64/boot.h
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 12:53:59 2010 (r712)
+++ trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 12:59:43 2010 (r713)
@@ -6,9 +6,6 @@
* the copyright and warranty status of this work.
*/
-// forthload.c
-int forth_load(const char *filename);
-
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
Modified: trunk/openbios-devel/config/scripts/switch-arch
==============================================================================
--- trunk/openbios-devel/config/scripts/switch-arch Sat Mar 27 12:53:59 2010 (r712)
+++ trunk/openbios-devel/config/scripts/switch-arch Sat Mar 27 12:59:43 2010 (r713)
@@ -150,8 +150,7 @@
;;
x86)
- #select_prefix i486
- select_prefix x86_64
+ select_prefix i486
CFLAGS="-fno-builtin -m32"
AS_FLAGS="-Wa,-32"
;;
1
0
[commit] r712 - in trunk/openbios-devel: arch/sparc32 arch/sparc64 arch/x86 config/scripts include/libopenbios libopenbios
by repository service March 27, 2010
by repository service March 27, 2010
March 27, 2010
Author: mcayland
Date: Sat Mar 27 12:53:59 2010
New Revision: 712
URL: http://tracker.coreboot.org/trac/openbios/changeset/712
Log:
Move the Forth loader forthload.c from arch/*/forthload.c to libopenbios/forth_load.c. While the Forth loader source was
included and built as part of the SPARC64 and SPARC32 builds, it was never actually invoked in the boot sequence. Hence this
patch maintains the existing behaviour in that only X86 builds included the Forth loader.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
Added:
trunk/openbios-devel/include/libopenbios/forth_load.h
trunk/openbios-devel/libopenbios/forth_load.c
Deleted:
trunk/openbios-devel/arch/sparc32/forthload.c
trunk/openbios-devel/arch/sparc64/forthload.c
trunk/openbios-devel/arch/x86/forthload.c
Modified:
trunk/openbios-devel/arch/sparc32/build.xml
trunk/openbios-devel/arch/sparc64/build.xml
trunk/openbios-devel/arch/x86/boot.c
trunk/openbios-devel/arch/x86/boot.h
trunk/openbios-devel/arch/x86/build.xml
trunk/openbios-devel/config/scripts/switch-arch
trunk/openbios-devel/libopenbios/build.xml
Modified: trunk/openbios-devel/arch/sparc32/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc32/build.xml Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/arch/sparc32/build.xml Sat Mar 27 12:53:59 2010 (r712)
@@ -15,7 +15,6 @@
<object source="udiv.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="forthload.c"/>
<object source="romvec.c"/>
<object source="entry.S"/>
<object source="vectors.S"/>
Modified: trunk/openbios-devel/arch/sparc64/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 12:53:59 2010 (r712)
@@ -14,7 +14,6 @@
<object source="switch.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="forthload.c"/>
<object source="fcodeload.c"/>
<object source="ofmem_sparc64.c"/>
<object source="entry.S"/>
Modified: trunk/openbios-devel/arch/x86/boot.c
==============================================================================
--- trunk/openbios-devel/arch/x86/boot.c Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/arch/x86/boot.c Sat Mar 27 12:53:59 2010 (r712)
@@ -12,17 +12,20 @@
#include "arch/common/nvram.h"
#include "libc/diskio.h"
#include "libopenbios/sys_info.h"
+#include "libopenbios/elf_load.h"
+#include "libopenbios/forth_load.h"
#include "boot.h"
struct sys_info sys_info;
static int try_path(const char *path, char *param)
{
+ void *boot_notes = NULL;
ucell valid, address, type, size;
int image_retval = 0;;
/* ELF Boot loader */
- elf_load(&sys_info, path, param);
+ elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
@@ -32,7 +35,7 @@
linux_load(&sys_info, path, param);
/* Forth loader */
- forth_load(&sys_info, path, param);
+ forth_load(path);
feval("state-valid @");
valid = POP();
if (valid)
Modified: trunk/openbios-devel/arch/x86/boot.h
==============================================================================
--- trunk/openbios-devel/arch/x86/boot.h Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/arch/x86/boot.h Sat Mar 27 12:53:59 2010 (r712)
@@ -6,12 +6,6 @@
* the copyright and warranty status of this work.
*/
-/* forthload.c */
-int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
-
-/* elfload.c */
-int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
-
/* linux_load.c */
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
Modified: trunk/openbios-devel/arch/x86/build.xml
==============================================================================
--- trunk/openbios-devel/arch/x86/build.xml Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/arch/x86/build.xml Sat Mar 27 12:53:59 2010 (r712)
@@ -14,7 +14,6 @@
<object source="linux_load.c"/>
<object source="segment.c"/>
<object source="sys_info.c"/>
- <object source="forthload.c"/>
<object source="entry.S"/>
<object source="xbox/console.c" condition="XBOX"/>
<object source="xbox/methods.c" condition="XBOX"/>
Modified: trunk/openbios-devel/config/scripts/switch-arch
==============================================================================
--- trunk/openbios-devel/config/scripts/switch-arch Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/config/scripts/switch-arch Sat Mar 27 12:53:59 2010 (r712)
@@ -150,7 +150,8 @@
;;
x86)
- select_prefix i486
+ #select_prefix i486
+ select_prefix x86_64
CFLAGS="-fno-builtin -m32"
AS_FLAGS="-Wa,-32"
;;
Added: trunk/openbios-devel/include/libopenbios/forth_load.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/include/libopenbios/forth_load.h Sat Mar 27 12:53:59 2010 (r712)
@@ -0,0 +1,22 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <forth_load.h>
+ *
+ * Forth loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland(a)siriusit.co.uk)
+ *
+ * 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
+ *
+ */
+
+#ifndef _H_FORTHLOAD
+#define _H_FORTHLOAD
+
+extern int forth_load(const char *filename);
+
+#endif /* _H_FORTHLOAD */
\ No newline at end of file
Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 12:30:14 2010 (r711)
+++ trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 12:53:59 2010 (r712)
@@ -17,6 +17,7 @@
<object source="elf_load.c" condition="AMD64"/>
<object source="font_8x8.c" condition="FONT_8X8"/>
<object source="font_8x16.c" condition="FONT_8X16"/>
+ <object source="forth_load.c" condition="X86"/>
<object source="ipchecksum.c"/>
<object source="linuxbios_info.c" condition="LINUXBIOS"/>
<object source="ofmem_common.c" condition="OFMEM"/>
Added: trunk/openbios-devel/libopenbios/forth_load.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/libopenbios/forth_load.c Sat Mar 27 12:53:59 2010 (r712)
@@ -0,0 +1,75 @@
+/* tag: forth source loader
+ *
+ * Copyright (C) 2004 Stefan Reinauer
+ *
+ * See the file "COPYING" for further information about
+ * the copyright and warranty status of this work.
+ */
+
+#include "config.h"
+#include "kernel/kernel.h"
+#include "libopenbios/bindings.h"
+#include "libopenbios/sys_info.h"
+#include "libc/diskio.h"
+#include "libopenbios/forth_load.h"
+#define printk printk
+#define debug printk
+
+static int fd;
+
+static char *forthtext=NULL;
+int forth_load(const char *filename)
+{
+ char magic[2];
+ unsigned long forthsize;
+ int retval = -1;
+
+ /* Mark the saved-program-state as invalid */
+ feval("0 state-valid !");
+
+ fd = open_io(filename);
+ if (!fd)
+ goto out;
+
+ if (read_io(fd, magic, 2) != 2) {
+ debug("Can't read magic header\n");
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+ }
+
+ if (magic[0] != '\\' || magic[1] != ' ') {
+ debug("No forth source image\n");
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+ }
+
+ /* Calculate the file size by seeking to the end of the file */
+ seek_io(fd, -1);
+ forthsize = tell(fd);
+ forthtext = malloc(forthsize+1);
+ seek_io(fd, 0);
+
+ printk("Loading forth source ...");
+ if ((size_t)read_io(fd, forthtext, forthsize) != forthsize) {
+ printk("Can't read forth text\n");
+ goto out;
+ }
+ forthtext[forthsize]=0;
+ printk("ok\n");
+
+ // Initialise saved-program-state
+ PUSH((ucell)forthtext);
+ feval("saved-program-state >sps.entry !");
+ PUSH((ucell)forthsize);
+ feval("saved-program-state >sps.file-size !");
+ feval("forth saved-program-state >sps.file-type !");
+
+ feval("-1 state-valid !");
+
+ retval=0;
+
+out:
+ //if (forthtext)
+ // free(forthtext);
+ return retval;
+}
1
0
[commit] r711 - in trunk/openbios-devel: arch/sparc32 arch/sparc64 include/arch/sparc32 include/arch/sparc64 include/libopenbios libopenbios
by repository service March 27, 2010
by repository service March 27, 2010
March 27, 2010
Author: mcayland
Date: Sat Mar 27 12:30:14 2010
New Revision: 711
URL: http://tracker.coreboot.org/trac/openbios/changeset/711
Log:
Move the a.out loader from arch/*/aoutload.c into libopenbios as aout_load.c.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
Added:
trunk/openbios-devel/include/libopenbios/aout_load.h
trunk/openbios-devel/libopenbios/aout_load.c
Deleted:
trunk/openbios-devel/arch/sparc32/aoutload.c
trunk/openbios-devel/arch/sparc64/aoutload.c
Modified:
trunk/openbios-devel/arch/sparc32/boot.c
trunk/openbios-devel/arch/sparc32/boot.h
trunk/openbios-devel/arch/sparc32/build.xml
trunk/openbios-devel/arch/sparc64/boot.c
trunk/openbios-devel/arch/sparc64/boot.h
trunk/openbios-devel/arch/sparc64/build.xml
trunk/openbios-devel/include/arch/sparc32/types.h
trunk/openbios-devel/include/arch/sparc64/types.h
trunk/openbios-devel/libopenbios/build.xml
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/arch/sparc32/boot.c Sat Mar 27 12:30:14 2010 (r711)
@@ -9,6 +9,8 @@
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "libopenbios/sys_info.h"
+#include "libopenbios/elf_load.h"
+#include "libopenbios/aout_load.h"
#include "openprom.h"
#include "boot.h"
@@ -22,6 +24,7 @@
static int try_path(const char *path, char *param, const void *romvec)
{
+ void *boot_notes = NULL;
ucell valid, address, type, size;
int image_retval = 0;
@@ -31,7 +34,7 @@
printk("Trying %s (%s)\n", path, bootpath);
/* ELF Boot loader */
- elf_load(&sys_info, path, param, romvec);
+ elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
@@ -41,7 +44,7 @@
linux_load(&sys_info, path, param);
/* a.out loader */
- aout_load(&sys_info, path, romvec);
+ aout_load(&sys_info, path);
feval("state-valid @");
valid = POP();
if (valid)
Modified: trunk/openbios-devel/arch/sparc32/boot.h
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.h Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/arch/sparc32/boot.h Sat Mar 27 12:30:14 2010 (r711)
@@ -9,13 +9,6 @@
// forthload.c
int forth_load(const char *filename);
-// elfload.c
-int elf_load(struct sys_info *, const char *filename, const char *cmdline,
- const void *romvec);
-
-// aout_load.c
-int aout_load(struct sys_info *info, const char *filename, const void *romvec);
-
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
Modified: trunk/openbios-devel/arch/sparc32/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc32/build.xml Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/arch/sparc32/build.xml Sat Mar 27 12:30:14 2010 (r711)
@@ -15,7 +15,6 @@
<object source="udiv.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="aoutload.c"/>
<object source="forthload.c"/>
<object source="romvec.c"/>
<object source="entry.S"/>
Modified: trunk/openbios-devel/arch/sparc64/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.c Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/arch/sparc64/boot.c Sat Mar 27 12:30:14 2010 (r711)
@@ -9,6 +9,7 @@
#include "libc/vsprintf.h"
#include "libopenbios/sys_info.h"
#include "libopenbios/elf_load.h"
+#include "libopenbios/aout_load.h"
#include "boot.h"
struct sys_info sys_info;
Modified: trunk/openbios-devel/arch/sparc64/boot.h
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 12:30:14 2010 (r711)
@@ -9,9 +9,6 @@
// forthload.c
int forth_load(const char *filename);
-// aout_load.c
-int aout_load(struct sys_info *info, const char *filename);
-
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
Modified: trunk/openbios-devel/arch/sparc64/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 12:30:14 2010 (r711)
@@ -14,7 +14,6 @@
<object source="switch.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="aoutload.c"/>
<object source="forthload.c"/>
<object source="fcodeload.c"/>
<object source="ofmem_sparc64.c"/>
Modified: trunk/openbios-devel/include/arch/sparc32/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/sparc32/types.h Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/include/arch/sparc32/types.h Sat Mar 27 12:30:14 2010 (r711)
@@ -41,6 +41,8 @@
#define FMT_ucellX "%08X"
#define FMT_elf "%#x"
+#define FMT_sizet "%lx"
+#define FMT_aout_ehdr "%lx"
#define bitspercell (sizeof(cell)<<3)
#define bitsperdcell (sizeof(dcell)<<3)
Modified: trunk/openbios-devel/include/arch/sparc64/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/sparc64/types.h Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/include/arch/sparc64/types.h Sat Mar 27 12:30:14 2010 (r711)
@@ -37,8 +37,8 @@
#define FMT_ucellx "%016llx"
#define FMT_ucellX "%016llX"
-#define FMT_sizet "%lx"
#define FMT_elf "%#llx"
+#define FMT_sizet "%lx"
#define FMT_aout_ehdr "%x"
#ifdef NEED_FAKE_INT128_T
Added: trunk/openbios-devel/include/libopenbios/aout_load.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/include/libopenbios/aout_load.h Sat Mar 27 12:30:14 2010 (r711)
@@ -0,0 +1,24 @@
+/*
+ * Creation Date: <2010/03/22 18:00:00 mcayland>
+ * Time-stamp: <2010/03/22 18:00:00 mcayland>
+ *
+ * <aout_load.h>
+ *
+ * a.out loader
+ *
+ * Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland(a)siriusit.co.uk)
+ *
+ * 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
+ *
+ */
+
+#ifndef _H_AOUTLOAD
+#define _H_AOUTLOAD
+
+#include "libopenbios/sys_info.h"
+
+extern int aout_load(struct sys_info *info, const char *filename);
+
+#endif /* _H_AOUTLOAD */
\ No newline at end of file
Added: trunk/openbios-devel/libopenbios/aout_load.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/libopenbios/aout_load.c Sat Mar 27 12:30:14 2010 (r711)
@@ -0,0 +1,147 @@
+/* a.out boot loader
+ * As we have seek, this implementation can be straightforward.
+ * 2003-07 by SONE Takeshi
+ */
+
+#include "config.h"
+#include "kernel/kernel.h"
+
+#ifdef CONFIG_SPARC64
+#define CONFIG_SPARC64_PAGE_SIZE_8KB
+#endif
+
+#include "arch/common/a.out.h"
+#include "libopenbios/sys_info.h"
+#include "libopenbios/bindings.h"
+#include "libopenbios/aout_load.h"
+#include "libc/diskio.h"
+#define printf printk
+#define debug printk
+
+#define addr_fixup(addr) ((addr) & 0x00ffffff)
+
+static char *image_name, *image_version;
+static int fd;
+
+static int check_mem_ranges(struct sys_info *info,
+ unsigned long start,
+ unsigned long size)
+{
+ int j;
+ unsigned long end;
+ unsigned long prog_start, prog_end;
+ struct memrange *mem;
+
+ prog_start = virt_to_phys(&_start);
+ prog_end = virt_to_phys(&_end);
+
+ end = start + size;
+
+ if (start < prog_start && end > prog_start)
+ goto conflict;
+ if (start < prog_end && end > prog_end)
+ goto conflict;
+ mem = info->memrange;
+ for (j = 0; j < info->n_memranges; j++) {
+ if (mem[j].base <= start && mem[j].base + mem[j].size >= end)
+ break;
+ }
+ if (j >= info->n_memranges)
+ goto badseg;
+ return 1;
+
+ conflict:
+ printf("%s occupies [%#lx-%#lx]\n", program_name, prog_start, prog_end);
+
+ badseg:
+ printf("A.out file [%#lx-%#lx] doesn't fit into memory\n", start, end - 1);
+ return 0;
+}
+
+int aout_load(struct sys_info *info, const char *filename)
+{
+ int retval = -1;
+ struct exec ehdr;
+ unsigned long start, size;
+ unsigned int offset;
+
+ image_name = image_version = NULL;
+
+ /* Mark the saved-program-state as invalid */
+ feval("0 state-valid !");
+
+ fd = open_io(filename);
+ if (!fd)
+ goto out;
+
+ for (offset = 0; offset < 16 * 512; offset += 512) {
+ seek_io(fd, offset);
+ if (read_io(fd, &ehdr, sizeof ehdr) != sizeof ehdr) {
+ debug("Can't read a.out header\n");
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+ }
+ if (!N_BADMAG(ehdr))
+ break;
+ }
+
+ if (N_BADMAG(ehdr)) {
+ debug("Not a bootable a.out image\n");
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+ }
+
+ if (ehdr.a_text == 0x30800007)
+ ehdr.a_text=64*1024;
+
+ if (N_MAGIC(ehdr) == NMAGIC) {
+ size = addr_fixup(N_DATADDR(ehdr)) + addr_fixup(ehdr.a_data);
+ } else {
+ size = addr_fixup(ehdr.a_text) + addr_fixup(ehdr.a_data);
+ }
+
+ if (size < 7680)
+ size = 7680;
+
+
+ start = 0x4000; // N_TXTADDR(ehdr);
+
+ if (!check_mem_ranges(info, start, size))
+ goto out;
+
+ printf("Loading a.out %s...\n", image_name ? image_name : "image");
+
+ seek_io(fd, offset + N_TXTOFF(ehdr));
+
+ if (N_MAGIC(ehdr) == NMAGIC) {
+ if ((size_t)read_io(fd, (void *)start, ehdr.a_text) != ehdr.a_text) {
+ printf("Can't read program text segment (size 0x" FMT_aout_ehdr ")\n", ehdr.a_text);
+ goto out;
+ }
+ if ((size_t)read_io(fd, (void *)(start + N_DATADDR(ehdr)), ehdr.a_data) != ehdr.a_data) {
+ printf("Can't read program data segment (size 0x" FMT_aout_ehdr ")\n", ehdr.a_data);
+ goto out;
+ }
+ } else {
+ if ((size_t)read_io(fd, (void *)start, size) != size) {
+ printf("Can't read program (size 0x" FMT_sizet ")\n", size);
+ goto out;
+ }
+ }
+
+ debug("Loaded %lu bytes\n", size);
+ debug("entry point is %#lx\n", start);
+
+ // Initialise saved-program-state
+ PUSH(addr_fixup(start));
+ feval("saved-program-state >sps.entry !");
+ PUSH(size);
+ feval("saved-program-state >sps.file-size !");
+ feval("aout saved-program-state >sps.file-type !");
+
+ feval("-1 state-valid !");
+
+out:
+ close_io(fd);
+ return retval;
+}
Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 11:57:03 2010 (r710)
+++ trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 12:30:14 2010 (r711)
@@ -1,6 +1,8 @@
<build>
<library name="openbios" type="static" target="target">
+ <object source="aout_load.c" condition="SPARC32"/>
+ <object source="aout_load.c" condition="SPARC64"/>
<object source="bindings.c"/>
<object source="client.c"/>
<object source="console_common.c"/>
1
0
[commit] r710 - in trunk/openbios-devel: arch/amd64 arch/ppc/qemu arch/sparc32 arch/sparc64 arch/unix arch/x86 include/arch/amd64 include/arch/sparc32 include/arch/sparc64 include/arch/x86 include/...
by repository service March 27, 2010
by repository service March 27, 2010
March 27, 2010
Author: mcayland
Date: Sat Mar 27 11:57:03 2010
New Revision: 710
URL: http://tracker.coreboot.org/trac/openbios/changeset/710
Log:
Create a brand new ELF loader based upon arch/*/elfload.c and libopenbios/elfload.c combined together in libopenbios. This means
that each arch no longer needs its own ELF loader implementation.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
Added:
trunk/openbios-devel/include/libopenbios/elf_load.h
trunk/openbios-devel/libopenbios/elf_load.c
Deleted:
trunk/openbios-devel/arch/amd64/elfload.c
trunk/openbios-devel/arch/sparc32/elfload.c
trunk/openbios-devel/arch/sparc64/elfload.c
trunk/openbios-devel/arch/x86/elfload.c
trunk/openbios-devel/include/libopenbios/elfload.h
trunk/openbios-devel/libopenbios/elfload.c
Modified:
trunk/openbios-devel/arch/ppc/qemu/main.c
trunk/openbios-devel/arch/sparc32/build.xml
trunk/openbios-devel/arch/sparc64/boot.c
trunk/openbios-devel/arch/sparc64/boot.h
trunk/openbios-devel/arch/sparc64/build.xml
trunk/openbios-devel/arch/unix/boot.c
trunk/openbios-devel/arch/x86/build.xml
trunk/openbios-devel/arch/x86/linux_load.c
trunk/openbios-devel/arch/x86/segment.c
trunk/openbios-devel/include/arch/amd64/io.h
trunk/openbios-devel/include/arch/amd64/types.h
trunk/openbios-devel/include/arch/sparc32/types.h
trunk/openbios-devel/include/arch/sparc64/types.h
trunk/openbios-devel/include/arch/x86/io.h
trunk/openbios-devel/include/arch/x86/types.h
trunk/openbios-devel/libopenbios/build.xml
Modified: trunk/openbios-devel/arch/ppc/qemu/main.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/main.c Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/ppc/qemu/main.c Sat Mar 27 11:57:03 2010 (r710)
@@ -16,7 +16,7 @@
#include "config.h"
#include "libopenbios/bindings.h"
-#include "libopenbios/elfload.h"
+#include "libopenbios/elf_load.h"
#include "arch/common/nvram.h"
#include "packages/nvram.h"
#include "libc/diskio.h"
Modified: trunk/openbios-devel/arch/sparc32/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc32/build.xml Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/sparc32/build.xml Sat Mar 27 11:57:03 2010 (r710)
@@ -15,7 +15,6 @@
<object source="udiv.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="elfload.c"/>
<object source="aoutload.c"/>
<object source="forthload.c"/>
<object source="romvec.c"/>
Modified: trunk/openbios-devel/arch/sparc64/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.c Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/sparc64/boot.c Sat Mar 27 11:57:03 2010 (r710)
@@ -8,6 +8,7 @@
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "libopenbios/sys_info.h"
+#include "libopenbios/elf_load.h"
#include "boot.h"
struct sys_info sys_info;
@@ -26,7 +27,7 @@
int image_retval = 0;
/* ELF Boot loader */
- elf_load(&sys_info, path, param);
+ elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
Modified: trunk/openbios-devel/arch/sparc64/boot.h
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/sparc64/boot.h Sat Mar 27 11:57:03 2010 (r710)
@@ -9,9 +9,6 @@
// forthload.c
int forth_load(const char *filename);
-// elfload.c
-int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
-
// aout_load.c
int aout_load(struct sys_info *info, const char *filename);
Modified: trunk/openbios-devel/arch/sparc64/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc64/build.xml Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/sparc64/build.xml Sat Mar 27 11:57:03 2010 (r710)
@@ -14,7 +14,6 @@
<object source="switch.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
- <object source="elfload.c"/>
<object source="aoutload.c"/>
<object source="forthload.c"/>
<object source="fcodeload.c"/>
Modified: trunk/openbios-devel/arch/unix/boot.c
==============================================================================
--- trunk/openbios-devel/arch/unix/boot.c Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/unix/boot.c Sat Mar 27 11:57:03 2010 (r710)
@@ -4,7 +4,7 @@
#undef BOOTSTRAP
#include "config.h"
#include "libopenbios/bindings.h"
-#include "libopenbios/elfload.h"
+#include "libopenbios/elf_load.h"
#include "arch/common/nvram.h"
#include "libc/diskio.h"
Modified: trunk/openbios-devel/arch/x86/build.xml
==============================================================================
--- trunk/openbios-devel/arch/x86/build.xml Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/x86/build.xml Sat Mar 27 11:57:03 2010 (r710)
@@ -14,7 +14,6 @@
<object source="linux_load.c"/>
<object source="segment.c"/>
<object source="sys_info.c"/>
- <object source="elfload.c"/>
<object source="forthload.c"/>
<object source="entry.S"/>
<object source="xbox/console.c" condition="XBOX"/>
Modified: trunk/openbios-devel/arch/x86/linux_load.c
==============================================================================
--- trunk/openbios-devel/arch/x86/linux_load.c Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/x86/linux_load.c Sat Mar 27 11:57:03 2010 (r710)
@@ -460,7 +460,6 @@
uint32_t max;
uint32_t start, end, size;
uint64_t forced;
- extern char _start[], _end[];
fd = open_io(initrd_file);
if (!fd) {
Modified: trunk/openbios-devel/arch/x86/segment.c
==============================================================================
--- trunk/openbios-devel/arch/x86/segment.c Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/arch/x86/segment.c Sat Mar 27 11:57:03 2010 (r710)
@@ -40,7 +40,6 @@
{0xffff, 0, 0, 0x93, 0xcf, 0},
};
-extern char _start[], _end[];
void relocate(struct sys_info *info)
{
Modified: trunk/openbios-devel/include/arch/amd64/io.h
==============================================================================
--- trunk/openbios-devel/include/arch/amd64/io.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/include/arch/amd64/io.h Sat Mar 27 11:57:03 2010 (r710)
@@ -1,6 +1,7 @@
#ifndef _ASM_IO_H
#define _ASM_IO_H
+extern char _start, _end;
extern unsigned long virt_offset;
#define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virt_offset))
Modified: trunk/openbios-devel/include/arch/amd64/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/amd64/types.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/include/arch/amd64/types.h Sat Mar 27 11:57:03 2010 (r710)
@@ -23,6 +23,8 @@
typedef __int128_t dcell;
typedef __uint128_t ducell;
+#define FMT_elf "%#x"
+
#define bitspercell (sizeof(cell)<<3)
#define bitsperdcell (sizeof(dcell)<<3)
Modified: trunk/openbios-devel/include/arch/sparc32/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/sparc32/types.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/include/arch/sparc32/types.h Sat Mar 27 11:57:03 2010 (r710)
@@ -40,6 +40,8 @@
#define FMT_ucellx "%08x"
#define FMT_ucellX "%08X"
+#define FMT_elf "%#x"
+
#define bitspercell (sizeof(cell)<<3)
#define bitsperdcell (sizeof(dcell)<<3)
Modified: trunk/openbios-devel/include/arch/sparc64/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/sparc64/types.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/include/arch/sparc64/types.h Sat Mar 27 11:57:03 2010 (r710)
@@ -37,6 +37,10 @@
#define FMT_ucellx "%016llx"
#define FMT_ucellX "%016llX"
+#define FMT_sizet "%lx"
+#define FMT_elf "%#llx"
+#define FMT_aout_ehdr "%x"
+
#ifdef NEED_FAKE_INT128_T
typedef struct {
uint64_t hi;
Modified: trunk/openbios-devel/include/arch/x86/io.h
==============================================================================
--- trunk/openbios-devel/include/arch/x86/io.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/include/arch/x86/io.h Sat Mar 27 11:57:03 2010 (r710)
@@ -3,6 +3,7 @@
#include "asm/types.h"
+extern char _start, _end;
extern unsigned long virt_offset;
#define phys_to_virt(phys) ((void *) ((unsigned long) (phys) - virt_offset))
Modified: trunk/openbios-devel/include/arch/x86/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/x86/types.h Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/include/arch/x86/types.h Sat Mar 27 11:57:03 2010 (r710)
@@ -29,6 +29,8 @@
#define FMT_ucellx "%08x"
#define FMT_ucellX "%08X"
+#define FMT_elf "%#x"
+
#define bitspercell (sizeof(cell)<<3)
#define bitsperdcell (sizeof(dcell)<<3)
Added: trunk/openbios-devel/include/libopenbios/elf_load.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/include/libopenbios/elf_load.h Sat Mar 27 11:57:03 2010 (r710)
@@ -0,0 +1,30 @@
+/*
+ * Creation Date: <2001/05/05 16:44:17 samuel>
+ * Time-stamp: <2003/10/22 23:18:42 samuel>
+ *
+ * <elfload.h>
+ *
+ * Elf loader
+ *
+ * Copyright (C) 2001, 2003 Samuel Rydh (samuel(a)ibrium.se)
+ *
+ * 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
+ *
+ */
+
+#ifndef _H_ELFLOAD
+#define _H_ELFLOAD
+
+#include "arch/common/elf.h"
+#include "asm/elf.h"
+#include "libopenbios/sys_info.h"
+
+extern int elf_load(struct sys_info *info, const char *filename, const char *cmdline, void **boot_notes);
+extern int is_elf(Elf_ehdr *ehdr);
+extern int find_elf(Elf_ehdr *ehdr);
+
+extern Elf_phdr * elf_readhdrs(int offset, Elf_ehdr *ehdr);
+
+#endif /* _H_ELFLOAD */
Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml Fri Mar 26 23:33:50 2010 (r709)
+++ trunk/openbios-devel/libopenbios/build.xml Sat Mar 27 11:57:03 2010 (r710)
@@ -9,6 +9,10 @@
<object source="elf_info.c" condition="SPARC32"/>
<object source="elf_info.c" condition="SPARC64"/>
<object source="elf_info.c" condition="PPC"/>
+ <object source="elf_load.c" condition="X86"/>
+ <object source="elf_load.c" condition="SPARC32"/>
+ <object source="elf_load.c" condition="SPARC64"/>
+ <object source="elf_load.c" condition="AMD64"/>
<object source="font_8x8.c" condition="FONT_8X8"/>
<object source="font_8x16.c" condition="FONT_8X16"/>
<object source="ipchecksum.c"/>
Added: trunk/openbios-devel/libopenbios/elf_load.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/libopenbios/elf_load.c Sat Mar 27 11:57:03 2010 (r710)
@@ -0,0 +1,462 @@
+/* ELF Boot loader
+ * As we have seek, this implementation can be straightforward.
+ * 2003-07 by SONE Takeshi
+ */
+
+#include "config.h"
+#include "kernel/kernel.h"
+#include "libc/diskio.h"
+#include "arch/common/elf_boot.h"
+#include "libopenbios/elf_load.h"
+#include "libopenbios/sys_info.h"
+#include "libopenbios/ipchecksum.h"
+#include "libopenbios/bindings.h"
+#define printf printk
+#define debug printk
+
+#define DEBUG 0
+
+#define MAX_HEADERS 0x20
+#define BS 0x100 /* smallest step used when looking for the ELF header */
+
+/* FreeBSD and possibly others mask the high 8 bits */
+#define addr_fixup(addr) ((addr) & 0x00ffffff)
+
+static char *image_name, *image_version;
+static int fd;
+
+/* Note: avoid name collision with platforms which have their own version of calloc() */
+static void *ob_calloc(size_t nmemb, size_t size)
+{
+ size_t alloc_size = nmemb * size;
+ void *mem;
+
+ if (alloc_size < nmemb || alloc_size < size) {
+ printf("calloc overflow: %u, %u\n", nmemb, size);
+ return NULL;
+ }
+
+ mem = malloc(alloc_size);
+ memset(mem, 0, alloc_size);
+
+ return mem;
+}
+
+static int check_mem_ranges(struct sys_info *info,
+ Elf_phdr *phdr, int phnum)
+{
+ int i, j;
+ unsigned long start, end;
+ unsigned long prog_start, prog_end;
+ struct memrange *mem;
+
+ prog_start = virt_to_phys(&_start);
+ prog_end = virt_to_phys(&_end);
+
+ for (i = 0; i < phnum; i++) {
+ if (phdr[i].p_type != PT_LOAD)
+ continue;
+ start = addr_fixup(phdr[i].p_paddr);
+ end = start + phdr[i].p_memsz;
+ if (start < prog_start && end > prog_start)
+ goto conflict;
+ if (start < prog_end && end > prog_end)
+ goto conflict;
+ mem=info->memrange;
+ for (j = 0; j < info->n_memranges; j++) {
+ if (mem[j].base <= start && mem[j].base + mem[j].size >= end)
+ break;
+ }
+ if (j >= info->n_memranges)
+ goto badseg;
+ }
+ return 1;
+
+conflict:
+ printf("%s occupies [%#lx-%#lx]\n", program_name, prog_start, prog_end);
+
+badseg:
+ printf("Segment %d [%#lx-%#lx] doesn't fit into memory\n", i, start, end-1);
+ return 0;
+}
+
+static unsigned long process_image_notes(Elf_phdr *phdr, int phnum,
+ unsigned short *sum_ptr,
+ unsigned int offset)
+{
+ int i;
+ char *buf = NULL;
+ int retval = 0;
+ unsigned long addr, end;
+ Elf_Nhdr *nhdr;
+ const char *name;
+ void *desc;
+
+ for (i = 0; i < phnum; i++) {
+ if (phdr[i].p_type != PT_NOTE)
+ continue;
+ buf = malloc(phdr[i].p_filesz);
+ seek_io(fd, offset + phdr[i].p_offset);
+ if ((size_t)read_io(fd, buf, phdr[i].p_filesz) != phdr[i].p_filesz) {
+ printf("Can't read note segment\n");
+ goto out;
+ }
+ addr = (unsigned long) buf;
+ end = addr + phdr[i].p_filesz;
+ while (addr < end) {
+ nhdr = (Elf_Nhdr *) addr;
+ addr += sizeof(Elf_Nhdr);
+ name = (const char *) addr;
+ addr += (nhdr->n_namesz+3) & ~3;
+ desc = (void *) addr;
+ addr += (nhdr->n_descsz+3) & ~3;
+
+ if (nhdr->n_namesz==sizeof(ELF_NOTE_BOOT)
+ && memcmp(name, ELF_NOTE_BOOT, sizeof(ELF_NOTE_BOOT))==0) {
+ if (nhdr->n_type == EIN_PROGRAM_NAME) {
+ image_name = ob_calloc(1, nhdr->n_descsz + 1);
+ memcpy(image_name, desc, nhdr->n_descsz);
+ }
+ if (nhdr->n_type == EIN_PROGRAM_VERSION) {
+ image_version = ob_calloc(1, nhdr->n_descsz + 1);
+ memcpy(image_version, desc, nhdr->n_descsz);
+ }
+ if (nhdr->n_type == EIN_PROGRAM_CHECKSUM) {
+ *sum_ptr = *(unsigned short *) desc;
+ debug("Image checksum: %#04x\n", *sum_ptr);
+ /* Where in the file */
+ retval = phdr[i].p_offset
+ + (unsigned long) desc - (unsigned long) buf;
+ }
+ }
+ }
+ }
+out:
+ close_io(fd);
+ if (buf)
+ free(buf);
+ return retval;
+}
+
+static int load_segments(Elf_phdr *phdr, int phnum,
+ unsigned long checksum_offset,
+ unsigned int offset, unsigned long *bytes)
+{
+ //unsigned int start_time, time;
+ int i;
+
+ *bytes = 0;
+ // start_time = currticks();
+ for (i = 0; i < phnum; i++) {
+ if (phdr[i].p_type != PT_LOAD)
+ continue;
+ debug("segment %d addr:" FMT_elf " file:" FMT_elf " mem:" FMT_elf " ",
+ i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz);
+ seek_io(fd, offset + phdr[i].p_offset);
+ debug("loading... ");
+ if ((size_t)read_io(fd, phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz)
+ != phdr[i].p_filesz) {
+ printf("Can't read program segment %d\n", i);
+ return 0;
+ }
+ bytes += phdr[i].p_filesz;
+ debug("clearing... ");
+ memset(phys_to_virt(addr_fixup(phdr[i].p_paddr) + phdr[i].p_filesz), 0,
+ phdr[i].p_memsz - phdr[i].p_filesz);
+ if (phdr[i].p_offset <= checksum_offset
+ && phdr[i].p_offset + phdr[i].p_filesz >= checksum_offset+2) {
+ debug("clearing checksum... ");
+ memset(phys_to_virt(addr_fixup(phdr[i].p_paddr) + checksum_offset
+ - phdr[i].p_offset), 0, 2);
+ }
+ debug("ok\n");
+
+ }
+ // time = currticks() - start_time;
+ //debug("Loaded %lu bytes in %ums (%luKB/s)\n", bytes, time,
+ // time? bytes/time : 0);
+ debug("Loaded %lu bytes \n", *bytes);
+
+ return 1;
+}
+
+static int verify_image(Elf_ehdr *ehdr, Elf_phdr *phdr, int phnum,
+ unsigned short image_sum)
+{
+ unsigned short sum, part_sum;
+ unsigned long offset;
+ int i;
+
+ sum = 0;
+ offset = 0;
+
+ part_sum = ipchksum(ehdr, sizeof *ehdr);
+ sum = add_ipchksums(offset, sum, part_sum);
+ offset += sizeof *ehdr;
+
+ part_sum = ipchksum(phdr, phnum * sizeof(*phdr));
+ sum = add_ipchksums(offset, sum, part_sum);
+ offset += phnum * sizeof(*phdr);
+
+ for (i = 0; i < phnum; i++) {
+ if (phdr[i].p_type != PT_LOAD)
+ continue;
+ part_sum = ipchksum(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_memsz);
+ sum = add_ipchksums(offset, sum, part_sum);
+ offset += phdr[i].p_memsz;
+ }
+
+ if (sum != image_sum) {
+ printf("Verify FAILED (image:%#04x vs computed:%#04x)\n",
+ image_sum, sum);
+ return 0;
+ }
+ return 1;
+}
+
+static inline unsigned padded(unsigned s)
+{
+ return (s + 3) & ~3;
+}
+
+static Elf_Bhdr *add_boot_note(Elf_Bhdr *bhdr, const char *name,
+ unsigned type, const char *desc, unsigned descsz)
+{
+ Elf_Nhdr nhdr;
+ unsigned ent_size, new_size, pad;
+ char *addr;
+
+ if (!bhdr)
+ return NULL;
+
+ nhdr.n_namesz = name? strlen(name)+1 : 0;
+ nhdr.n_descsz = descsz;
+ nhdr.n_type = type;
+ ent_size = sizeof(nhdr) + padded(nhdr.n_namesz) + padded(nhdr.n_descsz);
+ if (bhdr->b_size + ent_size > 0xffff) {
+ printf("Boot notes too big\n");
+ free(bhdr);
+ return NULL;
+ }
+ if (bhdr->b_size + ent_size > bhdr->b_checksum) {
+ do {
+ new_size = bhdr->b_checksum * 2;
+ } while (new_size < bhdr->b_size + ent_size);
+ if (new_size > 0xffff)
+ new_size = 0xffff;
+ debug("expanding boot note size to %u\n", new_size);
+#ifdef HAVE_REALLOC
+ bhdr = realloc(bhdr, new_size);
+ bhdr->b_checksum = new_size;
+#else
+ printf("Boot notes too big\n");
+ free(bhdr);
+ return NULL;
+#endif
+ }
+
+ addr = (char *) bhdr;
+ addr += bhdr->b_size;
+ memcpy(addr, &nhdr, sizeof(nhdr));
+ addr += sizeof(nhdr);
+
+ memcpy(addr, name, nhdr.n_namesz);
+ addr += nhdr.n_namesz;
+ pad = padded(nhdr.n_namesz) - nhdr.n_namesz;
+ memset(addr, 0, pad);
+ addr += pad;
+
+ memcpy(addr, desc, nhdr.n_descsz);
+ addr += nhdr.n_descsz;
+ pad = padded(nhdr.n_descsz) - nhdr.n_descsz;
+ memset(addr, 0, pad);
+ addr += pad;
+
+ bhdr->b_size += ent_size;
+ bhdr->b_records++;
+ return bhdr;
+}
+
+static inline Elf_Bhdr *add_note_string(Elf_Bhdr *bhdr, const char *name,
+ unsigned type, const char *desc)
+{
+ return add_boot_note(bhdr, name, type, desc, strlen(desc) + 1);
+}
+
+static Elf_Bhdr *build_boot_notes(struct sys_info *info, const char *cmdline)
+{
+ Elf_Bhdr *bhdr;
+
+ bhdr = malloc(256);
+ bhdr->b_signature = ELF_BHDR_MAGIC;
+ bhdr->b_size = sizeof *bhdr;
+ bhdr->b_checksum = 256; /* XXX cache the current buffer size here */
+ bhdr->b_records = 0;
+
+ if (info->firmware)
+ bhdr = add_note_string(bhdr, NULL, EBN_FIRMWARE_TYPE, info->firmware);
+ bhdr = add_note_string(bhdr, NULL, EBN_BOOTLOADER_NAME, program_name);
+ bhdr = add_note_string(bhdr, NULL, EBN_BOOTLOADER_VERSION, program_version);
+ if (cmdline)
+ bhdr = add_note_string(bhdr, NULL, EBN_COMMAND_LINE, cmdline);
+ if (!bhdr)
+ return bhdr;
+ bhdr->b_checksum = 0;
+ bhdr->b_checksum = ipchksum(bhdr, bhdr->b_size);
+ return bhdr;
+}
+
+int
+is_elf(Elf_ehdr *ehdr)
+{
+ return (ehdr->e_ident[EI_MAG0] == ELFMAG0
+ && ehdr->e_ident[EI_MAG1] == ELFMAG1
+ && ehdr->e_ident[EI_MAG2] == ELFMAG2
+ && ehdr->e_ident[EI_MAG3] == ELFMAG3
+ && ehdr->e_ident[EI_CLASS] == ARCH_ELF_CLASS
+ && ehdr->e_ident[EI_DATA] == ARCH_ELF_DATA
+ && ehdr->e_ident[EI_VERSION] == EV_CURRENT
+ && ehdr->e_type == ET_EXEC
+ && ARCH_ELF_MACHINE_OK(ehdr->e_machine)
+ && ehdr->e_version == EV_CURRENT
+ && ehdr->e_phentsize == sizeof(Elf_phdr));
+}
+
+int
+find_elf(Elf_ehdr *ehdr)
+{
+ int offset;
+
+ for (offset = 0; offset < MAX_HEADERS * BS; offset += BS) {
+ if ((size_t)read_io(fd, ehdr, sizeof ehdr) != sizeof ehdr) {
+ debug("Can't read ELF header\n");
+ return 0;
+ }
+
+ if (is_elf(ehdr)) {
+ debug("Found ELF header at offset %d\n", offset);
+ return offset;
+ }
+
+ seek_io(fd, offset);
+ }
+
+ debug("Not a bootable ELF image\n");
+ return 0;
+}
+
+Elf_phdr *
+elf_readhdrs(int offset, Elf_ehdr *ehdr)
+{
+ unsigned long phdr_size;
+ Elf_phdr *phdr;
+
+ phdr_size = ehdr->e_phnum * sizeof(Elf_phdr);
+ phdr = malloc(phdr_size);
+ seek_io(fd, offset + ehdr->e_phoff);
+ if ((size_t)read_io(fd, phdr, phdr_size) != phdr_size) {
+ printf("Can't read program header\n");
+ return NULL;
+ }
+
+ return phdr;
+}
+
+int elf_load(struct sys_info *info, const char *filename, const char *cmdline, void **boot_notes)
+{
+ Elf_ehdr ehdr;
+ Elf_phdr *phdr = NULL;
+ unsigned long checksum_offset, file_size;
+ unsigned short checksum = 0;
+ int retval = -1;
+ unsigned int offset;
+
+ image_name = image_version = NULL;
+
+ /* Mark the saved-program-state as invalid */
+ feval("0 state-valid !");
+
+ fd = open_io(filename);
+ if (!fd)
+ goto out;
+
+ offset = find_elf(&ehdr);
+ if (!offset) {
+ retval = LOADER_NOT_SUPPORT;
+ goto out;
+ }
+
+#if DEBUG
+ printk("ELF header:\n");
+ printk(" ehdr.e_type = %d\n", (int)ehdr.e_type);
+ printk(" ehdr.e_machine = %d\n", (int)ehdr.e_machine);
+ printk(" ehdr.e_version = %d\n", (int)ehdr.e_version);
+ printk(" ehdr.e_entry = 0x%08x\n", (int)ehdr.e_entry);
+ printk(" ehdr.e_phoff = 0x%08x\n", (int)ehdr.e_phoff);
+ printk(" ehdr.e_shoff = 0x%08x\n", (int)ehdr.e_shoff);
+ printk(" ehdr.e_flags = %d\n", (int)ehdr.e_flags);
+ printk(" ehdr.e_ehsize = 0x%08x\n", (int)ehdr.e_ehsize);
+ printk(" ehdr.e_phentsize = 0x%08x\n", (int)ehdr.e_phentsize);
+ printk(" ehdr.e_phnum = %d\n", (int)ehdr.e_phnum);
+#endif
+
+ if (ehdr.e_phnum > MAX_HEADERS) {
+ printk ("elfload: too many program headers (MAX_HEADERS)\n");
+ retval = 0;
+ goto out;
+ }
+
+ phdr = elf_readhdrs(offset, &ehdr);
+ if (!phdr)
+ goto out;
+
+ if (!check_mem_ranges(info, phdr, ehdr.e_phnum))
+ goto out;
+
+ checksum_offset = process_image_notes(phdr, ehdr.e_phnum, &checksum, offset);
+
+ printf("Loading %s", image_name ? image_name : "image");
+ if (image_version)
+ printf(" version %s", image_version);
+ printf("...\n");
+
+ if (!load_segments(phdr, ehdr.e_phnum, checksum_offset, offset, &file_size))
+ goto out;
+
+ if (checksum_offset) {
+ if (!verify_image(&ehdr, phdr, ehdr.e_phnum, checksum))
+ goto out;
+ }
+
+ /* If we are attempting an ELF boot image, we pass a non-NULL pointer
+ into boot_notes and mark the image as elf-boot rather than standard
+ ELF */
+ if (boot_notes) {
+ *boot_notes = (void *)virt_to_phys(build_boot_notes(info, cmdline));
+ feval("elf-boot saved-program-state >sps.file-type !");
+ } else {
+ feval("elf saved-program-state >sps.file-type !");
+ }
+
+ //debug("current time: %lu\n", currticks());
+
+ debug("entry point is " FMT_elf "\n", addr_fixup(ehdr.e_entry));
+
+ // Initialise saved-program-state
+ PUSH(addr_fixup(ehdr.e_entry));
+ feval("saved-program-state >sps.entry !");
+ PUSH(file_size);
+ feval("saved-program-state >sps.file-size !");
+
+ feval("-1 state-valid !");
+
+out:
+ close_io(fd);
+ if (phdr)
+ free(phdr);
+ if (image_name)
+ free(image_name);
+ if (image_version)
+ free(image_version);
+ return retval;
+}
1
0
[commit] r709 - in trunk/openbios-devel: arch/sparc32 arch/sparc64 arch/x86 include/arch/sparc32 include/arch/x86
by repository service March 26, 2010
by repository service March 26, 2010
March 26, 2010
Author: mcayland
Date: Fri Mar 26 23:33:50 2010
New Revision: 709
URL: http://tracker.coreboot.org/trac/openbios/changeset/709
Log:
Switch the loaders for x86, sparc64 and sparc32 over to use the new saved-program-state in boot() rather than try to execute the
device payload directly. This is the first stage in isolating the OF "load" and "go" words, and in preparation for moving the
majority of the loaders into libopenbios.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
Modified:
trunk/openbios-devel/arch/sparc32/aoutload.c
trunk/openbios-devel/arch/sparc32/boot.c
trunk/openbios-devel/arch/sparc32/elfload.c
trunk/openbios-devel/arch/sparc32/forthload.c
trunk/openbios-devel/arch/sparc64/aoutload.c
trunk/openbios-devel/arch/sparc64/boot.c
trunk/openbios-devel/arch/sparc64/elfload.c
trunk/openbios-devel/arch/sparc64/fcodeload.c
trunk/openbios-devel/arch/sparc64/forthload.c
trunk/openbios-devel/arch/x86/boot.c
trunk/openbios-devel/arch/x86/elfload.c
trunk/openbios-devel/arch/x86/forthload.c
trunk/openbios-devel/include/arch/sparc32/types.h
trunk/openbios-devel/include/arch/x86/types.h
Modified: trunk/openbios-devel/arch/sparc32/aoutload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/aoutload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc32/aoutload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -56,7 +56,6 @@
int aout_load(struct sys_info *info, const char *filename, const void *romvec)
{
int retval = -1;
- int image_retval;
struct exec ehdr;
unsigned long start, size;
unsigned int offset = 512;
@@ -134,18 +133,6 @@
feval("-1 state-valid !");
- printf("Jumping to entry point...\n");
-
-#if 1
- {
- int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
-
- entry = (void *) addr_fixup(start);
- image_retval = entry(romvec, 0, 0, 0, 0);
- }
-#endif
-
- printf("Image returned with return value %#x\n", image_retval);
retval = 0;
out:
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc32/boot.c Fri Mar 26 23:33:50 2010 (r709)
@@ -4,7 +4,6 @@
#undef BOOTSTRAP
#include "config.h"
#include "libopenbios/bindings.h"
-#include "libopenbios/elfload.h"
#include "arch/common/nvram.h"
#include "drivers/drivers.h"
#include "libc/diskio.h"
@@ -19,25 +18,78 @@
uint32_t qemu_cmdline;
uint32_t cmdline_size;
char boot_device;
+int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
-static void try_path(const char *path, char *param, const void *romvec)
+static int try_path(const char *path, char *param, const void *romvec)
{
+ ucell valid, address, type, size;
+ int image_retval = 0;
+
push_str(path);
fword("pathres-resolve-aliases");
bootpath = pop_fstr_copy();
printk("Trying %s (%s)\n", path, bootpath);
- elf_load(&sys_info, path, param, romvec);
- linux_load(&sys_info, path, param);
- aout_load(&sys_info, path, romvec);
+ /* ELF Boot loader */
+ elf_load(&sys_info, path, param, romvec);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ /* Linux loader (not using Forth) */
+ linux_load(&sys_info, path, param);
+
+ /* a.out loader */
+ aout_load(&sys_info, path, romvec);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ return 0;
+
+
+start_image:
+ /* Get the entry point and the type (see forth/debugging/client.fs) */
+ feval("saved-program-state >sps.entry @");
+ address = POP();
+ feval("saved-program-state >sps.file-type @");
+ type = POP();
+ feval("saved-program-state >sps.file-size @");
+ size = POP();
+
+ printk("Jumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
+
+ switch (type) {
+ case 0x0:
+ /* Start ELF boot image */
+ entry = (void *) address;
+ image_retval = entry(romvec, 0, 0, 0, 0);
+
+ break;
+
+ case 0x5:
+ /* Start a.out image */
+ entry = (void *) address;
+ image_retval = entry(romvec, 0, 0, 0, 0);
+
+ break;
+ }
+
+ printk("Image returned with return value %#x\n", image_retval);
+
+ return -1;
}
+
void boot(void)
{
char *path = pop_fstr_copy(), *param, altpath[256];
const char *oldpath = path;
int unit = 0;
const void *romvec;
+ int result;
if(!path) {
push_str("boot-device");
@@ -102,8 +154,6 @@
romvec = init_openprom();
if (kernel_size) {
- int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
-
printk("[sparc] Kernel already loaded\n");
entry = (void *) kernel_image;
entry(romvec, 0, 0, 0, 0);
@@ -115,17 +165,19 @@
else
printk("without parameters.\n");
- try_path(path, param, romvec);
-
- push_str(path);
- PUSH(':');
- fword("left-split");
- snprintf(altpath, sizeof(altpath), "%s:d", pop_fstr_copy());
- POP();
- POP();
+ result = try_path(path, param, romvec);
+ if (!result) {
+ push_str(path);
+ PUSH(':');
+ fword("left-split");
+ snprintf(altpath, sizeof(altpath), "%s:d", pop_fstr_copy());
+ POP();
+ POP();
+
+ try_path(altpath, param, romvec);
+ }
- try_path(altpath, param, romvec);
- printk("Unsupported image format\n");
+ printk("Unsupported image format\n");
free(path);
}
Modified: trunk/openbios-devel/arch/sparc32/elfload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/elfload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc32/elfload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -312,7 +312,6 @@
unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
- int image_retval;
unsigned int offset;
image_name = image_version = NULL;
@@ -394,21 +393,6 @@
feval("-1 state-valid !");
- printf("Jumping to entry point...\n");
-
-#if 1
- {
- int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
-
- entry = (void *) addr_fixup(ehdr.e_entry);
- image_retval = entry(romvec, 0, 0, 0, 0);
- }
-#else
- image_retval = start_elf(addr_fixup(ehdr.e_entry), virt_to_phys(boot_notes));
-#endif
-
- // console_init(); FIXME
- printf("Image returned with return value %#x\n", image_retval);
retval = 0;
out:
Modified: trunk/openbios-devel/arch/sparc32/forthload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/forthload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc32/forthload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -68,9 +68,6 @@
feval("-1 state-valid !");
- PUSH ( (ucell)forthtext );
- PUSH ( (ucell)forthsize );
- fword("eval2");
retval=0;
out:
Modified: trunk/openbios-devel/arch/sparc64/aoutload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/aoutload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc64/aoutload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -57,7 +57,6 @@
int aout_load(struct sys_info *info, const char *filename)
{
int retval = -1;
- int image_retval;
struct exec ehdr;
unsigned long start, size;
unsigned int offset;
@@ -138,14 +137,6 @@
feval("-1 state-valid !");
- printf("Jumping to entry point...\n");
-
- {
- extern int sparc64_of_client_interface( int *params );
- image_retval = start_client_image(addr_fixup(start), (uint64_t)&sparc64_of_client_interface);
- }
-
- printf("Image returned with return value %#x\n", image_retval);
retval = 0;
out:
Modified: trunk/openbios-devel/arch/sparc64/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/boot.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc64/boot.c Fri Mar 26 23:33:50 2010 (r709)
@@ -4,7 +4,6 @@
#undef BOOTSTRAP
#include "config.h"
#include "libopenbios/bindings.h"
-#include "libopenbios/elfload.h"
#include "arch/common/nvram.h"
#include "libc/diskio.h"
#include "libc/vsprintf.h"
@@ -17,16 +16,88 @@
uint64_t qemu_cmdline;
uint64_t cmdline_size;
char boot_device;
+extern int sparc64_of_client_interface( int *params );
+
+
+static int try_path(const char *path, char *param)
+{
+ void *boot_notes = NULL;
+ ucell valid, address, type, size;
+ int image_retval = 0;
+
+ /* ELF Boot loader */
+ elf_load(&sys_info, path, param);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ /* Linux loader (not using Forth) */
+ linux_load(&sys_info, path, param);
+
+ /* a.out loader */
+ aout_load(&sys_info, path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ /* Fcode loader */
+ fcode_load(path);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ return 0;
+
+
+start_image:
+ /* Get the entry point and the type (see forth/debugging/client.fs) */
+ feval("saved-program-state >sps.entry @");
+ address = POP();
+ feval("saved-program-state >sps.file-type @");
+ type = POP();
+ feval("saved-program-state >sps.file-size @");
+ size = POP();
+
+ printk("Jumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
+
+ switch (type) {
+ case 0x0:
+ /* Start ELF boot image */
+ image_retval = start_elf(address, (uint64_t)boot_notes);
+ break;
+
+ case 0x5:
+ /* Start a.out image */
+ image_retval = start_client_image(address, (uint64_t)&sparc64_of_client_interface);
+ break;
+
+ case 0x10:
+ /* Start Fcode image */
+ printk("Evaluating FCode...\n");
+ PUSH(address);
+ PUSH(1);
+ fword("byte-load");
+ image_retval = 0;
+ break;
+ }
+
+ printk("Image returned with return value %#x\n", image_retval);
+
+ return -1;
+}
void boot(void)
{
char *path=pop_fstr_copy(), *param;
char altpath[256];
+ int result;
if (kernel_size) {
void (*entry)(unsigned long p1, unsigned long p2, unsigned long p3,
- unsigned long p4, unsigned long p5);
- extern int sparc64_of_client_interface( int *params );
+ unsigned long p4, unsigned long p5);;
printk("[sparc64] Kernel already loaded\n");
entry = (void *) (unsigned long)kernel_image;
@@ -82,24 +153,13 @@
else
printk("without parameters.\n");
+ result = try_path(path, param);
+ if (!result) {
+ snprintf(altpath, sizeof(altpath), "%s:f", path);
+ try_path(altpath, param);
+ }
- if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
- if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
- if (aout_load(&sys_info, path) == LOADER_NOT_SUPPORT)
- if (fcode_load(path) == LOADER_NOT_SUPPORT) {
-
- snprintf(altpath, sizeof(altpath), "%s:f", path);
-
- if (elf_load(&sys_info, altpath, param)
- == LOADER_NOT_SUPPORT)
- if (linux_load(&sys_info, altpath, param)
- == LOADER_NOT_SUPPORT)
- if (aout_load(&sys_info, altpath)
- == LOADER_NOT_SUPPORT)
- if (fcode_load(altpath)
- == LOADER_NOT_SUPPORT)
- printk("Unsupported image format\n");
- }
+ printk("Unsupported image format\n");
free(path);
}
Modified: trunk/openbios-devel/arch/sparc64/elfload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/elfload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc64/elfload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -311,7 +311,6 @@
unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
- int image_retval;
unsigned int offset;
image_name = image_version = NULL;
@@ -393,27 +392,6 @@
feval("-1 state-valid !");
- printf("Jumping to entry point...\n");
-
-#if 0
- {
- extern unsigned int qemu_mem_size;
- extern char boot_device;
- void *init_openprom(unsigned long memsize, const char *cmdline, char boot_device);
-
- int (*entry)(const void *romvec, int p2, int p3, int p4, int p5);
- const void *romvec;
-
- romvec = init_openprom(qemu_mem_size, cmdline, boot_device);
- entry = (void *) addr_fixup(ehdr.e_entry);
- image_retval = entry(romvec, 0, 0, 0, 0);
- }
-#else
- image_retval = start_elf(addr_fixup(ehdr.e_entry), virt_to_phys(boot_notes));
-#endif
-
- // console_init(); FIXME
- printf("Image returned with return value %#x\n", image_retval);
retval = 0;
out:
Modified: trunk/openbios-devel/arch/sparc64/fcodeload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/fcodeload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc64/fcodeload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -74,11 +74,7 @@
feval("saved-program-state >sps.file-size !");
feval("fcode saved-program-state >sps.file-type !");
- printf("Evaluating FCode...\n");
-
- PUSH(start);
- PUSH(1);
- fword("byte-load");
+ feval("-1 state-valid !");
retval = 0;
Modified: trunk/openbios-devel/arch/sparc64/forthload.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/forthload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/sparc64/forthload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -68,9 +68,6 @@
feval("-1 state-valid !");
- PUSH ( (ucell)forthtext );
- PUSH ( (ucell)forthsize );
- fword("eval2");
retval=0;
out:
Modified: trunk/openbios-devel/arch/x86/boot.c
==============================================================================
--- trunk/openbios-devel/arch/x86/boot.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/x86/boot.c Fri Mar 26 23:33:50 2010 (r709)
@@ -9,7 +9,6 @@
#undef BOOTSTRAP
#include "config.h"
#include "libopenbios/bindings.h"
-#include "libopenbios/elfload.h"
#include "arch/common/nvram.h"
#include "libc/diskio.h"
#include "libopenbios/sys_info.h"
@@ -17,6 +16,62 @@
struct sys_info sys_info;
+static int try_path(const char *path, char *param)
+{
+ ucell valid, address, type, size;
+ int image_retval = 0;;
+
+ /* ELF Boot loader */
+ elf_load(&sys_info, path, param);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ /* Linux loader (not using Forth) */
+ linux_load(&sys_info, path, param);
+
+ /* Forth loader */
+ forth_load(&sys_info, path, param);
+ feval("state-valid @");
+ valid = POP();
+ if (valid)
+ goto start_image;
+
+ return 0;
+
+
+start_image:
+ /* Get the entry point and the type (see forth/debugging/client.fs) */
+ feval("saved-program-state >sps.entry @");
+ address = POP();
+ feval("saved-program-state >sps.file-type @");
+ type = POP();
+ feval("saved-program-state >sps.file-size @");
+ size = POP();
+
+ printk("Jumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
+
+ switch (type) {
+ case 0x0:
+ /* Start ELF boot image */
+ image_retval = start_elf(address, (uint32_t)NULL);
+ break;
+
+ case 0x11:
+ /* Start Forth image */
+ PUSH(address);
+ PUSH(size);
+ fword("eval2");
+ image_retval = 0;
+ break;
+ }
+
+ printk("Image returned with return value %#x\n", image_retval);
+
+ return -1;
+}
+
void boot(void)
{
char *path=pop_fstr_copy(), *param;
@@ -34,15 +89,9 @@
printk("[x86] Booting file '%s' with parameters '%s'\n",path, param);
- if (elf_load(&sys_info, path, param) != LOADER_NOT_SUPPORT)
- goto loaded;
- if (linux_load(&sys_info, path, param) != LOADER_NOT_SUPPORT)
- goto loaded;
- if (forth_load(&sys_info, path, param) != LOADER_NOT_SUPPORT)
- goto loaded;
+ try_path(path, param);
printk("Unsupported image format\n");
-loaded:
free(path);
}
Modified: trunk/openbios-devel/arch/x86/elfload.c
==============================================================================
--- trunk/openbios-devel/arch/x86/elfload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/x86/elfload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -313,7 +313,6 @@
unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
- int image_retval;
image_name = image_version = NULL;
@@ -379,7 +378,7 @@
debug("entry point is %#x\n", ehdr.e_entry);
// Initialise saved-program-state
- PUSH(ehdr.e_entry);
+ PUSH(ehdr.e_entry & ADDRMASK);
feval("saved-program-state >sps.entry !");
PUSH(file_size);
feval("saved-program-state >sps.file-size !");
@@ -387,11 +386,6 @@
feval("-1 state-valid !");
- printk("Jumping to entry point...\n");
- image_retval = start_elf(ehdr.e_entry & ADDRMASK, virt_to_phys(boot_notes));
-
- // console_init(); FIXME
- printk("Image returned with return value %#x\n", image_retval);
retval = 0;
out:
Modified: trunk/openbios-devel/arch/x86/forthload.c
==============================================================================
--- trunk/openbios-devel/arch/x86/forthload.c Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/arch/x86/forthload.c Fri Mar 26 23:33:50 2010 (r709)
@@ -68,11 +68,6 @@
feval("-1 state-valid !");
- PUSH ( (ucell)forthtext );
- PUSH ( (ucell)forthsize );
- fword("eval2");
- retval=0;
-
out:
//if (forthtext)
// free(forthtext);
Modified: trunk/openbios-devel/include/arch/sparc32/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/sparc32/types.h Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/include/arch/sparc32/types.h Fri Mar 26 23:33:50 2010 (r709)
@@ -35,6 +35,11 @@
typedef long long dcell;
typedef unsigned long long ducell;
+#define FMT_cell "%ld"
+#define FMT_ucell "%lu"
+#define FMT_ucellx "%08x"
+#define FMT_ucellX "%08X"
+
#define bitspercell (sizeof(cell)<<3)
#define bitsperdcell (sizeof(dcell)<<3)
Modified: trunk/openbios-devel/include/arch/x86/types.h
==============================================================================
--- trunk/openbios-devel/include/arch/x86/types.h Fri Mar 26 22:17:32 2010 (r708)
+++ trunk/openbios-devel/include/arch/x86/types.h Fri Mar 26 23:33:50 2010 (r709)
@@ -24,6 +24,11 @@
typedef int64_t dcell;
typedef uint64_t ducell;
+#define FMT_cell "%ld"
+#define FMT_ucell "%lu"
+#define FMT_ucellx "%08x"
+#define FMT_ucellX "%08X"
+
#define bitspercell (sizeof(cell)<<3)
#define bitsperdcell (sizeof(dcell)<<3)
1
0