You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
961 B
ArmAsm

// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
.section ".text._start"
.global _start
_start:
mrs x1, mpidr_el1 // Read Multiprocessor Affinity Register
and x1, x1, #3 // Clear all bits except [1:0], which hold core id
cbz x1, 2f // Jump to label 2 if we are core 0
1: wfe // Wait for event
b 1b // In case an event happened, jump back to 1
2: // If we are here, we are core0
ldr x1, =_start // Load address of function "_start()"
mov sp, x1 // Set start of stack to before our code, aka first
// address before "_start()"
bl init // Jump to the "init()" kernel function
b 1b // We should never reach here. But just in case,
// park this core aswell