Commit graph

2,730 commits

Author SHA1 Message Date
Fabian
cb0ca91f58 Resolve some internal imports directly 2020-08-30 19:29:54 -05:00
Fabian
57b51d440d nodejs: Prefer perf_hooks module over custom shim for performance.now 2020-08-30 19:29:54 -05:00
Fabian
2ee68c960a Make --strip-debug configurable (for release builds) 2020-08-30 19:29:54 -05:00
Fabian
53bd41614f Fix minor problem with Rust port of call_interrupt_vector 2020-08-30 19:29:54 -05:00
Fabian
7796d9dcb4 Clean up wasm loading, remove unused code for emscripten 2020-08-30 19:29:54 -05:00
Fabian
618062299d Remove emscripten from docker test image 2020-08-30 19:29:54 -05:00
Fabian
5bcee471ca Remove old C code 2020-08-30 19:29:54 -05:00
Fabian
b83ed1b7c1 Minor 2020-08-30 19:29:54 -05:00
Fabian
dd929f52c5 9p: Add create event, add file name to the read event 2020-08-30 19:29:54 -05:00
Fabian
fbdb4a28ea Remove all uses of "for in" 2020-08-30 19:29:54 -05:00
Fabian
3b86889a99 Throw proper error 2020-08-30 19:29:54 -05:00
Fabian
a39d58d4e5 ne2k: Fix transfer of empty packet and start page after wrap-around 2020-08-30 19:29:54 -05:00
Fabian
28a6f1a84a Add pit.dump 2020-08-30 19:29:54 -05:00
Fabian
efea556a10 Implement NetworkAdapter.change_proxy 2020-08-30 19:29:54 -05:00
Ernest Wong
44d54facb7 Filesystem: Remove remnants of file loader 2020-08-30 19:29:54 -05:00
Ernest Wong
c1729b7daf Filesystem: Don't modify local copy of filedata after set_data
While the original code would've worked for MemoryFileStorage, it will
not work for FileStorages that clone the data before saving (e.g.
IndexedDBFileStorage) as local changes won't be reflected onto the
storage class.
2020-08-30 19:29:54 -05:00
Ernest Wong
6fe226eec9 Filestorage: Reuse write-to-indexeddb logic 2020-08-30 19:29:54 -05:00
Ernest Wong
27a825dce3 Filestorage: Preserve key names when writing into indexeddb 2020-08-30 19:29:54 -05:00
Ernest Wong
a0c984dc8d Filesystem: Introduce IndexedDBFileStorage
Uses MemoryFileStorage as a fallback when:
- v86 is used in a browserless environment, e.g. NodeJS
- browser doesn't support indexedDB
- opening indexedDB fails
- existing database is a newer version
- existing database is an old version and is under use - blocking
current v86 instance to connect to it.
2020-08-30 19:29:54 -05:00
Ernest Wong
0a67e3532f Filesystem: Introduce FileStorage class for server-loaded files 2020-08-30 19:29:54 -05:00
Ernest Wong
595d6dca55 Filesystem: Refactor inodedata accesses to async methods
The "// jshint ignore:line" comments are pretty messy, so squint your eyes.
They're systematically placed, so we can regex it out when jshint's
new version finally arrives.

