interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / kernel / arch / smp_entry.S

38 lines · 1433 bytes Raw Blame History
1/* smp_entry.S -- PSCI CPU_ON entry point for secondary cores (core/smp.c).
2 *
3 * Entered with the MMU and caches off, x0 = context_id = the core's
4 * struct ck_smp_cpu (identity mapped, cleaned to PoC by the boot core), at
5 * the EL PSCI chose: EL2 when EL2 exists (QEMU 8.2.2 target/arm/tcg/psci.c:144),
6 * else EL1. Only aligned 8-byte loads from the context happen before the MMU
7 * is on. EL2: fatal-only EL2 vectors, then the boot core's own EL2 -> EL1h
8 * path ck_enter_el1 (ADR 0009: HCR_EL2.RW, VMPIDR_EL2 = this core's MPIDR,
9 * timer and GIC system register access, MMU on with the boot core's tables).
10 * EL1: ck_switch_el1. Both land in ck_smp_secondary_main(ctx) on the core's
11 * own stack. Any other EL parks here. Context offsets: core/smp.c. */
12 .text
13 .global ck_smp_entry
14 .type ck_smp_entry, %function
15 .balign 8
16ck_smp_entry:
17 msr daifset, #0xf
18 mov x19, x0
19 mrs x9, CurrentEL
20 ubfx x9, x9, #2, #2
21 ldp x0, x1, [x19, #0] /* root, mair */
22 ldp x2, x3, [x19, #16] /* tcr, sctlr */
23 ldr x4, [x19, #32] /* stack top */
24 adrp x5, ck_smp_secondary_main
25 add x5, x5, :lo12:ck_smp_secondary_main
26 mov x6, x19
27 cmp x9, #2
28 b.ne 1f
29 adrp x10, ck_vectors_el2
30 add x10, x10, :lo12:ck_vectors_el2
31 msr vbar_el2, x10
32 isb
33 b ck_enter_el1
341: cmp x9, #1
35 b.eq ck_switch_el1
362: wfe
37 b 2b
38 .size ck_smp_entry, . - ck_smp_entry