Page 1 of 1

2 IDT questions

Posted: Sat Oct 26, 2002 7:52 pm
by Tom
I have two IDT questions.

[glow=blue,2,300]1: Can I make and load a IDT while already in PMode?[/glow]

2: Where is a good GAS &/or NASM IDT tutorial?

Thank you,

Re:2 IDT questions

Posted: Sat Oct 26, 2002 7:55 pm
by Tom
:( I have question 1 already answerd. And I can't.

So, because I ran out of room in my boot sector, I need a 2nd and 3rd stage loaders :-[ :-X :-\ Alot of re-programming...

Re:2 IDT questions

Posted: Sat Oct 26, 2002 8:48 pm
by gtsphere
tom,
i have a question, if your normal boot loader ran out of room, then you have to make another one, in essence? I'm obviously guessing you need the room to set up the IDT and stuff, but if you consider it, that wouldn't be too hard, just take the bootloader you have, make it jump to another 'program' then to another, untill you have all the nitty gritty details setup, then load your kernel?? i'm pretty sure that this sounds easier than it is to do, but is that how it could be fix?

Re:2 IDT questions

Posted: Sat Oct 26, 2002 9:08 pm
by Tom
yes. I have a half working 2nd loader.

I think I found the bug to stop my 2nd loader from working.

If you want the code, it will be in the long-delayed Prekernel 0.7

Re:2 IDT questions

Posted: Sat Oct 26, 2002 9:14 pm
by gtsphere
i'm just curious, but where do you load your kernel at?

Re:2 IDT questions

Posted: Sat Oct 26, 2002 9:23 pm
by Tom
right now:

Bootsector: BIOS loaded it at 0x7C00
2nd Stage Loader: Loaded at 1000h
3rd Stage Loader Linked with C Kernel: loaded at 6000h and might change.

Re:2 IDT questions

Posted: Sun Oct 27, 2002 2:10 am
by Ozguxxx
Why do you need a 3rd stage bootloader? I mean you can load a second one and then (since you have all the space u want- I mean enough space) do whatever you need to do there. Why dont you just link your 2nd stage bootloader with c?

Re:2 IDT questions

Posted: Sun Oct 27, 2002 9:21 am
by Tom
well, the 2nd stage loader is 16bit realmode then switches to PMode.

If I linked it with the C kernel it wouldn't work. GCC Code is 32-bit PMode.

So,
Bootsector: Realmode->read disk and go to 2nd stage loader
2nd Stage Loader: Realmode->Read Disk->GDT->PMode->Go To 3rd Stage Loader linked with C Kernel because I have 32-Bit ASM functions that the C Kernel Needs extern.
3rd Stage Loader->C Kernel->FritzOS Booted.

Would you like a diagram? It sounds like alot, and it is sorta alot.

Re:2 IDT questions

Posted: Sun Oct 27, 2002 3:32 pm
by Ozguxxx
At first a had done my kernel in the way you did but I saw that it caused some problems to me. Now I hae only two boot stages and in fact now I am doing in the way as:
BootSector:LoadSecondBootSectorBecauseWeDoNotHaveEnoughSpace->2ndStageThatIsLinkedWithC(DoOtherStuff)
And it works. (In kernel-it cannot be called kernel now- I have both 16 bit assembly code linked with also 32 bit DJGPP code)
I have not read a lot about linking stuff but you have 16 and 32 bit code mixed in your secodbootloader right? So if this does not cause any probelms why should 32 bit DJGPP code linked with 16 bit assembly cause us problems? I did not get any problems when I did this. IN some of your code you have to mix 16 and 32 bit code. Am I wrong?

Re:2 IDT questions

Posted: Sun Oct 27, 2002 3:55 pm
by Tom
Well, I need to have a 16bit loader so I can set PMode.
And I need to do it this way only becuase of PMode, the GDT, and the IDT i am making.

Now, I found a IDT tutorial.

Re:2 IDT questions

Posted: Mon Oct 28, 2002 3:19 am
by Pype.Clicker
Tom wrote: I have two IDT questions.

[glow=blue,2,300]1: Can I make and load a IDT while already in PMode?[/glow]
yes, you can (and you must, in fact ;) wait to be in protected mode to load an IDT, as long as you disable interrupts until it's done.
2: Where is a good GAS &/or NASM IDT tutorial?
I posted a long description on the way i do it last week, but it's rather oriented towards the writing of a good interrupt handler than on the building and loading of an IDT (which trivially consist in setting the good values in a table, then loading the table's address and size in a IDTR structure and perform a LIDT [idtr] operation, if i remember well ...)