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 16 /** 17 * @brief 进程退出时执行的函数 18 * 19 * @param code 返回码 20 * @return ul 21 */ 22 extern ul rs_process_do_exit(ul code); 23 24 extern int rs_current_cpu_id(); 25 26 extern unsigned long head_stack_start; // 导出内核层栈基地址(定义在head.S) 27 extern ul _stack_start; 28 extern void ret_from_intr(void); // 导出从中断返回的函数(定义在entry.S) 29 30 extern uint32_t rs_current_pcb_cpuid(); 31 extern uint32_t rs_current_pcb_pid(); 32 extern uint32_t rs_current_pcb_preempt_count(); 33 extern uint32_t rs_current_pcb_flags(); 34 extern uint64_t rs_current_pcb_thread_rbp(); 35 36 #define PF_NEED_SCHED (1UL << 1) 37