OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 7:17 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Trying to Build an operating system
PostPosted: Sun Feb 25, 2001 12:00 am 
Hi PPl
I am really new to this .... i have made a bootloader
now i have to make a kernall... can anybody tell me
how can i make a very easy kernal on c++ which will
only do some calculations or something ... so that
i can place this project of mine on the exhibition.


take care all of you.
Bye


Top
  
 
 Post subject: RE:Trying to Build an operating system
PostPosted: Sun Feb 25, 2001 12:00 am 
>On 2001-02-25 05:59:03, Arif Habib Shadan wrote:
>
>can anybody tell me how can i make a very easy kernal
>on c++ which will only do some calculations or
something

You bootloader does setup pmode correct? Checkout DF's
faq at http://www.mega-tokyo.com/os/os-faq-cpp.html#start
for info relating to making a c++ kernel.

Also the guide located on this site about Mixing C and
Assembly contains some related information.


Top
  
 
 Post subject: RE:Trying to Build an operating system
PostPosted: Mon Feb 26, 2001 12:00 am 
>On 2001-02-25 05:59:03, Arif Habib Shadan wrote:
>Hi PPl
>I am really new to this .... i have made a bootloader
>now i have to make a kernall... can anybody tell me
>how can i make a very easy kernal on c++ which will
>only do some calculations or something ... so that
>i can place this project of mine on the exhibition.

you can not use c++. just c. the reason is that
if you want to create an object, you have to
allocate some memory for it. constructors and
destructors call malloc() and free(). if you
don't have malloc() and free() implemented, it
will not even compile.

You may try to create some simple stuff with use
of TurboC++1.01 compiler available from Borland
for free. Make sure you don't use standard
functions like printf() 'coz you don't have any
kind of DOS available at the boot time.
Also, don't create COM and EXE programs in a way
you would do a regular DOS program. If you do so,
compiler adds some DOS specific code which will
not work w/o DOS. Just compile .C files to .OBJ
and link them together with some stuff written
in assembly and also compiled to .OBJ. Then link
those .OBJs together (asm part goes first and calls
_main) in let's say a COM program -
this would be easy.
Then load and this COM program. Don't forget to
make all preparations for a COM program:
CS=DS=ES=SS, IP=100h, SP=0FFFEh (or even 0). Also
make sure you have "ORG 100h" in that ASM part and
you run the code using correct CS:IP.

Good Luck


Top
  
 
 Post subject: RE:Trying to Build an operating system
PostPosted: Wed Feb 28, 2001 12:00 am 
>On 2001-02-26 17:08:17, Anonymous wrote:
>you can not use c++. just c.

Of course you can!

>the reason is that
>if you want to create an object, you have to
>allocate some memory for it. constructors and
>destructors call malloc() and free(). if you
>don't have malloc() and free() implemented, it
>will not even compile.

There are many free/public-domain/GPLed implementations of
malloc() and free(), and of the new() and delete() operator functions.
Nearly all of them are made to be platform independent, eg, you
can put them in your OS.

If you are writing an OS, then you should be able to write up your own
versions of malloc() and free(), since they are just basic memory management.

Anyway, you don't even need to have them implemented. You can
allocate your objects statically at compile time, or as local
variables on the stack.

I know you are going to say that this is useless since you need to
allocate objects dynamically to represent certain data structures, eg,
page tables/directories, process information, etc. If you were
writting the OS in C, you would still need to dynamically allocate
struct's to represent those data structures, meaning that you would
need implementations of malloc() and free().


--Nick


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 145 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group