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