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