Interrupt handler hang

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.
gedd
Member
Member
Posts: 104
Joined: Thu Apr 10, 2008 1:47 am

Re: Interrupt handler hang

Post by gedd »

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 :

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");
	}
When Combuster talk about GTD i checked it, i was fine
I chek my GTD code , fine ---> headache :shock:
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
10 000 points for whose give me the error ;o) :D

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 [-o<
[ Grub 2 | Visual Studio 2013 | PE File ]
The OsDev E.T.
Don't send OsDev MIB !
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: Interrupt handler hang

Post by quanganht »

gedd wrote:
When Combuster talk about GTD i checked it, i was fine
I chek my GTD code , fine ---> headache :shock:
Finaly i discover this in my GTD manager header:

Code: Select all

// Segment type
#define SEGMENT_TYPE_16BIT	0
#define SEGMENT_TYPE_32BIT	0
It should be

Code: Select all

 #define SEGMENT_TYPE_32BIT	1
Right ???

5mm between NUM_1 key and NUM_0 key makes huge difference !
"Programmers are tools for converting caffeine into code."
Post Reply