ChorusOS 4.0 Porting Guide

HotRebootDesc Structure

Example 4-2 is the HotRebootDesc structure definition provided in kernel/include/chorus/bki/reboot.h.


Example 4-2 HotRebootDesc structure

/*
 * PrstChunk::status bit values
 */

#define PRST_CHUNK_ALLOCATED 0x1
#define PRST_CHUNK_MAPPED    0x2

/*
 * Descriptor of a chunk of persistent memory
 */

typedef struct PrstChunk {
    char*   id;              /* name string */
    int     status;          /* status bit string */
    VmSize  size;            /* size in bytes */

    PhAddr  paddr;           /* starting physical address 
                              * valid if PRST_CHUNK_ALLOCATED is set */
    VmAddr  vaddr;           /* starting virtual address */
                              * valid if PRST_CHUNK_MAPPED is set */
} PrstChunk;


/*
 * Persistent memory descriptor
 */

typedef struct PrstMem {
    int        maxChunks;    /* max number of persistent memory chunks */
    int        numChunks;    /* number of persistent memory chunks */
    PrstChunk* chunks;       /* array of persistent memory chunks */
    int        maxStrLen;    /* max cumulated size of chunk ids */
    int        curStrLen;    /* current cumulated size of chunk ids */
    char*      str;          /* chunk ids buffer*/
} PrstMem;

/*
 * The state kept over a hot reboot
 */

typedef struct HotRebootDesc {
    PrstMem    prstMem;      /* persistent memory descriptor */
} HotRebootDesc;

The prstMem field of HotRebootDesc describes the persistent memory (the portion of system RAM that must remain the same during subsequent hot reboots). The description is an array of PrstChunk structures, each one describing a persistent memory device (a contiguous named portion of persistent memory). The array is statically allocated in the reboot program data segment.

A persistent memory device is described by its symbolic name, id, the starting physical address, paddr, the starting virtual addresses, vaddr, and the size.

Different operating system components are involved in persistent memory device allocations: