-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change runExports so that wasi imports can be used. Improve fd_write so that emscipten compiled programs can be used. Also add example programs. Also update build file to use not use incorrect flags on windows. Signed-off-by: Adam Laszlo Kulcsar <[email protected]>
- Loading branch information
1 parent
a99792c
commit cb85a97
Showing
6 changed files
with
84 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
(module | ||
(import "wasi_snapshot_preview1" "fd_write" (func $__wasi_fd_write (param i32 i32 i32 i32) (result i32))) | ||
(import "wasi_snapshot_preview1" "fd_write" (func $wasi_fd_write (param i32 i32 i32 i32) (result i32))) | ||
(memory 1) | ||
|
||
(export "memory" (memory 0)) | ||
(export "_start" (func $_start)) | ||
(export "hello_world" (func $hello_world)) | ||
(data (i32.const 0) "Hello World!\n") | ||
|
||
(func $_start (result i32) | ||
(i32.store (i32.const 24) (i32.const 13)) ;; Lenght of "Hello World!\n" | ||
(i32.store (i32.const 20) (i32.const 0)) ;; memory offset of "Hello World!\n" | ||
(call $__wasi_fd_write | ||
(func $hello_world | ||
(i32.store (i32.const 100) (i32.const 0)) | ||
(i32.store (i32.const 104) (i32.const 13)) | ||
(i32.store (i32.const 200) (i32.const 0)) | ||
(call $wasi_fd_write | ||
(i32.const 1) ;;file descriptor | ||
(i32.const 20) ;;offset of str offset | ||
(i32.const 100) ;;offset of str offset | ||
(i32.const 1) ;;iovec length | ||
(i32.const 30) ;;result offset | ||
(i32.const 200) ;;result offset | ||
) | ||
drop | ||
i32.const 32 | ||
i32.load | ||
) | ||
) | ||
|
||
(assert_return (invoke "_start") (i32.const 0)) | ||
(assert_return (invoke "hello_world")) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
(module | ||
(import "wasi_snapshot_preview1" "proc_exit" (func $exit (param i32))) | ||
(import "wasi_snapshot_preview1" "proc_exit" (func $wasi_proc_exit (param i32))) | ||
|
||
|
||
(func (export "start") | ||
(func (export "proc_exit") | ||
i32.const 0 | ||
call $exit | ||
call $wasi_proc_exit | ||
) | ||
) | ||
|
||
(assert_return (invoke "start")) | ||
(assert_return (invoke "proc_exit")) |