Last active
March 2, 2020 13:52
-
-
Save subzey/7dd2cc27274b59322d78878f73a0944d to your computer and use it in GitHub Desktop.
WASI iovec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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