-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We had to implement argument passing to processes. I'm not really satisfied with the solution because the api is crappy. However, let's leave it like that for now and improve it in the future.
- Loading branch information
Showing
8 changed files
with
124 additions
and
11 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
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
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 |
---|---|---|
|
@@ -62,3 +62,8 @@ bench = false | |
name = "stress" | ||
test = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "echo" | ||
test = false | ||
bench = false |
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,19 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
use common::syscalls::{sys_execute_get_arg, sys_execute_number_of_args}; | ||
use userspace::{print, println}; | ||
|
||
extern crate userspace; | ||
|
||
#[unsafe(no_mangle)] | ||
fn main() { | ||
let args = sys_execute_number_of_args(); | ||
for index in 0..args { | ||
let mut buf = [0u8; 1024]; | ||
let len = sys_execute_get_arg(index, &mut buf).expect("Could not read arg"); | ||
let s = core::str::from_utf8(&buf[0..len]).expect("Argument must be utf8"); | ||
print!("{s} "); | ||
} | ||
println!(""); | ||
} |
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