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

Fix unwinding feature in sel4-microkit crate #227

Closed
wants to merge 4 commits into from
Closed
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
7 changes: 7 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ members = [
"crates/private/support/sel4-simple-task/threading",
"crates/private/tests/capdl/threads/components/test",
"crates/private/tests/capdl/utcover/components/test",
"crates/private/tests/microkit/minimal",
"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",
Expand Down
16 changes: 16 additions & 0 deletions crates/private/tests/microkit/minimal/Cargo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright 2024, Colias Group, LLC
#
# SPDX-License-Identifier: BSD-2-Clause
#

{ mk, localCrates }:

mk {
package.name = "tests-microkit-minimal";
dependencies = {
inherit (localCrates)
;
sel4-microkit = localCrates.sel4-microkit // { default-features = false; };
};
}
20 changes: 20 additions & 0 deletions crates/private/tests/microkit/minimal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright 2023, Colias Group, LLC
#
# SPDX-License-Identifier: BSD-2-Clause
#
#
# This file is generated from './Cargo.nix'. You can edit this file directly
# if you are not using this project's Cargo manifest management tools.
# See 'hacking/cargo-manifest-management/README.md' for more information.
#

[package]
name = "tests-microkit-minimal"
version = "0.1.0"
authors = ["Nick Spinale <[email protected]>"]
edition = "2021"
license = "BSD-2-Clause"

[dependencies]
sel4-microkit = { path = "../../../../sel4-microkit", default-features = false }
16 changes: 16 additions & 0 deletions crates/private/tests/microkit/minimal/src/bin/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Copyright 2024, Colias Group, LLC
//
// SPDX-License-Identifier: BSD-2-Clause
//

#![no_std]
#![no_main]

use sel4_microkit::{debug_println, protection_domain, NullHandler};

#[protection_domain]
fn init() -> NullHandler {
debug_println!("TEST_PASS");
NullHandler::new()
}
11 changes: 11 additions & 0 deletions crates/private/tests/microkit/minimal/x.system
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2024, Colias Group, LLC

SPDX-License-Identifier: BSD-2-Clause
-->
<system>
<protection_domain name="test" priority="128">
<program_image path="test.elf" />
</protection_domain>
</system>
3 changes: 2 additions & 1 deletion crates/sel4-microkit/Cargo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mk {
sel4-microkit-base
sel4-microkit-macros
;
sel4-runtime-common = localCrates.sel4-runtime-common // { features = [ "tls" "unwinding" "start" ]; };
sel4-runtime-common = localCrates.sel4-runtime-common // { features = [ "tls" "start" ]; };
sel4 = localCrates.sel4 // { features = [ "single-threaded" ]; };
};
features = {
Expand All @@ -33,6 +33,7 @@ mk {
];
unwinding = [
"sel4-panicking/unwinding"
"sel4-runtime-common/unwinding"
];
alloc = [
"sel4-panicking/alloc"
Expand Down
4 changes: 2 additions & 2 deletions crates/sel4-microkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ license = "BSD-2-Clause"
alloc = ["sel4-panicking/alloc"]
default = ["unwinding"]
full = ["default", "alloc"]
unwinding = ["sel4-panicking/unwinding"]
unwinding = ["sel4-panicking/unwinding", "sel4-runtime-common/unwinding"]

[dependencies]
cfg-if = "1.0.0"
Expand All @@ -32,5 +32,5 @@ sel4-microkit-base = { path = "base" }
sel4-microkit-macros = { path = "macros" }
sel4-panicking = { path = "../sel4-panicking" }
sel4-panicking-env = { path = "../sel4-panicking/env" }
sel4-runtime-common = { path = "../sel4-runtime-common", features = ["tls", "unwinding", "start"] }
sel4-runtime-common = { path = "../sel4-runtime-common", features = ["tls", "start"] }
sel4-sync = { path = "../sel4-sync" }
6 changes: 5 additions & 1 deletion crates/sel4-microkit/base/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,9 @@ pub fn ipc_buffer_ptr() -> *mut sel4::IpcBuffer {
static mut __sel4_ipc_buffer_obj: sel4::IpcBuffer;
}

ptr::addr_of_mut!(__sel4_ipc_buffer_obj)
// Only unsafe until 1.82
#[allow(unused_unsafe)]
unsafe {
ptr::addr_of_mut!(__sel4_ipc_buffer_obj)
}
}
1 change: 1 addition & 0 deletions hacking/nix/scope/world/instances/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ in rec {
microkit.examples.hello
microkit.examples.banscii
microkit.examples.http-server
microkit.tests.minimal
microkit.tests.passive-server-with-deferred-action
microkit.tests.reset
examples.root-task.hello
Expand Down
26 changes: 26 additions & 0 deletions hacking/nix/scope/world/instances/microkit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
, worldConfig
, seL4Config
, callPlatform
, verus

, maybe
, canSimulate
Expand Down Expand Up @@ -77,6 +78,31 @@ in {
};

tests = {
minimal = maybe isMicrokit (
let
pd = mkPD rec {
inherit (verus) rustEnvironment;
rootCrate = crates.tests-microkit-minimal;
extraProfile = {
panic = "abort";
};
};
in
callPlatform {
system = microkit.mkSystem {
searchPath = [
"${pd}/bin"
];
systemXML = sources.srcRoot + "/crates/private/tests/microkit/minimal/x.system";
};
extraPlatformArgs = lib.optionalAttrs canSimulate {
canAutomateSimply = true;
};
} // {
inherit pd;
}
);

passive-server-with-deferred-action = maybe isMicrokit (
let
mkCrateName = role: "tests-microkit-passive-server-with-deferred-action-pds-${role}";
Expand Down
3 changes: 3 additions & 0 deletions hacking/nix/scope/worlds.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ in rec {
let
in rec {
default = qemu-arm-virt.default;
microkitDefault = qemu-arm-virt.microkit;

qemu-arm-virt =
let
mk =
Expand Down Expand Up @@ -263,6 +265,7 @@ in rec {
let
in rec {
default = qemu-riscv-virt.default;
microkitDefault = qemu-riscv-virt.microkit;

qemu-riscv-virt =
let
Expand Down
5 changes: 5 additions & 0 deletions hacking/nix/top-level/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ in {

worlds = lib.fix (self: {
default = self.aarch64.default;
microkit = rec {
default = aarch64;
aarch64 = self.aarch64.microkitDefault;
riscv64 = self.riscv64.microkitDefault;
};
} // lib.mapAttrs (_: arch: arch.none.this.worlds) {
inherit (pkgs.host) aarch64 aarch32 x86_64 i386;
riscv64 = pkgs.host.riscv64.default;
Expand Down
Loading