Home | History | Annotate | Download | only in Arm
      1 //
      2 //  Copyright (c) 2012-2014, ARM Limited. All rights reserved.
      3 //
      4 //  This program and the accompanying materials
      5 //  are licensed and made available under the terms and conditions of the BSD License
      6 //  which accompanies this distribution.  The full text of the license may be found at
      7 //  http://opensource.org/licenses/bsd-license.php
      8 //
      9 //  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 //  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 //
     12 //
     13 
     14 
     15     INCLUDE AsmMacroExport.inc
     16 
     17  RVCT_ASM_EXPORT ArmCallSmc
     18     push    {r4-r8}
     19     // r0 will be popped just after the SMC call
     20     push     {r0}
     21 
     22     // Load the SMC arguments values into the appropriate registers
     23     ldr     r7, [r0, #28]
     24     ldr     r6, [r0, #24]
     25     ldr     r5, [r0, #20]
     26     ldr     r4, [r0, #16]
     27     ldr     r3, [r0, #12]
     28     ldr     r2, [r0, #8]
     29     ldr     r1, [r0, #4]
     30     ldr     r0, [r0, #0]
     31 
     32     smc     #0
     33 
     34     // Pop the ARM_SMC_ARGS structure address from the stack into r8
     35     pop     {r8}
     36 
     37     // Load the SMC returned values into the appropriate registers
     38     // A SMC call can return up to 4 values - we do not need to store back r4-r7.
     39     str     r3, [r8, #12]
     40     str     r2, [r8, #8]
     41     str     r1, [r8, #4]
     42     str     r0, [r8, #0]
     43 
     44     mov     r0, r8
     45 
     46     // Restore the registers r4-r8
     47     pop     {r4-r8}
     48 
     49     bx      lr
     50 
     51     END
     52