Jakub Konka
e530a582af
Fix preopening dirs on Windows
6 years ago
Dan Gohman
635be8a032
Make the wasmtime-wasi-c dependency conditional on Unix.
6 years ago
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.
6 years ago
Jakub Konka
e8142f076d
Migrate to wasi-common crate
6 years ago
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.
6 years ago
Jakub Konka
51fc39e0e6
Backport path_get fix discovered in Win branch
6 years ago
Jakub Konka
c3ff3cf075
Add template for Windows impl
6 years ago
Jakub Konka
7605584691
Move *nix specific implementation to separate module
6 years ago
Jef
dc3a4d7f4a
Fix register cycles, fix a minor issue in pushing
6 years ago
afinch7
9b6abc1497
fmt
6 years ago
afinch7
48b7f8e443
detect lzcnt/tzcnt support and use if available
6 years ago
Dan Gohman
3372e47e5a
Fix fd_fdstat_set_rights to set the rights.
After checking that no new rights are being added, actually set the
rights, which may be a subset of the original rights.
6 years ago
Dan Gohman
c5bda1f4e1
Fix symlink resolution on Linux and FreeBSD.
Linux's open returns ENOTDIR when used with O_DIRECTORY|O_NOFOLLOW and
the path is a symlink. Update the code to expect this.
FreeBSD's open returns EMLINK instead of ELOOP when using O_NOFOLLOW on
symlink. Update the code to expect this.
6 years ago
Dan Gohman
9823bf6196
Change path_open to not create files with execute privleges.
WASI currently lacks the ability to specify the full UNIX access control
information when creating files and directories, so for now just avoid
creating executable files and rely on the umask.
6 years ago
Dan Gohman
32da43f600
Handle set-size rights correctly when truncating a file.
If a path_open call is requesting __WASI_RIGHT_FD_FILESTAT_SET_SIZE,
interpret that as a request for write privleges. If it is requesting
O_TRUNC, require __WASI_RIGHT_PATH_FILESTAT_SET_SIZE, since this is
a path operation rather than a FD operation.
6 years ago
Dan Gohman
d20d787bb7
Don't grant __WASI_RIGHT_FD_FILESTAT_SET_SIZE for directories.
RIGHTS_DIRECTORY_BASE should not include
__WASI_RIGHT_FD_FILESTAT_SET_SIZE, because that would imply the ability
to set the size of a directory.
6 years ago
Jakub Konka
14ba585edf
Reorganise hostcalls into submodules
6 years ago
Jakub Konka
b9871648b2
Import all changes from lucet-wasi
6 years ago
Jakub Konka
006198eb92
Generate C bindings for all hostcalls
6 years ago
Jakub Konka
e552b19dfe
Add placeholder for cbindgen proc_macro_attribute
6 years ago
afinch7
2563dc53a1
fixed registry leak and literal casts
6 years ago
Dan Gohman
eb1cf8b0a1
Make users of `dec_slice_of` safe.
Make `dec_slice_of` return a slice rather than a pointer-length pair,
freeing its users from having to call the unsafe `slice::from_raw_parts`.
This requires splitting `dec_slice_of` and `dec_ptr` into mut and
non-mut versions, and reorganizing poll_oneoff a little to avoid
borrow-checker errors -- decoded slices do alias the main memory, so
make sure functions only need one or the other.
6 years ago
afinch7
a5fa03abb2
fix for ctz and clz
6 years ago
Jakub Konka
8a68375f89
Move TODO about proc_exit from wasmtime
6 years ago
Jakub Konka
8b09f321ac
Make memory fns safe wherever possible
6 years ago
Jef
680473c50c
Fix param names
6 years ago
Jakub Konka
75ad92b0f3
Insulate API from intricacies of memory mgmt of calling runtimes
6 years ago
Jakub Konka
751a1a1f7b
Add experimental struct with views memory and ctxs
This struct is heavily taking from Lucet's Vmctx struct.
6 years ago
Jakub Konka
8090f8791f
Add stubs for unimplemented hostcalls
6 years ago
Jakub Konka
19a4f00752
Set up CI, add format and test scripts.
Remove unused Cargo dependencies.
6 years ago
Dan Gohman
5e702fa001
Update a comment to refer to WASI.
6 years ago
Jakub Konka
2587fa0145
Port WASI host types
6 years ago
Dan Gohman
8335484870
Update wasm32.rs to name the union fields.
The upstream wasi/core.h header switched from anonymous unions to unions
named `u`. This patch updates wasm32.rs to reflect this, as was done in
wasmtime 5b77f952
.
6 years ago
Jef
30583954eb
Add better debugging tools
6 years ago
Jakub Konka
ce6f9cb165
Changes to compile in lucet
6 years ago
Jakub Konka
cd39c1dfd8
Extract common interface from lucet-wasi
6 years ago
Jef
21cdd55cd2
Fix various panics and miscompilations
6 years ago
Jef
745d9ae162
Implement rem in backend - not every backend will act like x86
6 years ago
Jef
ea1ec9491e
Don't use cmov (no need)
6 years ago
Jef
a2ef962ed7
Fix shift's incorrect register freeing logic
6 years ago
Jef
82e810c8d2
Avoid emitting tests on `select`
6 years ago
Jef
ced654f907
Allow register allocation to fail
6 years ago
Tibor Vass
7eccb2b622
microwasm: fix comment typo for BrIf
Signed-off-by: Tibor Vass <teabee89@gmail.com>
6 years ago
Jef
9bf6d73210
Integrate Lightbeam ( #51 )
* Integrate lightbeam
6 years ago
Jef
762cd3fb32
rustfmt
6 years ago
Jef
a8bb9fd634
Use latest wasmparser instead of fork
6 years ago
bjorn3
3ae7c60b13
Update src/wasmtime.rs
Fix spelling error.
Co-Authored-By: sunfishcode <sunfish@mozilla.com>
6 years ago
Dan Gohman
b2fefe7714
WASI prototype design, implementation, and documentation.
This adds documents describing the WASI Core API, and an implementation in
Wasmtime.
6 years ago
Jef
79f26328d4
Improve efficiency of resetting stack pointer
6 years ago
Jef
652e2fdeec
Fix some places that could have caused panics, update example assembly in readme
6 years ago