/DragonOS/kernel/src/driver/virtio/ |
H A D | virtio_impl.rs | 29 let (paddr, count) = in dma_alloc() 31 let virt = MMArch::phys_2_virt(paddr).unwrap(); in dma_alloc() 44 paddr.data(), in dma_alloc() 45 NonNull::new(MMArch::phys_2_virt(paddr).unwrap().data() as _).unwrap(), in dma_alloc() 53 paddr: virtio_drivers::PhysAddr, in dma_dealloc() 72 PhysPageFrame::new(PhysAddr::new(paddr)), in dma_dealloc() 82 unsafe fn mmio_phys_to_virt(paddr: virtio_drivers::PhysAddr, _size: usize) -> NonNull<u8> { in mmio_phys_to_virt() 83 NonNull::new((MMArch::phys_2_virt(PhysAddr::new(paddr))).unwrap().data() as _).unwrap() in mmio_phys_to_virt()
|
H A D | transport_mmio.rs | 37 let paddr = reg.starting_address as usize; in new() localVariable 39 let page_offset = paddr % MMArch::PAGE_SIZE; in new() 40 let paddr = paddr - page_offset; in new() localVariable 48 let device_id = DeviceId::new(None, Some(format!("virtio_mmio_{:#X}", paddr))).unwrap(); in new() 51 unsafe { mmio_guard.map_phys(PhysAddr::new(paddr), size) }?; in new()
|
/DragonOS/kernel/src/driver/firmware/efi/ |
H A D | memmap.rs | 17 pub(super) paddr: Option<PhysAddr>, field 37 paddr: None, 106 let paddr = data.mmap_base.expect("mmap_base is not set"); in do_efi_memmap_init() localVariable 107 let paddr = PhysAddr::new(paddr as usize); in do_efi_memmap_init() localVariable 111 let offset = paddr.data() - page_align_down(paddr.data()); in do_efi_memmap_init() 118 PhysAddr::new(page_align_down(paddr.data())), in do_efi_memmap_init() 138 inner_guard.mmap.paddr = Some(paddr); in do_efi_memmap_init()
|
H A D | guid.rs | 48 pub paddr: u64, field 57 .field("paddr", &format_args!("0x{:x}", self.paddr)) in fmt()
|
/DragonOS/kernel/src/mm/ |
H A D | no_init.rs | 113 let paddr = MMA::virt_2_phys(vaddr)?; in allocate() localVariable 114 return Some((paddr, count)); in allocate() 143 pub unsafe fn pseudo_map_phys(vaddr: VirtAddr, paddr: PhysAddr, count: PageFrameCount) { in pseudo_map_phys() 146 pseudo_map_phys_with_flags(vaddr, paddr, count, flags); in pseudo_map_phys() 152 pub unsafe fn pseudo_map_phys_ro(vaddr: VirtAddr, paddr: PhysAddr, count: PageFrameCount) { in pseudo_map_phys_ro() 155 pseudo_map_phys_with_flags(vaddr, paddr, count, flags); in pseudo_map_phys_ro() 161 paddr: PhysAddr, in pseudo_map_phys_with_flags() 166 assert!(paddr.check_aligned(MMArch::PAGE_SIZE)); in pseudo_map_phys_with_flags() 178 let paddr = paddr + i * MMArch::PAGE_SIZE; in pseudo_map_phys_with_flags() localVariable 180 mapper.map_phys(vaddr, paddr, flags).unwrap(); in pseudo_map_phys_with_flags()
|
H A D | page.rs | 77 pub fn contains(&self, paddr: &PhysAddr) -> bool { in contains() 78 self.phys2page.contains_key(paddr) in contains() 81 pub fn get(&mut self, paddr: &PhysAddr) -> Option<Arc<Page>> { in get() 82 page_reclaimer_lock_irqsave().get(paddr); in get() 83 self.phys2page.get(paddr).cloned() in get() 86 pub fn get_unwrap(&mut self, paddr: &PhysAddr) -> Arc<Page> { in get_unwrap() 87 page_reclaimer_lock_irqsave().get(paddr); in get_unwrap() 89 .get(paddr) in get_unwrap() 90 .unwrap_or_else(|| panic!("Phys Page not found, {:?}", paddr)) in get_unwrap() 94 pub fn insert(&mut self, paddr: PhysAddr, page: &Arc<Page>) { in insert() [all …]
|
H A D | kernel_mapper.rs | 105 mut paddr: PhysAddr, in map_phys_with_size() 117 let flusher = self.mapper.map_phys(vaddr, paddr, flags).unwrap(); in map_phys_with_size() 124 paddr += MMArch::PAGE_SIZE; in map_phys_with_size()
|
H A D | fault.rs | 255 let paddr = mapper.translate(address).unwrap().0; in do_anonymous_page() localVariable 257 let page = page_manager_guard.get_unwrap(&paddr); in do_anonymous_page() 473 let paddr = mapper.translate(address).unwrap().0; in do_wp_page() localVariable 475 let page = page_manager_guard.get_unwrap(&paddr); in do_wp_page() 478 (MMArch::phys_2_virt(paddr).unwrap().data() as *mut u8).copy_from_nonoverlapping( in do_wp_page() 496 let paddr = mapper.translate(address).unwrap().0; in do_wp_page() localVariable 498 let page = page_manager_guard.get_unwrap(&paddr); in do_wp_page() 501 (MMArch::phys_2_virt(paddr).unwrap().data() as *mut u8).copy_from_nonoverlapping( in do_wp_page()
|
H A D | mmio_buddy.rs | 668 pub unsafe fn map_phys(&self, paddr: PhysAddr, length: usize) -> Result<(), SystemError> { in map_phys() 683 let r = kernel_mapper.map_phys_with_size(self.vaddr, paddr, length, flags, true); in map_phys() 695 paddr: PhysAddr, in map_phys_with_flags() 711 let r = kernel_mapper.map_phys_with_size(self.vaddr, paddr, length, flags, true); in map_phys_with_flags() 738 paddr: PhysAddr, in map_any_phys() 741 let paddr_base = PhysAddr::new(page_align_down(paddr.data())); in map_any_phys() 742 let offset = paddr - paddr_base; in map_any_phys()
|
H A D | ucontext.rs | 193 if let Some((paddr, _)) = new_mapper.translate(page) { in try_clone() 194 let page = page_manager_guard.get_unwrap(&paddr); in try_clone() 1165 let (paddr, _, flush) = unsafe { mapper.unmap_phys(page.virt_address(), true) } in unmap() 1169 let page = page_manager_guard.get_unwrap(&paddr); in unmap() 1177 PhysPageFrame::new(paddr), in unmap() 1256 if let Some((paddr, _)) = utable.translate(frame.virt_address()) { in extract() 1257 let page = page_manager_guard.get_unwrap(&paddr); in extract() 1269 if let Some((paddr, _)) = utable.translate(frame.virt_address()) { in extract() 1270 let page = page_manager_guard.get_unwrap(&paddr); in extract() 1581 let paddr = cur_phy.phys_address(); in physmap() localVariable [all …]
|
/DragonOS/kernel/src/driver/net/ |
H A D | dma.rs | 23 let (paddr, count) = allocate_page_frames(page_num).expect("e1000e: alloc page failed"); in dma_alloc() 24 let virt = MMArch::phys_2_virt(paddr).unwrap(); in dma_alloc() 37 paddr.data(), in dma_alloc() 38 NonNull::new(MMArch::phys_2_virt(paddr).unwrap().data() as _).unwrap(), in dma_alloc() 45 pub unsafe fn dma_dealloc(paddr: usize, vaddr: NonNull<u8>, pages: usize) -> i32 { in dma_dealloc() 61 PhysPageFrame::new(PhysAddr::new(paddr)), in dma_dealloc()
|
/DragonOS/kernel/src/arch/x86_64/mm/ |
H A D | mod.rs | 62 pub(super) fn x86_64_set_kernel_load_base_paddr(paddr: PhysAddr) { in x86_64_set_kernel_load_base_paddr() 64 BOOTSTRAP_MM_INFO.as_mut().unwrap().kernel_load_base_paddr = paddr.data(); in x86_64_set_kernel_load_base_paddr() 307 if let Some(paddr) = virt.data().checked_sub(Self::PHYS_OFFSET) { in virt_2_phys() 308 return Some(PhysAddr::new(paddr)); in virt_2_phys() 315 fn make_entry(paddr: PhysAddr, page_flags: usize) -> usize { in make_entry() 316 return paddr.data() | page_flags; in make_entry() 504 let paddr = area.base.add(i * MMArch::PAGE_SIZE); in allocator_init() localVariable 505 let vaddr = unsafe { MMArch::phys_2_virt(paddr) }.unwrap(); in allocator_init() 509 .map_phys(vaddr, paddr, flags) in allocator_init() 584 let (paddr, allocated_frame_count) = in test_buddy() [all …]
|
/DragonOS/kernel/src/arch/riscv64/mm/ |
H A D | init.rs | 109 let paddr = area.base.add(i * MMArch::PAGE_SIZE); in riscv_mm_init() localVariable 110 let vaddr = unsafe { MMArch::phys_2_virt(paddr) }.unwrap(); in riscv_mm_init() 114 .map_phys(vaddr, paddr, flags) in riscv_mm_init() 184 let base = PhysAddr::new(info.paddr as usize); in remap_at_low_address() 188 let paddr = PhysAddr::new(base.data() + i * MMArch::PAGE_SIZE); in remap_at_low_address() localVariable 193 .map_phys(vaddr, paddr, flags) in remap_at_low_address() 206 let base = PhysAddr::new(info.paddr as usize); in unmap_at_low_address()
|
H A D | mod.rs | 174 let paddr = PhysPageFrame::from_ppn(ppn).phys_address(); in table() localVariable 176 return paddr; in table() 237 if let Some(paddr) = virt.data().checked_sub(Self::PHYS_OFFSET) { in virt_2_phys() 238 let r = PhysAddr::new(paddr); in virt_2_phys() 245 fn make_entry(paddr: PhysAddr, page_flags: usize) -> usize { in make_entry() 246 let ppn = PhysPageFrame::new(paddr).ppn(); in make_entry()
|
/DragonOS/kernel/src/mm/allocator/ |
H A D | buddy.rs | 116 let mut paddr = (area.area_base_aligned() + offset_in_remain_area).data(); in new() localVariable 118 PageFrameCount::from_bytes(area.area_end_aligned().data() - paddr).unwrap(); in new() 138 assert!(paddr & ((1 << i) - 1) == 0); in new() 142 if paddr & (1 << i) != 0 { in new() 143 allocator.buddy_free(PhysAddr::new(paddr), i as u8); in new() 145 paddr += 1 << i; in new() 154 allocator.buddy_free(PhysAddr::new(paddr), i as u8); in new() 155 paddr += 1 << i; in new() 169 assert!(paddr & ((1 << i) - 1) == 0); in new() 170 allocator.buddy_free(PhysAddr::new(paddr), i as u8); in new() [all …]
|
H A D | page_frame.rs | 22 pub fn new(paddr: PhysAddr) -> Self { in new() 24 number: paddr.data() >> MMArch::PAGE_SHIFT, in new() 369 let paddr = frame.phys_address(); in deallocate_page_frames() localVariable 370 let page = page_manager_guard.get(&paddr); in deallocate_page_frames() 381 page_manager_guard.remove_page(&paddr); in deallocate_page_frames()
|
/DragonOS/kernel/src/arch/riscv64/pci/ |
H A D | pci_host_ecam.rs | 20 let paddr = reg.starting_address as usize; in pci_host_ecam_driver_init() localVariable 45 paddr, in pci_host_ecam_driver_init() 56 PhysAddr::new(paddr), in pci_host_ecam_driver_init()
|
/DragonOS/kernel/crates/klog_types/src/ |
H A D | lib.rs | 132 pub paddr: Option<usize>, field 136 pub fn new(layout: core::alloc::Layout, vaddr: Option<usize>, paddr: Option<usize>) -> Self { in new() 140 paddr, in new() 155 &format_args!("{:#x}", self.paddr.as_ref().unwrap_or(&0)), in fmt()
|
/DragonOS/kernel/src/ipc/ |
H A D | shm.rs | 170 let paddr = cur_phys.phys_address(); in add() localVariable 171 page_manager_guard.insert(paddr, &page); in add() 176 let paddr = phys_page.0; in add() localVariable 187 let shm_kernel = KernelShm::new(kern_ipc_perm, paddr, size); in add() 338 let paddr = cur_phys.phys_address(); in ipc_rmid() localVariable 340 LockedFrameAllocator.free(paddr, PageFrameCount::new(1)); in ipc_rmid() 343 page_manager_guard.remove_page(&paddr); in ipc_rmid()
|
/DragonOS/kernel/src/arch/x86_64/driver/ |
H A D | hpet.rs | 70 let paddr = PhysAddr::new(hpet_info.base_address); in new() localVariable 73 unsafe { mmio.map_phys(paddr, map_size)? }; in new() 93 unsafe { mmio.map_phys(paddr, bytes_to_map)? }; in new()
|
/DragonOS/kernel/src/arch/x86_64/init/pvh/ |
H A D | param.rs | 146 pub paddr: u64, field 328 unsafe { ::std::ptr::addr_of!((*ptr).paddr) as usize - ptr as usize }, in bindgen_test_layout_hvm_modlist_entry() 334 stringify!(paddr) in bindgen_test_layout_hvm_modlist_entry()
|
/DragonOS/kernel/src/driver/net/e1000e/ |
H A D | e1000e.rs | 94 paddr: usize, field 108 paddr: 0, in new() 112 let (paddr, vaddr) = dma_alloc(E1000E_DMA_PAGES); in new() 115 paddr, in new() 135 return self.paddr; in as_paddr() 159 unsafe { dma_dealloc(self.paddr, self.buffer, E1000E_DMA_PAGES) }; in free_buffer()
|
/DragonOS/kernel/src/driver/video/ |
H A D | mod.rs | 101 let paddr = bp.screen_info.lfb_base; in init_frame_buffer() localVariable 106 .map_phys_with_flags(paddr, page_align_up(buf_size), page_flags) in init_frame_buffer()
|
/DragonOS/kernel/src/arch/x86_64/driver/apic/ |
H A D | xapic.rs | 154 let paddr = PhysAddr::new(xapic_base.data() & !0xffff); in new() localVariable 158 g.map_phys(paddr, 4096).expect("Fail to map MMIO for XAPIC"); in new()
|
/DragonOS/kernel/src/perf/ |
H A D | bpf.rs | 241 let paddr = cur_phys.phys_address(); in do_mmap() localVariable 242 page_manager_guard.insert(paddr, &page); in do_mmap()
|