ISR Problem

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
dilipcs1992
Posts: 5
Joined: Sat Dec 03, 2011 8:58 am

ISR Problem

Post by dilipcs1992 »

Hi Everyone
i'm developing a os in fasm assembly language using grub
i've printed the string on the screen, and set my own GDT and IDT and defined ISR
every thing works fine, whe i call interup, interupt is triggered and i get message on screen
but problem is if i don't call any interupt also my os throwing Double Fault Exception, please help!
Thanks in Advance
User avatar
brain
Member
Member
Posts: 234
Joined: Thu Nov 05, 2009 5:04 pm
Location: UK
Contact:

Re: ISR Problem

Post by brain »

Its broken. :lol: e.g. damned if I know, you need to debug more and/or give more information afterwards.
dilipcs1992
Posts: 5
Joined: Sat Dec 03, 2011 8:58 am

Re: ISR Problem

Post by dilipcs1992 »

berkus wrote:There's a bug in your code.
Where could be the Bug
I mean if,GDT not defined properly we get Double Fault Error
so what could be cause of Double Fault Eception GDT,IDT or ISR

sample of my os code

Code: Select all

; Global Descriptor Table (GDT)

InstallGDT:
        cli                                                                                                                                     ; clear interrupts
        pusha                                                                                                                           ; save registers
        lgdt    [GDT]                                                                                                           ; load GDT into GDTR
        sti                                                                                                                                     ; enable interrupts
        popa                                                                                                                            ; restore registers
        ret                                                                                                                                     ; All done!
        
GdtData: 
        dd              0                                                                                                                       ; null descriptor
        dd              0

        dw              0FFFFh                                                                                                          ; limit low
        dw              0                                                                                                                       ; base low
        db              0                                                                                                                       ; base middle
        db              10011010b                                                                                                       ; access
        db              11001111b                                                                                                       ; granularity
        db              0

        dw              0FFFFh                                                                                                          ; limit low
        dw              0                                                                                                                       ; base low
        db              0                                                                                                                       ; base middle
        db              10010010b                                                                                                       ; access
        db              11001111b                                                                                                       ; granularity
        db              0
EndOfGdt:

GDT: 
        dw              EndOfGdt - GdtData - 1                                                                          ; limit (Size of GDT)
        dd              GdtData     

;Interupt Descriptor Table

InstallIDT:
        cli
        pusha
        lidt    [IDT]
        sti
        popa
        ret
        
IdtData:

        dw              (isr0 and 0FFFFh)
        dw              00001000b
        db              0
        db              10001110b
        dw              (isr0 shr 16) and 0xFFFF

        dw              (isr1 and 0FFFFh)
        dw              00001000b
        db              0
        db              10001110b
        dw              (isr1 shr 16) and 0xFFFF    
EndOfIdt:

IDT:
        dw              EndOfIdt - IdtData - 1
        dd              IdtData 

macro isrStub errmsg
{
   pusha
   push ds
   push es
   push fs
   push gs
   mov ax, 0x10
   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   mov eax, esp
   push ebx
        mov ebx,errmsg
        call Puts
        mov ebx,er
        call Puts
        hlt
   pop ebx
   pop gs
   pop fs
   pop es
   pop ds
   popa
   add esp, 8
   iret
}   

isr0:
   cli
   isrStub err0
isr1:
   cli
   isrStub err1  

er     db              'Exception System Halted!',10,0
err0    db             'Division By Zero',10,0
err1    db             'Debug',10,0
Last edited by dilipcs1992 on Fri Apr 06, 2012 6:35 am, edited 2 times in total.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: ISR Problem

Post by bluemoon »

You provided none information on the issue.
Do you really want us to just wild guess on it? If so, okay I guess there is un-handled interrupt elsewhere.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: ISR Problem

Post by Combuster »

It's a crystal ball.
It insists on predicting 90% cloud coverage.

The rest of the time it says "wrong forum"
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: ISR Problem

Post by JAAman »

i added code tags to your post, please do this yourself in the future

as for your problem, you first need to do a little investigating yourself, to at least find out where the problem is occurring, and then, if you still need help, give more information (the more the better -- most people here won't help someone who doesn't show that they tried to solve it themselves first) and relevant code (preferably the code that actually causes the error to appear, other things may be important, but at least start there)

for your own work: start by finding out exactly what your code does, and where it causes the problem, then look in the intel manuals:

intel 3A:5.14 for a list of reasons why that particular exception can occur

intel vol. 2 for the offending instruction to find which exceptions it can cause and why

for #DF i would recommend the former (since #DF is caused by something going wrong while fetching another exception handler, rather than caused directly by execution of an instruction)
Post Reply