Commit Graph

2437 Commits

Author SHA1 Message Date
Jakub Konka
7287767a3f Add enough Windows functionality to run WASI tutorial (#22)
* Add partial impl of determine_type_rights fn

* Add draft of fd_fdstat_get hostcall

* Add writev wrapper for writing IoVec in RawHandle

* Move IoVec and writev to separate helper crate

* Add Win error handling

Clean up closing and duplicating RawHandle

* Wrap Win file type result

* Add draft impl of fd_close and fd_read

* Refactor getting file access rights

* Remove winapi from the main Cargo.toml

* Add very rough draft of open_path (very incomplete)

* Clean up WinError with macro

* Ignore dir handle in openat if path absolute

* Decode oflags and advance open_path hostcall

* Clean up AccessRight and FlagsAndAttributes flags

* Implement path_get (without symlink expansion yet!)

* Add ShareMode and fix path_get for nested paths

* Add some error mappings between Win and WASI

* Clean up fdflags conversions

* Fix sharing violation when calling openat at '.'

* Apply Alex's fix of using ManuallyDrop instead forget

* Clean up

* Explicitly specify workspace to avoid comp errors at tests
2019-06-27 17:10:15 -07:00
Jakub Konka
22c69f46f9 Use build.rs to generate test cases automatically
Now, test binaries are bundled with the repo, and
just like in CraneStation/wasmtime, the test cases
are generated automatically using build.rs. So all
it takes is to drop a new test binary in the
testsuite dir to get the test case for it generated
(with some caveats to do with handling preopens).
2019-06-26 15:24:21 -07:00
Jakub Konka
656112d00b Patch wasmtime-wasi to use this wasi-common version 2019-06-26 15:24:21 -07:00
Jakub Konka
81b673f908 Fix typos 2019-06-26 15:24:21 -07:00
Jakub Konka
b9c04d431f Move workspace creation outside of runtime instantiation 2019-06-26 15:24:21 -07:00
Jakub Konka
d0eac815f0 Fix Windows CI 2019-06-26 15:24:21 -07:00
Jakub Konka
ae63b33a23 Refactor 2019-06-26 15:24:21 -07:00
Jakub Konka
20d228f29e Modify test-all.sh script 2019-06-26 15:24:21 -07:00
Jakub Konka
982dbab1f2 Add misc-tests as a submodule dep 2019-06-26 15:24:21 -07:00
Jakub Konka
6ca01ce546 Add wasmtime as default runtime for integration tests 2019-06-26 15:24:21 -07:00
Yury Delendik
d52ab02835 Fix skipping dead DWARF records 2019-06-26 14:26:26 -07:00
Yury Delendik
19cfec6e8f Ignore non-existent refs in the transformed DWARF 2019-06-26 14:25:45 -07:00
Dan Gohman
c0ba4753eb Enable wasi-common by default (#177)
This removes the --wasi-common, as it's now on by default, and adds a
--wasi-c option to enable the wasi-c implementation.
2019-06-25 02:05:49 -07:00
Jakub Konka
513429f1b8 Port trace log from wasmtime-wasi-c crate 2019-06-24 22:47:41 +02:00
Jakub Konka
dc05d89a08 Fix path_readlink: with a 0-sized buffer should succeed 2019-06-24 11:54:18 -07:00
Jakub Konka
7fef91c1e4 Fix fd_renumber when trying to renumber a preopen 2019-06-24 11:54:18 -07:00
Jakub Konka
a11f2b1d3a Refactor path_get and fix flags in path_open 2019-06-24 11:54:18 -07:00
Jakub Konka
b35719fe4a Add fixes so that misc-tests pass 2019-06-24 11:54:18 -07:00
Sean Stangl
b9836d4d9c Correctly capitalize Firefox in the README 2019-06-20 16:23:15 -07:00
Jef
2e4d676093 Fix several miscompilations 2019-06-20 15:21:22 +02:00
Van der Auwermeulen Grégoire
d900a5f6ef Update WASI-tutorial.md
consistent
2019-06-19 07:13:51 -07:00
Van der Auwermeulen Grégoire
3425553dc6 Update WASI-tutorial.md
Update README based on feedback
2019-06-19 07:13:51 -07:00
Van der Auwermeulen Grégoire
15b85dc285 Update WASI-tutorial.md 2019-06-19 07:13:51 -07:00
Jakub Konka
ce8912abf3 Use preopen_dir handlers exposed in wasi-common 2019-06-19 07:12:00 -07:00
Sendil Kumar
ab8f8ef5d8 Adds an explicit way to use the args inside the WebAssembly Module 2019-06-19 07:10:56 -07:00
Jakub Konka
7ac6666fcb Fixes incorrect guest fd encoding
Surfaced when running sunfishcode/misc-tests. When trying to
truncate the file without the __WASI_RIGHT_PATH_FILESTAT_SET_SIZE
right, error __WASI_ENOTCAPABLE was correctly returned, however,
the guest fd pointer was not encoded to -1 in that case. This
commit fixes it by taking out the guest fd encoding out of the
conditional branch which turns out obsolete.
2019-06-19 07:09:46 -07:00
Jakub Konka
54a897cf91 Move common functionality into hostcalls mod 2019-06-18 06:00:22 -07:00
Jakub Konka
c113ff32e6 Move preopen_dir handlers from wasmtime to wasi-common 2019-06-17 02:40:42 -07:00
Jef
e2285b543a Fix div (makes the euler example pass!) 2019-06-13 13:24:40 +02:00
Jef
353e6e737b Make not a no-op for condition codes, only emit constants once 2019-06-09 14:55:09 +02:00
Ari Lotter
8dc1d90352 Use try_from replacing cast in wasmtime-runtime. 2019-06-09 12:27:28 +02:00
Ari Lotter
f3f6ab0583 Use try_from replacing cast in wasmtime-wasi-c. 2019-06-09 12:27:28 +02:00
Ari Lotter
1158b5bd6c Use try_from replacing cast in wasmtime-environ.
`try_from` is stable now, so cast is unnecessary.
2019-06-09 12:27:28 +02:00
Jakub Konka
e530a582af Fix preopening dirs on Windows 2019-06-03 13:23:07 -07:00
Dan Gohman
635be8a032 Make the wasmtime-wasi-c dependency conditional on Unix. 2019-06-03 13:23:07 -07:00
Dan Gohman
06b6ec42b9 Provide the C WASI implementation as an option.
This adds the C WASI implementation as a new crate, wasmtime-wasi-c,
and adds a command-line flag to the wasmtime command-line driver to
select which WASI implementation to use.
2019-06-03 13:23:07 -07:00
Jakub Konka
d57fbc7d0c Sync with wasi-common 2019-06-03 13:23:07 -07:00
Jakub Konka
e44d8e8fe3 Update min rustc to 1.34 as required by wasi-common 2019-06-03 13:23:07 -07:00
Jakub Konka
e8142f076d Migrate to wasi-common crate 2019-06-03 13:23:07 -07:00
Dan Gohman
3dfeab50ad Don't add the NULL terminator to argv and environ arrays.
The wasm userspace has been updated to do that instead, in
https://github.com/CraneStation/wasi-sysroot/pull/72.
2019-06-02 08:54:51 +02:00
Dan Gohman
9a66400cd8 Use try_from instead of the cast crate.
`try_from` is newly stable in the standard library starting in Rust 1.34.
2019-05-31 21:09:43 +02:00
Jakub Konka
51fc39e0e6 Backport path_get fix discovered in Win branch 2019-05-31 20:32:42 +02:00
Dan Gohman
61eb4738fe wasi-sysroot is now named wasi-libc. (#167) 2019-05-31 10:15:52 +02:00
Dan Gohman
825f1d764a Fix a compiler warning.
Fix the following warning from Rust 1.35:

warning: cannot borrow `*self` as mutable because it is also borrowed as immutable
   --> wasmtime-runtime/src/instance.rs:473:25
    |
465 |         } else if let Some(start_export) = self.module.exports.get("_start") {
    |                                            ----------- immutable borrow occurs here
...
473 |                         self.invoke_function(*func_index)
    |                         ^^^^                 ----------- immutable borrow later used here
    |                         |
    |                         mutable borrow occurs here
    |
    = note: #[warn(mutable_borrow_reservation_conflict)] on by default
    = warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
    = note: for more information, see issue #59159 <https://github.com/rust-lang/rust/issues/59159>
2019-05-30 18:44:38 -07:00
Dan Gohman
b5f4949597 Avoid using C features which depends on _Generic. 2019-05-27 10:13:33 -07:00
Dan Gohman
1882fc41bb Build sandboxed-system-primitives with -std=gnu99. 2019-05-27 09:14:29 -07:00
Dan Gohman
f486d61629 Make use of static_assert conditional on whether it's available. 2019-05-27 09:07:04 -07:00
Dan Gohman
176538b860 Support GCC and clang versions that lack <stdatomic.h>.
Add a code path to use the GCC builtins for atomics, which are supported
in older compiler versions, rather than the new <stdatomic.h>.
2019-05-27 07:48:18 +02:00
Jakub Konka
0143ed548d Update README 2019-05-24 11:02:03 -07:00
Jakub Konka
b1764e18eb Add appveyor for automated Win testing 2019-05-24 11:02:03 -07:00