Using async/await instead of callbacks due to callback hell, and it also
helps minimising the diff)
2020-08-30 19:29:54 -05:00
Ernest Wong
1a6f3cfef3 Compile from and to ECMASCRIPT_2017
- Want to use async/await features.
- We need modern web browsers to run Web Assembly anyway.
2020-08-30 19:29:54 -05:00
Amaan Cheval
b6b55e5644 cpu: Refactor get_tss_stack_addr to simplify things 2020-08-30 19:29:54 -05:00
Amaan Cheval
0bf4e4faf6 cpu: Port get_tss_stack_addr to Rust 2020-08-30 19:29:54 -05:00
Amaan Cheval
de8411f184 Minor: Inline has_error_code 2020-08-30 19:29:54 -05:00
Amaan Cheval
3b94c5f9d3 cpu: Refactor to use error_code: Option<i32> for call_interrupt_vector 2020-08-30 19:29:54 -05:00
Amaan Cheval
ce090cfb4e cpu: Inline into InterruptDescriptor and clean call_interrupt_vector 2020-08-30 19:29:54 -05:00
Amaan Cheval
f7f0f64f84 cpu: Use of_<T> functions to init descriptor and selector structs 2020-08-30 19:29:54 -05:00
Amaan Cheval
ae70cb7e4f cpu: Minor refactor in call_interrupt_vector 2020-08-30 19:29:54 -05:00
Amaan Cheval
8ba3de34c1 cpu: Check for reserved zeros in interrupt descriptor
This lets us make our gate type validity check more readable
2020-08-30 19:29:54 -05:00
Amaan Cheval
aa789d4129 cpu: Follow call_interrupt_vector's specification more closely 2020-08-30 19:29:54 -05:00
Amaan Cheval
4ef09445e1 cpu: Port call_interrupt_vector to Rust 2020-08-30 19:29:54 -05:00
Fabian
48e6843a87 Remove S_ prefix from profiler 2020-08-30 19:29:54 -05:00
Fabian
5b2aa69777 Use CachedStateFlags type in former C code 2020-08-30 19:29:54 -05:00
Fabian
18b2a0883a Remove same_page, use Page::page_of 2020-08-30 19:29:54 -05:00
Fabian
0798a0b40e Don't create unnecessary entry points
This commit prevents creation of entry points for jumps within the same
page. In interpreted mode, execution is continued on these kinds of
jumps.

Since this prevents the old hotness detection from working efficiently,
hotness detection has also been changed to work based on instruction
counters, and is such more precise (longer basic blocks are compiled
earlier).

This also breaks the old detection loop safety mechanism and causes
Linux to sometimes loop forever on "calibrating delay loop", so
JIT_ALWAYS_USE_LOOP_SAFETY has been set to 1.
2020-08-30 19:29:54 -05:00
Fabian
afcce9b371 Record compiled instructions per opcode 2020-08-30 19:29:54 -05:00
Fabian
7e1d398e05 Track last executed jump instruction, check for missed entry points while looking for compiled code 2020-08-30 19:29:54 -05:00
Fabian
7e3f1ad401 gen_fn: Accept wasm builder, not jit context 2020-08-30 19:29:54 -05:00
Amaan Cheval
20d22a0bc0 loader.js: Try to carry on even if some scripts fail to load
For eg. some BUILD_FILES are optional - the order doesn't really matter, so we ought to keep loading
whatever we can (i.e. if we don't have Capstone, we should still be able to load
libwabt).

Note: Even without this change, v86 would have kept trying to load and run, ignoring any 404s; this
change just makes it likelier that we'll ignore ignorable errors.
2020-08-30 19:29:54 -05:00
Fabian
8447b6bb83 Fix prefixes in jitted code: Reset after exception 2020-08-30 19:29:54 -05:00
Fabian
5eaece7743 jit memory moves with immediate address (A0/A1/A2/A3) 2020-08-30 19:29:54 -05:00
Fabian
3f9b32cdd8 Improve stats for run_interpreted 2020-08-30 19:29:54 -05:00
Fabian
8de547455e jit memory access for imul 2020-08-30 19:29:54 -05:00
Fabian
b0f3fd88c4 report_safe_{read,write}_jit_slow: not_user can happen (it just doesn't happen very often) 2020-08-30 19:29:54 -05:00
Fabian
6a2cd6419d jit memory access for 8-bit read-modify-write operations with immediate 2020-08-30 19:29:54 -05:00
Fabian
2635ed71b4 jit memory access for 8-bit read-modify-write operations 2020-08-30 19:29:54 -05:00
Fabian
b98ff1612a Make profiler stat counters u64 2020-08-30 19:29:54 -05:00
Fabian
014e745810 Clean up dead code from old exceptions 2020-08-30 19:29:54 -05:00
Fabian
7d0521475a Store fxsave_store_fpu_mask in state 2020-08-30 19:29:54 -05:00