forked from xuos/xiuos
33 lines
984 B
C
33 lines
984 B
C
/*
|
|
* 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 x0, %1;\
|
|
mov x1, %2;\
|
|
mov x2, %3;\
|
|
mov x3, %4;\
|
|
mov x4, %5;\
|
|
svc #0;\
|
|
dsb ish;\
|
|
isb;\
|
|
mov %0, x0"
|
|
: "=r"(ret)
|
|
: "r"(sys_num), "r"(a1), "r"(a2), "r"(a3), "r"(a4)
|
|
: "memory", "r0", "r1", "r2", "r3", "r4");
|
|
|
|
return ret;
|
|
} |