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

Support for running wasm-wasi binaries #472

Merged
merged 21 commits into from Jan 24, 2022

Conversation

vikrammullick
Copy link
Contributor

@vikrammullick vikrammullick commented Dec 14, 2021

This PR includes applications/wasi_interpreter, a wasi interpreter that interfaces between Theseus and wasmi and currently supports the following wasi system calls:

System Call Notes
ProcExit
FdClose
FdWrite
FdSeek
FdRead
FdFdstatGet
EnvironSizesGet
EnvironGet
FdPrestatGet
FdPrestatDirName
PathOpen
FdFdstatSetFlags
ArgsSizesGet
ArgsGet
ClockTimeGet TODO: return UNIX timestamp (currently returns 0)

Additionally, this PR includes the following applications:
applications/wgrep: grep-2.0 compiled to wasi-wasm and run with wasi-interpreter source
applications/wzork: zork compiled to wasi-wasm and run with wasi-interpreter source, about
applications/wpee: pee (command to write to files) compiled to wasi-wasm and run with wasi-interpreter source
applications/wasmi_simple_test: Test application to verify that wasmi successfully runs in no_std environment
applications/gen_test_files: Helper application to generate test text files (opening crawls from the Star Wars Saga)

@kevinaboos
Copy link
Member

Thanks again for submitting this; I've left some comments on Slack.

kevinaboos added a commit that referenced this pull request Jan 12, 2022
Necessary for future usage by in-kernel WASM components, e.g., #472
github-actions bot pushed a commit that referenced this pull request Jan 12, 2022
Necessary for future usage by in-kernel WASM components, e.g., #472 9115bb0
@vikrammullick vikrammullick force-pushed the wasm-support branch 2 times, most recently from f78e1a2 to eb29515 Compare January 12, 2022 10:17
vikrammullick pushed a commit to vikrammullick/Theseus that referenced this pull request Jan 12, 2022
Necessary for future usage by in-kernel WASM components, e.g., theseus-os#472
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks excellent! just left a few small comments.

kernel/wasi_interpreter/src/wasi_definitions.rs Outdated Show resolved Hide resolved
kernel/wasi_interpreter/src/wasi_definitions.rs Outdated Show resolved Hide resolved
applications/wasm/Cargo.toml Show resolved Hide resolved
applications/wasm/src/lib.rs Outdated Show resolved Hide resolved
applications/wasm/src/lib.rs Outdated Show resolved Hide resolved
…added description to applications/wasm Cargo.toml, improved wasm application usage text
@kevinaboos kevinaboos merged commit f4aa715 into theseus-os:theseus_main Jan 24, 2022
github-actions bot pushed a commit that referenced this pull request Jan 24, 2022
* See `applications/wasm` for examples on how to run WASM binaries.

* Key components and details:
    * `kernel/wasm_interpreter` is the main interface between `wasmi` and the rest of Theseus.
    * `applications/wasm` is the user frontend for invoking a WASM binary, which allows specifying access to directories, preopening files, and passing arguments to the WASM application.
    * Basic WASI system calls are supported.
    *  WASM binaries are currently located in `extra_files/`, as are some test/demo files that are used by those WASM binaries. f4aa715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants