j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: Sun Jan 30 14:07:40 2011 New Revision: 1018 URL: http://tracker.coreboot.org/trac/openbios/changeset/1018
Log: ppc: avoid runtime relocations
Because the sizes of cells and pointers do not match on PPC64, relocations of an ucell array using the address of the array itself can't be computed by the linker.
Use a fixed address on PPC64 for the array, so we can use a fixed ucell sized constant for the relocation offset.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/arch/ppc/build.xml trunk/openbios-devel/arch/ppc/qemu/kernel.c trunk/openbios-devel/arch/ppc/qemu/ofmem.c trunk/openbios-devel/arch/ppc64/qemu/ldscript
Modified: trunk/openbios-devel/arch/ppc/build.xml ============================================================================== --- trunk/openbios-devel/arch/ppc/build.xml Sun Jan 30 14:07:37 2011 (r1017) +++ trunk/openbios-devel/arch/ppc/build.xml Sun Jan 30 14:07:40 2011 (r1018) @@ -60,11 +60,7 @@
<executable name="target/include/qemu-dict.h" target="target" condition="QEMU"> <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-qemu.dict"/> </executable>
Modified: trunk/openbios-devel/arch/ppc/qemu/kernel.c ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/kernel.c Sun Jan 30 14:07:37 2011 (r1017) +++ trunk/openbios-devel/arch/ppc/qemu/kernel.c Sun Jan 30 14:07:40 2011 (r1018) @@ -17,7 +17,6 @@ * */
-#include "qemu-dict.h" #include "config.h" #include "dict.h" #include "libopenbios/bindings.h" @@ -27,7 +26,19 @@ #include "kernel.h"
#define MEMORY_SIZE (256*1024) /* 256K ram for hosted system */ -#define DICTIONARY_SIZE (512*1024) /* 512K for the dictionary */ +/* 512K for the dictionary */ +#define DICTIONARY_SIZE (512 * 1024 / sizeof(ucell)) +#ifdef __powerpc64__ +#define DICTIONARY_BASE 0xfff08000 /* this must match the value in ldscript! */ +#define DICTIONARY_SECTION __attribute__((section(".data.dict"))) +#else +#define DICTIONARY_BASE ((ucell)((char *)&forth_dictionary)) +#define DICTIONARY_SECTION +#endif + +static ucell forth_dictionary[DICTIONARY_SIZE] DICTIONARY_SECTION = { +#include "qemu-dict.h" +};
static ucell *memory;
@@ -82,10 +93,12 @@ int initialize_forth( void ) { - dict = malloc(DICTIONARY_SIZE); - dictlimit = DICTIONARY_SIZE; + dict = (unsigned char *)forth_dictionary; + dicthead = (ucell)FORTH_DICTIONARY_END; + last = (ucell *)((unsigned char *)forth_dictionary + + FORTH_DICTIONARY_LAST); + dictlimit = sizeof(forth_dictionary);
- load_dictionary( forth_dictionary, sizeof(forth_dictionary) ); forth_init();
PUSH_xt( bind_noname_func(arch_of_init) );
Modified: trunk/openbios-devel/arch/ppc/qemu/ofmem.c ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/ofmem.c Sun Jan 30 14:07:37 2011 (r1017) +++ trunk/openbios-devel/arch/ppc/qemu/ofmem.c Sun Jan 30 14:07:40 2011 (r1018) @@ -55,7 +55,7 @@ #define HASH_BITS 15 #endif #define HASH_SIZE (2 << HASH_BITS) -#define OFMEM_SIZE (2 * 1024 * 1024) +#define OFMEM_SIZE (1 * 1024 * 1024 + 512 * 1024)
#define SEGR_USER BIT(2) #define SEGR_BASE 0x0400
Modified: trunk/openbios-devel/arch/ppc64/qemu/ldscript ============================================================================== --- trunk/openbios-devel/arch/ppc64/qemu/ldscript Sun Jan 30 14:07:37 2011 (r1017) +++ trunk/openbios-devel/arch/ppc64/qemu/ldscript Sun Jan 30 14:07:40 2011 (r1018) @@ -6,6 +6,7 @@ BASE_ADDR = 0xfff00000;
/* As NVRAM is at 0xfff04000, the .text needs to be after that + * The value in arch/ppc/qemu/kernel.c must match this value! */ TEXT_ADDR = 0xfff08000;
@@ -26,6 +27,12 @@
. = TEXT_ADDR; /* Normal sections */ + .data.dict ALIGN(4096): { + _dict_start = .; + *(.data.dict) + _dict_end = .; + } + .text ALIGN(4096): { *(.text) *(.text.*)