Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for resettable protection domains #167

Merged
merged 20 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ License: CC-BY-SA-4.0
Files:
Cargo.lock
support/*.json
crates/sel4-generate-target-specs/src/microkit-resettable.lds
hacking/cargo-manifest-management/tool/Cargo.lock
hacking/unstable-feature-monitoring/wishlist/Cargo.lock
hacking/nix/scope/capdl-tool/capDL-tool.nix
Expand Down
97 changes: 53 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ members = [
"crates/private/tests/capdl/utcover/components/test",
"crates/private/tests/microkit/passive-server-with-deferred-action/pds/client",
"crates/private/tests/microkit/passive-server-with-deferred-action/pds/server",
"crates/private/tests/microkit/reset",
"crates/private/tests/root-task/backtrace",
"crates/private/tests/root-task/c",
"crates/private/tests/root-task/config",
Expand Down Expand Up @@ -121,7 +122,8 @@ members = [
"crates/sel4-panicking/env",
"crates/sel4-platform-info",
"crates/sel4-platform-info/types",
"crates/sel4-render-elf-with-data",
"crates/sel4-reset",
"crates/sel4-reset/cli",
"crates/sel4-root-task",
"crates/sel4-root-task/default-test-harness",
"crates/sel4-root-task/macros",
Expand All @@ -132,7 +134,9 @@ members = [
"crates/sel4-shared-ring-buffer/block-io/types",
"crates/sel4-shared-ring-buffer/bookkeeping",
"crates/sel4-shared-ring-buffer/smoltcp",
"crates/sel4-stack",
"crates/sel4-sync",
"crates/sel4-synthetic-elf",
"crates/sel4-test-harness",
"crates/sel4/bitfield-ops",
"crates/sel4/bitfield-parser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mk {
inherit (localCrates)
sel4-microkit-message
sel4-microkit-driver-adapters

;
sel4-microkit = localCrates.sel4-microkit // { default-features = false; };
sel4-pl011-driver = localCrates.sel4-pl011-driver // { optional = true; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,36 @@ mod stack {
Self(UnsafeCell::new([0; N]))
}

pub const fn top(&self) -> StackTop {
StackTop(self.0.get().cast::<u8>().wrapping_add(N))
pub const fn bottom(&self) -> StackBottom {
StackBottom(self.0.get().cast::<u8>().wrapping_add(N))
}
}

#[repr(transparent)]
pub struct StackTop(#[allow(dead_code)] *mut u8);
pub struct StackBottom(#[allow(dead_code)] *mut u8);

unsafe impl Sync for StackTop {}
unsafe impl Sync for StackBottom {}

const STACK_SIZE: usize = 0x4000;

static STACK: Stack<STACK_SIZE> = Stack::new();

#[no_mangle]
static __stack_top: StackTop = STACK.top();
static __stack_bottom: StackBottom = STACK.bottom();
}

cfg_if::cfg_if! {
if #[cfg(target_arch = "aarch64")] {
global_asm! {
r#"
.extern __rust_entry
.extern __stack_top
.extern __stack_bottom

.section .text

.global _start
_start:
ldr x9, =__stack_top
ldr x9, =__stack_bottom
ldr x9, [x9]
mov sp, x9
b __rust_entry
Expand All @@ -136,13 +136,13 @@ cfg_if::cfg_if! {
global_asm! {
r#"
.extern __rust_entry
.extern __stack_top
.extern __stack_bottom

.section .text

.global _start
_start:
ldr r8, =__stack_top
ldr r8, =__stack_bottom
ldr r8, [r8]
mov sp, r8
b __rust_entry
Expand All @@ -155,7 +155,7 @@ cfg_if::cfg_if! {
() => {
r#"
.extern __rust_entry
.extern __stack_top
.extern __stack_bottom

.section .text

Expand All @@ -169,7 +169,7 @@ cfg_if::cfg_if! {
addi gp, gp, %pcrel_lo(1b)
.option pop

la sp, __stack_top
la sp, __stack_bottom
lx sp, (sp)
jal __rust_entry

Expand Down Expand Up @@ -201,13 +201,13 @@ cfg_if::cfg_if! {
global_asm! {
r#"
.extern __rust_entry
.extern __stack_top
.extern __stack_bottom

.section .text

.global _start
_start:
mov rsp, __stack_top
mov rsp, __stack_bottom
mov rbp, rsp
sub rsp, 0x8 // Stack must be 16-byte aligned before call
push rbp
Expand Down
2 changes: 1 addition & 1 deletion crates/examples/root-task/spawn-task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ edition = "2021"
license = "BSD-2-Clause"

[dependencies]
object = { version = "0.32.1", default-features = false, features = ["read"] }
object = { version = "0.36.1", default-features = false, features = ["read"] }
sel4 = { path = "../../../sel4" }
sel4-root-task = { path = "../../../sel4-root-task" }
Loading
Loading