Hello again,
In my last thread someone told me to make my own librarys for my operating system.
My question is how do i make my own C++ librarys.
Thanks.:cool:
Operating System Library
Started by brade8000, Mar 10 2010 02:39 AM
15 replies to this topic
#1
Posted 10 March 2010 - 02:39 AM
|
|
|
#2
Posted 10 March 2010 - 04:13 AM
You can look at the source code for GCC to get some ideas.
#3
Posted 11 March 2010 - 01:04 AM
I'd say start with writing the C library, as it's basic and you can build on top of it to make your C++ library. When I started working on my own OS, I looked up the C library functions at cplusplus.com's library reference, read the specifications, and figured out how to write them. Since I've done this sort of thing before I can help you out should you need it.
sudo rm -rf /
#4
Posted 11 March 2010 - 09:40 PM
Awesome I need some help as my first OS
#5
Posted 11 March 2010 - 09:41 PM
What do you need? More importantly, what features do you want your OS to have?
sudo rm -rf /
#6
Posted 12 March 2010 - 12:28 AM
I want the user to be able to write text filesand some more basic stuff mainly i just want it to run
#7
Posted 12 March 2010 - 01:35 AM
Ok, that's not too bad. You're going to have to plan this out very carefully before you write a single line of code. Here are a few things to consider:
- Are you going to allow more than one program to run at a time? (multiprocessing) If so, you're going to have to write your own thread scheduling subroutines, context switching...just don't do it. Like really. Don't.
- Are you going to allow user programs to run, or is everything part of the operating system? (If you write everything then it makes your life much easier but isn't as fun.)
- What processor are you targeting? (I can only help you with Intel, or MIPS to a lesser degree.)
- If you're targeting an Intel processor, what mode are you going to be executing in? (See here for a brief description of x86 processor modes.) Most modern operating systems use protected mode. However, you can go one of three ways:
- Protected mode:
- Each program runs in its own address space, so it can't touch other programs. Or your operating system.
- Each program also runs at one of four privilege levels. Thus you can prevent specific user mode programs from doing certain things, while allowing others with higher privileges to do those same things.
- Downside - you're probably going to have to implement paging. This is not fun.
- No BIOS routines. It's a crutch, but it's slow and somewhat limited. No modern operating system that I know of uses it.
- Each program runs in its own address space, so it can't touch other programs. Or your operating system.
- Virtual 8086 mode: I don't recommend this as you're making a basic operating system and this won't be of much use to you.
- Unreal mode: This basically lets you use all the RAM you want and allows you to use the BIOS routines. The BIOS is slow - even slower than Windows, if you can believe that - but using it as a crutch also means that you're not going to have to create your own file system drivers just to create a simple fopen(). It doesn't do well with large disks or large amounts of memory, but for something as simple as I think you want this it's all right. Learning experience.
- Protected mode:
- Are you going to have a rudimentary GUI or a pure command-line interface? The GUI isn't too bad, I've written a basic one in assembly language. Don't remember where I put the code...
- Are you going to allow a mouse? It doesn't have to have a pointer; your driver can just move the console cursor around.
- Speakers? Using the motherboard speaker to beep at the user when they do something stupid is pretty easy.
- Memory management system, for stuff like malloc()? Oooh, this'll be fun.
sudo rm -rf /
#8
Posted 12 March 2010 - 01:01 PM
OK kool thanks.
#9
Posted 12 March 2010 - 09:41 PM
No I don't want multiprocessing.
It will all be on the OS.
Whatever processer is best and easiest.
I will have GUI.
I will allow mouse.
Speakers Yes.
Memery Yes.
Want to be able to write .txt files and run smoothly.
Thanks.
P.S. I have dicided to use Dev C++ is that a good language to use for an OS.
It will all be on the OS.
Whatever processer is best and easiest.
I will have GUI.
I will allow mouse.
Speakers Yes.
Memery Yes.
Want to be able to write .txt files and run smoothly.
Thanks.
P.S. I have dicided to use Dev C++ is that a good language to use for an OS.
#10
Posted 12 March 2010 - 09:46 PM
Well most Computer Desktops are Intel Core Two Duo's running at 2.53GHz
So you can't just say what's the easiest because there are different ones!
Start Menu>My Computer>System Tasks>System Information. (If your running Windows XP) :)
So you can't just say what's the easiest because there are different ones!
Start Menu>My Computer>System Tasks>System Information. (If your running Windows XP) :)
#11
Posted 12 March 2010 - 10:46 PM
The processor model doesn't matter, it's the processor family. By the way, brade8000, I saw your questions about what kernels are...you're a looong way off from writing an OS, buddy.
Dev C++ is not going to get you far, nor will any sort of C++. You can't use any standard library functions, so no iostream, no std::string, and so on. Only difference between C and C++ at this low of a level is the ability to use classes. That's it.
As far as your GUI and mouse, if you don't know what a kernel is, you're not going to be able to write a device driver for either. I strongly suggest you read some books on operating systems first. If you start coding now you're going to get frustrated and give up.
Dev C++ is not going to get you far, nor will any sort of C++. You can't use any standard library functions, so no iostream, no std::string, and so on. Only difference between C and C++ at this low of a level is the ability to use classes. That's it.
As far as your GUI and mouse, if you don't know what a kernel is, you're not going to be able to write a device driver for either. I strongly suggest you read some books on operating systems first. If you start coding now you're going to get frustrated and give up.
sudo rm -rf /
#12
Posted 13 March 2010 - 12:26 AM
Ok i will use intel


Sign In
Create Account


Back to top









