/DragonOS-0.1.2/kernel/src/common/ |
D | spinlock.h | 22 int8_t lock; // 1:unlocked 0:locked member 25 extern void __arch_spin_lock(spinlock_t *lock); 26 extern void __arch_spin_unlock(spinlock_t *lock); 28 extern void __arch_spin_lock_no_preempt(spinlock_t *lock); 29 extern void __arch_spin_unlock_no_preempt(spinlock_t *lock); 31 extern long __arch_spin_trylock(spinlock_t *lock); 38 void spin_lock(spinlock_t *lock) in spin_lock() argument 40 __arch_spin_lock(lock); in spin_lock() 48 void spin_unlock(spinlock_t *lock) in spin_unlock() argument 50 __arch_spin_unlock(lock); in spin_unlock() [all …]
|
D | mutex.h | 39 void mutex_init(mutex_t *lock); 46 void mutex_lock(mutex_t *lock); 53 void mutex_unlock(mutex_t *lock); 62 int mutex_trylock(mutex_t *lock); 69 #define mutex_is_locked(lock) ((atomic_read(&(lock)->count) == 1) ? 0 : 1) argument
|
D | kfifo.h | 130 …ays_inline kfifo_in_locked(struct kfifo_t *fifo, const void *from, uint32_t size, spinlock_t *lock) in kfifo_in_locked() argument 132 spin_lock(lock); in kfifo_in_locked() 134 spin_unlock(lock); in kfifo_in_locked() 147 …t __always_inline kfifo_out_locked(struct kfifo_t *fifo, void *to, uint32_t size, spinlock_t *lock) in kfifo_out_locked() argument 149 spin_lock(lock); in kfifo_out_locked() 151 spin_unlock(lock); in kfifo_out_locked()
|
D | wait_queue.h | 38 void wait_queue_sleep_on_unlock(wait_queue_node_t *wait_queue_head, void *lock); 57 spinlock_t lock; // 队列需要有一个自旋锁,虽然目前内部并没有使用,但是以后可能会用.[在completion内部使用] member 102 void wait_queue_sleep_with_node_unlock(wait_queue_head_t *q, wait_queue_node_t *wait, void *lock);
|
D | lockref.h | 19 spinlock_t lock; member
|
/DragonOS-0.1.2/kernel/src/libs/ |
D | mutex.c | 10 void mutex_init(mutex_t *lock) in mutex_init() argument 12 atomic_set(&lock->count, 1); in mutex_init() 13 spin_init(&lock->wait_lock); in mutex_init() 14 list_init(&lock->wait_list); in mutex_init() 23 static void __mutex_acquire(mutex_t *lock) in __mutex_acquire() argument 31 void mutex_lock(mutex_t *lock) in mutex_lock() argument 37 spin_lock(&lock->wait_lock); in mutex_lock() 38 if (likely(mutex_is_locked(lock))) in mutex_lock() 44 spin_unlock(&lock->wait_lock); in mutex_lock() 50 list_append(&lock->wait_list, &waiter->list); in mutex_lock() [all …]
|
D | spinlock.rs | 10 pub fn spin_lock_irqsave(lock: *mut spinlock_t, flags: &mut u64) { in spin_lock_irqsave() 13 spin_lock(lock); in spin_lock_irqsave() 19 pub fn spin_unlock_irqrestore(lock: *mut spinlock_t, flags: &u64) { in spin_unlock_irqrestore() 21 spin_unlock(lock); in spin_unlock_irqrestore() 29 pub fn spin_is_locked(lock: &spinlock_t) -> bool { in spin_is_locked() 30 let val = unsafe { read_volatile(&lock.lock as *const i8) }; in spin_is_locked() 37 Self { lock: 1 } in default() 42 pub fn spin_lock_irq(lock: *mut spinlock_t){ in spin_lock_irq() 44 unsafe{spin_lock(lock);} in spin_lock_irq() 48 pub fn spin_unlock_irq(lock: *mut spinlock_t){ in spin_unlock_irq() [all …]
|
D | lockref.c | 13 … while (likely(!spin_is_locked(&old.lock))) \ 46 spin_lock(&lock_ref->lock); in lockref_inc() 48 spin_unlock(&lock_ref->lock); in lockref_inc() 66 spin_lock(&lock_ref->lock); in lockref_inc_not_zero() 73 spin_unlock(&lock_ref->lock); in lockref_inc_not_zero() 97 spin_lock(&lock_ref->lock); in lockref_dec() 103 spin_unlock(&lock_ref->lock); in lockref_dec() 148 spin_lock(&lock_ref->lock); in lockref_dec_not_zero() 154 spin_unlock(&lock_ref->lock); in lockref_dec_not_zero() 177 spin_lock(&lock_ref->lock); in lockref_dec_or_lock_not_zero() [all …]
|
D | wait_queue_head.c | 14 spin_init(&wait_queue->lock); in wait_queue_head_init() 37 void wait_queue_sleep_with_node_unlock(wait_queue_head_t *q, wait_queue_node_t *wait, void *lock) in wait_queue_sleep_with_node_unlock() argument 43 spin_unlock((spinlock_t *)lock); in wait_queue_sleep_with_node_unlock()
|
D | wait_queue.rs | 8 let mut x = Self { wait_list: Default::default(), lock: Default::default() }; in default()
|
D | wait_queue.c | 40 void *lock) in wait_queue_sleep_on_unlock() argument 46 spin_unlock((spinlock_t *)lock); in wait_queue_sleep_on_unlock()
|
/DragonOS-0.1.2/kernel/src/arch/x86_64/asm/ |
D | spinlock.c | 4 void __arch_spin_lock(spinlock_t *lock) in __arch_spin_lock() argument 15 : "=m"(lock->lock)::"memory"); in __arch_spin_lock() 19 void __arch_spin_unlock(spinlock_t *lock) in __arch_spin_unlock() argument 22 __asm__ __volatile__("movb $1, %0 \n\t" : "=m"(lock->lock)::"memory"); in __arch_spin_unlock() 25 void __arch_spin_lock_no_preempt(spinlock_t *lock) in __arch_spin_lock_no_preempt() argument 36 : "=m"(lock->lock)::"memory"); in __arch_spin_lock_no_preempt() 39 void __arch_spin_unlock_no_preempt(spinlock_t *lock) in __arch_spin_unlock_no_preempt() argument 41 __asm__ __volatile__("movb $1, %0 \n\t" : "=m"(lock->lock)::"memory"); in __arch_spin_unlock_no_preempt() 44 long __arch_spin_trylock(spinlock_t *lock) in __arch_spin_trylock() argument 50 : "=q"(tmp_val), "=m"(lock->lock) in __arch_spin_trylock()
|
/DragonOS-0.1.2/kernel/src/sched/ |
D | completion.c | 23 spin_lock(&x->wait_queue.lock); in complete() 29 spin_unlock(&x->wait_queue.lock); in complete() 39 spin_lock(&x->wait_queue.lock); in complete_all() 45 spin_unlock(&x->wait_queue.lock); in complete_all() 70 spin_unlock(&x->wait_queue.lock); in __wait_for_common() 73 spin_lock(&x->wait_queue.lock); in __wait_for_common() 94 spin_lock(&x->wait_queue.lock); in wait_for_completion() 96 spin_unlock(&x->wait_queue.lock); in wait_for_completion() 109 spin_lock(&x->wait_queue.lock); in wait_for_completion_timeout() 111 spin_unlock(&x->wait_queue.lock); in wait_for_completion_timeout() [all …]
|
/DragonOS-0.1.2/docs/kernel/locking/ |
D | locks.md | 72 **`void mutex_init(mutex_t *lock)`** 78 **`void mutex_lock(mutex_t *lock)`** 84 **`void mutex_unlock(mutex_t *lock)`** 90 **`void mutex_trylock(mutex_t *lock)`** 96 **`void mutex_is_locked(mutex_t *lock)`**
|
D | lockref.md | 18 spinlock_t lock; 31   在改变引用计数时,cmpxchg先确保没有别的线程持有锁,然后改变引用计数,同时通过`lock cmpxchg`指令验证在更改发生时,没有其他线程持有锁,并且当前的目标loc…
|
/DragonOS-0.1.2/kernel/src/ipc/ |
D | pipe.c | 17 spinlock_t lock; member 38 spin_lock(&pipe_ptr->data.lock); in pipe_read() 44 wait_queue_sleep_on_unlock(&pipe_ptr->data.read_wait_queue, (void *)&pipe_ptr->data.lock); in pipe_read() 45 spin_lock(&pipe_ptr->data.lock); in pipe_read() 57 spin_unlock(&pipe_ptr->data.lock); in pipe_read() 71 spin_lock(&pipe_ptr->data.lock); in pipe_write() 77 wait_queue_sleep_on_unlock(&pipe_ptr->data.write_wait_queue, (void *)&pipe_ptr->data.lock); in pipe_write() 78 spin_lock(&pipe_ptr->data.lock); in pipe_write() 90 spin_unlock(&pipe_ptr->data.lock); in pipe_write() 117 spin_init(&pipe_ptr->data.lock); in pipe_alloc()
|
/DragonOS-0.1.2/kernel/src/filesystem/VFS/ |
D | VFS.c | 301 spin_lock(&parent_dir->lockref.lock); in vfs_mkdir() 315 spin_lock(&parent_dir->dir_inode->lockref.lock); in vfs_mkdir() 317 spin_unlock(&parent_dir->dir_inode->lockref.lock); in vfs_mkdir() 322 spin_unlock(&parent_dir->lockref.lock); in vfs_mkdir() 333 spin_lock(&prev_dentry->lockref.lock); in vfs_mkdir() 336 spin_unlock(&prev_dentry->lockref.lock); in vfs_mkdir() 345 spin_unlock(&parent_dir->lockref.lock); in vfs_mkdir() 448 spin_lock(&parent_dentry->lockref.lock); in do_open() 449 spin_lock(&parent_dentry->dir_inode->lockref.lock); in do_open() 452 spin_unlock(&parent_dentry->dir_inode->lockref.lock); // 解锁inode in do_open() [all …]
|
D | dcache.c | 63 spin_lock(&dentry->lockref.lock); in vfs_dentry_put() 67 spin_unlock(&dentry->lockref.lock); in vfs_dentry_put() 71 spin_lock(&dentry->dir_inode->lockref.lock); in vfs_dentry_put() 75 spin_unlock(&dentry->dir_inode->lockref.lock); in vfs_dentry_put() 95 spin_lock(&dentry->dir_inode->lockref.lock); in vfs_dentry_put() 99 spin_unlock(&dentry->dir_inode->lockref.lock); in vfs_dentry_put()
|
/DragonOS-0.1.2/kernel/src/filesystem/devfs/ |
D | chardev.c | 34 mutex_t lock; // 操作互斥锁 member 50 mutex_lock(&chardev_manage_info[private_info->sub_type].lock); in __devfs_chardev_register() 67 mutex_unlock(&chardev_manage_info[private_info->sub_type].lock); in __devfs_chardev_register() 81 mutex_init(&chardev_manage_info[i].lock); in __devfs_chardev_init()
|
/DragonOS-0.1.2/user/libs/libc/ |
D | .gitignore | 2 Cargo.lock
|
D | Makefile | 6 rm -f Cargo.lock
|
/DragonOS-0.1.2/kernel/ |
D | Makefile | 7 rm -f Cargo.lock
|
D | .gitignore | 3 Cargo.lock
|
/DragonOS-0.1.2/kernel/src/libs/libUI/ |
D | textui.c | 38 window->lock.lock = 1; in __textui_init_window() 216 spin_lock(&window->lock); in textui_putchar_window() 224 spin_unlock(&window->lock); in textui_putchar_window() 278 spin_unlock(&window->lock); in textui_putchar_window()
|
/DragonOS-0.1.2/kernel/src/process/ |
D | initial_proc.rs | 22 siglock: spinlock_t { lock: 1 },
|