git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: incorrect settings of msi registers.
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
process.h
diff --git
a/lunaix-os/includes/lunaix/process.h
b/lunaix-os/includes/lunaix/process.h
index 0b743d39c3058fff0d1d61b702ff149ae3a67d78..d35bfe77c7cc9ddb41be6f1ae04997a029744668 100644
(file)
--- a/
lunaix-os/includes/lunaix/process.h
+++ b/
lunaix-os/includes/lunaix/process.h
@@
-12,19
+12,21
@@
// 虽然内核不是进程,但为了区分,这里使用Pid=-1来指代内核。这主要是方便物理页所有权检查。
#define KERNEL_PID -1
// 虽然内核不是进程,但为了区分,这里使用Pid=-1来指代内核。这主要是方便物理页所有权检查。
#define KERNEL_PID -1
-#define P
ROC
_STOPPED 0
-#define P
ROC
_RUNNING 1
-#define P
ROC
_TERMNAT 2
-#define P
ROC
_DESTROY 4
-#define P
ROC
_BLOCKED 8
-#define P
ROC
_CREATED 16
+#define P
S
_STOPPED 0
+#define P
S
_RUNNING 1
+#define P
S
_TERMNAT 2
+#define P
S
_DESTROY 4
+#define P
S
_BLOCKED 8
+#define P
S
_CREATED 16
-#define PROC_TERMMASK 0x6
+#define PROC_TERMINATED(state) (state & 0x6)
+
+#define PROC_FINPAUSE 1
struct proc_mm
{
heap_context_t u_heap;
struct proc_mm
{
heap_context_t u_heap;
- struct mm_region
*
regions;
+ struct mm_region regions;
};
struct proc_sig
};
struct proc_sig
@@
-38,14
+40,33
@@
struct proc_sig
struct proc_info
{
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;
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;
struct llist_header siblings;
struct llist_header children;
struct llist_header grp_member;
+
+ struct
+ {
+ struct llist_header sleepers;
+ time_t wakeup_time;
+ time_t alarm_time;
+ } sleep;
+
struct proc_mm mm;
time_t created;
uint8_t state;
struct proc_mm mm;
time_t created;
uint8_t state;
@@
-53,18
+74,29
@@
struct proc_info
int32_t k_status;
sigset_t sig_pending;
sigset_t sig_mask;
int32_t k_status;
sigset_t sig_pending;
sigset_t sig_mask;
+ sigset_t sig_inprogress;
+ int flags;
void* sig_handler[_SIG_NUM];
pid_t pgid;
void* sig_handler[_SIG_NUM];
pid_t pgid;
- struct lx_timer* timer;
};
extern volatile struct proc_info* __current;
};
extern volatile struct proc_info* __current;
-pid_t
-alloc_pid();
+/**
+ * @brief 分配并初始化一个进程控制块
+ *
+ * @return struct proc_info*
+ */
+struct proc_info*
+alloc_process();
+/**
+ * @brief 初始化进程用户空间
+ *
+ * @param pcb
+ */
void
void
-init_proc(struct proc_info* pcb);
+init_proc
_user_space
(struct proc_info* pcb);
/**
* @brief 向系统发布一个进程,使其可以被调度。
/**
* @brief 向系统发布一个进程,使其可以被调度。
@@
-72,7
+104,7
@@
init_proc(struct proc_info* pcb);
* @param process
*/
void
* @param process
*/
void
-
push
_process(struct proc_info* process);
+
commit
_process(struct proc_info* process);
pid_t
destroy_process(pid_t pid);
pid_t
destroy_process(pid_t pid);