[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbios
Subject:    [OpenBIOS] [commit] r712 - in trunk/openbios-devel: arch/sparc32
From:       repository service <svn () openbios ! org>
Date:       2010-03-27 11:53:59
Message-ID: E1NvUaV-0002pK-IB () ra ! coresystems ! de
[Download RAW message or body]

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@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@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;
+}

-- 
OpenBIOS                 http://openbios.org/
Mailinglist:  http://lists.openbios.org/mailman/listinfo
Free your System - May the Forth be with you


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic