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