idt problems

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
slacker

idt problems

Post by slacker »

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: Select all

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
slacker

Re:idt problems

Post by slacker »

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
slacker

Re:idt problems

Post by slacker »

ok i found my dumbass error but if someone could explain it to me i would appreciate it.

DW 0x0008 != DW 0x08 why?
slacker

Re:idt problems

Post by slacker »

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.........
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:idt problems

Post by Pype.Clicker »

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 :)
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:idt problems

Post by distantvoices »

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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:idt problems

Post by Pype.Clicker »

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"
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:idt problems

Post by distantvoices »

:-* 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
Tim

Re:idt problems

Post by Tim »

IMHO the 'nybble' spelling is naff. I always use 'nibble'.
Whatever5k

Re:idt problems

Post by Whatever5k »

Tim Robinson wrote: I always use 'nibble'.
Same for me.
_mark

Re:idt problems

Post by _mark »

They are both correct synonyms for each other - so in this case everyone is right.
slacker

Re:idt problems

Post by slacker »

everyone is wrong. its nyble
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:idt problems

Post by distantvoices »

you must be kidding :P
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
shadrak

Re:idt problems

Post by shadrak »

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. :) :)
shadrak

Re:idt problems

Post by shadrak »

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.
Post Reply