@ -45,15 +45,31 @@ static void mmu_setup(void)
/* load TTBR0 */
el = current_el ( ) ;
if ( el = = 1 )
if ( el = = 1 ) {
asm volatile ( " msr ttbr0_el1, %0 "
: : " r " ( gd - > arch . tlb_addr ) : " memory " ) ;
else if ( el = = 2 )
asm volatile ( " msr tcr_el1, %0 "
: : " r " ( TCR_FLAGS | TCR_EL1_IPS_BITS )
: " memory " ) ;
asm volatile ( " msr mair_el1, %0 "
: : " r " ( MEMORY_ATTRIBUTES ) : " memory " ) ;
} else if ( el = = 2 ) {
asm volatile ( " msr ttbr0_el2, %0 "
: : " r " ( gd - > arch . tlb_addr ) : " memory " ) ;
else
asm volatile ( " msr tcr_el2, %0 "
: : " r " ( TCR_FLAGS | TCR_EL2_IPS_BITS )
: " memory " ) ;
asm volatile ( " msr mair_el2, %0 "
: : " r " ( MEMORY_ATTRIBUTES ) : " memory " ) ;
} else {
asm volatile ( " msr ttbr0_el3, %0 "
: : " r " ( gd - > arch . tlb_addr ) : " memory " ) ;
asm volatile ( " msr tcr_el3, %0 "
: : " r " ( TCR_FLAGS | TCR_EL2_IPS_BITS )
: " memory " ) ;
asm volatile ( " msr mair_el3, %0 "
: : " r " ( MEMORY_ATTRIBUTES ) : " memory " ) ;
}
/* enable the mmu */
set_sctlr ( get_sctlr ( ) | CR_M ) ;