/DragonOS-0.1.7/kernel/src/libs/ |
D | wait_queue.rs | 5 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 …]
|
D | wait_queue.c | 27 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()
|
D | semaphore.c | 14 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()
|
D | mutex.rs | 9 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()
|
D | mutex.c | 19 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()
|
D | semaphore.rs | 3 use crate::{arch::asm::current::current_pcb, kdebug, syscall::SystemError}; 54 current_pcb().pid, in up()
|
/DragonOS-0.1.7/kernel/src/smp/ |
D | smp.c | 139 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(¤t_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/ |
D | trap.c | 16 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/ |
D | process.c | 231 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 …]
|
D | preempt.rs | 1 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()
|
D | preempt.h | 14 ++(current_pcb->preempt_count);\ 24 --(current_pcb->preempt_count);\
|
D | process.rs | 9 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 …]
|
D | kthread.c | 116 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()
|
D | fork.c | 54 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 …]
|
D | pid.rs | 1 use crate::{arch::asm::current::current_pcb, include::bindings::bindings::pt_regs}; 27 return current_pcb().pid as u64; in sys_getpid()
|
D | fork.rs | 6 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/ |
D | syscall.c | 197 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/ |
D | cpu.rs | 3 use super::asm::current::current_pcb; 9 current_pcb().cpu_id as u32 in current_cpu_id()
|
/DragonOS-0.1.7/kernel/src/sched/ |
D | cfs.rs | 6 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()
|
D | core.rs | 4 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()
|
D | rt.rs | 6 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/ |
D | syscall.rs | 2 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()
|
D | signal.rs | 10 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/ |
D | sleep.rs | 7 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/ |
D | traceback.c | 39 … 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()
|