2 IDT questions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Tom

2 IDT questions

Post 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,
Tom

Re:2 IDT questions

Post 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...
gtsphere

Re:2 IDT questions

Post 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?
Tom

Re:2 IDT questions

Post 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
gtsphere

Re:2 IDT questions

Post by gtsphere »

i'm just curious, but where do you load your kernel at?
Tom

Re:2 IDT questions

Post 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.
Ozguxxx

Re:2 IDT questions

Post 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?
Tom

Re:2 IDT questions

Post 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.
Ozguxxx

Re:2 IDT questions

Post 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?
Tom

Re:2 IDT questions

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:2 IDT questions

Post 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 ...)
Post Reply