forked from theseus-os/Theseus
-
Notifications
You must be signed in to change notification settings - Fork 0
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 task-cancel
- Loading branch information
Showing
131 changed files
with
5,585 additions
and
4,093 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "test_identity_mapping" | ||
version = "0.1.0" | ||
description = "Tests the `memory::create_identity_mapping()` function" | ||
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,39 @@ | ||
//! A set of basic tests for [`memory::create_identity_mapping()`]. | ||
|
||
#![no_std] | ||
|
||
extern crate alloc; | ||
|
||
use alloc::{ | ||
vec::Vec, | ||
string::String, | ||
}; | ||
use app_io::println; | ||
|
||
static TEST_SET: [usize; 8] = [1, 2, 4, 8, 25, 48, 256, 1024]; | ||
|
||
pub fn main(_args: Vec<String>) -> isize { | ||
match rmain() { | ||
Ok(_) => 0, | ||
Err(e) => { | ||
println!("Error: {}", e); | ||
-1 | ||
} | ||
} | ||
} | ||
|
||
fn rmain() -> Result<(), &'static str> { | ||
let flags = memory::PteFlags::new().valid(true); | ||
for num_pages in TEST_SET.into_iter() { | ||
println!("Attempting to create identity mapping of {num_pages} pages..."); | ||
match memory::create_identity_mapping(num_pages, flags) { | ||
Ok(mp) => { | ||
assert_eq!(mp.size_in_pages(), num_pages); | ||
println!(" Success: {mp:?}"); | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "test_preemption_counter" | ||
version = "0.1.0" | ||
authors = ["Klim Tsoutsman <klim@tsoutsman.com>"] | ||
description = "Application for testing the preemption counter" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
app_io = { path = "../../kernel/app_io" } | ||
preemption = { path = "../../kernel/preemption" } |
Oops, something went wrong.