/DragonOS-0.1.8/kernel/src/process/ |
D | process.c | 44 extern void process_exit_sighand(struct process_control_block *pcb); 45 extern void process_exit_signal(struct process_control_block *pcb); 46 extern void initial_proc_init_signal(struct process_control_block *pcb); 47 extern void rs_process_exit_fpstate(struct process_control_block *pcb); 48 extern void rs_drop_address_space(struct process_control_block *pcb); 76 __attribute__((__section__(".data.init_proc_union"))) = {INITIAL_PROC(initial_proc_union.pcb)}; 78 struct process_control_block *initial_proc[MAX_CPU_NUM] = {&initial_proc_union.pcb, 0}; 89 extern int process_exit_files(struct process_control_block *pcb); 97 uint64_t process_exit_mm(struct process_control_block *pcb); 250 struct process_control_block *pcb = current_pcb; in process_do_exit() local [all …]
|
D | fork.c | 15 extern int process_copy_files(uint64_t clone_flags, struct process_control_block *pcb); 16 int process_copy_flags(uint64_t clone_flags, struct process_control_block *pcb); 17 int process_copy_mm(uint64_t clone_flags, struct process_control_block *pcb); 18 int process_copy_thread(uint64_t clone_flags, struct process_control_block *pcb, uint64_t stack_sta… 21 extern int process_copy_sighand(uint64_t clone_flags, struct process_control_block *pcb); 22 extern int process_copy_signal(uint64_t clone_flags, struct process_control_block *pcb); 23 extern void process_exit_sighand(struct process_control_block *pcb); 24 extern void process_exit_signal(struct process_control_block *pcb); 84 tsk->prev_pcb = &initial_proc_union.pcb; in do_fork() 86 tsk->next_pcb = initial_proc_union.pcb.next_pcb; in do_fork() [all …]
|
D | kthread.c | 44 struct kthread_info_t *to_kthread(struct process_control_block *pcb) in to_kthread() argument 46 WARN_ON(!(pcb->flags & PF_KTHREAD)); in to_kthread() 47 return pcb->worker_private; in to_kthread() 53 struct process_control_block *pcb = NULL; in __kthread_create_on_node() local 83 pcb = create->result; in __kthread_create_on_node() 95 struct kthread_info_t *kthread = to_kthread(pcb); in __kthread_create_on_node() 101 process_set_pcb_name(pcb, pcb_name); in __kthread_create_on_node() 106 return pcb; in __kthread_create_on_node() 141 struct process_control_block *pcb; in kthread_create_on_node() local 144 pcb = __kthread_create_on_node(thread_fn, data, node, name_fmt, args); in kthread_create_on_node() [all …]
|
D | process.h | 25 extern void process_exit_thread(struct process_control_block *pcb); 26 extern int process_exit_files(struct process_control_block *pcb); 106 int process_wakeup(struct process_control_block *pcb); 113 int process_wakeup_immediately(struct process_control_block *pcb); 121 uint64_t process_exit_mm(struct process_control_block *pcb); 150 int process_release_pcb(struct process_control_block *pcb); 185 void process_set_pcb_name(struct process_control_block *pcb, const char *pcb_name); 196 extern bool process_is_stopped(struct process_control_block *pcb); 212 extern int process_wake_up_state(struct process_control_block *pcb, uint64_t state);
|
D | initial_proc.rs | 28 pub extern "C" fn initial_proc_init_signal(pcb: *mut process_control_block) { in initial_proc_init_signal() 30 assert_eq!(unsafe { (*pcb).pid }, 0); in initial_proc_init_signal() 34 (*pcb).sighand = &mut INITIAL_SIGHAND as *mut sighand_struct as usize in initial_proc_init_signal() 36 (*pcb).signal = &mut INITIAL_SIGNALS as *mut signal_struct as usize in initial_proc_init_signal() 41 (*pcb).sig_pending.signal = 0; in initial_proc_init_signal() 42 (*pcb).sig_pending.sigqueue = in initial_proc_init_signal()
|
D | fork.rs | 24 pub extern "C" fn process_copy_sighand(clone_flags: u64, pcb: *mut process_control_block) -> i32 { in process_copy_sighand() 40 (*pcb).sighand = sig as *mut sighand_struct as usize in process_copy_sighand() 74 flush_signal_handlers(pcb, false); in process_copy_sighand() 83 pub extern "C" fn process_copy_signal(clone_flags: u64, pcb: *mut process_control_block) -> i32 { in process_copy_signal() 96 (*pcb).signal = sig as *mut signal_struct as usize in process_copy_signal() 102 (*pcb).sig_pending.signal = 0; in process_copy_signal() 103 (*pcb).sig_pending.sigqueue = in process_copy_signal() 110 pub extern "C" fn process_exit_signal(pcb: *mut process_control_block) { in process_exit_signal() 114 let sighand = Box::from_raw((*pcb).sighand as *mut sighand_struct); in process_exit_signal() 117 (*pcb).sighand = 0 as *mut crate::include::bindings::bindings::sighand_struct; in process_exit_signal() [all …]
|
D | c_adapter.rs | 38 pub extern "C" fn rs_drop_address_space(pcb: &'static mut process_control_block) -> i32 { in rs_drop_address_space() 40 pcb.drop_address_space(); in rs_drop_address_space() 68 pub extern "C" fn process_exit_files(pcb: &'static mut process_control_block) -> i32 { in process_exit_files() 69 let r: Result<(), SystemError> = pcb.exit_files(); in process_exit_files() 98 pub extern "C" fn rs_process_exit_fpstate(pcb: &'static mut process_control_block) { in rs_process_exit_fpstate() 99 if pcb.fp_state != null_mut() { in rs_process_exit_fpstate() 100 let state = pcb.fp_state as usize as *mut FpState; in rs_process_exit_fpstate()
|
D | process.rs | 31 pub extern "C" fn process_is_stopped(pcb: *const process_control_block) -> bool { in process_is_stopped() 32 let state: u64 = unsafe { read_volatile(&(*pcb).state) } as u64; in process_is_stopped() 58 let pcb = unsafe { _pcb.as_mut() }.unwrap(); in process_try_to_wake_up() localVariable 63 write_volatile(&mut pcb.state, PROC_RUNNING as u64); in process_try_to_wake_up() 72 if unsafe { read_volatile(&pcb.state) } & _state != 0 { in process_try_to_wake_up() 75 write_volatile(&mut pcb.state, PROC_RUNNING as u64); in process_try_to_wake_up() 77 sched_enqueue(pcb, true); in process_try_to_wake_up() 91 pub extern "C" fn process_wake_up_state(pcb: *mut process_control_block, state: u64) -> bool { in process_wake_up_state() 92 return process_try_to_wake_up(pcb, state, 0); in process_wake_up_state() 96 pub fn process_kick(pcb: *mut process_control_block) { in process_kick() [all …]
|
/DragonOS-0.1.8/kernel/src/sched/ |
D | core.rs | 42 pub fn loads_balance(pcb: &mut process_control_block) { in loads_balance() 47 let mut min_loads_cpu_id = pcb.cpu_id; in loads_balance() 48 let mut min_loads = get_cpu_loads(pcb.cpu_id); in loads_balance() 59 if (min_loads_cpu_id != pcb.cpu_id) && (pcb.flags & (PF_NEED_MIGRATE as u64)) == 0 { in loads_balance() 61 pcb.flags |= PF_NEED_MIGRATE as u64; in loads_balance() 62 pcb.migrate_to = min_loads_cpu_id; in loads_balance() 72 fn enqueue(&mut self, pcb: &'static mut process_control_block); in enqueue() 103 pub extern "C" fn sched_enqueue(pcb: &'static mut process_control_block, mut reset_time: bool) { in sched_enqueue() 107 if pcb.state & (PROC_RUNNING as u64) == 0 { in sched_enqueue() 114 if pcb.pid > 0 { in sched_enqueue() [all …]
|
D | rt.rs | 52 pub fn enqueue(&mut self, pcb: &'static mut process_control_block) { in enqueue() 57 if pcb.pid == 0 { in enqueue() 61 self.queue.push_back(pcb); in enqueue() 80 pub fn enqueue_front(&mut self, pcb: &'static mut process_control_block) { in enqueue_front() 85 if pcb.pid == 0 { in enqueue_front() 89 self.queue.push_front(pcb); in enqueue_front() 161 pub fn enqueue_front(&mut self, pcb: &'static mut process_control_block) { in enqueue_front() 162 self.cpu_queue[pcb.cpu_id as usize][pcb.priority as usize].enqueue_front(pcb); in enqueue_front() 214 fn enqueue(&mut self, pcb: &'static mut process_control_block) { in enqueue() 215 let cpu_id = pcb.cpu_id; in enqueue() [all …]
|
D | cfs.rs | 60 pub fn enqueue(&mut self, pcb: &'static mut process_control_block) { in enqueue() 65 if pcb.pid == 0 { in enqueue() 70 self.queue.insert(pcb.virtual_runtime, pcb); in enqueue() 127 result.cpu_queue[0].idle_pcb = unsafe { &mut initial_proc_union.pcb }; in new() 160 pub fn enqueue_reset_vruntime(&mut self, pcb: &'static mut process_control_block) { in enqueue_reset_vruntime() 161 let cpu_queue = &mut self.cpu_queue[pcb.cpu_id as usize]; in enqueue_reset_vruntime() 163 pcb.virtual_runtime = cpu_queue.min_vruntime().unwrap(); in enqueue_reset_vruntime() 166 cpu_queue.enqueue(pcb); in enqueue_reset_vruntime() 170 pub fn set_cpu_idle(&mut self, cpu_id: usize, pcb: *mut process_control_block) { in set_cpu_idle() 172 self.cpu_queue[cpu_id].idle_pcb = pcb; in set_cpu_idle() [all …]
|
D | sched.h | 65 extern void sched_enqueue(struct process_control_block *pcb, bool reset_time); 66 extern void sched_set_cpu_idle(uint64_t cpu_id, struct process_control_block *pcb); 67 extern void sched_migrate_process(struct process_control_block *pcb, uint64_t target);
|
D | syscall.rs | 21 let pcb = do_sched(); in sched() localVariable 23 if pcb.is_some() { in sched() 24 switch_process(current_pcb(), pcb.unwrap()); in sched()
|
/DragonOS-0.1.8/docs/kernel/sched/ |
D | cfs.md | 10 1. enqueue(): 将pcb入队列 11 2. dequeue(): 将pcb从调度队列中弹出,若队列为空,则返回IDLE进程的pcb 20 1. sched(): 是对于Scheduler trait的sched()实现,是普通进程进行调度时的逻辑处理,该函数会返回接下来要执行的pcb,若没有符合要求的pcb,返回None 21 2. enqueue(): 同样是对于Scheduler trait的sched()实现,将一个pcb加入调度器的调度队列
|
D | rt.md | 13 1. enqueue(): 将pcb入队列 14 2. dequeue(): 将pcb出队列 21 1. pick_next_task_rt(): 获取当前CPU中的第一个需要执行的RT pcb 22 2. sched(): 是对于Scheduler trait的sched()实现,是实时进程进行调度时的逻辑处理,该函数会返回接下来要执行的pcb,若没有符合要求的pcb,返回None 23 3. enqueue(): 同样是对于Scheduler trait的sched()实现,将一个pcb加入调度器的调度队列 43 struct process_control_block *pcb_name = kthread_run_rt(&fn_name, NULL, "test create rt pcb"); 47 2. pcb中涉及到实时进程的字段含义
|
D | c_waiting.md | 35 struct process_control_block *pcb; 49   函数`wait_queue_init(wait_queue_node_t *wait_queue, struct process_control_block *pcb)`提供… 97 | DECLARE_WAIT_ON_STACK(name, pcb) | 在栈上声明一个wait_queue节点,同时把pcb所代表的进程与该节点绑定 | 99 | DECLARE_WAIT_ALLOC(name, pcb) | 使用`kzalloc`声明一个wait_queue节点,同时把pcb所代表的进程与该节点绑定,请记得使用kfree释放空间 | 121 …eue_head_t *q, wait_queue_node_t *wait, void *lock) | 传入一个等待队列节点,将该节点的pcb指向的进程挂起,并设置挂起状态为PROC… 122 …rriptible(wait_queue_head_t *q, wait_queue_node_t *wait) | 传入一个等待队列节点,将该节点的pcb指向的进程挂起,并设置挂起状态为PROC…
|
/DragonOS-0.1.8/docs/kernel/process_management/ |
D | pcb.md | 11 ### 根据pid寻找pcb 15 该API提供了根据pid寻找pcb的功能,定义在`kernel/src/process/process.h`中。 17 当找到目标的pcb时,返回对应的pcb,否则返回NULL。 27 目标pcb
|
D | kthread.md | 13 …ead_stop()`函数。该函数将会置位内核线程的`worker_private`中的`KTHREAD_SHOULD_STOP`标志位,并等待内核线程的退出,然后获得返回值并清理内核线程的pcb。 51   创建好的内核线程的pcb 83   `int kthread_stop(struct process_control_block * pcb)` 91 **pcb** 93   内核线程的pcb
|
D | index.rst | 8 pcb
|
/DragonOS-0.1.8/kernel/src/libs/ |
D | wait_queue_head.c | 24 BUG_ON(wait->pcb == NULL); in wait_queue_sleep_with_node() 26 wait->pcb->state = PROC_UNINTERRUPTIBLE; in wait_queue_sleep_with_node() 39 BUG_ON(wait->pcb == NULL); in wait_queue_sleep_with_node_unlock() 41 wait->pcb->state = PROC_UNINTERRUPTIBLE; in wait_queue_sleep_with_node_unlock() 55 BUG_ON(wait->pcb == NULL); in wait_queue_sleep_with_node_interriptible() 57 wait->pcb->state = PROC_INTERRUPTIBLE; in wait_queue_sleep_with_node_interriptible() 77 if (wait->pcb->state & state) in wait_queue_wakeup_on_stack() 80 process_wakeup_immediately(wait->pcb); in wait_queue_wakeup_on_stack()
|
D | wait_queue.c | 13 void wait_queue_init(wait_queue_node_t *wait_queue, struct process_control_block *pcb) in wait_queue_init() argument 16 wait_queue->pcb = pcb; in wait_queue_init() 78 if (wait->pcb->state & state) in wait_queue_wakeup() 81 process_wakeup(wait->pcb); in wait_queue_wakeup()
|
/DragonOS-0.1.8/kernel/src/common/ |
D | wait_queue.h | 15 struct process_control_block *pcb; member 24 void wait_queue_init(wait_queue_node_t *wait_queue, struct process_control_block *pcb); 60 #define DECLARE_WAIT_ON_STACK(name, pcb) \ argument 62 wait_queue_init(&(name), pcb); 68 #define DECLARE_WAIT_ALLOC(name, pcb) \ argument 70 wait_queue_init(&(name), pcb);
|
D | kthread.h | 80 int kthread_stop(struct process_control_block *pcb); 110 bool kthread_set_worker_private(struct process_control_block *pcb); 118 struct kthread_info_t *to_kthread(struct process_control_block *pcb); 125 void free_kthread_struct(struct process_control_block *pcb);
|
/DragonOS-0.1.8/kernel/src/ipc/ |
D | signal.rs | 92 let pcb = unsafe { process_find_pcb_by_pid(pid).as_mut() }; in signal_kill_proc_info() localVariable 94 if pcb.is_none() { in signal_kill_proc_info() 102 retval = signal_send_sig_info(sig, info, pcb.unwrap()); in signal_kill_proc_info() 155 pcb: &'a mut process_control_block, in lock_process_sighand() 160 let sighand_ptr = sighand_struct::convert_mut(unsafe { &mut *pcb.sighand }); in lock_process_sighand() 163 kBUG!("Sighand ptr of process {pid} is NULL!", pid = pcb.pid); in lock_process_sighand() 170 let ret = unsafe { ((*pcb).sighand as *mut sighand_struct).as_mut() }; in lock_process_sighand() 178 fn unlock_process_sighand(pcb: &mut process_control_block, flags: usize) { in unlock_process_sighand() 179 let lock = unsafe { &mut (*pcb.sighand).siglock }; in unlock_process_sighand() 191 pcb: &mut process_control_block, in send_signal_locked() [all …]
|
/DragonOS-0.1.8/kernel/src/arch/x86_64/ |
D | fpu.rs | 81 pub fn fp_state_save(pcb: &mut process_control_block) { in fp_state_save() 85 let fp: &mut FpState = if pcb.fp_state == null_mut() { in fp_state_save() 87 pcb.fp_state = f as *mut FpState as usize as *mut c_void; in fp_state_save() 90 unsafe { (pcb.fp_state as usize as *mut FpState).as_mut().unwrap() } in fp_state_save() 119 pub fn fp_state_restore(pcb: &mut process_control_block) { in fp_state_restore() 123 if pcb.fp_state == null_mut() { in fp_state_restore() 124 panic!("fp_state_restore: fp_state is null. pid={}", pcb.pid); in fp_state_restore() 141 let fp = unsafe { (pcb.fp_state as usize as *mut FpState).as_mut().unwrap() }; in fp_state_restore()
|