2017-09-13 5 views
1

J'essaie de passer de el3 à el1 secure mais je continue à faire en sorte que le processeur reste accroché quelque part. Mon code fonctionne sur un Cortex-A53 (framboise pi 3). Pour l'instant, je ne peux que passer de EL3 à EL2.ARMv8 passant de el3 à el1 secure

/* Code to try jump to EL1 secure */ 
MSR SCTLR_EL1, XZR 

MRS X0, SCR_EL3 
ORR X0, X0, #(1<<10) // RW EL1 Execution state is AArch64. 
MSR SCR_EL3, x0 
MOV X0, #0b00101 // DAIF=0000 
MSR SPSR_EL3, X0 

ADR X0, read_core 
MSR ELR_EL3, X0 // EL1 code. 
ERET 

read_core:

/* set stack poiter */ 
mov sp, #0x3F000000 

/* Jump to kernel main entry point */ 
bl kernel_entry 

Quelqu'un peut-il me indiquer ce qui peut éventuellement se tromper ici?

Thnks à l'avance

Répondre

0

Enfin, je réussi à laisser tomber rpi3 pour sécuriser EL1. Si quelqu'un est intéressé, vérifiez le code.

drop_el1_secure: 

/* Try drop from el3 to el1 secure */ 

/*=============================================================*/ 
/*  Enable FP/SIMD at EL1         */ 
/*=============================================================*/ 
mov x0, #3 << 20 
msr cpacr_el1, x0   /* Enable FP/SIMD at EL1 */ 

/*=============================================================*/ 
/*  Initialize sctlr_el1         */ 
/*=============================================================*/ 
mov x0, xzr 
orr x0, x0, #(1 << 29)   /* Checking http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0500d/CIHDIEBD.html */ 
orr x0, x0, #(1 << 28)   /* Bits 29,28,23,22,20,11 should be 1 (res1 on documentation) */ 
orr x0, x0, #(1 << 23) 
orr x0, x0, #(1 << 22) 
orr x0, x0, #(1 << 20) 
orr x0, x0, #(1 << 11) 
msr sctlr_el1, x0 

/*=============================================================*/ 
/*  Initialize scr_el3          */ 
/*=============================================================*/ 
mrs x0, scr_el3 
orr x0, x0, #(1<<10)  /* Lower EL is 64bits */ 
msr scr_el3, x0 

/*=============================================================*/ 
/*  Initialize spsr_el3         */ 
/*=============================================================*/ 
mov x0, xzr 
mov x0, #0b00101   /* EL1 */ 
orr x0, x0, #(1 << 8)  /* Enable SError and External Abort. */ 
orr x0, x0, #(1 << 7)  /* IRQ interrupt Process state mask. */ 
orr x0, x0, #(1 << 6)  /* FIQ interrupt Process state mask. */ 
msr spsr_el3, x0 

/*=============================================================*/ 
/*  Initialize elr_el3          */ 
/*=============================================================*/ 
adr x0, el1_secure 
msr elr_el3, x0 

eret 

el1_secure: bl call_kernel_main