Archived

This topic is now archived and is closed to further replies.

Operating systems programming

This topic is 5876 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

where can i find fairly simple information on how to create my own simple operating system that can be copied to a disk and booted when the computer boots? I really am looking forward to create my own text based OS just for the fun of it or maybee even more.

Share this post


Link to post
Share on other sites
It is VERY hard to produce a working OS (I tried it myself), but if you are REALLY into programming an OS, try

www.gaztek.org
os-dev.isa.net.au

The Intel platform is VERY HARD to program, you have to handle PIC, PIT, disk controller, ... Interrupts are just fun ;-), around 40k source code to set basic things....

Darkening

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Phillk6751
well i believe if im correct, that a unix based os can be created entirely of C or C++ on an x86 platform or was that just for the pdp-11 that unix was originally ported to?


You can write most of the OS in C, but there are a few things that will need to be assembly.

Share this post


Link to post
Share on other sites
quote:
Original post by Phillk6751
well i believe if im correct, that a unix based os can be created entirely of C or C++ on an x86 platform

Except for such things as the boot sector, the IVT, and other low-level items, yes, you are correct. The rest of the OS can be written in a high-level language.

Share this post


Link to post
Share on other sites
I have a book that is pretty good. Its called something like "Programming 32-bit operating systems". When I get home, I can post the exact name/auther/publisher.

Overall, it was a pretty good book. However, its pretty deep, and covers a lot of ground (memory management models and stuff) before even getting to any real stuff. I have to admit, I only read about 1/2 to 2/3 of the book, and I never actually implemented anything with it. I bought it more as a learning guide, to get some inside perspective on how the hardware and os interact, and I learned a bundle from it. So I guess Im saying, Im not sure whether or not it would be helpful in implementing your own simple OS.

Share this post


Link to post
Share on other sites
My OS bible is Operating Systems: Design and Implementation. It's written by someone (Andrew Tanenbaum, if I recall correctly) that dislikes Linux, but apart from that, it's fine.

Signatures? We don't need no steenking signatures!

Edited by - Mayrel on November 1, 2001 2:41:21 PM

Share this post


Link to post
Share on other sites
Ok, the book is
Developing Your Own 32-bit Operating System
by Richard A. Burgess
published by Sams Publishing

Its pretty decent. It comes with a sample OS which is built throughout the book. He covers pretty much everything: boot sector, multitasking, file system, device drivers, memory management, etc.

Share this post


Link to post
Share on other sites
You might want to check out V2OS. A buddy of mine was into it for a while and I guess it allows you to boot off of a floppy and execute a program... or something like that. Maybe thats all you need.

http://v2os.v2.nl/

--Buzzy

Share this post


Link to post
Share on other sites
quote:
Original post by Mayrel
...(Andrew Tanenbaum, if I recall correctly) that dislikes Linux...

Andrew designed Minix, which he (and others) used extenisively for teaching operating systems classes, which was also the inspiration for Linux (Linus was dissatisfied with its features). Linus and Andrew evetually had a major falling out, which leads to the state of affairs described above.

Share this post


Link to post
Share on other sites
quote:
Original post by buzzy_b
I guess it allows you to boot off of a floppy and execute a program... or something like that.


I question what you mean exactly. Boot from a floppy...well thats relatively easy. That book I mentioned has a code snippet,about 4 pages of assembler, which gets put in the boot sector of a floppy (floppy should have standard DOS/FAT12 filesystem). All the boot sector does is start reading the program sequentially from the disk into memory. Once its loaded into memory, execution jumps to the start of that code.

