This repository has been archived on 2024-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
2024-02-06 21:10:51 +08:00
|
|
|
|
#ifndef X86_64_SYSCALL
|
|
|
|
|
#define X86_64_SYSCALL 1
|
|
|
|
|
|
|
|
|
|
#include <types.h>
|
|
|
|
|
|
|
|
|
|
extern void *system_calls_table[256];
|
|
|
|
|
|
2024-02-18 03:53:54 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief 系统调用规范
|
|
|
|
|
* @addindex x86_64
|
|
|
|
|
*
|
|
|
|
|
* 系统调用使用的寄存器:
|
|
|
|
|
* rax - 调用号
|
|
|
|
|
* rbx - 系统调用程序保留
|
|
|
|
|
* rcx - rip寄存器缓存
|
|
|
|
|
* rdi - 系统调用程序保留
|
|
|
|
|
* rdx - 参数1
|
|
|
|
|
* r8 - 参数2
|
|
|
|
|
* r9 - 参数3
|
|
|
|
|
* r10 - 参数4
|
|
|
|
|
* r11 - rflags寄存器缓存
|
|
|
|
|
* r12 - 参数5
|
|
|
|
|
* r13 - 参数6
|
|
|
|
|
* r14 - 参数7
|
|
|
|
|
* r15 - 参数8
|
|
|
|
|
*
|
|
|
|
|
* 系统调用时,使用内核主堆栈。
|
|
|
|
|
*/
|
2024-02-06 21:10:51 +08:00
|
|
|
|
|
2024-02-18 03:53:54 +08:00
|
|
|
|
/**
|
|
|
|
|
* @name set_kernel_stack_cache
|
|
|
|
|
* @addindex 平台依赖函数 x86_64
|
|
|
|
|
*
|
|
|
|
|
* ```c
|
|
|
|
|
* void set_kernel_stack_cache(usize stack);
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* 将堆栈缓存设为一个`stack`。
|
|
|
|
|
*/
|
2024-02-06 21:10:51 +08:00
|
|
|
|
extern void set_kernel_stack_cache(usize stack);
|
|
|
|
|
|
2024-02-18 03:53:54 +08:00
|
|
|
|
/**
|
|
|
|
|
* @name return_from_systemcall
|
|
|
|
|
* @addindex 平台依赖函数 x86_64
|
|
|
|
|
*
|
|
|
|
|
* ```c
|
|
|
|
|
* void return_from_systemcall();
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* 执行`sysret`指令。
|
|
|
|
|
*/
|
|
|
|
|
extern void return_from_systemcall();
|
|
|
|
|
|
2024-02-06 21:10:51 +08:00
|
|
|
|
#endif
|