Commit graph pcem/src/386_dynarec.c
Author SHA1 Message Date
SarahW
ca89a51478 Remove redundant oldcs variable - when processing an exception, oldcs and CS are the same. 2019-01-28 20:00:49 +00:00
SarahW
427aa72a15 Don't set cpu_state.oldpc at the start of every iteration of the recompiler main loop. 2019-01-28 19:25:09 +00:00
SarahW
889ca7f3f2 Remove test-USE32-and-mask-PC operation from interpreter as well. 2019-01-27 21:22:35 +00:00
SarahW
ee186dbb0d Remove test-USE32-and-mask-PC operation following code block execution. Instead, ensure that all recompiled instructions mask PC correctly. 2019-01-27 20:54:22 +00:00
SarahW
7b3b6a745d Remove pointless NULL check against block in recompiler loop. 2019-01-27 20:52:59 +00:00
SarahW
6c65c34bd3 Don't clear trap at the start of the recompiler loop; instead, clear it when actually taking a trap. 2019-01-27 20:52:37 +00:00
SarahW
93b42d43d5 Remove pointless setting of cpu_state.op32 and cycdiff at start of recompiler main loop. 2019-01-27 20:52:02 +00:00
SarahW
c3250ca63e Don't set oldcpl at the start of each instruction; instead, only set it following a successful CS load. 2019-01-27 20:51:13 +00:00
SarahW
43b5b83644 Reduce codeblock_hash table to uint16_t. 2018-11-30 13:18:56 +00:00
SarahW
9ff1c7f409 Further reductions to codeblock_t size - replace link pointers with uint16_t block indicies, shrink ins to uint8_t, remove endpc. codeblock_t now fits in a 64-byte cacheline on 32-bit platforms. 2018-11-29 20:05:12 +00:00
SarahW
2007c25177 Start reducing size of codeblock_t structure.
Re-arrange all variables needed to run a block to fit in a single cache line.
2018-11-28 20:29:48 +00:00
SarahW
a4d3aa1912 Move flags and eflags variables into cpu_struct. 2018-11-28 09:42:04 +00:00
SarahW
d9e38fe37c Fix masking of FPU top-of-stack in several places. Fixes DOS Quake. 2018-10-09 13:51:05 +01:00
SarahW
a7d006b637 Rewrote timer code.
The new code is based on timestamps, rather than delays. This eliminates the
need to update every timer in timer_process(), which cost a non-trivial amount
of CPU time on low-end machines.

