Skip to content

Instantly share code, notes, and snippets.

@subzey
Last active March 2, 2020 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subzey/7dd2cc27274b59322d78878f73a0944d to your computer and use it in GitHub Desktop.
Save subzey/7dd2cc27274b59322d78878f73a0944d to your computer and use it in GitHub Desktop.
WASI iovec
(module
(func $fd_write (import "wasi_unstable" "fd_write") (param i32 i32 i32 i32) (result i32))
(func $proc_exit (import "wasi_unstable" "proc_exit") (param i32))
(memory (export "memory") 1)
(data (offset (i32.const 65532)) "TEST")
(func (export "_start")
(i32.store (i32.const 0) (i32.const 65532)) ;; iov.iov_base
(i32.store (i32.const 4) (i32.const 4)) ;; iov.iov_len
(call $fd_write
(i32.const 1) ;; fd, 1 = stdout
(i32.const 0) ;; *iovs
(i32.const 1) ;; iovs_len
(i32.const 4) ;; nwritten
)
(call $proc_exit)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment