Page 1 of 2

C code

Posted: Mon Dec 23, 2002 12:08 pm
by Skywalker
[attachment deleted by admin]

Re:C code

Posted: Mon Dec 23, 2002 12:13 pm
by adeelmahmood1
well so many people are having problems in making IDT including me .. so ill just follow this thread may be this could help me too :)

Re:C code

Posted: Mon Dec 23, 2002 2:16 pm
by jrfritz
Well, my IDT (actually code slashers) is not working fully...but I do see probs with yours.

I'm writing a fix ... but it will not fully work...though...since mine is not working either.

Re:C code

Posted: Mon Dec 23, 2002 2:20 pm
by jrfritz
Some code that partialy works...and hey, code slasher! help! or someone!

http://www.mega-tokyo.com/forum/attachments/uploaded_files/tmpcodenotworking.txt

In that code, at least the GPF works.

Re:C code

Posted: Mon Dec 23, 2002 2:24 pm
by Skywalker
Hi Tom,

thanks for answer.

I do not want a fully IDT set. If you test the code, it halts the PC. I only load a functio for the IRQ1 that prints a text on screen. But it don't I don't know why.

Can post the code you have please?
I don't want you lose time with my problems

thanks.

Re:C code

Posted: Mon Dec 23, 2002 2:28 pm
by jrfritz
You NEED a fully IDT set ::)

Try that code...don't use yours it has probs.

Re:C code

Posted: Mon Dec 23, 2002 2:30 pm
by jrfritz
Actually I ment it has more probs than mine...even though they are almost the same...the main prob with yours is you need a full IDT set and you can't use that IDT array.

Re:C code

Posted: Mon Dec 23, 2002 2:35 pm
by Skywalker
:D

We reply at the same time.


what about the pic remap? and the set IDT function?
do not think me bad, but i don't trust my routines.

thanks

Re:C code

Posted: Mon Dec 23, 2002 2:38 pm
by jrfritz
I don't know about your pic remap....I use ASM code for that.

You should use my SetIDT thing...I tested it and it works...unless yours works...but try mine...

And does my code work?(part way?)

Re:C code

Posted: Mon Dec 23, 2002 2:47 pm
by whyme_t
Tom wrote: you can't use that IDT array.
Tom, are you saying you can't use an Array for the IDT? Is there a reason you shouldn't do it as an array of idt descriptors? Just curious as this is the way I've implemented mine.

Re:C code

Posted: Mon Dec 23, 2002 2:52 pm
by jrfritz
I've tested arrays in the IDT with code slashers code...doesn't work. It doesn't matter to me, though, since I don't need a array.

Now...could someone go to the IRQ thread and help me?

Re:C code

Posted: Mon Dec 23, 2002 3:46 pm
by Skywalker
Hi,

Tom, where is you SETIDT???

As soon I have the IDT working, i'll help you with de IRQs.. if i can.

Thanks

Re:C code

Posted: Tue Dec 24, 2002 1:20 pm
by jrfritz
Here is my LoadIDT (setidt) and remap ints functions...they are in asm:
; For remapping the PIC so the IDT will work correctly in Protected Mode.
; NOTE: This is not enabled to be called in the C++ Kernel.
;REMAP INTERRUPTS 0-15 --> 0x20 - 0x2f
RemapInts:
in al,0x21
mov ah,al
in al,0xA1
mov cx,ax

mov al,0x11
out 0x20,al
out 0xEB,al
out 0xA0,al
out 0xEB,al

mov al,0x20
out 0x21,al
out 0xEB,al

add al,0x8
out 0xA1,al
out 0xEB,al

mov al,0x04
out 0x21,al
out 0xEB,al
shr al,1
out 0xA1,al
out 0xEB,al
shr al,1
out 0x21,al
out 0xEB,al
out 0xA1,al
out 0xEB,al

mov ax,cx
out 0xA1,al
mov al,ah
out 0x21,al
mov ecx,0x1000
cld
picl1: out 0xEB,al
loop picl1

   ; Exit
   ret

; For loading the IDT in the C++ Kernel module.
; C Definition:
; void loadidt(descriptor_reg *idt_ptr);
loadidt:
push ebp   ; Get the descriptor_reg argument
mov ebp,esp
lidt [ebp+8]   ; Load the IDT
mov esp,ebp
pop ebp
      ; Exit
ret

Re:C code

Posted: Fri Dec 27, 2002 1:56 pm
by Slasher
hi,
Tom, in you code you need to disable ints in all interrupt handlers and not just the exception handlers!
So your IRS0 and IRS1 handlers need a CLI right at the start and a STI before you exist.

Re:C code

Posted: Fri Dec 27, 2002 2:03 pm
by jrfritz
Oh...what if a PIT happends then?