ChorusOS 4.0 Porting Guide

Banks

The bankDesc structure points to an array of BankDesc system image memory bank descriptors.

typedef struct BankDesc {     
        char*    id;      /* bank's symbolic name */ 
        BankType type;    /* bank's type */     
        char*    fs;      /* files system type symbolic name */ 
        VmAddr   vaddr;   /* address required for the bank's image */     
        VmSize   size;    /* bank's size */ 
} BankDesc;

The bankDesc structure is declared in ~nucleus/sys/common/src/lib/bki/bki.h. A memory bank is specified by vaddr, indicating the starting address within the initial address space, and size.

The type field value is a combination of the bits listed in Table 2-1.

Table 2-1 type Bits
type Bit Meaning
 BANK_KSP always "1" in this version
 BANK_DEVICE bank is a memory device
 BANK_DEVICE_READ data from the memory device can be read
 BANK_DEVICE_WRITE data from the memory device can be modified
 BANK_DEVICE_EXEC instructions from the memory device can be executed

If any of the last three bits is set, the BANK_DEVICE bit must also be set.

Files in a memory bank can by organized as a volume of a file system. In this case, the fs field points to a stiring containing the name of the file system type (for example, "FAT" stands for MS-DOS FAT files system). Otherwise, fs is 0.

When the initial loader jumps to the bootconf entry point, the memory banks containing the BIN_BOOTCONF and BIN_BOOTSTRAP program binaries must already be installed at the address indicated by vaddr.

When the bootstrap program transfers control to the microkernel, all memory banks must be installed at the address indicated by vaddr.