/DragonOS/kernel/src/arch/x86_64/init/pvh/ |
H A D | param.rs | 200 let ptr = UNINIT.as_ptr(); in bindgen_test_layout_hvm_start_info() localVariable 212 unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 222 unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 232 unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 242 unsafe { ::std::ptr::addr_of!((*ptr).nr_modules) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 252 unsafe { ::std::ptr::addr_of!((*ptr).modlist_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 262 unsafe { ::std::ptr::addr_of!((*ptr).cmdline_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 272 unsafe { ::std::ptr::addr_of!((*ptr).rsdp_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 282 unsafe { ::std::ptr::addr_of!((*ptr).memmap_paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() 292 unsafe { ::std::ptr::addr_of!((*ptr).memmap_entries) as usize - ptr as usize }, in bindgen_test_layout_hvm_start_info() [all …]
|
/DragonOS/kernel/src/mm/allocator/ |
H A D | kernel_allocator.rs | 13 ptr::NonNull, 26 unsafe fn local_dealloc(&self, ptr: *mut u8, layout: Layout); in local_dealloc() 54 pub(super) unsafe fn free_in_buddy(&self, ptr: *mut u8, layout: Layout) { in free_in_buddy() 58 let phy_addr = MMArch::virt_2_phys(VirtAddr::new(ptr as usize)).unwrap(); in free_in_buddy() 70 .unwrap_or(core::ptr::null_mut()); in local_alloc() 75 return core::ptr::null_mut(); in local_alloc() 84 let ptr: *mut u8 = x.as_mut_ptr(); in local_alloc_zeroed() localVariable 85 core::ptr::write_bytes(ptr, 0, x.len()); in local_alloc_zeroed() 86 ptr in local_alloc_zeroed() 88 .unwrap_or(core::ptr::null_mut()); in local_alloc_zeroed() [all …]
|
H A D | slab.rs | 1 use core::{alloc::Layout, ptr::NonNull, sync::atomic::AtomicBool}; 54 ptr: *mut u8, in deallocate() 57 if let Some(nptr) = NonNull::new(ptr) { in deallocate()
|
/DragonOS/kernel/src/common/ |
H A D | err.h | 15 static inline long __must_check IS_ERR(const void* ptr) in IS_ERR() argument 17 return IS_ERR_VALUE((uint64_t)ptr); in IS_ERR() 27 static inline long __must_check IS_ERR_OR_NULL(const void* ptr) in IS_ERR_OR_NULL() argument 29 return !ptr || IS_ERR_VALUE((uint64_t)ptr); in IS_ERR_OR_NULL() 43 static inline long __must_check PTR_ERR(void * ptr) in PTR_ERR() argument 45 return (long)ptr; in PTR_ERR()
|
H A D | glib.h | 25 #define container_of(ptr, type, member) \ argument 27 typeof(((type *)0)->member) *p = (ptr); \
|
/DragonOS/kernel/src/arch/x86_64/include/asm/ |
H A D | cmpxchg.h | 33 [ptr] "+m"(*__ptr), \ 44 [ptr] "+m"(*__ptr), \ 55 [ptr] "+m"(*__ptr), \ 66 [ptr] "+m"(*__ptr), \ 80 #define arch_try_cmpxchg(ptr, old_ptr, new) \ argument 81 __raw_try_cmpxchg((ptr), (old_ptr), (new), sizeof(*ptr)) 83 bool __try_cmpxchg_q(uint64_t *ptr, uint64_t *old_ptr, uint64_t *new_ptr);
|
/DragonOS/kernel/src/libs/ |
H A D | volatile.rs | 3 unsafe { core::ptr::read_volatile(core::ptr::addr_of!($data)) } 9 unsafe { core::ptr::write_volatile(core::ptr::addr_of_mut!($data), $value) } 21 true => core::ptr::read_volatile(core::ptr::addr_of!($data)) | $val, 22 false => core::ptr::read_volatile(core::ptr::addr_of!($data)) & (!$val), 150 crate::libs::volatile::VolatileReadable::vread(core::ptr::addr_of!( 172 core::ptr::addr_of_mut!((*$nonnull.as_ptr()).$field),
|
H A D | align.rs | 4 use core::{alloc::GlobalAlloc, fmt::Debug, ptr::Unique}; 53 let ptr = unsafe { KERNEL_ALLOCATOR.alloc_zeroed(Self::LAYOUT) }; in new_zeroed() localVariable 54 if ptr.is_null() { in new_zeroed() 58 inner: unsafe { Unique::new_unchecked(ptr.cast()) }, in new_zeroed() 63 pub unsafe fn new_unchecked(ptr: *mut T) -> Self { in new_unchecked() 65 inner: Unique::new_unchecked(ptr), in new_unchecked() 87 core::ptr::drop_in_place(self.inner.as_ptr()); in drop()
|
/DragonOS/kernel/crates/rust-slabmalloc/src/ |
H A D | sc.rs | 201 let ptr = slab_page.allocate(sc_layout); in try_allocate_from_pagelist() localVariable 202 if !ptr.is_null() { in try_allocate_from_pagelist() 208 return ptr; in try_allocate_from_pagelist() 220 ptr::null_mut() in try_allocate_from_pagelist() 273 let ptr = { in allocate() localVariable 276 let ptr = self.try_allocate_from_pagelist(new_layout); in allocate() localVariable 277 if ptr.is_null() && self.empty_slabs.head.is_some() { in allocate() 282 let ptr = empty_page.allocate(layout); in allocate() localVariable 283 debug_assert!(!ptr.is_null(), "Allocation must have succeeded here."); in allocate() 292 ptr in allocate() [all …]
|
H A D | lib.rs | 40 use core::ptr::{self, NonNull}; 70 ptr: NonNull<u8>, in deallocate()
|
H A D | pages.rs | 224 None => ptr::null_mut(), in allocate() 239 fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) -> Result<(), AllocationError> { in deallocate() 242 ptr, in deallocate() 246 let page_offset = ((ptr.as_ptr() as usize) - align_offset) & (Self::SIZE - 1); in deallocate() 252 ptr in deallocate() 452 if core::ptr::eq(slab_page, s) { in contains() 496 Rawlink { p: ptr::null_mut() } in default() 503 Rawlink { p: ptr::null_mut() } in none()
|
/DragonOS/kernel/crates/kprobe/src/arch/rv64/ |
H A D | mod.rs | 57 core::ptr::write(address as *mut u16, inst_16); in drop() 60 core::ptr::write(address as *mut u32, inst_32); in drop() 91 let inst_16 = unsafe { core::ptr::read(address as *const u16) }; in replace_inst() 107 core::ptr::write(address as *mut u16, C_EBREAK_INST as u16); in replace_inst() 110 core::ptr::write(inst_tmp_ptr as *mut u16, inst_16); in replace_inst() 111 core::ptr::write((inst_tmp_ptr + 2) as *mut u16, C_EBREAK_INST as u16); in replace_inst() 114 let inst_32 = unsafe { core::ptr::read(address as *const u32) }; in replace_inst() 117 core::ptr::write(address as *mut u32, EBREAK_INST); in replace_inst() 120 core::ptr::write(inst_tmp_ptr as *mut u32, inst_32); in replace_inst() 121 core::ptr::write((inst_tmp_ptr + 4) as *mut u32, EBREAK_INST); in replace_inst()
|
/DragonOS/kernel/crates/kprobe/src/arch/loongarch64/ |
H A D | mod.rs | 45 let inst_32 = unsafe { core::ptr::read(inst_tmp_ptr as *const u32) }; in drop() 47 core::ptr::write(address as *mut u32, inst_32); in drop() 79 let inst_32 = unsafe { core::ptr::read(address as *const u32) }; in replace_inst() 81 core::ptr::write(address as *mut u32, EBREAK_INST); in replace_inst() 84 core::ptr::write(inst_tmp_ptr as *mut u32, inst_32); in replace_inst() 85 core::ptr::write((inst_tmp_ptr + 4) as *mut u32, EBREAK_INST); in replace_inst()
|
/DragonOS/kernel/src/bpf/prog/ |
H A D | verifier.rs | 53 let ptr = match src_reg as u32 { in relocation() localVariable 101 if let Some(ptr) = ptr { in relocation() 104 insn.imm = ptr as i32; in relocation() 105 next_insn.imm = (ptr >> 32) as i32; in relocation() 121 for ptr in raw_file_ptr { in relocation() 122 self.prog.insert_map(ptr); in relocation()
|
/DragonOS/docs/kernel/core_api/ |
H A D | kernel_api.md | 129 ### `list_entry(ptr, type, member)` 133   该宏能通过ptr指向的List获取到List所处的结构体的地址 137 **ptr** 149 ### `list_first_entry(ptr, type, member)` 159 ### `list_first_entry_or_null(ptr, type, member)` 169 ### `list_last_entry(ptr, type, member)` 179 ### `list_last_entry_or_full(ptr, type, member)` 217 ### `list_for_each(ptr, head)` 225 **ptr** 233 ### `list_for_each_prev(ptr, head)` [all …]
|
/DragonOS/kernel/src/arch/x86_64/asm/ |
H A D | cmpxchg.c | 3 bool __try_cmpxchg_q(uint64_t *ptr, uint64_t *old_ptr, uint64_t *new_ptr) in __try_cmpxchg_q() argument 5 bool success = __raw_try_cmpxchg(ptr, old_ptr, *new_ptr, 8); in __try_cmpxchg_q()
|
/DragonOS/kernel/src/arch/riscv64/ |
H A D | cpu.rs | 19 let ptr: *const LocalContext = riscv::register::tp::read() as *const LocalContext; in current_cpu_id() localVariable 21 if core::intrinsics::unlikely(ptr.is_null()) { in current_cpu_id() 25 unsafe { (*ptr).current_cpu() } in current_cpu_id() 99 let ptr = self as *const Self as usize; in sync_to_cpu() localVariable 103 riscv::register::tp::write(ptr); in sync_to_cpu()
|
/DragonOS/kernel/src/perf/ |
H A D | bpf.rs | 38 ptr: usize, field 47 ptr: 0, in empty() 59 fn init(ptr: *mut u8, size: usize, phys_addr: PhysAddr) -> Self { in init() 64 let perf_event_mmap_page = &mut *(ptr as *mut perf_event_mmap_page); in init() 74 ptr: ptr as usize, in init() 96 let data_tail = unsafe { &mut (*(self.ptr as *mut perf_event_mmap_page)).data_tail }; in write_event() 97 let data_head = unsafe { &mut (*(self.ptr as *mut perf_event_mmap_page)).data_head }; in write_event() 207 let data_tail = unsafe { &(*(self.ptr as *mut perf_event_mmap_page)).data_tail }; in readable() 208 let data_head = unsafe { &(*(self.ptr as *mut perf_event_mmap_page)).data_head }; in readable() 212 unsafe { core::slice::from_raw_parts(self.ptr as *const u8, self.size) } in as_slice() [all …]
|
/DragonOS/user/apps/test-for-robustfutex/src/ |
H A D | main.rs | 8 ptr::{self, NonNull}, 194 list: RobustList { next: ptr::null() }, in set_list() 196 list_op_pending: ptr::null(), in set_list() 235 list: RobustList { next: ptr::null() }, in test01() 237 list_op_pending: ptr::null(), in test01() 243 ptr::null_mut::<c_void>(), in test01() 315 ptr::null_mut::<c_void>(), in test02() 328 ptr::null_mut::<c_void>(), in test02()
|
/DragonOS/kernel/src/mm/ |
H A D | c_adapter.rs | 36 let (ptr, len, cap) = space.into_raw_parts(); in do_kmalloc() 37 if !ptr.is_null() { in do_kmalloc() 38 let vaddr = VirtAddr::new(ptr as usize); in do_kmalloc()
|
/DragonOS/kernel/crates/kprobe/src/arch/x86/ |
H A D | mod.rs | 29 core::ptr::copy( in drop() 88 core::ptr::copy( in replace_inst() 104 core::ptr::write_volatile(address as *mut u8, EBREAK_INST); in replace_inst()
|
/DragonOS/kernel/src/driver/net/ |
H A D | dma.rs | 13 use core::ptr::NonNull; 26 core::ptr::write_bytes(virt.data() as *mut u8, 0, count.data() * MMArch::PAGE_SIZE); in dma_alloc()
|
/DragonOS/kernel/src/driver/irqchip/ |
H A D | riscv_sifive_plic.rs | 18 ptr::{read_volatile, write_volatile}, 144 core::ptr::write_volatile( in set_threshold() 179 core::ptr::write_volatile(reg, core::ptr::read_volatile(reg) | hwirq_mask); in toggle() 183 core::ptr::write_volatile(reg, core::ptr::read_volatile(reg) & !hwirq_mask); in toggle() 268 core::ptr::write_volatile( in irq_unmask() 291 core::ptr::write_volatile( in irq_mask() 493 core::ptr::write_volatile( in do_riscv_sifive_plic_init()
|
/DragonOS/kernel/src/namespaces/ |
H A D | mod.rs | 83 ($ptr:expr, $struct:path, $field:ident) => { 89 Arc::from_raw(($ptr as *const u8).wrapping_sub(offset) as *mut $struct)
|
/DragonOS/kernel/src/process/ |
H A D | kthread.rs | 223 let ptr = Arc::into_raw(self); in generate_unsafe_arc_ptr() localVariable 224 return ptr; in generate_unsafe_arc_ptr() 227 pub unsafe fn parse_unsafe_arc_ptr(ptr: *const Self) -> Arc<Self> { in parse_unsafe_arc_ptr() 228 let arc = Arc::from_raw(ptr); in parse_unsafe_arc_ptr() 495 pub unsafe extern "C" fn kernel_thread_bootstrap_stage2(ptr: *const KernelThreadCreateInfo) -> ! { in kernel_thread_bootstrap_stage2() 496 let info = KernelThreadCreateInfo::parse_unsafe_arc_ptr(ptr); in kernel_thread_bootstrap_stage2()
|