# os-memory **Repository Path**: zr233/os-memory ## Basic Information - **Project Name**: os-memory - **Description**: 操作系统内存管理 - **Primary Language**: Rust - **License**: MulanPubL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-07-19 - **Last Updated**: 2025-08-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OS-MEMORY 这是一个用于`no-std`环境的简易内存管理实现。 ## 功能 * [x] 支持架构: x86_64, riscv64, aarch64 * [x] 页表管理 * [x] `DMA`一致性内存分配 ## 使用 ```rust struct Boot; // Boot阶段相关参数 impl BootState for Boot { fn virt_phys_offset() -> usize { todo!() } fn memory_regions() -> impl Iterator { todo!() } fn phys_bus_offset() -> usize { todo!() } } os_memory::init_allocator::(); // 创建一个长度为10的一致性内存数组,alignment 为 4096 let mut array = ArrayCoherent::::zero(10, 4096).unwrap(); assert_eq!(array.len(), 10); let b = Box::new(1); assert_eq!(*b, 1); ```