Added EL3 handling code (untested)

pull/4/head
bzt 6 years ago
parent 7372187fcd
commit fc6614dbd8

@ -13,6 +13,8 @@ Exception return from AArch64 EL2 to AArch64 EL1 PC 0x8004c
Current EL is: 00000001
```
FIGYELEM: a teljesség kedvéért hozzáadtam az EL3-at is az Issue #6 miatt, bár semmilyen módon nem tudtam kipróbálni.
Start
-----

@ -12,6 +12,8 @@ Exception return from AArch64 EL2 to AArch64 EL1 PC 0x8004c
Current EL is: 00000001
```
NOTE: For completeness, I've added code for EL3 too because of Issue #6, although I had no means to test it.
Start
-----

Binary file not shown.

@ -36,7 +36,7 @@ void main()
asm volatile ("mrs %0, CurrentEL" : "=r" (el));
uart_puts("Current EL is: ");
uart_hex(el>>2);
uart_hex((el>>2)&3);
uart_puts("\n");
// echo everything back

@ -42,7 +42,22 @@ _start:
// set up EL1
mrs x0, CurrentEL
cmp x0, #4
and x0, x0, #12 // clear reserved bits
// running at EL3?
cmp x0, #12
bne 5f
// should never be executed, just for completeness
mov x2, #0x5b1
msr scr_el3, x2
mov x2, #0x3c9
msr spsr_el3, x2
adr x2, 5f
msr elr_el3, x2
eret
// running at EL2?
5: cmp x0, #4
beq 5f
msr sp_el1, x1
// enable CNTP for EL1

Binary file not shown.

@ -42,7 +42,22 @@ _start:
// set up EL1
mrs x0, CurrentEL
cmp x0, #4
and x0, x0, #12 // clear reserved bits
// running at EL3?
cmp x0, #12
bne 5f
// should never be executed, just for completeness
mov x2, #0x5b1
msr scr_el3, x2
mov x2, #0x3c9
msr spsr_el3, x2
adr x2, 5f
msr elr_el3, x2
eret
// running at EL2?
5: cmp x0, #4
beq 5f
msr sp_el1, x1
// enable CNTP for EL1

Binary file not shown.

@ -42,7 +42,22 @@ _start:
// set up EL1
mrs x0, CurrentEL
cmp x0, #4
and x0, x0, #12 // clear reserved bits
// running at EL3?
cmp x0, #12
bne 5f
// should never be executed, just for completeness
mov x2, #0x5b1
msr scr_el3, x2
mov x2, #0x3c9
msr spsr_el3, x2
adr x2, 5f
msr elr_el3, x2
eret
// running at EL2?
5: cmp x0, #4
beq 5f
msr sp_el1, x1
// enable CNTP for EL1

Loading…
Cancel
Save