Going further with grub

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
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Going further with grub

Post 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.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: Going further with grub

Post 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.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Re: Going further with grub

Post 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)?
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: Going further with grub

Post 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
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Re: Going further with grub

Post 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?
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: Going further with grub

Post 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.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Re: Going further with grub

Post 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!
Attachments
src_files.tar.gz
The source files of the kernel
(10 KiB) Downloaded 74 times
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Going further with grub

Post by Combuster »

You do know that the whole subject is discussed in-depth on the FAQ? Which cases have you checked?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply