[OpenBIOS] [PATCH 3/4] x86: avoid runtime relocations

Blue Swirl blauwirbel at gmail.com
Fri Jan 21 21:17:22 CET 2011


Signed-off-by: Blue Swirl <blauwirbel at gmail.com>
---
 arch/x86/build.xml  |    6 +-----
 arch/x86/builtin.c  |    9 +++++++--
 arch/x86/openbios.c |   12 ++++--------
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/x86/build.xml b/arch/x86/build.xml
index 8317209..02cecce 100644
--- a/arch/x86/build.xml
+++ b/arch/x86/build.xml
@@ -55,11 +55,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-x86.dict"/>
  </executable>

diff --git a/arch/x86/builtin.c b/arch/x86/builtin.c
index a649172..b02f939 100644
--- a/arch/x86/builtin.c
+++ b/arch/x86/builtin.c
@@ -13,12 +13,17 @@
  * wrap an array around the hex'ed dictionary file
  */

+/* 256K for the dictionary */
+#define DICTIONARY_SIZE (256 * 1024 / sizeof(ucell))
+
 #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/x86/openbios.c b/arch/x86/openbios.c
index 24b886d..dd444fa 100644
--- a/arch/x86/openbios.c
+++ b/arch/x86/openbios.c
@@ -22,9 +22,6 @@

 void collect_sys_info(struct sys_info *info);

-#define DICTIONARY_SIZE (256*1024)      /* 256K for the dictionary   */
-static unsigned char intdict[DICTIONARY_SIZE];
-
 #ifdef CONFIG_DRIVER_PCI
 static const pci_arch_t default_pci_host = {
     .name = "Intel,i440FX",
@@ -84,12 +81,11 @@ int openbios(void)

         collect_sys_info(&sys_info);

-	dict=intdict;
-	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();

 	relocate(&sys_info);
-- 
1.6.2.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-x86-avoid-runtime-relocations.patch
Type: application/mbox
Size: 2857 bytes
Desc: not available
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110121/75425544/attachment.bin>


More information about the OpenBIOS mailing list