void pgt_init(void) { size_t n; for (n = 0; n < PGT_CACHE_SIZE; n++) { struct pgt *p = pgt_entries + n; p->tbl = tee_pager_alloc(PGT_SIZE, TEE_MATTR_LOCKED); SLIST_INSERT_HEAD(&pgt_free_list, p, link); } }
/* allocate pageable_zi vmem for mp scratch memory pool */ static struct mempool *get_mp_scratch_memory_pool(void) { size_t size; void *data; size = ROUNDUP(MPI_MEMPOOL_SIZE, SMALL_PAGE_SIZE); data = tee_pager_alloc(size); if (!data) panic(); return mempool_alloc_pool(data, size, tee_pager_release_phys); }
void pgt_init(void) { size_t n; size_t m; COMPILE_TIME_ASSERT(PGT_CACHE_SIZE % PGT_NUM_PGT_PER_PAGE == 0); COMPILE_TIME_ASSERT(PGT_SIZE * PGT_NUM_PGT_PER_PAGE == SMALL_PAGE_SIZE); for (n = 0; n < ARRAY_SIZE(pgt_parents); n++) { uint8_t *tbl = tee_pager_alloc(SMALL_PAGE_SIZE, TEE_MATTR_LOCKED); SLIST_INIT(&pgt_parents[n].pgt_cache); for (m = 0; m < PGT_NUM_PGT_PER_PAGE; m++) { struct pgt *p = pgt_entries + n * PGT_NUM_PGT_PER_PAGE + m; p->tbl = tbl + m * PGT_SIZE; p->parent = &pgt_parents[n]; SLIST_INSERT_HEAD(&pgt_parents[n].pgt_cache, p, link); } } }