From: "Groman" Newsgroups: alt.os.development,alt.lang.asm,comp.os.msdos.djgpp,alt.os.assembly References: Subject: Re: Having troubles with IDT/IRQ0 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: <_1Qe4.581$6Q4.15708@nnrp2-w.snfc21.pbi.net> Date: Tue, 11 Jan 2000 16:38:32 -0800 NNTP-Posting-Host: 206.170.6.189 X-Complaints-To: abuse AT pacbell DOT net X-Trace: nnrp2-w.snfc21.pbi.net 947637498 206.170.6.189 (Tue, 11 Jan 2000 16:38:18 PST) NNTP-Posting-Date: Tue, 11 Jan 2000 16:38:18 PST Organization: SBC Internet Services To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com sorry, forgot to mention: #define _pack __attribute__ ((packed)) Groman wrote in message news:CXMe4.467$YK4 DOT 12132 AT nnrp3-w DOT snfc21 DOT pbi DOT net... > Could somebody please tell me if the following bits and pieces are correct > and do what I want(99% chance the problem is elseware, but I want to make > sure > these pieces are which work) > I've been starring into this code for about 16 hours now, and I think I am > missing something obvious: > The computer reboots as soon as I enable the interrupts(IRQs are shifted to > 0x20 and are all masked but 0x2 and 0x0(code from Linux 2.0 source)) > > Bochs panics saying > interrupt(): gate descriptor is not valid sys seg > > > > I am using djgpp with nasm... > > > is this a correct IDT entry? > struct IDTDesc > { > unsigned short OffSet1 _pack; // Offset > unsigned short Selector1 _pack; // Segment selector > unsigned short Flags _pack; // Flags > unsigned short OffSet2 _pack; // Rest of the offset > } _pack; > > is this the correct way to setup the IDT(statically) > > IDTDesc IDT[256]; > > > is this the correct way to change interrupt 0x20 to handler IRQ0Handler: > > unsigned long int offset = (unsigned int)(void *)&IRQ0Handler; > DisableInt(); > > IDT[0x20].OffSet1 = (offset&0xFFFF); > IDT[0x20].OffSet2 = (offset>>16); > IDT[0x20].Flags = 0x8E00; > IDT[0x20].Selector1 = 0x8; > > will this work as an interrupt handler? > > _IRQ0Handler: > push eax > push edx > > > mov dx,0x20 > mov al,0x20 > out dx,al > > inc word [0xb8000] > > pop edx > pop eax > iret > > sincerely, groman > > thank you in advance. > > > > >