Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <asm_macros.S> |
| 8 | |
| 9 | .globl sp_svc |
| 10 | |
| 11 | func sp_svc |
| 12 | /* |
| 13 | * Save the address of the svc_args structure on the stack. |
| 14 | * |
| 15 | * Although x0 contains an 8-byte value, we are allocating 16 bytes |
| 16 | * on the stack to respect the 16-byte stack-alignment. |
| 17 | */ |
| 18 | str x0, [sp, #-16]! |
| 19 | |
| 20 | /* Load the SVC arguments values into the appropriate registers. */ |
| 21 | ldp x6, x7, [x0, #48] |
| 22 | ldp x4, x5, [x0, #32] |
| 23 | ldp x2, x3, [x0, #16] |
| 24 | ldp x0, x1, [x0, #0] |
| 25 | |
| 26 | svc #0 |
| 27 | |
| 28 | /* |
| 29 | * Pop the svc_args structure address from the stack into a caller-saved |
| 30 | * register. |
| 31 | */ |
| 32 | ldr x9, [sp], #16 |
| 33 | |
| 34 | /* |
| 35 | * The return values are stored in x0-x3, put them in the svc_args |
| 36 | * return structure. |
| 37 | */ |
| 38 | stp x0, x1, [x9, #0] |
| 39 | stp x2, x3, [x9, #16] |
| 40 | ret |
| 41 | endfunc sp_svc |