xref: /aosp_15_r20/trusty/kernel/lib/sm/arch/arm64/entry.S (revision 344aa361028b423587d4ef3fa52a23d194628137)
1*344aa361SAndroid Build Coastguard Worker/*
2*344aa361SAndroid Build Coastguard Worker * Copyright (c) 2013, Google Inc. All rights reserved
3*344aa361SAndroid Build Coastguard Worker *
4*344aa361SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining
5*344aa361SAndroid Build Coastguard Worker * a copy of this software and associated documentation files
6*344aa361SAndroid Build Coastguard Worker * (the "Software"), to deal in the Software without restriction,
7*344aa361SAndroid Build Coastguard Worker * including without limitation the rights to use, copy, modify, merge,
8*344aa361SAndroid Build Coastguard Worker * publish, distribute, sublicense, and/or sell copies of the Software,
9*344aa361SAndroid Build Coastguard Worker * and to permit persons to whom the Software is furnished to do so,
10*344aa361SAndroid Build Coastguard Worker * subject to the following conditions:
11*344aa361SAndroid Build Coastguard Worker *
12*344aa361SAndroid Build Coastguard Worker * The above copyright notice and this permission notice shall be
13*344aa361SAndroid Build Coastguard Worker * included in all copies or substantial portions of the Software.
14*344aa361SAndroid Build Coastguard Worker *
15*344aa361SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16*344aa361SAndroid Build Coastguard Worker * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17*344aa361SAndroid Build Coastguard Worker * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18*344aa361SAndroid Build Coastguard Worker * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19*344aa361SAndroid Build Coastguard Worker * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20*344aa361SAndroid Build Coastguard Worker * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21*344aa361SAndroid Build Coastguard Worker * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*344aa361SAndroid Build Coastguard Worker */
23*344aa361SAndroid Build Coastguard Worker
24*344aa361SAndroid Build Coastguard Worker#include <asm.h>
25*344aa361SAndroid Build Coastguard Worker#include <arch/asm_macros.h>
26*344aa361SAndroid Build Coastguard Worker#include <lib/sm/monitor.h>
27*344aa361SAndroid Build Coastguard Worker#include <lib/sm/smcall.h>
28*344aa361SAndroid Build Coastguard Worker#include <lib/sm/sm_err.h>
29*344aa361SAndroid Build Coastguard Worker
30*344aa361SAndroid Build Coastguard Worker#include <kernel/vm.h>
31*344aa361SAndroid Build Coastguard Worker
32*344aa361SAndroid Build Coastguard WorkerFUNCTION(sm_sched_nonsecure)
33*344aa361SAndroid Build Coastguard Worker	push	x1, x30
34*344aa361SAndroid Build Coastguard Worker	mov	x1, x0
35*344aa361SAndroid Build Coastguard Worker
36*344aa361SAndroid Build Coastguard Worker	ldr	x0, =SMC_SC_NS_RETURN
37*344aa361SAndroid Build Coastguard Worker	mov	x2, xzr
38*344aa361SAndroid Build Coastguard Worker	mov	x3, xzr
39*344aa361SAndroid Build Coastguard Worker	smc	#0
40*344aa361SAndroid Build Coastguard Worker
41*344aa361SAndroid Build Coastguard Worker	pop	x9, x30
42*344aa361SAndroid Build Coastguard Worker	stp	w0, w1, [x9], #8
43*344aa361SAndroid Build Coastguard Worker	stp	w2, w3, [x9], #8
44*344aa361SAndroid Build Coastguard Worker	str	x7, [x9], #8
45*344aa361SAndroid Build Coastguard Worker	ret
46*344aa361SAndroid Build Coastguard Worker
47*344aa361SAndroid Build Coastguard WorkerFUNCTION(platform_early_halt)
48*344aa361SAndroid Build Coastguard Worker	/* Disable interrupts and FIQs */
49*344aa361SAndroid Build Coastguard Worker	msr	daifset, #3
50*344aa361SAndroid Build Coastguard Worker
51*344aa361SAndroid Build Coastguard Worker.Lloop:
52*344aa361SAndroid Build Coastguard Worker	ldr	x0, =SMC_SC_NS_RETURN
53*344aa361SAndroid Build Coastguard Worker	ldr	x1, =SM_ERR_PANIC
54*344aa361SAndroid Build Coastguard Worker	mov	x2, xzr
55*344aa361SAndroid Build Coastguard Worker	mov	x3, xzr
56*344aa361SAndroid Build Coastguard Worker	smc	#0
57*344aa361SAndroid Build Coastguard Worker
58*344aa361SAndroid Build Coastguard Worker	b	.Lloop
59