v86/src/cpu.js

4843 lines
129 KiB
JavaScript
Raw Normal View History

2013-11-07 21:30:18 +01:00
"use strict";
/** @const */
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
2017-07-06 01:59:48 +02:00
var CPU_LOG_VERBOSE = false;
2016-07-17 18:44:54 +02:00
// Resources:
// https://pdos.csail.mit.edu/6.828/2006/readings/i386/toc.htm
// https://www-ssl.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
// http://ref.x86asm.net/geek32.html
2013-11-07 21:30:18 +01:00
/** @constructor */
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
2017-07-06 01:59:48 +02:00
function CPU(bus, wm)
{
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
2017-07-06 01:59:48 +02:00
this.wm = wm;
this.wasm_patch(wm);
this.memory_size = new Uint32Array(wm.mem.buffer, 812, 1);
2014-01-08 03:22:30 +01:00
2016-08-02 04:15:24 +02:00
// Note: Currently unused (degrades performance and not required by any OS
// that we support)
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
2017-07-06 01:59:48 +02:00
this.a20_enabled = new Int32Array(wm.mem.buffer, 552, 1);
this.a20_enabled[0] = +true;
2016-08-02 04:15:24 +02:00
this.mem_page_infos = undefined;
2016-08-02 04:15:24 +02:00
this.mem8 = new Uint8Array(0);
this.mem16 = new Uint16Array(this.mem8.buffer);
this.mem32s = new Int32Array(this.mem8.buffer);
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
2017-07-06 01:59:48 +02:00
this.segment_is_null = new Uint8Array(wm.mem.buffer, 724, 8);
this.segment_offsets = new Int32Array(wm.mem.buffer, 736, 8);
this.segment_limits = new Uint32Array(wm.mem.buffer, 768, 8);
//this.segment_infos = [];
2013-11-07 21:30:18 +01:00
/**
* Translation Lookaside Buffer
* @const
2013-11-07 21:30:18 +01:00
*/
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
2017-07-06 01:59:48 +02:00
this.tlb_data = new Int32Array(wm.mem.buffer, 2048 + 0x100000*2, 0x100000);
2013-11-07 21:30:18 +01:00
/**
2013-11-07 21:30:18 +01:00
* Information about which pages are cached in the tlb.
* By bit:
* 0 system, read
* 1 system, write
* 2 user, read
* 3 user, write
* @const
2013-11-07 21:30:18 +01:00
*/
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
2017-07-06 01:59:48 +02:00
this.tlb_info = new Uint8Array(wm.mem.buffer, 2048, 0x100000);
2013-11-07 21:30:18 +01:00
/**
2013-11-07 21:30:18 +01:00
* Same as tlb_info, except it only contains global pages
* @const
2013-11-07 21:30:18 +01:00
*/
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
2017-07-06 01:59:48 +02:00
this.tlb_info_global = new Uint8Array(wm.mem.buffer, 2048 + 0x100000, 0x100000);
2013-11-07 21:30:18 +01:00
/**
2013-11-07 21:30:18 +01:00
* Wheter or not in protected mode
*/
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
2017-07-06 01:59:48 +02:00
this.protected_mode = new Int32Array(wm.mem.buffer, 800, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.idtr_size = new Int32Array(wm.mem.buffer, 564, 1);
this.idtr_offset = new Int32Array(wm.mem.buffer, 568, 1);
2013-11-07 21:30:18 +01:00
/**
2013-11-07 21:30:18 +01:00
* global descriptor table register
*/
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
2017-07-06 01:59:48 +02:00
this.gdtr_size = new Int32Array(wm.mem.buffer, 572, 1);
this.gdtr_offset = new Int32Array(wm.mem.buffer, 576, 1);
2013-11-07 21:30:18 +01:00
this.tss_size_32 = false;
2013-11-07 21:30:18 +01:00
/*
* whether or not a page fault occured
*/
this.page_fault = false;
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.cr = new Int32Array(wm.mem.buffer, 580, 8);
2015-04-12 20:16:26 +02:00
2013-11-07 21:30:18 +01:00
/** @type {number} */
2015-04-12 20:16:26 +02:00
this.cr[0] = 0;
2013-11-07 21:30:18 +01:00
/** @type {number} */
2015-04-12 20:16:26 +02:00
this.cr[2] = 0;
2013-11-07 21:30:18 +01:00
/** @type {number} */
2015-04-12 20:16:26 +02:00
this.cr[3] = 0;
2013-11-07 21:30:18 +01:00
/** @type {number} */
2015-04-12 20:16:26 +02:00
this.cr[4] = 0;
2013-11-07 21:30:18 +01:00
// current privilege level
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
2017-07-06 01:59:48 +02:00
this.cpl = new Int32Array(wm.mem.buffer, 612, 1);
2013-11-07 21:30:18 +01:00
// if false, pages are 4 KiB, else 4 Mib
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
2017-07-06 01:59:48 +02:00
this.page_size_extensions = new Int32Array(wm.mem.buffer, 616, 1);
2013-11-07 21:30:18 +01:00
2017-04-06 02:57:24 +02:00
// current operand/address size
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
2017-07-06 01:59:48 +02:00
this.is_32 = new Int32Array(wm.mem.buffer, 804, 1);
2017-04-06 02:57:24 +02:00
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
2017-07-06 01:59:48 +02:00
this.stack_size_32 = new Int32Array(wm.mem.buffer, 808, 1);
2013-11-07 21:30:18 +01:00
/**
* Was the last instruction a hlt?
2013-11-07 21:30:18 +01:00
* @type {boolean}
*/
this.in_hlt = false;
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.last_virt_eip = new Int32Array(wm.mem.buffer, 620, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.eip_phys = new Int32Array(wm.mem.buffer, 624, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.last_virt_esp = new Int32Array(wm.mem.buffer, 628, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.esp_phys = new Int32Array(wm.mem.buffer, 632, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.sysenter_cs = new Int32Array(wm.mem.buffer, 636, 1);
2014-07-26 01:24:07 +02:00
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
2017-07-06 01:59:48 +02:00
this.sysenter_esp = new Int32Array(wm.mem.buffer, 640, 1);
2014-07-26 01:24:07 +02:00
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
2017-07-06 01:59:48 +02:00
this.sysenter_eip = new Int32Array(wm.mem.buffer, 644, 1);
2014-07-26 01:24:07 +02:00
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
2017-07-06 01:59:48 +02:00
this.prefixes = new Int32Array(wm.mem.buffer, 648, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.flags = new Int32Array(wm.mem.buffer, 536, 1);
2013-11-07 21:30:18 +01:00
/**
* bitmap of flags which are not updated in the flags variable
* changed by arithmetic instructions, so only relevant to arithmetic flags
2013-11-07 21:30:18 +01:00
*/
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
2017-07-06 01:59:48 +02:00
this.flags_changed = new Int32Array(wm.mem.buffer, 532, 1);
2013-11-07 21:30:18 +01:00
/**
* the last 2 operators and the result and size of the last arithmetic operation
2013-11-07 21:30:18 +01:00
*/
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
2017-07-06 01:59:48 +02:00
this.last_op1 = new Int32Array(wm.mem.buffer, 512, 1);
this.last_op2 = new Int32Array(wm.mem.buffer, 516, 1);
this.last_op_size = new Int32Array(wm.mem.buffer, 520, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.last_add_result = new Int32Array(wm.mem.buffer, 524, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.last_result = new Int32Array(wm.mem.buffer, 528, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.mul32_result = new Int32Array(wm.mem.buffer, 544, 2);
2016-10-01 23:22:10 +02:00
this.div32_result = new Float64Array(2);
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
2017-07-06 01:59:48 +02:00
this.tsc_offset = new Int32Array(wm.mem.buffer, 652, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.modrm_byte = new Int32Array(wm.mem.buffer, 540, 1);
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
2017-07-06 01:59:48 +02:00
this.phys_addr = new Int32Array(wm.mem.buffer, 656, 1);
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
2017-07-06 01:59:48 +02:00
this.phys_addr_high = new Int32Array(wm.mem.buffer, 660, 1);
2017-04-06 02:57:24 +02:00
/** @type {!Object} */
this.devices = {};
this.table = [];
2013-11-07 21:30:18 +01:00
// paging enabled
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
2017-07-06 01:59:48 +02:00
this.paging = new Uint8Array(wm.mem.buffer, 820, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer = new Int32Array(wm.mem.buffer, 556, 1);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.previous_ip = new Int32Array(wm.mem.buffer, 560, 1);
2013-11-07 21:30:18 +01:00
this.apic_enabled = true;
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
2017-07-06 01:59:48 +02:00
// managed in io.js
/** @const */ this.memory_map_read8 = [];
/** @const */ this.memory_map_write8 = [];
/** @const */ this.memory_map_read32 = [];
/** @const */ this.memory_map_write32 = [];
/**
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
2017-07-06 01:59:48 +02:00
* @const
* @type {{main: ArrayBuffer, vga: ArrayBuffer}}
*/
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
2017-07-06 01:59:48 +02:00
this.bios = {
main: null,
vga: null,
};
this.timestamp_counter = new Int32Array(wm.mem.buffer, 664, 1);
2013-11-07 21:30:18 +01:00
// registers
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
2017-07-06 01:59:48 +02:00
this.reg32s = new Int32Array(wm.mem.buffer, 4, 8);
this.reg32 = new Uint32Array(this.reg32s.buffer, 4, 8);
this.reg16s = new Int16Array(this.reg32s.buffer, 4, 16);
this.reg16 = new Uint16Array(this.reg32s.buffer, 4, 16);
this.reg8s = new Int8Array(this.reg32s.buffer, 4, 32);
this.reg8 = new Uint8Array(this.reg32s.buffer, 4, 32);
2013-11-07 21:30:18 +01:00
// mm0-mm7 split up into 32 bit pairs
this.reg_mmxs = new Int32Array(16);
this.reg_mmx = new Uint32Array(this.reg_mmxs.buffer);
this.reg_mmx8s = new Int8Array(this.reg_mmxs.buffer);
this.reg_mmx8 = new Uint8Array(this.reg_mmxs.buffer);
2017-07-06 22:15:57 +02:00
this.reg_xmm32s = new Int32Array(wm.mem.buffer, 828, 8 * 4);
2017-07-10 01:09:07 +02:00
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
2017-07-06 01:59:48 +02:00
this.mxcsr = new Int32Array(wm.mem.buffer, 824, 1);
2017-06-22 18:30:55 +02:00
// segment registers, tr and ldtr
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
2017-07-06 01:59:48 +02:00
this.sreg = new Uint16Array(wm.mem.buffer, 668, 8);
2013-11-07 21:30:18 +01:00
// debug registers
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
2017-07-06 01:59:48 +02:00
this.dreg = new Int32Array(wm.mem.buffer, 684, 8);
2017-04-06 02:57:24 +02:00
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
2017-07-06 01:59:48 +02:00
this.fw_value = new Int32Array(wm.mem.buffer, 720, 1);
this.io = undefined;
this.fpu = undefined;
2013-11-07 21:30:18 +01:00
2017-06-01 16:28:03 +02:00
this.bus = bus;
dbg_assert(this.table16 && this.table32);
dbg_assert(this.table0F_16 && this.table0F_32);
this.update_operand_size();
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
2017-07-06 01:59:48 +02:00
this.tsc_offset[0] = v86.microtick();
this.debug_init();
2016-08-02 04:15:24 +02:00
this.init2();
2016-08-02 04:15:24 +02:00
//Object.seal(this);
}
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
2017-07-06 01:59:48 +02:00
CPU.prototype.wasm_patch = function(wm)
{
this.add = this.wm.funcs['_add'];
this.adc = this.wm.funcs['_adc'];
this.sub = this.wm.funcs['_sub'];
this.sbb = this.wm.funcs['_sbb'];
this.inc = this.wm.funcs['_inc'];
this.dec = this.wm.funcs['_dec'];
this.neg = this.wm.funcs['_neg'];
this.mul8 = this.wm.funcs['_mul8'];
this.imul8 = this.wm.funcs['_imul8'];
this.mul16 = this.wm.funcs['_mul16'];
this.imul16 = this.wm.funcs['_imul16'];
this.imul_reg16 = this.wm.funcs['_imul_reg16'];
this.mul32 = this.wm.funcs['_mul32'];
this.imul32 = this.wm.funcs['_imul32'];
this.imul_reg32 = this.wm.funcs['_imul_reg32'];
this.xadd8 = this.wm.funcs['_xadd8'];
this.xadd16 = this.wm.funcs['_xadd16'];
this.xadd32 = this.wm.funcs['_xadd32'];
this.bcd_daa = this.wm.funcs['_bcd_daa'];
this.bcd_das = this.wm.funcs['_bcd_das'];
this.bcd_aad = this.wm.funcs['_bcd_aad'];
this.bcd_aaa = this.wm.funcs['_bcd_aaa'];
this.bcd_aas = this.wm.funcs['_bcd_aas'];
this.and = this.wm.funcs['_and'];
this.or = this.wm.funcs['_or'];
this.xor = this.wm.funcs['_xor'];
this.rol8 = this.wm.funcs['_rol8'];
this.rol16 = this.wm.funcs['_rol16'];
this.rol32 = this.wm.funcs['_rol32'];
this.rcl8 = this.wm.funcs['_rcl8'];
this.rcl16 = this.wm.funcs['_rcl16'];
this.rcl32 = this.wm.funcs['_rcl32'];
this.ror8 = this.wm.funcs['_ror8'];
this.ror16 = this.wm.funcs['_ror16'];
this.ror32 = this.wm.funcs['_ror32'];
this.rcr8 = this.wm.funcs['_rcr8'];
this.rcr16 = this.wm.funcs['_rcr16'];
this.rcr32 = this.wm.funcs['_rcr32'];
this.div8 = this.wm.funcs['_div8'];
this.idiv8 = this.wm.funcs['_idiv8'];
this.div16 = this.wm.funcs['_div16'];
this.getcf = this.wm.funcs['_getcf'];
this.getaf = this.wm.funcs['_getaf'];
this.raise_exception = this.wm.funcs['_raise_exception'];
this.raise_exception_with_code = this.wm.funcs['_raise_exception_with_code'];
this.trigger_de = this.wm.funcs['_trigger_de'];
this.trigger_gp = this.wm.funcs['_trigger_gp'];
this.do_many_cycles_unsafe = this.wm.funcs['_do_many_cycles_unsafe'];
this.read_imm8 = this.wm.funcs['_read_imm8'];
this.read_imm8s = this.wm.funcs['_read_imm8s'];
this.read_imm16 = this.wm.funcs['_read_imm16'];
this.read_imm32s = this.wm.funcs['_read_imm32s'];
this.read_write_e8 = this.wm.funcs['_read_write_e8'];
this.write_e8 = this.wm.funcs['_write_e8'];
this.in_mapped_range = this.wm.funcs['_in_mapped_range'];
this.read16 = this.wm.funcs['_read16'];
this.read_aligned16 = this.wm.funcs['_read_aligned16'];
this.read32s = this.wm.funcs['_read32s'];
this.write8 = this.wm.funcs['_write8'];
this.write16 = this.wm.funcs['_write16'];
this.write32 = this.wm.funcs['_write32'];
this.push16 = this.wm.funcs['_push16'];
this.push32 = this.wm.funcs['_push32'];
this.pusha16 = this.wm.funcs['_pusha16'];
this.pusha32 = this.wm.funcs['_pusha32'];
};
CPU.prototype.get_state = function()
{
var state = [];
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
2017-07-06 01:59:48 +02:00
state[0] = this.memory_size[0];
state[1] = this.segment_is_null;
state[2] = this.segment_offsets;
state[3] = this.segment_limits;
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
2017-07-06 01:59:48 +02:00
state[4] = this.protected_mode[0];
state[5] = this.idtr_offset[0];
state[6] = this.idtr_size[0];
state[7] = this.gdtr_offset[0];
state[8] = this.gdtr_size[0];
state[9] = this.page_fault;
state[10] = this.cr;
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
2017-07-06 01:59:48 +02:00
state[11] = this.cpl[0];
state[12] = this.page_size_extensions[0];
state[13] = this.is_32[0];
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
2017-07-06 01:59:48 +02:00
state[16] = this.stack_size_32[0];
state[17] = this.in_hlt;
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
2017-07-06 01:59:48 +02:00
state[18] = this.last_virt_eip[0];
state[19] = this.eip_phys[0];
state[20] = this.last_virt_esp[0];
state[21] = this.esp_phys[0];
state[22] = this.sysenter_cs[0];
state[23] = this.sysenter_eip[0];
state[24] = this.sysenter_esp[0];
state[25] = this.prefixes[0];
2017-07-10 01:09:07 +02:00
state[26] = this.flags[0];
state[27] = this.flags_changed[0];
state[28] = this.last_op1[0];
state[29] = this.last_op2[0];
state[30] = this.last_op_size[0];
state[31] = this.last_add_result[0];
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
2017-07-06 01:59:48 +02:00
state[32] = this.modrm_byte[0];
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
2017-07-06 01:59:48 +02:00
state[36] = this.paging[0];
2017-07-10 01:09:07 +02:00
state[37] = this.instruction_pointer[0];
state[38] = this.previous_ip[0];
state[39] = this.reg32s;
state[40] = this.sreg;
state[41] = this.dreg;
state[42] = this.mem8;
state[43] = this.fpu;
state[45] = this.devices.virtio;
state[46] = this.devices.apic;
state[47] = this.devices.rtc;
state[48] = this.devices.pci;
state[49] = this.devices.dma;
state[50] = this.devices.acpi;
state[51] = this.devices.hpet;
state[52] = this.devices.vga;
state[53] = this.devices.ps2;
state[54] = this.devices.uart;
state[55] = this.devices.fdc;
state[56] = this.devices.cdrom;
state[57] = this.devices.hda;
state[58] = this.devices.pit;
state[59] = this.devices.net;
state[60] = this.devices.pic;
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
2017-07-06 01:59:48 +02:00
state[61] = this.a20_enabled[0];
state[62] = this.fw_value[0];
state[63] = this.devices.ioapic;
state[64] = this.tss_size_32;
state[65] = this.reg_mmxs;
2017-07-10 01:09:07 +02:00
state[66] = this.reg_xmm32s;
return state;
};
CPU.prototype.set_state = function(state)
{
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
2017-07-06 01:59:48 +02:00
this.memory_size[0] = state[0];
2017-07-10 01:09:07 +02:00
this.segment_is_null.set(state[1]);
this.segment_offsets.set(state[2]);
this.segment_limits.set(state[3]);
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
2017-07-06 01:59:48 +02:00
this.protected_mode[0] = state[4];
this.idtr_offset[0] = state[5];
this.idtr_size[0] = state[6];
this.gdtr_offset[0] = state[7];
this.gdtr_size[0] = state[8];
this.page_fault = state[9];
2017-07-10 01:09:07 +02:00
this.cr.set(state[10]);
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = state[11];
this.page_size_extensions[0] = state[12];
this.is_32[0] = state[13];
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
2017-07-06 01:59:48 +02:00
this.stack_size_32[0] = state[16];
this.in_hlt = state[17];
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
2017-07-06 01:59:48 +02:00
this.last_virt_eip[0] = state[18];
this.eip_phys[0] = state[19];
this.last_virt_esp[0] = state[20];
this.esp_phys[0] = state[21];
this.sysenter_cs[0] = state[22];
this.sysenter_eip[0] = state[23];
this.sysenter_esp[0] = state[24];
this.prefixes[0] = state[25];
2017-07-10 01:09:07 +02:00
this.flags[0] = state[26];
this.flags_changed[0] = state[27];
this.last_op1[0] = state[28];
this.last_op2[0] = state[29];
this.last_op_size[0] = state[30];
this.last_add_result[0] = state[31];
this.modrm_byte[0] = state[32];
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
2017-07-06 01:59:48 +02:00
this.paging[0] = state[36];
2017-07-10 01:09:07 +02:00
this.instruction_pointer[0] = state[37];
this.previous_ip[0] = state[38];
this.reg32s.set(state[39]);
this.sreg.set(state[40]);
this.dreg.set(state[41]);
this.mem8.set(state[42]);
this.fpu = state[43];
this.devices.virtio = state[45];
this.devices.apic = state[46];
this.devices.rtc = state[47];
this.devices.pci = state[48];
this.devices.dma = state[49];
this.devices.acpi = state[50];
this.devices.hpet = state[51];
this.devices.vga = state[52];
this.devices.ps2 = state[53];
this.devices.uart = state[54];
this.devices.fdc = state[55];
this.devices.cdrom = state[56];
this.devices.hda = state[57];
this.devices.pit = state[58];
this.devices.net = state[59];
this.devices.pic = state[60];
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
2017-07-06 01:59:48 +02:00
this.a20_enabled[0] = state[61];
this.fw_value[0] = state[62];
this.devices.ioapic = state[63];
this.tss_size_32 = state[64];
2017-07-10 01:09:07 +02:00
this.reg_mmxs.set(state[65]);
this.reg_xmm32s.set(state[66]);
this.full_clear_tlb();
// tsc_offset?
this.update_operand_size();
};
2013-11-07 21:30:18 +01:00
2015-01-06 04:26:39 +01:00
/**
* @return {number} time in ms until this method should becalled again
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.main_run = function()
2013-11-07 21:30:18 +01:00
{
if(this.in_hlt)
2013-11-07 21:30:18 +01:00
{
2016-08-02 02:41:43 +02:00
//if(false)
//{
// var _t = this.hlt_loop();
// var t = 0;
2016-08-02 02:41:43 +02:00
//}
//else
2017-04-06 02:57:24 +02:00
//{
var t = this.hlt_loop();
2017-04-06 02:57:24 +02:00
//}
if(this.in_hlt)
{
return t;
}
2013-11-07 21:30:18 +01:00
}
this.do_run();
return 0;
};
2014-12-21 18:11:22 +01:00
CPU.prototype.exception_cleanup = function(e)
2013-12-06 20:47:37 +01:00
{
2014-05-06 20:24:46 +02:00
if(e === MAGIC_CPU_EXCEPTION)
2013-12-06 20:47:37 +01:00
{
// A legit CPU exception (for instance, a page fault happened)
// call_interrupt_vector has already been called at this point,
// so we just need to reset some state
this.page_fault = false;
2013-12-06 20:47:37 +01:00
// restore state from prefixes
2015-04-28 11:12:40 +02:00
this.clear_prefixes();
2013-12-06 20:47:37 +01:00
}
else
{
console.log(e);
console.log(e.stack);
//var e = new Error(e.message);
//Error.captureStackTrace && Error.captureStackTrace(e);
2013-12-06 20:47:37 +01:00
throw e;
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.reboot_internal = function()
2013-11-07 21:30:18 +01:00
{
2014-12-21 19:19:04 +01:00
this.reset();
this.load_bios();
2013-11-07 21:30:18 +01:00
throw MAGIC_CPU_EXCEPTION;
};
2013-11-07 21:30:18 +01:00
2014-12-21 19:19:04 +01:00
CPU.prototype.reset = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.a20_enabled[0] = +true;
2016-08-02 04:15:24 +02:00
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
2017-07-06 01:59:48 +02:00
this.segment_is_null.fill(0);
this.segment_limits.fill(0);
//this.segment_infos = new Uint32Array(8);
this.segment_offsets.fill(0);
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.reg32s.fill(0);
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
2017-07-06 01:59:48 +02:00
this.sreg.fill(0);
this.dreg.fill(0);
2017-06-22 18:30:55 +02:00
for(let i = 0; i < this.reg_mmxs.length; i++)
{
this.reg_mmxs[i] = 0;
}
2017-06-22 18:30:55 +02:00
for(let i = 0; i < this.reg_xmm32s.length; i++)
{
this.reg_xmm32s[i] = 0;
}
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
2017-07-06 01:59:48 +02:00
this.mxcsr[0] = 0x1F80;
2017-06-22 18:30:55 +02:00
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
2017-07-06 01:59:48 +02:00
this.full_clear_tlb();
this.protected_mode[0] = +false;
// http://www.sandpile.org/x86/initial.htm
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
2017-07-06 01:59:48 +02:00
this.idtr_size[0] = 0;
this.idtr_offset[0] = 0;
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
2017-07-06 01:59:48 +02:00
this.gdtr_size[0] = 0;
this.gdtr_offset[0] = 0;
this.page_fault = false;
2015-04-12 20:16:26 +02:00
this.cr[0] = 1 << 30 | 1 << 29 | 1 << 4;
this.cr[2] = 0;
this.cr[3] = 0;
this.cr[4] = 0;
this.dreg[6] = 0xFFFF0FF0|0;
this.dreg[7] = 0x400;
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = 0;
this.paging[0] = 0;
this.page_size_extensions[0] = 0;
this.is_32[0] = +false;
this.stack_size_32[0] = +false;
this.prefixes[0] = 0;
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
2017-07-06 01:59:48 +02:00
this.last_virt_eip[0] = -1;
this.last_virt_esp[0] = -1;
this.update_operand_size();
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
2017-07-06 01:59:48 +02:00
this.timestamp_counter[0] = 0;
this.previous_ip[0] = 0;
this.in_hlt = false;
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
2017-07-06 01:59:48 +02:00
this.sysenter_cs[0] = 0;
this.sysenter_esp[0] = 0;
this.sysenter_eip[0] = 0;
2014-07-26 01:24:07 +02:00
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
2017-07-06 01:59:48 +02:00
this.flags[0] = flags_default;
this.flags_changed.fill(0);
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
2017-07-06 01:59:48 +02:00
this.last_result.fill(0);
this.last_add_result.fill(0);
this.last_op1.fill(0);
this.last_op2.fill(0);
this.last_op_size.fill(0);
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
2017-07-06 01:59:48 +02:00
this.tsc_offset[0] = v86.microtick();
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = 0xFFFF0;
2016-08-01 22:26:10 +02:00
this.switch_cs_real_mode(0xF000);
2016-02-15 00:51:27 +01:00
2014-12-21 19:19:04 +01:00
this.switch_seg(reg_ss, 0x30);
this.reg16[reg_sp] = 0x100;
if(this.devices.virtio)
{
this.devices.virtio.reset();
}
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
2017-07-06 01:59:48 +02:00
this.fw_value[0] = 0;
2014-12-21 19:19:04 +01:00
};
2016-07-26 21:45:39 +02:00
/** @export */
CPU.prototype.create_memory = function(size)
2016-07-26 21:45:39 +02:00
{
if(size < 1024 * 1024)
{
size = 1024 * 1024;
}
else if((size | 0) < 0)
{
size = Math.pow(2, 31) - MMAP_BLOCK_SIZE;
}
size = ((size - 1) | (MMAP_BLOCK_SIZE - 1)) + 1 | 0;
dbg_assert((size | 0) > 0);
dbg_assert((size & MMAP_BLOCK_SIZE - 1) === 0);
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
2017-07-06 01:59:48 +02:00
this.memory_size[0] = size;
2016-08-02 04:15:24 +02:00
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
2017-07-06 01:59:48 +02:00
var buffer = this.wm.mem.buffer;
2016-08-02 04:15:24 +02:00
2017-07-10 01:09:07 +02:00
this.mem8 = new Uint8Array(buffer, 2048 + 0x100000 * 6, size);
this.mem16 = new Uint16Array(buffer, 2048 + 0x100000 * 6, size);
this.mem32s = new Int32Array(buffer, 2048 + 0x100000 * 6, size);
2016-07-26 21:45:39 +02:00
};
CPU.prototype.init = function(settings, device_bus)
2014-12-21 19:19:04 +01:00
{
this.create_memory(typeof settings.memory_size === "number" ?
settings.memory_size : 1024 * 1024 * 64);
2014-12-21 19:19:04 +01:00
this.reset();
2016-08-02 04:15:24 +02:00
var io = new IO(this);
2014-07-27 01:07:51 +02:00
this.io = io;
2013-11-07 21:30:18 +01:00
this.bios.main = settings.bios;
this.bios.vga = settings.vga_bios;
2013-11-07 21:30:18 +01:00
2014-12-21 19:19:04 +01:00
this.load_bios();
2013-11-07 21:30:18 +01:00
var a20_byte = 0;
2013-11-07 21:30:18 +01:00
2016-02-05 17:06:19 +01:00
io.register_read(0xB3, this, function()
{
// seabios smm_relocate_and_restore
dbg_log("port 0xB3 read");
return 0;
});
io.register_read(0x92, this, function()
2013-11-07 21:30:18 +01:00
{
return a20_byte;
});
io.register_write(0x92, this, function(out_byte)
{
a20_byte = out_byte;
});
io.register_read(0x511, this, function()
{
// bios config port (used by seabios and kvm-unit-test)
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
2017-07-06 01:59:48 +02:00
let result = this.fw_value[0] & 0xFF;
this.fw_value[0] >>>= 8;
return result;
});
io.register_write(0x510, this, undefined, function(value)
{
dbg_log("bios config port, index=" + h(value));
if(value === FW_CFG_SIGNATURE)
{
// We could pretend to be QEMU here to control certain options in
// seabios, but for now this isn't needed
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
2017-07-06 01:59:48 +02:00
this.fw_value[0] = 0xfab0fab0|0;
}
else if(value === FW_CFG_RAM_SIZE)
{
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
2017-07-06 01:59:48 +02:00
this.fw_value[0] = this.memory_size[0];
}
else if(value === FW_CFG_NB_CPUS)
{
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
2017-07-06 01:59:48 +02:00
this.fw_value[0] = 1;
}
else
{
dbg_assert(false, "Unimplemented fw index: " + h(value));
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
2017-07-06 01:59:48 +02:00
this.fw_value[0] = 0;
}
});
if(DEBUG)
{
// Use by linux for port-IO delay
// Avoid generating tons of debug messages
io.register_write(0x80, this, function(out_byte)
{
});
}
this.devices = {};
2013-11-07 21:30:18 +01:00
// TODO: Make this more configurable
if(settings.load_devices)
{
2014-07-27 01:07:51 +02:00
this.devices.pic = new PIC(this);
this.devices.pci = new PCI(this);
if(ENABLE_ACPI)
{
this.devices.ioapic = new IOAPIC(this);
this.devices.apic = new APIC(this);
this.devices.acpi = new ACPI(this);
}
2015-02-25 18:23:10 +01:00
this.devices.rtc = new RTC(this);
this.fill_cmos(this.devices.rtc, settings);
2014-07-27 01:07:51 +02:00
this.devices.dma = new DMA(this);
if(ENABLE_HPET)
{
2014-07-27 01:07:51 +02:00
this.devices.hpet = new HPET(this);
}
this.devices.vga = new VGAScreen(this, device_bus,
settings.vga_memory_size || 8 * 1024 * 1024);
this.fpu = new FPU(this);
2013-11-07 21:30:18 +01:00
this.devices.ps2 = new PS2(this, device_bus);
2015-01-09 03:58:18 +01:00
this.devices.uart = new UART(this, 0x3F8, device_bus);
2013-11-07 21:30:18 +01:00
this.devices.fdc = new FloppyController(this, settings.fda, settings.fdb);
2013-11-07 21:30:18 +01:00
var ide_device_count = 0;
2015-12-31 00:31:08 +01:00
if(settings.hda)
2013-11-07 21:30:18 +01:00
{
2015-12-31 00:31:08 +01:00
this.devices.hda = new IDEDevice(this, settings.hda, false, ide_device_count++, device_bus);
2013-11-07 21:30:18 +01:00
}
2015-12-31 00:31:08 +01:00
if(settings.cdrom)
2013-11-07 21:30:18 +01:00
{
2015-12-31 00:31:08 +01:00
this.devices.cdrom = new IDEDevice(this, settings.cdrom, true, ide_device_count++, device_bus);
2013-11-07 21:30:18 +01:00
}
if(settings.hdb)
2014-01-10 04:24:56 +01:00
{
this.devices.hdb = new IDEDevice(this, settings.hdb, false, ide_device_count++, device_bus);
2014-01-10 04:24:56 +01:00
}
2013-11-07 21:30:18 +01:00
2014-07-27 01:07:51 +02:00
this.devices.pit = new PIT(this);
2014-10-11 02:15:37 +02:00
2015-01-10 02:19:22 +01:00
if(settings.enable_ne2k)
2014-10-11 02:15:37 +02:00
{
this.devices.net = new Ne2k(this, device_bus);
2014-10-11 02:15:37 +02:00
}
if(settings.fs9p)
{
2015-01-13 04:51:31 +01:00
this.devices.virtio = new VirtIO(this, device_bus, settings.fs9p);
}
2013-11-07 21:30:18 +01:00
}
if(settings.multiboot)
{
dbg_assert(settings.multiboot.buffer);
this.load_multiboot(settings.multiboot.buffer);
}
2013-11-07 21:30:18 +01:00
if(DEBUG)
{
this.debug.init();
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
CPU.prototype.load_multiboot = function(buffer)
{
// https://www.gnu.org/software/grub/manual/multiboot/multiboot.html
dbg_log("Trying multiboot from buffer of size " + buffer.byteLength, LOG_CPU);
const MAGIC = 0x1BADB002;
const ELF_MAGIC = 0x464C457F;
const MULTIBOOT_HEADER_ADDRESS = 0x10000;
const MULTIBOOT_SEARCH_BYTES = 8192;
if(buffer.byteLength < MULTIBOOT_SEARCH_BYTES)
{
var buf32 = new Int32Array(MULTIBOOT_SEARCH_BYTES / 4);
new Uint8Array(buf32.buffer).set(new Uint8Array(buffer));
}
else
{
var buf32 = new Int32Array(buffer, 0, MULTIBOOT_SEARCH_BYTES / 4);
}
for(var offset = 0; offset < MULTIBOOT_SEARCH_BYTES; offset += 4)
{
if(buf32[offset >> 2] === MAGIC)
{
var flags = buf32[offset + 4 >> 2];
var checksum = buf32[offset + 8 >> 2];
var total = MAGIC + flags + checksum | 0;
if(total)
{
dbg_log("Multiboot checksum check failed", LOG_CPU);
continue;
}
}
else
{
continue;
}
dbg_log("Multiboot magic found, flags: " + h(flags >>> 0, 8), LOG_CPU);
dbg_assert((flags & ~MULTIBOOT_HEADER_ADDRESS) === 0, "TODO");
this.reg32s[reg_eax] = 0x2BADB002;
let multiboot_info_addr = 0x7C00;
this.reg32s[reg_ebx] = multiboot_info_addr;
this.write32(multiboot_info_addr, 0);
this.cr[0] = 1;
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
2017-07-06 01:59:48 +02:00
this.protected_mode[0] = +true;
this.flags[0] = flags_default;
this.update_cs_size(true);
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
2017-07-06 01:59:48 +02:00
this.stack_size_32[0] = +true;
for(var i = 0; i < 6; i++)
{
this.segment_is_null[i] = 0;
this.segment_offsets[i] = 0;
this.segment_limits[i] = 0xFFFFFFFF;
// Value doesn't matter, OS isn't allowed to reload without setting
// up a proper GDT
this.sreg[i] = 0xB002;
}
if(flags & MULTIBOOT_HEADER_ADDRESS)
{
dbg_log("Multiboot specifies its own address table", LOG_CPU);
var header_addr = buf32[offset + 12 >> 2];
var load_addr = buf32[offset + 16 >> 2];
var load_end_addr = buf32[offset + 20 >> 2];
var bss_end_addr = buf32[offset + 24 >> 2];
var entry_addr = buf32[offset + 28 >> 2];
dbg_log("header=" + h(header_addr, 8) +
" load=" + h(load_addr, 8) +
" load_end=" + h(load_end_addr, 8) +
" bss_end=" + h(bss_end_addr, 8) +
" entry=" + h(entry_addr, 8));
dbg_assert(load_addr <= header_addr);
var file_start = offset - (header_addr - load_addr);
if(load_end_addr === 0)
{
var length = undefined;
}
else
{
dbg_assert(load_end_addr >= load_addr);
var length = load_end_addr - load_addr;
}
let blob = new Uint8Array(buffer, file_start, length);
this.write_blob(blob, load_addr);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + entry_addr | 0;
}
else if(buf32[0] === ELF_MAGIC)
{
dbg_log("Multiboot image is in elf format", LOG_CPU);
let elf = read_elf(buffer);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + elf.header.entry | 0;
for(let program of elf.program_headers)
{
if(program.type === 0)
{
// null
}
else if(program.type === 1)
{
// load
// Since multiboot specifies that paging is disabled,
// virtual and physical address must be equal
dbg_assert(program.paddr === program.vaddr);
dbg_assert(program.filesz <= program.memsz);
dbg_assert(program.paddr + program.memsz < this.memory_size[0]);
if(program.filesz) // offset mighty be outside of buffer if filesz is 0
{
let blob = new Uint8Array(buffer, program.offset, program.filesz);
this.write_blob(blob, program.paddr);
}
}
else if(program.type === 4 ||
program.type === 0x6474e550 ||
program.type === 0x6474e551)
{
// ignore for now
}
else
{
dbg_assert(false, "unimplemented elf section type");
}
}
}
else
{
dbg_assert(false, "Not a bootable multiboot format");
}
// only for kvm-unit-test
this.io.register_write_consecutive(0xF4, this,
function(value)
{
console.log("Test exited with code " + h(value, 2));
throw "HALT";
},
function() {},
function() {},
function() {});
// only for kvm-unit-test
for(let i = 0xE; i <= 0xF; i++)
{
this.io.register_write(0x2000 + i, this,
function(value)
{
dbg_log("kvm-unit-test: Set irq " + h(i) + " to " + h(value, 2));
if(value)
{
this.device_raise_irq(i);
}
else
{
this.device_lower_irq(i);
}
});
}
dbg_log("Starting multiboot kernel at:", LOG_CPU);
this.debug.dump_state();
this.debug.dump_regs();
break;
}
};
2015-02-25 18:23:10 +01:00
CPU.prototype.fill_cmos = function(rtc, settings)
{
var boot_order = settings.boot_order || 0x213;
// Used by seabios to determine the boot order
// Nibble
// 1: FloppyPrio
// 2: HDPrio
// 3: CDPrio
// 4: BEVPrio
2015-02-25 18:23:10 +01:00
// bootflag 1, high nibble, lowest priority
// Low nibble: Disable floppy signature check (1)
2016-01-01 18:23:40 +01:00
rtc.cmos_write(CMOS_BIOS_BOOTFLAG1 , 1 | boot_order >> 4 & 0xF0);
2015-02-25 18:23:10 +01:00
// bootflag 2, both nibbles, high and middle priority
2016-01-01 18:23:40 +01:00
rtc.cmos_write(CMOS_BIOS_BOOTFLAG2, boot_order & 0xFF);
2016-01-03 02:30:36 +01:00
// 640k or less if less memory is used
rtc.cmos_write(CMOS_MEM_BASE_LOW, 640 & 0xFF);
rtc.cmos_write(CMOS_MEM_BASE_HIGH, 640 >> 8);
var memory_above_1m = 0; // in k
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
2017-07-06 01:59:48 +02:00
if(this.memory_size[0] >= 1024 * 1024)
2016-01-03 02:30:36 +01:00
{
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
2017-07-06 01:59:48 +02:00
memory_above_1m = (this.memory_size[0] - 1024 * 1024) >> 10;
2016-01-03 02:30:36 +01:00
memory_above_1m = Math.min(memory_above_1m, 0xFFFF);
}
rtc.cmos_write(CMOS_MEM_OLD_EXT_LOW, memory_above_1m & 0xFF);
rtc.cmos_write(CMOS_MEM_OLD_EXT_HIGH, memory_above_1m >> 8 & 0xFF);
rtc.cmos_write(CMOS_MEM_EXTMEM_LOW, memory_above_1m & 0xFF);
rtc.cmos_write(CMOS_MEM_EXTMEM_HIGH, memory_above_1m >> 8 & 0xFF);
var memory_above_16m = 0; // in 64k blocks
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
2017-07-06 01:59:48 +02:00
if(this.memory_size[0] >= 16 * 1024 * 1024)
2016-01-03 02:30:36 +01:00
{
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
2017-07-06 01:59:48 +02:00
memory_above_16m = (this.memory_size[0] - 16 * 1024 * 1024) >> 16;
2016-01-03 02:30:36 +01:00
memory_above_16m = Math.min(memory_above_16m, 0xFFFF);
}
rtc.cmos_write(CMOS_MEM_EXTMEM2_LOW, memory_above_16m & 0xFF);
rtc.cmos_write(CMOS_MEM_EXTMEM2_HIGH, memory_above_16m >> 8 & 0xFF);
// memory above 4G (not supported by this emulator)
2016-01-01 18:23:40 +01:00
rtc.cmos_write(CMOS_MEM_HIGHMEM_LOW, 0);
rtc.cmos_write(CMOS_MEM_HIGHMEM_MID, 0);
rtc.cmos_write(CMOS_MEM_HIGHMEM_HIGH, 0);
2015-02-25 18:23:10 +01:00
2016-01-03 02:30:36 +01:00
rtc.cmos_write(CMOS_EQUIPMENT_INFO, 0x2F);
rtc.cmos_write(CMOS_BIOS_SMP_COUNT, 0);
2015-02-25 18:23:10 +01:00
};
2014-12-21 19:19:04 +01:00
CPU.prototype.load_bios = function()
{
var bios = this.bios.main;
var vga_bios = this.bios.vga;
if(!bios)
{
dbg_log("Warning: No BIOS");
return;
}
// load bios
var data = new Uint8Array(bios),
start = 0x100000 - bios.byteLength;
this.write_blob(data, start);
2014-12-21 19:19:04 +01:00
if(vga_bios)
{
// load vga bios
var vga_bios8 = new Uint8Array(vga_bios);
// older versions of seabios
this.write_blob(vga_bios8, 0xC0000);
2017-06-07 17:19:15 +02:00
// newer versions of seabios (needs to match pci rom address, see vga.js)
this.io.mmap_register(0xFEB00000, 0x100000,
function(addr)
{
addr = (addr - 0xFEB00000) | 0;
if(addr < vga_bios8.length)
{
return vga_bios8[addr];
}
2017-06-07 17:19:15 +02:00
else
{
return 0;
}
},
function(addr, value)
{
2017-06-07 17:19:15 +02:00
dbg_assert(false, "Unexpected write to VGA rom");
});
2014-12-21 19:19:04 +01:00
}
else
{
dbg_log("Warning: No VGA BIOS");
}
// seabios expects the bios to be mapped to 0xFFF00000 also
this.io.mmap_register(0xFFF00000, 0x100000,
2014-12-21 19:19:04 +01:00
function(addr)
{
addr &= 0xFFFFF;
2016-08-02 04:15:24 +02:00
return this.mem8[addr];
2014-12-21 19:19:04 +01:00
}.bind(this),
function(addr, value)
{
addr &= 0xFFFFF;
2016-08-02 04:15:24 +02:00
this.mem8[addr] = value;
2014-12-21 19:19:04 +01:00
}.bind(this));
};
2014-12-21 18:11:22 +01:00
CPU.prototype.do_run = function()
2013-11-07 21:30:18 +01:00
{
/** @type {number} */
var start = v86.microtick();
/** @type {number} */
var now = start;
2013-11-07 21:30:18 +01:00
// outer loop:
// runs cycles + timers
2014-02-07 17:41:48 +01:00
for(; now - start < TIME_PER_FRAME;)
2013-11-07 21:30:18 +01:00
{
2017-04-01 01:12:02 +02:00
this.run_hardware_timers(now);
2014-07-12 22:20:57 +02:00
this.handle_irqs();
2017-04-01 01:12:02 +02:00
this.do_many_cycles();
if(this.in_hlt)
{
return;
}
2016-02-14 13:15:09 +01:00
now = v86.microtick();
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
CPU.prototype.do_many_cycles = function()
{
try {
this.do_many_cycles_unsafe();
}
catch(e)
{
this.exception_cleanup(e);
}
};
CPU.prototype.do_many_cycles_unsafe = function()
{
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
2017-07-06 01:59:48 +02:00
dbg_assert(false);
// inner loop:
// runs only cycles
for(var k = LOOP_COUNTER; k--;)
{
this.cycle_internal();
}
};
2013-11-07 21:30:18 +01:00
// Some functions must not be inlined, because then more code is in the
// deoptimized try-catch block.
2013-11-07 21:30:18 +01:00
// This trick is a bit ugly, but it works without further complication.
if(typeof window !== "undefined")
{
window["__no_inline_for_closure_compiler__"] = [
CPU.prototype.exception_cleanup,
CPU.prototype.do_many_cycles_unsafe,
CPU.prototype.do_many_cycles,
];
}
2013-11-07 21:30:18 +01:00
2016-08-01 23:22:38 +02:00
/** @const */
var PROFILING = false;
if(PROFILING)
{
var instruction_total = new Float64Array(256);
2016-08-02 02:11:05 +02:00
var instruction_count = new Float64Array(256);
2016-08-01 23:22:38 +02:00
2016-08-02 02:11:05 +02:00
window["print_profiling"] = function print_profiling()
2016-08-01 23:22:38 +02:00
{
var prof_instructions = [];
for(var i = 0; i < 256; i++) prof_instructions[i] = {
n: h(i, 2),
total: instruction_total[i],
count: instruction_count[i],
per: (instruction_total[i] / instruction_count[i]) || 0,
};
2016-08-01 23:22:38 +02:00
console.log("count:");
console.table(prof_instructions.sort((p0, p1) => p1.count - p0.count));
console.log("time:");
console.table(prof_instructions.sort((p0, p1) => p1.total - p0.total));
console.log("time/count:");
console.table(prof_instructions.sort((p0, p1) => p1.per - p0.per));
};
2016-08-01 23:22:38 +02:00
}
2013-11-07 21:30:18 +01:00
/**
* execute a single instruction cycle on the cpu
* this includes reading all prefixes and the whole instruction
*/
2016-07-26 21:42:42 +02:00
CPU.prototype.cycle_internal = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.previous_ip[0] = this.instruction_pointer[0];
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
2017-07-06 01:59:48 +02:00
this.timestamp_counter[0]++;
2016-08-01 23:22:38 +02:00
if(PROFILING)
{
var start = performance.now();
}
var opcode = this.read_imm8();
2016-08-01 23:22:38 +02:00
//this.translate_address_read(this.instruction_pointer + 15|0)
2013-11-07 21:30:18 +01:00
if(DEBUG)
{
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
2017-07-06 01:59:48 +02:00
this.debug.logop(this.instruction_pointer[0] - 1 >>> 0, opcode);
2014-12-06 23:20:54 +01:00
}
2013-11-07 21:30:18 +01:00
// call the instruction
this.table[opcode](this);
2013-11-07 21:30:18 +01:00
2016-08-01 23:22:38 +02:00
if(PROFILING)
{
var end = performance.now();
instruction_total[opcode] += end - start;
instruction_count[opcode]++;
}
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
2017-07-06 01:59:48 +02:00
if(this.flags[0] & flag_trap)
{
// TODO
dbg_log("Trap flag: Ignored", LOG_CPU);
}
};
2013-11-07 21:30:18 +01:00
2016-07-26 21:42:42 +02:00
/** @export */
CPU.prototype.cycle = function()
{
try
{
this.cycle_internal();
}
catch(e)
{
this.exception_cleanup(e);
}
};
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
2017-07-06 01:59:48 +02:00
CPU.prototype.run_instruction_0f = function()
{
if(this.is_osize_32())
{
this.table0F_32[this.read_op0F()](this);
}
else
{
this.table0F_16[this.read_op0F()](this);
}
};
CPU.prototype.dbg_log = function()
{
dbg_log("from wasm: " + [].join.call(arguments));
};
CPU.prototype.dbg_assert = function(x)
{
dbg_assert(x);
};
CPU.prototype.segment_prefix_op = function(sreg)
{
dbg_assert(sreg <= 5);
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
2017-07-06 01:59:48 +02:00
this.prefixes[0] |= sreg + 1;
this.run_prefix_instruction();
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
2017-07-06 01:59:48 +02:00
this.prefixes[0] = 0;
};
CPU.prototype.run_prefix_instruction = function()
2014-12-12 23:24:37 +01:00
{
if(this.is_osize_32())
{
this.table32[this.read_imm8()](this);
}
else
{
this.table16[this.read_imm8()](this);
}
2014-12-12 23:24:37 +01:00
};
2014-12-21 18:11:22 +01:00
CPU.prototype.hlt_loop = function()
{
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
2017-07-06 01:59:48 +02:00
dbg_assert(this.flags[0] & flag_interrupt);
2014-06-29 22:28:55 +02:00
//dbg_log("In HLT loop", LOG_CPU);
2017-04-01 01:12:02 +02:00
this.run_hardware_timers(v86.microtick());
this.handle_irqs();
return 0;
};
2017-04-01 01:12:02 +02:00
CPU.prototype.run_hardware_timers = function(now)
{
if(ENABLE_HPET)
{
2015-01-14 02:43:09 +01:00
var pit_time = this.devices.pit.timer(now, this.devices.hpet.legacy_mode);
var rtc_time = this.devices.rtc.timer(now, this.devices.hpet.legacy_mode);
this.devices.hpet.timer(now);
}
else
{
2015-01-14 02:43:09 +01:00
var pit_time = this.devices.pit.timer(now, false);
var rtc_time = this.devices.rtc.timer(now, false);
}
2015-12-31 00:31:08 +01:00
if(ENABLE_ACPI)
{
2017-04-01 00:16:43 +02:00
this.devices.acpi.timer(now);
2015-12-31 00:31:08 +01:00
this.devices.apic.timer(now);
}
};
2015-04-28 11:12:40 +02:00
CPU.prototype.clear_prefixes = function()
{
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
2017-07-06 01:59:48 +02:00
this.prefixes[0] = 0;
2015-04-28 11:12:40 +02:00
};
2017-03-16 02:26:31 +01:00
CPU.prototype.set_cr0 = function(cr0)
2013-11-07 21:30:18 +01:00
{
2015-04-12 20:16:26 +02:00
//dbg_log("cr0 = " + h(this.cr[0] >>> 0), LOG_CPU);
2013-11-07 21:30:18 +01:00
2017-07-17 21:56:05 +02:00
if(cr0 & CR0_AM)
{
dbg_log("Warning: Unimplemented: cr0 alignment mask", LOG_CPU);
}
2017-03-16 02:26:31 +01:00
if((cr0 & (CR0_PE | CR0_PG)) === CR0_PG)
{
// cannot load PG without PE
throw this.debug.unimpl("#GP handler");
}
this.cr[0] = cr0;
2013-11-07 21:30:18 +01:00
if(!this.fpu)
2013-11-07 21:30:18 +01:00
{
// if there's no FPU, keep emulation set
2015-04-12 20:16:26 +02:00
this.cr[0] |= CR0_EM;
2013-11-07 21:30:18 +01:00
}
2015-04-12 20:16:26 +02:00
this.cr[0] |= CR0_ET;
2013-11-07 21:30:18 +01:00
2017-03-16 02:26:31 +01:00
var new_paging = (this.cr[0] & CR0_PG) === CR0_PG;
2016-08-01 23:22:38 +02:00
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
2017-07-06 01:59:48 +02:00
if(new_paging !== Boolean(this.paging[0]))
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.paging[0] = +new_paging;
this.full_clear_tlb();
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
this.protected_mode[0] = +((this.cr[0] & CR0_PE) === CR0_PE);
};
2013-11-07 21:30:18 +01:00
2017-06-22 18:21:36 +02:00
CPU.prototype.set_cr4 = function(cr4)
{
if(cr4 & (1 << 11 | 1 << 12 | 1 << 15 | 1 << 16 | 1 << 19 | 0xFFC00000))
{
this.trigger_gp(0);
}
if((this.cr[4] ^ cr4) & CR4_PGE)
{
if(cr4 & CR4_PGE)
{
// The PGE bit has been enabled. The global TLB is
// still empty, so we only have to copy it over
this.clear_tlb();
}
else
{
// Clear the global TLB
this.full_clear_tlb();
}
}
this.cr[4] = cr4;
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
2017-07-06 01:59:48 +02:00
this.page_size_extensions[0] = (cr4 & CR4_PSE) ? PSE_ENABLED : 0;
2017-06-22 18:21:36 +02:00
if(cr4 & CR4_PAE)
{
throw this.debug.unimpl("PAE");
}
if(cr4 & 0xFFFFF900)
{
dbg_assert(false, "Unimplemented CR4 bits: " + h(cr4));
this.trigger_ud();
}
dbg_log("cr4=" + h(cr4 >>> 0), LOG_CPU);
};
2014-12-21 18:11:22 +01:00
CPU.prototype.cpl_changed = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.last_virt_eip[0] = -1;
this.last_virt_esp[0] = -1;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.read_imm8 = function()
{
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
2017-07-06 01:59:48 +02:00
if((this.instruction_pointer[0] & ~0xFFF) ^ this.last_virt_eip[0])
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.eip_phys[0] = this.translate_address_read(this.instruction_pointer[0]) ^ this.instruction_pointer[0];
this.last_virt_eip[0] = this.instruction_pointer[0] & ~0xFFF;
}
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
var data8 = this.read8(this.eip_phys[0] ^ this.instruction_pointer[0]);
this.instruction_pointer[0] = this.instruction_pointer[0] + 1 | 0;
2013-11-07 21:30:18 +01:00
return data8;
2013-11-07 21:30:18 +01:00
};
2014-12-21 18:11:22 +01:00
CPU.prototype.read_imm8s = function()
2013-11-07 21:30:18 +01:00
{
return this.read_imm8() << 24 >> 24;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.read_imm16 = function()
{
// Two checks in one comparison:
// 1. Did the high 20 bits of eip change
// or 2. Are the low 12 bits of eip 0xFFF (and this read crosses a page boundary)
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
2017-07-06 01:59:48 +02:00
if(((this.instruction_pointer[0] ^ this.last_virt_eip[0]) >>> 0) > 0xFFE)
2013-11-07 21:30:18 +01:00
{
return this.read_imm8() | this.read_imm8() << 8;
}
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
var data16 = this.read16(this.eip_phys[0] ^ this.instruction_pointer[0]);
this.instruction_pointer[0] = this.instruction_pointer[0] + 2 | 0;
2013-11-07 21:30:18 +01:00
return data16;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.read_imm32s = function()
{
// Analogue to the above comment
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
2017-07-06 01:59:48 +02:00
if(((this.instruction_pointer[0] ^ this.last_virt_eip[0]) >>> 0) > 0xFFC)
2013-11-07 21:30:18 +01:00
{
return this.read_imm16() | this.read_imm16() << 16;
}
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
var data32 = this.read32s(this.eip_phys[0] ^ this.instruction_pointer[0]);
this.instruction_pointer[0] = this.instruction_pointer[0] + 4 | 0;
2013-11-07 21:30:18 +01:00
return data32;
2013-11-07 21:30:18 +01:00
};
/*
* Create an internal data unit to represent 64 bits of data
*/
CPU.prototype.create_atom64s = function(low, high)
{
let data = new Int32Array(2);
data[0] = low;
data[1] = high;
return data;
};
CPU.prototype.create_atom128s = function(d0, d1, d2, d3)
{
let data = new Int32Array(4);
data[0] = d0;
data[1] = d1;
data[2] = d2;
data[3] = d3;
return data;
}
CPU.prototype.read_modrm_byte = function()
{
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
2017-07-06 01:59:48 +02:00
this.modrm_byte[0] = this.read_imm8();
};
CPU.prototype.read_op0F = CPU.prototype.read_imm8;
CPU.prototype.read_sib = CPU.prototype.read_imm8;
CPU.prototype.read_op8 = CPU.prototype.read_imm8;
CPU.prototype.read_op8s = CPU.prototype.read_imm8s;
CPU.prototype.read_op16 = CPU.prototype.read_imm16;
CPU.prototype.read_op32s = CPU.prototype.read_imm32s;
CPU.prototype.read_disp8 = CPU.prototype.read_imm8;
CPU.prototype.read_disp8s = CPU.prototype.read_imm8s;
CPU.prototype.read_disp16 = CPU.prototype.read_imm16;
CPU.prototype.read_disp32s = CPU.prototype.read_imm32s;
CPU.prototype.init2 = function () {};
CPU.prototype.branch_taken = function () {};
CPU.prototype.branch_not_taken = function () {};
CPU.prototype.diverged = function () {};
CPU.prototype.modrm_resolve = function(modrm_byte)
{
dbg_assert(modrm_byte < 0xC0);
return (this.is_asize_32() ? this.modrm_table32 : this.modrm_table16)[modrm_byte](this);
};
CPU.prototype.sib_resolve = function(mod)
{
return this.sib_table[this.read_sib()](this, mod);
};
CPU.prototype.clear_instruction_cache = function() {};
2013-11-07 21:30:18 +01:00
// read word from a page boundary, given 2 physical addresses
2014-12-21 18:11:22 +01:00
CPU.prototype.virt_boundary_read16 = function(low, high)
2013-11-07 21:30:18 +01:00
{
dbg_assert((low & 0xFFF) === 0xFFF);
dbg_assert((high & 0xFFF) === 0);
2016-08-02 04:15:24 +02:00
return this.read8(low) | this.read8(high) << 8;
};
2013-11-07 21:30:18 +01:00
// read doubleword from a page boundary, given 2 addresses
2014-12-21 18:11:22 +01:00
CPU.prototype.virt_boundary_read32s = function(low, high)
2013-11-07 21:30:18 +01:00
{
dbg_assert((low & 0xFFF) >= 0xFFD);
dbg_assert((high - 3 & 0xFFF) === (low & 0xFFF));
2014-01-10 04:24:56 +01:00
var mid;
2013-11-07 21:30:18 +01:00
if(low & 1)
{
if(low & 2)
{
// 0xFFF
2016-08-02 04:15:24 +02:00
mid = this.read_aligned16(high - 2 >> 1);
2013-11-07 21:30:18 +01:00
}
else
{
// 0xFFD
2016-08-02 04:15:24 +02:00
mid = this.read_aligned16(low + 1 >> 1);
2013-11-07 21:30:18 +01:00
}
}
else
{
// 0xFFE
mid = this.virt_boundary_read16(low + 1 | 0, high - 1 | 0);
2013-11-07 21:30:18 +01:00
}
return this.read8(low) | mid << 8 | this.read8(high) << 24;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.virt_boundary_write16 = function(low, high, value)
2013-11-07 21:30:18 +01:00
{
dbg_assert((low & 0xFFF) === 0xFFF);
dbg_assert((high & 0xFFF) === 0);
2016-08-02 04:15:24 +02:00
this.write8(low, value);
this.write8(high, value >> 8);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.virt_boundary_write32 = function(low, high, value)
2013-11-07 21:30:18 +01:00
{
dbg_assert((low & 0xFFF) >= 0xFFD);
dbg_assert((high - 3 & 0xFFF) === (low & 0xFFF));
2016-08-02 04:15:24 +02:00
this.write8(low, value);
this.write8(high, value >> 24);
2013-11-07 21:30:18 +01:00
if(low & 1)
{
if(low & 2)
{
// 0xFFF
2016-08-02 04:15:24 +02:00
this.write8(high - 2, value >> 8);
this.write8(high - 1, value >> 16);
2013-11-07 21:30:18 +01:00
}
else
{
// 0xFFD
2016-08-02 04:15:24 +02:00
this.write8(low + 1 | 0, value >> 8);
this.write8(low + 2 | 0, value >> 16);
2013-11-07 21:30:18 +01:00
}
}
else
{
// 0xFFE
2016-08-02 04:15:24 +02:00
this.write8(low + 1 | 0, value >> 8);
this.write8(high - 1, value >> 16);
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
// safe_read, safe_write
// read or write byte, word or dword to the given *virtual* address,
// and be safe on page boundaries
2014-12-21 18:11:22 +01:00
CPU.prototype.safe_read8 = function(addr)
2013-11-07 21:30:18 +01:00
{
2014-01-02 01:05:49 +01:00
dbg_assert(addr < 0x80000000);
2016-08-02 04:15:24 +02:00
return this.read8(this.translate_address_read(addr));
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.safe_read16 = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(this.paging[0] && (addr & 0xFFF) === 0xFFF)
2013-11-07 21:30:18 +01:00
{
return this.safe_read8(addr) | this.safe_read8(addr + 1 | 0) << 8;
2013-11-07 21:30:18 +01:00
}
else
{
2016-08-02 04:15:24 +02:00
return this.read16(this.translate_address_read(addr));
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.safe_read32s = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(this.paging[0] && (addr & 0xFFF) >= 0xFFD)
2013-11-07 21:30:18 +01:00
{
return this.safe_read16(addr) | this.safe_read16(addr + 2 | 0) << 16;
2013-11-07 21:30:18 +01:00
}
else
{
2016-08-02 04:15:24 +02:00
return this.read32s(this.translate_address_read(addr));
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
CPU.prototype.safe_read64s = function(addr)
{
let data = this.create_atom64s(0, 0);
if(this.paging && (addr & 0xFFF) >= 0xFF9)
{
data[0] = this.safe_read32s(addr);
data[1] = this.safe_read32s(addr + 4 | 0);
}
else
{
data[0] = this.read32s(this.translate_address_read(addr));
data[1] = this.read32s(this.translate_address_read(addr + 4 | 0));
}
return data;
};
CPU.prototype.safe_read128s_aligned = function(addr)
{
dbg_assert((addr & 0xF) === 0);
let phys = this.translate_address_read(addr);
return this.create_atom128s(
this.read32s(phys),
this.read32s(phys + 4 | 0),
this.read32s(phys + 8 | 0),
this.read32s(phys + 12 | 0)
);
};
CPU.prototype.safe_read128s_unaligned = function(addr)
{
return this.create_atom128s(
this.safe_read32s(addr),
this.safe_read32s(addr + 4 | 0),
this.safe_read32s(addr + 8 | 0),
this.safe_read32s(addr + 12 | 0)
);
};
2014-12-21 18:11:22 +01:00
CPU.prototype.safe_write8 = function(addr, value)
2013-11-07 21:30:18 +01:00
{
2014-01-02 01:05:49 +01:00
dbg_assert(addr < 0x80000000);
2016-08-02 04:15:24 +02:00
this.write8(this.translate_address_write(addr), value);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.safe_write16 = function(addr, value)
2013-11-07 21:30:18 +01:00
{
var phys_low = this.translate_address_write(addr);
2013-11-07 21:30:18 +01:00
if((addr & 0xFFF) === 0xFFF)
{
this.virt_boundary_write16(phys_low, this.translate_address_write(addr + 1 | 0), value);
2013-11-07 21:30:18 +01:00
}
else
{
2016-08-02 04:15:24 +02:00
this.write16(phys_low, value);
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.safe_write32 = function(addr, value)
2013-11-07 21:30:18 +01:00
{
var phys_low = this.translate_address_write(addr);
2013-11-07 21:30:18 +01:00
if((addr & 0xFFF) >= 0xFFD)
{
this.virt_boundary_write32(phys_low, this.translate_address_write(addr + 3 & ~3) | (addr + 3) & 3, value);
2013-11-07 21:30:18 +01:00
}
else
{
2016-08-02 04:15:24 +02:00
this.write32(phys_low, value);
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2017-06-20 19:21:17 +02:00
CPU.prototype.safe_write64 = function(addr, low, high)
{
this.writable_or_pagefault(addr, 8);
2017-06-20 19:21:17 +02:00
this.safe_write32(addr, low);
this.safe_write32(addr + 4 | 0, high);
};
CPU.prototype.safe_write128 = function(addr, d0, d1, d2, d3)
{
this.writable_or_pagefault(addr, 16);
this.safe_write32(addr, d0);
this.safe_write32(addr + 4 | 0, d1);
this.safe_write32(addr + 8 | 0, d2);
this.safe_write32(addr + 12 | 0, d3);
};
2013-11-07 21:30:18 +01:00
// read 2 or 4 byte from ip, depending on address size attribute
2014-12-21 18:11:22 +01:00
CPU.prototype.read_moffs = function()
2013-11-07 21:30:18 +01:00
{
if(this.is_asize_32())
2013-11-07 21:30:18 +01:00
{
return this.get_seg_prefix(reg_ds) + this.read_op32s() | 0;
2013-11-07 21:30:18 +01:00
}
else
{
return this.get_seg_prefix(reg_ds) + this.read_op16() | 0;
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
CPU.prototype.getiopl = function()
2014-12-06 22:51:04 +01:00
{
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
2017-07-06 01:59:48 +02:00
return this.flags[0] >> 12 & 3;
2014-12-06 23:20:54 +01:00
};
2014-12-06 22:51:04 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.vm86_mode = function()
2014-12-06 23:20:54 +01:00
{
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
2017-07-06 01:59:48 +02:00
return !!(this.flags[0] & flag_vm);
2014-12-06 23:20:54 +01:00
};
2014-12-06 22:51:04 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.get_eflags = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
return (this.flags[0] & ~flags_all) | !!this.getcf() | !!this.getpf() << 2 | !!this.getaf() << 4 |
!!this.getzf() << 6 | !!this.getsf() << 7 | !!this.getof() << 11;
};
2013-11-07 21:30:18 +01:00
/**
* Update the flags register depending on iopl and cpl
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.update_eflags = function(new_flags)
2013-11-07 21:30:18 +01:00
{
2015-03-09 01:33:39 +01:00
var dont_update = flag_rf | flag_vm | flag_vip | flag_vif,
clear = ~flag_vip & ~flag_vif & flags_mask;
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
2017-07-06 01:59:48 +02:00
if(this.flags[0] & flag_vm)
2013-11-07 21:30:18 +01:00
{
// other case needs to be handled in popf or iret
2014-12-06 22:51:04 +01:00
dbg_assert(this.getiopl() === 3);
2015-03-09 01:33:39 +01:00
dont_update |= flag_iopl;
2015-03-09 01:33:39 +01:00
// don't clear vip or vif
clear |= flag_vip | flag_vif;
2013-11-07 21:30:18 +01:00
}
else
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(!this.protected_mode[0]) dbg_assert(this.cpl[0] === 0);
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0])
{
// cpl > 0
// cannot update iopl
2015-03-09 01:33:39 +01:00
dont_update |= flag_iopl;
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0] > this.getiopl())
{
// cpl > iopl
2015-03-09 01:33:39 +01:00
// cannot update interrupt flag
dont_update |= flag_interrupt;
}
}
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
this.flags[0] = (new_flags ^ ((this.flags[0] ^ new_flags) & dont_update)) & clear | flags_default;
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.flags_changed[0] = 0;
};
2013-11-07 21:30:18 +01:00
2015-12-30 19:57:20 +01:00
CPU.prototype.get_stack_reg = function()
{
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
2017-07-06 01:59:48 +02:00
if(this.stack_size_32[0])
2015-12-30 19:57:20 +01:00
{
return this.reg32s[reg_esp];
}
else
{
return this.reg16[reg_sp];
}
};
CPU.prototype.set_stack_reg = function(value)
{
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
2017-07-06 01:59:48 +02:00
if(this.stack_size_32[0])
2015-12-30 19:57:20 +01:00
{
this.reg32s[reg_esp] = value;
}
else
{
this.reg16[reg_sp] = value;
}
};
CPU.prototype.adjust_stack_reg = function(value)
{
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
2017-07-06 01:59:48 +02:00
if(this.stack_size_32[0])
2015-12-30 19:57:20 +01:00
{
this.reg32s[reg_esp] += value;
}
else
{
this.reg16[reg_sp] += value;
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.get_stack_pointer = function(mod)
{
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
2017-07-06 01:59:48 +02:00
if(this.stack_size_32[0])
2015-04-17 23:58:35 +02:00
{
2015-12-30 19:57:20 +01:00
return this.get_seg(reg_ss) + this.reg32s[reg_esp] + mod | 0;
2015-04-17 23:58:35 +02:00
}
else
{
2015-12-30 19:57:20 +01:00
return this.get_seg(reg_ss) + (this.reg16[reg_sp] + mod & 0xFFFF) | 0;
2015-04-17 23:58:35 +02:00
}
};
2013-11-07 21:30:18 +01:00
/*
* returns the "real" instruction pointer,
2013-11-07 21:30:18 +01:00
* without segment offset
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.get_real_eip = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
return this.instruction_pointer[0] - this.get_seg(reg_cs) | 0;
};
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
CPU.prototype.call_interrupt_vector = function(interrupt_nr, is_software_int, has_error_code, error_code)
2013-11-07 21:30:18 +01:00
{
//dbg_log("int " + h(interrupt_nr, 2) + " (" + (is_software_int ? "soft" : "hard") + "ware)", LOG_CPU);
2017-04-02 18:03:50 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("int " + h(interrupt_nr) + " start" +
" (" + (is_software_int ? "soft" : "hard") + "ware)");
CPU_LOG_VERBOSE && this.debug.dump_regs();
this.debug.debug_interrupt(interrupt_nr);
2014-06-24 16:10:40 +02:00
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
2017-07-06 01:59:48 +02:00
dbg_assert(typeof has_error_code === "boolean");
dbg_assert(has_error_code === false || typeof error_code === "number");
2013-11-07 21:30:18 +01:00
// we have to leave hlt_loop at some point, this is a
// good place to do it
2014-06-29 22:28:55 +02:00
//this.in_hlt && dbg_log("Leave HLT loop", LOG_CPU);
this.in_hlt = false;
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
if(this.protected_mode[0])
{
2015-04-12 20:16:26 +02:00
if(this.vm86_mode() && (this.cr[4] & CR4_VME))
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("VME");
}
2014-12-06 23:20:54 +01:00
if(this.vm86_mode() && is_software_int && this.getiopl() < 3)
{
2015-12-31 00:31:08 +01:00
dbg_log("call_interrupt_vector #GP. vm86 && software int && iopl < 3", LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_gp(0);
}
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
2017-07-06 01:59:48 +02:00
if((interrupt_nr << 3 | 7) > this.idtr_size[0])
2013-11-07 21:30:18 +01:00
{
dbg_log(interrupt_nr, LOG_CPU);
2013-12-28 23:21:43 +01:00
dbg_trace(LOG_CPU);
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
var addr = this.idtr_offset[0] + (interrupt_nr << 3) | 0;
2013-11-07 21:30:18 +01:00
dbg_assert((addr & 0xFFF) < 0xFF8);
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
2017-07-06 01:59:48 +02:00
if(this.paging[0])
2013-11-07 21:30:18 +01:00
{
addr = this.translate_address_system_read(addr);
2013-11-07 21:30:18 +01:00
}
2016-08-02 04:15:24 +02:00
var base = this.read16(addr) | this.read16(addr + 6 | 0) << 16;
var selector = this.read16(addr + 2 | 0);
var access = this.read8(addr + 5 | 0);
var dpl = access >> 5 & 3;
var type = access & 31;
2013-11-07 21:30:18 +01:00
if((access & 0x80) === 0)
2013-11-07 21:30:18 +01:00
{
// present bit not set
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#NP handler");
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
if(is_software_int && dpl < this.cpl[0])
2013-11-07 21:30:18 +01:00
{
dbg_log("#gp software interrupt (" + h(interrupt_nr, 2) + ") and dpl < cpl", LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_gp(interrupt_nr << 3 | 2);
2013-11-07 21:30:18 +01:00
}
if(type === 5)
2013-11-07 21:30:18 +01:00
{
// task gate
dbg_log("interrupt to task gate: int=" + h(interrupt_nr, 2) + " sel=" + h(selector, 4) + " dpl=" + dpl, LOG_CPU);
dbg_trace(LOG_CPU);
this.do_task_switch(selector, error_code);
CPU_LOG_VERBOSE && this.debug.dump_state("int end");
return;
2013-11-07 21:30:18 +01:00
}
if((type & ~1 & ~8) !== 6)
2013-11-07 21:30:18 +01:00
{
// invalid type
2013-12-28 23:21:43 +01:00
dbg_trace(LOG_CPU);
2013-11-07 21:30:18 +01:00
dbg_log("invalid type: " + h(type));
2015-03-09 01:53:38 +01:00
dbg_log(h(addr) + " " + h(base >>> 0) + " " + h(selector));
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
var is_trap = (type & 1) === 1;
var is_16 = (type & 8) === 0;
var info = this.lookup_segment_selector(selector);
2013-11-07 21:30:18 +01:00
dbg_assert((base >>> 0) <= info.effective_limit);
dbg_assert(info.is_valid);
2013-11-07 21:30:18 +01:00
if(info.is_null)
{
dbg_log("is null");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
if(!info.is_executable || info.dpl > this.cpl[0])
2013-11-07 21:30:18 +01:00
{
dbg_log("not exec");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
if(!info.is_present)
{
2017-04-06 02:54:44 +02:00
// kvm-unit-test
2013-11-07 21:30:18 +01:00
dbg_log("not present");
2017-04-06 02:54:44 +02:00
this.trigger_np(interrupt_nr << 3 | 2);
2013-11-07 21:30:18 +01:00
}
2017-03-16 02:11:29 +01:00
var old_flags = this.get_eflags();
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
//dbg_log("interrupt " + h(interrupt_nr, 2) + " (" + (is_software_int ? "soft" : "hard") + "ware) from cpl=" + this.cpl[0] + " vm=" + (this.flags[0] & flag_vm) + " cs:eip=" + h(this.sreg[reg_cs], 4) + ":" + h(this.get_real_eip(), 8) + " to cpl="
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
2017-07-06 01:59:48 +02:00
if(!info.dc_bit && info.dpl < this.cpl[0])
2013-11-07 21:30:18 +01:00
{
// inter privilege level interrupt
// interrupt from vm86 mode
2013-11-07 21:30:18 +01:00
2015-03-09 01:53:38 +01:00
//dbg_log("Inter privilege interrupt gate=" + h(selector, 4) + ":" + h(base >>> 0, 8) + " trap=" + is_trap + " 16bit=" + is_16, LOG_CPU);
2017-04-02 18:03:50 +02:00
//this.debug.dump_regs();
2016-08-01 22:26:10 +02:00
var tss_stack_addr = this.get_tss_stack_addr(info.dpl);
if(this.tss_size_32)
{
var new_esp = this.read32s(tss_stack_addr);
var new_ss = this.read16(tss_stack_addr + 4 | 0);
}
else
{
var new_esp = this.read16(tss_stack_addr);
var new_ss = this.read16(tss_stack_addr + 2 | 0);
}
var ss_info = this.lookup_segment_selector(new_ss);
2016-08-01 22:26:10 +02:00
// Disabled: Incorrect handling of direction bit
// See http://css.csail.mit.edu/6.858/2014/readings/i386/s06_03.htm
//if(!((new_esp >>> 0) <= ss_info.effective_limit))
// debugger;
//dbg_assert((new_esp >>> 0) <= ss_info.effective_limit);
dbg_assert(ss_info.is_valid && !ss_info.is_system && ss_info.is_writable);
if(ss_info.is_null)
2013-11-07 21:30:18 +01:00
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#TS handler");
2013-11-07 21:30:18 +01:00
}
if(ss_info.rpl !== info.dpl) // xxx: 0 in v86 mode
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#TS handler");
}
if(ss_info.dpl !== info.dpl || !ss_info.rw_bit)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#TS handler");
}
if(!ss_info.is_present)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#TS handler");
}
var old_esp = this.reg32s[reg_esp];
var old_ss = this.sreg[reg_ss];
if(old_flags & flag_vm)
{
2015-03-09 01:53:38 +01:00
//dbg_log("return from vm86 mode");
2017-04-02 18:03:50 +02:00
//this.debug.dump_regs();
2015-03-09 01:53:38 +01:00
dbg_assert(info.dpl === 0, "switch to non-0 dpl from vm86 mode");
}
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
2017-07-06 01:59:48 +02:00
var stack_space = (is_16 ? 2 : 4) * (5 + (has_error_code === true) + 4 * ((old_flags & flag_vm) === flag_vm));
var new_stack_pointer = ss_info.base + (ss_info.size ? new_esp - stack_space : (new_esp - stack_space & 0xFFFF));
// XXX: with new cpl or with cpl 0?
this.translate_address_system_write(new_stack_pointer);
this.translate_address_system_write(ss_info.base + new_esp - 1);
// no exceptions below
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = info.dpl;
this.cpl_changed();
2017-03-18 01:03:56 +01:00
this.update_cs_size(info.size);
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_vm & ~flag_rf;
this.switch_seg(reg_ss, new_ss);
2015-12-30 19:57:20 +01:00
this.set_stack_reg(new_esp);
if(old_flags & flag_vm)
{
2015-03-09 01:53:38 +01:00
if(is_16)
{
dbg_assert(false);
2015-03-09 01:53:38 +01:00
}
else
{
this.push32(this.sreg[reg_gs]);
this.push32(this.sreg[reg_fs]);
this.push32(this.sreg[reg_ds]);
this.push32(this.sreg[reg_es]);
}
}
2015-03-09 01:53:38 +01:00
if(is_16)
{
this.push16(old_ss);
this.push16(old_esp);
}
else
{
this.push32(old_ss);
this.push32(old_esp);
}
}
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
2017-07-06 01:59:48 +02:00
else if(info.dc_bit || info.dpl === this.cpl[0])
{
// intra privilege level interrupt
//dbg_log("Intra privilege interrupt gate=" + h(selector, 4) + ":" + h(base >>> 0, 8) +
2015-03-09 01:53:38 +01:00
// " trap=" + is_trap + " 16bit=" + is_16 +
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
2017-07-06 01:59:48 +02:00
// " cpl=" + this.cpl[0] + " dpl=" + info.dpl + " conforming=" + +info.dc_bit, LOG_CPU);
//this.debug.dump_regs_short();
2015-03-09 01:53:38 +01:00
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
2017-07-06 01:59:48 +02:00
if(this.flags[0] & flag_vm)
2015-12-31 00:31:08 +01:00
{
dbg_assert(false, "check error code");
2015-12-31 00:31:08 +01:00
this.trigger_gp(selector & ~3);
}
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
2017-07-06 01:59:48 +02:00
var stack_space = (is_16 ? 2 : 4) * (3 + (has_error_code === true));
2015-03-09 01:53:38 +01:00
// XXX: with current cpl or with cpl 0?
this.writable_or_pagefault(this.get_stack_pointer(-stack_space), stack_space);
// no exceptions below
}
else
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
}
2015-03-09 01:53:38 +01:00
if(is_16)
{
this.push16(old_flags);
this.push16(this.sreg[reg_cs]);
this.push16(this.get_real_eip());
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
2017-07-06 01:59:48 +02:00
if(has_error_code === true)
2015-03-09 01:53:38 +01:00
{
this.push16(error_code);
}
2015-03-09 01:53:38 +01:00
base &= 0xFFFF;
}
else
{
this.push32(old_flags);
this.push32(this.sreg[reg_cs]);
this.push32(this.get_real_eip());
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
2017-07-06 01:59:48 +02:00
if(has_error_code === true)
2015-03-09 01:53:38 +01:00
{
this.push32(error_code);
}
}
if(old_flags & flag_vm)
{
this.switch_seg(reg_gs, 0);
this.switch_seg(reg_fs, 0);
this.switch_seg(reg_ds, 0);
this.switch_seg(reg_es, 0);
}
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
2017-07-06 01:59:48 +02:00
this.sreg[reg_cs] = selector & ~3 | this.cpl[0];
dbg_assert((this.sreg[reg_cs] & 3) === this.cpl[0]);
2017-03-18 01:03:56 +01:00
this.update_cs_size(info.size);
2014-07-27 01:07:51 +02:00
this.segment_limits[reg_cs] = info.effective_limit;
this.segment_offsets[reg_cs] = info.base;
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + base | 0;
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_nt & ~flag_vm & ~flag_rf & ~flag_trap;
if(!is_trap)
{
// clear int flag for interrupt gates
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_interrupt;
}
else
{
if(!this.page_fault) // XXX
{
this.handle_irqs();
}
}
}
else
{
// call 4 byte cs:ip interrupt vector from ivt at cpu.memory 0
2015-03-09 01:53:38 +01:00
var index = interrupt_nr << 2;
2016-08-02 04:15:24 +02:00
var new_ip = this.read16(index);
var new_cs = this.read16(index + 2 | 0);
2015-03-09 01:53:38 +01:00
// push flags, cs:ip
2017-03-16 02:11:29 +01:00
this.push16(this.get_eflags());
this.push16(this.sreg[reg_cs]);
this.push16(this.get_real_eip());
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_interrupt;
2016-08-01 22:26:10 +02:00
this.switch_cs_real_mode(new_cs);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + new_ip | 0;
}
//dbg_log("int to:", LOG_CPU);
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("int end");
};
2014-12-21 18:11:22 +01:00
CPU.prototype.iret16 = function()
{
this.iret(true);
};
CPU.prototype.iret32 = function()
{
this.iret(false);
};
2015-04-22 04:15:32 +02:00
CPU.prototype.iret = function(is_16)
{
//dbg_log("iret is_16=" + is_16, LOG_CPU);
CPU_LOG_VERBOSE && this.debug.dump_state("iret" + (is_16 ? "16" : "32") + " start");
2017-04-02 18:03:50 +02:00
//this.debug.dump_regs();
if(this.vm86_mode() && this.getiopl() < 3)
{
// vm86 mode, iopl != 3
dbg_log("#gp iret vm86 mode, iopl != 3", LOG_CPU);
this.trigger_gp(0);
}
if(is_16)
{
var new_eip = this.safe_read16(this.get_stack_pointer(0));
var new_cs = this.safe_read16(this.get_stack_pointer(2));
var new_flags = this.safe_read16(this.get_stack_pointer(4));
}
else
{
var new_eip = this.safe_read32s(this.get_stack_pointer(0));
var new_cs = this.safe_read16(this.get_stack_pointer(4));
var new_flags = this.safe_read32s(this.get_stack_pointer(8));
}
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
2017-07-06 01:59:48 +02:00
if(!this.protected_mode[0] || (this.vm86_mode() && this.getiopl() === 3))
{
if(new_eip & 0xFFFF0000)
2015-04-22 04:15:32 +02:00
{
throw this.debug.unimpl("#GP handler");
}
2016-08-01 22:26:10 +02:00
this.switch_cs_real_mode(new_cs);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = new_eip + this.get_seg(reg_cs) | 0;
if(is_16)
{
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
2017-07-06 01:59:48 +02:00
this.update_eflags(new_flags | this.flags[0] & ~0xFFFF);
this.adjust_stack_reg(3 * 2);
}
else
{
this.update_eflags(new_flags);
this.adjust_stack_reg(3 * 4);
}
//dbg_log("iret32 to:", LOG_CPU);
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("iret end");
this.handle_irqs();
return;
}
dbg_assert(!this.vm86_mode());
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
2017-07-06 01:59:48 +02:00
if(this.flags[0] & flag_nt)
{
2014-12-06 23:20:54 +01:00
if(DEBUG) throw this.debug.unimpl("nt");
this.trigger_gp(0);
}
2013-11-07 21:30:18 +01:00
if(new_flags & flag_vm)
{
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0] === 0)
{
// return to virtual 8086 mode
2013-11-07 21:30:18 +01:00
// vm86 cannot be set in 16 bit flag
dbg_assert(!is_16);
dbg_assert((new_eip & ~0xFFFF) === 0);
2014-01-02 01:05:49 +01:00
//dbg_log("in vm86 mode now " +
// " cs:eip=" + h(new_cs, 4) + ":" + h(this.instruction_pointer >>> 0, 8) +
// " iopl=" + this.getiopl() + " flags=" + h(new_flags, 8), LOG_CPU);
var temp_esp = this.safe_read32s(this.get_stack_pointer(12));
var temp_ss = this.safe_read16(this.get_stack_pointer(16));
var new_es = this.safe_read16(this.get_stack_pointer(20));
var new_ds = this.safe_read16(this.get_stack_pointer(24));
var new_fs = this.safe_read16(this.get_stack_pointer(28));
var new_gs = this.safe_read16(this.get_stack_pointer(32));
// no exceptions below
2013-11-07 21:30:18 +01:00
this.update_eflags(new_flags);
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_vm;
2016-08-01 22:26:10 +02:00
this.switch_cs_real_mode(new_cs);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = (new_eip & 0xFFFF) + this.get_seg(reg_cs) | 0;
2013-11-07 21:30:18 +01:00
this.switch_seg(reg_es, new_es);
this.switch_seg(reg_ds, new_ds);
this.switch_seg(reg_fs, new_fs);
this.switch_seg(reg_gs, new_gs);
2013-11-07 21:30:18 +01:00
this.adjust_stack_reg(9 * 4); // 9 dwords: eip, cs, flags, esp, ss, es, ds, fs, gs
2013-12-28 23:21:43 +01:00
this.reg32s[reg_esp] = temp_esp;
this.switch_seg(reg_ss, temp_ss);
2013-12-28 23:21:43 +01:00
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = 3;
2015-04-22 04:15:32 +02:00
this.cpl_changed();
this.update_cs_size(false);
//dbg_log("iret32 to:", LOG_CPU);
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("iret end");
2017-04-02 18:03:50 +02:00
//this.debug.dump_regs();
2013-11-07 21:30:18 +01:00
return;
2013-11-07 21:30:18 +01:00
}
2013-12-28 23:21:43 +01:00
else
{
2016-07-28 00:15:23 +02:00
dbg_log("vm86 flag ignored because cpl != 0", LOG_CPU);
new_flags &= ~flag_vm;
2013-12-28 23:21:43 +01:00
}
}
2013-11-07 21:30:18 +01:00
// protected mode return
2013-11-07 21:30:18 +01:00
var info = this.lookup_segment_selector(new_cs);
dbg_assert(info.is_valid);
dbg_assert((new_eip >>> 0) <= info.effective_limit);
2013-11-07 21:30:18 +01:00
if(info.is_null)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("is null");
}
if(!info.is_present)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("not present");
}
if(!info.is_executable)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("not exec");
}
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
2017-07-06 01:59:48 +02:00
if(info.rpl < this.cpl[0])
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("rpl < cpl");
}
if(info.dc_bit && info.dpl > info.rpl)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("conforming and dpl > rpl");
}
2013-11-07 21:30:18 +01:00
if(!info.dc_bit && info.rpl !== info.dpl)
{
dbg_log("#gp iret: non-conforming cs and rpl != dpl, dpl=" + info.dpl + " rpl=" + info.rpl, LOG_CPU);
2017-03-31 22:34:56 +02:00
this.trigger_gp(new_cs & ~3);
}
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
2017-07-06 01:59:48 +02:00
if(info.rpl > this.cpl[0])
{
// outer privilege return
if(is_16)
{
var temp_esp = this.safe_read16(this.get_stack_pointer(6));
var temp_ss = this.safe_read16(this.get_stack_pointer(8));
}
else
{
var temp_esp = this.safe_read32s(this.get_stack_pointer(12));
var temp_ss = this.safe_read16(this.get_stack_pointer(16));
}
2013-11-07 21:30:18 +01:00
2016-10-23 17:37:02 +02:00
var ss_info = this.lookup_segment_selector(temp_ss);
var new_cpl = info.rpl;
if(ss_info.is_null)
{
dbg_log("#GP for loading 0 in SS sel=" + h(temp_ss, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_gp(0);
}
if(!ss_info.is_valid ||
ss_info.is_system ||
ss_info.rpl !== new_cpl ||
!ss_info.is_writable ||
ss_info.dpl !== new_cpl)
{
dbg_log("#GP for loading invalid in SS sel=" + h(temp_ss, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_gp(temp_ss & ~3);
}
if(!ss_info.is_present)
{
dbg_log("#SS for loading non-present in SS sel=" + h(temp_ss, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_ss(temp_ss & ~3);
}
// no exceptions below
2013-11-07 21:30:18 +01:00
if(is_16)
2015-04-22 04:15:32 +02:00
{
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
2017-07-06 01:59:48 +02:00
this.update_eflags(new_flags | this.flags[0] & ~0xFFFF);
}
else
{
this.update_eflags(new_flags);
2015-04-22 04:15:32 +02:00
}
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = info.rpl;
2015-04-22 04:15:32 +02:00
this.cpl_changed();
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
2017-07-06 01:59:48 +02:00
//dbg_log("outer privilege return: from=" + this.cpl[0] + " to=" + info.rpl + " ss:esp=" + h(temp_ss, 4) + ":" + h(temp_esp >>> 0, 8), LOG_CPU);
this.switch_seg(reg_ss, temp_ss);
this.set_stack_reg(temp_esp);
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0] === 0)
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] = this.flags[0] & ~flag_vif & ~flag_vip | (new_flags & (flag_vif | flag_vip));
}
// XXX: Set segment to 0 if it's not usable in the new cpl
// XXX: Use cached segment information
//var ds_info = this.lookup_segment_selector(this.sreg[reg_ds]);
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
2017-07-06 01:59:48 +02:00
//if(this.cpl[0] > ds_info.dpl && (!ds_info.is_executable || !ds_info.dc_bit)) this.switch_seg(reg_ds, 0);
// ...
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
else if(info.rpl === this.cpl[0])
2013-11-07 21:30:18 +01:00
{
// same privilege return
// no exceptions below
if(is_16)
{
this.adjust_stack_reg(3 * 2);
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
2017-07-06 01:59:48 +02:00
this.update_eflags(new_flags | this.flags[0] & ~0xFFFF);
}
else
{
this.adjust_stack_reg(3 * 4);
this.update_eflags(new_flags);
}
2015-04-22 04:15:32 +02:00
// update vip and vif, which are not changed by update_eflags
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0] === 0)
2015-04-22 04:15:32 +02:00
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] = this.flags[0] & ~flag_vif & ~flag_vip | (new_flags & (flag_vif | flag_vip));
2015-04-22 04:15:32 +02:00
}
}
else
{
dbg_assert(false);
}
this.sreg[reg_cs] = new_cs;
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
2017-07-06 01:59:48 +02:00
dbg_assert((new_cs & 3) === this.cpl[0]);
2017-03-18 01:03:56 +01:00
this.update_cs_size(info.size);
2014-07-27 01:07:51 +02:00
this.segment_limits[reg_cs] = info.effective_limit;
this.segment_offsets[reg_cs] = info.base;
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = new_eip + this.get_seg(reg_cs) | 0;
CPU_LOG_VERBOSE && this.debug.dump_state("iret" + (is_16 ? "16" : "32") + " end");
2013-11-07 21:30:18 +01:00
this.handle_irqs();
};
2016-08-01 22:26:10 +02:00
CPU.prototype.switch_cs_real_mode = function(selector)
{
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
2017-07-06 01:59:48 +02:00
dbg_assert(!this.protected_mode[0] || this.vm86_mode());
2016-08-01 22:26:10 +02:00
this.sreg[reg_cs] = selector;
this.segment_is_null[reg_cs] = 0;
this.segment_offsets[reg_cs] = selector << 4;
};
CPU.prototype.far_return = function(eip, selector, stack_adjust)
{
dbg_assert(typeof selector === "number" && selector < 0x10000 && selector >= 0);
//dbg_log("far return eip=" + h(eip >>> 0, 8) + " cs=" + h(selector, 4) + " stack_adjust=" + h(stack_adjust), LOG_CPU);
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("far ret start");
2016-08-01 22:26:10 +02:00
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
2017-07-06 01:59:48 +02:00
if(!this.protected_mode[0])
2016-08-01 22:26:10 +02:00
{
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
2017-07-06 01:59:48 +02:00
dbg_assert(!this.is_32[0]);
//dbg_assert(!this.stack_size_32[0]);
2016-08-01 22:26:10 +02:00
}
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
2017-07-06 01:59:48 +02:00
if(!this.protected_mode[0] || this.vm86_mode())
2016-08-01 22:26:10 +02:00
{
this.switch_cs_real_mode(selector);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + eip | 0;
this.adjust_stack_reg(2 * (this.is_osize_32() ? 4 : 2) + stack_adjust);
2016-08-01 22:26:10 +02:00
return;
}
var info = this.lookup_segment_selector(selector);
if(info.is_null)
{
dbg_log("null cs", LOG_CPU);
this.trigger_gp(0);
}
if(!info.is_valid)
{
dbg_log("invalid cs: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(info.is_system)
{
dbg_assert(false, "is system in far return");
this.trigger_gp(selector & ~3);
}
if(!info.is_executable)
{
dbg_log("non-executable cs: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
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
2017-07-06 01:59:48 +02:00
if(info.rpl < this.cpl[0])
2016-08-01 22:26:10 +02:00
{
dbg_log("cs rpl < cpl: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(info.dc_bit && info.dpl > info.rpl)
{
dbg_log("cs conforming and dpl > rpl: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(!info.dc_bit && info.dpl !== info.rpl)
{
dbg_log("cs non-conforming and dpl != rpl: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(!info.is_present)
{
dbg_log("#NP for loading not-present in cs sel=" + h(selector, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_np(selector & ~3);
}
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
2017-07-06 01:59:48 +02:00
if(info.rpl > this.cpl[0])
2016-08-01 22:26:10 +02:00
{
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
2017-07-06 01:59:48 +02:00
dbg_log("far return privilege change cs: " + h(selector) + " from=" + this.cpl[0] + " to=" + info.rpl + " is_16=" + this.is_osize_32(), LOG_CPU);
2016-08-01 22:26:10 +02:00
if(this.is_osize_32())
2016-08-01 22:26:10 +02:00
{
//dbg_log("esp read from " + h(this.translate_address_system_read(this.get_stack_pointer(stack_adjust + 8))))
2016-08-01 22:26:10 +02:00
var temp_esp = this.safe_read32s(this.get_stack_pointer(stack_adjust + 8));
//dbg_log("esp=" + h(temp_esp));
2016-08-01 22:26:10 +02:00
var temp_ss = this.safe_read16(this.get_stack_pointer(stack_adjust + 12));
}
else
{
//dbg_log("esp read from " + h(this.translate_address_system_read(this.get_stack_pointer(stack_adjust + 4))));
2016-08-01 22:26:10 +02:00
var temp_esp = this.safe_read16(this.get_stack_pointer(stack_adjust + 4));
//dbg_log("esp=" + h(temp_esp));
2016-08-01 22:26:10 +02:00
var temp_ss = this.safe_read16(this.get_stack_pointer(stack_adjust + 6));
}
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = info.rpl;
2016-08-01 22:26:10 +02:00
this.cpl_changed();
// XXX: Can raise, conditions should be checked before side effects
this.switch_seg(reg_ss, temp_ss);
this.set_stack_reg(temp_esp + stack_adjust);
//if(this.is_osize_32())
2016-08-01 22:26:10 +02:00
//{
// this.adjust_stack_reg(2 * 4);
//}
//else
//{
// this.adjust_stack_reg(2 * 2);
//}
//throw this.debug.unimpl("privilege change");
//this.adjust_stack_reg(stack_adjust);
}
else
{
if(this.is_osize_32())
2016-08-01 22:26:10 +02:00
{
this.adjust_stack_reg(2 * 4 + stack_adjust);
}
else
{
this.adjust_stack_reg(2 * 2 + stack_adjust);
}
}
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
2017-07-06 01:59:48 +02:00
//dbg_assert(this.cpl[0] === info.dpl);
2016-08-01 22:26:10 +02:00
2017-03-18 01:03:56 +01:00
this.update_cs_size(info.size);
2016-08-01 22:26:10 +02:00
this.segment_is_null[reg_cs] = 0;
this.segment_limits[reg_cs] = info.effective_limit;
//this.segment_infos[reg_cs] = 0; // TODO
this.segment_offsets[reg_cs] = info.base;
this.sreg[reg_cs] = selector;
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
2017-07-06 01:59:48 +02:00
dbg_assert((selector & 3) === this.cpl[0]);
2017-04-02 18:03:50 +02:00
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + eip | 0;
2016-08-01 22:26:10 +02:00
//dbg_log("far return to:", LOG_CPU)
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("far ret end");
2016-08-01 22:26:10 +02:00
};
CPU.prototype.far_jump = function(eip, selector, is_call)
{
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
2017-07-06 01:59:48 +02:00
is_call = !!is_call;
2016-08-01 22:26:10 +02:00
dbg_assert(typeof selector === "number" && selector < 0x10000 && selector >= 0);
//dbg_log("far " + ["jump", "call"][+is_call] + " eip=" + h(eip >>> 0, 8) + " cs=" + h(selector, 4), LOG_CPU);
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("far " + ["jump", "call"][+is_call]);
2016-08-01 22:26:10 +02:00
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
2017-07-06 01:59:48 +02:00
if(!this.protected_mode[0] || this.vm86_mode())
2016-08-01 22:26:10 +02:00
{
if(is_call)
{
if(this.is_osize_32())
2016-08-01 22:26:10 +02:00
{
this.writable_or_pagefault(this.get_stack_pointer(-8), 8);
this.push32(this.sreg[reg_cs]);
this.push32(this.get_real_eip());
}
else
{
this.writable_or_pagefault(this.get_stack_pointer(-4), 4);
this.push16(this.sreg[reg_cs]);
this.push16(this.get_real_eip());
}
}
this.switch_cs_real_mode(selector);
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + eip | 0;
2016-08-01 22:26:10 +02:00
return;
}
var info = this.lookup_segment_selector(selector);
if(info.is_null)
{
dbg_log("#gp null cs", LOG_CPU);
this.trigger_gp(0);
}
if(!info.is_valid)
{
dbg_log("#gp invalid cs: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(info.is_system)
{
dbg_assert(is_call, "TODO: Jump");
2016-08-01 22:26:10 +02:00
dbg_log("system type cs: " + h(selector), LOG_CPU);
if(info.type === 0xC || info.type === 4)
{
// call gate
var is_16 = info.type === 4;
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
2017-07-06 01:59:48 +02:00
if(info.dpl < this.cpl[0] || info.dpl < info.rpl)
2016-08-01 22:26:10 +02:00
{
dbg_log("#gp cs gate dpl < cpl or dpl < rpl: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(!info.is_present)
{
dbg_log("#NP for loading not-present in gate cs sel=" + h(selector, 4), LOG_CPU);
this.trigger_np(selector & ~3);
}
var cs_selector = info.raw0 >>> 16;
var cs_info = this.lookup_segment_selector(cs_selector);
if(cs_info.is_null)
{
dbg_log("#gp null cs", LOG_CPU);
this.trigger_gp(0);
}
if(!cs_info.is_valid)
{
dbg_log("#gp invalid cs: " + h(cs_selector), LOG_CPU);
this.trigger_gp(cs_selector & ~3);
}
if(!cs_info.is_executable)
{
dbg_log("#gp non-executable cs: " + h(cs_selector), LOG_CPU);
this.trigger_gp(cs_selector & ~3);
}
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
2017-07-06 01:59:48 +02:00
if(cs_info.dpl > this.cpl[0])
2016-08-01 22:26:10 +02:00
{
dbg_log("#gp dpl > cpl: " + h(cs_selector), LOG_CPU);
this.trigger_gp(cs_selector & ~3);
}
if(!cs_info.is_present)
{
dbg_log("#NP for loading not-present in cs sel=" + h(cs_selector, 4), LOG_CPU);
this.trigger_np(cs_selector & ~3);
}
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
2017-07-06 01:59:48 +02:00
if(!cs_info.dc_bit && cs_info.dpl < this.cpl[0])
2016-08-01 22:26:10 +02:00
{
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
2017-07-06 01:59:48 +02:00
dbg_log("more privilege call gate is_16=" + is_16 + " from=" + this.cpl[0] + " to=" + cs_info.dpl);
2016-08-01 22:26:10 +02:00
var tss_stack_addr = this.get_tss_stack_addr(cs_info.dpl);
if(this.tss_size_32)
{
var new_esp = this.read32s(tss_stack_addr);
var new_ss = this.read16(tss_stack_addr + 4 | 0);
}
else
{
var new_esp = this.read16(tss_stack_addr);
var new_ss = this.read16(tss_stack_addr + 2 | 0);
}
2016-08-01 22:26:10 +02:00
var ss_info = this.lookup_segment_selector(new_ss);
// Disabled: Incorrect handling of direction bit
// See http://css.csail.mit.edu/6.858/2014/readings/i386/s06_03.htm
//if(!((new_esp >>> 0) <= ss_info.effective_limit))
// debugger;
//dbg_assert((new_esp >>> 0) <= ss_info.effective_limit);
dbg_assert(ss_info.is_valid && !ss_info.is_system && ss_info.is_writable);
if(ss_info.is_null)
{
throw this.debug.unimpl("#TS handler");
}
if(ss_info.rpl !== cs_info.dpl) // xxx: 0 in v86 mode
{
throw this.debug.unimpl("#TS handler");
}
if(ss_info.dpl !== cs_info.dpl || !ss_info.rw_bit)
{
throw this.debug.unimpl("#TS handler");
}
if(!ss_info.is_present)
{
throw this.debug.unimpl("#SS handler");
}
2016-10-23 17:37:02 +02:00
var parameter_count = info.raw1 & 0x1F;
var stack_space = is_16 ? 4 : 8;
if(is_call)
{
stack_space += is_16 ? 4 + 2 * parameter_count : 8 + 4 * parameter_count;
}
if(ss_info.size)
{
//try {
this.writable_or_pagefault(ss_info.base + new_esp - stack_space | 0, stack_space); // , cs_info.dpl
//} catch(e) { debugger; }
}
else
{
//try {
this.writable_or_pagefault(ss_info.base + (new_esp - stack_space & 0xFFFF) | 0, stack_space); // , cs_info.dpl
//} catch(e) { debugger; }
}
2016-08-01 22:26:10 +02:00
var old_esp = this.reg32s[reg_esp];
var old_ss = this.sreg[reg_ss];
var old_stack_pointer = this.get_stack_pointer(0);
2016-10-23 17:37:02 +02:00
//dbg_log("old_esp=" + h(old_esp));
2016-08-01 22:26:10 +02:00
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
2017-07-06 01:59:48 +02:00
this.cpl[0] = cs_info.dpl;
2016-08-01 22:26:10 +02:00
this.cpl_changed();
2017-03-18 01:03:56 +01:00
this.update_cs_size(cs_info.size);
2016-08-01 22:26:10 +02:00
this.switch_seg(reg_ss, new_ss);
this.set_stack_reg(new_esp);
2016-10-23 17:37:02 +02:00
//dbg_log("parameter_count=" + parameter_count);
2016-08-01 22:26:10 +02:00
//dbg_assert(parameter_count === 0, "TODO");
if(is_16)
{
this.push16(old_ss);
this.push16(old_esp);
2016-10-23 17:37:02 +02:00
//dbg_log("old esp written to " + h(this.translate_address_system_read(this.get_stack_pointer(0))));
2016-08-01 22:26:10 +02:00
}
else
{
this.push32(old_ss);
this.push32(old_esp);
2016-10-23 17:37:02 +02:00
//dbg_log("old esp written to " + h(this.translate_address_system_read(this.get_stack_pointer(0))));
2016-08-01 22:26:10 +02:00
}
if(is_call)
{
if(is_16)
{
for(var i = parameter_count - 1; i >= 0; i--)
{
var parameter = this.safe_read16(old_stack_pointer + 2 * i);
this.push16(parameter);
}
2016-10-23 17:37:02 +02:00
//this.writable_or_pagefault(this.get_stack_pointer(-4), 4);
2016-08-01 22:26:10 +02:00
this.push16(this.sreg[reg_cs]);
this.push16(this.get_real_eip());
}
else
{
for(var i = parameter_count - 1; i >= 0; i--)
{
var parameter = this.safe_read32s(old_stack_pointer + 4 * i);
this.push32(parameter);
}
2016-10-23 17:37:02 +02:00
//this.writable_or_pagefault(this.get_stack_pointer(-8), 8);
2016-08-01 22:26:10 +02:00
this.push32(this.sreg[reg_cs]);
this.push32(this.get_real_eip());
}
}
}
else
{
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
2017-07-06 01:59:48 +02:00
dbg_log("same privilege call gate is_16=" + is_16 + " from=" + this.cpl[0] + " to=" + cs_info.dpl + " conforming=" + cs_info.dc_bit);
2016-08-01 22:26:10 +02:00
// ok
if(is_call)
{
if(is_16)
{
this.writable_or_pagefault(this.get_stack_pointer(-4), 4);
this.push16(this.sreg[reg_cs]);
this.push16(this.get_real_eip());
}
else
{
this.writable_or_pagefault(this.get_stack_pointer(-8), 8);
this.push32(this.sreg[reg_cs]);
this.push32(this.get_real_eip());
}
}
}
// Note: eip from call is ignored
var new_eip = info.raw0 & 0xFFFF;
if(!is_16)
{
new_eip |= info.raw1 & 0xFFFF0000;
}
dbg_log("call gate eip=" + h(new_eip >>> 0) + " cs=" + h(cs_selector) + " conforming=" + cs_info.dc_bit);
dbg_assert((new_eip >>> 0) <= cs_info.effective_limit, "todo: #gp");
2017-03-18 01:03:56 +01:00
this.update_cs_size(cs_info.size);
2016-08-01 22:26:10 +02:00
this.segment_is_null[reg_cs] = 0;
this.segment_limits[reg_cs] = cs_info.effective_limit;
//this.segment_infos[reg_cs] = 0; // TODO
this.segment_offsets[reg_cs] = cs_info.base;
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
2017-07-06 01:59:48 +02:00
this.sreg[reg_cs] = cs_selector & ~3 | this.cpl[0];
dbg_assert((this.sreg[reg_cs] & 3) === this.cpl[0]);
2016-08-01 22:26:10 +02:00
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + new_eip | 0;
2016-08-01 22:26:10 +02:00
}
else
{
var types = { 9: "Available 386 TSS", 0xb: "Busy 386 TSS", 4: "286 Call Gate", 0xc: "386 Call Gate" };
throw this.debug.unimpl("load system segment descriptor, type = " + (info.access & 15) + " (" + types[info.access & 15] + ")");
}
}
else
{
if(!info.is_executable)
{
dbg_log("#gp non-executable cs: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
if(info.dc_bit)
{
// conforming code segment
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
2017-07-06 01:59:48 +02:00
if(info.dpl > this.cpl[0])
2016-08-01 22:26:10 +02:00
{
dbg_log("#gp cs dpl > cpl: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
}
else
{
// non-conforming code segment
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
2017-07-06 01:59:48 +02:00
if(info.rpl > this.cpl[0] || info.dpl !== this.cpl[0])
2016-08-01 22:26:10 +02:00
{
dbg_log("#gp cs rpl > cpl or dpl != cpl: " + h(selector), LOG_CPU);
this.trigger_gp(selector & ~3);
}
}
if(!info.is_present)
{
dbg_log("#NP for loading not-present in cs sel=" + h(selector, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_np(selector & ~3);
}
if(is_call)
{
if(this.is_osize_32())
2016-08-01 22:26:10 +02:00
{
this.writable_or_pagefault(this.get_stack_pointer(-8), 8);
this.push32(this.sreg[reg_cs]);
this.push32(this.get_real_eip());
}
else
{
this.writable_or_pagefault(this.get_stack_pointer(-4), 4);
this.push16(this.sreg[reg_cs]);
this.push16(this.get_real_eip());
}
}
dbg_assert((eip >>> 0) <= info.effective_limit, "todo: #gp");
2017-03-18 01:03:56 +01:00
this.update_cs_size(info.size);
2016-08-01 22:26:10 +02:00
this.segment_is_null[reg_cs] = 0;
this.segment_limits[reg_cs] = info.effective_limit;
//this.segment_infos[reg_cs] = 0; // TODO
this.segment_offsets[reg_cs] = info.base;
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
2017-07-06 01:59:48 +02:00
this.sreg[reg_cs] = selector & ~3 | this.cpl[0];
2016-08-01 22:26:10 +02:00
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + eip | 0;
2016-08-01 22:26:10 +02:00
}
//dbg_log("far " + ["jump", "call"][+is_call] + " to:", LOG_CPU)
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state("far " + ["jump", "call"][+is_call] + " end");
2016-08-01 22:26:10 +02:00
};
CPU.prototype.get_tss_stack_addr = function(dpl)
{
if(this.tss_size_32)
2016-08-01 22:26:10 +02:00
{
var tss_stack_addr = (dpl << 3) + 4 | 0;
if((tss_stack_addr + 5 | 0) > this.segment_limits[reg_tr])
{
throw this.debug.unimpl("#TS handler");
}
tss_stack_addr = tss_stack_addr + this.segment_offsets[reg_tr] | 0;
dbg_assert((tss_stack_addr & 0xFFF) <= 0x1000 - 6);
2016-08-01 22:26:10 +02:00
}
else
{
var tss_stack_addr = (dpl << 2) + 2 | 0;
2016-08-01 22:26:10 +02:00
if((tss_stack_addr + 5 | 0) > this.segment_limits[reg_tr])
{
throw this.debug.unimpl("#TS handler");
}
tss_stack_addr = tss_stack_addr + this.segment_offsets[reg_tr] | 0;
dbg_assert((tss_stack_addr & 0xFFF) <= 0x1000 - 4);
}
2016-08-01 22:26:10 +02:00
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
2017-07-06 01:59:48 +02:00
if(this.paging[0])
2016-08-01 22:26:10 +02:00
{
tss_stack_addr = this.translate_address_system_read(tss_stack_addr);
}
return tss_stack_addr;
};
2017-04-06 03:34:26 +02:00
CPU.prototype.do_task_switch = function(selector, error_code)
{
2017-06-02 18:00:35 +02:00
dbg_assert(this.tss_size_32, "TODO");
2016-08-01 22:26:10 +02:00
dbg_log("do_task_switch sel=" + h(selector), LOG_CPU);
var descriptor = this.lookup_segment_selector(selector);
dbg_assert((descriptor.type | 2) === 3 || (descriptor.type | 2) === 0xb);
var tss_is_16 = descriptor.type <= 3;
var tss_is_busy = (descriptor.type & 2) === 2;
if(!descriptor.is_valid || descriptor.is_null || !descriptor.from_gdt)
{
throw this.debug.unimpl("#GP handler");
}
if((descriptor.access & 31) === 0xB)
{
// is busy
throw this.debug.unimpl("#GP handler");
}
if(!descriptor.is_present)
{
throw this.debug.unimpl("#NP handler");
}
if(descriptor.effective_limit < 103)
{
throw this.debug.unimpl("#NP handler");
}
var tsr_size = this.segment_limits[reg_tr];
var tsr_offset = this.segment_offsets[reg_tr];
var old_eflags = this.get_eflags();
if(tss_is_busy)
{
old_eflags &= ~flag_nt;
}
this.writable_or_pagefault(tsr_offset, 0x66);
//this.safe_write32(tsr_offset + TSR_CR3, this.cr[3]);
2016-08-01 23:22:38 +02:00
// TODO: Write 16 bit values if old tss is 16 bit
this.safe_write32(tsr_offset + TSR_EIP, this.get_real_eip());
this.safe_write32(tsr_offset + TSR_EFLAGS, old_eflags);
this.safe_write32(tsr_offset + TSR_EAX, this.reg32s[reg_eax]);
this.safe_write32(tsr_offset + TSR_ECX, this.reg32s[reg_ecx]);
this.safe_write32(tsr_offset + TSR_EDX, this.reg32s[reg_edx]);
this.safe_write32(tsr_offset + TSR_EBX, this.reg32s[reg_ebx]);
this.safe_write32(tsr_offset + TSR_ESP, this.reg32s[reg_esp]);
this.safe_write32(tsr_offset + TSR_EBP, this.reg32s[reg_ebp]);
this.safe_write32(tsr_offset + TSR_ESI, this.reg32s[reg_esi]);
this.safe_write32(tsr_offset + TSR_EDI, this.reg32s[reg_edi]);
this.safe_write32(tsr_offset + TSR_ES, this.sreg[reg_es]);
this.safe_write32(tsr_offset + TSR_CS, this.sreg[reg_cs]);
this.safe_write32(tsr_offset + TSR_SS, this.sreg[reg_ss]);
this.safe_write32(tsr_offset + TSR_DS, this.sreg[reg_ds]);
this.safe_write32(tsr_offset + TSR_FS, this.sreg[reg_fs]);
this.safe_write32(tsr_offset + TSR_GS, this.sreg[reg_gs]);
//this.safe_write32(tsr_offset + TSR_LDT, this.sreg[reg_ldtr]);
if(true /* is jump or call or int */)
{
// mark as busy
2016-08-02 04:15:24 +02:00
this.write8(descriptor.table_offset + 5 | 0, this.read8(descriptor.table_offset + 5 | 0) | 2);
}
//var new_tsr_size = descriptor.effective_limit;
var new_tsr_offset = descriptor.base;
dbg_assert(!tss_is_16, "unimplemented");
if(true /* is call or int */)
{
this.safe_write16(new_tsr_offset + TSR_BACKLINK, this.sreg[reg_tr]);
}
var new_cr3 = this.safe_read32s(new_tsr_offset + TSR_CR3);
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_vm;
var new_eip = this.safe_read32s(new_tsr_offset + TSR_EIP);
var new_cs = this.safe_read16(new_tsr_offset + TSR_CS);
var info = this.lookup_segment_selector(new_cs);
if(info.is_null)
{
dbg_log("null cs", LOG_CPU);
throw this.debug.unimpl("#TS handler");
}
if(!info.is_valid)
{
dbg_log("invalid cs: " + h(selector), LOG_CPU);
throw this.debug.unimpl("#TS handler");
}
if(info.is_system)
{
throw this.debug.unimpl("#TS handler");
}
if(!info.is_executable)
{
throw this.debug.unimpl("#TS handler");
}
if(info.dc_bit && info.dpl > info.rpl)
{
dbg_log("cs conforming and dpl > rpl: " + h(selector), LOG_CPU);
throw this.debug.unimpl("#TS handler");
}
if(!info.dc_bit && info.dpl !== info.rpl)
{
dbg_log("cs non-conforming and dpl != rpl: " + h(selector), LOG_CPU);
throw this.debug.unimpl("#TS handler");
}
if(!info.is_present)
{
dbg_log("#NP for loading not-present in cs sel=" + h(selector, 4), LOG_CPU);
throw this.debug.unimpl("#TS handler");
}
this.segment_is_null[reg_cs] = 0;
this.segment_limits[reg_cs] = info.effective_limit;
this.segment_offsets[reg_cs] = info.base;
this.sreg[reg_cs] = new_cs;
this.cpl = info.dpl;
this.cpl_changed();
dbg_assert((this.sreg[reg_cs] & 3) === this.cpl);
dbg_assert((new_eip >>> 0) <= info.effective_limit, "todo: #gp");
this.update_cs_size(info.size);
var new_eflags = this.safe_read32s(new_tsr_offset + TSR_EFLAGS);
if(true /* is call or int */)
{
this.safe_write32(tsr_offset + TSR_BACKLINK, selector);
new_eflags |= flag_nt;
}
if(new_eflags & flag_vm)
{
throw this.debug.unimpl("task switch to VM mode");
}
this.update_eflags(new_eflags);
2015-12-31 00:31:08 +01:00
if(true /* call or int */)
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_nt;
}
2015-12-31 00:31:08 +01:00
var new_ldt = this.safe_read16(new_tsr_offset + TSR_LDT);
this.load_ldt(new_ldt);
this.reg32s[reg_eax] = this.safe_read32s(new_tsr_offset + TSR_EAX);
this.reg32s[reg_ecx] = this.safe_read32s(new_tsr_offset + TSR_ECX);
this.reg32s[reg_edx] = this.safe_read32s(new_tsr_offset + TSR_EDX);
this.reg32s[reg_ebx] = this.safe_read32s(new_tsr_offset + TSR_EBX);
this.reg32s[reg_esp] = this.safe_read32s(new_tsr_offset + TSR_ESP);
this.reg32s[reg_ebp] = this.safe_read32s(new_tsr_offset + TSR_EBP);
this.reg32s[reg_esi] = this.safe_read32s(new_tsr_offset + TSR_ESI);
this.reg32s[reg_edi] = this.safe_read32s(new_tsr_offset + TSR_EDI);
this.switch_seg(reg_es, this.safe_read16(new_tsr_offset + TSR_ES));
this.switch_seg(reg_ss, this.safe_read16(new_tsr_offset + TSR_SS));
this.switch_seg(reg_ds, this.safe_read16(new_tsr_offset + TSR_DS));
this.switch_seg(reg_fs, this.safe_read16(new_tsr_offset + TSR_FS));
this.switch_seg(reg_gs, this.safe_read16(new_tsr_offset + TSR_GS));
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.get_seg(reg_cs) + new_eip | 0;
this.segment_offsets[reg_tr] = descriptor.base;
this.segment_limits[reg_tr] = descriptor.effective_limit;
this.sreg[reg_tr] = selector;
this.cr[3] = new_cr3;
dbg_assert((this.cr[3] & 0xFFF) === 0);
this.clear_tlb();
this.cr[0] |= CR0_TS;
if(error_code !== false)
{
if(tss_is_16)
{
this.push16(error_code & 0xFFFF);
}
else
{
this.push32(error_code);
}
}
};
2014-12-21 18:11:22 +01:00
CPU.prototype.hlt_op = function()
{
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0])
{
this.trigger_gp(0);
}
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
if((this.flags[0] & flag_interrupt) === 0)
{
this.debug.show("cpu halted");
this.bus.send("cpu-event-halt");
if(DEBUG) this.debug.dump_regs();
throw "HALT";
2013-11-07 21:30:18 +01:00
}
else
{
// get out of here and into hlt_loop
this.in_hlt = true;
2017-04-06 02:57:24 +02:00
//if(false) // possibly unsafe, test in safari
//{
// this.hlt_loop();
// this.diverged();
// if(this.in_hlt)
// {
// throw MAGIC_CPU_EXCEPTION;
// }
//}
//else
{
throw MAGIC_CPU_EXCEPTION;
}
}
};
2013-11-07 21:30:18 +01:00
// assumes ip to point to the byte before the next instruction
2014-12-21 18:11:22 +01:00
CPU.prototype.raise_exception = function(interrupt_nr)
2013-11-07 21:30:18 +01:00
{
//if(DEBUG && interrupt_nr !== 7)
//{
// // show interesting exceptions
// dbg_log("Exception " + h(interrupt_nr) + " at " + h(this.previous_ip >>> 0, 8) + " (cs=" + h(this.sreg[reg_cs], 4) + ")", LOG_CPU);
// dbg_trace(LOG_CPU);
2017-04-02 18:03:50 +02:00
// this.debug.dump_regs();
// this.debug.dump_state();
//}
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.call_interrupt_vector(interrupt_nr, false, false, 0);
2014-05-06 20:24:46 +02:00
throw MAGIC_CPU_EXCEPTION;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.raise_exception_with_code = function(interrupt_nr, error_code)
2013-11-07 21:30:18 +01:00
{
dbg_assert(typeof error_code === "number");
//if(DEBUG)
//{
// dbg_log("Exception " + h(interrupt_nr) + " err=" + h(error_code) + " at " + h(this.previous_ip >>> 0, 8) + " (cs=" + h(this.sreg[reg_cs], 4) + ")", LOG_CPU);
// dbg_trace(LOG_CPU);
2017-04-02 18:03:50 +02:00
// this.debug.dump_regs();
//}
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.call_interrupt_vector(interrupt_nr, false, true, error_code);
2014-05-06 20:24:46 +02:00
throw MAGIC_CPU_EXCEPTION;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_de = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.raise_exception(0);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_ud = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.raise_exception(6);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_nm = function()
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.raise_exception(7);
};
2016-08-01 22:26:10 +02:00
CPU.prototype.trigger_ts = function(code)
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
2016-08-01 22:26:10 +02:00
this.raise_exception_with_code(10, code);
};
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_gp = function(code)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.raise_exception_with_code(13, code);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_np = function(code)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.raise_exception_with_code(11, code);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_ss = function(code)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.raise_exception_with_code(12, code);
};
2013-11-07 21:30:18 +01:00
// used before fpu instructions
CPU.prototype.task_switch_test = function()
{
if(this.cr[0] & (CR0_EM | CR0_TS))
{
this.trigger_nm();
}
};
2017-06-20 18:05:38 +02:00
// used before mmx instructions
CPU.prototype.task_switch_test_mmx = function()
{
if(this.cr[0] & (CR0_EM | CR0_TS))
{
if(this.cr[0] & CR0_TS)
{
this.trigger_nm();
}
else
{
this.trigger_ud();
}
}
};
CPU.prototype.todo = function()
{
if(DEBUG)
{
dbg_trace();
throw "TODO";
}
this.trigger_ud();
};
CPU.prototype.undefined_instruction = function()
{
dbg_assert(false, "Possible fault: undefined instruction");
this.trigger_ud();
};
CPU.prototype.unimplemented_sse = function()
{
dbg_log("No SSE", LOG_CPU);
dbg_assert(false);
this.trigger_ud();
};
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
2017-07-06 01:59:48 +02:00
CPU.prototype.unimplemented_sse_wasm = function()
2014-11-01 13:59:32 +01:00
{
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] -= 1;
this.table0F_32[this.read_op0F()](this);
2014-11-01 13:59:32 +01:00
};
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
2017-07-06 01:59:48 +02:00
CPU.prototype.get_seg_prefix_ds = function(offset)
2014-11-01 13:59:32 +01:00
{
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
2017-07-06 01:59:48 +02:00
offset = offset || 0;
return this.get_seg_prefix(reg_ds) + offset | 0;
2014-11-01 13:59:32 +01:00
};
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
2017-07-06 01:59:48 +02:00
CPU.prototype.get_seg_prefix_ss = function(offset)
2014-11-01 13:59:32 +01:00
{
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
2017-07-06 01:59:48 +02:00
offset = offset || 0;
return this.get_seg_prefix(reg_ss) + offset | 0;
};
CPU.prototype.get_seg_prefix_cs = function(offset)
{
offset = offset || 0;
return this.get_seg_prefix(reg_cs) + offset | 0;
2014-11-01 13:59:32 +01:00
};
2013-11-07 21:30:18 +01:00
/**
* Get segment base by prefix or default
* @param {number} default_segment
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.get_seg_prefix = function(default_segment /*, offset*/)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
var prefix = this.prefixes[0] & PREFIX_MASK_SEGMENT;
if(prefix)
2013-11-07 21:30:18 +01:00
{
if(prefix === SEG_PREFIX_ZERO)
{
return 0;
}
else
{
return this.get_seg(prefix - 1 /*, offset*/);
}
2013-11-07 21:30:18 +01:00
}
else
{
return this.get_seg(default_segment /*, offset*/);
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
/**
* Get segment base
* @param {number} segment
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.get_seg = function(segment /*, offset*/)
2013-11-07 21:30:18 +01:00
{
dbg_assert(segment >= 0 && segment < 8);
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
2017-07-06 01:59:48 +02:00
if(this.protected_mode[0])
2013-11-07 21:30:18 +01:00
{
if(this.segment_is_null[segment])
2013-11-07 21:30:18 +01:00
{
dbg_assert(segment !== reg_cs && segment !== reg_ss);
2017-04-06 02:57:24 +02:00
dbg_trace();
dbg_log("#gp Use null segment: " + segment + " sel=" + h(this.sreg[segment], 4), LOG_CPU);
2013-11-07 21:30:18 +01:00
this.trigger_gp(0);
}
// TODO:
2013-11-07 21:30:18 +01:00
// - validate segment limits
// - validate if segment is writable
}
return this.segment_offsets[segment];
};
2013-11-07 21:30:18 +01:00
CPU.prototype.read_e8 = function()
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
return this.safe_read8(this.modrm_resolve(modrm_byte));
} else {
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
2017-07-06 01:59:48 +02:00
return this.wm.funcs['_read_e8_partial_branch']();
}
};
CPU.prototype.read_e8s = function()
{
return this.read_e8() << 24 >> 24;
};
CPU.prototype.read_e16 = function()
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
return this.safe_read16(this.modrm_resolve(modrm_byte));
} else {
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
2017-07-06 01:59:48 +02:00
return this.reg16[modrm_byte << 1 & 14];
}
};
CPU.prototype.read_e16s = function()
{
return this.read_e16() << 16 >> 16;
};
CPU.prototype.read_e32s = function()
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
return this.safe_read32s(this.modrm_resolve(modrm_byte));
} else {
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
2017-07-06 01:59:48 +02:00
return this.reg32s[modrm_byte & 7];
}
};
CPU.prototype.read_e32 = function()
{
return this.read_e32s() >>> 0;
};
2017-06-20 18:19:24 +02:00
CPU.prototype.read_mmx_mem32s = function()
{
if(this.modrm_byte[0] < 0xC0) {
return this.safe_read32s(this.modrm_resolve(this.modrm_byte[0]));
} else {
// Returning lower dword of qword
return this.reg_mmxs[2 * (this.modrm_byte[0] & 7)];
}
};
2017-06-20 18:19:24 +02:00
CPU.prototype.read_mmx_mem64s = function()
{
if(this.modrm_byte[0] < 0xC0) {
return this.safe_read64s(this.modrm_resolve(this.modrm_byte[0]));
} else {
return this.create_atom64s(
this.reg_mmxs[2 * (this.modrm_byte[0] & 7)],
this.reg_mmxs[2 * (this.modrm_byte[0] & 7) + 1]
);
}
};
CPU.prototype.read_xmm_mem64s = function()
{
if(this.modrm_byte[0] < 0xC0) {
return this.safe_read64s(this.modrm_resolve(this.modrm_byte[0]));
} else {
let i = (this.modrm_byte[0] & 7) << 2;
return this.create_atom64s(
this.reg_xmm32s[i],
this.reg_xmm32s[i | 1]
);
}
};
CPU.prototype.read_xmm_mem128s = function()
{
if(this.modrm_byte[0] < 0xC0) {
return this.safe_read128s_aligned(this.modrm_resolve(this.modrm_byte[0]));
} else {
let i = (this.modrm_byte[0] & 7) << 2;
return this.create_atom128s(
this.reg_xmm32s[i],
this.reg_xmm32s[i | 1],
this.reg_xmm32s[i | 2],
this.reg_xmm32s[i | 3]
);
}
};
CPU.prototype.read_xmm_mem128s_unaligned = function()
{
if(this.modrm_byte[0] < 0xC0) {
return this.safe_read128s_unaligned(this.modrm_resolve(this.modrm_byte[0]));
} else {
let i = (this.modrm_byte[0] & 7) << 2;
return this.create_atom128s(
this.reg_xmm32s[i],
this.reg_xmm32s[i | 1],
this.reg_xmm32s[i | 2],
this.reg_xmm32s[i | 3]
);
}
};
CPU.prototype.set_e8 = function(value)
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
var addr = this.modrm_resolve(modrm_byte);
this.safe_write8(addr, value);
} else {
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
2017-07-06 01:59:48 +02:00
this.reg8[modrm_byte << 2 & 0xC | modrm_byte >> 2 & 1] = value;
}
};
CPU.prototype.set_e16 = function(value)
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
var addr = this.modrm_resolve(modrm_byte);
this.safe_write16(addr, value);
} else {
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
2017-07-06 01:59:48 +02:00
this.reg16[modrm_byte << 1 & 14] = value;
}
};
CPU.prototype.set_e32 = function(value)
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
var addr = this.modrm_resolve(modrm_byte);
this.safe_write32(addr, value);
} else {
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
2017-07-06 01:59:48 +02:00
this.reg32s[modrm_byte & 7] = value;
}
};
2017-06-20 19:21:17 +02:00
CPU.prototype.set_mmx_mem64s = function(low, high)
{
if(this.modrm_byte[0] < 0xC0) {
var addr = this.modrm_resolve(this.modrm_byte[0]);
2017-06-20 19:21:17 +02:00
this.safe_write64(addr, low, high);
} else {
this.reg_mmxs[2 * (this.modrm_byte[0] & 7)] = low;
this.reg_mmxs[2 * (this.modrm_byte[0] & 7) + 1] = high;
}
};
CPU.prototype.read_write_e8 = function()
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
var virt_addr = this.modrm_resolve(modrm_byte);
this.phys_addr[0] = this.translate_address_write(virt_addr);
return this.read8(this.phys_addr[0]);
} else {
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
2017-07-06 01:59:48 +02:00
return this.reg8[modrm_byte << 2 & 0xC | modrm_byte >> 2 & 1];
}
};
CPU.prototype.write_e8 = function(value)
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
this.write8(this.phys_addr[0], value);
}
else {
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
2017-07-06 01:59:48 +02:00
this.reg8[modrm_byte << 2 & 0xC | modrm_byte >> 2 & 1] = value;
}
};
CPU.prototype.read_write_e16 = function()
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
var virt_addr = this.modrm_resolve(modrm_byte);
this.phys_addr[0] = this.translate_address_write(virt_addr);
if(this.paging[0] && (virt_addr & 0xFFF) === 0xFFF) {
this.phys_addr_high[0] = this.translate_address_write(virt_addr + 1 | 0);
dbg_assert(this.phys_addr_high[0]);
return this.virt_boundary_read16(this.phys_addr[0], this.phys_addr_high[0]);
} else {
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
2017-07-06 01:59:48 +02:00
this.phys_addr_high[0] = 0;
return this.read16(this.phys_addr[0]);
}
} else {
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
2017-07-06 01:59:48 +02:00
return this.reg16[modrm_byte << 1 & 14];
}
};
CPU.prototype.write_e16 = function(value)
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
if(this.phys_addr_high[0]) {
this.virt_boundary_write16(this.phys_addr[0], this.phys_addr_high[0], value);
} else {
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
2017-07-06 01:59:48 +02:00
this.write16(this.phys_addr[0], value);
}
} else {
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
2017-07-06 01:59:48 +02:00
this.reg16[modrm_byte << 1 & 14] = value;
}
};
CPU.prototype.read_write_e32 = function()
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
var virt_addr = this.modrm_resolve(modrm_byte);
this.phys_addr[0] = this.translate_address_write(virt_addr);
if(this.paging[0] && (virt_addr & 0xFFF) >= 0xFFD) {
//this.phys_addr_high[0] = this.translate_address_write(virt_addr + 3 | 0);
this.phys_addr_high[0] = this.translate_address_write(virt_addr + 3 & ~3) | (virt_addr + 3) & 3;
dbg_assert(this.phys_addr_high[0]);
return this.virt_boundary_read32s(this.phys_addr[0], this.phys_addr_high[0]);
} else {
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
2017-07-06 01:59:48 +02:00
this.phys_addr_high[0] = 0;
return this.read32s(this.phys_addr[0]);
}
} else {
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
2017-07-06 01:59:48 +02:00
return this.reg32s[modrm_byte & 7];
}
};
CPU.prototype.write_e32 = function(value)
{
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
2017-07-06 01:59:48 +02:00
var modrm_byte = this.modrm_byte[0];
if(modrm_byte < 0xC0) {
if(this.phys_addr_high[0]) {
this.virt_boundary_write32(this.phys_addr[0], this.phys_addr_high[0], value);
} else {
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
2017-07-06 01:59:48 +02:00
this.write32(this.phys_addr[0], value);
}
} else {
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
2017-07-06 01:59:48 +02:00
this.reg32s[modrm_byte & 7] = value;
}
};
CPU.prototype.read_reg_e16 = function()
{
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
2017-07-06 01:59:48 +02:00
return this.reg16[this.modrm_byte[0] << 1 & 14];
};
CPU.prototype.write_reg_e16 = function(value)
{
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
2017-07-06 01:59:48 +02:00
this.reg16[this.modrm_byte[0] << 1 & 14] = value;
};
CPU.prototype.read_reg_e32s = function()
{
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
2017-07-06 01:59:48 +02:00
return this.reg32s[this.modrm_byte[0] & 7];
};
CPU.prototype.write_reg_e32 = function(value)
{
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
2017-07-06 01:59:48 +02:00
this.reg32s[this.modrm_byte[0] & 7] = value;
};
CPU.prototype.read_g8 = function()
{
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
2017-07-06 01:59:48 +02:00
return this.reg8[this.modrm_byte[0] >> 1 & 0xC | this.modrm_byte[0] >> 5 & 1];
};
CPU.prototype.write_g8 = function(value)
{
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
2017-07-06 01:59:48 +02:00
this.reg8[this.modrm_byte[0] >> 1 & 0xC | this.modrm_byte[0] >> 5 & 1] = value;
};
CPU.prototype.read_g16 = function()
{
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
2017-07-06 01:59:48 +02:00
return this.reg16[this.modrm_byte[0] >> 2 & 14];
};
CPU.prototype.read_g16s = function()
{
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
2017-07-06 01:59:48 +02:00
return this.reg16s[this.modrm_byte[0] >> 2 & 14];
};
CPU.prototype.write_g16 = function(value)
{
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
2017-07-06 01:59:48 +02:00
this.reg16[this.modrm_byte[0] >> 2 & 14] = value;
};
CPU.prototype.read_g32s = function()
{
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
2017-07-06 01:59:48 +02:00
return this.reg32s[this.modrm_byte[0] >> 3 & 7];
};
CPU.prototype.write_g32 = function(value)
{
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
2017-07-06 01:59:48 +02:00
this.reg32[this.modrm_byte[0] >> 3 & 7] = value;
};
CPU.prototype.read_xmm64s = function()
{
return this.create_atom64s(
this.reg_xmm32s[(this.modrm_byte[0] >> 3 & 7) << 2],
this.reg_xmm32s[(this.modrm_byte[0] >> 3 & 7) << 2 | 1]
);
};
CPU.prototype.read_xmm128s = function()
{
let i = (this.modrm_byte[0] >> 3 & 7) << 2;
return this.create_atom128s(
this.reg_xmm32s[i | 0],
this.reg_xmm32s[i | 1],
this.reg_xmm32s[i | 2],
this.reg_xmm32s[i | 3]
);
};
2017-06-20 19:21:17 +02:00
CPU.prototype.read_mmx64s = function()
{
return this.create_atom64s(
this.reg_mmxs[2 * (this.modrm_byte[0] >> 3 & 7)],
this.reg_mmxs[2 * (this.modrm_byte[0] >> 3 & 7) + 1]
);
};
2017-06-20 19:21:17 +02:00
CPU.prototype.write_mmx64s = function(low, high)
{
this.reg_mmxs[2 * (this.modrm_byte[0] >> 3 & 7)] = low;
this.reg_mmxs[2 * (this.modrm_byte[0] >> 3 & 7) + 1] = high;
};
CPU.prototype.write_xmm64 = function(low, high)
{
let i = (this.modrm_byte[0] >> 3 & 7) << 2;
this.reg_xmm32s[i] = low;
this.reg_xmm32s[i + 1] = high;
};
CPU.prototype.write_xmm128s = function(d0, d1, d2, d3)
{
let i = (this.modrm_byte[0] >> 3 & 7) << 2;
this.reg_xmm32s[i] = d0;
this.reg_xmm32s[i + 1] = d1;
this.reg_xmm32s[i + 2] = d2;
this.reg_xmm32s[i + 3] = d3;
};
CPU.prototype.pic_call_irq = function(int)
{
try
{
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
2017-07-06 01:59:48 +02:00
this.previous_ip[0] = this.instruction_pointer[0];
this.call_interrupt_vector(int, false, false, 0);
}
catch(e)
{
this.exception_cleanup(e);
}
};
2014-12-21 18:11:22 +01:00
CPU.prototype.handle_irqs = function()
2013-11-07 21:30:18 +01:00
{
dbg_assert(!this.page_fault);
2013-12-28 23:21:43 +01:00
this.diverged();
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
2017-07-06 01:59:48 +02:00
if((this.flags[0] & flag_interrupt) && !this.page_fault)
{
if(this.devices.pic)
2013-11-07 21:30:18 +01:00
{
2017-03-07 23:39:58 +01:00
this.devices.pic.acknowledge_irq();
2013-11-07 21:30:18 +01:00
}
if(this.devices.apic)
{
2017-03-07 23:39:58 +01:00
this.devices.apic.acknowledge_irq();
}
}
};
CPU.prototype.device_raise_irq = function(i)
{
dbg_assert(arguments.length === 1);
if(this.devices.pic)
{
this.devices.pic.set_irq(i);
}
if(this.devices.ioapic)
{
this.devices.ioapic.set_irq(i);
}
};
CPU.prototype.device_lower_irq = function(i)
{
if(this.devices.pic)
{
this.devices.pic.clear_irq(i);
}
if(this.devices.ioapic)
{
this.devices.ioapic.clear_irq(i);
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.test_privileges_for_io = function(port, size)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(this.protected_mode[0] && (this.cpl[0] > this.getiopl() || (this.flags[0] & flag_vm)))
2013-11-25 19:57:46 +01:00
{
if(!this.tss_size_32)
{
dbg_log("#GP for port io, 16-bit TSS port=" + h(port) + " size=" + size, LOG_CPU);
CPU_LOG_VERBOSE && this.debug.dump_state();
this.trigger_gp(0);
}
var tsr_size = this.segment_limits[reg_tr];
var tsr_offset = this.segment_offsets[reg_tr];
if(tsr_size >= 0x67)
{
2016-08-01 23:22:38 +02:00
dbg_assert((tsr_offset + 0x64 + 2 & 0xFFF) < 0xFFF);
2016-08-02 04:15:24 +02:00
var iomap_base = this.read16(this.translate_address_system_read(tsr_offset + 0x64 + 2 | 0)),
high_port = port + size - 1 | 0;
if(tsr_size >= (iomap_base + (high_port >> 3) | 0))
{
var mask = ((1 << size) - 1) << (port & 7),
addr = this.translate_address_system_read(tsr_offset + iomap_base + (port >> 3) | 0),
port_info = (mask & 0xFF00) ?
2016-08-02 04:15:24 +02:00
this.read16(addr) : this.read8(addr);
2016-08-01 23:22:38 +02:00
dbg_assert((addr & 0xFFF) < 0xFFF);
if(!(port_info & mask))
{
return;
}
}
}
dbg_log("#GP for port io port=" + h(port) + " size=" + size, LOG_CPU);
2016-10-23 17:37:02 +02:00
CPU_LOG_VERBOSE && this.debug.dump_state();
this.trigger_gp(0);
2013-11-25 19:57:46 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.cpuid = function()
2013-11-07 21:30:18 +01:00
{
// cpuid
// TODO: Fill in with less bogus values
2013-11-07 21:30:18 +01:00
// http://lxr.linux.no/linux+%2a/arch/x86/include/asm/cpufeature.h
2014-01-08 03:22:30 +01:00
// http://www.sandpile.org/x86/cpuid.htm
2017-06-22 18:32:28 +02:00
var eax = 0;
var ecx = 0;
var edx = 0;
var ebx = 0;
2016-02-04 14:25:42 +01:00
var winnt_fix = false;
2014-07-27 00:14:23 +02:00
switch(this.reg32s[reg_eax])
{
case 0:
// maximum supported level
2016-02-04 14:25:42 +01:00
if(winnt_fix)
{
eax = 2;
}
else
{
eax = 5;
}
2014-07-27 00:14:23 +02:00
ebx = 0x756E6547|0; // Genu
edx = 0x49656E69|0; // ineI
ecx = 0x6C65746E|0; // ntel
break;
case 1:
// pentium
eax = 3 | 6 << 4 | 15 << 8;
ebx = 1 << 16 | 8 << 8; // cpu count, clflush size
2015-04-17 23:53:09 +02:00
ecx = 1 << 23 | 1 << 30; // popcnt, rdrand
2016-08-01 23:22:38 +02:00
var vme = 0 << 1;
if(VMWARE_HYPERVISOR_PORT) ecx |= 1 << 31; // hypervisor
2014-07-27 00:14:23 +02:00
edx = (this.fpu ? 1 : 0) | // fpu
2016-08-01 23:22:38 +02:00
vme | 1 << 3 | 1 << 4 | 1 << 5 | // vme, pse, tsc, msr
2017-05-11 12:12:19 +02:00
1 << 8 | 1 << 11 | 1 << 13 | 1 << 15 | // cx8, sep, pge, cmov
1 << 23 | 1 << 24 | 1 << 25 | 1 << 26; // mmx, fxsr, sse1, sse2
2016-08-01 21:43:47 +02:00
if(ENABLE_ACPI && this.apic_enabled)
2016-08-01 21:43:47 +02:00
{
edx |= 1 << 9; // apic
}
2014-07-27 00:14:23 +02:00
break;
case 2:
// Taken from http://siyobik.info.gf/main/reference/instruction/CPUID
eax = 0x665B5001|0;
ebx = 0;
ecx = 0;
edx = 0x007A7000;
break;
2014-12-20 21:36:39 +01:00
case 4:
// from my local machine
switch(this.reg32s[reg_ecx])
{
case 0:
eax = 0x00000121;
ebx = 0x01c0003f;
ecx = 0x0000003f;
2014-12-20 21:36:39 +01:00
edx = 0x00000001;
break;
case 1:
eax = 0x00000122;
ebx = 0x01c0003f;
ecx = 0x0000003f;
2014-12-20 21:36:39 +01:00
edx = 0x00000001;
break;
2014-12-20 21:36:39 +01:00
case 2:
eax = 0x00000143;
ebx = 0x05c0003f;
ecx = 0x00000fff;
2014-12-20 21:36:39 +01:00
edx = 0x00000001;
break;
}
break;
2017-04-06 03:07:22 +02:00
case 5:
// from my local machine
eax = 0x40;
ebx = 0x40;
ecx = 3;
edx = 0x00142120;
break;
2014-07-27 00:14:23 +02:00
case 0x80000000|0:
// maximum supported extended level
eax = 5;
// other registers are reserved
break;
case 0x40000000|0: // hypervisor
if(VMWARE_HYPERVISOR_PORT)
{
// h("Ware".split("").reduce((a, c, i) => a | c.charCodeAt(0) << i * 8, 0))
ebx = 0x61774D56|0; // VMwa
ecx = 0x4D566572|0; // reVM
edx = 0x65726177|0; // ware
}
break;
2014-07-27 00:14:23 +02:00
default:
dbg_log("cpuid: unimplemented eax: " + h(this.reg32[reg_eax]), LOG_CPU);
}
dbg_log("cpuid: eax=" + h(this.reg32[reg_eax], 8) + " cl=" + h(this.reg8[reg_cl], 2), LOG_CPU);
2015-01-05 23:20:27 +01:00
2014-07-27 00:14:23 +02:00
this.reg32s[reg_eax] = eax;
this.reg32s[reg_ecx] = ecx;
this.reg32s[reg_edx] = edx;
this.reg32s[reg_ebx] = ebx;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.update_cs_size = function(new_size)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
new_size = Boolean(new_size);
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
2017-07-06 01:59:48 +02:00
if(Boolean(this.is_32[0]) !== new_size)
2017-03-18 01:03:56 +01:00
{
this.clear_instruction_cache();
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
2017-07-06 01:59:48 +02:00
this.is_32[0] = +new_size;
2017-03-18 01:03:56 +01:00
this.update_operand_size();
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.update_operand_size = function()
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(this.is_32[0])
2013-11-07 21:30:18 +01:00
{
this.table = this.table32;
2013-11-07 21:30:18 +01:00
}
else
{
this.table = this.table16;
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
/**
* @param {number} selector
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.lookup_segment_selector = function(selector)
2013-11-07 21:30:18 +01:00
{
dbg_assert(typeof selector === "number" && selector >= 0 && selector < 0x10000);
2013-11-07 21:30:18 +01:00
var is_gdt = (selector & 4) === 0,
selector_offset = selector & ~7,
info,
table_offset,
table_limit;
info = {
rpl: selector & 3,
from_gdt: is_gdt,
is_null: false,
is_valid: true,
2014-01-08 03:22:30 +01:00
base: 0,
access: 0,
flags: 0,
type: 0,
dpl: 0,
is_system: false,
is_present: false,
is_executable: false,
rw_bit: false,
dc_bit: false,
size: false,
2014-07-27 01:07:51 +02:00
is_conforming_executable: false,
2014-07-27 01:07:51 +02:00
// limit after applying granularity
effective_limit: 0,
2014-01-08 03:22:30 +01:00
is_writable: false,
is_readable: false,
2014-02-11 21:42:28 +01:00
table_offset: 0,
2016-02-07 17:45:55 +01:00
2016-08-01 22:30:38 +02:00
raw0: 0,
2016-02-07 17:45:55 +01:00
raw1: 0,
2013-11-07 21:30:18 +01:00
};
if(is_gdt)
{
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
2017-07-06 01:59:48 +02:00
table_offset = this.gdtr_offset[0];
table_limit = this.gdtr_size[0];
2013-11-07 21:30:18 +01:00
}
else
{
table_offset = this.segment_offsets[reg_ldtr];
table_limit = this.segment_limits[reg_ldtr];
2013-11-07 21:30:18 +01:00
}
2017-05-09 18:58:33 +02:00
if(is_gdt && selector_offset === 0)
2013-11-07 21:30:18 +01:00
{
info.is_null = true;
return info;
}
// limit is the number of entries in the table minus one
2014-07-27 01:07:51 +02:00
if((selector | 7) > table_limit)
2013-11-07 21:30:18 +01:00
{
dbg_log("Selector " + h(selector, 4) + " is outside of the " +
(is_gdt ? "g" : "l") + "dt limits", LOG_CPU);
2013-11-07 21:30:18 +01:00
info.is_valid = false;
return info;
}
table_offset = table_offset + selector_offset | 0;
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
if(this.paging[0])
2013-11-07 21:30:18 +01:00
{
table_offset = this.translate_address_system_read(table_offset);
2013-11-07 21:30:18 +01:00
}
2014-02-11 21:42:28 +01:00
info.table_offset = table_offset;
2013-11-07 21:30:18 +01:00
2016-08-02 04:15:24 +02:00
info.base = this.read16(table_offset + 2 | 0) | this.read8(table_offset + 4 | 0) << 16 |
this.read8(table_offset + 7 | 0) << 24;
info.access = this.read8(table_offset + 5 | 0);
info.flags = this.read8(table_offset + 6 | 0) >> 4;
2016-08-02 04:15:24 +02:00
info.raw0 = this.read32s(table_offset | 0);
info.raw1 = this.read32s(table_offset + 4 | 0);
2016-02-07 17:45:55 +01:00
2016-08-02 04:15:24 +02:00
//this.write8(table_offset + 5 | 0, info.access | 1);
2013-11-07 21:30:18 +01:00
// used if system
info.type = info.access & 0xF;
info.dpl = info.access >> 5 & 3;
info.is_system = (info.access & 0x10) === 0;
info.is_present = (info.access & 0x80) === 0x80;
info.is_executable = (info.access & 8) === 8;
info.rw_bit = (info.access & 2) === 2;
info.dc_bit = (info.access & 4) === 4;
info.is_conforming_executable = info.dc_bit && info.is_executable;
2013-11-07 21:30:18 +01:00
info.size = (info.flags & 4) === 4;
2016-08-02 04:15:24 +02:00
var limit = this.read16(table_offset) |
(this.read8(table_offset + 6 | 0) & 0xF) << 16;
2013-11-07 21:30:18 +01:00
2014-07-27 01:07:51 +02:00
if(info.flags & 8)
2013-11-07 21:30:18 +01:00
{
2014-07-27 01:07:51 +02:00
// granularity set
info.effective_limit = (limit << 12 | 0xFFF) >>> 0;
2013-11-07 21:30:18 +01:00
}
else
{
2014-07-27 01:07:51 +02:00
info.effective_limit = limit;
2013-11-07 21:30:18 +01:00
}
info.is_writable = info.rw_bit && !info.is_executable;
info.is_readable = info.rw_bit || !info.is_executable;
return info;
};
2013-11-07 21:30:18 +01:00
/**
* @param {number} reg
* @param {number} selector
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.switch_seg = function(reg, selector)
2013-11-07 21:30:18 +01:00
{
dbg_assert(reg >= 0 && reg <= 5);
dbg_assert(typeof selector === "number" && selector < 0x10000 && selector >= 0);
2014-11-01 13:59:32 +01:00
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
2017-07-06 01:59:48 +02:00
if(!this.protected_mode[0] || this.vm86_mode())
2013-11-07 21:30:18 +01:00
{
this.sreg[reg] = selector;
this.segment_is_null[reg] = 0;
this.segment_offsets[reg] = selector << 4;
2015-12-30 19:57:20 +01:00
if(reg === reg_ss)
{
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
2017-07-06 01:59:48 +02:00
this.stack_size_32[0] = +false;
}
2013-11-07 21:30:18 +01:00
return;
}
var info = this.lookup_segment_selector(selector);
2013-11-07 21:30:18 +01:00
if(reg === reg_ss)
{
if(info.is_null)
{
dbg_log("#GP for loading 0 in SS sel=" + h(selector, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_gp(0);
2013-11-07 21:30:18 +01:00
}
if(!info.is_valid ||
info.is_system ||
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
2017-07-06 01:59:48 +02:00
info.rpl !== this.cpl[0] ||
!info.is_writable ||
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
2017-07-06 01:59:48 +02:00
info.dpl !== this.cpl[0])
2013-11-07 21:30:18 +01:00
{
dbg_log("#GP for loading invalid in SS sel=" + h(selector, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_gp(selector & ~3);
2013-11-07 21:30:18 +01:00
}
2013-11-07 21:30:18 +01:00
if(!info.is_present)
{
dbg_log("#SS for loading non-present in SS sel=" + h(selector, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_ss(selector & ~3);
2013-11-07 21:30:18 +01:00
}
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
2017-07-06 01:59:48 +02:00
this.stack_size_32[0] = info.size;
2013-11-07 21:30:18 +01:00
}
else if(reg === reg_cs)
{
2016-08-01 22:26:10 +02:00
// handled by switch_cs_real_mode, far_return or far_jump
dbg_assert(false);
2013-11-07 21:30:18 +01:00
}
else
{
// es, ds, fs, gs
if(info.is_null)
{
//dbg_log("0 loaded in seg=" + reg + " sel=" + h(selector, 4), LOG_CPU);
//dbg_trace(LOG_CPU);
this.sreg[reg] = selector;
this.segment_is_null[reg] = 1;
return;
2013-11-07 21:30:18 +01:00
}
if(!info.is_valid ||
info.is_system ||
!info.is_readable ||
(!info.is_conforming_executable &&
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
2017-07-06 01:59:48 +02:00
(info.rpl > info.dpl || this.cpl[0] > info.dpl))
) {
dbg_log("#GP for loading invalid in seg " + reg + " sel=" + h(selector, 4), LOG_CPU);
2016-08-01 23:22:38 +02:00
this.debug.dump_state();
2017-04-02 18:03:50 +02:00
this.debug.dump_regs();
dbg_trace(LOG_CPU);
this.trigger_gp(selector & ~3);
2013-11-07 21:30:18 +01:00
}
2013-11-07 21:30:18 +01:00
if(!info.is_present)
{
dbg_log("#NP for loading not-present in seg " + reg + " sel=" + h(selector, 4), LOG_CPU);
dbg_trace(LOG_CPU);
this.trigger_np(selector & ~3);
2013-11-07 21:30:18 +01:00
}
}
this.segment_is_null[reg] = 0;
2014-07-27 01:07:51 +02:00
this.segment_limits[reg] = info.effective_limit;
//this.segment_infos[reg] = 0; // TODO
this.segment_offsets[reg] = info.base;
this.sreg[reg] = selector;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.load_tr = function(selector)
2013-11-07 21:30:18 +01:00
{
var info = this.lookup_segment_selector(selector);
2013-11-07 21:30:18 +01:00
dbg_assert(info.is_valid);
2016-08-01 23:22:38 +02:00
//dbg_log("load tr: " + h(selector, 4) + " offset=" + h(info.base >>> 0, 8) + " limit=" + h(info.effective_limit >>> 0, 8), LOG_CPU);
2013-11-07 21:30:18 +01:00
if(!info.from_gdt)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("TR can only be loaded from GDT");
2013-11-07 21:30:18 +01:00
}
if(info.is_null)
{
dbg_log("#GP(0) | tried to load null selector (ltr)");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
if(!info.is_system)
{
dbg_log("#GP | ltr: not a system entry");
2017-04-06 02:57:24 +02:00
throw this.debug.unimpl("#GP handler (happens when running kvm-unit-test without ACPI)");
2013-11-07 21:30:18 +01:00
}
if(info.type !== 9 && info.type !== 1)
2013-11-07 21:30:18 +01:00
{
// 0xB: busy 386 TSS (GP)
2017-04-06 02:57:24 +02:00
// 0x9: 386 TSS
// 0x3: busy 286 TSS (GP)
// 0x1: 286 TSS (??)
dbg_log("#GP | ltr: invalid type (type = " + h(info.type) + ")");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
2017-04-06 02:57:24 +02:00
if(!info.is_present)
{
dbg_log("#NT | present bit not set (ltr)");
throw this.debug.unimpl("#NT handler");
}
this.tss_size_32 = info.type === 9;
this.segment_offsets[reg_tr] = info.base;
2014-07-27 01:07:51 +02:00
this.segment_limits[reg_tr] = info.effective_limit;
this.sreg[reg_tr] = selector;
2014-02-11 21:42:28 +01:00
// Mark task as busy
2016-08-02 04:15:24 +02:00
this.write8(info.table_offset + 5 | 0, this.read8(info.table_offset + 5 | 0) | 2);
2013-11-07 21:30:18 +01:00
2014-07-27 01:07:51 +02:00
//dbg_log("tsr at " + h(info.base) + "; (" + info.effective_limit + " bytes)");
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.load_ldt = function(selector)
2013-11-07 21:30:18 +01:00
{
var info = this.lookup_segment_selector(selector);
2013-11-07 21:30:18 +01:00
if(info.is_null)
{
// invalid
this.segment_offsets[reg_ldtr] = 0;
this.segment_limits[reg_ldtr] = 0;
2013-11-07 21:30:18 +01:00
return;
}
dbg_assert(info.is_valid);
2013-11-07 21:30:18 +01:00
if(!info.from_gdt)
{
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("LDTR can only be loaded from GDT");
2013-11-07 21:30:18 +01:00
}
if(!info.is_present)
{
dbg_log("lldt: present bit not set");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
if(!info.is_system)
{
dbg_log("lldt: not a system entry");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
if(info.type !== 2)
{
dbg_log("lldt: invalid type (" + info.type + ")");
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("#GP handler");
2013-11-07 21:30:18 +01:00
}
this.segment_offsets[reg_ldtr] = info.base;
2014-07-27 01:07:51 +02:00
this.segment_limits[reg_ldtr] = info.effective_limit;
this.sreg[reg_ldtr] = selector;
2013-11-07 21:30:18 +01:00
2016-08-01 23:22:38 +02:00
//dbg_log("ldt at " + h(info.base >>> 0) + "; (" + info.effective_limit + " bytes)", LOG_CPU);
};
2014-12-21 18:11:22 +01:00
CPU.prototype.arpl = function(seg, r16)
{
2017-07-18 22:17:56 +02:00
if(!this.protected_mode[0] || this.vm86_mode())
{
this.trigger_ud();
}
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
2017-07-06 01:59:48 +02:00
this.flags_changed[0] &= ~flag_zero;
2013-11-07 21:30:18 +01:00
2017-07-18 22:17:56 +02:00
if((seg & 3) < (r16 & 3))
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_zero;
2017-07-18 22:17:56 +02:00
return seg & ~3 | r16 & 3;
}
else
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_zero;
return seg;
}
};
2013-11-07 21:30:18 +01:00
2015-02-22 00:51:58 +01:00
CPU.prototype.lar = function(selector, original)
{
2017-04-06 02:57:24 +02:00
dbg_log("lar sel=" + h(selector, 4), LOG_CPU);
2015-02-22 00:51:58 +01:00
/** @const */
var LAR_INVALID_TYPE = 1 << 0 | 1 << 6 | 1 << 7 | 1 << 8 | 1 << 0xA |
2015-02-22 00:51:58 +01:00
1 << 0xD | 1 << 0xE | 1 << 0xF;
var info = this.lookup_segment_selector(selector);
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
2017-07-06 01:59:48 +02:00
this.flags_changed[0] &= ~flag_zero;
2015-02-22 00:51:58 +01:00
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
2017-07-06 01:59:48 +02:00
var dpl_bad = info.dpl < this.cpl[0] || info.dpl < info.rpl;
2015-02-22 00:51:58 +01:00
if(info.is_null || !info.is_valid ||
2016-02-07 17:45:55 +01:00
(info.is_system ? (LAR_INVALID_TYPE >> info.type & 1) || dpl_bad :
!info.is_conforming_executable && dpl_bad)
2015-02-22 00:51:58 +01:00
) {
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_zero;
dbg_log("lar: invalid selector=" + h(selector, 4) + " is_null=" + info.is_null, LOG_CPU);
2015-02-22 00:51:58 +01:00
return original;
}
else
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_zero;
2016-02-07 17:45:55 +01:00
return info.raw1 & 0x00FFFF00;
2015-02-22 00:51:58 +01:00
}
};
CPU.prototype.lsl = function(selector, original)
{
2017-04-06 02:57:24 +02:00
dbg_log("lsl sel=" + h(selector, 4), LOG_CPU);
2015-02-22 00:51:58 +01:00
/** @const */
var LSL_INVALID_TYPE = 1 << 0 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7 | 1 << 8 |
2015-02-22 00:51:58 +01:00
1 << 0xA | 1 << 0xC | 1 << 0xD | 1 << 0xE | 1 << 0xF;
var info = this.lookup_segment_selector(selector);
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
2017-07-06 01:59:48 +02:00
this.flags_changed[0] &= ~flag_zero;
2015-02-22 00:51:58 +01:00
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
2017-07-06 01:59:48 +02:00
var dpl_bad = info.dpl < this.cpl[0] || info.dpl < info.rpl;
2015-02-22 00:51:58 +01:00
if(info.is_null || !info.is_valid ||
2016-02-07 17:45:55 +01:00
(info.is_system ? (LSL_INVALID_TYPE >> info.type & 1) || dpl_bad :
!info.is_conforming_executable && dpl_bad)
2015-02-22 00:51:58 +01:00
) {
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_zero;
2016-02-07 17:45:55 +01:00
dbg_log("lsl: invalid selector=" + h(selector, 4) + " is_null=" + info.is_null, LOG_CPU);
2015-02-22 00:51:58 +01:00
return original;
}
else
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_zero;
2015-02-22 00:51:58 +01:00
return info.effective_limit | 0;
}
};
2013-11-07 21:30:18 +01:00
2016-02-14 20:00:41 +01:00
CPU.prototype.verr = function(selector)
{
var info = this.lookup_segment_selector(selector);
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
2017-07-06 01:59:48 +02:00
this.flags_changed[0] &= ~flag_zero;
2016-02-14 20:00:41 +01:00
if(info.is_null || !info.is_valid || info.is_system || !info.is_readable ||
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
2017-07-06 01:59:48 +02:00
(!info.is_conforming_executable && (info.dpl < this.cpl[0] || info.dpl < info.rpl)))
2016-02-14 20:00:41 +01:00
{
2016-02-14 20:07:18 +01:00
dbg_log("verr -> invalid. selector=" + h(selector, 4), LOG_CPU);
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
2017-07-06 01:59:48 +02:00
this.flags[0] &= ~flag_zero;
2016-02-14 20:00:41 +01:00
}
else
{
dbg_log("verr -> valid. selector=" + h(selector, 4), LOG_CPU);
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_zero;
2016-02-14 20:00:41 +01:00
}
};
CPU.prototype.verw = function(selector)
{
var info = this.lookup_segment_selector(selector);
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
2017-07-06 01:59:48 +02:00
this.flags_changed[0] &= ~flag_zero;
2016-02-14 20:00:41 +01:00
if(info.is_null || !info.is_valid || info.is_system || !info.is_writable ||
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
2017-07-06 01:59:48 +02:00
info.dpl < this.cpl[0] || info.dpl < info.rpl)
2016-02-14 20:00:41 +01:00
{
dbg_log("verw invalid " + " " + h(selector) + " " + info.is_null + " " +
!info.is_valid + " " + info.is_system + " " + !info.is_writable + " " +
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
2017-07-06 01:59:48 +02:00
(info.dpl < this.cpl[0]) + " " + (info.dpl < info.rpl) + " " + LOG_CPU);
this.flags[0] &= ~flag_zero;
2016-02-14 20:00:41 +01:00
}
else
{
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
2017-07-06 01:59:48 +02:00
this.flags[0] |= flag_zero;
2016-02-14 20:00:41 +01:00
}
};
2014-12-21 18:11:22 +01:00
CPU.prototype.clear_tlb = function()
2013-11-07 21:30:18 +01:00
{
// clear tlb excluding global pages
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
2017-07-06 01:59:48 +02:00
this.last_virt_eip[0] = -1;
this.last_virt_esp[0] = -1;
2013-11-07 21:30:18 +01:00
this.tlb_info.set(this.tlb_info_global);
2013-11-07 21:30:18 +01:00
//dbg_log("page table loaded", LOG_CPU);
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.full_clear_tlb = function()
2013-11-07 21:30:18 +01:00
{
//dbg_log("TLB full clear", LOG_CPU);
2014-07-12 22:20:57 +02:00
2013-11-07 21:30:18 +01:00
// clear tlb including global pages
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
2017-07-06 01:59:48 +02:00
var buf32 = new Int32Array(
this.tlb_info_global.buffer,
this.tlb_info_global.byteOffset,
this.tlb_info_global.length >>> 2);
2014-07-13 00:02:17 +02:00
for(var i = 0; i < (1 << 18); )
{
buf32[i++] = buf32[i++] = buf32[i++] = buf32[i++] = 0;
}
2013-11-07 21:30:18 +01:00
this.clear_tlb();
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.invlpg = function(addr)
2013-11-07 21:30:18 +01:00
{
var page = addr >>> 12;
2014-07-12 22:20:57 +02:00
//dbg_log("invlpg: addr=" + h(addr >>> 0), LOG_CPU);
2013-11-07 21:30:18 +01:00
this.tlb_info[page] = 0;
this.tlb_info_global[page] = 0;
2013-11-07 21:30:18 +01:00
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
2017-07-06 01:59:48 +02:00
this.last_virt_eip[0] = -1;
this.last_virt_esp[0] = -1;
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.translate_address_read = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
{
return addr;
}
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0] === 3)
{
return this.translate_address_user_read(addr);
}
else
{
return this.translate_address_system_read(addr);
}
};
2014-12-21 18:11:22 +01:00
CPU.prototype.translate_address_write = function(addr)
{
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
{
return addr;
}
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
2017-07-06 01:59:48 +02:00
if(this.cpl[0] === 3)
{
return this.translate_address_user_write(addr);
}
else
{
return this.translate_address_system_write(addr);
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.translate_address_user_write = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
2016-02-07 16:58:41 +01:00
{
return addr;
}
2013-11-07 21:30:18 +01:00
var base = addr >>> 12;
if(this.tlb_info[base] & TLB_USER_WRITE)
2013-11-07 21:30:18 +01:00
{
2014-07-12 22:20:57 +02:00
return this.tlb_data[base] ^ addr;
2013-11-07 21:30:18 +01:00
}
else
{
return this.do_page_translation(addr, 1, 1) | addr & 0xFFF;
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.translate_address_user_read = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
2016-02-07 16:58:41 +01:00
{
return addr;
}
2013-11-07 21:30:18 +01:00
var base = addr >>> 12;
if(this.tlb_info[base] & TLB_USER_READ)
2013-11-07 21:30:18 +01:00
{
2014-07-12 22:20:57 +02:00
return this.tlb_data[base] ^ addr;
2013-11-07 21:30:18 +01:00
}
else
{
return this.do_page_translation(addr, 0, 1) | addr & 0xFFF;
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.translate_address_system_write = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
2016-02-07 16:58:41 +01:00
{
return addr;
}
2013-11-07 21:30:18 +01:00
var base = addr >>> 12;
if(this.tlb_info[base] & TLB_SYSTEM_WRITE)
2013-11-07 21:30:18 +01:00
{
2014-07-12 22:20:57 +02:00
return this.tlb_data[base] ^ addr;
2013-11-07 21:30:18 +01:00
}
else
{
return this.do_page_translation(addr, 1, 0) | addr & 0xFFF;
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.translate_address_system_read = function(addr)
2013-11-07 21:30:18 +01:00
{
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
2016-02-07 16:58:41 +01:00
{
return addr;
}
2013-11-07 21:30:18 +01:00
var base = addr >>> 12;
if(this.tlb_info[base] & TLB_SYSTEM_READ)
2013-11-07 21:30:18 +01:00
{
2014-07-12 22:20:57 +02:00
return this.tlb_data[base] ^ addr;
2013-11-07 21:30:18 +01:00
}
else
{
return this.do_page_translation(addr, 0, 0) | addr & 0xFFF;
2013-11-07 21:30:18 +01:00
}
};
2013-11-07 21:30:18 +01:00
/**
* @return {number}
2013-11-07 21:30:18 +01:00
*/
2014-12-21 18:11:22 +01:00
CPU.prototype.do_page_translation = function(addr, for_writing, user)
2013-11-07 21:30:18 +01:00
{
var page = addr >>> 12,
page_dir_addr = (this.cr[3] >>> 2) + (page >> 10) | 0,
2016-08-02 04:15:24 +02:00
page_dir_entry = this.mem32s[page_dir_addr],
2013-11-07 21:30:18 +01:00
high,
can_write = true,
global,
cachable = true,
allow_user = true;
dbg_assert(addr < 0x80000000);
2013-11-07 21:30:18 +01:00
if(!(page_dir_entry & 1))
{
// to do at this place:
//
// - set cr2 = addr (which caused the page fault)
// - call_interrupt_vector with id 14, error code 0-7 (requires information if read or write)
// - prevent execution of the function that triggered this call
2013-12-01 23:36:37 +01:00
//dbg_log("#PF not present", LOG_CPU);
2013-11-07 21:30:18 +01:00
2015-04-12 20:16:26 +02:00
this.cr[2] = addr;
this.trigger_pagefault(for_writing, user, 0);
2013-11-07 21:30:18 +01:00
// never reached as this.trigger_pagefault throws up
2013-11-07 21:30:18 +01:00
dbg_assert(false);
}
if((page_dir_entry & 2) === 0)
{
can_write = false;
2015-04-12 20:16:26 +02:00
if(for_writing && (user || (this.cr[0] & CR0_WP)))
2013-11-07 21:30:18 +01:00
{
2015-04-12 20:16:26 +02:00
this.cr[2] = addr;
this.trigger_pagefault(for_writing, user, 1);
2013-11-07 21:30:18 +01:00
dbg_assert(false);
}
}
if((page_dir_entry & 4) === 0)
{
allow_user = false;
if(user)
{
// "Page Fault: page table accessed by non-supervisor";
2013-12-01 23:36:37 +01:00
//dbg_log("#PF supervisor", LOG_CPU);
2015-04-12 20:16:26 +02:00
this.cr[2] = addr;
this.trigger_pagefault(for_writing, user, 1);
2013-11-07 21:30:18 +01:00
dbg_assert(false);
}
}
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
2017-07-06 01:59:48 +02:00
if(page_dir_entry & this.page_size_extensions[0])
2013-11-07 21:30:18 +01:00
{
// size bit is set
// set the accessed and dirty bits
2016-08-02 04:15:24 +02:00
this.mem32s[page_dir_addr] = page_dir_entry | 0x20 | for_writing << 6;
2013-11-07 21:30:18 +01:00
2014-07-12 22:20:57 +02:00
high = (page_dir_entry & 0xFFC00000) | (addr & 0x3FF000);
2013-11-07 21:30:18 +01:00
global = page_dir_entry & 0x100;
}
else
{
var page_table_addr = ((page_dir_entry & 0xFFFFF000) >>> 2) + (page & 0x3FF) | 0,
2016-08-02 04:15:24 +02:00
page_table_entry = this.mem32s[page_table_addr];
2013-11-07 21:30:18 +01:00
2014-07-12 22:20:57 +02:00
if((page_table_entry & 1) === 0)
2013-11-07 21:30:18 +01:00
{
2013-12-01 23:36:37 +01:00
//dbg_log("#PF not present table", LOG_CPU);
2015-04-12 20:16:26 +02:00
this.cr[2] = addr;
this.trigger_pagefault(for_writing, user, 0);
2013-11-07 21:30:18 +01:00
dbg_assert(false);
}
if((page_table_entry & 2) === 0)
{
can_write = false;
2015-04-12 20:16:26 +02:00
if(for_writing && (user || (this.cr[0] & CR0_WP)))
2013-11-07 21:30:18 +01:00
{
2013-12-01 23:36:37 +01:00
//dbg_log("#PF not writable page", LOG_CPU);
2015-04-12 20:16:26 +02:00
this.cr[2] = addr;
this.trigger_pagefault(for_writing, user, 1);
2013-11-07 21:30:18 +01:00
dbg_assert(false);
}
}
if((page_table_entry & 4) === 0)
{
allow_user = false;
if(user)
{
2013-12-01 23:36:37 +01:00
//dbg_log("#PF not supervisor page", LOG_CPU);
2015-04-12 20:16:26 +02:00
this.cr[2] = addr;
this.trigger_pagefault(for_writing, user, 1);
2013-11-07 21:30:18 +01:00
dbg_assert(false);
}
}
// set the accessed and dirty bits
this.write_aligned32(page_dir_addr, page_dir_entry | 0x20);
this.write_aligned32(page_table_addr, page_table_entry | 0x20 | for_writing << 6);
2013-11-07 21:30:18 +01:00
high = page_table_entry & 0xFFFFF000;
global = page_table_entry & 0x100;
}
2014-07-12 22:20:57 +02:00
this.tlb_data[page] = high ^ page << 12;
2013-11-07 21:30:18 +01:00
2014-07-12 22:20:57 +02:00
var allowed_flag;
2013-11-07 21:30:18 +01:00
2014-07-12 22:20:57 +02:00
if(allow_user)
{
if(can_write)
{
allowed_flag = TLB_SYSTEM_READ | TLB_SYSTEM_WRITE | TLB_USER_READ | TLB_USER_WRITE;
2013-11-07 21:30:18 +01:00
}
2014-07-12 22:20:57 +02:00
else
{
// TODO: Consider if cr0.wp is not set
allowed_flag = TLB_SYSTEM_READ | TLB_USER_READ;
}
}
else
{
2013-11-07 21:30:18 +01:00
if(can_write)
{
2014-07-12 22:20:57 +02:00
allowed_flag = TLB_SYSTEM_READ | TLB_SYSTEM_WRITE;
2013-11-07 21:30:18 +01:00
}
2014-07-12 22:20:57 +02:00
else
2013-11-07 21:30:18 +01:00
{
2014-07-12 22:20:57 +02:00
allowed_flag = TLB_SYSTEM_READ;
2013-11-07 21:30:18 +01:00
}
}
2014-07-12 22:20:57 +02:00
this.tlb_info[page] = allowed_flag;
2015-04-12 20:16:26 +02:00
if(global && (this.cr[4] & CR4_PGE))
2014-07-12 22:20:57 +02:00
{
this.tlb_info_global[page] = allowed_flag;
}
2013-11-07 21:30:18 +01:00
2014-02-22 22:15:41 +01:00
return high;
};
2014-02-22 22:15:41 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.writable_or_pagefault = function(addr, size)
2014-02-22 22:15:41 +01:00
{
dbg_assert(size < 0x1000, "not supported yet");
dbg_assert(size > 0);
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
2017-07-06 01:59:48 +02:00
if(!this.paging[0])
2014-02-22 22:15:41 +01:00
{
return;
}
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
2017-07-06 01:59:48 +02:00
var user = this.cpl[0] === 3 ? 1 : 0,
2014-07-12 22:20:57 +02:00
mask = user ? TLB_USER_WRITE : TLB_SYSTEM_WRITE,
page = addr >>> 12;
if((this.tlb_info[page] & mask) === 0)
{
this.do_page_translation(addr, 1, user);
}
2014-02-22 22:15:41 +01:00
if((addr & 0xFFF) + size - 1 >= 0x1000)
{
if((this.tlb_info[page + 1 | 0] & mask) === 0)
2014-02-22 22:15:41 +01:00
{
this.do_page_translation(addr + size - 1 | 0, 1, user);
2014-02-22 22:15:41 +01:00
}
}
};
2013-11-07 21:30:18 +01:00
2014-12-21 18:11:22 +01:00
CPU.prototype.trigger_pagefault = function(write, user, present)
2013-11-07 21:30:18 +01:00
{
2017-06-17 19:59:56 +02:00
if(LOG_PAGE_FAULTS)
{
dbg_log("page fault w=" + write + " u=" + user + " p=" + present +
" eip=" + h(this.previous_ip[0] >>> 0, 8) +
2017-06-17 19:59:56 +02:00
" cr2=" + h(this.cr[2] >>> 0, 8), LOG_CPU);
dbg_trace(LOG_CPU);
}
2013-11-07 21:30:18 +01:00
if(this.page_fault)
2013-11-07 21:30:18 +01:00
{
2013-12-28 23:21:43 +01:00
dbg_trace(LOG_CPU);
2014-12-06 23:20:54 +01:00
throw this.debug.unimpl("Double fault");
2013-11-07 21:30:18 +01:00
}
2014-01-02 01:05:49 +01:00
// invalidate tlb entry
2015-04-12 20:16:26 +02:00
var page = this.cr[2] >>> 12;
this.tlb_info[page] = 0;
this.tlb_info_global[page] = 0;
2014-01-02 01:05:49 +01:00
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
2017-07-06 01:59:48 +02:00
this.instruction_pointer[0] = this.previous_ip[0];
this.page_fault = true;
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
2017-07-06 01:59:48 +02:00
this.call_interrupt_vector(14, false, true, user << 2 | write << 1 | present);
2013-11-07 21:30:18 +01:00
2014-05-06 20:24:46 +02:00
throw MAGIC_CPU_EXCEPTION;
};
2013-11-07 21:30:18 +01:00
CPU.prototype.is_osize_32 = function()
{
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
2017-07-06 01:59:48 +02:00
return Boolean(this.is_32[0]) !== ((this.prefixes[0] & PREFIX_MASK_OPSIZE) === PREFIX_MASK_OPSIZE);
};
CPU.prototype.is_asize_32 = function()
{
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
2017-07-06 01:59:48 +02:00
return Boolean(this.is_32[0]) !== ((this.prefixes[0] & PREFIX_MASK_ADDRSIZE) === PREFIX_MASK_ADDRSIZE);
};
CPU.prototype.get_reg_asize = function(reg)
{
dbg_assert(reg === reg_ecx || reg === reg_esi || reg === reg_edi);
var r = this.reg32s[reg];
if(this.is_asize_32())
{
return r;
}
else
{
return r & 0xFFFF;
}
};
CPU.prototype.set_ecx_asize = function(value)
{
if(this.is_asize_32())
{
this.reg32s[reg_ecx] = value;
}
else
{
this.reg16[reg_cx] = value;
}
};
CPU.prototype.add_reg_asize = function(reg, value)
{
dbg_assert(reg === reg_ecx || reg === reg_esi || reg === reg_edi);
if(this.is_asize_32())
{
this.reg32s[reg] += value;
}
else
{
this.reg16[reg << 1] += value;
}
};
CPU.prototype.decr_ecx_asize = function()
{
return this.is_asize_32() ? --this.reg32s[reg_ecx] : --this.reg16[reg_cx];
2017-04-06 02:57:24 +02:00
};
2016-08-01 21:28:19 +02:00
// Closure Compiler's way of exporting
if(typeof window !== "undefined")
{
window["CPU"] = CPU;
}
else if(typeof module !== "undefined" && typeof module.exports !== "undefined")
{
module.exports["CPU"] = CPU;
}
else if(typeof importScripts === "function")
{
self["CPU"] = CPU;
}