-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'theseus_main' into theseus_main
- Loading branch information
Showing
28 changed files
with
1,545 additions
and
958 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "test_aligned_page_allocation" | ||
version = "0.1.0" | ||
description = "Tests the `AllocationRequest::AlignedTo` variant, which is needed for huge pages" | ||
authors = ["Kevin Boos <kevinaboos@gmail.com>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
log = "0.4.8" | ||
|
||
[dependencies.memory] | ||
path = "../../kernel/memory" | ||
|
||
[dependencies.app_io] | ||
path = "../../kernel/app_io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//! A set of basic tests for the [`AllocationRequest::AlignedTo`] variant. | ||
#![no_std] | ||
|
||
extern crate alloc; | ||
|
||
use alloc::{ | ||
vec::Vec, | ||
string::String, | ||
}; | ||
use app_io::println; | ||
use memory::AllocationRequest; | ||
|
||
static TEST_SET: [usize; 9] = [1, 2, 4, 8, 27, 48, 256, 512, 1024]; | ||
|
||
pub fn main(_args: Vec<String>) -> isize { | ||
match rmain() { | ||
Ok(_) => 0, | ||
Err(e) => { | ||
println!("Error: {}", e); | ||
-1 | ||
} | ||
} | ||
} | ||
|
||
fn rmain() -> Result<(), &'static str> { | ||
for num_pages in TEST_SET.into_iter() { | ||
for alignment in TEST_SET.into_iter() { | ||
println!("Attempting to allocate {num_pages} pages with alignment of {alignment} 4K pages..."); | ||
match memory::allocate_pages_deferred( | ||
AllocationRequest::AlignedTo { alignment_4k_pages: alignment }, | ||
num_pages, | ||
) { | ||
Ok((ap, _action)) => { | ||
assert_eq!(ap.start().number() % alignment, 0); | ||
assert_eq!(ap.size_in_pages(), num_pages); | ||
println!(" Success: {ap:?}"); | ||
} | ||
Err(e) => println!(" !! FAILURE: {e:?}"), | ||
} | ||
} | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.