Skip to content

Support for running wasm-wasi binaries#472

Merged
kevinaboos merged 21 commits into
theseus-os:theseus_mainfrom
vikrammullick:wasm-support
Jan 24, 2022
Merged

Support for running wasm-wasi binaries#472
kevinaboos merged 21 commits into
theseus-os:theseus_mainfrom
vikrammullick:wasm-support

Conversation

@vikrammullick

@vikrammullick vikrammullick commented Dec 14, 2021

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

@kevinaboos kevinaboos left a comment

Copy link
Copy Markdown
Member

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.

Comment thread kernel/wasi_interpreter/src/wasi_definitions.rs Outdated
Comment thread kernel/wasi_interpreter/src/wasi_definitions.rs Outdated
Comment thread applications/wasm/Cargo.toml
Comment thread applications/wasm/src/lib.rs Outdated
Comment thread applications/wasm/src/lib.rs Outdated
…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.

2 participants