| 95 | } |
| 96 | |
| 97 | auto sys_exit(int code) -> int { |
| 98 | klog::Info("[Syscall] Process {} exited with code {}", |
| 99 | TaskManagerSingleton::instance().GetCurrentTask()->pid, code); |
| 100 | // 调用 TaskManager 的 Exit 方法处理线程退出 |
| 101 | TaskManagerSingleton::instance().Exit(code); |
| 102 | // 不会执行到这里,因为 Exit 会触发调度切换 |
| 103 | klog::Err("[Syscall] sys_exit should not return!"); |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | [[nodiscard]] auto sys_yield() -> int { |
| 108 | TaskManagerSingleton::instance().Schedule(); |