X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/cd103ea1b3ff029cfc458b3913975b5600915341..aa8afd3a17a7433230b76a1910ab3ddb83bcd227:/lunaix-os/includes/lunaix/process.h diff --git a/lunaix-os/includes/lunaix/process.h b/lunaix-os/includes/lunaix/process.h index 0b743d3..7a5d502 100644 --- a/lunaix-os/includes/lunaix/process.h +++ b/lunaix-os/includes/lunaix/process.h @@ -24,7 +24,7 @@ struct proc_mm { heap_context_t u_heap; - struct mm_region* regions; + struct mm_region regions; }; struct proc_sig @@ -38,11 +38,22 @@ struct proc_sig struct proc_info { + /* + Any change to *critical section*, including layout, size + must be reflected in kernel/asm/x86/interrupt.S to avoid + disaster! + */ + + /* ---- critical section start ---- */ + pid_t pid; struct proc_info* parent; isr_param intr_ctx; // size=76 uintptr_t ustack_top; void* page_table; + + /* ---- critical section end ---- */ + struct llist_header siblings; struct llist_header children; struct llist_header grp_member; @@ -60,11 +71,21 @@ struct proc_info extern volatile struct proc_info* __current; -pid_t -alloc_pid(); +/** + * @brief 分配并初始化一个进程控制块 + * + * @return struct proc_info* + */ +struct proc_info* +alloc_process(); +/** + * @brief 初始化进程用户空间 + * + * @param pcb + */ void -init_proc(struct proc_info* pcb); +init_proc_user_space(struct proc_info* pcb); /** * @brief 向系统发布一个进程,使其可以被调度。 @@ -72,7 +93,7 @@ init_proc(struct proc_info* pcb); * @param process */ void -push_process(struct proc_info* process); +commit_process(struct proc_info* process); pid_t destroy_process(pid_t pid);