summaryrefslogtreecommitdiff
path: root/DESIGN
blob: 8b67f8f8346c8ae4efa9f94f0f975d5b2d10c598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
design principles
-----------------

The final goal is a self-hosting, self-compiling system, so we will
have to implement or port the assember, the C compiler, a linker and
a make program into the new operating system. So featuritis and
non-standards will kill the project fast!

Use strict ANSI C99. This means no inline-assembly. This means
we have to write assembly routines if we need things not available
in C (lgdt, in, out, etc.).
Use the cdecl calling convetion when calling assembly from C.
Stick to NASM assembly bare features (equ, org). Use only the absolute
minimum.

Use only as much assembly as needed, if necessary call a stub function
from C doing the things we would normally do in inlined assembly.

Make sure it compiles with every ANSI C99 compiler (gcc, clang, tcc, pcc, ...).
Use only what is needed, nothing fancy.
Try to compile as often as possible with different compilers on different
host systems.

Use only very simple makefile rules. Make sure we could also just
use a simple shell script to compile the kernel.

Avoid implementation and using of unsafe C functions. Provide safe
counterparts wherever possible. There are of course exceptions like
scrolling the VGA buffer with a memmove.

Use standard C functions early on, even if they have to be glued
funnilly to early functions as in VGA text console, etc.