Author: blueswirl Date: Sun Jan 30 14:07:37 2011 New Revision: 1017 URL: http://tracker.coreboot.org/trac/openbios/changeset/1017
Log: x86: avoid runtime relocations
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/arch/x86/build.xml trunk/openbios-devel/arch/x86/builtin.c trunk/openbios-devel/arch/x86/openbios.c
Modified: trunk/openbios-devel/arch/x86/build.xml ============================================================================== --- trunk/openbios-devel/arch/x86/build.xml Sun Jan 30 14:07:34 2011 (r1016) +++ trunk/openbios-devel/arch/x86/build.xml Sun Jan 30 14:07:37 2011 (r1017) @@ -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>
Modified: trunk/openbios-devel/arch/x86/builtin.c ============================================================================== --- trunk/openbios-devel/arch/x86/builtin.c Sun Jan 30 14:07:34 2011 (r1016) +++ trunk/openbios-devel/arch/x86/builtin.c Sun Jan 30 14:07:37 2011 (r1017) @@ -13,12 +13,20 @@ * wrap an array around the hex'ed dictionary file */
+/* 256K for the dictionary */ +#define DICTIONARY_SIZE (256 * 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); }
Modified: trunk/openbios-devel/arch/x86/openbios.c ============================================================================== --- trunk/openbios-devel/arch/x86/openbios.c Sun Jan 30 14:07:34 2011 (r1016) +++ trunk/openbios-devel/arch/x86/openbios.c Sun Jan 30 14:07:37 2011 (r1017) @@ -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 @@
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);