Page 1 of 1
Example OS written in C++??
Posted: Sat Jan 06, 2007 3:17 am
by Scalpel
Are there any OS's written in C++ available for study somewhere? Any of the OSDev members written their OS in C++, with available sourcecode?
I've gotten my C++ kernel booting, and can perform simple text-to-screen operations, but am trying to determine which part I should focus on next. Memory management? Write a C++ library, f.instance string functions?
All help appreciated!
Posted: Sat Jan 06, 2007 12:07 pm
by Alboin
There is a a project called
UnixLite that is a Unix type operating system with binary compatibility with Linux. It can even run a small web browser, and some unix utilities. (bash, gcc, etc.) Moreover, it's GPL and written in C++.
Re: Example OS written in C++??
Posted: Sat Jan 06, 2007 1:47 pm
by INF1n1t
Scalpel wrote:Are there any OS's written in C++ available for study somewhere? Any of the OSDev members written their OS in C++, with available sourcecode?
I've gotten my C++ kernel booting, and can perform simple text-to-screen operations, but am trying to determine which part I should focus on next. Memory management? Write a C++ library, f.instance string functions?
All help appreciated!
I wrote my boot loader, which enters pmode (32 Bit) and does a far jump to the entry point of the kernel.bin. Now I'm gonna set up the compiler and linker to produce pure binary files. And after that I'm focusing right on the memory managment.
I think you should focus on the memory managment
Posted: Sat Jan 06, 2007 4:34 pm
by Scalpel
Hmm, I'm thinking that perhaps some sort of minimal error handling needs to come first. Now the kernel crashes and burns easily. A simple
causes the computer to reboot.
I also tried a simple memcpy library function (
this one), but that crashed the kernel as well.
So exception handling is first priority. But then I probably need to write some basic library routines first anyway. Right now I've got squat. Not even a printf , malloc or strcpy. I guess I need some of those when writing an exception handler?
Any good documentation for writing exception handlers anywhere?
Posted: Sat Jan 06, 2007 5:38 pm
by Alboin
I suggest you work on a printf function first; even before memory management. This makes debugging much easier. However, in C++ you don't need to write a printf function. (Which isn't very fun...) Instead, you can just make something like cout, which is much funner to make.
Posted: Sat Jan 06, 2007 6:21 pm
by Scalpel
Alboin wrote:I suggest you work on a printf function first; even before memory management. This makes debugging much easier. However, in C++ you don't need to write a printf function. (Which isn't very fun...) Instead, you can just make something like cout, which is much funner to make.
I've got a Video class with a function Video.write(char*), from David Stouts tutorial over at Bona Fide. I am able to write out strings, have enabled escape chars (\n, \b), but can't print out numbers yet. I need to figure out how to do formatting, f.instance:
Code: Select all
Video vid;
int numb = 123;
vid.write("Here is a number: %d", numb);
Posted: Sat Jan 06, 2007 6:48 pm
by Alboin
vid.write wasn't was I was going for. Hmmm...Uh, I was going for an overloading operator approach... Attached is what I was thinking...It should work if one does something like:
Code: Select all
int i = 12;
Monitor m ;
m << "Hi" << i;
This means that one doesn't have to do any formatting except for '\n', '\t', etc.
I hope it works....
Posted: Sun Jan 07, 2007 4:23 am
by Scalpel
Thanks for the great example