Commit graph

2307 commits

Author SHA1 Message Date
Fabian 0c42ea0d1f Custom code generation for leave (C9) 2020-08-30 19:37:15 -05:00
Fabian 837e6ff362 Custom code generation for ret imm (C2) 2020-08-30 19:37:15 -05:00
Fabian c0f1d2a487 Custom code generation for arith al/ax/eax, imm (group [0123][45CD], A8/A9) 2020-08-30 19:37:15 -05:00
Fabian fc954cecea Update libwabt (fix failing decoding of large generated modules) 2020-08-30 19:37:15 -05:00
Fabian 04281702ed Track jit exits to same/different page 2020-08-30 19:37:15 -05:00
Fabian f14e9528d6 Custom code generation for cmovcc (0F40-0F4F) 2020-08-30 19:37:15 -05:00
Fabian aef22e38ad Add missing tracking of jit exit points 2020-08-30 19:37:15 -05:00
Fabian 69b834c8de Move condition function generation into codegen module and use it for cmovcc/setcc 2020-08-30 19:37:15 -05:00
Fabian c9163c2df5 Custom code generation for mov reg, imm (B0-BF) 2020-08-30 19:37:15 -05:00
Ernest Wong dbfa0edc3c Filestorage: Split read() logic into different cases for readability 2020-08-30 19:37:15 -05:00
Ernest Wong 607078f59d Filestorage: Optimise .read to single IndexedDB request for 4k block
Reusing the naming scheme of
sha256sum
sha256sum-0
sha256sum-1
sha256sum-2
etc
but the extra metadata such as total file size and block count are no
longer needed in the first block.
2020-08-30 19:37:15 -05:00
Fabian 2c23ffc2cf Use get_eflags_no_arith over flags[0] (minor performance) 2020-08-30 19:37:15 -05:00
Fabian 2837ccd06b Support for gen_safe_read128 and code generation for MOVDQU (F30F6F) 2020-08-30 19:37:15 -05:00
Fabian 70cc242eb1 Simplify call_interrupt_vector from js 2020-08-30 19:37:15 -05:00
Fabian dca6be2d94 Also generate nop for prefetch instruction 2020-08-30 19:37:15 -05:00
Fabian 440b67eda5 Support for gen_safe_write128 and code generation for MOVAPS/MOVDQA (0F29/660F7F) 2020-08-30 19:37:15 -05:00
Fabian e2ab5eabdd Code generation for missing memory operations (8-bit shifts, shrd, shld, xadd) 2020-08-30 19:37:15 -05:00
Fabian ec846b34d9 Codegen for fpu instructions (misc instructions) (D9_[14], DB_5, DD_5, DF_4) 2020-08-30 19:37:15 -05:00
Fabian 1eab44746b Codegen for fpu instructions (fldcw/fstcw) (D9_5, D9_7) 2020-08-30 19:37:15 -05:00
Fabian fdce557820 Codegen for fpu instructions (memory stores: fst/fstp/fist/fistp) (D9_[23], DB_[23], DD_[23], DF_[237]) 2020-08-30 19:37:15 -05:00
Fabian b11b2725bb Use i64 locals for gen_safe_write64 2020-08-30 19:37:15 -05:00
Fabian 7c99bdae74 Codegen for fpu instructions (memory loads: fld, fild) (D9_0, DB_0, DD_0, DF_5) 2020-08-30 19:37:15 -05:00
Fabian c452c357dd Codegen for fpu instructions (DE group) 2020-08-30 19:37:15 -05:00
Fabian 21caefbffd Codegen for fpu instructions (DC group) 2020-08-30 19:37:15 -05:00
Fabian f797ce10c9 64-bit operations for gen_safe_{read,write,read_write} 2020-08-30 19:37:15 -05:00
Fabian 4c3f8dcde8 Support for i64 locals 2020-08-30 19:37:15 -05:00
Fabian f6718c3ead Fix a few missing local frees 2020-08-30 19:37:15 -05:00
Fabian ec059a9f27 Codegen for fpu instructions (D8 group) 2020-08-30 19:37:15 -05:00
Fabian 66c96bd1b1 Clean up old C code 2020-08-30 19:37:15 -05:00
Fabian 05296b0586 Enable fpu instructions in nasm tests 2020-08-30 19:37:15 -05:00
Fabian bb0e58ace9 More precise emulation of fpu instructions 2020-08-30 19:37:15 -05:00
Fabian a179d2ec7e Reduce default logging in ne2k 2020-08-30 19:37:15 -05:00
Fabian 18cdd2107f Reset fpu state in cpu.reset 2020-08-30 19:37:15 -05:00
Fabian c46d12f921 Allow using libv86-debug.js with v86oxide.wasm 2020-08-30 19:37:15 -05:00
Fabian c20a54a9e4 Don't print full array in assertion (slow) 2020-08-30 19:37:15 -05:00
Ernest Wong e5e1f68244 Fix type error for logging filestorage error 2020-08-30 19:37:15 -05:00
Ernest Wong 4651e28177 Fix type annotations for async functions 2020-08-30 19:37:15 -05:00
Fabian 4827732a4c Make closure compiler happy 2020-08-30 19:37:15 -05:00
Fabian 7e04f313ba Remove unused as_text option 2020-08-30 19:37:15 -05:00
Ernest Wong 1155faae25 Filestorage: Simplify IndexedDBFileStorage#set - remove async 2020-08-30 19:37:15 -05:00
Ernest Wong 602cfe0e3c Filestorage: Fix IndexedDB error logging 2020-08-30 19:37:15 -05:00
Ernest Wong 75bee02ac7 Filestorage: Don't wait before issuing next store.put request 2020-08-30 19:37:15 -05:00
Ernest Wong aadae9242c Filestorage: Clone array views to avoid serializing full array buffer
IndexedDB uses the StructuredSerializeForStorage algorithm to store
records into the database.

