delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/11/16:27:16

From: "Groman" <groman AT thehelm DOT com>
Newsgroups: alt.os.development,alt.lang.asm,comp.os.msdos.djgpp,alt.os.assembly
Subject: Having troubles with IDT/IRQ0
Lines: 65
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <CXMe4.467$YK4.12132@nnrp3-w.snfc21.pbi.net>
Date: Tue, 11 Jan 2000 13:06:55 -0800
NNTP-Posting-Host: 206.170.7.133
X-Complaints-To: abuse AT pacbell DOT net
X-Trace: nnrp3-w.snfc21.pbi.net 947624802 206.170.7.133 (Tue, 11 Jan 2000 13:06:42 PST)
NNTP-Posting-Date: Tue, 11 Jan 2000 13:06:42 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

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.




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019