/DragonOS/kernel/src/libs/ |
H A D | vec_cursor.rs | 14 data: Vec<u8>, field 21 pub fn new(data: Vec<u8>) -> Self { in new() 22 return Self { data, pos: 0 }; in new() 28 data: Vec::new(), in zerod() 31 result.data.resize(length, 0); in zerod() 37 return &mut self.data; in get_mut() 42 return &self.data; in get_ref() 47 if self.pos >= self.data.len() { in read_u8() 51 return Ok(self.data[self.pos - 1]); in read_u8() 56 if self.pos + 2 > self.data.len() { in read_u16() [all …]
|
H A D | rwlock.rs | 39 data: UnsafeCell<T>, field 45 data: *const T, field 55 data: *const T, field 64 data: *mut T, field 76 pub const fn new(data: T) -> Self { in new() 79 data: UnsafeCell::new(data), in new() 87 let RwLock { data, .. } = self; in into_inner() 88 return data.into_inner(); in into_inner() 96 return self.data.get(); in as_mut_ptr() 146 data: unsafe { &*self.data.get() }, in inner_try_read() [all …]
|
H A D | volatile.rs | 2 ($data: expr) => { 3 unsafe { core::ptr::read_volatile(core::ptr::addr_of!($data)) } 8 ($data: expr, $value: expr) => { 9 unsafe { core::ptr::write_volatile(core::ptr::addr_of_mut!($data), $value) } 17 ($data: expr, $val: expr, $flag: expr) => { 19 $data, 21 true => core::ptr::read_volatile(core::ptr::addr_of!($data)) | $val, 22 false => core::ptr::read_volatile(core::ptr::addr_of!($data)) & (!$val), 33 ($data: expr, $bits: expr, $val: expr) => { 34 volatile_set_bit!($data, $bits, false); [all …]
|
H A D | spinlock.rs | 20 data: UnsafeCell<T>, field 29 data: *mut T, field 48 unsafe { &mut *this.lock.data.get() } in leak() 66 data: UnsafeCell::new(value), in new() 108 data: unsafe { &mut *self.data.get() }, in try_lock() 134 data: unsafe { &mut *self.data.get() }, in try_lock_irqsave() 148 data: unsafe { &mut *self.data.get() }, in try_lock_no_preempt() 181 return unsafe { &*self.data }; in deref() 188 return unsafe { &mut *self.data }; in deref_mut()
|
/DragonOS/kernel/crates/bitmap/src/ |
H A D | alloc_bitmap.rs | 10 data: Vec<usize>, field 16 let data = vec![0usize; elements.div_ceil(usize::BITS as usize)]; in new() localVariable 19 data, in new() 25 for i in 0..rhs.data.len() { in bitand_assign() 26 self.data[i] &= rhs.data[i]; in bitand_assign() 34 return self.core.get(self.elements, &self.data, index); in get() 39 return self.core.set(self.elements, &mut self.data, index, value); in set() 49 self.data.len() * core::mem::size_of::<usize>() in size() 54 self.core.first_index(&self.data) in first_index() 59 self.core.first_false_index(self.elements, &self.data) in first_false_index() [all …]
|
H A D | static_bitmap.rs | 13 pub data: [usize; N.div_ceil(usize::BITS as usize)], field 33 data: [0; N.div_ceil(usize::BITS as usize)], in new() 45 return self.core.get(N, &self.data, index); in get() 50 return self.core.set(N, &mut self.data, index, value); in set() 60 self.data.len() * size_of::<usize>() in size() 65 self.core.first_index(&self.data) in first_index() 70 self.core.first_false_index(N, &self.data) in first_false_index() 75 self.core.last_index(N, &self.data) in last_index() 80 self.core.last_false_index(N, &self.data) in last_false_index() 85 self.core.next_index(N, &self.data, index) in next_index() [all …]
|
H A D | bitmap_core.rs | 18 pub(crate) fn get(&self, n: usize, data: &[T], index: usize) -> Option<bool> { in get() 26 let element = data.get(element_index)?; in get() 33 pub(crate) fn set(&self, n: usize, data: &mut [T], index: usize, value: bool) -> Option<bool> { in set() 40 let element = data.get_mut(element_index)?; in set() 46 pub(crate) fn set_all(&self, n: usize, data: &mut [T], value: bool) { in set_all() 48 for element in data.iter_mut() { in set_all() 53 let last_element = data.last_mut().unwrap(); in set_all() 61 pub(crate) fn first_index(&self, data: &[T]) -> Option<usize> { in first_index() 62 for (i, element) in data.iter().enumerate() { in first_index() 73 pub(crate) fn first_false_index(&self, n: usize, data: &[T]) -> Option<usize> { in first_false_index() [all …]
|
/DragonOS/kernel/src/time/ |
H A D | jiffies.rs | 34 data: ClocksourceData, field 45 return inner.data.clone(); in clocksource_data() 51 fn update_clocksource_data(&self, data: ClocksourceData) -> Result<(), SystemError> { in update_clocksource_data() 52 let d = &mut self.0.lock_irqsave().data; in update_clocksource_data() 53 d.set_name(data.name); in update_clocksource_data() 54 d.set_rating(data.rating); in update_clocksource_data() 55 d.set_mask(data.mask); in update_clocksource_data() 56 d.set_mult(data.mult); in update_clocksource_data() 57 d.set_shift(data.shift); in update_clocksource_data() 58 d.set_max_idle_ns(data.max_idle_ns); in update_clocksource_data() [all …]
|
/DragonOS/kernel/src/perf/ |
H A D | bpf.rs | 24 data: SpinLock<BpfPerfEventData>, field 95 pub fn write_event(&mut self, data: &[u8]) -> Result<()> { in write_event() 100 let sample_size = PerfSample::calculate_size(data.len()); in write_event() 140 self.write_event(data) in write_event() 142 let new_data_head = self.write_sample(data, *data_head as usize)?; in write_event() 157 fn write_any(&mut self, data: &[u8], data_head: usize) -> Result<usize> { in write_any() 160 let data_len = data.len(); in write_any() 164 data_region[start..end].copy_from_slice(data); in write_any() 167 data_region[start..start + first_len].copy_from_slice(&data[..first_len]); in write_any() 168 data_region[0..end].copy_from_slice(&data[first_len..]); in write_any() [all …]
|
/DragonOS/kernel/src/arch/x86_64/driver/apic/ |
H A D | mod.rs | 130 data: u32, field 137 pub fn new(register: LVTRegister, data: u32) -> Option<Self> { in new() 139 let mut result = Self { register, data: 0 }; in new() 140 result.set_vector((data & 0xFF) as u8); in new() 145 .set_delivery_mode(DeliveryMode::try_from(((data >> 8) & 0b111) as u8).ok()?) in new() 151 result.set_interrupt_input_pin_polarity((data & (1 << 13)) == 0); in new() 153 if data & (1 << 15) != 0 { in new() 159 result.set_mask((data & (1 << 16)) != 0); in new() 163 .set_timer_mode(LocalApicTimerMode::try_from(((data >> 17) & 0b11) as u8).ok()?) in new() 172 pub fn data(&self) -> u32 { in data() method [all …]
|
/DragonOS/kernel/src/driver/base/device/ |
H A D | device_number.rs | 30 pub const fn data(&self) -> u32 { in data() method 37 data: u32, field 46 data: (major.data() << Self::MINOR_BITS) | minor, in new() 51 Major::new(self.data >> Self::MINOR_BITS) in major() 55 self.data & 0xfffff in minor() 58 pub const fn data(&self) -> u32 { in data() method 59 self.data in data() 71 Self { data: x } in from()
|
/DragonOS/kernel/src/driver/clocksource/ |
H A D | acpi_pm.rs | 76 data: ClocksourceData, field 82 let data = ClocksourceData { in new() localVariable 97 data, in new() 113 return inner.data.clone(); in clocksource_data() 120 fn update_clocksource_data(&self, data: ClocksourceData) -> Result<(), SystemError> { in update_clocksource_data() 121 let d = &mut self.0.lock_irqsave().data; in update_clocksource_data() 122 d.set_name(data.name); in update_clocksource_data() 123 d.set_rating(data.rating); in update_clocksource_data() 124 d.set_mask(data.mask); in update_clocksource_data() 125 d.set_mult(data.mult); in update_clocksource_data() [all …]
|
/DragonOS/kernel/src/bpf/map/ |
H A D | queue.rs | 39 data: Vec<BpfQueueValue>, field 47 let data = Vec::with_capacity(attr.max_entries as usize); in new() localVariable 50 data, in new() 57 if self.data.len() == self.max_entries as usize { in push() 60 self.data.remove(0); in push() 65 self.data.push(value); in push() 69 if self.data.is_empty() { in pop() 72 Some(self.data.remove(0)) in pop() 75 self.data.first() in peek() 105 if self.data.len() == self.max_entries as usize { in push() [all …]
|
H A D | lru.rs | 22 data: LruCache<BpfHashMapKey, BpfHashMapValue>, field 32 data: LruCache::new( in new() 41 let value = self.data.get(key).map(|v| v.as_slice()); in lookup_elem() 45 self.data.put(key.to_vec(), value.to_vec()); in update_elem() 49 self.data.pop(key); in delete_elem() 57 for (key, value) in self.data.iter() { in for_each_elem() 69 .data in lookup_and_delete_elem() 74 self.data.pop(key); in lookup_and_delete_elem() 78 let mut iter = self.data.iter(); in get_next_key() 113 let mut data = Vec::with_capacity(num_cpus as usize); in new() localVariable [all …]
|
H A D | array_map.rs | 26 data: ArrayMapData, field 32 data: Vec<u8>, field 39 .field("data_len", &self.data.len()) in fmt() 48 let data = vec![0; total_size as usize]; in new() localVariable 49 ArrayMapData { elem_size, data } in new() 57 &self.data[start as usize..(start + self.elem_size) as usize] in index() 64 &mut self.data[start as usize..(start + self.elem_size) as usize] in index_mut() 74 let data = ArrayMapData::new(elem_size as u32, attr.max_entries); in new() localVariable 77 data, in new() 91 let val = self.data.index(index); in lookup_elem() [all …]
|
/DragonOS/kernel/src/driver/block/cache/ |
H A D | cache_block.rs | 21 data: Box<[u8]>, field 27 pub fn new(data: Box<[u8]>, flag: CacheBlockFlag, lba_id: BlockId) -> Self { in new() 29 data, in new() 35 pub fn from_data(lba_id: BlockId, data: Vec<u8>) -> Self { in from_data() 36 let space_box = data.into_boxed_slice(); in from_data() 43 pub fn data(&self, buf: &mut [u8]) -> Result<usize, BlockCacheError> { in data() method 47 buf.copy_from_slice(&self.data); in data()
|
/DragonOS/kernel/src/driver/firmware/efi/ |
H A D | memmap.rs | 85 let res = unsafe { *(vaddr.data() as *const Self::Item) }; in next() 95 pub(super) fn memmap_init_early(&self, data: &EFIFdtParams) -> Result<(), SystemError> { in memmap_init_early() 96 return self.do_efi_memmap_init(data, true); in memmap_init_early() 105 fn do_efi_memmap_init(&self, data: &EFIFdtParams, early: bool) -> Result<(), SystemError> { in do_efi_memmap_init() 106 let paddr = data.mmap_base.expect("mmap_base is not set"); in do_efi_memmap_init() 111 let offset = paddr.data() - page_align_down(paddr.data()); in do_efi_memmap_init() 112 let map_size = data.mmap_size.unwrap() as usize + offset; in do_efi_memmap_init() 118 PhysAddr::new(page_align_down(paddr.data())), in do_efi_memmap_init() 139 inner_guard.mmap.size = data.mmap_size.unwrap() as usize; in do_efi_memmap_init() 141 data.mmap_size.unwrap() as usize / data.mmap_desc_size.unwrap() as usize; in do_efi_memmap_init() [all …]
|
/DragonOS/kernel/crates/rbpf/examples/ |
H A D | load_elf__block_a_port.c | 27 void *data = (void *)(long)skb->data; in handle_ingress() local 29 struct eth_hdr *eth = data; in handle_ingress() 30 struct iphdr *iph = data + sizeof(*eth); in handle_ingress() 31 struct tcphdr *tcp = data + sizeof(*eth) + sizeof(*iph); in handle_ingress() 34 if (data + sizeof(*eth) + sizeof(*iph) + sizeof(*tcp) > data_end) in handle_ingress()
|
/DragonOS/kernel/src/arch/x86_64/asm/ |
H A D | pio.rs | 22 unsafe fn out8(port: u16, data: u8) { in out8() 23 x86::io::outb(port, data) in out8() 27 unsafe fn out16(port: u16, data: u16) { in out16() 28 x86::io::outw(port, data) in out16() 32 unsafe fn out32(port: u16, data: u32) { in out32() 33 x86::io::outl(port, data) in out32()
|
/DragonOS/kernel/src/exception/ |
H A D | msi.rs | 17 pub data: u32, field 25 self.address_lo, self.address_hi, self.data in fmt() 33 pub const fn new(address: u64, data: u32) -> Self { in new() 37 data, in new() 42 pub const fn new_lo_hi(address_lo: u32, address_hi: u32, data: u32) -> Self { in new_lo_hi() 46 data, in new_lo_hi() 59 data: 0, in new_zeroed() 108 data: 0, in new() 131 fn write_msi_msg(&self, data: Arc<dyn MsiDescFuncData>); in write_msi_msg()
|
/DragonOS/kernel/src/driver/video/fbdev/ |
H A D | vesafb.rs | 443 fn fb_copyarea(&self, data: super::base::CopyAreaData) { in fb_copyarea() 449 if data.sx > var.xres as i32 in fb_copyarea() 450 || data.sy > var.yres as i32 in fb_copyarea() 451 || data.dx > var.xres as i32 in fb_copyarea() 452 || data.dy > var.yres as i32 in fb_copyarea() 453 || (data.sx + data.width as i32) < 0 in fb_copyarea() 454 || (data.sy + data.height as i32) < 0 in fb_copyarea() 455 || (data.dx + data.width as i32) < 0 in fb_copyarea() 456 || (data.dy + data.height as i32) < 0 in fb_copyarea() 462 let (s_visiable_x, s_w) = if data.sx < 0 { in fb_copyarea() [all …]
|
/DragonOS/kernel/src/arch/x86_64/ |
H A D | link.lds | 20 *(.bootstrap.data) 45 .data (data_start_pa): AT(data_start_pa - KERNEL_VMA) 48 *(.data) 49 *(.data.*) 70 .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) 71 { *(.data.init_proc_union) }
|
/DragonOS/kernel/src/mm/ |
H A D | percpu.rs | 68 pub fn new(data: Vec<T>) -> Option<Self> { in new() 74 if data.len() != cpu_num.try_into().unwrap() { in new() 78 return Some(Self { inner: data }); in new() 88 &self.inner[cpu_id.data() as usize] in get() 95 &mut (self as *const Self as *mut Self).as_mut().unwrap().inner[cpu_id.data() as usize] in get_mut() 100 &self.inner[cpu_id.data() as usize] in force_get() 105 &mut (self as *const Self as *mut Self).as_mut().unwrap().inner[cpu_id.data() as usize] in force_get_mut()
|
/DragonOS/kernel/src/arch/x86_64/interrupt/ |
H A D | trap.rs | 121 smp_get_processor_id().data(), in do_divide_error() 135 smp_get_processor_id().data(), in do_debug() 149 smp_get_processor_id().data(), in do_nmi() 163 smp_get_processor_id().data(), in do_int3() 177 smp_get_processor_id().data(), in do_overflow() 191 smp_get_processor_id().data(), in do_bounds() 205 smp_get_processor_id().data(), in do_undefined_opcode() 219 smp_get_processor_id().data(), in do_dev_not_avaliable() 233 smp_get_processor_id().data(), in do_double_fault() 247 smp_get_processor_id().data(), in do_coprocessor_segment_overrun() [all …]
|
/DragonOS/kernel/src/libs/lib_ui/font/ |
H A D | mod.rs | 52 return &self.bitmap.data[pos..pos + self.bytes_per_char]; in char_map() 70 pub data: &'a [u8], field 76 pub const fn new(data: &'static [u8], width: usize) -> Self { in new() 79 height: data.len() / width / 8, in new() 81 Self { data, size } in new() 89 self.data.len() in len()
|