OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 7:48 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: idt problems
PostPosted: Tue Apr 08, 2003 1:56 pm 
can someone look at this. when an interrupt occurs the ISR does not get executed and the code acts like an interrupt never occured. this is the second file of my bootloader. the first file is compiled as a binary and this one is compiled in aout format and linked to several functions writen in c. this file is loaded into memory from sector 7 of a floppy disk at 60:0 in real mode. the first bootloader then jumps to 60:0 and this file jumps to my kernel. any help would be appreciated.

Code:
jmp start
;notes:
;this file should be compiled in aout format
;so that 'extern' is available

;-------------------------varaiables---------------------
IDTpntr:
dw IDTend - IDT - 1
dd IDT

;-------------------------idt----------------------------------
IDT:
;int 0:
DW ISR0
DW 0x08   ;code selector
DB 0x00
DB 0x8E
DW 0x00

;int 1:
DW ISR1
DW 0x08   ;code selector
DB 0x00
DB 0x8E
DW 0x00

;int 2:
DW ISR2
DW 0x08   ;code selector
DB 0x00
DB 0x8E
DW 0x00

;int 3:
DW ISR3
DW 0x08   ;code selector
DB 0x00
DB 0x8E
DW 0x00

;int 4:
DW ISR4
DW 0x08   ;code selector
DB 0x00
DB 0x8E
DW 0x00

;int 5:
DW ISR5
DW 0x08   ;code selector
DB 0x00
DB 0x8E
DW 0x00
IDTend:

;----------------------------ISRs------------------------
;----------------------------0---------------------------
ISR0:
pusha
push gs
push fs
push es
push ds

[extern _isr_0]
call _isr_0
pop ds
pop es
pop fs
pop gs
popa
iret

;----------------------------1---------------------------
ISR1:
pusha
push gs
push fs
push es
push ds

[extern _isr_1]
call _isr_1
pop ds
pop es
pop fs
pop gs
popa
iret

;----------------------------2---------------------------
ISR2:
pusha
push gs
push fs
push es
push ds

[extern _isr_2]
call _isr_2
pop ds
pop es
pop fs
pop gs
popa
iret

;----------------------------3---------------------------
ISR3:
pusha
push gs
push fs
push es
push ds

[extern _isr_3]
call _isr_3
pop ds
pop es
pop fs
pop gs
popa
iret

;----------------------------4---------------------------
ISR4:
pusha
push gs
push fs
push es
push ds

[extern _isr_4]
call _isr_4
pop ds
pop es
pop fs
pop gs
popa
iret

;----------------------------5---------------------------
ISR5:
pusha
push gs
push fs
push es
push ds

[extern _isr_5]
call _isr_5
pop ds
pop es
pop fs
pop gs
popa
iret



start:
lidt [IDTpntr]
sti

XOR EBX,EBX
DIV EBX

jmp 0x100000
hlt


Top
  
 
 Post subject: Re:idt problems
PostPosted: Tue Apr 08, 2003 2:30 pm 
MORE INFO:
*********
actually the computer reboots when int 0 occurs and bochs gives this meesage:

00000582862p[CPU ] >>PANIC<< exception(): 3rd (13) exception with no resolution

since the asm file is aout format i link the file to itself:
ld -Ttext 0x600 --oformat binary -o idt.bin idt.o


Top
  
 
 Post subject: Re:idt problems
PostPosted: Tue Apr 08, 2003 4:23 pm 
ok i found my dumbass error but if someone could explain it to me i would appreciate it.

DW 0x0008 != DW 0x08 why?


Top
  
 
 Post subject: Re:idt problems
PostPosted: Tue Apr 08, 2003 5:48 pm 
ok i just found out 0x08=0x0008 but i dont know what my problem was before. it works now. maybe i should set up a forum so that i can talk to myself because it seems to help.........


Top
  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 2:25 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
i have a nice command line that do the trick :
edit project.log :D

And true, it helps... even talking it to the cat can force you to express your problem -- which holds the solution in 90% cases ...
It seems it make you break the "whatthehellisgoingon" brain loop the keyboard/screen/mouse seems to produce :)

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 2:35 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 11:59 am
Posts: 1600
Location: Vienna/Austria
I often find solutions to tricky problems during watching me brushing teeth in the morning. Those but so tricky problems then turn out to be due to false statements and so forth .. the usual crap programmers are doomed to.

as for your problem with word and double word (in asm: db,dw)

a word is just one byte. i.e. 0x08

a double word is two bytes: 0x0008.

to make it funny: a nibble is half a byte.

_________________
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image


Top
 Profile  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 3:16 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
beyond infinity wrote:
to make it funny: a nibble is half a byte.


hehe :) got caught at your own game :p the correct spelling is a "nybble"

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 3:44 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 11:59 am
Posts: 1600
Location: Vienna/Austria
:-* you are a habibi, pype ;D

ps: *shrugs* Found that weird spelling "nibble" in a book about programming asm on c64 ab't 14 years ago.

_________________
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image


Top
 Profile  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 10:06 am 
IMHO the 'nybble' spelling is naff. I always use 'nibble'.


Top
  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 10:22 am 
Tim Robinson wrote:
I always use 'nibble'.

Same for me.


Top
  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 11:46 am 
They are both correct synonyms for each other - so in this case everyone is right.


Top
  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 1:04 pm 
everyone is wrong. its nyble


Top
  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 1:12 pm 
Offline
Member
Member

Joined: Wed Oct 18, 2006 11:59 am
Posts: 1600
Location: Vienna/Austria
you must be kidding :P

_________________
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image


Top
 Profile  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 1:32 pm 
Your idtr is setup wrong. IDTR: dw size, dd address
but the address has got to be added to the base. So just IDT wont work. Try: mov bx,cs add bx,IDT mov [idtr + 2],bx. If ur planning to use pmode, then mov bx,cs shl ebx,4 mov [idtr + 2],ebx. :) :)


Top
  
 
 Post subject: Re:idt problems
PostPosted: Wed Apr 09, 2003 1:34 pm 
Also, im not sure but i dont thnk 0x8E is for exeptions. Check the intel manual. Try a regular interrupt like int 0x20 insted of an exeption.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot] and 230 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group