Firstly, I wanna give overview of what i have done :
1. I wrote a BootLoader/Bootsector that gives choice to load my OS or other OS and copied that BIN file(512 bytes) onto bootsector (not MBR) of the Active FAT32 partition of my HDD saving the old Bootsector onto spare sectors between 0-62 for normal booting if user selects other OS(XP in my case).
2. If MyOS is selected it loads the SecondStage BootLoader from the same partition.It is 4kb in size and detects hardware and stores that in a struct.
In the same SecondStage Bootloader I want to setup enviroment for Pmode (coz maybe kernel may not fit in less than 1MB) and enable Pmode.
I think I should do this :
a. GDT having 4 descriptors(code/data/stack) for Kernel including NULL.
I will set base=0 and limit=0xfffff for 4GB memory access in all descriptors except NULL,offcourse.
(Intention is to use Flat-Memory Model using Paging.)
b. NO LDT
c. SET CR3 to a physical address of Page-Directory which will contain page table addresses where pages will be mapped to frames linearly, i mean 0 to 0 address, i.e.
No translation for kernel.
d. Remap PIC to invoke 32 or greater interrupt numbers in IDT on firing.
I am confused whether to enter correponding enteries in IDT or let kernel do it?
e. IDT having 32 descriptors(NONE POPULATED).
I am confused whether to populate atleast some or not? Please suggest.
f. Enable A20, Set PE and PG bits.
g. Make a far JMP to flush the que or in other words let the processor units know about that mode has changed.
(I think latter is a better quote.)
h. Load kernel into memory and some part of it will do rest of necessary things like filling of IDT,loading of shell, etc.
Also I am not using QEMU or BOCHS.
Ya Allah,
It is all messed up inside my cranial cavity.
Hope this is a correct way!
