[OpenBIOS] [PATCH 2/4] sparc64: avoid runtime relocations

Blue Swirl blauwirbel at gmail.com
Sun Jan 23 12:56:13 CET 2011


Signed-off-by: Blue Swirl <blauwirbel at gmail.com>
---
 arch/sparc64/build.xml       |    6 +-----
 arch/sparc64/builtin.c       |   12 ++++++++++--
 arch/sparc64/ofmem_sparc64.c |    2 +-
 arch/sparc64/openbios.c      |   10 ++++------
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/sparc64/build.xml b/arch/sparc64/build.xml
index 3bea63c..54807c5 100644
--- a/arch/sparc64/build.xml
+++ b/arch/sparc64/build.xml
@@ -40,11 +40,7 @@

  <executable name="target/include/static-dict.h" target="target"
condition="IMAGE_ELF_EMBEDDED">
   <rule><![CDATA[
-	$(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
-	@echo "static const char forth_dictionary[] = {" > $@
-	@cat $< | hexdump -ve '1/0 "\t" 8/1 "0x%02x, " 1/0 "\n"' \
-					| sed 's/0x  ,//g' >> $@
-	@echo "};" >> $@]]></rule>
+	$(call quiet-command,$(ODIR)/forthstrap -x -D $@ -d $< </dev/null, "
 GEN   $(TARGET_DIR)$@")]]></rule>
   <external-object source="openbios-sparc64.dict"/>
  </executable>

diff --git a/arch/sparc64/builtin.c b/arch/sparc64/builtin.c
index aba8a2b..864da79 100644
--- a/arch/sparc64/builtin.c
+++ b/arch/sparc64/builtin.c
@@ -14,12 +14,20 @@
  * wrap an array around the hex'ed dictionary file
  */

+/* 512K for the dictionary */
+#define DICTIONARY_SIZE (512 * 1024 / sizeof(ucell))
+#define DICTIONARY_BASE ((ucell)((char *)&forth_dictionary))
+
+static ucell forth_dictionary[DICTIONARY_SIZE] = {
 #include "static-dict.h"
+};

 void collect_multiboot_info(struct sys_info *info);
 void collect_multiboot_info(struct sys_info *info)
 {
 	info->dict_start=(unsigned long *)forth_dictionary;
-	info->dict_end=(unsigned long *)((ucell)forth_dictionary +
-			sizeof(forth_dictionary));
+        info->dict_end = (unsigned long *)FORTH_DICTIONARY_END;
+        info->dict_last = (ucell *)((unsigned char *)forth_dictionary +
+                                            FORTH_DICTIONARY_LAST);
+        info->dict_limit = sizeof(forth_dictionary);
 }
diff --git a/arch/sparc64/ofmem_sparc64.c b/arch/sparc64/ofmem_sparc64.c
index 1655978..1ed4a7a 100644
--- a/arch/sparc64/ofmem_sparc64.c
+++ b/arch/sparc64/ofmem_sparc64.c
@@ -20,7 +20,7 @@

 #define OF_MALLOC_BASE		((char*)OFMEM + ALIGN_SIZE(sizeof(ofmem_t), 8))

-#define MEMSIZE ((256 + 512 + 512) * 1024)
+#define MEMSIZE ((256 + 512) * 1024)
 static union {
 	char memory[MEMSIZE];
 	ofmem_t ofmem;
diff --git a/arch/sparc64/openbios.c b/arch/sparc64/openbios.c
index 8c08814..ac709fe 100644
--- a/arch/sparc64/openbios.c
+++ b/arch/sparc64/openbios.c
@@ -33,7 +33,6 @@
 #define APB_MEM_BASE         0x1ff00000000ULL

 #define MEMORY_SIZE     (512*1024)      /* 512K ram for hosted system */
-#define DICTIONARY_SIZE (512*1024)      /* 512K for the dictionary   */

 static ucell *memory;

@@ -617,12 +616,11 @@ int openbios(void)

         collect_sys_info(&sys_info);

-        dict = malloc(DICTIONARY_SIZE);
-        dictlimit = DICTIONARY_SIZE;
+        dict = (unsigned char *)sys_info.dict_start;
+        dicthead = (cell)sys_info.dict_end;
+        last = sys_info.dict_last;
+        dictlimit = sys_info.dict_limit;

-	load_dictionary((char *)sys_info.dict_start,
-			(unsigned long)sys_info.dict_end
-                        - (unsigned long)sys_info.dict_start);
 	forth_init();

 #ifdef CONFIG_DEBUG_BOOT
-- 
1.6.2.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-sparc64-avoid-runtime-relocations.patch
Type: application/mbox
Size: 3512 bytes
Desc: not available
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110123/3546e4de/attachment-0001.bin>


More information about the OpenBIOS mailing list