delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/11/23:56:34

From: "Groman" <groman AT thehelm DOT com>
Newsgroups: alt.os.development,alt.lang.asm,comp.os.msdos.djgpp,alt.os.assembly
References: <CXMe4.467$YK4 DOT 12132 AT nnrp3-w DOT snfc21 DOT pbi DOT net>
Subject: Re: Having troubles with IDT/IRQ0
Lines: 80
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: <HCTe4.611$6Q4.18110@nnrp2-w.snfc21.pbi.net>
Date: Tue, 11 Jan 2000 20:42:30 -0800
NNTP-Posting-Host: 206.170.7.101
X-Complaints-To: abuse AT pacbell DOT net
X-Trace: nnrp2-w.snfc21.pbi.net 947652135 206.170.7.101 (Tue, 11 Jan 2000 20:42:15 PST)
NNTP-Posting-Date: Tue, 11 Jan 2000 20:42:15 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

Never mind....I found the bug...I can't beleive how stupid I was.
I wrote a function to setup the IDT, but didn't call it from the main kernel
code..
no wonder it didn't work...:)





Groman <groman AT thehelm DOT com> 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.
>
>
>
>
>


- Raw text -


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