Separating the kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
BASICFreak
Member
Member
Posts: 284
Joined: Fri Jan 16, 2009 8:34 pm
Location: Louisiana, USA

Separating the kernel

Post by BASICFreak »

OK, I have been working on a very "simple" OS for a wile now, currently I have a small "command prompt" but everything so far is in the kernel.

I am looking for documentation, information, or examples of how to get the "command prompt" or any "program" in general separated from the kernel

I want the kernel to handle all the keyboard input and video output, but I have not been able to find any information on how to get a "program" to communicate with the kernel rather than rewriting the "driver" per "program".

Any information is greatly appreciated.

Thanks in advance,
BASICFreak

I am sorry if this question has been asked before, I searched the WiKi but I think I just did not know what terms to look for. I am still very new to OS development.
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
Sortie wrote:
  • Don't play the role of an operating systems developer, be one.
  • Be truly afraid of undefined [behavior].
  • Your operating system should be itself, not fight what it is.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: Separating the kernel

Post by piranha »

Well, the programs would be executable files that the kernel loads and runs. The programs interface with the kernel by use of system calls (its on the wiki).

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Separating the kernel

Post by gerryg400 »

You need a kernel/system API. For example, in the Posix world, your 'shell' would be a user-space program. It will do something like this.

Code: Select all

fdin = open("/dev/console", ...);  // or /dev/kbd etc.
fdout = open("/dev/console", ...);   // or /dev/screen  etc.

while (1) {

    char ch;

    write(fdout, "$ ", 2);

    read(fdin, &ch, 1);

    switch (ch) {
       // process text input etc.
    }
}
At the 'system/kernel' interface you need to implement open/read/write etc. for each device type.

I should stress that Posix is just one OS interface. You can make your own.
If a trainstation is where trains stop, what is a workstation ?
Post Reply