Re: Interrupt handler hang
Posted: Fri May 15, 2009 2:48 am
Hi !
Problem resolved
Thanks for your helps and a big tanks For Combuster who put me on the way
The problem was that interrupt were executed in 16 bits mode as it mentionned in previous post.
Explanation
the way my os run
- step 1 : Boot : asm 16 bits code
- step 2 : Loader : asm 16bits/32 bits PM
- step 3 : Kernel : C++ : 32 bits PM
The loader, load kernel , init GTD, Vesa ...
In my kernel before impliment IDT Manager, i wanted to impliment GTD Manager to be completely clean
So i did it, tested it (badly in fact) and begin work on IDT Manager ... and finaly ask help on OSDEV
here is my code in kernel :
When Combuster talk about GTD i checked it, i was fine
I chek my GTD code , fine ---> headache
Finaly i discover this in my GTD manager header:
10 000 points for whose give me the error ;o)
Like it is recommended by intel , you must do a far jump after loading gtd register, so GTD init return function is not enought.
What happen, the far jump was taken into account at the interrupt jump, at this moment IDT and GDT switch into 16 bits mode and the interrupt hand at iret.
Combuster , your my hero
Problem resolved
Thanks for your helps and a big tanks For Combuster who put me on the way
The problem was that interrupt were executed in 16 bits mode as it mentionned in previous post.
Explanation
the way my os run
- step 1 : Boot : asm 16 bits code
- step 2 : Loader : asm 16bits/32 bits PM
- step 3 : Kernel : C++ : 32 bits PM
The loader, load kernel , init GTD, Vesa ...
In my kernel before impliment IDT Manager, i wanted to impliment GTD Manager to be completely clean
So i did it, tested it (badly in fact) and begin work on IDT Manager ... and finaly ask help on OSDEV
here is my code in kernel :
Code: Select all
video.Init();
video.ClearScreen();
GDTMan.Init(); // GTD Manager : init again in the same way as loader do, so nochange
IDTMan.Init(0x08, &cons); // IDT Manager
[.....]
cons.WriteLine("Int 90");
IDTMan.GenerateInt(90); // work fine without this line
[.....]
int i=1;
cons.SetForeColor(0x00888888);
while(i>0) // infinite loop
{
i++;
cons.Write("i : ");
cons.Write(i);
cons.Write("\r");
}
I chek my GTD code , fine ---> headache
Finaly i discover this in my GTD manager header:
Code: Select all
// segment access
#define RW_READ 0
#define RW_WRITE 1
// Granularity
#define GRANULARITY_NONE 0
#define GRANULARITY_4K 1
// Segment type
#define SEGMENT_TYPE_16BIT 0
#define SEGMENT_TYPE_32BIT 0
// Privilege Level
#define PRIVILEGE_LEVEL_RING0 0
#define PRIVILEGE_LEVEL_RING1 1
#define PRIVILEGE_LEVEL_RING2 2
#define PRIVILEGE_LEVEL_RING3 3
// Descriptor bit
#define DESCRIPTOR_BIT_SYSTEM 0
#define DESCRIPTOR_BIT_CODE_OR_DATA 1
// Desciptor executable
#define EXECUTABLE_DATA 0
#define EXECUTABLE_CODE 1
// memory
#define MEMORY_YES 1
#define MEMORY_NO 0
Like it is recommended by intel , you must do a far jump after loading gtd register, so GTD init return function is not enought.
What happen, the far jump was taken into account at the interrupt jump, at this moment IDT and GDT switch into 16 bits mode and the interrupt hand at iret.
Combuster , your my hero