Commit graph

240 commits

Author SHA1 Message Date
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 ae241fac7b Replace todo() by undefined_instruction() 2020-08-30 19:29:53 -05:00
Fabian 5e82bc0e00 Remove use of cpu exceptions for trigger_ss (partially including switch_seg) 2020-08-30 19:29:53 -05:00
Fabian 3a8d644d75 Port jit to Rust
The following files and functions were ported:
- jit.c
- codegen.c
- _jit functions in instructions*.c and misc_instr.c
- generate_{analyzer,jit}.js (produces Rust code)
- jit_* from cpu.c

And the following data structures:
- hot_code_addresses
- wasm_table_index_free_list
- entry_points
- jit_cache_array
- page_first_jit_cache_entry

Other miscellaneous changes:
- Page is an abstract type
- Addresses, locals and bitflags are unsigned
- Make the number of entry points a growable type
- Avoid use of global state wherever possible
- Delete string packing
- Make CachedStateFlags abstract
- Make AnalysisType product type
- Make BasicBlockType product type
- Restore opcode assertion
- Set opt-level=2 in debug mode (for test performance)
- Delete JIT_ALWAYS instrumentation (now possible via api)
- Refactor generate_analyzer.js
- Refactor generate_jit.js
2020-08-30 19:29:13 -05:00
Awal Garg e33cc8f072 rust restructuring, some refactoring 2020-08-30 19:27:07 -05:00
Awal Garg ca2486391a remove unused bindings 2020-08-30 19:27:07 -05:00
Awal Garg eb322bcddf rename get_cs 2020-08-30 19:27:07 -05:00
Awal Garg 43832da920 remove unused binding 2020-08-30 19:27:07 -05:00
Awal Garg 7be3803590 add wg_ prefix to rust exports 2020-08-30 19:27:07 -05:00
Awal Garg 345f979287 use a sane number of pages in wasmgen memory 2020-08-30 19:27:07 -05:00
Awal Garg 95a65153f4 fix commit_instruction_body_to_cs 2020-08-30 19:27:07 -05:00
Awal Garg 03f0da9525 use wg_ prefix for wasmgen, add tests to makefile 2020-08-30 19:27:07 -05:00
Awal Garg 6251730fee added wasmgen init changes 2020-08-30 19:27:07 -05:00
Fabian 9964040583 Register memory before calling constructor
As the constructor might call wasm code, which in turn uses memory to
pass strings
2020-08-30 19:27:07 -05:00
Fabian d374afb72e Add memcpy 2020-08-30 19:27:07 -05:00
Fabian 2e7e6d206a Delete old block linking infrastructure 2020-08-30 19:27:07 -05:00
Amaan Cheval 3641bc3b87 codegen: Make SCALE_INDEX_FOR_ARRAY32 more specific and revert
This reverts commit b830fe8d7acb0f83c3c8a0febd7e172927ae2f46 and makes
the macro more specific
2020-08-30 19:27:07 -05:00
Amaan Cheval 96c095d381 codegen: Get rid of scale_by parameter and use log2(sizeof(arr[0])) 2020-08-30 19:27:07 -05:00
Fabian c59da991b8 First load 9p filesystem, then restore 2020-08-30 19:27:02 -05:00
Fabian 0ac3829778 Add missing wasm imports: llvm_round_f64 and llvm_trunc_f64 2020-08-30 19:27:02 -05:00
Fabian 2fd4e50c93 Keep track of cached code entries per page
- Use this data structure to delete cached code immediately when page is
  written, not later when wasm index is reused
- Remove "dirty page" data structure
- Simplify cycle_internal, as no entries can be found dirty, they are
  removed immediately after being overwritten
2020-08-30 19:27:02 -05:00
Fabian f8349af093 New block analysis, generation of state machine with multiple basic blocks
This commit consists of three components:

1. A new generated x86-parser that analyses instructions. For now, it
   only detects the control flow of an instruction: Whether it is a
   (conditional) jump, a normal instruction or a basic block boundary
2. A new function, jit_find_basic_blocks, that finds and connects basic
   blocks using 1. It loosely finds all basic blocks making up a function,
   i.e. it doesn't follow call or return instructions (but it does follow
   all near jumps). Different from our previous analysis, it also finds
   basic blocks in the strict sense that no basic block contains a jump
   into the middle of another basic block
3. A new code-generating function, jit_generate, that takes the output
   of 2 as input. It generates a state machine:
   - Each basic block becomes a case block in a switch-table
   - Each basic block ends with setting a state variable for the following basic block
   - The switch-table is inside a while(true) loop, which is terminated
     by return statements in basic blocks which are leaves

Additionally:
- Block linking has been removed as it is (mostly) obsoleted by these
  changes. It may later be reactived for call instructions
- The code generator API has been extended to generate the code for the state machine
- The iterations of the state machine are limited in order to avoid
  infinite loops that can't be interrupted