It appears that the html5 spec defines the StructuredSerializeForStorage
algorithm in a way that, when we serialize a TypedArray, the associated
ArrayBuffer is also serialized. Meaning even if the TypedArray is a view
of a single byte in the ArrayBuffer, the potentially-megabytes of data
in the ArrayBuffer are also copied over.

This makes sense. After deserialization, you'd expect the TypedArray to
function the same way as before meaning it should have the same
`.byteOffset` and `.buffer` properties.

However, it is easy to overlook this and think that a TypedArray viewing
2 bytes will only have the 2 bytes stored in the database.

This commit fixes a source of crashes. When calling
IndexedDBFileStorage#set() with a 3Mb file, the file is to be stored as
approx 800 lots of 4k blocks. However, in reality, 800 lots of 3 Mb array
buffers are being stored into the database. As the transaction is not
committed until the last request has been placed, I suspect that Chrome was
trying to store those 2.4 Gb worth of data in memory and did not handle
this case properly, leading to out-of-memory.

This commit also fixes a source of poor performance. When calling
IndexedDBFileStorage#read() to read 4k of a 48 Mb file, the browser seems
to be deserializing the entire 48 Mb into memory and garbage collecting
it even though only 4k is needed.
2020-08-30 19:37:15 -05:00
Fabian 47e91de601 Remove has_rand_int, always require get_rand_int to be available 2020-08-30 19:37:15 -05:00
Fabian 0d70c87796 Implement rdrand on Node (for __x86_rdrand) 2020-08-30 19:37:15 -05:00
Fabian bea53fdfb2 Fix profiler build 2020-08-30 19:37:15 -05:00
Fabian 23c5ebdf61 Reduce value of WASM_TABLE_SIZE and incraese JIT_THRESHOLD
Now that WASM_TABLE_SIZE may be capped, we set it slightly below the
limit under which chromium crashes: https://bugs.chromium.org/p/v8/issues/detail?id=8427

JIT_THRESHOLD is also reduced due to two reasons:

- With the lower WASM_TABLE_SIZE, we want to avoid compiling too many
  modules
- It has occasionally been observed that under node, the engine's wasm
  compiler can't catch up with the number of modules we produce, thus
  resulting in 100s of pending compiled modules. This most likely
  happens only under node as we don't render the screen and
  the main loop (based on setImmediate) is faster.
  The new value doesn't seem to exhibit this problem, but we may want to
  increase the threshold further if the problem appears again
2020-08-30 19:37:15 -05:00
Fabian 71093270cd Add stat to track running out of wasm indices 2020-08-30 19:37:15 -05:00
Fabian 0e16983dd3 Handle case when wasm table is full (fixes #35)
Also fix jit_empty_cache when callbacks are pending (fixes #53)

This is also a preparation for setting WASM_TABLE_SIZE to a low value to
work around memory limitations in browsers.
2020-08-30 19:37:15 -05:00
Fabian 3f3446b5dd Update linux-boot benchmark script 2020-08-30 19:37:15 -05:00
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