IDT

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

IDT

Post by eL JeDi »

[attachment deleted by admin]
K.J.

Re:IDT

Post by K.J. »

I suggest that you create small asm ISRs that call C functions as needed.

Remember to save(via push) and before you iret(pop) any registers that you modify at all including eax, ebx, etc.

K.J.
eL JeDi

Re:IDT

Post by eL JeDi »

Hi KJ,

Have you got any code that i can see? I will try this now.

Thanks
Ozguxxx

Re:IDT

Post by Ozguxxx »

Hi, I've just looked at the source code but (If I am not wrong) I could not see where interrupts are set after ints are remapped, I don't know id this is causing problem but in your init_pic function you should enable interrupts... (Am I wrong?) Also Do you have to send disable interrupts to both PICs? I think one is master and one is slave so only disabling master solves disabling both... I might be wrong about this. But a good question, isnt it? Good luck...
K.J.

Re:IDT

Post by K.J. »

Sure...

[tt]
_int60:
   cli
   push eax
   push ebx
   push ecx
   push edx
   push ebp
   push edi
   push esi
   push es
   push ds
   push fs
   push gs

   mov eax, 0
   mov gs, eax
   mov fs, eax
   mov eax, _LINEAR_DATA_SEL
   mov es, eax
   mov ds, eax

   extern _c_int60
   call _c_int60

   pop gs
   pop fs
   pop ds
   pop es
   pop esi
   pop edi
   pop ebp
   pop edx
   pop ecx
   pop ebx
   pop eax
   sti
   iretd

void c_int60()
{
//do whatever
};
[/tt]

Hope that helps,
K.J.
eL JeDi

Re:IDT

Post by eL JeDi »

Here I am again.

I've tried the ISR, but it doesn't works.

the asm file:

global irq1
extern key_press

irq1:
cli
pusha
call key_press
popa
sti
iretd

the C file:

extern void irq1();

void key_press(void)
{
   printf("IRQ1_WORKS!\n");
   outportb(0x20, 0x20);

}
void start()
{
   dir_reg idt;

   int ai;

   textmode();
   ClrScr();
   Ini_pic();
   asm("sti");
   printf("Booting a my OS\n");

   idt.limit=8*256-1;
   idt.base=0x00000600;

   set_idt(&idt);
   set_irq(1,irq1);

   asm("hlt");

}

the rest of the C file is the same..

K.J. I've tried the one that you have posted too, with the same results.

Ozguxxx sorry, but I'm afraid i dont understand you.

Thanks once again.
Ozguxxx

Re:IDT

Post by Ozguxxx »

Hi. I have a suggestion (only suggestion :) ): It would be easier to write all stuff in asm first. I mean KJ's first code which has an assembly stub calling a C function is (I think) the best way to get things work for beginning.
I want to ask a question: Which #ed isr routine are you trying to handle for getting keyboard keys?
BTW your ints.h file is fairly complicated for me... :o
eL JeDi

Re:IDT

Post by eL JeDi »

Hi,

I've tried this too, without any result.

The function that the IRQ1 should call is Key_press(); a simple printf function that show on the screen "Key Press".

Has anyone a complete working code about the IDT??? can you post it please??. I think it has to be something simple.. but I don't know what.

I spended so meny weeks with this.. and i'm becoming crazy.
K.J.

Re:IDT

Post by K.J. »

I'm working on an interrupts tutorial ATM. I'll email you the "beta" of it ASAP.

I have complete, working IDT code, but I do some stuff that most people think is weird in it so that I get it where I want and just how I want. Email me if you want it though.

K.J.
eL JeDi

Re:IDT

Post by eL JeDi »

Hi KJ

I send you an email. I want de beta version and the code.
Thanks for all.
Post Reply