Oh! I get it!
So after getting to the point that I really needed to implement some sort of memory management, I eventually started reading about paging. I then went back to
Higher Half Bare Bones and thought about it quite a bit... My next task is to write a simple do-nothing kernel just to fix what I wrote about above to make sure I understand completely.
But I do have a question, and it's more of a verification I'm looking for from you more experienced folks.
It should be possible to do the higher-half kernel using 4k pages instead of the 4MB page, without setting the PSE bit of CR4, as long as I map enough 4k pages to encompass my entire kernel. Correct?
Also - the way the higher-half bare bones is written, the video buffer would appear at 0xC00B8000, right?
I could leave the first meg of memory identity mapped (instead of unmapping it in the example) and still access it (and probably the multiboot information if the bootloader doesn't put it above 0x100000) as I normally would (e.g. 0xb8000)?
However, applications written for an OS that does this would need to be aware of it - The first meg is off-limits for their use.
Unless... each application or process would need its own page directory/table in order to separate it's memory from other processes. That other page directory/table could have other pages of physical memory mapped to the first meg, so then they would be able to access it as if it were their own without conflicting with video RAM and other ROM stuff. ?
These other processes' page directory/table would need to have at least some pages mapped to the kernel to be able to call kernel APIs and such. Which is now why I think task gates are probably useful, to switch tasks (and the page tables in use) to the kernel's... Is this correct also?
Would the IDT also need to have task gates (or the equivalent) when an exception is generated that would require a switch to the kernel's code, if the kernel weren't mapped into the applications memory space?
I'm now assuming that the best implementation (or at least the easiest) is to have the kernel's memory space mapped into the application's memory space to avoid all this confusion, at least to begin with.
Anyway... I've used this message to kind of organize my own thoughts on the subject, and I would like feedback on where I may be right or wrong.
Thanks!
Steve