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
Merge branch 'interrupt-rework' into prog-loader
[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 2cd4330b041b8f711bafb6bbf13d489aabe9104f..27137a103db53763d07f7c28d02b5f9a5107df29 100644
(file)
--- a/
lunaix-os/includes/lunaix/process.h
+++ b/
lunaix-os/includes/lunaix/process.h
@@
-3,7
+3,10
@@
#include <arch/x86/interrupts.h>
#include <lunaix/clock.h>
#include <arch/x86/interrupts.h>
#include <lunaix/clock.h>
+#include <lunaix/ds/waitq.h>
+#include <lunaix/fs.h>
#include <lunaix/mm/mm.h>
#include <lunaix/mm/mm.h>
+#include <lunaix/mm/region.h>
#include <lunaix/signal.h>
#include <lunaix/timer.h>
#include <lunaix/types.h>
#include <lunaix/signal.h>
#include <lunaix/timer.h>
#include <lunaix/types.h>
@@
-12,31
+15,29
@@
// 虽然内核不是进程,但为了区分,这里使用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_READY
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_TERM
MASK 0x6
+#define PROC_TERM
INATED(state) (state & 0x6)
#define PROC_FINPAUSE 1
#define PROC_FINPAUSE 1
-struct proc_
mm
+struct proc_
sigstate
{
{
-
heap_context_t u_heap
;
-
struct mm_region regions
;
+
isr_param proc_regs
;
+
char fxstate[512] __attribute__((aligned(16)))
;
};
struct proc_sig
{
void* signal_handler;
int sig_num;
};
struct proc_sig
{
void* signal_handler;
int sig_num;
- isr_param prev_context;
-};
-
-#define PROC_SIG_SIZE sizeof(struct proc_sig) // size=84
+ struct proc_sigstate prev_context;
+} __attribute__((packed));
struct proc_info
{
struct proc_info
{
@@
-48,17
+49,28
@@
struct proc_info
/* ---- critical section start ---- */
/* ---- 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; // offset = 0
+ struct proc_info* parent; // offset = 4
+ isr_param intr_ctx; // offset = 8
+ uintptr_t ustack_top; // offset = 84 -> 56 -> 60
+ void* page_table; // offset = 88 -> 60 -> 64
+ void* fxstate; // offset = 92 -> 64 -> 68
/* ---- critical section end ---- */
/* ---- critical section end ---- */
+ struct llist_header tasks;
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;
+ waitq_t waitqueue;
+
+ 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;
@@
-66,14
+78,22
@@
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];
int flags;
void* sig_handler[_SIG_NUM];
+ struct v_fdtable* fdtable;
+ struct v_dnode* cwd;
pid_t pgid;
pid_t pgid;
- struct lx_timer* timer;
};
extern volatile struct proc_info* __current;
};
extern volatile struct proc_info* __current;
+static inline void
+block_current()
+{
+ __current->state = PS_BLOCKED;
+}
+
/**
* @brief 分配并初始化一个进程控制块
*
/**
* @brief 分配并初始化一个进程控制块
*