This involved changes to every user of the timer code, so this change almost
certainly introduces bugs.
2018-08-02 22:06:10 +01:00
SarahW
91143d3c68 Move CPU segment structures into cpu_state structure. 2018-07-22 12:56:03 +01:00
SarahW
0f0a1c3223 Perform NULL segment checks upfront in opcode handlers, rather than on every memory access.
This removes the need to pass the segment to readmem*l()/writemem*l().
2018-07-18 22:10:18 +01:00
SarahW
03fe25d818 First stage of dynamic recompiler rewrite.
Basic IR generation calls C implementation of all instructions.
Backend generation implemented for x86, x86-64, ARM and ARM64.
2018-06-17 20:26:15 +01:00
SarahW
2957dae2d5 Fixes to x86_was_reset handling. Based on patch from Greatpsycho. 2018-01-08 21:10:46 +00:00
SarahW
f336dd9589 Implemented IDT limit checking on real mode interrupts. Patch from Greatpsycho. 2018-01-08 20:54:19 +00:00
SarahW
4af811699e Fix dynarec timer granularity to 5us. Fixed speed issues in Tubular Worlds. 2017-11-19 21:55:49 +00:00
SarahW
717d815604 Tweak flat DS/SS dynarec optimisation, should reduce block churn when routines are called both with and without flat DS/SS.
Fixed incorrect STACK32 flag when entering V86 mode that was hidden by block churn.
Protected and V86 mode status now considered when selecting block.
2017-11-15 21:55:27 +00:00
SarahW
c71963727a Recompiler now uses logical address of 0xffffffff rather than 0 to represent invalid block. Fixes some Unixes when recompiler enabled. 2017-10-15 21:32:01 +01:00
SarahW
5f0d43f782 Prefetch simulation no longer counts prefixes when prefetch calculation disabled (eg when CPU cache enabled). Fixes hang on reset on 486+ CPUs. 2017-10-15 21:29:49 +01:00
SarahW
132a2eb110 Add NMI support to dynamic recompiler. 2017-10-13 22:42:59 +01:00
SarahW
a96e87527e Reorganised REP instructions. 2017-07-20 21:06:21 +01:00
SarahW
1f33b52451 Added VME emulation to Intel DX4, Pentium and Pentium MMX.
Temporarily disabled recompilation of CLI and STI.
2017-06-30 20:42:19 +01:00
SarahW
3a7c4687d6 Reduce self modifying code granularity from 64 bytes to 16. 2017-06-13 21:05:10 +01:00
SarahW
083ca3d4a2 Slight optimisation when DS/SS are 'flat' (base=0, limit=4G). 2017-05-24 21:50:37 +01:00
SarahW
2b892d2a7a Fixed compiler warnings for Windows builds.
Added -Werror to Windows makefiles.
2017-04-11 19:34:41 +01:00
SarahW
7c7961c578 Fixed inconsistent declaration of biosmask 2016-12-17 21:53:58 +00:00
SarahW
bfc69a4bea Cleaned up ibm.h a bit 2016-11-28 20:06:17 +00:00
SarahW
a4f3b2013e Added AMI 386DX and MR 386DX models (both based on OPTi 495 chipset). AMI 386DX supports external cache, useful for with prefetch emulation.
Also commit a few fixes required :
- Set EDX correctly on soft reset
- LOCK NOP is now treated as an illegal instruction
- Tweaks to FDC sense interrupt handling following FDC reset
2016-11-27 21:53:13 +00:00
SarahW
1b73963997 Added prefetch timing approximation for 286/386 CPUs, with configurable memory timing. 2016-11-25 21:32:02 +00:00
SarahW
a174a88c49 Codeblock tree now includes both physical and virtual addresses into key. Fixes performance issues with Windows 3.1. 2016-11-08 21:30:48 +00:00
SarahW
75f9316c11 x86-32 recompiler compiles FPU instructions using direct access to register stack when top-of-stack is static. Minor speedup. 2016-09-11 15:38:05 +01:00
SarahW
eb126fd822 Moved more variables into cpu_state structure. 2016-08-21 21:28:23 +01:00
SarahW
c664682758 Move some more variables into cpu_state structure. Minor speedup (~2%). 2016-08-17 21:28:16 +01:00
SarahW
535604b760 Pack decoded ModR/M data into a single word - minor recompiler speedup. 2016-08-14 16:29:54 +01:00
SarahW
42237ac1f8 Recompiler now only recompiles a block after seeing it twice. Improves performance on stuff that uses self modifying code - eg Doom, Duke Nukem 3D, Windows 95 idle 2016-07-31 12:33:37 +01:00
SarahW
4ae8f2d260 REP instructions now handle trap flag correctly, Windows NT 3.51 now works on 386 systems. 2016-06-28 21:58:21 +01:00
SarahW
7fbb99fe75 Don't quit emulator on triple fault when dynamic recompiler enabled. 2016-05-21 21:14:00 +01:00
SarahW
52636936e9 Limited how long REP instructions are uninterruptable for, improves sound on games/demos that use high-frequency timer interrupts for sound output (eg Crystal Dream, Cronologia) 2016-05-03 21:31:05 +01:00
SarahW
c81a91fd72 Moved integer registers, PC and flags_* variables into new cpu_state structure. Reduces recompiled code size slightly, small speedup (1-3%). 2016-04-20 21:39:41 +01:00
SarahW
36bb949126 If recompiler block hash table points to wrong block, then walk tree to find correct block instead of recompiling. Speedups of 10-20% on games that were seeing hash aliasing, eg Quake III, System Shock 2, UltraHLE etc 2016-04-06 20:48:36 +01:00
TomW
673a3527af Don't cause illegal instruction exception on unknown REP instruction. Patch from Battler. 2016-03-17 21:47:56 +00:00
TomW
94f33aa873 More accurate timing for INT, IRET, CALL far, RET far and JMP far. 2016-02-06 18:08:10 +00:00
TomW
673d785743 Writing to a memory page with code present only causes code block flushes if the data changes, or if a block is currently being recompiled. 2016-02-03 21:09:05 +00:00
TomW
79202cc5c0 Changed timer base frequency on XT models to 14.318MHz - PIT, CGA and 4.77MHz CPU should now stay in perfect sync. 2015-11-25 21:50:38 +00:00
TomW
2efc56e882 Reset triggered by keyboard controller should now be handled correctly by dynamic recompiler. 2015-08-31 19:31:23 +01:00
TomW
f339f00315 Interpreter and dynamic recompiler now present in a single binary. 2015-08-21 20:55:36 +01:00