File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -63,5 +63,7 @@ axsync = { path = "modules/axsync" }
6363axtask = { path = " modules/axtask" }
6464axdma = { path = " modules/axdma" }
6565
66+ allocator = { git = " https://github.com/arceos-org/allocator.git" , tag = " v0.1.1" }
67+
6668[profile .release ]
6769lto = true
Original file line number Diff line number Diff line change @@ -146,6 +146,24 @@ impl GlobalAllocator {
146146 self . palloc . lock ( ) . alloc_pages ( num_pages, align_pow2)
147147 }
148148
149+ /// Allocates contiguous pages starting from the given address.
150+ ///
151+ /// It allocates `num_pages` pages from the page allocator starting from the
152+ /// given address.
153+ ///
154+ /// `align_pow2` must be a power of 2, and the returned region bound will be
155+ /// aligned to it.
156+ pub fn alloc_pages_at (
157+ & self ,
158+ start : usize ,
159+ num_pages : usize ,
160+ align_pow2 : usize ,
161+ ) -> AllocResult < usize > {
162+ self . palloc
163+ . lock ( )
164+ . alloc_pages_at ( start, num_pages, align_pow2)
165+ }
166+
149167 /// Gives back the allocated pages starts from `pos` to the page allocator.
150168 ///
151169 /// The pages should be allocated by [`alloc_pages`], and `align_pow2`
You can’t perform that action at this time.
0 commit comments