Page 1 of 1

Going further with grub

Posted: Fri Apr 26, 2013 6:04 pm
by DrHaximus
Hey.
I've managed to use the default gcc and ld to successfully compile and link my test 'kernel' with the Bare Bones tutorial. I've made print functions, newline functions and that sort of stuff.

The problem is, I want to be able to get keyboard input. Although I don't know where to go from here, I've looked at the PS/2 keyboard wiki pages, although I don't know how to use the tables of make/break codes.

If anyone could give me a list (in order) of things I have to set-up or do with my kernel to get to the level where I can start getting keyboard input, I would be very greatful.
Thanks.

Re: Going further with grub

Posted: Fri Apr 26, 2013 6:11 pm
by Mikemk
1) boot.
2) set up environment
3) set up interrupts
4) figure out how you want to handle key presses for your ui/gui.

Re: Going further with grub

Posted: Fri Apr 26, 2013 6:12 pm
by DrHaximus
@m12

"2) set up environment"

That doesn't really help me, I need specifics.
By "set up interrupts" do you mean set up the interrupt table (or something called something similar)?

Re: Going further with grub

Posted: Fri Apr 26, 2013 6:29 pm
by Mikemk
DrHaximus wrote:"2) set up environment"

That doesn't really help me, I need specifics.
That is specific. Set up the environment to however your kernel will expect it. eg, (Brendan, skip to the comma) do you want real mode, protected mode, or long mode? do you want the A20 line enabled? Do you want to use paging or PAE?
By "set up interrupts" do you mean set up the interrupt table (or something called something similar)?
In real mode, IVT
Pmode and lmode, IDT

Re: Going further with grub

Posted: Fri Apr 26, 2013 6:33 pm
by DrHaximus
@M12

Oh.. Thanks. I didn't know that.
But I'm using GRUB, which (to my knowledge) already drops me off in Protected Mode with A20 enabled.

Are you sure I need to set up the IDT alongside GRUB?

Re: Going further with grub

Posted: Fri Apr 26, 2013 7:21 pm
by Mikemk
DrHaximus wrote:But I'm using GRUB, which (to my knowledge) already drops me off in Protected Mode with A20 enabled.
You would be correct. The question is, do you want to stay there.
Are you sure I need to set up the IDT alongside GRUB?
No, actually, you don't have to do anything. If you want to intercept interrupts, you can implement an idt, but if you have no need for error handling (ints 0-31), keyboard/mouse/hard drive/clock/timer/etc, long battery life (see how long your battery lasts with continual polling), etc, nobodies making do an idt.

Re: Going further with grub

Posted: Sat Apr 27, 2013 1:48 am
by DrHaximus
Hey guys.
I hope someone answers this next question, I didn't see the point creating a new topic for it :)

I'm using osdever.net to get the core files for my OS so I can start making the higher level stuff with C. I had to edit a few functions in some of the tutorials to get it to compile (mostly just syntax/typo stuff) and the keyboard/PIT isn't working. Which in turn means the IRQ must not be working.

Everything compiles fine. Nothing errors, and the kernel.c file runs without flaw.

I have attached the source files, please read the

irq.c, irq.h, kb.c, kb.h, timer.c, timer.h and loader.s

which are the files I suspect are the culprits

Thanks!

Re: Going further with grub

Posted: Sat Apr 27, 2013 4:35 am
by Combuster
You do know that the whole subject is discussed in-depth on the FAQ? Which cases have you checked?