Commit Graph

52 Commits

Author SHA1 Message Date
Flyinghead 318852e261 dynarec: use mprotect to protect code areas
All ram pages containing code are write protected. In that case, no need
for block checks. Memory reads in the same block(s) can also be executed
at compile time and the results propagated as constants.
When a write is detected in a protected area, the corresponding blocks
are discarded and recompiled using traditional (slow) block checks.

Backported the blkmap code finding change from upstream.
Use smart pointers for block management to avoid reference issues.
Added WriteAfterWrite ssa pass
Fixed crash in ssa ConstProp pass when op list is modified
2019-06-19 11:01:33 +02:00
Flyinghead 3d8b0df789 rec-x64: setpeq native impl. Fix imm mem write for byte and short
Optimize fneg, fabs and sub
Fix cvt_f2i
Fix fsca with imm arg
2019-06-18 13:16:42 +02:00
Flyinghead 2c3b516341 x64: use eax instead of ecx for mem reads return value 2019-06-10 14:48:54 +02:00
Flyinghead 3dd16e80d2 arm64 and x64 recs use ssa regalloc 2019-06-10 13:57:10 +02:00
Flyinghead b8a00b9c7d rec-arm64/x64: only do regalloc on rewrite when needed 2019-05-28 20:03:08 +02:00
Flyinghead 714de0303e rec-x64: don't save fp regs when calling mem access handlers 2019-05-28 19:43:56 +02:00
Flyinghead 5b2cef3fdd dynarec: add negc and xtrct op codes
native implementation of negc and xtrct for x64 and arm64
rec-arm64: pass exception pc in w27 instead of sh4 context
inline mmu_intruction_translation() and clean up
2019-05-26 13:30:05 +02:00
Flyinghead e3d95f2258 wince: unify _vmem and vmem32. Use 4GB virtual space on 64-bit arch
On 64-bit architectures, _vmem first tries to allocate 4GB then falls
back to 512 MB.
The same virtual space is now used by _vmem and vmem32 (mmu)
2019-05-23 11:40:33 +02:00
Flyinghead c2c0215e1b Merge remote-tracking branch 'origin/master' into fh/wince-dynarec 2019-05-22 14:13:00 +02:00
flyinghead 3ef363733d wince: fix setjmp/longjmp on windows 2019-05-16 16:57:35 +02:00
David Guillen Fandos 3b760f9869 Add FEAT_NO_RWX_PAGES and implement it for x64 CPU (Win and Linux)
Tested: Both with and without the feature, works only for x64 CPUs for
now, but supported in both windows and linux (see vmem implementation
for it, using mem-mapped files).
2019-05-12 22:02:57 +02:00
flyinghead 7f2fcfde6f wince: don't use setjmp/longjmp on windows 2019-05-10 22:31:59 +02:00
flyinghead e6794743ad wince: rec-x64 fix for win32
fix GDI on windows
2019-05-10 21:21:30 +02:00
Flyinghead 810b8a59da wince: 32-bit virtual mem space
use fast mem read/write for x64 and arm64 dynarecs
2019-04-29 18:23:00 +02:00
Flyinghead 553f6054ce NO_MMU build fixes 2019-04-19 11:56:11 +02:00
Flyinghead 9920880987 dynarec: reserve code cache space for frequently changing blocks
detect frequent SMC check failures and use a specific code cache area
for these blocks.
flush the temp area when full but keep the main code cache area
2019-04-19 11:45:05 +02:00
Flyinghead 0f34d776f6 wince: delete sr.FD hack, restore FD block check in x64 rec
use longjmp for interpreter fallback exceptions
2019-04-18 14:15:01 +02:00
Flyinghead 5d6e96463c x64 and win32 build fixes 2019-04-15 18:31:15 +02:00
Flyinghead dece3fc13e wince: use setjmp/longjmp instead of try/catch for dynarecs
WinCE fast mmu implementation
WIP arm64 dynarec
2019-04-15 18:02:34 +02:00
David Miller 3d1b82854e
Merge branch 'master' into fh/win32-winresize 2019-04-12 13:03:30 -04:00
flyinghead 7f0489ff28 visual studio compatibility
no modem support
no zip or 7z support so no naomi for now
hacked a .asm file as vs doesn't support inline assembly -> code dup
2019-03-30 19:26:05 +01:00
Flyinghead 505c5b6c4d dynarec: FullCheck was being ignored and FastCheck used instead
Fix crash on arm32
Fix infinite loop on x64
2019-03-30 10:06:19 +01:00
Stefanos Kornilios Mitsis Poiitidis af6993a819 dynarec: Refactor smc-option a bit 2019-03-30 07:16:44 +01:00
Flyinghead 6438a402df dynarec: add option to control smc code checks: none, fast, full 2019-03-29 19:23:37 +01:00
Flyinghead ba00da2420 dynarec: don't throw exceptions if NO_MMU 2019-03-25 13:53:49 +01:00
Flyinghead ef43883fb5 dynarec: WinCE support WIP
Only for the x64 dynarec atm
Bugs remaining
2019-03-25 11:53:13 +01:00
Flyinghead 91fb92264d x64 dynarec: do not use RSQRTSS as it lacks precision
RSQRTSS error is:
|Relative Error| <= 1.5 ∗ 2^-12
whereas SH4's FSRRA abs error is <= 2^-21

