`hart_t *newhart` must be zeroed with `memset (newhart,0,sizeof(hart_t));` after `hart_t *newhart = malloc(sizeof(hart_t));` because sometimes the cpu starts with wrong settings causing exceptions.