Configure the number of pages in the board

This permits to have portable apps.
This commit is contained in:
Julien Cretin
2021-08-15 22:39:13 +02:00
committed by Julien Cretin
parent c1f2551d0d
commit 2d5fdd1034
12 changed files with 77 additions and 79 deletions

View File

@@ -349,7 +349,7 @@ index 348c746a5..5465c95f4 100644
}
}
diff --git a/kernel/src/process.rs b/kernel/src/process.rs
index c52754be3..ae6a58341 100644
index c52754be3..26a7c47d3 100644
--- a/kernel/src/process.rs
+++ b/kernel/src/process.rs
@@ -359,6 +359,15 @@ pub trait ProcessType {
@@ -415,7 +415,7 @@ index c52754be3..ae6a58341 100644
+ .mpu()
+ .allocate_region(
+ storage_location.address as *const u8,
+ storage_location.size,
+ storage_location.unallocated_size,
+ storage_location.size,
+ mpu::Permissions::ReadOnly,
+ &mut mpu_config,
@@ -439,10 +439,10 @@ index c52754be3..ae6a58341 100644
// memory space just for kernel and grant state. We need to make
// sure we allocate enough memory just for that.
diff --git a/kernel/src/sched.rs b/kernel/src/sched.rs
index 10626a2e1..8844bc6c3 100644
index 10626a2e1..61401b04a 100644
--- a/kernel/src/sched.rs
+++ b/kernel/src/sched.rs
@@ -118,6 +118,12 @@ pub enum SchedulingDecision {
@@ -118,6 +118,13 @@ pub enum SchedulingDecision {
TrySleep,
}
@@ -450,12 +450,13 @@ index 10626a2e1..8844bc6c3 100644
+pub struct StorageLocation {
+ pub address: usize,
+ pub size: usize,
+ pub unallocated_size: usize,
+}
+
/// Main object for the kernel. Each board will need to create one.
pub struct Kernel {
/// How many "to-do" items exist at any given time. These include
@@ -127,6 +133,9 @@ pub struct Kernel {
@@ -127,6 +134,9 @@ pub struct Kernel {
/// This holds a pointer to the static array of Process pointers.
processes: &'static [Option<&'static dyn process::ProcessType>],
@@ -465,7 +466,7 @@ index 10626a2e1..8844bc6c3 100644
/// A counter which keeps track of how many process identifiers have been
/// created. This is used to create new unique identifiers for processes.
process_identifier_max: Cell<usize>,
@@ -170,9 +179,17 @@ pub enum StoppedExecutingReason {
@@ -170,9 +180,17 @@ pub enum StoppedExecutingReason {
impl Kernel {
pub fn new(processes: &'static [Option<&'static dyn process::ProcessType>]) -> Kernel {
@@ -483,7 +484,7 @@ index 10626a2e1..8844bc6c3 100644
process_identifier_max: Cell::new(0),
grant_counter: Cell::new(0),
grants_finalized: Cell::new(false),
@@ -900,4 +917,8 @@ impl Kernel {
@@ -900,4 +918,8 @@ impl Kernel {
(return_reason, time_executed_us)
}