after a bunch of days spent reading the intel manuals and learning on how segmentation works in pmode, I managed to set a correct gdt and enter prot mode, now I am in front of a big question mark....
How does a C program know where it is located?
Ok that can sound a strange question, let me explain in a few steps what I want to do:
1) I created a LBR that looks in my fat16 disk (image) for a file called BOOT.BIN
2) BOOT.BIN enables a20, saves the bios memory map, sets a gdt and enables pmode.
3) Then, it should load my C kernel from the disk image using a small driver written on the fly for the occurrence.
But imagine a unuseful kernel like this:
Code: Select all
void main()
{
goto hello;
(2 megabytes of space here)
hello:
other_code();
}
Something to do with the loader?
(Hope you're able to understand what I tried to explain..)
EDIT: maybe "paging" is the answer?