Skip to content

Commit

Permalink
Merge pull request #1011 from stlankes/syscall
Browse files Browse the repository at this point in the history
add feature `syscall` to run kernel as standalone application
  • Loading branch information
stlankes authored Dec 24, 2023
2 parents 3d106e0 + 2d9192a commit 5bcf624
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ tcp = ["smoltcp", "smoltcp/socket-tcp"]
udp = ["smoltcp", "smoltcp/socket-udp"]
trace = []
vga = []
syscall = []

[dependencies]
ahash = { version = "0.8", default-features = false }
Expand Down
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,10 @@ pub(crate) extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
#[cfg(target_os = "none")]
extern "C" fn initd(_arg: usize) {
extern "C" {
#[cfg(not(test))]
#[cfg(all(not(test), not(feature = "syscall")))]
fn runtime_entry(argc: i32, argv: *const *const u8, env: *const *const u8) -> !;
#[cfg(all(not(test), feature = "syscall"))]
fn main() -> !;
#[cfg(feature = "newlib")]
fn init_lwip();
#[cfg(feature = "newlib")]
Expand Down Expand Up @@ -294,7 +296,10 @@ extern "C" fn initd(_arg: usize) {
#[cfg(not(test))]
unsafe {
// And finally start the application.
runtime_entry(argc, argv, environ)
#[cfg(all(not(test), not(feature = "syscall")))]
runtime_entry(argc, argv, environ);
#[cfg(all(not(test), feature = "syscall"))]
main();
}
#[cfg(test)]
test_main();
Expand Down

0 comments on commit 5bcf624

Please sign in to comment.