eulex icon indicating copy to clipboard operation
eulex copied to clipboard

Another question to keep it going

Open dotmilk opened this issue 7 years ago • 2 comments

First thanks for this wonderful bit of code. I must admit I'm a tad lost when it comes to how the builtin files get into the image, I see you concating all the paths to the various .fs files and then including them with #include "BUILTIN-FILES.S". I am unsure by what means their contents end up assembled into the kernel / as theri dictionary entries are just of the form BUILTIN_WORD_NAME(__core_fs, "@core.fs") which suggests to me they exist as a word __core_fs in the dictionary, but what that word does or how the whole file gets into the image is beyond me.

I'm more of a nasm kind of guy and not the best at it or reading gas and not realizing if I'm missing a directive or something. So any sort of elucidation would be greatly appreciated.

dotmilk avatar Jul 31 '18 15:07 dotmilk

The files are included as text into the image. __core_fs is added by the linker, and it is the address of such a content in the image. We just give a convenient name to it @core.fs, so we can load it with require for example. (which will initialize the interpreter in that buffer).

Look at this rule from the GNUmakefile:

%.o: %.fs
	objcopy -I binary -O elf32-i386 -Bi386 $< $@

So, there is no cross-compilation at all. forth.S will start interpreting all those built-in files.

Does it help?

davazp avatar Jul 31 '18 22:07 davazp

Ahhh having followed it into core.fs now it makes much more sense. Thank you.

dotmilk avatar Aug 01 '18 05:08 dotmilk