this code doesn´t work
*********************************************
struct
{
unsigned short size;
unsigned long *basis;
}__attribute__((packed)) IDTR;
typedef struct
{
unsigned short offset_0_15;
unsigned short selektor;
unsigned char type;
unsigned char leer;
unsigned short offset_16_31;
}__attribute__((packed)) GATE;
void int_null();
void intgate(void *addr,unsigned char num_int,unsigned char type);
void lidt();
void setup_idt();
void int0();
void int1();
void int2();
void int3();
void int4();
void int5();
void int6();
void int7();
void int8();
void int9();
void int10();
void int11();
void int12();
void int13();
void int14();
void int15();
void int16();
void int17();
extern GATE idt[256];
#include "types.h"
void intgate(void *addr ,unsigned char num_int,unsigned char type)
{
unsigned short codesegment=0x10;
idt[num_int].offset_0_15=(unsigned short)(((unsigned long)addr)&0xffff);
idt[num_int].selektor=codesegment;
idt[num_int].type=type;
idt[num_int].leer=0;
idt[num_int].offset_16_31=(unsigned short)(((unsigned long)addr)>>16);
}
void lidt()
{
IDTR.size=2057;
IDTR.basis=0x78;
__asm__("lidt %0": :"m" (IDTR));
}
void setup_idt()
{
int i;
intgate(int0,0,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int1,1,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int2,2,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int3,3,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int4,4,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int5,5,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int6,6,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int7,7,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int8,8,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int9,9,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int10,10,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int11,11,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int12,12,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int13,13,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int14,14,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int15,15,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int16,16,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
intgate(int17,17,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
for (i=18;i<256;i++)
intgate(int_null,i,INTGATE_80386 | SYSTEM | DPL0 | PRESENT);
lidt();
}
void int0()
{
writescreen("Division durch 0 Fault:",0x1f);
while(1);
}
void int1()
{
writescreen("Debug Ausnahme",0x1f);
while(1);
}
void int2()
{
writescreen("unbekannter error",0x1f);
while(1);
}
void int3()
{
writescreen("Unterbrechungspunkt",0x1f);
while(1);
}
void int4()
{
writescreen("Overflow",0x1f);
while(1);
}
void int5()
{
writescreen("hmmmmmm",0x1f);
while(1);
}
void int6()
{
writescreen("Falscher Opcode",0x1f);
while(1);
}
void int7()
{
writescreen("Coprozessor Fault",0x1f);
while(1);
}
void int8()
{
writescreen("Double Fault",0x1f);
while(1);
}
void int9()
{
writescreen("Coprozessor Fault2",0x1f);
while(1);
}
void int10()
{
writescreen("Invalid TSS",0x1f);
while(1);
}
void int11()
{
writescreen("Segment nicht vorhanden",0x1f);
while(1);
}
void int12()
{
writescreen("Stack exception",0x1f);
while(1);
}
void int13()
{
writescreen("General Protection Fault",0x1f);
while(1);
}
void int14()
{
writescreen("Paging fehler:",0x1f);
while(1);
}
void int15()
{
writescreen("Unknown error",0x1f);
while(1);
}
void int16()
{
writescreen("Coprozessor fault3",0x1f);
while(1);
}
void int17()
{
writescreen("critical error",0x1f);
while(1);
}
void int_null()
{
writescreen("intxx:",0x07);
while(1);
}
*************************************************
if i cause the divide 0 error the computer reboots
what must i change that the idt works probably
PLS HELP!!!!!!!!!!!!
[email protected]