Home
last modified time | relevance | path

Searched refs:current_pcb (Results 1 – 25 of 43) sorted by relevance

12

/DragonOS-0.1.7/kernel/src/libs/
Dwait_queue.rs5 arch::{asm::current::current_pcb, sched::sched, CurrentIrqArch},
46 current_pcb().state = PROC_INTERRUPTIBLE as u64; in sleep()
47 guard.wait_list.push_back(current_pcb()); in sleep()
59 current_pcb().state = PROC_INTERRUPTIBLE as u64; in sleep_with_func()
60 guard.wait_list.push_back(current_pcb()); in sleep_with_func()
84 current_pcb().state = PROC_INTERRUPTIBLE as u64; in sleep_without_schedule()
85 guard.wait_list.push_back(current_pcb()); in sleep_without_schedule()
91 current_pcb().state = PROC_UNINTERRUPTIBLE as u64; in sleep_uninterruptible()
92 guard.wait_list.push_back(current_pcb()); in sleep_uninterruptible()
101 current_pcb().state = PROC_INTERRUPTIBLE as u64; in sleep_unlock_spinlock()
[all …]
Dwait_queue.c27 wait_queue_init(wait, current_pcb); in wait_queue_sleep_on()
28 current_pcb->state = PROC_UNINTERRUPTIBLE; in wait_queue_sleep_on()
43 wait_queue_init(wait, current_pcb); in wait_queue_sleep_on_unlock()
44 current_pcb->state = PROC_UNINTERRUPTIBLE; in wait_queue_sleep_on_unlock()
58 wait_queue_init(wait, current_pcb); in wait_queue_sleep_on_interriptible()
59 current_pcb->state = PROC_INTERRUPTIBLE; in wait_queue_sleep_on_interriptible()
Dsemaphore.c14 wait_queue_init(&wait, current_pcb); in semaphore_down()
16 current_pcb->state = PROC_UNINTERRUPTIBLE; in semaphore_down()
21 current_pcb->flags |= PF_NEED_SCHED; in semaphore_down()
Dmutex.rs9 arch::{asm::current::current_pcb, sched::sched},
68 if self.check_pid_in_wait_list(&inner, current_pcb().pid) == false { in lock()
69 inner.wait_list.push_back(current_pcb()); in lock()
107 current_pcb().state &= !(PROC_RUNNING as u64); in __sleep()
108 current_pcb().state |= PROC_INTERRUPTIBLE as u64; in __sleep()
Dmutex.c19 current_pcb->state = PROC_UNINTERRUPTIBLE; in __mutex_sleep()
20 current_pcb->flags |= PF_NEED_SCHED; in __mutex_sleep()
49 waiter->pcb = current_pcb; in mutex_lock()
Dsemaphore.rs3 use crate::{arch::asm::current::current_pcb, kdebug, syscall::SystemError};
54 current_pcb().pid, in up()
/DragonOS-0.1.7/kernel/src/smp/
Dsmp.c139 kdebug("init proc's preempt_count=%ld", current_pcb->preempt_count); in smp_init()
162 memset(current_pcb, 0, sizeof(struct process_control_block)); in smp_ap_start()
165 current_pcb->state = PROC_RUNNING; in smp_ap_start()
166 current_pcb->flags = PF_KTHREAD; in smp_ap_start()
167 current_pcb->mm = &initial_mm; in smp_ap_start()
169 list_init(&current_pcb->list); in smp_ap_start()
170 current_pcb->addr_limit = KERNEL_BASE_LINEAR_ADDR; in smp_ap_start()
171 current_pcb->priority = 2; in smp_ap_start()
172 current_pcb->virtual_runtime = 0; in smp_ap_start()
174 current_pcb->thread = (struct thread_struct *)(current_pcb + 1); // 将线程结构体放置在pcb后方 in smp_ap_start()
[all …]
/DragonOS-0.1.7/kernel/src/exception/
Dtrap.c16 regs->rsp, regs->rip, proc_current_cpu_id, current_pcb->pid); in do_divide_error()
18 current_pcb->state = PROC_STOPPED; in do_divide_error()
28 proc_current_cpu_id, current_pcb->pid); in do_debug()
69 current_pcb->state = PROC_STOPPED; in do_overflow()
89 regs->rsp, regs->rip, proc_current_cpu_id, current_pcb->pid); in do_undefined_opcode()
91 current_pcb->state = PROC_STOPPED; in do_undefined_opcode()
100 regs->rip, proc_current_cpu_id, current_pcb->pid); in do_dev_not_avaliable()
102 current_pcb->state = PROC_STOPPED; in do_dev_not_avaliable()
115 current_pcb->state = PROC_STOPPED; in do_double_fault()
126 current_pcb->state = PROC_STOPPED; in do_coprocessor_segment_overrun()
[all …]
/DragonOS-0.1.7/kernel/src/process/
Dprocess.c231 current_pcb->mm->code_addr_start = ehdr.e_entry; in process_load_elf_file()
296 … mm_create_vma(current_pcb->mm, virt_base, PAGE_2M_SIZE, VM_USER | VM_ACCESS_FLAGS, NULL, &vma); in process_load_elf_file()
302 mm_map(current_pcb->mm, virt_base, PAGE_2M_SIZE, pa); in process_load_elf_file()
318 … int val = mm_create_vma(current_pcb->mm, virt_base + off, PAGE_4K_SIZE, VM_USER | VM_ACCESS_FLAGS, in process_load_elf_file()
324 mm_map(current_pcb->mm, virt_base + off, PAGE_4K_SIZE, paddr); in process_load_elf_file()
375 regs->rsp = current_pcb->mm->stack_start; in process_load_elf_file()
376 regs->rbp = current_pcb->mm->stack_start; in process_load_elf_file()
381 …int val = mm_create_vma(current_pcb->mm, current_pcb->mm->stack_start - PAGE_2M_SIZE, PAGE_2M_SIZE, in process_load_elf_file()
390 memset((void *)(current_pcb->mm->stack_start - PAGE_2M_SIZE), 0, PAGE_2M_SIZE); in process_load_elf_file()
419 if (current_pcb->flags & PF_VFORK) in do_execve()
[all …]
Dpreempt.rs1 use crate::arch::asm::current::current_pcb;
6 current_pcb().preempt_count += 1; in preempt_disable()
12 current_pcb().preempt_count -= 1; in preempt_enable()
Dpreempt.h14 ++(current_pcb->preempt_count);\
24 --(current_pcb->preempt_count);\
Dprocess.rs9 arch::{asm::current::current_pcb, fpu::FpState},
59 if current_pcb() as *mut process_control_block as usize == _pcb as usize { in process_try_to_wake_up()
190 if let Some(f) = FileDescriptorVec::from_pcb(current_pcb()) { in alloc_fd()
195 let r: Option<&mut FileDescriptorVec> = FileDescriptorVec::from_pcb(current_pcb()); in alloc_fd()
237 let r: &mut FileDescriptorVec = FileDescriptorVec::from_pcb(current_pcb()).unwrap(); in get_file_mut_by_fd()
251 let r: &mut FileDescriptorVec = FileDescriptorVec::from_pcb(current_pcb()).unwrap(); in get_file_ref_by_fd()
263 let r: &mut FileDescriptorVec = FileDescriptorVec::from_pcb(current_pcb()).unwrap(); in drop_fd()
322 let r = current_pcb().init_files(); in process_init_files()
339 let r = current_pcb().copy_files(clone_flags, from); in process_copy_files()
367 if current_pcb().fp_state == null_mut() { in rs_dup_fpstate()
[all …]
Dkthread.c116 struct kthread_info_t *kt = to_kthread(current_pcb); in kthread_exit()
163 struct kthread_info_t *self = to_kthread(current_pcb); in kthread()
172 current_pcb->state = PROC_UNINTERRUPTIBLE; in kthread()
175 create->result = current_pcb; in kthread()
177 current_pcb->state &= ~PROC_RUNNING; // 设置当前进程不是RUNNING态 in kthread()
216 struct process_control_block *pcb = current_pcb; in kthreadd()
218 kthreadd_pcb = current_pcb; in kthreadd()
220 current_pcb->flags |= PF_NOFREEZE; in kthreadd()
224 current_pcb->state = PROC_INTERRUPTIBLE; in kthreadd()
261 struct kthread_info_t *self = to_kthread(current_pcb); in kthread_should_stop()
Dfork.c54 memcpy(tsk, current_pcb, sizeof(struct process_control_block)); in do_fork()
63 if ((current_pcb->flags & PF_KTHREAD) && stack_start != 0) in do_fork()
89 tsk->parent_pcb = current_pcb; in do_fork()
97 tsk->parent_pcb = current_pcb; in do_fork()
192 pcb->mm = current_pcb->mm; in process_copy_mm()
201 memcpy(new_mms, current_pcb->mm, sizeof(struct mm_struct)); in process_copy_mm()
214 uint64_t *current_pgd = (uint64_t *)phys_2_virt(current_pcb->mm->pgd); in process_copy_mm()
219 struct vm_area_struct *vma = current_pcb->mm->vmas; in process_copy_mm()
283 uint64_t old_top = (uint64_t)(current_pcb) + STACK_SIZE; in process_rewrite_rbp()
333 uint32_t size = ((uint64_t)current_pcb) + STACK_SIZE - (uint64_t)(current_regs); in process_copy_thread()
[all …]
Dpid.rs1 use crate::{arch::asm::current::current_pcb, include::bindings::bindings::pt_regs};
27 return current_pcb().pid as u64; in sys_getpid()
Dfork.rs6 arch::asm::current::current_pcb,
28 let r = RefCount::convert_mut(unsafe { &mut (*(current_pcb().sighand)).count }).unwrap(); in process_copy_sighand()
49 spin_lock_irqsave(unsafe { &mut (*current_pcb().sighand).siglock }, &mut flags); in process_copy_sighand()
52 for (index, x) in unsafe { (*current_pcb().sighand).action } in process_copy_sighand()
67 spin_unlock_irqrestore(unsafe { &mut (*current_pcb().sighand).siglock }, &flags); in process_copy_sighand()
/DragonOS-0.1.7/kernel/src/syscall/
Dsyscall.c197 struct mm_struct *mm = current_pcb->mm; in sys_brk()
198 if (new_brk < mm->brk_start || new_brk > new_brk >= current_pcb->addr_limit) in sys_brk()
205 if (new_brk >= current_pcb->mm->brk_end) in sys_brk()
206 offset = (int64_t)(new_brk - current_pcb->mm->brk_end); in sys_brk()
208 offset = -(int64_t)(current_pcb->mm->brk_end - new_brk); in sys_brk()
210 new_brk = mm_do_brk(current_pcb->mm->brk_end, offset); // 扩展堆内存空间 in sys_brk()
212 current_pcb->mm->brk_end = new_brk; in sys_brk()
224 uint64_t retval = current_pcb->mm->brk_end; in sys_sbrk()
229 if (new_brk > current_pcb->addr_limit) // 堆地址空间超过限制 in sys_sbrk()
237 … if ((__int128_t)current_pcb->mm->brk_end + (__int128_t)regs->r8 < current_pcb->mm->brk_start) in sys_sbrk()
[all …]
/DragonOS-0.1.7/kernel/src/arch/x86_64/
Dcpu.rs3 use super::asm::current::current_pcb;
9 current_pcb().cpu_id as u32 in current_cpu_id()
/DragonOS-0.1.7/kernel/src/sched/
Dcfs.rs6 arch::asm::current::current_pcb,
144 let current_cpu_queue: &mut CFSQueue = self.cpu_queue[current_pcb().cpu_id as usize]; in timer_update_jiffies()
152 current_pcb().flags |= PF_NEED_SCHED as u64; in timer_update_jiffies()
157 current_pcb().virtual_runtime += 1; in timer_update_jiffies()
185 current_pcb().flags &= !(PF_NEED_SCHED as u64); in sched()
195 if (current_pcb().state & (PROC_RUNNING as u64)) == 0 in sched()
196 || current_pcb().virtual_runtime >= proc.virtual_runtime in sched()
200 if current_pcb().state & (PROC_RUNNING as u64) != 0 { in sched()
201 sched_enqueue(current_pcb(), false); in sched()
Dcore.rs4 arch::asm::{current::current_pcb, ptrace::user_mode},
26 if cpu_id == process_cpu(current_pcb()) { in cpu_executing()
27 return current_pcb(); in cpu_executing()
85 match rt_scheduler.pick_next_task_rt(current_pcb().cpu_id) { in __sched()
158 match current_pcb().policy { in sched_update_jiffies()
163 current_pcb().rt_time_slice -= 1; in sched_update_jiffies()
185 switch_process(current_pcb(), pcb.unwrap()); in sys_sched()
Drt.rs6 arch::asm::current::current_pcb,
172 current_pcb().flags &= !(PF_NEED_SCHED as u64); in sched()
174 let cpu_id = current_pcb().cpu_id; in sched()
181 if proc.priority <= current_pcb().priority { in sched()
185 sched_enqueue(current_pcb(), false); in sched()
193 if proc.priority >= current_pcb().priority { in sched()
203 sched_enqueue(current_pcb(), false); in sched()
/DragonOS-0.1.7/kernel/src/ipc/
Dsyscall.rs2 arch::asm::current::current_pcb,
24 let read_fd = current_pcb().alloc_fd(read_file.unwrap(), None); in do_pipe()
29 let write_fd = current_pcb().alloc_fd(write_file.unwrap(), None); in do_pipe()
Dsignal.rs10 asm::{bitops::ffz, current::current_pcb, ptrace::user_mode},
290 q._sinfo.data._sifields._kill._pid = current_pcb().pid; in __send_signal_locked()
294 let sq: &mut SigQueue = SigQueue::from_c_void(current_pcb().sig_pending.sigqueue); in __send_signal_locked()
437 if current_pcb().sig_pending.signal == 0 || (!user_mode(regs)) { in do_signal()
446 let oldset = current_pcb().sig_blocked; in do_signal()
456 current_pcb().pid in do_signal()
463 current_pcb().pid, in do_signal()
484 let _tmp = sighand_struct::convert_mut(current_pcb().sighand); in get_signal_to_deliver()
488 panic!("Sighand is NULL! pid={}", current_pcb().pid); in get_signal_to_deliver()
495 dequeue_signal(sigset_t::convert_mut(&mut current_pcb().sig_blocked).unwrap()); in get_signal_to_deliver()
[all …]
/DragonOS-0.1.7/kernel/src/time/
Dsleep.rs7 asm::current::current_pcb,
45 let handler: Box<WakeUpHelper> = WakeUpHelper::new(current_pcb()); in nano_sleep()
54 current_pcb().mark_sleep_interruptible(); in nano_sleep()
/DragonOS-0.1.7/kernel/src/debug/traceback/
Dtraceback.c39 … BLACK, "Kernel traceback: Fault in userland. pid=%ld, rbp=%#018lx\n", current_pcb->pid, regs->rbp… in traceback()
59 if((uint64_t)(rbp) >= current_pcb->thread->rbp || ((uint64_t)rbp<regs->rsp)) in traceback()

12