Chapter 2. A tour of the kernel sources

Table of Contents
Kernel headers
Kernel source files

This description takes the form of a tour around the sources explaining their structure and describing the functionality of each component.

The kernel is divided into two basic parts, the largely machine independent parts in Cygnus/eCos/packages/kernel/v1_2_1, and the architecture- and platform-specific parts that comprise the Hardware Abstraction Layer (HAL) in Cygnus/eCos/packages/hal. These will be described separately. Also note that the HAL is described in great detail in its own chapter (see Chapter 7).

Kernel headers

Kernel header files (in Cygnus/eCos/packages/kernel/v1_2_1/include) provide external interfaces and configuration control for the various kernel objects. In general there is an include file for each major kernel class. Those header files having to do with configuration live in the pkgconf subdirectory.

The base name of a header file and the source file that implements it are usually the same. So, for example, the member functions defined in sched.hxx are implemented in sched.cxx. For a number of classes there are also header files that define inline functions, for example sched.inl.

There are some kernel objects that are implemented using C++ templates to allow code re-use in future; it is not intended that these template classes be used generally by applications. The appropriate concrete kernel classes should be used instead.

Now we examine the files one by one for reference:

include/bitmap.hxx

Bitmap scheduler definition. See source file sched/bitmap.cxx

include/clock.hxx, include/clock.inl

Counter, clock and alarm functions. See source file common/clock.cxx

include/diag.h

Diagnostic routines. See source file trace/diag.c

include/errors.h

Kernel error codes. See source file common/except.cxx

include/except.hxx

Exception handling.

include/flag.hxx

Flag synchronization objects. See source file sync/flag.cxx

include/instrmnt.h

Instrumentation. See source file instrmnt/meminst.cxx

include/intr.hxx

Interrupts. See source file intr/intr.cxx

include/kapi.h, include/kapidata.h

Native "C" API to the kernel. See source file common/kapi.cxx

include/ktypes.h

Kernel types.

include/llistt.hxx

A simple doubly linked-list template class used elsewhere in the kernel.

include/lottery.hxx

Lottery scheduler implementation. See source file sched/lottery.cxx

include/mbox.hxx, include/mboxt.hxx, include/mboxt2.hxx, include/mboxt.inl, include/mboxt2.inl

Message boxes. See source file sync/mbox.cxx; mboxt.hxx and mboxt2.hxx and mboxt.inl and mboxt2.inl implement the underlying template function.

Note: The files with a 2 suffix are used by default and provide precise µITRON semantics.

include/memfixed.hxx, include/mempoolt.hxx, include/mempolt2.hxx, include/mempoolt.inl, include/mempolt2.inl, include/mfiximpl.hxx, include/mfiximpl.inl

Fixed-block allocation memory pools. See source file mem/memfixed.cxx; mempoolt[2] and mfiximpl are a thread-safety template function and underlying memory manager respectively.

Note: The files with a 2 suffix are used by default and provide precise µITRON semantics.

include/memvar.hxx, include/mempoolt.hxx, include/mempolt2.hxx, include/mempoolt.inl, include/mempolt2.inl, include/mvarimpl.hxx, include/mvarimpl.inl

Variable-block allocation memory pools. See source file mem/memvar.cxx; mempoolt[2] and mvar are a thread-safety template function and underlying memory manager respectively.

Note: The files with a 2 suffix are used by default and provide precise µITRON semantics.

include/mlqueue.hxx

Multi-level queue scheduler. See source file sched/mlqueue.cxx

include/mutex.hxx

Mutexes. See source file sync/mutex.cxx

include/sched.hxx, include/sched.inl

General scheduler functions. See source file sched/sched.cxx

include/sema.hxx, include/sema2.hxx

Semaphores. See source files sync/cnt_sem.cxx and sync/bin_sem.cxx for counting or binary semaphores respectively.

Note: The file with a 2 suffix is used by default and provides precise µITRON semantics.

include/thread.hxx, include/thread.inl

Threads, regardless of scheduler. See common/thread.cxx