C code

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.
Skywalker

C code

Post by Skywalker »

[attachment deleted by admin]
adeelmahmood1

Re:C code

Post 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 :)
jrfritz

Re:C code

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

Re:C code

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

Re:C code

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

Re:C code

Post by jrfritz »

You NEED a fully IDT set ::)

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

Re:C code

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

Re:C code

Post 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
jrfritz

Re:C code

Post 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?)
whyme_t

Re:C code

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

Re:C code

Post 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?
Skywalker

Re:C code

Post 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
jrfritz

Re:C code

Post 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
Slasher

Re:C code

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

Re:C code

Post by jrfritz »

Oh...what if a PIT happends then?
Post Reply