/DragonOS/kernel/src/mm/ |
H A D | no_init.rs | 35 data: [u64; MMArch::PAGE_SIZE], 57 data: [0; MMArch::PAGE_SIZE], in new() 76 assert!(vaddr.check_aligned(MMArch::PAGE_SIZE)); in allocate_page() 87 let index = offset / MMArch::PAGE_SIZE; in free_page() 119 assert!(address.check_aligned(MMA::PAGE_SIZE)); in free() 165 assert!(vaddr.check_aligned(MMArch::PAGE_SIZE)); in pseudo_map_phys_with_flags() 166 assert!(paddr.check_aligned(MMArch::PAGE_SIZE)); in pseudo_map_phys_with_flags() 177 let vaddr = vaddr + i * MMArch::PAGE_SIZE; in pseudo_map_phys_with_flags() 178 let paddr = paddr + i * MMArch::PAGE_SIZE; in pseudo_map_phys_with_flags() 194 assert!(vaddr.check_aligned(MMArch::PAGE_SIZE)); in pseudo_unmap_phys() [all …]
|
H A D | syscall.rs | 390 if !old_vaddr.check_aligned(MMArch::PAGE_SIZE) { in mremap() 451 assert!(start_vaddr.check_aligned(MMArch::PAGE_SIZE)); in munmap() 452 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in munmap() 463 let page_count = PageFrameCount::new(len / MMArch::PAGE_SIZE); in munmap() 485 assert!(start_vaddr.check_aligned(MMArch::PAGE_SIZE)); in mprotect() 486 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in mprotect() 499 let page_count = PageFrameCount::new(len / MMArch::PAGE_SIZE); in mprotect() 520 if !start_vaddr.check_aligned(MMArch::PAGE_SIZE) || !check_aligned(len, MMArch::PAGE_SIZE) { in madvise() 535 let page_count = PageFrameCount::new(len / MMArch::PAGE_SIZE); in madvise() 552 if !start.check_aligned(MMArch::PAGE_SIZE) || !check_aligned(len, MMArch::PAGE_SIZE) { in msync()
|
H A D | early_ioremap.rs | 28 const SLOT_CNT: usize = MMArch::FIXMAP_SIZE / MMArch::PAGE_SIZE; 81 if !phys.check_aligned(MMArch::PAGE_SIZE) { in map() 126 let map_size = slot_count * MMArch::PAGE_SIZE; in map() 195 MMArch::FIXMAP_START_VADDR + idx * MMArch::PAGE_SIZE in idx_to_virt()
|
H A D | kernel_mapper.rs | 114 let count = PageFrameCount::new(page_align_up(size) / MMArch::PAGE_SIZE); in map_phys_with_size() 123 vaddr += MMArch::PAGE_SIZE; in map_phys_with_size() 124 paddr += MMArch::PAGE_SIZE; in map_phys_with_size()
|
H A D | fault.rs | 249 Layout::from_size_align(MMArch::PAGE_SIZE, MMArch::PAGE_SIZE).unwrap(), in do_anonymous_page() 326 MMArch::PAGE_SIZE, in do_cow_fault() 480 MMArch::PAGE_SIZE, in do_wp_page() 503 MMArch::PAGE_SIZE, in do_wp_page() 663 file_pgoff * MMArch::PAGE_SIZE, in filemap_fault() 664 MMArch::PAGE_SIZE, in filemap_fault() 667 MMArch::PAGE_SIZE, in filemap_fault()
|
H A D | page.rs | 261 MMArch::PAGE_SIZE, in page_writeback() 267 MMArch::PAGE_SIZE, in page_writeback() 620 MMArch::write_bytes(frame, 0, MMArch::PAGE_SIZE); in clone() 652 MMArch::PAGE_SIZE, in clone() 1132 Arch::write_bytes(table_vaddr, 0, Arch::PAGE_SIZE); in create() 1189 MMArch::write_bytes(vaddr, 0, MMArch::PAGE_SIZE); in map() 1209 if !(virt.check_aligned(Arch::PAGE_SIZE) && phys.check_aligned(Arch::PAGE_SIZE)) { in map_phys() 1244 MMArch::write_bytes(MMArch::phys_2_virt(frame).unwrap(), 0, MMArch::PAGE_SIZE); in map_phys() 1266 if !(virt.check_aligned(Arch::PAGE_SIZE)) { in map_huge_page() 1297 MMArch::PAGE_SIZE * count.data(), in map_huge_page() [all …]
|
H A D | mod.rs | 424 (self.base.data() + (MMArch::PAGE_SIZE - 1)) & !(MMArch::PAGE_SIZE - 1), in area_base_aligned() 430 return PhysAddr::new((self.base.data() + self.size) & !(MMArch::PAGE_SIZE - 1)); in area_end_aligned() 493 const PAGE_SIZE: usize = 1 << Self::PAGE_SHIFT; constant 495 const PAGE_OFFSET_MASK: usize = Self::PAGE_SIZE - 1; 504 const PAGE_ADDRESS_MASK: usize = Self::PAGE_ADDRESS_SIZE - Self::PAGE_SIZE; 519 const ENTRY_ADDRESS_MASK: usize = Self::ENTRY_ADDRESS_SIZE - Self::PAGE_SIZE;
|
H A D | mmio_buddy.rs | 532 assert!(vaddr.check_aligned(MMArch::PAGE_SIZE)); in release_mmio() 533 assert!(length & (MMArch::PAGE_SIZE - 1) == 0); in release_mmio() 542 let page_count = length / MMArch::PAGE_SIZE; in release_mmio() 560 .unmap_phys(vaddr + i * MMArch::PAGE_SIZE, false); in release_mmio() 632 size & (MMArch::PAGE_SIZE - 1) == 0, in from_raw()
|
H A D | ucontext.rs | 291 VirtRegion::new(page.virt_address(), count.data() * MMArch::PAGE_SIZE), in map_anonymous() 370 if !offset & (MMArch::PAGE_SIZE - 1) == 0 { in file_mapping() 394 VirtRegion::new(page.virt_address(), count.data() * MMArch::PAGE_SIZE), in file_mapping() 523 if !new_vaddr.check_aligned(MMArch::PAGE_SIZE) { in mremap() 755 assert!(new_brk.check_aligned(MMArch::PAGE_SIZE)); in set_brk() 968 if requested.end() >= MMArch::USER_END_VADDR || !vaddr.check_aligned(MMArch::PAGE_SIZE) { in find_free_at() 1208 assert!(region.start().check_aligned(MMArch::PAGE_SIZE)); in extract() 1209 assert!(region.end().check_aligned(MMArch::PAGE_SIZE)); in extract() 1569 VirtRegion::new(destination.virt_address(), count.data() * MMArch::PAGE_SIZE), in physmap() 1636 page_count.data() * MMArch::PAGE_SIZE, in zeroed() [all …]
|
/DragonOS/kernel/src/driver/net/ |
H A D | dma.rs | 14 const PAGE_SIZE: usize = 4096; constant 20 (pages * PAGE_SIZE) in dma_alloc() 21 .div_ceil(MMArch::PAGE_SIZE) in dma_alloc() 28 core::ptr::write_bytes(virt.data() as *mut u8, 0, count.data() * MMArch::PAGE_SIZE); in dma_alloc() 49 (pages * PAGE_SIZE) in dma_dealloc() 50 .div_ceil(MMArch::PAGE_SIZE) in dma_dealloc()
|
/DragonOS/kernel/src/driver/virtio/ |
H A D | virtio_impl.rs | 14 use virtio_drivers::{BufferDirection, Hal, PAGE_SIZE}; 26 (pages * PAGE_SIZE) in dma_alloc() 27 .div_ceil(MMArch::PAGE_SIZE) in dma_alloc() 35 core::ptr::write_bytes(virt.data() as *mut u8, 0, count.data() * MMArch::PAGE_SIZE); in dma_alloc() 60 (pages * PAGE_SIZE) in dma_dealloc() 61 .div_ceil(MMArch::PAGE_SIZE) in dma_dealloc()
|
/DragonOS/kernel/src/mm/allocator/ |
H A D | bump.rs | 78 offset = (offset + (MMA::PAGE_SIZE - 1)) & !(MMA::PAGE_SIZE - 1); in remain_areas() 81 if offset + MMA::PAGE_SIZE <= area_end { in remain_areas() 156 offset = (offset + (MMA::PAGE_SIZE - 1)) & !(MMA::PAGE_SIZE - 1); in allocate() 159 if offset + count.data() * MMA::PAGE_SIZE <= area_end { in allocate() 162 self.offset = offset + count.data() * MMA::PAGE_SIZE; in allocate()
|
H A D | page_frame.rs | 40 return PhysAddr::new(self.number * MMArch::PAGE_SIZE); in phys_address() 99 number: vaddr.data() / MMArch::PAGE_SIZE, in new() 111 return VirtAddr::new(self.number * MMArch::PAGE_SIZE); in virt_address() 187 return self.0 * MMArch::PAGE_SIZE; in bytes() 197 return Some(Self(bytes / MMArch::PAGE_SIZE)); in from_bytes()
|
H A D | slab.rs | 92 assert_eq!(base_addr as usize & (MMArch::PAGE_SIZE - 1), 0); // 确认地址4k对齐 in free_slab_page() 93 assert_eq!(size, MMArch::PAGE_SIZE); // 确认释放的slab_page大小 in free_slab_page()
|
H A D | kernel_allocator.rs | 34 let count = (page_align_up(layout.size()) / MMArch::PAGE_SIZE).next_power_of_two(); in alloc_in_buddy() 48 allocated_frame_count.data() * MMArch::PAGE_SIZE, in alloc_in_buddy() 56 let count = (page_align_up(layout.size()) / MMArch::PAGE_SIZE).next_power_of_two(); in free_in_buddy()
|
H A D | buddy.rs | 78 (A::PAGE_SIZE - mem::size_of::<PageList<A>>()) / mem::size_of::<PhysAddr>(); 95 core::ptr::write_bytes(MMArch::phys_2_virt(*f)?.data() as *mut u8, 0, A::PAGE_SIZE); in new() 152 let mut entries = (remain_pages.data() * A::PAGE_SIZE) >> i; in new() 163 let mut remain_bytes = remain_pages.data() * A::PAGE_SIZE; in new()
|
/DragonOS/kernel/src/arch/riscv64/mm/ |
H A D | init.rs | 108 for i in 0..((area.size + MMArch::PAGE_SIZE - 1) / MMArch::PAGE_SIZE) { in riscv_mm_init() 109 let paddr = area.base.add(i * MMArch::PAGE_SIZE); in riscv_mm_init() 187 for i in 0..(size / MMArch::PAGE_SIZE) { in remap_at_low_address() 188 let paddr = PhysAddr::new(base.data() + i * MMArch::PAGE_SIZE); in remap_at_low_address() 189 let vaddr = VirtAddr::new(base.data() + i * MMArch::PAGE_SIZE); in remap_at_low_address() 209 for i in 0..(size / MMArch::PAGE_SIZE) { in unmap_at_low_address() 210 let vaddr = VirtAddr::new(base.data() + i * MMArch::PAGE_SIZE); in unmap_at_low_address()
|
/DragonOS/kernel/src/perf/ |
H A D | bpf.rs | 20 const PAGE_SIZE: usize = MMArch::PAGE_SIZE; constant 60 assert_eq!(size % PAGE_SIZE, 0); in init() 61 assert!(size / PAGE_SIZE >= 2); in init() 65 perf_event_mmap_page.data_offset = PAGE_SIZE as u64; in init() 66 perf_event_mmap_page.data_size = (size - PAGE_SIZE) as u64; in init() 76 data_region_size: size - PAGE_SIZE, in init() 159 let data_region = self.as_mut_slice()[PAGE_SIZE..].as_mut(); in write_any() 237 unsafe { LockedFrameAllocator.allocate(PageFrameCount::new(len / PAGE_SIZE)) } in do_mmap() 269 let page_count = PageFrameCount::new(len / PAGE_SIZE); in drop()
|
/DragonOS/kernel/src/arch/x86_64/mm/ |
H A D | mod.rs | 125 VirtAddr::new((Self::PAGE_ADDRESS_SIZE >> 1) - Self::PAGE_SIZE); 257 const PAGE_SIZE: usize = 1 << Self::PAGE_SHIFT; constant 259 const PAGE_OFFSET_MASK: usize = Self::PAGE_SIZE - 1; 267 const PAGE_ADDRESS_MASK: usize = Self::PAGE_ADDRESS_SIZE - Self::PAGE_SIZE; 282 const ENTRY_ADDRESS_MASK: usize = Self::ENTRY_ADDRESS_SIZE - Self::PAGE_SIZE; 503 for i in 0..area.size.div_ceil(MMArch::PAGE_SIZE) { in allocator_init() 504 let paddr = area.base.add(i * MMArch::PAGE_SIZE); in allocator_init() 587 assert!(paddr.data() % MMArch::PAGE_SIZE == 0); in test_buddy() 592 .check_aligned(allocated_frame_count.data() * MMArch::PAGE_SIZE)); in test_buddy() 594 allocated += allocated_frame_count.data() * MMArch::PAGE_SIZE; in test_buddy() [all …]
|
/DragonOS/kernel/src/driver/net/e1000e/ |
H A D | e1000e.rs | 26 const PAGE_SIZE: usize = 4096; constant 101 assert!(length <= PAGE_SIZE); in new() 303 let recv_ring_length = PAGE_SIZE / size_of::<E1000ERecvDesc>(); in new() 304 let trans_ring_length = PAGE_SIZE / size_of::<E1000ETransDesc>(); in new() 321 let buffer = E1000EBuffer::new(PAGE_SIZE); in new() 328 let buffer = E1000EBuffer::new(PAGE_SIZE); in new() 351 volwrite!(receive_regs, rdlen0, PAGE_SIZE as u32); in new() 381 volwrite!(transimit_regs, tdlen0, PAGE_SIZE as u32); in new() 437 let new_buffer = E1000EBuffer::new(PAGE_SIZE); in e1000e_receive() 561 let recv_ring_length = PAGE_SIZE / size_of::<E1000ERecvDesc>(); in drop() [all …]
|
/DragonOS/kernel/src/arch/x86_64/ |
H A D | elf.rs | 9 const ELF_PAGE_SIZE: usize = MMArch::PAGE_SIZE;
|
/DragonOS/kernel/src/arch/riscv64/ |
H A D | elf.rs | 9 const ELF_PAGE_SIZE: usize = MMArch::PAGE_SIZE;
|
/DragonOS/kernel/src/virt/kvm/ |
H A D | host_mem.rs | 38 pub const PAGE_SIZE: u32 = 1 << PAGE_SHIFT; constant 39 pub const PAGE_MASK: u32 = !(PAGE_SIZE - 1); 100 return slot.userspace_addr + (gfn - slot.base_gfn) * (PAGE_SIZE as u64); in __gfn_to_hva()
|
H A D | vm.rs | 64 if (mem.memory_size & (MMArch::PAGE_SIZE - 1) as u64) != 0 in set_user_memory_region() 65 || (mem.guest_phys_addr & (MMArch::PAGE_SIZE - 1) as u64) != 0 in set_user_memory_region()
|
/DragonOS/kernel/src/libs/ |
H A D | align.rs | 134 let page_size = MMArch::PAGE_SIZE; in page_align_up() 139 let page_size = MMArch::PAGE_SIZE; in page_align_down()
|