Home
last modified time | relevance | path

Searched refs:count (Results 1 – 25 of 48) sorted by relevance

12

/DragonOS-0.1.7/kernel/src/libs/
Dlockref.c43 CMPXCHG_LOOP(lock_ref, ++new.count;, return;); in lockref_inc()
47 ++lock_ref->count; in lockref_inc()
63 if (old.count <= 0) in lockref_inc_not_zero()
65 ++new.count; in lockref_inc_not_zero()
72 if (lock_ref->count > 0) in lockref_inc_not_zero()
74 ++lock_ref->count; in lockref_inc_not_zero()
96 if (old.count <= 0) in lockref_dec()
98 --new.count; in lockref_dec()
100 { return new.count; }) in lockref_dec()
105 if (lock_ref->count > 0) in lockref_dec()
[all …]
Dlockref.rs12 pub count: i32, field
19 count: i32, field
35 count: 0,
56 old.count = unsafe { read_volatile(&self.count) }; in cmpxchg_loop()
69 new.count += 1; in cmpxchg_loop()
73 if old.count <= 0 { in cmpxchg_loop()
76 new.count += 1; in cmpxchg_loop()
80 if old.count < 0 { in cmpxchg_loop()
83 new.count += 1; in cmpxchg_loop()
87 if old.count <= 0 { in cmpxchg_loop()
[all …]
Dmutex.c12 atomic_set(&lock->count, 1); in mutex_init()
59 atomic_dec(&lock->count); in mutex_lock()
83 atomic_inc(&lock->count); in mutex_unlock()
117 atomic_dec(&lock->count); in mutex_trylock()
Dstring.c65 char *strncpy(char *dst, const char *src, long count) in strncpy() argument
79 : "S"(src), "D"(dst), "c"(count) in strncpy()
Dcpu.c49 int count = 0; in cpu_init() local
55 *(uint *)&Cpu_BrandName[4 * count] = tmp_info[j]; in cpu_init()
56 ++count; in cpu_init()
/DragonOS-0.1.7/user/apps/shell/
Dshell.c64 int count = shell_readline(kb_fd, input_buffer); in main_loop() local
65 if (!count || current_command_index < count_history - 1) in main_loop()
67 if (count) in main_loop()
76 if (count) in main_loop()
110 void clear_command(int count, char *buf) in clear_command() argument
112 for (int i = 0; i < count; i++) in clear_command()
155 int count = 0; in shell_readline() local
173 clear_command(count, buf); in shell_readline()
174 count = 0; in shell_readline()
177 count = strlen(buf); in shell_readline()
[all …]
/DragonOS-0.1.7/docs/kernel/locking/
Dlockref.md19 pub count: i32,
26 count: i32,
42 int count;
79 &emsp;&emsp;原子地将引用计数加1.如果原来的count≤0,则操作失败。
85 | Ok(self.count) | 成功,返回新的引用计数 |
98 | Ok(self.count) | 成功,返回新的引用计数 |
111 &emsp;&emsp;原子地将引用计数-1。如果已处于count≤0的状态,则返回Err(SystemError::EPERM)
113 &emsp;&emsp;本函数与`lockref_dec_return()`的区别在于,当在`cmpxchg()`中检测到`count<=0`或已加锁,本函数会再次尝试通过加锁来执行操作,而`loc…
119 | Ok(self.count) | 成功,返回新的引用计数 |
124 &emsp;&emsp;原子地将引用计数减1。如果处于已加锁或count≤0的状态,则返回SystemError::EPERM
[all …]
/DragonOS-0.1.7/kernel/src/libs/libUI/
Dtextui-render.c39 int textui_refresh_vlines(struct textui_window_t *window, uint16_t start, uint16_t count) in textui_refresh_vlines() argument
43 for (int i = start; i < window->vlines_num && count > 0; ++i, --count) in textui_refresh_vlines()
50 while (count > 0) in textui_refresh_vlines()
58 --count; in textui_refresh_vlines()
73 …fresh_characters(struct textui_window_t *window, uint16_t vline_id, uint16_t start, uint16_t count) in textui_refresh_characters() argument
78 if (unlikely(vline_id >= window->vlines_num && (start + count) > window->chars_per_line)) in textui_refresh_characters()
93 for (int i = 0; i < count; ++i) in textui_refresh_characters()
Dtextui.h130 int textui_refresh_vlines(struct textui_window_t *window, uint16_t start, uint16_t count);
141 …resh_characters(struct textui_window_t *window, uint16_t vline_id, uint16_t start, uint16_t count);
/DragonOS-0.1.7/kernel/src/driver/mouse/
Dps2_mouse.c22 ps2_mouse_buf_ptr->count = 0; in ps2_mouse_clear_buf()
34 if (ps2_mouse_buf_ptr->count == 0) in ps2_mouse_get_scancode()
35 while (!ps2_mouse_buf_ptr->count) in ps2_mouse_get_scancode()
42 --(ps2_mouse_buf_ptr->count); in ps2_mouse_get_scancode()
65 if (ps2_mouse_buf_ptr->count >= ps2_mouse_buffer_size) in ps2_mouse_handler()
72 ++(ps2_mouse_buf_ptr->count); in ps2_mouse_handler()
207 ps2_mouse_buf_ptr->count = 0; in ps2_mouse_init()
289 if (ps2_mouse_buf_ptr->count < 4) in ps2_mouse_get_packet()
314 if (ps2_mouse_buf_ptr->count < 5) in ps2_mouse_get_packet()
353 if(!ps2_mouse_buf_ptr->count) in analyze_mousecode()
[all …]
/DragonOS-0.1.7/kernel/src/driver/keyboard/
Dps2_keyboard.c101 long ps2_keyboard_read(struct vfs_file_t *filp, char *buf, int64_t count, long *position) in ps2_keyboard_read() argument
107 count = (count > kb_buf.size) ? kb_buf.size : count; in ps2_keyboard_read()
108 return kfifo_out(&kb_buf, buf, count); in ps2_keyboard_read()
120 long ps2_keyboard_write(struct vfs_file_t *filp, char *buf, int64_t count, long *position) in ps2_keyboard_write() argument
148 uint8_t count = kfifo_in((struct kfifo_t *)buf_vaddr, &x, sizeof(unsigned char)); in ps2_keyboard_handler() local
/DragonOS-0.1.7/kernel/src/driver/multiboot2/
Dmultiboot2.c22 void *data, unsigned int *count) in multiboot2_iter() argument
32 if (_fun(tag, data, count) == true) in multiboot2_iter()
58 bool multiboot2_get_memory(const struct iter_data_t *_iter_data, void *data, unsigned int *count) in multiboot2_get_memory() argument
65 *count = 0; in multiboot2_get_memory()
72 ++(*count); in multiboot2_get_memory()
/DragonOS-0.1.7/kernel/src/driver/disk/ahci/
Dahcidisk.rs55 count: usize, // 读取lba的数量 in read_at()
59 let check_length = ((count - 1) >> 4) + 1; // prdt length in read_at()
60 if count * 512 > buf.len() || check_length > u16::MAX as usize { in read_at()
64 } else if count == 0 { in read_at()
104 let mut tmp_count = count; in read_at()
147 volatile_write!(cmdfis.countl, (count & 0xFF) as u8); in read_at()
148 volatile_write!(cmdfis.counth, ((count >> 8) & 0xFF) as u8); in read_at()
182 return Ok(count * 512); in read_at()
188 count: usize, in write_at()
192 let check_length = ((count - 1) >> 4) + 1; // prdt length in write_at()
[all …]
/DragonOS-0.1.7/kernel/src/common/
Dsemaphore.h34 static __always_inline void semaphore_init(semaphore_t *sema, ul count) in semaphore_init() argument
36 atomic_set(&sema->counter, count); in semaphore_init()
Dmutex.h19 atomic_t count; // 锁计数。1->已解锁。 0->已上锁,且有可能存在等待者 member
69 #define mutex_is_locked(lock) ((atomic_read(&(lock)->count) == 1) ? 0 : 1)
Dblk_types.h30 …long (*transfer)(struct blk_gendisk *gd, long cmd, uint64_t base_addr, uint64_t count, uint64_t bu…
41 uint32_t count; member
/DragonOS-0.1.7/docs/userland/libc/apis/api-list/
Dstring.md13 ``char* strncpy(char *dst,const char *src,size_t count)``
21 count: 字节数
Dunistd.md11 ``ssize_t read(int fd,void *buf,size_t count)`` : 从文件读取
17 ``ssize_t write(int fd,void const *buf,size_t count)`` : 写入文件
/DragonOS-0.1.7/user/libs/libc/src/
Dunistd.c28 ssize_t read(int fd, void *buf, size_t count) in read() argument
30 return (ssize_t)syscall_invoke(SYS_READ, fd, (uint64_t)buf, count, 0, 0, 0, 0, 0); in read()
41 ssize_t write(int fd, void const *buf, size_t count) in write() argument
43 return (ssize_t)syscall_invoke(SYS_WRITE, fd, (uint64_t)buf, count, 0, 0, 0, 0, 0); in write()
Ddirent.c57 int64_t getdents(int fd, struct dirent *dirent, long count) in getdents() argument
59 return syscall_invoke(SYS_GET_DENTS, fd, (uint64_t)dirent, count, 0, 0, 0, 0, 0); in getdents()
Dprintf.c44 int count = 0; in printf() local
48 count = vsprintf(buf, fmt, args); in printf()
51 write(1, buf, count); in printf()
52 return count; in printf()
57 int count = 0; in sprintf() local
61 count = vsprintf(buf, fmt, args); in sprintf()
64 return count; in sprintf()
/DragonOS-0.1.7/user/libs/libc/src/include/export/
Dunistd.h25 ssize_t read(int fd, void *buf, size_t count);
35 ssize_t write(int fd, void const *buf, size_t count);
/DragonOS-0.1.7/docs/kernel/boot/
Dmultiboot2.md23 void *data, unsigned int *count)
36 **count**
/DragonOS-0.1.7/kernel/src/ktest/
Dtest-mutex.c39 assert(atomic_read(&mtx.count) == 0); in ktest_mutex_case1_pid1()
62 assert(atomic_read(&mtx.count) == 0); in ktest_mutex_case1()
/DragonOS-0.1.7/kernel/src/io/
Ddevice.rs63 count: usize, in read_at()
77 count: usize, in write_at()
122 let count: usize = (range.lba_end - range.lba_start).try_into().unwrap(); in read_at() localVariable
127 BlockDevice::read_at(self, range.lba_start, count, buf_slice)?; in read_at()
158 let count: usize = (range.lba_end - range.lba_start).try_into().unwrap(); in write_at() localVariable
162 BlockDevice::write_at(self, range.lba_start, count, buf_slice)?; in write_at()

12