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

wasi: define wasi implementations + zware-gen uses these definitions #206

Merged
merged 4 commits into from
Jul 22, 2023

Conversation

malcolmstill
Copy link
Owner

@malcolmstill malcolmstill commented Jul 15, 2023

Description

  • Modifies zware-gen so no function stubs are created for wasi functions (module wasi_snapshot_preview1)
  • Implements enough wasi to run doom!
    • Luckily, as part of ditching the C++ implementation of the zig compiler, Andrew / Jacob have done the hard work and showed how to implement a bunch of these functions in https://github.com/andrewrk/zig-wasi
    • Adds an api (via Instance) for adding preopens and forwarding on args
    • Whilst the interface is on Instance, access within the wasi functions is via VirtualMachine directly (because remember vm.inst (potentially) changes to different Instances during execution...the non-invoking Instances will not have preopens / args
Screen.Recording.2023-07-17.at.02.18.40.mov

Follow ups

  • Need to implement more wasi (I currently comment out some code that reads env vars in the Doom source code which would otherwise pull in the wasi env functions)
    • How do we test this? Can I get a simple .c program that requires the complete wasi?

@malcolmstill malcolmstill merged commit f78cf55 into master Jul 22, 2023
@malcolmstill malcolmstill deleted the malcolm/wasi branch July 22, 2023 16:29
@malcolmstill malcolmstill mentioned this pull request Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant