1 /** 2 * @file process.h 3 * @author longjin 4 * @brief 进程 5 * @date 2022-01-29 6 * 7 * @copyright Copyright (c) 2022 8 * 9 */ 10 11 #pragma once 12 #include "ptrace.h" 13 #include <common/errno.h> 14 #include <common/glib.h> 15 #include <syscall/syscall.h> 16 17 /** 18 * @brief 进程退出时执行的函数 19 * 20 * @param code 返回码 21 * @return ul 22 */ 23 extern ul rs_process_do_exit(ul code); 24 25 extern int rs_current_cpu_id(); 26 27 extern unsigned long head_stack_start; // 导出内核层栈基地址(定义在head.S) 28 extern ul _stack_start; 29 extern void ret_from_intr(void); // 导出从中断返回的函数(定义在entry.S) 30 31 extern uint32_t rs_current_pcb_cpuid(); 32 extern uint32_t rs_current_pcb_pid(); 33 extern uint32_t rs_current_pcb_preempt_count(); 34 extern uint32_t rs_current_pcb_flags(); 35 extern int64_t rs_current_pcb_thread_rbp(); 36 37 #define PF_NEED_SCHED (1UL << 1) 38