Fabian
14fd138357
More precise stats for 32-bit addresses
2020-12-31 19:14:29 -06:00
Fabian
8f19c1d1dc
Remove outdated comment
2020-12-31 19:14:29 -06:00
Fabian
3951e5f42b
Use mIPS over kIPS \o/
2020-12-31 19:14:29 -06:00
Fabian
c0fd7051ee
Robustness
2020-12-31 19:14:29 -06:00
Fabian
b5def60fb4
Clean up
2020-12-31 19:14:29 -06:00
Fabian
2396a1b809
Add some sources for the OS images
2020-12-31 19:14:29 -06:00
Fabian
5f38f0ffcf
Remover "Other host"
2020-12-31 19:14:29 -06:00
Fabian
6021ce80b0
images: Load external kolibri image even over https (server previously didn't support https)
2020-12-31 19:14:29 -06:00
Fabian
b5b1cbf7da
Simplify
2020-12-31 19:14:29 -06:00
Fabian
c84a814610
Remove unused A20 stuff
2020-12-31 19:14:29 -06:00
Fabian
d5c9b29942
Upgrade jshint
2020-12-31 19:14:29 -06:00
Fabian
b7e5f28104
Fix rust warning
2020-12-31 19:14:29 -06:00
Fabian
48a9847d16
s/oxide//
2020-12-31 19:14:29 -06:00
Fabian
c97301842e
Put jit_cache_array and jit_page_first_entry into global state, reduces the size of the .wasm files by 8MB because for some reason the rust compiler decides to put them into the data section
2020-12-31 19:14:29 -06:00
Fabian
4bfd024366
Simplify gen_safe_read_write by removing fallback function
2020-12-31 19:14:29 -06:00
Fabian
697bd4c64d
Disambiguate drop
2020-12-31 19:14:29 -06:00
Fabian
941208c948
Remove defunct test coverage
2020-12-31 19:14:29 -06:00
Fabian
cd4977f517
Simplify
2020-12-31 19:14:29 -06:00
Fabian
33e608fa70
fix rust warning
2020-12-31 19:14:29 -06:00
Fabian
9efade88ee
Fix compilation with latest closure compiler
2020-12-31 19:14:29 -06:00
Fabian
1665e9b358
Fix instruction counter wrap-around
2020-12-31 19:14:29 -06:00
Fabian
60adbf9b1f
Fix: Side-effects in lsl/lar/arpl even when #ud is triggered
2020-12-31 19:14:29 -06:00
Fabian
9a38e6a654
nasmtests: Check exception eip
2020-12-31 19:14:29 -06:00
Fabian
f058037006
Fix exception eip in #ud and #gp in jitted code
2020-12-31 19:14:29 -06:00
Fabian
6f366b1277
Refactor: Use gen_set_previous_eip_offset_from_eip_with_low_bits in gen_safe_read_write
2020-12-31 19:14:29 -06:00
Fabian
5515c32e8d
Correct codegen for some undefined fpu instructions
2020-12-31 19:14:29 -06:00
Fabian
48940e426a
Fix fldm80/fstenv/fldenv: These instructions were generating and unconditional exit from jitted code but not updating eip. Changed to use the fallback mechanism for handling pagefaults
2020-12-31 19:14:29 -06:00
Fabian
3f1ba044ed
Increment timestamp_counter before running basic block
2020-12-31 19:14:29 -06:00
Fabian
85e846480f
Assert that TSC changes so that do_many_cycles_native is guaranteed to make progress
2020-12-31 19:14:29 -06:00
Fabian
861aea3157
Add recording serial adapter
2020-12-31 19:14:29 -06:00
Fabian
e2eecc7295
task_switch_test*_jit: assert that jit agrees
2020-12-31 19:14:29 -06:00
Fabian
492a2cf78e
Update previous_ip only if page fault is going to happen
2020-12-31 19:14:29 -06:00
Fabian
0c922cea95
Add config::LOG_PAGE_FAULTS
2020-12-31 19:14:29 -06:00
Fabian
cd0b6ce753
Fix off-by-on in assertion in write_blob/read_blob
2020-12-31 19:14:29 -06:00
Fabian
0d76a7e99a
Correctly set previous_ip before #nm (fixes segfaults in Linux)
2020-12-31 19:14:29 -06:00
Fabian
4e9fa5e783
refactor
2020-12-31 19:14:29 -06:00
Fabian
c47b4b252c
Optimise cr0 access in task_switch_test (only low byte needed)
2020-12-31 19:14:29 -06:00
Fabian
d2c01c31a3
Fix memory dumps
2020-12-31 19:14:29 -06:00
Fabian
5e73b6f21b
Remove invalid assertion on sfence/mfence/lfence (low bits of modrm byte are ignored)
2020-12-31 19:14:29 -06:00
Fabian
1c474eabdb
Fix mov [mem], sreg in 32-bit mode (should be 16-bit write)
2020-12-31 19:14:29 -06:00
Fabian
17f2488684
Fix uses of writable_or_pagefault from JS
2020-12-31 19:14:29 -06:00
Fabian
c207400922
Fix Rust warnings
2020-12-31 19:14:29 -06:00
Fabian
c97600f5cb
Also prepare gen_safe_read{64,128} for later optimisations
2020-12-31 19:14:29 -06:00
Fabian
b23c4a9db2
Optimise pop reg
2020-12-31 19:14:29 -06:00
Fabian
c5cd93678e
Pass local to gen_safe_read, add single function for modrm_resolve and gen_safe_read (preparation for later optimisations)
2020-12-31 19:14:29 -06:00
Fabian
aad8072aa7
Optimise push reg
2020-12-31 19:14:28 -06:00
Fabian
f620aceb5d
Use LocalOrImmediate for other arithmetic instructions
2020-12-31 19:14:28 -06:00
Fabian
43fcdf9fc2
Introduce LocalOrImmediate for more efficient parameter passing to cmp/test instructions
2020-12-31 19:14:28 -06:00
Fabian
1fa0430cb5
Remove unused macro rules
2020-12-31 19:14:28 -06:00
Fabian
bc3c73a607
wasm state machine: Fallthrough
2020-12-31 19:14:28 -06:00
Fabian
1278672998
Split modrm stat into reg_with_offset and complex
2020-12-31 19:14:28 -06:00
Fabian
1de8fe1888
Fix unnecessary push to stack
2020-12-31 19:14:28 -06:00
Fabian
f98f423d1b
Comment
2020-12-31 19:14:28 -06:00
Fabian
78ef12be68
Custom implementations for several sse instructions
...
- mov dword/qword [mem], xmm
- mov xmm, dword/qword [mem]
- some arithmetic
2020-12-31 19:14:28 -06:00
Fabian
4619d4dd6d
Add info to assertion
2020-12-31 19:14:28 -06:00
Fabian
63afa77167
Global pointers: Align general purpose registers, sse registers and flags
2020-12-31 19:14:28 -06:00
Fabian
e99da40215
Make std/cld custom (FC/FD), remove unused unguarded_register and no_register properties from x86 table
2020-12-31 19:14:28 -06:00
Fabian
0263764a5c
Remove unused unguarded_register property during analysis
2020-12-31 19:14:28 -06:00
Fabian
0e8c8a1dda
More opstats
2020-12-31 19:14:28 -06:00
Fabian
d98e1b2f70
Generate code (instead of call) for 32-bit arithmetic operations
2020-12-31 19:14:28 -06:00
Fabian
970739f60b
Generate custom code for getzf/getcf/test_be
2020-12-31 19:14:28 -06:00
Fabian
e0473dae18
profiler: Count generated simple/complex modrm address expressions
2020-12-31 19:14:28 -06:00
Fabian
5da6cde13f
Custom codegen for cbw/cwde/cwd/cdq/pushf/sahf (98/99/9C/9E)
2020-12-31 19:14:28 -06:00
Fabian
701d59e0dd
Custom codegen for absolute cli (FA)
2020-12-31 19:14:28 -06:00
Fabian
ff64866e25
Custom codegen for absolute cmpxchg (0FB1)
2020-12-31 19:14:28 -06:00
Fabian
b5a72061fb
Custom codegen for absolute jmp/call (FF_2/FF_4)
2020-12-31 19:14:28 -06:00
Fabian
fb7e4d376a
Custom codegen for lfence (0FAE_5)
2020-12-31 19:14:28 -06:00
Fabian
b240a8fde9
Custom codegen for push sreg (06/0E/16/1E/0FA0/0FA8)
2020-12-31 19:14:28 -06:00
Fabian
a9dac09ceb
Custom codegen for xchg (91-98)
2020-12-31 19:14:28 -06:00
Fabian
091b2324d9
Custom codegen for 8C
2020-12-31 19:14:28 -06:00
Fabian
c04ca292b9
Run latest rustfmt
2020-12-31 19:14:28 -06:00
Fabian
93ffd50969
Custom codegen for more sse move aliases (660F29/660F6F/F30F7F)
2020-08-30 19:37:15 -05:00
Fabian
75e5c2a56f
Codegen for 8-bit shifts (D0/D2)
2020-08-30 19:37:15 -05:00
Fabian
815e5d338e
Codegen more fpu instructions and run their tests (D9_6, DA_5)
2020-08-30 19:37:15 -05:00
Fabian
fdd1dc377d
Custom codegen for xadd (0FC1)
2020-08-30 19:37:15 -05:00
Fabian
874818866a
Codegen for mul32 + custom mul/imul (F7_[45])
2020-08-30 19:37:15 -05:00
Fabian
2a3e4bfa86
Minor: Remove unused
2020-08-30 19:37:15 -05:00
Fabian
1f74ee534c
Simplify cmpxchg using SAFE_READ_WRITE macro
2020-08-30 19:37:15 -05:00
Fabian
c086c710ad
Stat: Count duplicate entries
2020-08-30 19:37:15 -05:00
Fabian
0d938fb3da
Minor: Flatten pattern match
2020-08-30 19:37:15 -05:00
Fabian
f22325ecf4
Minor: Use hex constant
2020-08-30 19:37:15 -05:00
Fabian
b774db3f81
Fix: Clear prefixes when leaving instruction early
2020-08-30 19:37:15 -05:00
Fabian
ac9ef7d447
gen_pop/gen_push: Avoid some unnecessary locals after registers-in-locals
2020-08-30 19:37:15 -05:00
Fabian
ce10336747
Minor: Remove unused functions
2020-08-30 19:37:15 -05:00
Fabian
447307c27f
Minor: Remove unnecessary parens
2020-08-30 19:37:15 -05:00
Fabian
7c4ed66c20
Cleanup: Rename trigger_gp_non_raising to trigger_gp
2020-08-30 19:37:15 -05:00
Fabian
158bb75fec
FPU: Implement zero divide fault
2020-08-30 19:37:15 -05:00
Fabian
0269e9cecf
Fix fxtract
2020-08-30 19:37:15 -05:00
Fabian
724090b319
Reduce code size by removing register restoring around safe_{read,write}*_jit
2020-08-30 19:37:15 -05:00
Fabian
723f78c14f
Reduce code size by creating a block to jump to that handles the page fault case
2020-08-30 19:37:15 -05:00
Fabian
799171ba03
Refactor do_page_translation into do_page_walk which does the page walk without calling in case of a fault
2020-08-30 19:37:15 -05:00
Fabian
7024207fa4
Codegen for inc/dec (group 40-4F)
2020-08-30 19:37:15 -05:00
Fabian
a8308b988d
Store registers in locals
...
This changes registers to be temporarily stored in wasm locals, across
each complete wasm module. Registers are moved from memory to locals
upon entering the wasm module and moved from locals to memory upon
leaving. Additionally, calls to functions that modify registers are
wrapped between moving registers to memory before and moving back to
locals after. This affects:
1. All non-custom instructions
2. safe_{read,write}_slow, since it may page fault (the slow path of all memory accesses)
3. task_switch_test* and trigger_ud
4. All block boundaries
5. The fallback functions of gen_safe_read_write (read-modify-write memory accesses)
The performance benefits are currently mostly eaten up by 1. and 4. (if
one calculates the total number of read/writes to registers in memory,
they are higher after this patch, as each instructions of typ 1. or 4.
requires moving all 8 register twice). This can be improved later by the
relatively mechanical work of making instructions custom (not
necessarily full code generation, only the part of the instruction where
registers are accessed). Multi-page wasm module generation will
significantly reduce the number of type 4. instructions.
Due to 2., the overall code size has significantly increased. This case
(the slow path of memory access) is often generated but rarely executed.
These moves can be removed in a later patch by a different scheme for
safe_{read,write}_slow, which has been left out of this patch for
simplicity of reviewing.
This also simplifies our code generation for storing registers, as
instructions_body.const_i32(register_offset);
// some computations ...
instruction_body.store_i32();
turns into:
// some computations ...
write_register(register_index);
I.e., a prefix is not necessary anymore as locals are indexed directly.
Further patches will allow getting rid of some temporary locals, as
registers now can be used directly.
2020-08-30 19:37:15 -05:00
Fabian
56dc1af7cc
Split SAFE_WRITE stat into WRITE and READ_WRITE
2020-08-30 19:37:15 -05:00
Fabian
8838e263c3
Profiler: Track number of page faults and wasm bytes generated
2020-08-30 19:37:15 -05:00
Fabian
ed5ecda0ae
Custom implementation for pop [mem] (preparation for registers-in-locals)
2020-08-30 19:37:15 -05:00
Fabian
730919e317
Use gen_trigger_ud for invalid LEA encodings
2020-08-30 19:37:15 -05:00
Fabian
f5540d9edf
Use pop16_reg_jit for pop esp
2020-08-30 19:37:15 -05:00
Fabian
32f988a08d
Pass JitContext to gen_get_reg* (preparation for registers-in-locals)
2020-08-30 19:37:15 -05:00
Fabian
4d35564761
Simplify get_seg: Generate code inline, avoid importing it in every module
2020-08-30 19:37:15 -05:00