2013-07-18 20:07:46 +02:00
|
|
|
//
|
2014-08-04 16:18:13 +02:00
|
|
|
// Copyright (c) 2012-2014, ARM Limited. All rights reserved.
|
2013-07-18 20:07:46 +02:00
|
|
|
//
|
|
|
|
// This program and the accompanying materials
|
|
|
|
// are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
// which accompanies this distribution. The full text of the license may be found at
|
|
|
|
// http://opensource.org/licenses/bsd-license.php
|
|
|
|
//
|
|
|
|
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
2016-08-10 14:36:47 +02:00
|
|
|
#include <AsmMacroIoLibV8.h>
|
2013-07-18 20:07:46 +02:00
|
|
|
|
2016-08-10 14:36:47 +02:00
|
|
|
ASM_FUNC(ArmCallSmc)
|
2014-11-11 01:51:11 +01:00
|
|
|
// Push x0 on the stack - The stack must always be quad-word aligned
|
|
|
|
str x0, [sp, #-16]!
|
2013-07-18 20:07:46 +02:00
|
|
|
|
2014-08-04 16:18:13 +02:00
|
|
|
// Load the SMC arguments values into the appropriate registers
|
|
|
|
ldp x6, x7, [x0, #48]
|
|
|
|
ldp x4, x5, [x0, #32]
|
|
|
|
ldp x2, x3, [x0, #16]
|
|
|
|
ldp x0, x1, [x0, #0]
|
2013-07-18 20:07:46 +02:00
|
|
|
|
|
|
|
smc #0
|
|
|
|
|
2014-08-04 16:18:13 +02:00
|
|
|
// Pop the ARM_SMC_ARGS structure address from the stack into x9
|
2014-11-11 01:51:11 +01:00
|
|
|
ldr x9, [sp], #16
|
2014-08-04 16:18:13 +02:00
|
|
|
|
2014-11-11 01:51:11 +01:00
|
|
|
// Store the SMC returned values into the ARM_SMC_ARGS structure.
|
2014-08-04 16:18:13 +02:00
|
|
|
// A SMC call can return up to 4 values - we do not need to store back x4-x7.
|
|
|
|
stp x2, x3, [x9, #16]
|
|
|
|
stp x0, x1, [x9, #0]
|
|
|
|
|
|
|
|
mov x0, x9
|
|
|
|
|
2013-07-18 20:07:46 +02:00
|
|
|
ret
|