I have little problem, il have make boot disk, and i swap to protected mode.
But i have problem to set timer interrupt.
This is a part of my code C:
Code: Select all
unsigned short irq0_timeout;
struct pIDT
{
unsigned short limite;
unsigned long base;
};
struct IDT
{
unsigned short offset_0_15;
unsigned short selecteurSegment;
unsigned char zero;
unsigned char drapeau;
unsigned short offset_16_31;
};
void enable(void)
{
asm { sti }
}
void disable(void)
{
asm { cli }
}
void activerInterruption( void )
{
unsigned long adresseINT;
unsigned char index;
pointeurIDT.limite = (sizeof (struct IDT) * 256) - 1;
pointeurIDT.base = (unsigned long)&listeIDT;
adresseINT = (unsigned long)handlerIRQ;
for ( index = 0; index < 255; index++ )
{
listeIDT[index].offset_0_15 = adresseINT & 0xFFFF;
listeIDT[index].offset_16_31 = (adresseINT >> 16) & 0xFFFF;
listeIDT[index].selecteurSegment = 0x08;
// Numero du selecteur pour le code
listeIDT[index].zero = 0; // P DLP
listeIDT[index].drapeau = 0x8E; // 1 00 01110
}
// remapping des interruptions
outp( 0x20, 0x11 );
outp( 0xA0, 0x11 );
outp( 0x21, 0x20 );
// Remaps IRQ0-IRQ7 to 0x20-0x27 in interrupt vector table
outp( 0xA1, 0x28 );
// Remaps IRQ8-IRQ15 to 0x28-0x2F in interrupt vector table
outp( 0x21, 0x04 );
outp( 0xA1, 0x02 ); // PIC2 is connected to PIC1 via IRQ2
outp( 0x21, 0x01 );
outp( 0xA1, 0x01 );
outp( 0x21, 0xFE );
outp( 0xA1, 0xFF );
adresseINT = (unsigned long)&pointeurIDT;
asm {
LIDT FWORD PTR adresseINT
}
enable();
}
void handlerIRQ(void)
{
// AX,BX,CX,DX,SP,BP,SI et DI
asm {
PUSHAD
}
disable();
if ( irq0_timeout < 65535 )
irq0_timeout++;
eoi();
enable();
asm {
POPAD
POP EBP
IRET
}
}
void desactiverInterruption( void )
{
disable();
outp( 0x21, 0xFF );
outp( 0xA1, 0xFF );
}
void eoi(void)
{
outp( 0x20, 0x20 );
outp( 0xA0, 0x20 );
}I have add:
Code: Select all
POP EBP
IRETCan you help me ?
I use BCC32 and TLINK32 to compile.
Best regards !


