Andrew Scull | 75e2863 | 2018-08-08 20:09:14 +0100 | [diff] [blame] | 1 | #include "offsets.h" |
| 2 | |
| 3 | .section .text.cpu_entry, "ax" |
| 4 | .globl cpu_entry |
| 5 | cpu_entry: |
| 6 | /* Disable interrupts. */ |
| 7 | msr DAIFSet, #0xf |
| 8 | |
Andrew Scull | 75e2863 | 2018-08-08 20:09:14 +0100 | [diff] [blame] | 9 | /* Use SPx (instead of SP0). */ |
| 10 | msr spsel, #1 |
| 11 | |
| 12 | /* Prepare the stack. */ |
| 13 | ldr x30, [x0, #CPU_STACK_BOTTOM] |
| 14 | mov sp, x30 |
| 15 | |
| 16 | /* Configure exception handlers. */ |
| 17 | adrp x30, vector_table_el2 |
| 18 | add x30, x30, :lo12:vector_table_el2 |
| 19 | msr vbar_el2, x30 |
| 20 | |
Wedson Almeida Filho | 00df6c7 | 2018-10-18 11:19:24 +0100 | [diff] [blame^] | 21 | /* Call into C code, x0 holds the cpu pointer. */ |
Andrew Scull | 75e2863 | 2018-08-08 20:09:14 +0100 | [diff] [blame] | 22 | bl cpu_main |
| 23 | |
| 24 | /* Run the vcpu returned by cpu_main. */ |
| 25 | bl vcpu_restore_all_and_run |
| 26 | |
| 27 | /* Loop forever waiting for interrupts. */ |
| 28 | 0: wfi |
| 29 | b 0b |