Hi folks,
Do you ever tried to build your own kernel?
Yes. IA-32 Ring 0.
What type of programming
language did you use?
C with some inline assembly and one pure assembly file in NASM.
Specifically, the kernel compiles with two DOS compilers DJGPP and
OpenWatcom 1.3. I currently have roughly 2500 lines of C and 360 lines of
inline assembly (duplicated for each compiler).
I've heard there is a way to do that in C
Yes. But, it is difficult. The C libraries of your compiler are usually
built upon OS functions. In other words, most OS's are written _before_ the
C compiler _usually_ in assembler. Basically, this means that if you try to
write an OS in C many C library functions will be incomplete due to the
missing functions calls of the original OS. Critically important things
like reading the keyboard controller, file I/O, interrupt routines will all
need to be provide by you. Usually, the memory, string, and character
library functions are clean, due to their simplicity. Also, the functions
of a C compiler: creating constants, variables, flow control structures
(including if's, procedures, etc), and arithmetic and pointer operations,
are usually free from the original OS function calls.
You'll need a way to take control of your computer. This is usually done
with a bootloader and it's API (such as Grub). It can also be done via
other special transfer mechanisms from certain environments (i.e., DOS
DPMI).
If is it possible, can you recommend me some pages, documents or
anything what is about it?
I would start by studying other OS's written in C on the web. Freedos-32 is
written in C. I personally don't think it's method of implementation is
spectactular. But, it works. Another place to start are some of the sample
OS's. These have been written by people like Chris Giese, Alexei Frounze,
John Fine, etc. There are dozens of tutorial OS's such as Wild Boar Scafa,
Thix, Topsy, Bran, Visopsys, Mach, Shawn, etc...
Rod Pemberton