Skip to content

Commit

Permalink
wasi: dumb implementation of wasi_fd_write
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed May 22, 2020
1 parent c4a16cd commit ce26ace
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/wasi/wasi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ fizzy::execution_result wasi_proc_exit(fizzy::Instance&, std::vector<uint64_t> a
return {false, {}};
}

fizzy::execution_result wasi_fd_write(fizzy::Instance& instance, std::vector<uint64_t> args, int)
{
(void)instance;
(void)args;
return {false, {0}};
}

fizzy::bytes load_wasm_file(const fs::path& path)
{
std::ifstream wasm_file{path};
Expand Down Expand Up @@ -60,6 +67,10 @@ bool run(const fs::path& cmd, int argc, char** argv)
{
// TODO: support both wasi_snapshot_preview1 and wasi_unstable
{"wasi_unstable", "proc_exit", {fizzy::ValType::i32}, std::nullopt, wasi_proc_exit},
{"wasi_unstable", "fd_write",
{fizzy::ValType::i32, fizzy::ValType::i32, fizzy::ValType::i32,
fizzy::ValType::i32},
fizzy::ValType::i32, wasi_fd_write},
});
auto instance = fizzy::instantiate(module, imports);

Expand Down

0 comments on commit ce26ace

Please sign in to comment.