2020-07-21 20:10:14 -05:00
Amaan Cheval 371ed40c82 log: Remove obsoleted dbg_log and dbg_assert imports 2020-07-21 20:10:14 -05:00
Amaan Cheval d79f084f1d memory/cpu: Have safe_write128 use write128 and mmap_write128
According to Fabian: safe_write128 is called suprisingly often as it is used by
Linux to fill the frame buffer. We can do two optimisations here: Add write128
to avoid one in_mapped_range check. Add mmap_write128 (taking 4 32-bit integers)
to avoid several switches from wasm to js and lookups of
memory_map_write32[aligned_addr]
(we can assume that writes don't cross a 16-byte boundary)
2020-07-21 20:10:14 -05:00
Fabian caf3a9e1f3 Implement asynchronous compilation of wasm modules
Add a callback after codegen_finalize to create entry. Mark entries as
pending while they compile
2020-07-21 20:10:14 -05:00
Fabian 7939cfb8a8 Simplify jit_generate and codegen_finalize
- Don't pass the old entry to jit_generate, instead look it up in
  create_cache_entry (negligible performance overhead)
- Don't call the generated code immediate, this is a pre-requisite for
  asynchronous compilation. This also required disabling the
  self-modifying code assertion
- Don't pass codegen_finalize the start address to codegen_finalize,
  instead set it in jit_generate
2020-07-21 20:10:14 -05:00
Fabian bdc6f53099 Port full_clear_tlb and invlpg to C, fix clear_tlb 2020-07-21 20:10:14 -05:00
Fabian f5938caa5a Link blocks for conditional jumps 2020-07-21 20:10:14 -05:00
Fabian 3cee397d0e Port jcxz, loop* to C 2020-07-21 20:10:13 -05:00
Fabian f53aba84b5 Linking compiled blocks 2020-07-21 20:10:13 -05:00
Fabian 26bb7c2caa Allocate more space for codegen buffers 2020-07-21 20:10:13 -05:00
Fabian 6c107abc28 Log uncompiled assembly 2020-07-21 20:10:13 -05:00
Fabian 69c27f1a44 Warn when initial_state is passed as state 2020-07-21 20:10:13 -05:00
Fabian 27b0ab71b1 Pass Date.now directly 2020-07-21 20:10:13 -05:00
Fabian fcfcc76034 Delete more JavaScript 2020-07-21 20:10:13 -05:00
Fabian f7bac07b10 Improve performance of microtick 2020-07-21 20:10:13 -05:00
Amaan Cheval 538a2cb64c Major refactor for coverage logger
- Moved all helper functions to coverage.js
- Refactor individual cov_*[func_id] objects to coverage[func_id].*
- Write coverage data to its own directory (./build/coverage/coverage_data*)
- Enable/disable coverage logging in do_many_cycles to account for exceptions
- Better naming
- Minor stylistic refactoring
2020-07-21 20:10:13 -05:00
Amaan Cheval 1a7172feab Helper functions for logging coverage
Notes:

- The coverage_dump_loop doesn't really help much, but it helps keep the memory
usage a bit down for longer running tests (eg. booting Linux) - Linux still
slows down too much and can't callibrate its time to boot
- Dumping the incoming data without structuring by file results in very large
files (~150-300 mb for the nasm tests). Structuring by fn_id/fn_name slows
execution down, but allows for more manageable coverage data
- Buffering data in memory and writing to disk synchronously is faster / about
the same speed as async or buffering + async IO.
2020-07-21 20:10:13 -05:00
Fabian 1faec0e669 Remove math_pow, move declarations from shared.h to cpu.h 2020-07-21 20:10:13 -05:00
Fabian 5c2eb24832 Port writable_or_pagefault, do_page_translation and trigger_pagefault to C 2020-07-21 20:10:13 -05:00
Fabian 9ad9693cdd Port fpu to C 2020-07-21 20:10:13 -05:00
Awal Garg 8222d2e6e0 Squash
restore memcpy comment
delete all the things!
fix jshint issues
restore memcpy comment
remove duplicate fxsave assignment
Count cache drops
Use already available physical address instead of calling read_imm8
Remove useless assertion
Just move around to reduce later diff
Run jit paging test with assertions enabled
Run jit-paging test on CI
Extend jit-paging test
Fix deleting invalidated code across memory pages
Add jit-paging test to gitlab ci
Remove jit_in_progress
Clean up old comments, use bool for jit_jump
Fix state image not begin garbage collected
Add ENABLE_PROFILER_TIMES to configure slow profiling times
Move to jit_generate and jit_run_interpreted to separate function
Add missing struct field
Fix: Don't write jit cache entry until no more faults can happen
Download image for jit paging test
Add missing initialiser
Mark jit_{generate,run_interpreted} as static
Specify full path to profiler.h
Clean up duplicate/missing declaration after rebase
mmap error handling, line length and fix some warnings
remove further unused code
move js imports to single header file
2020-07-21 20:10:13 -05:00
Fabian 5e21d68d83 Clean up 2020-07-21 20:10:13 -05:00
Fabian d410f567a7 Temp: Amaan's improvements 2020-07-21 20:10:13 -05:00
Fabian 2a2f898a2a Generate jit, integrated it with the code generator and main loop, and enable it 2020-07-21 20:10:13 -05:00
Fabian f3f6c7801b Improve failing assertion message from C 2020-07-21 20:10:13 -05:00
Amaan Cheval 7ed2fcaf4f Clear cached function from wasm Table when we know for sure an index is dirty 2020-07-21 20:10:13 -05:00
Amaan Cheval 6dfda6f4a8 Add helper jit_store_func
The function fetches a buffer from the code-gen, compiles it, and stores it into
the WASM Table at a specific index
2020-07-21 20:10:13 -05:00
Amaan Cheval b4f5e59d17 Remove Closure Compiler hack for wm.exports functions 2020-07-21 20:10:13 -05:00
Amaan Cheval d83be46a46 Rename wm.mem -> wm.memory and wm.funcs -> wm.exports 2020-07-21 20:10:13 -05:00
Amaan Cheval c8cfffc880 Use emulator options' memory_size to determine size of wasm buffer, allowing for
dynamically sized emulator memory sizes.

Note: This may not always work due to browser limitations.
2020-07-21 20:10:13 -05:00
Amaan Cheval 8b5dd87671 Refactor load_wasm to make most v86-specifics external parameters and use dylink
section to determine memory and table sizes, and bases
2020-07-21 20:10:13 -05:00
Awal Garg fd7aed1821 disable resolve_modrm patch 2020-07-21 20:10:12 -05:00
Fabian 975a06269e Squash
2e469796 Minor
fab422ef Improve generation of 0f instructions
08ad7fe9 Improved if-else generation
3f81014d Minor: Align test output
4a3a84ef Generate modrm tests
61aa1875 Simplify
a6e47954 Generate decoding of immediate operands
435b2c10 Fix warnings
e4933042 Add missing immediate operand
3f3810c7 Generate immediate operands for instructions with modrm byte
a0aa7b1f Make memory layout in nasm tests clearer
6b8ef212 Remove 'g' property from instruction table (implied by 'e')
bf15c58c Remove unused declarations
1e543035 Remove useless `| 0` and `>>> 0` javascriptisms
1ccc5d53 Fix headers
8b40c532 Update qemu tests with changes from qemu
ec9b0fb5 Port xchg instructions to C
c73613e7 Port virt_boundary_* to C
d61d1241 Add headers
fd19f22c Make written value in write8 and write16 int32_t
497dcaec Generate read_imm for instructions with a modrm byte
8b7003d6 Generate read_imm8s
0cc75498 Remove read_op
9d716086 Trigger unimplemented_sse for partial sse instructions with prefix
8d5edd03 Remove unimplmented sse c-to-js hack
585d3565 Remove | 0
308124b2 Use int32_t as return value
f193f8e1 Use JS version of cvttsd2si for now
12747b97 Generate trigger_ud for missing modrm branches
770f674e Split 0f00 and 0f01 into multiple instructions depending on modrm bits
1cb372a3 Generate decoder for some 0f-prefix instructions
cec7bc63 Disable unused parameter warnings in instruction functions
807665b1 Generate read_imm for 0f/jmpcc
cdf6eccc Generate modrm decoding for shld
04528429 Create temporary files in /tmp/, not cwd
d8f3fbd8 Generate modrm/imm decoding for shld
00ef0942 Generate modrm decoding for bts
f531984b Generate modrm decoding for shrd and imul
07569c53 Generate modrm decoding cmpxchg
535ff190 Generate modrm decoding for lfs/lgs/lss
2f8ced8d Generate modrm decoding for btr and btc
95de6c66 Generate modrm decoding for movzx
c4d07e7e Generate modrm decoding for bsf and bsr
f0985d26 Generate modrm decoding for movsx
4b30937a Generate modrm decoding for xadd
a422eb27 Generate modrm decoding for movnti
e5501d3c Generate modrm decoding for mov to/from control/debug registers
bce11ec5 Generate modrm decoding for lar/lsl
5729a23c Fix access to DR4 and DR5 when cr4.DE is clear
44269a81 Specify immediate size explicitly instead of inferring it
82b2867a Fix STR instruction
98a9cc89 Log failing assertion
6d2f9964 Fix rdtsc
00260694 Log GP exceptions
7916883d Port trigger_ud and trigger_nm to C
36fedae9 Remove unused code
e08fabd0 Generate modrm decoding for 0f00 and 0f01
8ae8174d Generate modrm decoding for 0fae and 0fc7 (fxsave, cmpxchg8, etc.)
26168164 Generate modrm+immediate decoding for 0fba (bit test with immediate operand)
6adf7fa7 Simplify create_tests.js (unused prefix call)
c77cbdd8 Add comments about the implementation of pop [addr]
4640b4fe Simplify prefix call
a81a5497 Don't use var
3ca5d13d Separate call name and arguments in code generator
3191a543 Simplify other prefix call (8D/lea)
5185080e Update generated code (stylistic changes and #ud generation)
93b51d41 Remove unused wasm externals
e4af0a7f Avoid hardcoding special cases in code generator (lea, pop r/m)
654a2b49 Avoid hardcoding special cases in code generator (enter/jumpf/callf)
fd1a1e86 Commit generated code (only stylistic changes)
7310fd1a Simplify code generator by merging code for with and without 0f prefix
e7eae4af Simplify code generator by merging code for immediate operands
00fafd8a Improve assertions
db084e49 Simplify code generator (modrm if-else)
0a0e4c9e Improve code generation of switch-case
ce292795 Clarify some comments
37cf33fa Generate code in if/else blocks
cbcc33fc Document naming scheme
e30b97eb Generate modrm decoding for 0f12 (sse) instruction
24b72c2f movlpd cannot be used for register-to-register moves
72d72995 Generate modrm decoding for 0f13 (sse) instruction and disable register-to-register moving
75d76fbb Generate modrm decoding for 0f14 (sse) instruction
ac8965a7 Generate modrm decoding for 0f28-0f2b (movap, movntp)
e919d33e Generate modrm decoding for cvttsd2si
5f2ca2b4 Generate modrm decoding for andp and xorp
c8d1c6de Generate modrm decoding for 0f60-0f70 (sse instructions)
ae4ed46d Add multi-byte nop and prefetch to nasm test, generate modrm decoding
718a1acf Print qemu test error message more useful
d1ecc37e Generate modrm decoding for 0f70-0f80 (sse instructions)
6a7219a5 Generate modrm decoding for popcnt
25278217 Generate modrm decoding for 0f71-0f73 (sse shift with immediate byte)
ed1ec81b Generate modrm decoding for the remaining sse instructions (0fc0-0fff)
42bc5a6f Use 64-bit multiplication for native code
dda3fb39 Remove old modrm-decoding functions
717975ef Move register access functions to cpu.c
aee8138f Remove read_op, read_sib, read_op0F, read_disp
f31317f2 Rename xmm/mmx register access functions
a525e70b Remove 32-bit access to reg_xmm and reg_mmx
c803eabc Rename s8/s16/s32 to i8/i16/i32
9fbd2ddf Don't use uninitialised structs
942eb4f7 Use 64-bit load for mmx registers and assert reg64 and reg128 size
f94ec612 Use 64-bit writes for write_xmm64
08022de9 Use more efficient method for some 128-bit stores
9d5b084c Make timestamp counter unsigned
2ef388b3 Pass 64-bit value to safe_write64
4cb2b1be Optimise safe_write64 and safe_write128
b0ab09fb Implement psllq (660ff3)
9935e5d4 Optimise safe_read64s and safe_read128s
af9ea1cc Log cl in cpuid only if relevant
be5fe23e Add multi-op cache (disabled by default through ENABLE_JIT macro) and JIT paging test (similar to QEMU test).
aa2f286e Don't initialise group_dirtiness with 1 as it increases the binary size significantly
b8e14ed9 Remove unused reg_xmm32s
bc726e03 Implement dbg_log for native code with format characters 'd' and 'x'
454039d6 Fix store task register
63a4b349 Remove unnecessary parens and clean up some log statements
4cc96814 Add logop and dbg_trace imports
7940655d Only inhibit interrupts if the interrupt flag was 0 in STI
876c68a7 Split create_tests into create_tests and generate_interpreter
aa82499f Move detection of string instructions to x86_table
f3840ec2 Move C ast to separate file
90400703 Skip tests for lfence/mfence/sfence, clarify their encoding
4a9d8204 elf: Hide log messages when log level is zero
a601c526 Allow setting log level via settings
8a624453 Add cpu_exception_hook to debug builds
f9e335bf Nasm: Test exceptions
599ad088 logop: Format instruction pointer as unsigned
f95cf22b Don't skip zero dividing tests
2a655a0e Remove get_seg_prefix_ds from read_moffs (preparation for calling read_moffs from the code generator)
bc580b71 Remove obsolete comment
e556cee0 Fix nasmtest dependencies in makefile and clean
dcb1e72b Use all cores on travis
86efa737 Replace all instances of u32 & 0xFFFF with the respective u16 accesses
98b9f439 Use u8 instead of bit-shifts and masks from u32
b43f6569 Replace all instances of u32 >> 16 with the respective u16 accesses
9bfa72c7 Remove unnecessary parens
9cf93734 Clean up remaining instance of u32 with a mask instead of u16
22d4117f Correct order of writes in virt_boundary_write32
6734c7c1 Fix keyboard on ios, fixes #105
858a4506 Add missing file, c_ast.js
1d62e39e Move instruction naming scheme into function
f4816852 Reorder some code
69d49788 Minor improvements
0493e05f Add util.js
af9000c1 Improve full test
e5feba31 Add missing export
c7c42065 Replace prefix_call with custom_resolve_modrm
3186e6ad Add support for "%%" format string to dbg_log_wasm for printf import
efe54fad Add barebones instrumentation profiler (disabled by default).
c9f0d462 Implement movlps m64, xmm and enable its test
42869a12 Add tests for cross-page reads/writes confirmed with byte reads/writes
d68976ea Mask word values in port byte reads
9758d51e Add PS2_LOG_VERBOSE
5f52f037 Update NASM Makefile to include all dependencies to prevent unnecessary recompilation
2c71f927 Have NASM test generator use a seedable PRNG to allow for faster incremental tests
e4aa45bb Add chunk{16,32}_rw paging tests; instructions that read and write to memory
bdf538a2 add codegen to cpu constructor
aa76ce8e add resolve_modrm16
14d7ecf1 refactor codegen
b710319f [rebased] Merge branch codegen
0565ea42 minor refactoring
071dff3f temporary fix for automatic cast warnings
57c504f2 fix modrm16 issue
c2db5d9e jit modrm32
85c04245 reinstate modrm_fn0 and modrm_fn1
be65dafd add ip and previous ip manipulating functions
ae00ef89 update codegen js interface
530a74fa squashed commit for refactor
2c692199 add codegen-test to build
c15afe68 prefix gen to codegen api
c9611533 codegen tests fixes
2020-07-21 20:10:12 -05:00
Awal Garg 7c8294230d port fxrstor 2020-07-21 20:10:12 -05:00
Awal Garg d7b81d5bb9 port load_m80 2020-07-21 20:10:12 -05:00
Awal Garg b17e5e1672 port outs* 2020-07-21 20:10:11 -05:00
Awal Garg d96cbd5f7f port ins* 2020-07-21 20:10:11 -05:00
Awal Garg c8b7c1edf4 port scas* 2020-07-21 20:10:11 -05:00
Awal Garg 96dfe623a2 port lods* 2020-07-21 20:10:11 -05:00
Awal Garg e35ad8425d port stos* 2020-07-21 20:10:11 -05:00
Awal Garg 59f7bc4ec1 port cmpsd 2020-07-21 20:10:11 -05:00
Awal Garg 39ede470ed port cmpsw 2020-07-21 20:10:11 -05:00
Awal Garg c68e68a04f port cmpsb 2020-07-21 20:10:11 -05:00
Awal Garg 9a8c91e1a1 port movsd 2020-07-21 20:10:11 -05:00
Awal Garg a9edccebc7 port movsw 2020-07-21 20:10:11 -05:00
Awal Garg f64fc51036 port movsb 2020-07-21 20:10:11 -05:00
Awal Garg 8cc574af22 port idiv16 2020-07-21 20:10:11 -05:00
Awal Garg f9d99ac4de port idiv32 2020-07-21 20:10:11 -05:00
Awal Garg 18b8ebf4ba port div32 2020-07-21 20:10:11 -05:00
Awal Garg 6d8b086231 port bt*,bs*,popcnt,saturate* 2020-07-21 20:10:11 -05:00
Awal Garg 3140cce77f port shift functions etc. from arith.js 2020-07-21 20:10:11 -05:00
Awal Garg c866462bd6 port set_stack_reg 2020-07-21 20:10:11 -05:00
Awal Garg cd4d449159 port setcc 2020-07-21 20:10:11 -05:00
Awal Garg 725edc451f port pop16 and get_stack_reg 2020-07-21 20:10:11 -05:00
Fabian 3014f95359 Significantly improve speed of nasm tests
- Reuse v86 instances (in particular, memory allocation and wasm
loading)
- Reduce memory size from default (64M) to 2M
2020-07-21 20:10:11 -05:00
Fabian 9fa0d18ee8 Disable initial state memory optimisation (breaks with wasm) 2020-07-21 20:10:11 -05:00
Fabian 654235ec16 Fix .wasm loading in nodejs 2020-07-21 20:10:11 -05:00
Fabian ad06ea7bf4 Port get_real_eip 2020-07-21 20:10:11 -05:00
Fabian 77c43a938a Port read_moffs 2020-07-21 20:10:11 -05:00
Fabian 593ce966d0 Optimise clear_tlb 2020-07-21 20:10:11 -05:00
Fabian 54d52ed908 Call __post_instantiate 2020-07-21 20:10:11 -05:00
Fabian 42351c527a Port clear_tlb 2020-07-21 20:10:11 -05:00
Fabian 1dcb5a6f58 Port cmovcc 2020-07-21 20:10:11 -05:00
Fabian aebcff84ed Big squash
e72eac2fc A few more sse instructions
bdf83e0f0 temp rebase to resolve conflicts
58aa08353 replace all usage of modrm_byte with the set/get fns
7f1dbadf4 move registers to wasm memory
9a0432708 remove stdio inclusion
60f49f735 partial branch port of read_e8
747c51979 partial port of do_div32
8700c3042 remove wasm file from repo
c69bc5c91 revert div32 to js
ead0195b9 move last_op1 to wasm
16e9a2801 move last_op2 to wasm
4b5e749c8 move last_op_size to wasm
3a02ec98c move last_add_result, last_result, flags_changed to wasm
882b5476b implement add in C
8a8b15e11 move flags to wasm
4667917a9 implement getcf in C
1199537a1 implement adc in C
a8a2f81ba implement sub in C
697cb4070 implement sbb in C
1e4e08079 implement inc in C
35259ddc3 implement dec in C
82498a632 implement neg in C
47fe549af copy opsize and reg constants
39c0f07aa implement mul8 in C
443aef4b2 implement imul8 in C
afd2ec864 refactor memory accessing from C
f937617bc implement mul16 in C
af430b023 rewrite reg_* macros
6639f23a7 implement imul16 in C
6c490e88d add wasm build to makefile
ea698b8bc refactor modrm_byte access
71899e821 split cpu.c into individual files
00dc878be capitalize flag constants
e1ccf9477 remove unused buffer view
f0175e480 refactor JS to wasm replacement
f52c5f3a6 add assert.h
ccf73539e implement imul_reg16 in C
8ae41facd implement do_mul32 in C and port mul32_result to wasm memory
77d3875eb implement do_imul32 in C
af1cdc85d implement mul32 in C
820f514e3 implement imul32 in C
e165f02e0 implement imul_reg32 in C
fdee993e9 implement xadd8 in C
4e5d6f1c2 implement xadd16 in C
1c903565f implement xadd32 in C
1be111a93 implement getaf in C
4c2bc9f43 implement bcd_daa in C
3852cee61 implement bcd_das in C
ed68e2777 implement bcd_aad in C
b56c17640 implement bcd_aaa in C
5650e48c6 implement bcd_aas in C
99aeb5682 implement and in C
39d2308aa implement or in C
c76e59a0b implement xor in C
b14b87b95 async wasm instantiation
7f11605bc implement rol8 in C
161c662cf implement rol16 in C
37bf420f6 implement rol32 in C
921f06821 implement rcl8 in C
2f1bf0c2d implement rcl16 in C
ad1d56ebe implement rcl32 in C
ebcded69e implement ror8 in C
9bc225ff0 implement ror16 in C
403125717 implement ror32 in C
2a21a0896 implement rcr8 in C
80bf2667e implement rcr16 in C
f8fe46c47 implement rcr32 in C
95493a272 split error_code flag in call_interrupt_vector
a6f19110e export throw_cpu_exception to C
dd5d8ce0d export call_interrupt_vector to C
537c08f65 implement raise_exception_with_code to C
8347e787e port instruction_pointer to wasm memory (offset 556)
0e62a7046 port previous_ip to wasm memory (offset 560)
c09089e40 implement trigger_gp in C
a4f0fed1b implement raise_exception in C
0b41949f4 implement trigger_de in C
fc2a568a6 implement div8 in C
acc6bbb54 implement idiv8 in C
5a3db2d09 implement div16 in C
d77f0d151 Move wasm replacements to a dedicated function
135b19af0 port idtr_size and idtr_offset to wasm (offset 564, 568)
5f0ad7257 port gdtr_size to wasm (offset 572)
dc17f7b7a port gdtr_offset to wasm (offset 576)
07876e86f port cr to wasm (offsets 580-608)
50b0213c2 port cpl to wasm (offset 612)
5cea3efcc port page_size_extensions to wasm (offset 616)
89d6fd6e8 port last_virt_eip to wasm (offset 620)
68f4111fd port eip_phys to wasm (offset 624)
73b146319 port last_virt_esp to wasm (offset 628)
dbf920ff7 port esp_phys to wasm (offset 632)
c05177c5a port sysenter_cs to wasm (offset 636)
63dd72194 port sysenter_esp to wasm (offset 640)
59d8aa686 port sysenter_eip to wasm (offset 644)
c5e02dd8b port prefixes to wasm (offset 648)
259ca5d72 port tsc_offset to wasm (offset 652)
62ecc8825 port phys_addr to wasm (offset 656)
188ea275e port phys_addr_high to wasm (offset 660)
f458cb2bb port timestamp_counter to wasm (offset 664)
890449fa3 port sreg to wasm (offsets 668-682)
ebe65e6f3 port dreg to wasm (offsets 684-716)
df6553220 port fw_value to wasm (offset 720)
0cd3b78ea port segment isnull, offsets and limits to wasm (offset 724-796)
4fb0ecebc Turn off verbose logging
b55bc2cae fix unzip command in readme
f5b897bc3 fix docs links to api.md
ba03a7b4e Remove outdated test
930483ac4 Add elf parser
6597973c8 Shift addresses correctly
189903a7d Add comment to lss #ud
0a46ec4a9 Fix iret #gp error code (Windows XP)
28986b7ee Lower TIME_PER_FRAME
4ce987d71 Add acpi PM timer
43c31ea99 Handle access to debug registers when cr4.DE is set
283305215 Add run_hardware_timers
c617846f2 A few more assertions for IO ports
32e7444f4 Make Closure Compiler happy
a661c408c Buffer get written blocks
9306fd080 Add debug panel (#108)
795ff1a50 More complete APIC and IOAPIC implementation (#86)
4a4253956 Makefile: Refactor using addprefix
ac1009331 More VGA logging
18ee4ecde Only check irqs when irr changed
cdbc55e03 Add multiboot image loading, currently only supporting kvm-unit-test (#95, #129)
3ee9a1c85 Disable advanced optimisations for libv86. Fixes tests
12df5c76d Import kvm-unit-test into this repo
249f9ba37 Add kvm-unit-test (#129)
99b824f49 Mention than FreeBSD works
91fe8a3a1 ATA flush cache
0af630d99 PCI: Fix command/status
30fc01491 Rename function
569d1f3d6 APIC version write
df376842c Split movsx/movzx into 16/32 bit versions
dda21c5e2 CR3 ignored bits
b1f039211 Implement #NP (kvm-unit-test)
57dd8358f Minor (style and logging)
17fd08e29 Less incomplete task switch implementation
797fd5bd8 cpuid level 5
24e66a43f Missing parameter
a679829f0 PIC logging
e68ea4573 Don't create new arrays in reset(), set to 0 instead
550e55186 Update readme regarding Arch Linux
3b565e54e Use local kolibriOS image on https. Temporary workaround for #141
1a0f804d6 Fix restoring state
b397f1934 Leave ACPI disabled, fixes #151
83db7e871 add note about range header in SimpleHTTPServer
a20794873 update linux 9p image mount hook doc
88e65312e Improve fprem instruction implementation to update FPU status word's condition codes
9844ef433 Remove comments from fprem instruction
a429bbe73 Disable Oberon tests
ba3092060 Add kvm-unit-test to travis CI (#129)
6a8813567 Travis fix
46da581de Travis fix (gcc-multilib)
c78dcb105 Travis fix (switch to Trusty)
dbc2ab704 Reduce memory for kvm-unit-test
2c6bd1889 Fix multiboot images smaller than 8192 bytes
f5dead1f5 expand Archlinux doc with scripted install example
a34cd08d9 fix raw RangeHTTPServer link to wget
35f9923fb change state to initial state in archlinux doc
2aed2636f extend archlinux doc with networking example
2aa8f3722 First entry in LDT is valid (#145)
7492c8d3c Basic 16-bit tss implementation. Fixes #127. Fixes #145. Fixes windows 3.0
098d84a02 Minor
b9c93f8c6 Proper CD IDE DMA implementation, fixes #147, fixes #107
9b9123d6e Improved file loading in nodejs, simplify tests
40ee13f9b Add dummy screen
a58bd7419 Fix test: Check if disk image is missing
c8a7fd8dc Reenable Oberon tests
bd63f49ad Minor: Semicolons
d10f0b7ff Implement elcr in legacy pic
aed5b441a Change virtio irq to 10, old one collides with ps2 mouse
b93519c8a PS2 minor changes
25e64afa6 Update build command
5377f9457 Add maximum debug to emscripten build
dac6ce6a4 Reduce logging
f44f3b467 Convert argument for call from C
e1808f222 Raise when C assertion fails
bb6d38e6e Add cpu imports, in order to be called from C
f3f909d5d Port constants
7bab32657 Port protected_mode, is_32 and stack_size_32
ee02cdd86 Port the main instruction table
fe15a6cc0 fixes for prop mangling and closure type checks
11935fcc0 remove redundant pointer timestamp_counter
a7021eb20 port read_imm8 to wasm
f7a432691 strip useless brackets
90c7435f8 Reduce logging
047f0f405 Port a few small functions
df293f8d4 Port get_seg*
37774b0d1 Remove useless comparison
47f7a89b9 Port instructions with 0F prefix
8a822bae4 Remove useless brackets again (lost in rebase) and use correct quote style
2f6e90023 port read_imm{8s,16,32s}
8f5ce2dbf remove redundant declaration
5785195ce port read_write_e8 and write_e8
5fa1a15af Make instruction functions static
4a2336d12 Port jmp_rel16, jmpcc8, jmpcc16, jmpcc32
8633cfad9 Port set_e*
f024aec98 Port read_imm* aliases
d39cb4d7b Port read_g*
fa838388d Port read_e*
2f1c41d93 Port write_g*
43157269f Port logging and assertions
ac2c937d5 Port read_write_e{16,32} and write_e{16,32}
eeb7340c2 Port safe_read*
54d89b3d1 Port safe_write*
c5557a227 Port diverged, branch_taken, branch_taken
e3bb35939 Fix loading in node
00f6b2638 Remove useless `| 0` and `>> 0`. Use unsigned comparison
70fa762e3 Optimise read_imm8
4487917fd Port a20_enabled to wasm
a8f16cb20 Fix a20_enabled booleans for closure compiler
95145ec53 Move mul32 result so offsets are reserved in order (and mention length)
a3264e132 Move global pointer reservations to its own header file and make sure all .c files include all headers
78c779cbd Port FPU's stack_empty to wasm (offset 816)
4f25fc4b7 Port FPU's safe_tag_word function to wasm
8589a1c21 Port emms instruction to wasm
feb5079c7 port memory_size to wasm (offset 812)
262559291 port in_mapped_range to C
8a72ad56c Port a20_enabled to wasm
ce393e211 [wip] port read8
e936b49d1 port read8 to wasm
80cf98a3a port read16 to wasm
3a423372b port read_aligned16 to wasm
4725e1bac port read32s to wasm
60815b748 port write8 to wasm
5d64b295b port write16 to wasm
5fc83a791 port write32 to wasm
7148b6804 port push{16,32} to wasm
697222408 port pusha{16,32} to wasm
6adb5be15 Port paging, tlb_info, tlb_info_global and tlb_data
c8ab560af Port translate_address_*
8bb3e4285 Port get_eflags and getzf
c7a70a79b Port getsf
0d35dd621 Port getof
e4d3ec252 Port getpf
9aacf2cfe Port test_* (branch conditions)
9cb64f970 Add v86-debug.wasm build target
37012099d Call mmap_* functions statically
8fb9da298 Add missing voids
0bcbe7ef4 Silence warning
6fb9db2fd Simplify translate_address_read and translate_address_write
28b66ca6b Optimized versions of resolve_modrm32 and resolve_sib
cf4aea666 Silence warning
b4915a2d2 Port adjust_stack_reg, get_stack_pointer and pop32s
7ddc14948 Optimised memory reads and writes
2020-07-21 20:10:05 -05:00
copy 9211c4fc87 Destroy emulator (fix #283) 2019-07-11 19:44:48 -03:00
copy e237b218c9 Fix style and hide extra COM ports behind options 2019-05-11 19:06:41 -05:00
Stefan Bethke 0bce005cc0 Add COM2 to COM4 and extend API to allow receiving output bytes and sending input bytes to them. 2019-05-11 19:06:41 -05:00
Ernest Wong eb736ab406 Emulate PC speaker beep sounds 2017-12-16 22:51:40 -06:00
Rafael Gieschke 6a8a680336 Add support for "fastboot" option found in bochs BIOS
Introduced in
http://svn.code.sf.net/p/bochs/code/trunk@13073 6c8e4198-a580-4521-a02f-c9ae86df1db9
2017-12-11 11:19:00 -05:00
Ben 798b271ce6 Fix docs 2017-09-10 16:14:42 +02:00
copy 43747c4b32 Add dummy screen 2017-05-09 19:31:18 -05:00
copy 7b0d0b8084 Add multiboot image loading, currently only supporting kvm-unit-test (#95, #129) 2017-04-29 13:22:17 -05:00
Amaan Cheval 5ad8b60d2d Fix heuristic condition for using async file buffers 2017-03-25 14:00:51 -05:00
copy 7c50cb2356 Fix loading of local files (allow loading large files) 2017-03-21 18:10:20 -05:00
Fabian 69e7927a96 Better request error handling 2016-10-15 01:16:18 +02:00
copy ed6e2edb32 Use export annotation 2016-09-27 22:11:19 +02:00
copy 8996cc1e00 Support for environments that don't have File 2016-09-27 22:09:26 +02:00
copy 20d58a3c5a Remove no_initial_alloc, use empty memory instead 2016-08-02 05:33:02 +02:00
copy cf303a08fe onprogress: Prefer browser-provided total size over manually specified one 2016-07-18 04:32:02 +02:00
copy 8341e12027 Pass screen container to mouse adapter 2016-02-15 00:16:22 +01:00
copy 5c74b9c32e Export V86 2015-12-31 00:31:22 +01:00
copy 91e0137dc7 Minor changes 2015-12-31 00:31:08 +01:00
copy 67ae770477 Make disk images visible 2015-12-31 00:12:53 +01:00
copy d936c32e87 Change size to load image into memory completely from 16 to 256 2015-12-30 23:45:42 +01:00
copy bfdd41a35a Use quoted style for closure compiler 2015-09-16 03:46:13 +02:00
copy d26801457b Trailing whitespace 2015-09-16 03:25:09 +02:00
copy 7a6dc0f7e5 Avoid ram allocation if state is restored 2015-09-16 03:14:23 +02:00
copy 7513181326 Export keyboard_send_keys and keyboard_send_text 2015-09-15 21:38:15 +02:00
copy 87c291e923 V86.destroy() 2015-09-14 01:57:13 +02:00
copy b3c3d4d4a0 Move examples from docs/samples/ to examples/ 2015-08-22 16:37:55 +02:00
copy 311c87e010 Make V86Starter work when all loads are synchronous 2015-04-17 23:56:11 +02:00
copy e21ae4a37f Fix read_file returning extra zero bytes at the end 2015-04-16 01:44:59 +02:00
copy 897f18026a Use events over accessing the emulator object directly 2015-04-12 21:57:20 +02:00
copy 633013648e Handle empty filesystem correctly 2015-03-07 01:24:38 +01:00
copy f888130c9e Cascade operations to make loading smoother 2015-03-06 20:22:57 +01:00
copy b667aee0e1 Fix docs links 2015-03-04 00:58:00 +01:00
copy 652a67e16b Pass size to loadable images 2015-03-03 20:49:00 +01:00
copy 7fd39bda00 Export V86Starter in web worker 2015-01-31 17:39:32 +01:00
copy b75d93aa36 Refactor 2015-01-24 01:47:05 +01:00
copy 478c3218bc Documentation improvements 2015-01-20 00:05:17 +01:00
copy f0484f2410 Ignore fs if there is none 2015-01-20 00:04:26 +01:00
copy 9245080097 make filesystem url optional 2015-01-19 22:56:52 +01:00
copy 4107b2e393 create_file and read_file 2015-01-19 22:45:27 +01:00
copy 8bcbc876bb Fix quoting for closure compiler 2015-01-19 22:30:22 +01:00
copy 1be42a2a4a Make sure size is passed for asynchronous remote buffer 2015-01-19 22:24:21 +01:00
copy af16c3fc36 Some cleaning 2015-01-17 21:59:16 +01:00
copy 2609e0debf Add Node support back 2015-01-17 20:48:11 +01:00
copy 9af95c47f6 get_instruction_counter 2015-01-14 00:28:22 +01:00
copy fa3ee3f4ad load json filesystem as part of initialization process 2015-01-13 03:01:03 +01:00
copy daacd99a7d refactor load_file 2015-01-13 03:00:15 +01:00
copy 6c81fc9a5b Enable SyncFileBuffer 2015-01-13 01:34:09 +01:00
copy 2963432a11 minor 2015-01-12 18:54:52 +01:00
copy 0ce621470c Documentation comments 2015-01-11 23:31:08 +01:00
copy 3376fcdee4 make code more solid 2015-01-11 23:30:43 +01:00
copy bcb0d13599 enable_ne2k 2015-01-11 18:52:34 +01:00
copy cd9ab7b0b2 keyboard_set_status 2015-01-09 15:56:43 +01:00
copy 0f433fa0a4 Properly send strings to the serial terminal 2015-01-09 05:25:48 +01:00
copy 1032ef3ef2 New publicly usable interface called V86Starter, refactor browser/main.js using it 2015-01-09 04:49:44 +01:00