/* * Copyright (c) 2020 AIIT XUOS Lab * XiUOS is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: * http://license.coscl.org.cn/MulanPSL2 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. * See the Mulan PSL v2 for more details. */ #include "usyscall.h" int syscall(int sys_num, intptr_t a1, intptr_t a2, intptr_t a3, intptr_t a4) { int ret = -1; __asm__ volatile( "mov r0, %1;\ mov r1, %2;\ mov r2, %3;\ mov r3, %4;\ mov r4, %5;\ swi 0;\ dsb;\ isb;\ mov %0, r0" : "=r"(ret) : "r"(sys_num), "r"(a1), "r"(a2), "r"(a3), "r"(a4) : "memory", "r0", "r1", "r2", "r3", "r4"); return ret; }