Fixes loop issues is Sonic Adventure 1 and 2
Issue #1489
2019-02-04 10:48:22 +01:00
Flyinghead 91cfd4b2f7 Reserve and allocate maximum RAM/VRAM/ARAM in all cases
Reserve enough virtual memory space for DC and Naomi
Allocate dynarec entry point tables for max possible ram
Free mem and release vmem on exit
2019-01-24 09:48:58 +01:00
Flyinghead eb37dacadb x64: disable the use of AVX instructions because of rounding issues 2019-01-22 16:17:25 +01:00
Flyinghead cd4e4cbdc9 x64 dynarec: check if extension is supported by cpu. seh on win32
Check if FMA/AVX/SSE3 is supported before using it
fully naked main loop in win32 with proper seh directives
win32: more xmm regs to allocate and no need to save them when calling
out
2019-01-18 17:02:50 +01:00
Flyinghead f852480b88 OSX: build fix 2019-01-16 14:44:40 +01:00
Flyinghead 05d7cf2c72 x64 dynarec: implement immediate address ram read. OSX fix 2019-01-16 13:39:52 +01:00
Flyinghead e241613b8f x64 dynarec: implemented swaplb, fipr, ftrv, frswap and other fixes
native implementations for swaplb, fipr, ftrv and frswap
use explode_spans to map 2V and F64 to registers
save xmm registers when calling subroutine
2019-01-14 21:15:36 +01:00
Flyinghead 31163b8d7e x64 dynarec: various fixes and optimizations
implemented fsca
fixed fsetgt and cvtf2i
2019-01-13 12:27:02 +01:00
Flyinghead a2cd9d7af1 x64 dynarec: use register alloc spans, implement native opcodes 2019-01-12 23:48:48 +01:00
Flyinghead fc05727538 dynarecs clean-up
move GetRegPtr and ngen_FailedToFindBlock to sh4/dyna
2019-01-11 23:52:20 +01:00
Flyinghead d438f6d9c9 x64 dynarec: don't reset the cycle counter but add a time slice
This is how the interpreter and other dynarecs work. Better scheduling
precison.
Fixes Gundam Side Story freeze at boot.
2018-11-22 18:57:07 +01:00
Flyinghead 960904c401 Exit cleanly in desktop platforms
Lighter and cleaner version of the previous PR
2018-07-23 19:52:50 +02:00
Stefanos Kornilios Mitsis Poiitidis f45f888d0b Use platform specific first argument register 2018-07-01 12:15:59 +02:00
Stefanos Kornilios Mitsis Poiitidis ad05c35a7e Implement CheckBlock for x64 2018-06-29 15:19:49 +02:00
Stefanos Kornilios Mitsis Poiitidis a4186381fb xbyak: Move to deps folder 2015-08-24 13:27:51 +02:00
Stefanos Kornilios Mitsis Poiitidis 4c19f347aa x64/xbyak: Update to 4.86
- Resolves call warnings for clang/gcc
- Overall minor improvements
- Also added copyright file
2015-08-24 13:22:30 +02:00
Jan Holthuis 109a2cce93 rec_x64.cpp: Fix function calls
Resolves #719.
2015-08-15 18:15:49 +02:00
Stefanos Kornilios Mitsis Poiitidis 4aaff464b3 shrec/jitx64: Implement all block ends
This is still minimal and doesn't do any linking or other smart stuff
Also fixed a bug on shop_jdyn
2015-08-05 05:00:01 +02:00
Stefanos Kornilios Mitsis Poiitidis a9c76351f6 build: Draft & cleanup, refactor rec* options 2015-07-25 13:17:42 +02:00
Stefanos Kornilios Mitsis Poiitidis 82ef7d0754 jitx64: 16KBs of emit space are guaranteed, not 64 2015-07-21 15:42:10 +02:00
Stefanos Kornilios Mitsis Poiitidis 0a3fcfe4ac jit-x64: typofix on shop_writem, WriteMem64 2015-07-21 14:48:37 +02:00
Stefanos Kornilios Mitsis Poiitidis b056cf6cef Implement jitcore opset for x64
Now mov64, readm, writem, in addition to jittiny ifb, jdyn, mov32
2015-07-14 20:17:45 +02:00
Stefanos Kornilios Mitsis Poiitidis 1125f25eae Fix win86 build 2015-07-14 17:47:54 +02:00
Stefanos Kornilios Mitsis Poiitidis 8cb6d6578c Count cycles correctly 2015-07-14 17:23:02 +02:00