The tricky thing is what does the boot code load? It cant just be any standard DOS/Win/*nux executable, because those rely on functionality provided by the OS. So the program it loads must not be reliant on anything but pure hadrware calls. This essentially puts it in the category of an OS. An OS typically also provides an API of sorts for running other programs and for hiding the hardware from those programs, but I dont think thats really an absolute requirement. I think the purest definition of an OS is "software that provides an interface between a user and the hardware" (seems like thats a definition I read in one of my 1st year CIS course books).

Share this post


Link to post
Share on other sites
I guess i better learn to write my own header files. Where would i find a resource to learn to write header files...they look sooo hard....and do i also need to learn to write my own libraries? and what else? I am proficient in C++ except for the win-api, any graphics(but i get drawing coordinates and stuff) and the headers and libraries.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your probably looking at the Macros. Or possibly all of the user-made types and legacy C code. All of those things can be confusing if you are not used to certain conventions. Read any C++ book, or tutorial and you will find plenty on headers. They its interesting that you learned to be proficient (and im not even sure you are since I have never seen your code) in C++ without headers.

But then again they are just Organizational techniques so mabye you never needed to

Share this post


Link to post
Share on other sites
well, i''ve worked with using multiple source files....but i thought a header file was strictly for i/o source, right? or can it be used as a source file? what is the deal....i thought it was a file that defines functions (i.e. cout, cin, endl, and so on)...am i right or only partially or not at all? I gotta figure out header files and libraries.

Share this post


Link to post
Share on other sites
quote:
Original post by Phillk6751
well, i''ve worked with using multiple source files....but i thought a header file was strictly for i/o source, right? or can it be used as a source file? what is the deal....i thought it was a file that defines functions (i.e. cout, cin, endl, and so on)...am i right or only partially or not at all? I gotta figure out header files and libraries.

You definitely should hold on with that OS programming...

A header files is a convenient place to store a bunch of declarations (of files, functions or objects) that you wish to make available to a number of modules. Before a function can be used (in another function), it must either be declared (a statement of its name, number of parameters and their types) or defined (declaration with function body). Rather than declaring functions multiple times in several files, you can declare them once in a single header file and include that header (and all its declarations/definitions) in several files.

Naturally this may lead to ambiguities, especially if the file is included in several places or if there is recursive/deeply nested inclusion. Therefore, there are preprocessor directives that can be used to control the behavior of the include process. #include itself is a preprocessor directive in C/C++. The preprocessor serves to convert all the files and information given to the compiler into a single file - a "virtual file" if you like - which can then be compiled linearly from top to bottom.

The actual compilation process is interesting, and knowledge of the preprocessor is essential for writing portable code as many routines may be dependent on behavior under certain processors/compilers/operating systems.

Hope that helped.



I wanna work for Microsoft!

Share this post


Link to post
Share on other sites
Well, I'm working on somewhat of the same thing. I've been doing alot of research, and I'll tell you there isn't alot of information out there that gives you details on BIOS interrupts. I have come across a few good sites though. BTW I'm doing alot of assembly coding so alot of the sites deal in assembly. Your going to want to learn that if you want to do all the coding yourself.


Use this site its great (BIOS interrupt info)
http://www.ctyme.com/rbrown.htm

BIOS Sites
http://www.bioscentral.com/
http://www.extremetech.com/default/0,3398,,00.asp

File Format info.
http://www.wotsit.org/

Creating your own Operating System Faq
http://database.sarang.net/study/OS/os-faq.html

More info on OSs
http://www.nondot.org/sabre/os/articles

Assembly sites..
http://asmjournal.freeservers.com/
http://www.programmersheaven.com/zone5/index.htm
http://spiff.tripnet.se/~iczelion/

NASM:
http://www.web-sites.co.uk/nasm/

All those sites have pretty good links sections. For assembly info you cant go wrong heading to asmjournal.freeservers. That is the best of what I've found. Gool luck. And be ready to read alot of information before you start.

[edit]
cant believe I forgot NASM link.
[/edit]

Glandalf
Just a thought


Edited by - Glandalf on November 7, 2001 2:16:44 AM

Share this post


Link to post
Share on other sites
Hey...thatnks for all the help...I have found a lot of information from your help.

I am currently in the process of learning how to use header files and having some fun.

I love linux! I''m using KDevelop and NASM or MASM(whichever comes with mandrake 8.0), so i guess all my programming software is FREEWARE(Well, under GNU).

I was also wondering if my os has to be in C or if i can use the latest C++ or maybee even C# in most of it?

"Microsoft is evil," I said so.

Share this post


Link to post
Share on other sites
quote:
Original post by Phillk6751
I love linux! I''m using KDevelop and NASM or MASM(whichever comes with mandrake 8.0)

MASM is a Microsoft product; that would probably be GAS unless you installed NASM as well.

quote:
...so i guess all my programming software is FREEWARE(Well, under GNU).

Don''t let the FSF/GNU dude catch you calling their software freeware. There is a conceptual/philosophical distinction in terms of how you can use freeware and Free Software/Open Source Software. You can read more here, here and here.

quote:
I was also wondering if my os has to be in C or if i can use the latest C++ or maybee even C# in most of it?

"Microsoft is evil," I said so.

Well, Microsoft also makes C# so I guess that rules it out for you, being the "rabid anti-MS zealot you are..."

Using C++ for an OS is entirely possible, but still not very popular. The next revision of the C++ standard is intended to address that. However, I think AtheOS was written in C++ (I may be wrong), so give it a looksee.



I wanna work for Microsoft!

Share this post


Link to post
Share on other sites