ChorusOS 4.0 Porting Guide

The Initial Address Space

kernelSpace describes the initial address space. The exact interpretation of this descriptor is architecture dependent:

Other architecture-dependent requirements for the initial address space layout may be specified. See "The Boot-Kernel Interface (BKI)" for details.

If required, the initial virtual address space is specified by the PhMap structure:

typedef struct PhChunk {     
                PhAddr       start;  /* chunk physical start address */     
                PhSize       size;   /* chunk size in bytes */     
                unsigned int tag;    /* chunk attributes */ 
} PhChunk;  

typedef struct PhMap {     
                int      numChunks;  /* number of items in the array */     
                PhChunk* chunk;      /* array of chunk descriptors */ 
} PhMap; 

PhMap and PhChunk are declared in ~nucleus/src/lib/bki/phMap.h and ~nucleus/src/lib/bki/phChunk.h respectively. The PhMap structure is a series of PhChunk entries, each entry describing the virtual-to-physical translation of a contiguous range of virtual addresses. The size field of a PhChunk descriptor indicates the size of the range. The starting address of the range is given by the sum of the size values of the previous ranges. Therefore, the PhMap structure must describe the entire virtual address space.

If the tag value in PhChunk is equal to KSP_INVALID the translation is invalid and access to any address in the range described by PhChunk is prohibited.

Otherwise, the start field of a PhChunk structure gives the starting address of the physical address range that the virtual address is mapped to. The tag field of a PhChunk structure specifies the attributes associated with the mapping. The highest 24 bits of tag are used to store architecture-dependent attribute sets, such as memory access rights and cache control. See "The Boot-Kernel Interface (BKI)" for details of architecture-specific BKI. The lowest 8 bits are reserved for use by the microkernel, and are set to 0 by mkimage.

The value of the spaceBarrier field may influence the dimensions of the supervisor and the user virtual address spaces. The exact meaning of this field is architecture dependent (see "The Boot-Kernel Interface (BKI)" for details).