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

Function Syscall

src/arch/aarch64/syscall.cpp:16–37  ·  view source on GitHub ↗

* @brief AArch64 系统调用处理 * @param context_ptr 中断上下文,包含系统调用号和参数 */

Source from the content-addressed store, hash-verified

14 * @param context_ptr 中断上下文,包含系统调用号和参数
15 */
16auto Syscall(uint64_t, cpu_io::TrapContext* context_ptr) -> void {
17 // 获取系统调用号和参数
18 uint64_t syscall_id = 0;
19 std::array<uint64_t, 6> args{};
20
21 syscall_id = context_ptr->x8;
22 args[0] = context_ptr->x0;
23 args[1] = context_ptr->x1;
24 args[2] = context_ptr->x2;
25 args[3] = context_ptr->x3;
26 args[4] = context_ptr->x4;
27 args[5] = context_ptr->x5;
28
29 // 执行处理函数
30 auto ret = syscall_dispatcher(syscall_id, args.data());
31
32 // 设置返回值
33 context_ptr->x0 = static_cast<uint64_t>(ret);
34
35 // 跳过 svc 指令
36 context_ptr->elr_el1 += 4;
37}

Callers

nothing calls this directly

Calls 1

syscall_dispatcherFunction · 0.85

Tested by

no test coverage detected