SimpleKernel 1.17.0
Loading...
Searching...
No Matches
syscall.cpp File Reference
#include "syscall.hpp"
#include "interrupt.h"
#include "kernel_log.hpp"
Include dependency graph for syscall.cpp:

Go to the source code of this file.

Functions

auto Syscall (uint64_t, cpu_io::TrapContext *context_ptr) -> void
 AArch64 系统调用处理
 

Function Documentation

◆ Syscall()

auto Syscall ( uint64_t  cause,
cpu_io::TrapContext context_ptr 
) -> void

AArch64 系统调用处理

Definition at line 10 of file syscall.cpp.

10 {
11 // 获取系统调用号和参数
12 uint64_t syscall_id = 0;
13 uint64_t args[6] = {0};
14
15 syscall_id = context_ptr->a7;
16 args[0] = context_ptr->a0;
17 args[1] = context_ptr->a1;
18 args[2] = context_ptr->a2;
19 args[3] = context_ptr->a3;
20 args[4] = context_ptr->a4;
21 args[5] = context_ptr->a5;
22
23 // 执行处理函数
24 auto ret = syscall_dispatcher(syscall_id, args);
25
26 // 设置返回值
27 context_ptr->a0 = static_cast<uint64_t>(ret);
28 // 跳过 ecall 指令
29 context_ptr->sepc += 4;
30}
auto syscall_dispatcher(int64_t syscall_id, uint64_t args[6]) -> int
Definition syscall.cpp:17
Here is the call graph for this function: