Crates.io | selfe-sys |
lib.rs | selfe-sys |
version | 0.1.1 |
source | src |
created_at | 2022-01-21 17:44:04.50021 |
updated_at | 2022-01-21 17:44:04.50021 |
description | A generated thin wrapper around libsel4.a, with supporting subcrates |
homepage | |
repository | https://github.com/auxoncorp/selfe-sys |
max_upload_size | |
id | 518662 |
size | 60,976 |
A generated thin wrapper around libsel4.a, with supporting subcrates.
selfe
for building seL4 applications with the help of a sel4.toml config fileselfe-sys
for access to syscalls. It can be built/run independently or with selfe
.no_std
Rust-based root tasks on seL4.See the READMEs of the subdirectories for more detailed explanations.
Add a dependency to this library in your Cargo.toml manifest:
[dependencies]
selfe-sys = "0.1"
And then in your Rust project:
extern crate selfe_sys;
use selfe_sys::{seL4_CapInitThreadTCB, seL4_TCB_Suspend};
fn main() {
let _suspend_error = unsafe {
seL4_TCB_Suspend(seL4_CapInitThreadTCB as usize)
};
}
Furthermore, your library may require the following rustflags set in your .cargo/config
file
in order to link successfully.
[build]
rustflags = ["-C", "link-args=-no-pie"]
Note that the Rust-available library name is selfe_sys
selfe_sys
contains the syscalls, constants, API functions, and type definitions
from libsel4.
The majority of these bindings are generated with bindgen
from the seL4 kernel source specified in the project's relevant sel4.toml, as managed by
selfe-config. The exact contents of the sel4-sys
package
will depend on the configuration flags set in that sel4.toml file, as they affect
the headers in seL4 used as input to the binding generation.
The goal here is to be able to track against changes to seL4 with as little manual effort as reasonable.
Because these bindings are intended to be zero-overhead, the output is not particularly
Rust-idiomatic. A notable no-cost ergonomics addition is that
seL4_Word
and seL4_CPtr
have been defined to be the same as regular Rust usize
.
Starting from a regular Rust toolchain, install the build tools.
cargo install cargo-xbuild
cargo install selfe-config --bin selfe --features bin --force
Note that Python, CMake, Ninja, QEMU, and others are lurking as indirect dependencies for seL4.
Default configuration is provided such that a regular cargo build
will work
even without supplying a specific SEL4_CONFIG_PATH
environment variable pointing at a sel4.toml file.
cargo build
Cross-compilation is also possible with cargo-xbuild or
xargo. Specify your Rust target triple as an argument explicitly,
and use the environment variable SEL4_CONFIG_PATH
to point to your sel4.toml configuration file
and the SEL4_PLATFORM
env-var to select your desired platform target.
SEL4_CONFIG_PATH=/home/other/sel4.toml SEL4_PLATFORM=pc99 cargo xbuild --target=x86_64-unknown-linux-gnu
The embedded default configuration file minimally supports the sabre
and pc99
platforms
SEL4_PLATFORM=sabre cargo xbuild --target armv7-unknown-linux-gnueabihf
SEL4_PLATFORM=pc99 cargo xbuild --target x86_64-unknown-linux-gnu
This library contains three kinds of tests:
Run them all on an x86_64
type host dev machine with cargo test
See LICENSE for more details.
Copyright 2021 Auxon Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.