1 /** 2 * (C) Copyright 2014, Cavium Inc. 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 **/ 6 7 #include <asm-offsets.h> 8 #include <config.h> 9 #include <version.h> 10 #include <asm/macro.h> 11 #include <asm/system.h> 12 13 /* 14 * Issue the hypervisor call 15 * 16 * x0~x7: input arguments 17 * x0~x3: output arguments 18 */ 19 void hvc_call(struct pt_regs *args) 20 { 21 asm volatile( 22 "ldr x0, %0\n" 23 "ldr x1, %1\n" 24 "ldr x2, %2\n" 25 "ldr x3, %3\n" 26 "ldr x4, %4\n" 27 "ldr x5, %5\n" 28 "ldr x6, %6\n" 29 "ldr x7, %7\n" 30 "hvc #0\n" 31 "str x0, %0\n" 32 "str x1, %1\n" 33 "str x2, %2\n" 34 "str x3, %3\n" 35 : "+m" (args->regs[0]), "+m" (args->regs[1]), 36 "+m" (args->regs[2]), "+m" (args->regs[3]) 37 : "m" (args->regs[4]), "m" (args->regs[5]), 38 "m" (args->regs[6]), "m" (args->regs[7]) 39 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", 40 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", 41 "x16", "x17"); 42 } 43 44 /* 45 * void smc_call(arg0, arg1...arg7) 46 * 47 * issue the secure monitor call 48 * 49 * x0~x7: input arguments 50 * x0~x3: output arguments 51 */ 52 53 void smc_call(struct pt_regs *args) 54 { 55 asm volatile( 56 "ldr x0, %0\n" 57 "ldr x1, %1\n" 58 "ldr x2, %2\n" 59 "ldr x3, %3\n" 60 "ldr x4, %4\n" 61 "ldr x5, %5\n" 62 "ldr x6, %6\n" 63 "smc #0\n" 64 "str x0, %0\n" 65 "str x1, %1\n" 66 "str x2, %2\n" 67 "str x3, %3\n" 68 : "+m" (args->regs[0]), "+m" (args->regs[1]), 69 "+m" (args->regs[2]), "+m" (args->regs[3]) 70 : "m" (args->regs[4]), "m" (args->regs[5]), 71 "m" (args->regs[6]) 72 : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", 73 "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", 74 "x16", "x17"); 75 } 76