By now i am done with second stage bootloader and am ready to load kernel.
BUT i am not sure about GDT entries like:
1. 1 null, 1 ring0 code, 1 ring0 data, 1 ring3 code, 1 ring3 data BUT how many TSS?
2. When i am in Second stage bootloader i need to access BPB of BootSector, is there any mechanism where from i can get this structure without loading bootsector again as it is alredy available in memory? Yes, pointing to memory locations but i need to calculate these values and use hardcore statements like
BPB_BytesPerSector equ 7c00h+oxb
Is there any other way that can be used?
3.Well right now in Second stage bootloader i have switched to protected mode but have declared a common handler for exceptions, how to use proper routines is easy but how to get address of IDT structure declared in Second Stage bootloader, like above
Please, reply me soon?
GDT Entries, Help?
Re: GDT Entries, Help?
One on each processor.Raven wrote:1. 1 null, 1 ring0 code, 1 ring0 data, 1 ring3 code, 1 ring3 data BUT how many TSS?
It is your decision. For example, save BPB at 0x500 or at 0x7C00. The better way is DO NOT to transfer BPB at all. Boot device number is enough for this.Raven wrote:2. When i am in Second stage bootloader i need to access BPB of BootSector, is there any mechanism where from i can get this structure without loading bootsector again as it is alredy available in memory? Yes, pointing to memory locations but i need to calculate these values and use hardcore statements like
BPB_BytesPerSector equ 7c00h+oxb
Is there any other way that can be used?
sidt ?Raven wrote:3.Well right now in Second stage bootloader i have switched to protected mode but have declared a common handler for exceptions, how to use proper routines is easy but how to get address of IDT structure declared in Second Stage bootloader, like above...
If you have seen bad English in my words, tell me what's wrong, please.
- gzaloprgm
- Member
- Posts: 141
- Joined: Sun Sep 23, 2007 4:53 pm
- Location: Buenos Aires, Argentina
- Contact:
Re: GDT Entries, Help?
Depends of if you want to use Hardware or Software Multitasking. If you want to use Hardware, you'll need one TSS per process. Otherwise you only need one, to hold the value ESP and SS will get after a Ring3 to Ring0 switch.1. 1 null, 1 ring0 code, 1 ring0 data, 1 ring3 code, 1 ring3 data BUT how many TSS?
Well, if your second stage loader is loader just above the first sector (0x7C00+512), then you could merge both files into the same .asm and reference symbolically to the values.2. When i am in Second stage bootloader i need to access BPB of BootSector, is there any mechanism where from i can get this structure without loading bootsector again as it is alredy available in memory? Yes, pointing to memory locations but i need to calculate these values and use hardcore statements like
BPB_BytesPerSector equ 7c00h+oxb
Is there any other way that can be used?
I don't think the 2º stage bootloader should have that. The bootloader expects the kernel to be a valid file. And if some exception happens in pmode while in the second stage (before jumping to the kernel), it's probably a bug in your code.3.Well right now in Second stage bootloader i have switched to protected mode but have declared a common handler for exceptions, how to use proper routines is easy but how to get address of IDT structure declared in Second Stage bootloader, like above
Cheers,
Gonzalo
Visit https://gzalo.com : my web site with electronic circuits, articles, schematics, pcb, calculators, and other things related to electronics.