MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / Syscall

Function Syscall

src/arch/riscv64/syscall.cpp:10–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "kernel_log.hpp"
9
10auto Syscall(uint64_t, cpu_io::TrapContext* context_ptr) -> void {
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}

Callers 1

SyscallHandlerFunction · 0.70

Calls 1

syscall_dispatcherFunction · 0.85

Tested by

no test coverage detected