2 Star 6 Fork 3

稀风/KOS

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
u_syscall1.h 3.69 KB
Copy Edit Raw Blame History
稀风 authored 2023-04-16 21:30 . 优化代码
#ifndef __U_SYSCALL_H_
#define __U_SYSCALL_H_
#include <common.h>
// 无参数的系统调用
#define _SYS_CALL0(_NR) ({ \
U32 retval; \
asm volatile( \
"int $0x80" \
: "=a" (retval) \
: "a" (_NR) \
: "memory" \
); \
retval; \
})
// 一个参数的系统调用
#define _SYS_CALL1(_NR, ARG1) ({ \
U32 retval; \
asm volatile( \
"int $0x80" \
: "=a" (retval) \
: "a"(_NR), "b"(ARG1) \
: "memory" \
); \
retval; \
})
// 两个参数的系统调用
#define _SYS_CALL2(_NR, ARG1, ARG2) ({ \
U32 retval; \
asm volatile( \
"int $0x80" \
: "=a" (retval) \
: "a"(_NR), "b"(ARG1), "c"(ARG2) \
: "memory" \
); \
retval; \
})
// 三个参数的系统调用
#define _SYS_CALL3(_NR, ARG1, ARG2, ARG3) ({ \
U32 retval; \
asm volatile( \
"int $0x80" \
: "=a" (retval) \
: "a"(_NR), "b"(ARG1), "c"(ARG2), "d"(ARG3) \
: "memory" \
); \
retval; \
})
// 四个参数的系统调用
#define _SYS_CALL4(_NR, ARG1, ARG2, ARG3, ARG4) ({ \
U32 retval; \
asm volatile( \
"int $0x80" \
: "=a" (retval) \
: "a"(_NR), "b"(ARG1), "c"(ARG2), "d"(ARG3), "S"(ARG4) \
: "memory" \
); \
retval; \
})
// 五个参数的系统调用
#define _SYS_CALL5(_NR, ARG1, ARG2, ARG3, ARG4, ARG5) ({ \
U32 retval; \
asm volatile( \
"int $0x80" \
: "=a" (retval) \
: "a"(_NR), "b"(ARG1), "c"(ARG2), "d"(ARG3), "S"(ARG4), "D"(ARG4) \
: "memory" \
); \
retval; \
})
/******************************************************************************
* 函数名称: void TaskDestory(void)
* 功能说明: 销毁当前任务
* 输入参数: 无
* 输出参数: 无
* 函数返回: 无
* 其它说明: 无
******************************************************************************/
E_RET TaskDestory(void);
void TestFunc(U32 arg1, U08 arg2, U32 arg3, U16 arg4);
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/thin-wind/KOS.git
git@gitee.com:thin-wind/KOS.git
thin-wind
KOS
KOS
main

Search