HAL Port — Implementation Details
This documentation explains how the eCos HAL specification has been
mapped onto the PC hardware, and should be read in conjunction with
that specification. The PC platform HAL package complements the i386
architectural HAL. It provides functionality which is specific to the
Following a hard or soft reset the HAL will initialize or reinitialize
the on-chip peripherals that are used by eCos. There is an exception
for RAM startup applications which depend on a monitor for certain
Linker Scripts and Memory Maps
The platform HAL package provides the memory layout information needed
to generate the linker script. The key memory locations are as follows:
- Low RAM
This is the original 640KB of PC RAM between 0x00000000 and
0x000a0000. For FLOPPY startup this is all the RAM that is
available since the BIOS operations used to load the
executable off the diskette can only write to this memory
The lower few K bytes of this region are allocated to special
uses as follows:
The BIOS stores various system parameters in this
area, and it is left untouched in case these values are of
The Interrupt Descriptor Table (IDT). Space for a
full sized 256 entry table is left, although a full size
table is not normally created.
The Vector Service Routine (VSR) table. There is
space here for 256 entries, matching the IDT, although not
all will be used.
The Virtual Vector Table. This is used to pass
control between RedBoot and the application for access to
services and debugging.
This area is used in SMP configurations to start up
and synchronize the slave CPUs. It is unused in non-SMP
Any FLOPPY startup application will load itself at
0x00003000 and use RAM up to the 0x000a0000 boundary. In
RAM and GRUB startup configurations this area is unused.
- Reserved Region
The region between 0x000a0000 and 0x00100000 is reserved for
ROMs, devices and display memory. The only thing of real
interest here is the character display buffer at 0x000B8000.
- Main Memory
The region above 0x00100000 is the main memory area. This is
where RAM and GRUB startup applications are loaded. The upper
limit of this region depends on the amount of RAM fitted and
is determined at runtime by querying the BIOS.
- PCI Devices
The exact memory region used to map PCI devices is largely
dependent on the BIOS, but is usually placed above the
0xD0000000 boundary. Drivers for PCI devices will usually
determine the location of any device memory regions by
querying the device configuration.
- IO Ports
The i386 architecture defines a separate address space for IO
device registers. These are accessed by the IO
instructions. All the standard PC devices are available in
this space, and any PCI devices that define IO ports will
also be allocated here by the BIOS. In eCos these ports are
accessed using the
HAL_WRITE_XXX() macros defined in the
The i386 HAL contains support for Symmetric Multi-Processing
(SMP). The HAL expects the machine to be running under a
multiprocessor-aware BIOS and expects to find an MP configuration
table from which to configure itself. The HAL also switches over to
using the per-CPU APICs and the shared IOAPIC for interrupt control in
preference to the standard PIC.
SMP support in eCos is enabled by setting the
option. This will cause the HAL-level support to be enabled. If
applications are to be run under RedBoot then an SMP-aware RedBoot
must be used. The
GRUB_SMP configurations of RedBoot supply this.
The PC platform HAL does not affect the implementation of other
parts of the eCos HAL specification. The generic i386 variant HAL, and the I386
architectural HAL documentation should be consulted for further