blob: 2c1047df443ee1316cb62052946de990b1d7755f [file] [log] [blame]
Andrew Scull75e28632018-08-08 20:09:14 +01001#include "offsets.h"
2
3.section .text.cpu_entry, "ax"
4.globl cpu_entry
5cpu_entry:
6 /* Disable interrupts. */
7 msr DAIFSet, #0xf
8
Andrew Scull75e28632018-08-08 20:09:14 +01009 /* 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 Filho00df6c72018-10-18 11:19:24 +010021 /* Call into C code, x0 holds the cpu pointer. */
Andrew Scull75e28632018-08-08 20:09:14 +010022 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. */
280: wfi
29 b 0b