Commit graph

32 commits

Author SHA1 Message Date
Fabian 497f618cab Merge branch 'wasm' into master 2021-01-03 02:07:20 -06:00
Fabian 28a6f1a84a Add pit.dump 2020-08-30 19:29:54 -05:00
Fabian 267afaa83e Fix irq signaling in pit timer 2020-07-21 20:10:14 -05:00
Awal Garg 8222d2e6e0 Squash
restore memcpy comment
delete all the things!
fix jshint issues
restore memcpy comment
remove duplicate fxsave assignment
Count cache drops
Use already available physical address instead of calling read_imm8
Remove useless assertion
Just move around to reduce later diff
Run jit paging test with assertions enabled
Run jit-paging test on CI
Extend jit-paging test
Fix deleting invalidated code across memory pages
Add jit-paging test to gitlab ci
Remove jit_in_progress
Clean up old comments, use bool for jit_jump
Fix state image not begin garbage collected
Add ENABLE_PROFILER_TIMES to configure slow profiling times
Move to jit_generate and jit_run_interpreted to separate function
Add missing struct field
Fix: Don't write jit cache entry until no more faults can happen
Download image for jit paging test
Add missing initialiser
Mark jit_{generate,run_interpreted} as static
Specify full path to profiler.h
Clean up duplicate/missing declaration after rebase
mmap error handling, line length and fix some warnings
remove further unused code
move js imports to single header file
2020-07-21 20:10:13 -05:00
Ernest Wong 40a1c3c70d Implement sb16 mixer chip + tidy up 2018-04-08 14:38:24 -07:00
Ernest Wong 531f5ba84f Warn if pit counter larger than reload value
- Code by @copy
- Improves commit 8b6115d
2017-12-16 22:51:40 -06:00
Ernest Wong a185fd13bc Tidy up: spacing, quotes, and line length.
- Space before ? in ternary operators
- Double quotes ' -> "
- Line length of 100
2017-12-16 22:51:40 -06:00
Ernest Wong 1c092c215c Send via bus the required data only (pc speakers) 2017-12-16 22:51:40 -06:00
Ernest Wong eb736ab406 Emulate PC speaker beep sounds 2017-12-16 22:51:40 -06:00
Ernest Wong 818a6c211f Wrap PIT counter value - always
After restore_state, the pit.counter_start_time can be larger
than the current timestamp, leading to negative diff values, and
as a result, when get_counter_value is called, it can return
values larger than 16 bit integers. Thus, when ISA ports 0x40, 0x41, or
0x42 are read, the high-byte that counter_write returns can be larger
than 8-bit. Ultimately, this error is caught by the asserts in io.js. By
always applying a positive modulo to the counter value, it is always
ensured that the counter value is between zero and the reload value.
2017-12-16 22:51:40 -06:00
copy 819187cb25 Minor pit update 2017-03-04 15:59:37 -05:00
copy a7a8c271cb Correct handling of lowering irqs 2016-11-21 20:09:03 +01:00
copy e3e6367ccf Some assertions and minor changes 2016-08-01 23:22:38 +02:00
copy 6a8c57647a Improve PIT implementation: Read timer counters based on real time 2016-02-14 00:06:13 +01:00
copy 31ca64ccf6 PIT latch value - 1, fixes #65 2016-01-01 00:50:26 +01:00
copy 7fba276f86 Fix warnings 2015-09-15 21:58:40 +02:00
copy f557156256 trailing whitespace 2015-09-12 01:10:38 +02:00
copy f82373d6b2 Build state of emulator explicitly. Fixes #40 2015-05-18 22:18:59 +02:00
copy 3a824eda12 Change handling of interrupts to involve APIC 2015-05-17 01:56:50 +02:00
copy 3ff18c4527 Improve PIT counter 2 2015-04-12 19:49:25 +02:00
copy 21747acc44 Lazier hlt_loop, fixes #15 2015-01-14 02:43:09 +01:00
copy a0da169168 Make _state_skip work by value (instead of key). Fixes certain Closure Compiler builds 2015-01-12 18:05:10 +01:00
copy a9c8ef8d72 Implement refresh cycle toggle bit correctly, fixes #30 2014-12-31 01:12:53 +01:00
copy 90f4ff5d3a fix that assert 2014-12-21 21:15:40 +01:00
copy bfd12be557 cleaning up 2014-11-01 13:56:06 +01:00
copy 5fd2a1bd35 Improved handling of IO port operations 2014-10-21 21:51:42 +02:00
Fabian 9b031d4e40 Initial version of save/restore state feature, #18
Everything that is valid json plus arraybuffers and arraybuffer-views
can be restored automatically (without making changes to other code).
Properties that should not be part of the state buffer needed to be
annotated using a magic `_state_skip` property. Shared arraybuffer views
are broken during restoration and also need to be annotated. Adapters
are not (and should never be) saved.

Current limitations:
- Before restoring, the cpu needs to be initialised with the original
  settings. This is not a hard requirement and can be fixed later.
- Pending asynchronous operations are lost. It's a good idea to pause
  the cpu before saving the state.
2014-09-28 22:10:47 -07:00
Fabian 1aa4b191ee Rewrite to prototypical notation 2014-09-26 19:49:52 -07:00
copy 7a731ca061 Change CPU from closure to prototypical notation.
This change was necessary for several reasons:

- Code is much clearer and more modular
- The CPU object is now serializeable and therefore can be safed and
  restored
- A dynamic translator from instructions to (optimized) JavaScript is
  planned. It would use `new Function` to create functions at runtime.
  Functions created this way don't have access to any scope (except for
  the global scope) and therefore were not have been able to modify
  registers, etc. This is now possible through the cpu object
- Possibly, but not necessarily a speedgain can be achieved.
  See http://mrale.ph/blog/2012/09/23/grokking-v8-closures-for-fun.html

Additionally, some code was moved around.
2014-06-15 22:25:17 +02:00
copy 0897c2f234 hpet 2013-12-06 01:36:29 +01:00
copy 688840cd5d Fixed small bug 2013-11-29 17:22:37 +01:00
copy 8180d49f24 first public release 2013-11-06 01:12:55 +01:00