Message board for the users of flat assembler.
> OS Construction > IDT... this big wall!
Nikso 12 Jul 2004, 20:41
Finally I've reopen my OS project folder! ^_^ I've successfully start the protect mode with also vesa mode. I'm just starting to implement the multitasking but...
1. My bootloader initialize the PMODE so, somewhere after 0x7C00 there are the GDT.
2. My kernel is loaded at 0x10000 with ESP=0x90000
3. I load IDT dynamically and directly after the GDT in this way:
... MOV EAX,[IDTAddr] ; IDTAddr = GDTAddr + GDTLen MOV [IDT.Addr],EAX MOV [IDT.Size],(0x20*8)-1 ... some SetDescriptor calls ... LIDT [CS:IDT] FUNC SetDescriptor, IntNum,Selector,Offset,Privilege,Present BeginF PUSH EDX PUSH EAX ; Get memory zone MOV EDX,[IntNum] SHL EDX,3 ADD EDX,[Kernel.Interupts.Data.IDT.Addr] ; set selector MOV EAX,[Selector] MOV [EDX+2],AX ; set offset MOV EAX,[Offset] MOV [EDX],AX SHR EAX,16 MOV [EDX+6],AX ; Set flags MOV EAX,[Present] AND EAX,1 SHL AL,2 OR AL,BYTE [Privilege] AND EAX,7 SHL AL,5 OR AL,00001110b MOV [EDX+4],AX POP EAX POP EDX EndF
I've try to set all the 0x20 exceptions interrupts.
I've also try a non-dynamic way (even if in fast manner).
And I'm quite sure that the function below works.
In any cases LIDT instruction work, but if I try to generate an exception (div 0) bochs go in BIOS panic.
So, IDT generation should be ok. What could be the problem?
Anyone can explain me how to correctly initialize interrupts????
|12 Jul 2004, 20:41||
Octavio 12 Jul 2004, 23:41
is your kernel code 32 bit and org=10000h cs=0 ds=0 ?
|12 Jul 2004, 23:41||
Nikso 13 Jul 2004, 08:07
well, org=10000h but cs=0x08 and ds=0x10 because the global descriptor table is already in use...
|13 Jul 2004, 08:07||
Nikso 13 Jul 2004, 15:02
I've try to define the IDT just in the bootloader and... it works!
But, if I leve it there and try to fill an entry with a handler defined in the kernel (after 0x10000) it doesn't work...
So maybe is because the hight part of the offset in the IDT entry is not 0 (is should be 0x0010 at least) and I don't enter it correcly... dunno
What about the function above? Do it generate a correct IDT item?
|13 Jul 2004, 15:02||
Nikso 13 Jul 2004, 15:55
What can I say...
It was only a stupid mistake with the above function:
; Set flags MOV EAX,[Present] AND EAX,1 SHL AL,2 OR AL,BYTE [Privilege] AND EAX,7 SHL AL,5 OR AL,00001110b SHL EAX,8 ;<-- ------------ damn!!! MOV [EDX+4],AX
Exactly 1 day for find out a stupid mistake and 1 useless post
Whell... thanks in any cases ^_^
|13 Jul 2004, 15:55||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.