IDT exception 6
-
slacker
IDT exception 6
i was wondering if anyone else had the same problem as me. when i load IDT, remap PICs, and enable interrupts i always get this error (exception 6: invalid opcode). i have been workin on this problem for about a week now and if anybody knows how to fix this or what it is caused by please tell me. thank you
-
slacker
Re:IDT exception 6
ok i decided to start over with my IDT cause i had so many problems. how does this code look?
Code: Select all
[bits 32] ;workin in pmode
[global setupIDT] ;for linker to recognize
[extern _main]
;---variables---
ISR0 dd ISRaddr000
ISR1 dd ISRaddr001
ISR2 dd ISRaddr002
ISR3 dd ISRaddr003
ISR4 dd ISRaddr004
ISR5 dd ISRaddr005
ISR6 dd ISRaddr006
ISR7 dd ISRaddr007
ISR8 dd ISRaddr008
ISR9 dd ISRaddr009
ISR10 dd ISRaddr00A
ISR11 dd ISRaddr00B
ISR12 dd ISRaddr00C
ISR13 dd ISRaddr00D
ISR14 dd ISRaddr00E
curISR DD 0x00
curDES DD 0x00
;---IDT register information---
IDTpntr:
IDTlim dw IDTend - IDT - 1 ;limit
IDTbase dd IDT ;base
;---IDT---
IDT:
;---descriptor format---
%rep 256
dw 0x00 ;low offset
dw 0x08 ;code selector
db 0x00 ;always zero
db 0x8E ;descriptor settings
dw 0x00 ;high offset
%endrep
IDTend:
;---split 32bit addr into 2 words---
fixOFFSETS:
MOV ECX, 15
doIT:
call zeroREGS
MOV EAX, [curISR]
MOV EBX, [curDES]
PUSH EAX
AND EAX, 0xFFFF
MOV word [EBX], AX
POP EAX
INC EBX
INC EBX
INC EBX
INC EBX
INC EBX
SHR EAX, 16
MOV word [EBX], AX
INC EBX
INC EBX
MOV [curDES], EBX
INC dword [curISR]
loop doIT
ret
zeroREGS:
XOR EAX, EAX
XOR EBX, EBX
ret
;---start code---
setupIDT:
MOV dword [curISR], ISR0
MOV dword [curDES], IDT
call fixOFFSETS
lidt [IDTpntr]
sti
call _main
endit:
jmp endit
;---ISRs---
ISRaddr000:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr001:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr002:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr003:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr004:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr005:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr006:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr007:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr008:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr009:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr00A:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr00B:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr00C:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr00D:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
ISRaddr00E:
PUSHA
PUSH DS
PUSH ES
PUSH FS
PUSH GS
POP GS
POP FS
POP ES
POP DS
POPA
iret
-
distantvoices
- Member

- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:IDT exception 6
starting from which index do you patch the entries of the idt?
Do you increment the current adress of the idt by 8 to point to the next idt entry? I can't find it or I am blind. You have to crawl through your IDT starting from the beginning and by each loop increment the adress pointing into it by 8 bytes.
When you do this in C, it's some what more bytes in your binary, but it is much more comprehensive - and you easy can use pointer arithmetics.
Do you increment the current adress of the idt by 8 to point to the next idt entry? I can't find it or I am blind. You have to crawl through your IDT starting from the beginning and by each loop increment the adress pointing into it by 8 bytes.
When you do this in C, it's some what more bytes in your binary, but it is much more comprehensive - and you easy can use pointer arithmetics.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
-
slacker
Re:IDT exception 6
ok i found one of the problems i didnt increment EBX enough so the alignment was off but it still doesnt work.
i just added an extra INC EBX in there with all those other INC EBX commands. btw "BEYOND INFINITY", when i INC EBX im moving down a single byte in my IDT.
i just added an extra INC EBX in there with all those other INC EBX commands. btw "BEYOND INFINITY", when i INC EBX im moving down a single byte in my IDT.