-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recombine the structure into a single crate, possibly gating with configuration features. This also pulls in all the recent changes to the native rust inline assembly. Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
- Loading branch information
Showing
25 changed files
with
835 additions
and
599 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,32 @@ | ||
[workspace] | ||
members = [ | ||
"src/r-linux-syscall", | ||
[package] | ||
name = "r-linux" | ||
version = "0.1.0" | ||
|
||
authors = [ | ||
"David Rheinsberg <david.rheinsberg@gmail.com>", | ||
] | ||
categories = [ | ||
"no-std", | ||
"os", | ||
] | ||
description = "Capability-based Linux Runtime" | ||
edition = "2021" | ||
homepage = "https://github.com/bus1/r-linux" | ||
keywords = [ | ||
"api", | ||
"kernel", | ||
"linux", | ||
"runtime", | ||
"syscall", | ||
] | ||
license = "MIT OR Apache-2.0 OR LGPL-2.1-or-later" | ||
readme = "README.md" | ||
repository = "https://github.com/bus1/r-linux" | ||
|
||
[profile.dev] | ||
panic = "abort" | ||
[features] | ||
freestanding = [] | ||
unstable = [] | ||
|
||
[profile.release] | ||
panic = "abort" | ||
[[example]] | ||
name = "freestanding-syscall" | ||
required-features = ["freestanding"] |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# r-linux - Linux Kernel API Bindings | ||
# r-linux - Capability-based Linux Runtime | ||
|
||
## CHANGES WITH 0.1.0: | ||
|
||
|
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,54 @@ | ||
//! Freestanding Syscall | ||
//! | ||
//! This example shows a freestanding linux application with no runtime nor | ||
//! standard library linked. It directly provides the `_start` entry-point | ||
//! picked by the linux linker as ELF entry-point. It then simply invokes the | ||
//! `EXIT` syscall with an exit-code of 71. | ||
//! | ||
//! We need to provide a panic-handler for rust-core to link successfully. For | ||
//! simplicity we just loop in case of panic. Since no core-symbols are called, | ||
//! anyway, this is just about linking successfully. In case you did not | ||
//! specify `abort` as panic-strategy, we also need to provide the exception | ||
//! handler personality routine. Similarly to the panic-handler, we also just | ||
//! provide a dummy, since we never raise exceptions. Note that the exception | ||
//! handler requires unstable rust, so you need to compile via nightly or | ||
//! specify `panic-strategy = "abort"`. | ||
//! | ||
//! Note that our test-suite uses this example to check for cross-language | ||
//! link-time-optimization. It uses the exported symbol-list as reference, so | ||
//! be careful not to pull in symbols from this example other than the ones | ||
//! already there. | ||
//! | ||
//! Note that this example is guarded by the `freestanding` flag, since it | ||
//! cannot be linked with the standard runtime (crt0), as we do not provide the | ||
//! necessary hooks. Instead, you must compile it with `-nostartfiles`. Make | ||
//! sure to provide this when enabling the `freestanding` feature. | ||
#![cfg_attr(feature = "unstable", feature(lang_items))] | ||
|
||
#![no_main] | ||
#![no_std] | ||
|
||
use r_linux; | ||
|
||
#[cfg(feature = "unstable")] | ||
#[lang = "eh_personality"] | ||
extern "C" fn eh_personality() { | ||
loop {} | ||
} | ||
|
||
#[panic_handler] | ||
fn panic_handler(_info: &core::panic::PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[export_name = "_start"] | ||
pub extern "C" fn entrypoint() -> ! { | ||
unsafe { | ||
r_linux::syscall::arch::native::syscall::syscall1( | ||
r_linux::syscall::arch::native::nr::EXIT, | ||
71, | ||
); | ||
} | ||
loop {} | ||
} |
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,11 @@ | ||
//! Capability-based Linux Runtime | ||
//! | ||
//! XXX | ||
#![no_std] | ||
|
||
#[cfg(test)] | ||
#[macro_use] | ||
extern crate std; | ||
|
||
pub mod syscall; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.