My operating system is coming along well and making progress.
I have recently incorporated a GDT function in C as it was originally set in the kernel bootstrap. I can now make entries and update the GDT when necessary.
I have read a *lot* of material on the GDT and my theory of it is fine, I've got it up and running fine but almost every single text written up on it shows you how to set it up, what the structure bytes mean and that's that.
But what do I do with it?
Sure it's the x86 way to protect code and data but what protection am I getting if the code and data segments span all of memory?
I'm guessing I should perhaps shorten the range of the kernel code and data to the lower 16MB of physical memory, and then the rest as user space? Sure this will protect the kernel from user and vice versa, but then what about user programs interfering with user space? Am I correct in saying that if the user and programs are loaded within the same space there is no memory protection? Regardless of the GDT entry because both are able to read and write to the same locations in memory?
So this is leading me to every running program will be assigned it's own GDT entry? I should have a function that calculates the size of the binary then assign it a GDT entry and load it in there? And when the program terminates the GDT entry will be removed "freeing" the memory?
Any help, information or tips will be greatly appreciated.