Page 1 of 1

C++ Kernel

Posted: Sat Feb 28, 2004 8:28 pm
by Jankins
I was just wondering with a C++ kernel to get it to Display Some words e.g.

"Welcome To MyOs"

Would u use cout<<"Welcome To MyOs";

or Something else?
and when I type

ld kernel.o -o kernel.bin -oformat binary -Ttext 0x100000

It comes up with a error saying No Such Dirrectory (I am using linux) is there a different way to link kernel.o?

And Could some one plz type a baisc VERY VERY basic OS in like a template to work on, with nothing in it but Hello world sorta thing, if not don't worrie about it.

Re:C++ Kernel

Posted: Sun Feb 29, 2004 3:50 am
by Solar
Jankins wrote: Would u use cout<<"Welcome To MyOs";

or Something else?
cout - just like printf() - is part of the standard library. When writing a new kernel, you do not have a standard library at your disposal, until you either implement one yourself or port an existing one to your kernel.

Also, both cout and printf() write to standard output - which is set up by the C runtime environment. Your kernel, however, is not started by a C runtime, so you do not have a standard output.

The traditional way is to implement a scaled-down kprintf() (or kout) which can do basic output by writing directly to video memory.
And Could some one plz type a baisc VERY VERY basic OS in like a template to work on, with nothing in it but Hello world sorta thing, if not don't worrie about it.
Find attached a very early implementation of my own "testing" kernel. It might actually not compile correctly, as this is a snapshot of my working directory instead of a repository snapshot - I'm in the midst of a reinstallation of my machine.

It requires GRUB to boot the kernel, and does nothing but printing some data from the GRUB multiboot header to screen.

[attachment deleted by admin]