/DragonOS/kernel/src/mm/allocator/ |
H A D | buddy.rs | 11 use crate::mm::{MemoryManagementArch, PhysAddr, PhysMemoryArea, VirtAddr}; 30 next_page: PhysAddr, 49 next_page: PhysAddr::new(0), in empty() 53 fn new(entry_num: usize, next_page: PhysAddr) -> Self { in new() 69 free_area: [PhysAddr; MAX_ORDER - MIN_ORDER], 78 (A::PAGE_SIZE - mem::size_of::<PageList<A>>()) / mem::size_of::<PhysAddr>(); 86 let mut free_area: [PhysAddr; MAX_ORDER - MIN_ORDER] = in new() 87 [PhysAddr::new(0); MAX_ORDER - MIN_ORDER]; in new() 97 let page_list: PageList<A> = PageList::new(0, PhysAddr::new(0)); in new() 143 allocator.buddy_free(PhysAddr::new(paddr), i as u8); in new() [all …]
|
H A D | page_frame.rs | 10 mm::{MemoryManagementArch, PhysAddr, VirtAddr}, 22 pub fn new(paddr: PhysAddr) -> Self { in new() 39 pub fn phys_address(&self) -> PhysAddr { in phys_address() argument 40 return PhysAddr::new(self.number * MMArch::PAGE_SIZE); in phys_address() 311 unsafe fn allocate(&mut self, count: PageFrameCount) -> Option<(PhysAddr, PageFrameCount)>; in allocate() argument 314 unsafe fn free(&mut self, address: PhysAddr, count: PageFrameCount); in free() argument 316 unsafe fn allocate_one(&mut self) -> Option<PhysAddr> { in allocate_one() argument 320 unsafe fn free_one(&mut self, address: PhysAddr) { in free_one() argument 329 unsafe fn allocate(&mut self, count: PageFrameCount) -> Option<(PhysAddr, PageFrameCount)> { in allocate() argument 332 unsafe fn free(&mut self, address: PhysAddr, count: PageFrameCount) { in free() argument [all …]
|
H A D | bump.rs | 12 MemoryManagementArch, PageTableKind, PhysAddr, PhysMemoryArea, 102 unsafe fn ensure_early_mapping(&self, start_paddr: PhysAddr, count: PageFrameCount) { in ensure_early_mapping() argument 132 unsafe fn allocate(&mut self, count: PageFrameCount) -> Option<(PhysAddr, PageFrameCount)> { in allocate() argument 164 let r = (PhysAddr(res_page_phys), count); in allocate() 172 unsafe fn free(&mut self, _address: PhysAddr, _count: PageFrameCount) { in free() argument
|
/DragonOS/kernel/src/mm/ |
H A D | mod.rs | 160 pub struct PhysAddr(usize); struct 162 impl PhysAddr { impl 164 pub const MAX: Self = PhysAddr(usize::MAX); 195 impl Debug for PhysAddr { implementation 201 impl core::ops::Add<usize> for PhysAddr { implementation 210 impl core::ops::AddAssign<usize> for PhysAddr { implementation 217 impl core::ops::Add<PhysAddr> for PhysAddr { implementation 221 fn add(self, rhs: PhysAddr) -> Self::Output { in add() 226 impl core::ops::AddAssign<PhysAddr> for PhysAddr { implementation 228 fn add_assign(&mut self, rhs: PhysAddr) { in add_assign() argument [all …]
|
H A D | memblock.rs | 11 use super::{PhysAddr, PhysMemoryArea}; 40 pub const MIN_MEMBLOCK_ADDR: PhysAddr = PhysAddr::new(0); 42 pub const MAX_MEMBLOCK_ADDR: PhysAddr = PhysAddr::new(usize::MAX); 56 pub fn add_block(&self, base: PhysAddr, size: usize) -> Result<(), SystemError> { in add_block() argument 66 base: PhysAddr, in add_range() argument 174 base: PhysAddr, in do_insert_area() argument 230 pub fn remove_block(&self, base: PhysAddr, size: usize) -> Result<(), SystemError> { in remove_block() argument 258 inner.initial_memory_regions[0].base = PhysAddr::new(0); in do_remove_region() 275 base: PhysAddr, in isolate_range() argument 352 pub fn mark_nomap(&self, base: PhysAddr, size: usize) -> Result<(), SystemError> { in mark_nomap() argument [all …]
|
H A D | no_init.rs | 15 mm::{MMArch, MemoryManagementArch, PhysAddr}, 110 unsafe fn allocate(&mut self, count: PageFrameCount) -> Option<(PhysAddr, PageFrameCount)> { in allocate() argument 117 unsafe fn free(&mut self, address: PhysAddr, count: PageFrameCount) { in free() argument 143 pub unsafe fn pseudo_map_phys(vaddr: VirtAddr, paddr: PhysAddr, count: PageFrameCount) { in pseudo_map_phys() argument 152 pub unsafe fn pseudo_map_phys_ro(vaddr: VirtAddr, paddr: PhysAddr, count: PageFrameCount) { in pseudo_map_phys_ro() argument 161 paddr: PhysAddr, in pseudo_map_phys_with_flags() argument
|
H A D | early_ioremap.rs | 12 use super::{allocator::page_frame::PageFrameCount, MemoryManagementArch, PhysAddr, VirtAddr}; 44 mut phys: PhysAddr, in map_not_aligned() argument 77 phys: PhysAddr, in map() argument 206 phys: PhysAddr, 213 phys: PhysAddr::new(0),
|
H A D | page.rs | 35 MemoryManagementArch, PageTableKind, PhysAddr, VirtAddr, 67 phys2page: HashMap<PhysAddr, Arc<Page>>, 77 pub fn contains(&self, paddr: &PhysAddr) -> bool { in contains() 81 pub fn get(&mut self, paddr: &PhysAddr) -> Option<Arc<Page>> { in get() 86 pub fn get_unwrap(&mut self, paddr: &PhysAddr) -> Arc<Page> { in get_unwrap() 94 pub fn insert(&mut self, paddr: PhysAddr, page: &Arc<Page>) { in insert() argument 98 pub fn remove_page(&mut self, paddr: &PhysAddr) { in remove_page() argument 165 lru: LruCache<PhysAddr, Arc<Page>>, 175 pub fn get(&mut self, paddr: &PhysAddr) -> Option<Arc<Page>> { in get() 179 pub fn insert_page(&mut self, paddr: PhysAddr, page: &Arc<Page>) { in insert_page() argument [all …]
|
/DragonOS/kernel/src/driver/virtio/ |
H A D | virtio_impl.rs | 11 MemoryManagementArch, PhysAddr, VirtAddr, 24 ) -> (virtio_drivers::PhysAddr, NonNull<u8>) { in dma_alloc() argument 55 paddr: virtio_drivers::PhysAddr, in dma_dealloc() argument 76 PhysPageFrame::new(PhysAddr::new(paddr)), in dma_dealloc() 86 unsafe fn mmio_phys_to_virt(paddr: virtio_drivers::PhysAddr, _size: usize) -> NonNull<u8> { in mmio_phys_to_virt() argument 87 NonNull::new((MMArch::phys_2_virt(PhysAddr::new(paddr))).unwrap().data() as _).unwrap() in mmio_phys_to_virt() 95 ) -> virtio_drivers::PhysAddr { in share() argument 103 _paddr: virtio_drivers::PhysAddr, in unshare() argument
|
H A D | transport_mmio.rs | 19 MemoryManagementArch, PhysAddr, 51 unsafe { mmio_guard.map_phys(PhysAddr::new(paddr), size) }?; in new() 131 descriptors: virtio_drivers::PhysAddr, in queue_set() argument 132 driver_area: virtio_drivers::PhysAddr, in queue_set() argument 133 device_area: virtio_drivers::PhysAddr, in queue_set() argument
|
/DragonOS/kernel/src/driver/firmware/efi/ |
H A D | init.rs | 16 memblock::mem_block_manager, MemoryManagementArch, PhysAddr, VirtAddr, 57 let r = uefi_init(PhysAddr::new(data_from_fdt.systable.unwrap() as usize)); in efi_init() 84 PhysAddr::new(base), in efi_init() 93 PhysAddr::new(info.paddr as usize), in efi_init() 109 let start = PhysAddr::new(md.phys_start as usize); in efi_find_mirror() 130 fn uefi_init(system_table: PhysAddr) -> Result<(), SystemError> { in uefi_init() 224 fn efi_vaddr_2_paddr(efi_vaddr: usize) -> PhysAddr { in efi_vaddr_2_paddr() argument 242 return PhysAddr::new((md.phys_start + (efi_vaddr - md.virt_start)) as usize); in efi_vaddr_2_paddr() 246 return PhysAddr::new(efi_vaddr as usize); in efi_vaddr_2_paddr() 254 .remove_block(PhysAddr::new(0), PhysAddr::MAX.data()) in reserve_memory_regions() [all …]
|
H A D | mod.rs | 6 mm::PhysAddr, 39 pub runtime_paddr: Option<PhysAddr>, 44 pub memory_attribute_table_paddr: Option<PhysAddr>, 46 pub memreserve_table_paddr: Option<PhysAddr>, 48 pub esrt_table_paddr: Option<PhysAddr>,
|
H A D | tables.rs | 18 early_ioremap::EarlyIoRemap, memblock::mem_block_manager, MemoryManagementArch, PhysAddr, 49 firmware_vendor: PhysAddr, in report_systable_header() argument 147 .reserve_block(PhysAddr::new(entry.base), entry.size) in parse_config_tables() 319 .memory_attribute_table_paddr = Some(PhysAddr::new(table_raw.vendor_table as usize)); in post_process() 346 Some(PhysAddr::new(table_raw.vendor_table as usize)); in post_process() 376 Some(PhysAddr::new(table_raw.vendor_table as usize)); in post_process() 402 let table_paddr: PhysAddr = PhysAddr::new(table.vendor_table as usize); in match_table() 431 next_paddr: PhysAddr,
|
H A D | memmap.rs | 9 mm::{early_ioremap::EarlyIoRemap, PhysAddr, VirtAddr}, 17 pub(super) paddr: Option<PhysAddr>, 107 let paddr = PhysAddr::new(paddr as usize); in do_efi_memmap_init() 118 PhysAddr::new(page_align_down(paddr.data())), in do_efi_memmap_init()
|
/DragonOS/kernel/src/arch/riscv64/mm/ |
H A D | init.rs | 21 MemoryManagementArch, PageTableKind, PhysAddr, VirtAddr, 27 pub(super) static mut INITIAL_PGTABLE_VALUE: PhysAddr = PhysAddr::new(0); 53 KERNEL_BEGIN_PA = PhysAddr::new(start_pa); in init_kernel_addr() 54 KERNEL_END_PA = PhysAddr::new(end_pa); in init_kernel_addr() 77 let new_page_table: PhysAddr; 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() 206 let base = PhysAddr::new(info.paddr as usize); in unmap_at_low_address()
|
H A D | mod.rs | 17 MemoryManagementArch, PageTableKind, PhysAddr, VirtAddr, VmFlags, 30 pub(self) static mut KERNEL_BEGIN_PA: PhysAddr = PhysAddr::new(0); 32 pub(self) static mut KERNEL_END_PA: PhysAddr = PhysAddr::new(0); 170 unsafe fn table(_table_kind: PageTableKind) -> PhysAddr { in table() argument 179 unsafe fn set_table(_table_kind: PageTableKind, table: PhysAddr) { in set_table() argument 189 fn initial_page_table() -> PhysAddr { in initial_page_table() 216 unsafe fn phys_2_virt(phys: PhysAddr) -> Option<VirtAddr> { in phys_2_virt() 231 unsafe fn virt_2_phys(virt: VirtAddr) -> Option<PhysAddr> { in virt_2_phys() argument 238 let r = PhysAddr::new(paddr); in virt_2_phys() 245 fn make_entry(paddr: PhysAddr, page_flags: usize) -> usize { in make_entry() argument [all …]
|
/DragonOS/kernel/src/arch/riscv64/pci/ |
H A D | mod.rs | 11 mm::PhysAddr, 28 fn address_pci_to_physical(pci_address: PciAddr) -> crate::mm::PhysAddr { in address_pci_to_physical() argument 29 return PhysAddr::new(pci_address.data()); in address_pci_to_physical()
|
/DragonOS/kernel/src/arch/riscv64/init/ |
H A D | mod.rs | 13 mm::{memblock::mem_block_manager, PhysAddr, VirtAddr}, 26 pub fdt_paddr: PhysAddr, 35 fdt_paddr: PhysAddr::new(0), 51 static mut BOOT_FDT_PADDR: PhysAddr = PhysAddr::new(0); 55 let fdt_paddr = PhysAddr::new(fdt_paddr); in kernel_main()
|
/DragonOS/kernel/src/driver/pci/ |
H A D | ecam.rs | 3 use crate::mm::PhysAddr; 25 pub physical_address_base: PhysAddr, 33 physical_address_base: PhysAddr, in new() argument
|
/DragonOS/kernel/src/arch/x86_64/init/pvh/ |
H A D | mod.rs | 19 mm::{memblock::mem_block_manager, MemoryManagementArch, PhysAddr}, 34 let rsdp_paddr = PhysAddr::new(START_INFO.get().rsdp_paddr as usize); in init_acpi_args() 45 MMArch::phys_2_virt(PhysAddr::new(START_INFO.get().cmdline_paddr as usize)) in init_kernel_cmdline() 73 MMArch::phys_2_virt(PhysAddr::new(start_info.memmap_paddr as usize)).unwrap() in early_init_memory_blocks() 79 let start = PhysAddr::new(entry.addr as usize); in early_init_memory_blocks()
|
/DragonOS/kernel/src/arch/x86_64/init/ |
H A D | mod.rs | 14 mm::{MemoryManagementArch, PhysAddr}, 56 MMArch::phys_2_virt(PhysAddr::new(&GDT_Table as *const usize as usize)).unwrap(); in kernel_main() 58 MMArch::phys_2_virt(PhysAddr::new(&IDT_Table as *const usize as usize)).unwrap(); in kernel_main() 89 MMArch::phys_2_virt(PhysAddr::new(&GDT_Table as *const usize as usize)).unwrap(); in early_setup_arch() 91 MMArch::phys_2_virt(PhysAddr::new(&IDT_Table as *const usize as usize)).unwrap(); in early_setup_arch()
|
/DragonOS/kernel/src/arch/x86_64/mm/ |
H A D | mod.rs | 30 use crate::mm::{MemoryManagementArch, PageTableKind, PhysAddr, VirtAddr, VmFlags}; 46 static mut INITIAL_CR3_VALUE: PhysAddr = PhysAddr::new(0); 62 pub(super) fn x86_64_set_kernel_load_base_paddr(paddr: PhysAddr) { in x86_64_set_kernel_load_base_paddr() argument 169 MMArch::phys_2_virt(PhysAddr::new(0)).unwrap().data() in init() 194 unsafe fn table(table_kind: PageTableKind) -> PhysAddr { in table() argument 200 return PhysAddr::new(cr3); in table() 205 return PhysAddr::new(eptp as usize); in table() 211 unsafe fn set_table(_table_kind: PageTableKind, table: PhysAddr) { in set_table() argument 223 fn initial_page_table() -> PhysAddr { in initial_page_table() 298 unsafe fn phys_2_virt(phys: PhysAddr) -> Option<VirtAddr> { in phys_2_virt() [all …]
|
/DragonOS/kernel/src/arch/ |
H A D | mod.rs | 3 mm::PhysAddr, 33 fn address_pci_to_physical(pci_address: PciAddr) -> PhysAddr; in address_pci_to_physical() argument
|
/DragonOS/kernel/src/arch/x86_64/pci/ |
H A D | pci.rs | 11 use crate::mm::PhysAddr; 68 fn address_pci_to_physical(pci_address: PciAddr) -> PhysAddr { in address_pci_to_physical() argument 69 return PhysAddr::new(pci_address.data()); in address_pci_to_physical() 113 PhysAddr::new(mcfg_entry.base_address as usize), in discover_ecam_root()
|
/DragonOS/kernel/src/arch/riscv64/driver/ |
H A D | of.rs | 7 mm::{mmio_buddy::mmio_pool, MemoryManagementArch, PhysAddr}, 19 let map_paddr = PhysAddr::new(fdt_paddr.data() & crate::arch::MMArch::PAGE_MASK); in map_fdt()
|