[OpenBIOS] OpenBIOS dictionary relocation - can anyone explain this?
mark.cave-ayland at siriusit.co.uk
Thu Jan 22 14:40:53 CET 2009
Stefan Reinauer wrote:
> A dictionary is basically a linked list between forth words. When the
> dictionary is created, it lives at some virtual address in userspace,
> but that address might not be the one where it is finally executed. This
> would lead to all the pointers pointing to nirvana. Now, we solved this
> by making the dictionary relocatable. For that we needed to find out
> which words in the dictionary are data, and which are pointers.
> Therefore we compile the dictionary twice and compare the dictionary
> words for differences between the two dictionaries. If they're
> different, it's a pointer and thus needs to be relocated. The relocation
> table is a bit mask with one bit per dictionary word, noting whether a
> relocation is required upon dictionary loading or not. Now, if it is,
> the base address of the dictionary is added to the value so the pointer
> becomes valid again.
Wow. Thanks for this. I found a small reference to the linked-list
directory format on the FUtils page, although it's not easy to find. Am
I right in thinking from the code that the relocation table is appended
at the end of the dictionary in the image file?
Sirius Corporation - The Open Source Experts
T: +44 870 608 0063
More information about the OpenBIOS