One thinkg about testing and another ...

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
Willy

One thinkg about testing and another ...

Post by Willy »

Just some info:

My C++ -Kernel currently has cout (output), GDT , IDT etc. For loading I use GRUB. :)

Now the first question: How can I test that my GDT and IDT are working the way that they should? ::)

Second: IF (A very big if), my IDT is working, how does input happen? (In this case It would be cin)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:One thinkg about testing and another ...

Post by Pype.Clicker »

1) you can use INT nn assembly opcode to force an interrupt call. If your handler replied, then it's more likely that your IDT is fine.
2) you can test exceptions with code like "mov eax,0 ; idiv eax,eax,eax", "mov ax,0 ; mov gs,ax ; mov ax,[gs:ax]" ...
3) you can STI so that you'll start receiving harware IRQs (IRQ0 for timer for instance, which will be raised every 18.2th of second if you didn't reprogram the PIT)

And for the cin,

[IRQ1Handler] --scancode--> [ASCIIDecoder] --ascii char-->[inputbuffer]

Then, notify the thread owning the inputbuffer it has received some datas (this can just be stdin_hasdata++ if you're not multithreading yet ...)

And the user program will do

Code: Select all

volatile extern int stdin_hasdata;
getc {
  while (!stdin_hasdata);
  stdin_hasdata--;
  return stdin_buffer[stdin_readnext++];
}
Post Reply