microsoft/mu_feature_ffa

Public

mirrored from https://github.com/microsoft/mu_feature_ffaAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fix_upload

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

FfaFeaturePkg/Library/SecurePartitionEntryPoint/AArch64/ModuleEntryPoint.S

63lines · modeblame

4737fd0cKun Qin1 years ago1//
2// Copyright (c) 2021, ARM Limited. All rights reserved.
3//
4// SPDX-License-Identifier: BSD-2-Clause-Patent
5//
6//
7
184656c8kuqin121 years ago8#include <AArch64/AsmMacroLib.h>
4737fd0cKun Qin1 years ago9
10.align 12
11StackBase:
12.space 8192
13StackEnd:
14
15.macro FfaMemPermSet start:req end:req perm:req
16adrp x29, \start
17add x29, x29, :lo12: \start
18
19adrp x30, \end
20add x30, x30, :lo12:\end
21
22/* x30 = end - begin */
23sub x30, x30, x29
24/* x28 = x30 >> 12 (number of pages) */
25mov x28, #12
26lsrv x28, x30, x28
27
28mov w0, #0x89
29movk w0, #0x8400, lsl #16
30mov x1, x29
31mov x2, x28
32mov w3, #\perm
33
34svc #0
35
36mov w1, #0x61
37movk w1, #0x8400, lsl #16
38cmp w1, w0
39b.ne .
40.endm
41
42ASM_FUNC(_ModuleEntryPoint)
43// Stash boot information registers from the SPMC
44mov x8, x0
45mov x9, x1
46mov x10, x2
47mov x11, x3
48
49// Set the correct permissions on stack memory
50FfaMemPermSet StackBase StackEnd 0x5
51
52// Initialise SP
53adr x0, StackEnd
54mov sp, x0
55
56// Restore boot information registers from the SPMC
57mov x0, x8
58mov x1, x9
59mov x2, x10
60mov x3, x11
61
62// Invoke the C entrypoint
63b ModuleEntryPoint