X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/fa57b4a05aa12d594f40e0894e0ac6f810a7095c..2a49908006b177c4d6354309333d06b1b96e4887:/lunaix-os/includes/lunaix/process.h diff --git a/lunaix-os/includes/lunaix/process.h b/lunaix-os/includes/lunaix/process.h index c014443..974907d 100644 --- a/lunaix-os/includes/lunaix/process.h +++ b/lunaix-os/includes/lunaix/process.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -25,12 +26,6 @@ #define PROC_FINPAUSE 1 -struct proc_mm -{ - heap_context_t u_heap; - struct mm_region regions; -}; - struct proc_sigstate { isr_param proc_regs; @@ -57,9 +52,9 @@ struct proc_info pid_t pid; // offset = 0 struct proc_info* parent; // offset = 4 isr_param intr_ctx; // offset = 8 - uintptr_t ustack_top; // offset = 84 - void* page_table; // offset = 88 - void* fxstate; // offset = 92 + ptr_t ustack_top; // offset = 84 -> 56 -> 60 + ptr_t page_table; // offset = 88 -> 60 -> 64 + void* fxstate; // offset = 92 -> 64 -> 68 /* ---- critical section end ---- */ @@ -78,7 +73,7 @@ struct proc_info struct proc_mm mm; time_t created; - uint8_t state; + u8_t state; int32_t exit_code; int32_t k_status; sigset_t sig_pending; @@ -93,6 +88,12 @@ struct proc_info extern volatile struct proc_info* __current; +static inline void +block_current() +{ + __current->state = PS_BLOCKED; +} + /** * @brief 分配并初始化一个进程控制块 * @@ -121,7 +122,7 @@ pid_t destroy_process(pid_t pid); void -setup_proc_mem(struct proc_info* proc, uintptr_t kstack_from); +setup_proc_mem(struct proc_info* proc, ptr_t kstack_from); /** * @brief 复制当前进程(LunaixOS的类 fork (unix) 实现)