/* Exception level EL3 is meant to be used by the secure monitor only (ARM trusted firmware being one embodiment). The operating system shall be started at exception level EL2. So here we check the exception level and switch it if necessary.  */
void switch_to_non_secure_mode(void)
/* Exception level EL3 is meant to be used by the secure monitor only (ARM trusted firmware being one embodiment). The operating system shall be started at exception level EL2. So here we check the exception level and switch it if necessary.  */
void switch_to_non_secure_mode(void)
{
	struct jmp_buf_data non_secure_jmp;
	if (current_el() == 3) {
		if (setjmp(&non_secure_jmp))
			return;
		dcache_disable();
		armv8_switch_to_el2((uintptr_t)&non_secure_jmp, 0, 0, 0,
				    (uintptr_t)entry_non_secure, ES_TO_AARCH64);
	}
}