1/*
2 * Copyright 2018 The Hafnium Authors.
3 *
4 * Use of this source code is governed by a BSD-style
5 * license that can be found in the LICENSE file or at
6 * https://opensource.org/licenses/BSD-3-Clause.
7 */
8
9.global vm_cpu_entry
10vm_cpu_entry:
11	/* Disable trapping floating point access in EL1. */
12	mov x1, #(0x3 << 20)
13	msr cpacr_el1, x1
14	isb
15
16	/* Initialise stack from the cpu_start_state struct. */
17	ldr x1, [x0]
18	mov sp, x1
19
20	/* Load entry function pointer and its argument. */
21	ldr x1, [x0, 8]
22	ldr x0, [x0, 16]
23
24	/* Branch to entry function. */
25	blr x1
26
27	/* Entry function should not return, but if it does, spin. */
28	b .
29