/* Note that during this, an embedded SW thread may call nsi_exit(), which would result in this function never returning.  */
void nce_boot_cpu(void *this_arg, void(*start_routine)(void))
/* Note that during this, an embedded SW thread may call nsi_exit(), which would result in this function never returning.  */
void nce_boot_cpu(void *this_arg, void(*start_routine)(void))
{
	struct nce_status_t *this = (struct nce_status_t *)this_arg;
	NSI_SAFE_CALL(pthread_mutex_lock(&this->mtx_cpu));
	this->cpu_halted = false;
	this->start_routine = start_routine;
	pthread_t sw_thread;
	NSI_SAFE_CALL(pthread_create(&sw_thread, NULL, sw_wrapper, this_arg));
	while (this->cpu_halted == false) {
		pthread_cond_wait(&this->cond_cpu, &this->mtx_cpu);
	}
	NSI_SAFE_CALL(pthread_mutex_unlock(&this->mtx_cpu));
	if (this->terminate) {
		nsi_exit(0);
	}
}