24
8.2.2.2.4 Executive and server
The kernel consists of an executive and a server. The executive is a privileged library running in
the context of the calling thread (though with a separate stack). It handles kernel functions, which
do not require resource allocation. The kernel server is the highest-priority thread in the system,
and handles all requests, which do require kernel-side resource allocation.
8.2.2.2.5 Device drivers
The kernel manages calls from user code to device driver functions, which may run as either
kernel-executive or kernel-server calls.
Device drivers are also driven by interrupts. Interrupt service routines (ISRs) are short, so as to
minimize non-preemptible time. ISRs cannot call kernel services, but they may queue delayed
function calls (DFCs). If the system was interrupted in user state, the kernel will run the DFC
immediately after the ISR; otherwise, the DFC will be run when control would otherwise have
returned to user privilege. DFCs are more powerful potentially than ISRs. Even so, many DFCs
simply post a user thread to handle the event.
8.2.2.2.6 Power management
Power management is very important for a hand-portable machine. The user perceives the
machine to be “on” when the screen is active. Internally, power handling is more sophisticated.
If user-thread processing is taking place, the CPU is powered up constantly; otherwise, the CPU
is quiesced and only activated for brief processing in response to the tick interrupt. If the machine
is off, its DRAM must still be refreshed, and it must be able to switch itself on in response to the
ON key, the next alarm or incoming call etc. Devices such as comms links, phone lines, PC cards
and other removable media have their own power management requirements.
The kernel and device drivers use a power model to keep track of power requirements and power
sources, and close down devices and power sources when not required. Most power sources equate
to one of the system clocks, eg the processor clock, and lower-speed clocks for peripherals, DRAM
refresh, the tick interrupt etc. The kernel implements power management with a so-called “null
thread”, the lowest-priority thread in the system. When the null thread is scheduled, it simply
informs the power model that the CPU is no longer needed: the power model then shuts down the
CPU until the next interrupt.
Real electrical power comes from primary and backup batteries, as well as external power (from a
mains-driven PSU). A non-maskable interrupt is used to process emergency power-down — i.e.,
removal of primary power sources.
8.2.2.2.7 Porting and layering
The kernel is structured in several layers to facilitate porting. Some device drivers also use similar
layering.
A platform-independent layer handles communication with the executive, the basic kernel server
framework, and much internal kernel processing. A platform layer defines the main differences
between emulator/WINC implementations (in which services are implemented as calls to the
Win32 APIs), and full EPOC implementations (in which EPOC drives real hardware).
Lower layers implement specifics for CPUs (eg ARM3, StrongARM, M*Core), ASSPs
(application-specific standard parts, i.e. single chips comprising a CPU, MMU and various
peripherals), and variants (more minor differences). An EPOC port from one variant to another is
relatively easy; an ASSP port involves more work, and a CPU port significantly more.
8.2.2.2.8 Boot sequence
The kernel’s boot sequence brings up the MMU, kernel server, null thread, all kernel devices and
drivers, and finally the file server.
On target machines, the file server then loads the window server, which launches other necessary
system processes. The base delivers a text window server, which can be used for testing low-level
components, including the text shell. The full graphics window server launches a graphics shell.