The prstInstall() function is used by the bootstrap program to check whether:
there are RAM blocks already occupied by persistent memory devices that must be registred (tagged) as allocated
there are requests for additional RAM blocks to be allocated for new persistent memory devices
Example 3-10 is prstInstall() source code provided in kernel/snippet/nucleus/boot_tools/prstInstall.c.
void prstInstall() { int i; RamDesc* ram = &bootConf->ramAllocator; RebootDesc* rd = bootConf->rebootDesc; /* * Tag existing persistent memory as allocated */ for (i = 0; i < rd->hot.prstMem.numChunks; ++i) { PrstChunk* chunk = &rd->hot.prstMem.chunks[i]; ASSERT(CEILING2(chunk->size, PAGE_SIZE_f) == chunk->size); if (chunk->status & PRST_CHUNK_ALLOCATED) { ram_tag(ram, chunk->paddr, (PhSize) chunk->size, PH_RAM_ALLOCATED); } } /* * Extend persistent memory */ for (i = 0; i < rd->hot.prstMem.numChunks; ++i) { PrstChunk* chunk = &rd->hot.prstMem.chunks[i]; ASSERT(CEILING2(chunk->size, PAGE_SIZE_f) == chunk->size); if (!(chunk->status & PRST_CHUNK_ALLOCATED)) { if (!ram_alloc(ram, &chunk->paddr, (PhSize) chunk->size, PAGE_SIZE_f)) { printf ("can't allocate 0x%x bytes of persistent memory\n", chunk->size); ASSERT(0); } else { chunk->status |= PRST_CHUNK_ALLOCATED; } } } }