bl1/aarch64/bl1_context_mgmt.c
/*******************************************************************************
 * This function prepares the context for Secure/Normal world images.
 * Normal world images are transitioned to EL2(if supported) else EL1.
 ******************************************************************************/
This function prepares the context for Secure/Normal world images.
Normal world images are transitioned to EL2(if supported) else EL1.
This function prepares the context for Secure / Normal world images . Normal world images are transitioned to EL2 ( if supported ) else EL1 .
void bl1_prepare_next_image(unsigned int image_id)
{
	unsigned int security_state;
	image_desc_t *image_desc;
	entry_point_info_t *next_bl_ep;
#if CTX_INCLUDE_AARCH32_REGS
	if (EL_IMPLEMENTED(1) == EL_IMPL_A64ONLY) {
		ERROR("EL1 supports AArch64-only. Please set build flag "
				"CTX_INCLUDE_AARCH32_REGS = 0");
		panic();
	}
#endif
	image_desc = bl1_plat_get_image_desc(image_id);
	assert(image_desc);
	next_bl_ep = &image_desc->ep_info;
	security_state = GET_SECURITY_STATE(next_bl_ep->h.attr);
	if (!cm_get_context(security_state))
		cm_set_context(&bl1_cpu_context[security_state], security_state);
	if (security_state == SECURE) {
		next_bl_ep->spsr = SPSR_64(MODE_EL1, MODE_SP_ELX,
				   DISABLE_ALL_EXCEPTIONS);
	} else {
		if (EL_IMPLEMENTED(2)) {
			next_bl_ep->spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
				DISABLE_ALL_EXCEPTIONS);
		} else {
			next_bl_ep->spsr = SPSR_64(MODE_EL1, MODE_SP_ELX,
			   DISABLE_ALL_EXCEPTIONS);
		}
	}
	bl1_plat_set_ep_info(image_id, next_bl_ep);
	cm_init_my_context(next_bl_ep);
	cm_prepare_el3_exit(security_state);
	image_desc->state = IMAGE_STATE_EXECUTED;
	print_entry_point_info(next_bl_ep);
}
void bl1_prepare_next_image ( unsigned int image_id ) { unsigned int security_state ; image_desc_t * image_desc ; entry_point_info_t * next_bl_ep ; #if CTX_INCLUDE_AARCH32_REGS if ( EL_IMPLEMENTED ( 1 ) == EL_IMPL_A64ONLY ) { ERROR ( " " " " ) ; panic ( ) ; } #endif image_desc = bl1_plat_get_image_desc ( image_id ) ; assert ( image_desc ) ; next_bl_ep = & image_desc -> ep_info ; security_state = GET_SECURITY_STATE ( next_bl_ep -> h . attr ) ; if ( ! cm_get_context ( security_state ) ) cm_set_context ( & bl1_cpu_context [ security_state ] , security_state ) ; if ( security_state == SECURE ) { next_bl_ep -> spsr = SPSR_64 ( MODE_EL1 , MODE_SP_ELX , DISABLE_ALL_EXCEPTIONS ) ; } else { if ( EL_IMPLEMENTED ( 2 ) ) { next_bl_ep -> spsr = SPSR_64 ( MODE_EL2 , MODE_SP_ELX , DISABLE_ALL_EXCEPTIONS ) ; } else { next_bl_ep -> spsr = SPSR_64 ( MODE_EL1 , MODE_SP_ELX , DISABLE_ALL_EXCEPTIONS ) ; } } bl1_plat_set_ep_info ( image_id , next_bl_ep ) ; cm_init_my_context ( next_bl_ep ) ; cm_prepare_el3_exit ( security_state ) ; image_desc -> state = IMAGE_STATE_EXECUTED ; print_entry_point_info ( next_bl_ep ) ; }
This function prepares the context for Secure/Normal world images.
This function prepares the context for Secure / Normal world images .
/*
	 * Ensure that the build flag to save AArch32 system registers in CPU
	 * context is not set for AArch64-only platforms.
	 */ /* Get the image descriptor. */ /* Get the entry point info. */ /* Get the image security state. */ /* Setup the Secure/Non-Secure context if not done already. */ /* Prepare the SPSR for the next BL image. */ /* Use EL2 if supported; else use EL1. */ /* Allow platform to make change */ /* Prepare the context for the next BL image. */ /* Indicate that image is in execution state. */