Fabian
b96e36ddd4
Allow dev tools on electron
2020-08-30 19:37:15 -05:00
Ernest Wong
ad3bf2afe0
Filestorage: Export classes properly to all platforms
2020-08-30 19:37:15 -05:00
Ernest Wong
c928964562
Minor: Tidy quotes and spacing
2020-08-30 19:37:15 -05:00
Ernest Wong
c273741405
Add tests for file storage chunking
2020-08-30 19:37:15 -05:00
Ernest Wong
a841194d28
Filestorage: Reuse IDBObjectStore throughout transaction
...
- More like passing the same reference to it when calling db_get/set.
- In reality, it was still the same store object being accessed, but
this commit improves the coherence of the db_get/set helper methods.
2020-08-30 19:37:15 -05:00
Ernest Wong
bf35f0ab0b
Filestorage: Avoid additional allocation for small files
2020-08-30 19:37:15 -05:00
Ernest Wong
840415a052
Filestorage: (minor) Improve naming can_uncache() -> uncache()
2020-08-30 19:37:15 -05:00
Ernest Wong
d6bfa143ed
Filestorage: Don't rely on errors to select type of storage
2020-08-30 19:37:15 -05:00
Ernest Wong
738edf7b6c
Filestorage: Initialise IndexedDB before constructor
...
Simplifies several checks
2020-08-30 19:37:15 -05:00
Ernest Wong
9db722f71f
Filestorage: Improve usefulness of IndexedDB error messages
2020-08-30 19:37:15 -05:00
Ernest Wong
c625bba498
Filestorage: Implement cache cleanup - avoid memory growth
2020-08-30 19:37:15 -05:00
Ernest Wong
3a74e66b72
Filestorage: Expose load_from_server
2020-08-30 19:37:15 -05:00
Ernest Wong
62c880b415
Filestorage: Integrate chunking and revert unnecessary chunking
...
- Integrate new FileStorage interface with lib/filesystem.js
- Simplify the FileStorage interface with the intention that it only
serves read-only files.
2020-08-30 19:37:15 -05:00
Ernest Wong
afd27597d7
Filestorage: Draft chunking behind new FileStorage interface
2020-08-30 19:37:15 -05:00
Ernest Wong
efa45a3d11
Filestorage: Make filestorage .get .set atomic
...
...by sticking to the same transaction throughout an operation.
2020-08-30 19:37:15 -05:00
Ernest Wong
7cfe865556
Filestorage: Draft chunking behind existing FileStorage interface
2020-08-30 19:37:15 -05:00
Ernest Wong
8b64844d27
Filestorage: Give project-related name for IndexedDB Storage
2020-08-30 19:37:15 -05:00
Ernest Wong
83b283ebbe
Filestorage: Replace the two server classes with a wrapper class
...
Simplifies both the filestorage.js code as well as the starter.js code
that uses these FileStorage classes.
Now, the ServerFileStorageWrapper decorates the other FileStorage
classes by loading from the server when the file is not available.
Moreover, the previous starter.js was incorrectly passing the `baseurl`
parameter (it was passing it when baseurl was not defined nor needed).
2020-08-30 19:37:15 -05:00
Ernest Wong
93d9f6923e
Filestorage: Prevent overlapped reinitialization of IndexedDB
...
Catches cases when IndexDBFileStorage#init is accidentally called in
multiple places.
2020-08-30 19:37:15 -05:00
Ernest Wong
a85dd50169
Filestorage: Improve assert coverage and robustness
...
Checks that sha256sum is also not undefrined nor null.
Avoids ReferenceError when window is not defined e.g. on NodeJS.
2020-08-30 19:37:15 -05:00
Ernest Wong
c2dcb440dd
Filestorage: Refactor fallback and load-from-server
...
Fallback logic is moved to the caller's responsibility.
Empty FileStorages and FileStorages that load from the server are
separated into different classes. This is to avoid faults where the
caller of the constructor forgets to pass in a `baseurl` parameter and
leads to some confusing bug.
2020-08-30 19:37:15 -05:00
Ernest Wong
6a06a7108a
Tidy: file_storage snake case and interface naming convention
2020-08-30 19:37:15 -05:00
Fabian
88f482fae0
Commit temporary workaround
2020-08-30 19:37:15 -05:00
Fabian
608559fa94
Call hlt_loop immediately on an hlt instruction
2020-08-30 19:37:15 -05:00
Fabian
01697a7ebb
Delete some dead code
2020-08-30 19:37:15 -05:00
Fabian
2233b069b3
Mark Bitmap as constructor
2020-08-30 19:37:15 -05:00
Fabian
7720f9a8e6
Print opcode on unimplemented sse instructions
2020-08-30 19:37:15 -05:00
Fabian
400673646f
Remove unused constants
2020-08-30 19:37:15 -05:00
Fabian
58b8c49fb0
Pack memory in state image, reduces memory use during state loading
2020-08-30 19:37:15 -05:00
Fabian
32606a26ac
rtc: Implement alarm interrupt
2020-08-30 19:37:15 -05:00
Amaan Cheval
3eb15d328d
cpu: Update iret for minor fixes from manual
...
Citations for these changes:
https://imgur.com/a/QgNekKL
2020-08-30 19:37:15 -05:00
Amaan Cheval
1d5e0052b4
cpu: Port iret, iret16, iret32 to Rust
2020-08-30 19:37:15 -05:00
Amaan Cheval
8aa06b54e0
cpu: Port switch_cs_real_mode to Rust
2020-08-30 19:37:15 -05:00
Fabian
e5fbbd0f2d
Implement json loading for nodejs
2020-08-30 19:37:15 -05:00
Fabian
d2f86799e9
Simplify load_from_json: Accept json object directly, don't run asynchronously
2020-08-30 19:37:14 -05:00
Fabian
f7c22266c9
initrd/bzimage detection: Ignore case
2020-08-30 19:37:14 -05:00
Fabian
028e131ddb
Rename OnJSONLoaded & small refactor
2020-08-30 19:37:14 -05:00
Fabian
aea2409b1d
Ignore filesystem base when state image is provided
2020-08-30 19:37:14 -05:00
Fabian
af0f153640
Refactor using new filesystem function
2020-08-30 19:37:14 -05:00
Fabian
3f79814e05
Detect initrd/bzimage in 9p filesystem and load before boot
2020-08-30 19:37:14 -05:00
Fabian
e94c30ef6f
Don't wrap text in SyncBuffer
2020-08-30 19:37:14 -05:00
Fabian
9ffbba7bcd
Use bzimage loader for debian-full, remove ugly build script for the 9p boot hard drive image
2020-08-30 19:37:14 -05:00
Fabian
e1c6116a0f
Implement Linux kernel boot protocol, accept bzimage/initrd as boot configuration
2020-08-30 19:37:14 -05:00
Fabian
04d282c298
Firmware port: Pretend to be qemu, implement all indexes used by seabios
2020-08-30 19:37:14 -05:00
Fabian
753fcb25c7
Simplify multiboot buffer during init
2020-08-30 19:37:14 -05:00
Fabian
8d6baff91c
Fix rustfmt
2020-08-30 19:29:54 -05:00
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
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
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
fbdb4a28ea
Remove all uses of "for in"
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
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
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
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
Fabian
32699a3a7e
Clear unused wasm modules earlier
2020-08-30 19:29:54 -05:00
Fabian
c08a99c591
c2rust cleanup: Fix boolean literals
2020-08-30 19:29:54 -05:00
Fabian
cb1348fdc7
c2rust cleanup: Restore hex constants
2020-08-30 19:29:54 -05:00
Fabian
435608d9f0
c2rust cleanup: Remove unused mut
2020-08-30 19:29:54 -05:00
Fabian
05ca01c7de
c2rust cleanup: Remove casts on numeric literals
2020-08-30 19:29:54 -05:00
Fabian
d895985e83
c2rust cleanup: Turn while loops into for loops
2020-08-30 19:29:54 -05:00
Fabian
13f4a33231
task_switch_test_mmx: Fix order of checks
2020-08-30 19:29:54 -05:00
Fabian
7620a7cb84
fpu: Refactor (de-)serialisation of f32/f64/f80, add tests for denormals and nans
2020-08-30 19:29:54 -05:00
Fabian
96b703f87c
Keep track of whether fpu or mmx register has been written recently, store proper register in fx?save
2020-08-30 19:29:54 -05:00
Fabian
818cece40d
Transition from fpu mode on mmx operations
2020-08-30 19:29:54 -05:00
Fabian
e70e9dc4b2
Factor the conversion out of fpu_{load,store}_m80, add tests, fix the denormal number case
2020-08-30 19:29:54 -05:00
Fabian
aa9d5deefc
Warn on task_switch_test with cr4.osfxsr=0
2020-08-30 19:29:54 -05:00
Fabian
1de206da49
Minor: Print cr4 as hex
2020-08-30 19:29:54 -05:00
Fabian
35cd746940
Delete dead code
2020-08-30 19:29:54 -05:00
Fabian
585f720567
Fix sse shifts (shift operand is 64 bit)
2020-08-30 19:29:54 -05:00
Fabian
d37c8295aa
jit: Mask shifts and rotates to 5 bits
2020-08-30 19:29:54 -05:00
Amaan Cheval
68c9fb111c
cleanup: Remove unneeded TODO comments and whitespace
2020-08-30 19:29:54 -05:00
Amaan Cheval
96ef38e901
cpu: Port popa{16,32} to Rust
2020-08-30 19:29:54 -05:00
Amaan Cheval
56ec3be5a4
cpu: Port update_cs_size to Rust
...
The JS version needs to stay too since it can be called by other JS-only functions.
2020-08-30 19:29:54 -05:00
Amaan Cheval
1712d25725
cpu: Port set_cr0 to Rust
2020-08-30 19:29:54 -05:00
Amaan Cheval
b4922dc3b1
cpu: Port cpl_changed to Rust
...
We leave the JS version too, since it's used by several other JS functions
that we aren't porting yet.
2020-08-30 19:29:54 -05:00
Amaan Cheval
a9bb4619ef
cpu: Expand return_on_pagefault macro for cleanup
2020-08-30 19:29:54 -05:00
Amaan Cheval
8e7061eff5
cpu: Port test_privileges_for_io to Rust
2020-08-30 19:29:54 -05:00
Amaan Cheval
3c3c07079f
cleanup: Use tuples and destructuring for more Rustic code
2020-08-30 19:29:54 -05:00
Amaan Cheval
a209e00523
cleanup: Use methods instead of parsing props for SegmentDescriptor
2020-08-30 19:29:54 -05:00
Amaan Cheval
e4ff8faff0
cleanup: s/get_// for method names of SegmentDescriptor
2020-08-30 19:29:54 -05:00
Amaan Cheval
a6e863d3c6
cleanup: Rename SegmentDescriptor's type_attr to access_byte
2020-08-30 19:29:54 -05:00
Amaan Cheval
a8420a6ee1
cleanup: Use methods instead of parsing/storing props for SegmentSelector
2020-08-30 19:29:54 -05:00
Amaan Cheval
e7741c74ca
cleanup: Make SelectorNullOrInvalid an enum
2020-08-30 19:29:54 -05:00
Amaan Cheval
6cc262bdba
cleanup: Use OrPageFault type alias for clarity
2020-08-30 19:29:54 -05:00
Amaan Cheval
8f24d9464b
cpu: Clean Rust lookup_segment_selector/switch_seg using early-exits
2020-08-30 19:29:54 -05:00
Amaan Cheval
880aa5e2d1
cpu: Port lookup_segment_selector and switch_seg to Rust
...
We'll keep the JS versions too, since the Rust and JS versions are incompatible, but both are needed
in their own respect.
2020-08-30 19:29:54 -05:00
Amaan Cheval
3471663d84
Add default profile for Debian (using debian-full Docker image)
2020-08-30 19:29:54 -05:00
Fabian
83febd1376
Remove duplicated constants (TLB_*)
2020-08-30 19:29:54 -05:00
Fabian
bf895ff1b2
profiler: Keep track of fast/slow path for jitted memory access
2020-08-30 19:29:54 -05:00
Fabian
b70a5c081a
Allow fast path for memory reads from pages that contain code
2020-08-30 19:29:54 -05:00
Fabian
fcdda9487e
handle_irqs: Do interrupt flag check from Rust
2020-08-30 19:29:54 -05:00
Fabian
36a46bca80
Remove non-faulting stat
2020-08-30 19:29:54 -05:00
Fabian
22ba923f9a
Track number of module invalidations
2020-08-30 19:29:54 -05:00
Fabian
3cb7f7a0b4
Clean up casts of physical and virtual addresses
2020-08-30 19:29:54 -05:00
Fabian
8919079209
Print current state of has_flat_segmentation
2020-08-30 19:29:54 -05:00
Fabian
62dd6be561
Track missed entry points
2020-08-30 19:29:54 -05:00
Fabian
37c8459392
Clean up c2rust-generated profiler
2020-08-30 19:29:54 -05:00
Awal Garg
54151e2306
jit 0x0FBF
2020-08-30 19:29:54 -05:00
Awal Garg
0377e95c42
jit 0x0FB7
2020-08-30 19:29:54 -05:00
Ernest Wong
c3739fc22a
9p: Disable filename tracking by default
2020-08-30 19:29:54 -05:00
Fabian
1980a96093
popf: Warn on trap flag
2020-08-30 19:29:54 -05:00
Fabian
beaa54feda
popf: Call handle_irqs only if interrupt flag is set from 0 to 1
2020-08-30 19:29:54 -05:00
Fabian
295985e8e0
Remove code section: Only a single buffer is used for generating code
2020-08-30 19:29:54 -05:00
Fabian
41b60d278c
Accept builder in gen_jmp_rel16, simplifying
2020-08-30 19:29:54 -05:00
Fabian
d691b311a2
Simplify some code
2020-08-30 19:29:54 -05:00
Fabian
46f9bc9d00
Remove non-faulting property of instructions (all instructions are non-faulting)
2020-08-30 19:29:54 -05:00
Fabian
fa958d95c3
Fix warnings: Remove unused stuff
2020-08-30 19:29:54 -05:00
Fabian
841b528a04
Remove jit_dirty_cache_single in favour of jit_dirty_page
2020-08-30 19:29:54 -05:00
Fabian
456c4cbe65
mxcsr: Print warning only when bit is flipped & use constants
2020-08-30 19:29:54 -05:00
Fabian
26e6452c2c
Fix mxcsr warning
2020-08-30 19:29:54 -05:00
Fabian
419ddf765a
Remove some functions when profiler is disabled
2020-08-30 19:29:54 -05:00
Fabian
d24972e3b5
{movs,stos}{b,d}: Call jit_dirty_cache once per page
2020-08-30 19:29:54 -05:00
Fabian
f182923bbd
Page table accessed/dirty bits: Only write if necessary
2020-08-30 19:29:54 -05:00
Fabian
0a50a8474e
c2rust cleanup: Remove unnecessary suffixes on numbers
2020-08-30 19:29:54 -05:00
Fabian
b5ed5f7c5b
c2rust cleanup: Remove -> ()
2020-08-30 19:29:54 -05:00
Fabian
cb80830881
c2rust cleanup: Enable mutable_transmutes warnings
2020-08-30 19:29:54 -05:00
Fabian
6b8bf885a2
c2rust cleanup: Enable unused_assignments and unused_variables warnings and fix them
2020-08-30 19:29:54 -05:00
Fabian
fc0fd368c4
c2rust cleanup: Enable unused_unsafe warning and a few warnings
2020-08-30 19:29:54 -05:00
Fabian
015232f466
c2rust cleanup: Remove .offset(0)
2020-08-30 19:29:54 -05:00
Fabian
44bc613af3
c2rust cleanup: Remove dbg_log_c
2020-08-30 19:29:54 -05:00
Fabian
ef796d7f62
c2rust cleanup: Remove fresh variables
2020-08-30 19:29:54 -05:00
Fabian
3a00eedf21
c2rust cleanup: Re-enable some warnings
2020-08-30 19:29:54 -05:00
Fabian
652c4f4322
c2rust cleanup: Remove old makefile
2020-08-30 19:29:54 -05:00
Fabian
d08f5fd460
c2rust cleanup: Fix comments
2020-08-30 19:29:54 -05:00
Fabian
36fede1906
Simplify fpu_set_tag_word
2020-08-30 19:29:54 -05:00
Fabian
2b27510198
sse: Warn on unimplemented mxcsr features
2020-08-30 19:29:54 -05:00
Fabian
221e5489b4
sse: Clean up old cvt instruction
2020-08-30 19:29:54 -05:00
Fabian
d63c956a89
sse: Implement 0F5A/0F5B/CVTT?[SPD][SDQ]2[SPD][SDQ] ( #57 )
2020-08-30 19:29:54 -05:00
Fabian
8ab707dbc2
sse: Implement 0FE6/CVTPD2DQ/CVTTPD2DQ/CVTDQ2PD ( #57 )
2020-08-30 19:29:54 -05:00
Fabian
3ea0089878
sse: Implement 0F2C/0F2D/CVTT[PS][SD]2[SP]I ( #57 )
2020-08-30 19:29:54 -05:00
Fabian
9665dbf994
sse: Implement 0F2E/0F2F/u?comis[sd] ( #57 )
2020-08-30 19:29:54 -05:00
Fabian
8dc066f73d
sse: Expand sse3 instruction
2020-08-30 19:29:54 -05:00
Fabian
cc507db69b
sse: Implement 0FC6/shufp[sd] ( #57 )
2020-08-30 19:29:54 -05:00
Fabian
9e902eb1dc
sse: Implement 0F52/rcpps ( #57 )
2020-08-30 19:29:54 -05:00
Fabian
5dd26ead30
Generate code for memory instructions (0F4*, 0F9*, 0FAF: cmovcc, setcc, imul)
2020-08-30 19:29:54 -05:00
Fabian
de01a4b265
Generate code for memory instructions (F6/F7/FF_{0,1}: test/inc/dec)
2020-08-30 19:29:54 -05:00
Fabian
fa50294b47
Generate code for read-modify-write instructions (C1/D1/D3: Shifts and rotates)
2020-08-30 19:29:54 -05:00
Fabian
33f781e3ba
Set DEBUG to false for release build
2020-08-30 19:29:54 -05:00
Fabian
38a84342a2
Give Rust more indirect function slots and clean up the code
2020-08-30 19:29:54 -05:00
Fabian
3bb3e21962
mxcsr: Warn on 'Denormals Are Zero'
2020-08-30 19:29:54 -05:00
Fabian
b51c6e7c78
imul_reg16: Do sign extension in function
2020-08-30 19:29:54 -05:00
Fabian
8460d9e1e4
Clean up
2020-08-30 19:29:54 -05:00
Fabian
3706bcac12
Use jit for read-modify-write arithmetic instructions
2020-08-30 19:29:54 -05:00
Fabian
0cf700edee
Use cargo features to toggle profiler
2020-08-30 19:29:54 -05:00
Fabian
0680c1a2c4
fpu: Fix out of bounds memory access
2020-08-30 19:29:54 -05:00
Fabian
cfb9cd8abe
Partial custom implementation for arithmethic instructions with read-memory
2020-08-30 19:29:54 -05:00
Fabian
9de2b926a7
Custom implementations for test instruction (only wrapper)
2020-08-30 19:29:54 -05:00
Fabian
9164e0a48f
Custom implementation for 'mov r/m, imm'
2020-08-30 19:29:54 -05:00
Fabian
1d24c5952d
Cleanup of codegen api
2020-08-30 19:29:54 -05:00
Fabian
ca36680d52
PAGE_FAULT is u8
2020-08-30 19:29:54 -05:00
Fabian
b0eff6b951
Implement 8-bit memory accesses
2020-08-30 19:29:54 -05:00
Fabian
71524d1d2c
Use gen_jmp_rel16 for generating jumps in 16-bit mode
2020-08-30 19:29:54 -05:00
Fabian
fbd5e136e1
Temporarily increase JIT_THRESHOLD to account for marking a lot of instructions as block boundary
2020-08-30 19:29:54 -05:00
Fabian
3c903338c3
c2rust cleanup: Call more functions directly
2020-08-30 19:29:54 -05:00
Fabian
75eecd0d63
Multiboot loader: Skip sections outside of memory
2020-08-30 19:29:54 -05:00
Fabian
d4d7d236d5
Make all instructions non-faulting; handle faulting case in gen_safe_{read,write} ( #44 )
2020-08-30 19:29:54 -05:00
Fabian
60d4a28e2c
jit: Custom instructions can be block boundaries
2020-08-30 19:29:54 -05:00
Fabian
dc37bac547
Analysis: Never emit empty basic blocks, track last instruction of basic block
2020-08-30 19:29:54 -05:00
Fabian
92a2ffd4a9
Use .count_ones() over manual implementation for popcnt
2020-08-30 19:29:53 -05:00
Fabian
cd8e47a5c5
Improve hook handler: Print more information
2020-08-30 19:29:53 -05:00
Fabian
c8b3d5a618
Add more information to .expect
2020-08-30 19:29:53 -05:00
Fabian
d9282afec5
Force logging of panic messages
2020-08-30 19:29:53 -05:00
Fabian
8051db8ac6
Access from allocated memory
2020-08-30 19:29:53 -05:00
Fabian
1a96072840
Use u8 for page_fault
2020-08-30 19:29:53 -05:00
Fabian
9c9fc4e0e7
Check imports
2020-08-30 19:29:53 -05:00
Fabian
1b9ad3ac60
Remove useless #[no_mangle]
2020-08-30 19:29:53 -05:00
Fabian
ee3a3d4fe2
Fix statics and constants
2020-08-30 19:29:53 -05:00
Fabian
a2b2a7c5ae
Clean up profiler and static array
2020-08-30 19:29:53 -05:00
Fabian
ebf9cb1750
Remove extern from functions
2020-08-30 19:29:53 -05:00
Fabian
c489463c83
rust2c cleanup: Fix warnings
2020-08-30 19:29:53 -05:00
Fabian
a795accee6
c2rust cleanup: Make global pointers constants
2020-08-30 19:29:53 -05:00
Fabian
4b34beeb79
c2rust cleanup: Use Rust imports instead of linking
2020-08-30 19:29:53 -05:00
Fabian
fbe14a3d98
Disable safe_{read,write} fast path profiling
2020-08-30 19:29:53 -05:00
Fabian
a5cbf53da5
Fix jit in presence of new page fault handling
...
Makes the following a block boundary:
- push
- Any non-custom instruction that uses modrm encoding
- Any sse/fpu instruction
This commit affects performance negatively. In order to fix this, the
above instructions need to be implemented using custom code generators
for the memory access.
2020-08-30 19:29:53 -05:00
Fabian
2c47c85325
Fix format strings
2020-08-30 19:29:53 -05:00
Fabian
25949fff70
Handle page faults in instructions using return_on_pagefault and writable_or_pagefault
2020-08-30 19:29:53 -05:00
Fabian
a88420910d
Handle pagefaults without JS exceptions
...
This commit makes the return type of most basic memory access primitives
Result, where the Err(()) case means a page fault happened, the
instruction should be aborted and execution should continue at the page
fault handler.
The following primites have a Result return type: safe_{read,write}*,
translate_address_*, read_imm*, writable_or_pagefault, get_phys_eip,
modrm_resolve, push*, pop*.
Any instruction needs to handle the page fault cases and abort
execution appropriately. The return_on_pagefault! macro has been
provided to get the same behaviour as the previously used JS exceptions
(local to the function).
Calls from JavaScript abort on a pagefault, except for
writable_or_pagefault, which returns a boolean. JS needs to check
before calling any function that may pagefault.
This commit does not yet pervasively apply return_on_pagefault!, this
will be added in the next commit.
Jitted code does not yet properly handle the new form of page faults,
this will be added in a later commit.
2020-08-30 19:29:53 -05:00
Fabian
11ee22176d
Temporarily disable jit
2020-08-30 19:29:53 -05:00
Fabian
0a68bc9393
Check in generated Rust files
2020-08-30 19:29:53 -05:00
Fabian
48a8b74f20
Restore assertions
2020-08-30 19:29:53 -05:00
Fabian
46f30ea7bc
Preserve most comments
2020-08-30 19:29:53 -05:00
Fabian
07851e90ab
Clean up strings
2020-08-30 19:29:53 -05:00
Fabian
32322e5dc5
Restore code that was lost by c2rust
2020-08-30 19:29:53 -05:00
Fabian
67247ec907
(partially) fix variadic dbg_log
2020-08-30 19:29:53 -05:00
Fabian
5a874933df
Clean up integer/float types
2020-08-30 19:29:53 -05:00
Fabian
a832a74a36
Fix profiler
2020-08-30 19:29:53 -05:00
Fabian
d07cc4f7fa
Fix state images
2020-08-30 19:29:53 -05:00
Fabian
1faf8ccc86
Allocate memory via Rust instead of ahead-of-time
2020-08-30 19:29:53 -05:00
Fabian
952b8cf723
Quote for Closure Compiler and add missing functions for non-optimised builds
2020-08-30 19:29:53 -05:00
Fabian
05d0079015
Use Proxy over getters for memory views (works in compiled mode)
2020-08-30 19:29:53 -05:00
Fabian
01061dc4b6
The final Rust porting
...
This commit contains the final changes requires for porting all C code
to Rust and from emscripten to llvm:
- tools/wasm-patch-indirect-function-table.js: A script that rewrites
the wasm generated by llvm to remove the table limit
- tools/rust-lld-wrapper: A wrapper around rust-lld that removes
arguments forced by rustc that break compilation for us
- src/rust/cpu2/Makefile: A monstrosity to postprocess c2rust's output
- gen/generate_interpreter.js: Ported to produce Rust instead of C
- src/rust/*: A few functions and macros to connect the old Rust code
and the new Rust code
- src/*.js: Removes the loading of the old emscripten wasm module and
adapts imports and exports from emscripten to llvm
2020-08-30 19:29:53 -05:00
Fabian
6de0bb374b
Preparation C code for c2rust conversion
2020-08-30 19:29:53 -05:00
Awal Garg
26fc44a61f
simplify push16,32
2020-08-30 19:29:53 -05:00
Awal Garg
bfc04b80fb
jit E8
2020-08-30 19:29:53 -05:00
Awal Garg
4d7f87c515
avoid local in gen_safe_read_write
2020-08-30 19:29:53 -05:00
Awal Garg
b6aa8efc37
merge push16_ss* and push32_ss* functions
2020-08-30 19:29:53 -05:00
Awal Garg
2f5b1311c6
re-add gen_safe_read_write
2020-08-30 19:29:53 -05:00
Awal Garg
fb9a6e714a
remove unused codegen functions (register related)
2020-08-30 19:29:53 -05:00
Awal Garg
73cbea7d0f
call gen_pop{16,32} instead of using interpreted variants, update expect
...
tests
2020-08-30 19:29:53 -05:00
Awal Garg
be7d21e79f
add gen_push32_ss{16,32}
2020-08-30 19:29:53 -05:00
Awal Garg
5c2ab56b3b
add gen_push16_ss{16,32}
...
This adds the ImmVal enum type too.
2020-08-30 19:29:53 -05:00
Ernest Wong
e29e1ef9f4
Handle unexpected errors from fs.Mount and fix V86Starter error handling.
2020-08-30 19:29:53 -05:00
Ernest Wong
e683e812fd
Mount only onto non-existent paths, existent parent
...
If mountpoint already exists, then we're silently making its children
inaccessible which may not be what we expected/intended.
Create a new forwarder inode upon mounting.
2020-08-30 19:29:53 -05:00
Ernest Wong
23080e2731
Isolate filesystem qid counting to each v86 instance
2020-08-30 19:29:53 -05:00
Ernest Wong
070c38c6a1
Add tests for host-side fs mounting
...
The testing "framework" code is slowly turning into spaghetti due to the
asynchronous nature of the triggers. Using async functions will help
clarify the program flow if we think we should address this issue.
2020-08-30 19:29:53 -05:00
Ernest Wong
9e592dbd84
Decouple 9p and starter from fs's internal structure
...
Part of changes to support fs mounting on the host side.
Inode attributes are generally left untouched as field accesses.
2020-08-30 19:29:53 -05:00
Fabian
5b5a36d258
Fix rustfmt after upgrade
2020-08-30 19:29:53 -05:00
Fabian
551f5d1a1f
When HLT is executed, check for new interrupts immediately and don't leave the main loop if execution can continue
2020-08-30 19:29:53 -05:00
Fabian
ea6e7daee5
Avoid use of raising cpu exceptoins for HLT
2020-08-30 19:29:53 -05:00
Fabian
09072feee3
Warn when restoring memory of incorrect size
2020-08-30 19:29:53 -05:00
Fabian
8998bab05c
Lazy-load wabt/capstone on node
2020-08-30 19:29:53 -05:00
Fabian
33b0084aa5
Stats for global/non-global tlb entries
2020-08-30 19:29:53 -05:00
Fabian
33acb48fb9
Implement cvtsd2si ( #57 )
2020-08-30 19:29:53 -05:00
Fabian
6fa702c8aa
Implement {min,max,div}{p,s}{s,d} sse instructions ( #57 )
2020-08-30 19:29:53 -05:00
Fabian
c10bbca85e
Add sqrt{p,s}{d,s} instructions ( #57 )
2020-08-30 19:29:53 -05:00
Fabian
70ae4b720a
Remove use of raising cpu exceptions for trigger_ud
2020-08-30 19:29:53 -05:00