예제 #1
0
파일: init.c 프로젝트: diamond001/optee_os
TEE_Result init_teecore(void)
{
	static int is_first = 1;
	unsigned long a, s;

	/* (DEBUG) for inits at 1st TEE service: when UART is setup */
	if (!is_first)
		return TEE_SUCCESS;
	is_first = 0;

#ifndef WITH_UART_DRV
	/* UART tracing support */
	asc_init();
	IMSG("teecore: uart trace init");
#endif

	/* core malloc pool init */
#ifdef CFG_TEE_MALLOC_START
	a = CFG_TEE_MALLOC_START;
	s = CFG_TEE_MALLOC_SIZE;
#else
	a = (unsigned long)&teecore_heap_start;
	s = (unsigned long)&teecore_heap_end;
	a = ((a + 1) & ~0x0FFFF) + 0x10000;	/* 64kB aligned */
	s = s & ~0x0FFFF;	/* 64kB aligned */
	s = s - a;
#endif
	IMSG("teecore heap: paddr=0x%lX size=0x%lX (%ldkB)", a, s, s / 1024);
	malloc_init((void *)a, s);

	/* init support for futur mapping of TAs */
	tee_mmu_kmap_init();
	teecore_init_ta_ram();
	teecore_init_pub_ram();

	/* Libtomcrypt initialization */
	tee_ltc_init();

	/* time initialization */
	time_source_init();

	IMSG("teecore inits done");
	return TEE_SUCCESS;
}
예제 #2
0
TEE_Result tee_init_crypt_ctx( )
{
	//TEE_STDOUT("tee_init_crypt_ctx\n");
	struct tee_crypt_ctx *crypt_ctx = NULL;
	crypt_ctx = utee_mem_alloc(sizeof(*crypt_ctx));
	if(NULL == crypt_ctx) {
		return TEE_ERROR_OUT_OF_MEMORY;
	}
	TAILQ_INIT(&crypt_ctx->cryp_states);
	TAILQ_INIT(&crypt_ctx->objects);
	crypt_ctx->ref_count = 1;
	//TAILQ_INSERT_TAIL(&ta_crypt_ctxes, crypt_ctx, link);
	ta_crypt_ctx = crypt_ctx;
	//TEE_STDOUT("ta_crypt_ctx : 0x%08x\n",ta_crypt_ctx);


	/* Libtomcrypt initialization */
	tee_ltc_init();

	return TEE_SUCCESS;
}