JOEL4: don't delete .o files when building

MAKE has this horrible habit of cleaning up things it thinks I don't need.
Now I have to tell make to stop deleting .o files, because I don't want to
have to compile them every time.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: check for the existence of tools

A new target has been added to the makefile called 'tools'. This new target
checks for the existence of the required tools before starting the build process.
Currently this target is not run by default, but is optional for the developer
to run at a convenient time.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: use the LDFLAGS variable

The $(LDFLAGS) variable was not being used when $(LD) was called. This caused
an issue when building on a platform that was not 32-bit x86.

Signed-off-by: Joel Nider <joel@nider.org>
bug-fix: 22
JOEL4: removed debug messages

At the same time, fixed the tabbing.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: added cloc target

Can now use cloc to count the number of lines of code in the kernel.
There is little chance of me remembering all of the correct options
to all of the command line tools required in this (and my other)
project(s), therefore I made it a 'make' target.
This of course requires the cloc tool to be installed.

Signed-off-by: Joel Nider <joel@nider.org>
Added a 'clean' target

Now able to delete all of the output files and rebuild everything from
scratch when needed. Helps when changing compilers, etc.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: added location for kernel interface page

As part of the effort to become more L4 compliant, space has been
reserved in the address space of the user apps for the KIP.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: added unique include header for root_task.h

Don't know why this was missing. Now the file can only be included
once.  Also redefined uint32, although I'm not sure this was necessary.
It used to be defined in l4.h but will soon be removed.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: using proper define name for version number

The symbol for the version number has been changed since the name of
the kernel changed.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: add cloc as a tool

This should have been part of a previous commit, but I missed it.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: started the move to the X.2 v6 interface

Originally I was trying to use the seL4 interface, but found that it is
not easy to use or understand. Specifically, thread creation was a feature
that I didn't understand. The X.2 interface seems to be much easier to
grasp, and it is also better documented (which certainly helps).

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: removed unneeded lines

Some blank lines and commented junk removed.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: removed some debug print statements

These should not have been checked in anyway.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: use the LDFLAGS variable

The $(LDFLAGS) variable was not being used when $(LD) was called. This caused
an issue when building on a platform that was not 32-bit x86.

Signed-off-by: Joel Nider <joel@nider.org>
bug-fix: 22
JOEL4: more debugging info in page fault handler

Fixed up the names for x86 paging flags. Added a new debugging function
that can print out the non-zero values in the page directory.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: setting up system calls to use SYSENTER

We need the ability to pass more than one parameter, and the method
specified in the X.2 document is not compatible with the SYSENTER
method. This does not solve the problem, but is a step in the right
direction.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: x86 segments should be 16-bit values

When loading the task register with LTR, a 16-bit segment must be used.
A bug in the macro led the LTR instruction to try to load from a 32-bit
register, which failed during assembly.  This bug was only seen when
compiling with O1 or greater, since a memory location was used with O0
which does not exhibit the same behavior.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: remove 'a' flag to compile with optimizations

A stray 'a' from a copied code example has led to a compilation error under
optimizations (O1 and higher). I'm still not sure why this caused a problem,
and why it wasn't seen with O0, but removing the 'a' fixes the problem.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: O1 is now the default otimization level

Until now, the kernel was always built with O0 because of two compilation
bugs that prevented compilation under O1.  Now those two bugs are fixed,
(LTR and LDT assembler syntax bugs), the default optimization level will
now be O1.  O0 can still be used by passing DEBUG=y as a flag to make.

Signed-off-by: Joel Nider <joel@nider.org>
JOEL4: fix for LTR assembler syntax bug

When compiling with O1 and higher, the compiler emits an assembly sequence
that loads the task register (LTR) from a register rather than a memory location.
Since I was using a 32-bit value, the compiler naturally tried to load the LTR
from a 32-bit register.  However, the instruction can only load from 16-bit
register. Under O0 this was not seen because the memory syntax seems to be more
flexible, and the assembler was able to reference the memory as a 16-bit
location.

Signed-off-by: Joel Nider <joel@nider.org>