Lately, I was developing other stuff in my kernel - but for some reasing GRUB denied loading my kernel due to relocations (the kernel relocated itself later on, and yah all kernel modules, including the main one are position-independent). Hence, I decided my kernel was complex enough, that it deserved a initializer module. The initializer module, being a static, non-relocation requiring binary, was loaded at the 1 MB mark instead of the kernel (main module, named KernelHost). It loaded the other modules, (at a physical address, but relocated at virtual addresses above 3 GB mark), relocated them, passed symbol-tables, hash-tables, string-tables, and so on to the KernelHost.
Now, everything works fine - functions are callable. I map the interrupt hooks (ISRs) to the IDT, then load it. To test whether a interrupt works:
Code: Select all
int $0x21
Code: Select all
??? physical address not found # or available, don't remember, as I am on another PC
1. Called the interrupt hook from the code (there is a while loop before the IRET instruction) - yep, it works! That means it is paged, and physical address should be available.
2. I also debugged the whole IDT - everything was at its place. Entries left filled with zeros were as is - and filled entries where correct - segments, DPL, and so on.
3. Even the GDT selectors were correct - CS:0x8, DS:0x10.
What could possibly be wrong with the kernel? Note that, before the initializer module was present it was working. The kernel is now loaded at 16-MB (on the VM I am testing, but the initializer module loads it wherever it wants to). That is the only change with the module which loads the IDT (Hardware Abstraction Layer module).