The OS is linked to run at a particular base address. Pre-HAL OS’s were
linked to run at <n>MB, that is on a MB alignment to allow efficient MMU
section mapping. For simplicity, the HAL/OS layout can allow a fixed maximum
size for the HAL, currently set at 64k. Then the OS base address will be
<n>MB+64k. This allows a HAL of up to 64K to be placed at the bottom of a
ROM below the OS, and the HAL/OS combination to still be section-mapped. A
ROM should be portable to hardware variants merely by replacing the 64k HAL
block.
A more flexible system would only sacrifice MMU mapping efficiency. The HAL
and OS could be placed in any desired way, provided that each is contiguous
in physical memory.
The OS starts with a header including a magic word – this aids probing and
location of images. The OS header format is defined as:
Word 0: Magic word ("OSIm" - &6D49534F) Word 1: Flags (currently should be 0) Word 2: Image size (bytes) Word 3: Offset (bytes) from OS base to table of OS routine entry points Word 4: Number of entries in table
The HAL itself should have whatever header is required to start the system.
For example on ARM7500 16→32 bit switch code is required, and on the
9500 parts a special ROM header and checksum must be present. A HAL
descriptor block, instead of a header, can be placed somewhere in the HAL. A
pointer to this block is passed by the HAL to the OS in the OS_Start call:
Word 0: Flags bit 0 => uncachable workspace (32K) required bits 1-31 reserved Word 1: Offset (bytes) from descriptor to start of HAL (will be <= 0) Word 2: HAL size (bytes) Word 3: Offset (bytes) from descriptor to table of HAL routine entry points Word 4: Number of entries in table Word 5: Size of HAL static workspace required (bytes)