3159 Commits
Author SHA1 Message Date
ptitSeb bedacef673 Bumped version to v0.2.2 2021-05-24 10:44:00 +02:00
ptitSeb 78bafd8b33 [DYNAREC] Forgot this file on previous commit 2021-05-24 10:30:56 +02:00
ptitSeb 6ae9b28325 [DYNAREC] Added 65 69/81/83 opcodes 2021-05-24 09:53:52 +02:00
ptitSeb 68f01f4267 Merge pull request #388 from rajdakin/master
Fixed rpaths for tests 15 and 16
2021-05-23 21:58:55 +02:00
rajdakin d9f953ec82 Added copies of output for failed runs 2021-05-23 21:35:05 +02:00
rajdakin d06795e979 Fixed rpaths for tests 15 and 16 2021-05-23 21:20:11 +02:00
ptitSeb 979ce28de9 Merge pull request #387 from rajdakin/master
Added two linking tests
2021-05-23 21:04:24 +02:00
rajdakin 4aa2a95b59 Added two linking tests 2021-05-23 20:29:01 +02:00
ptitSeb b588709ad9 Changed the way Mutex are check for lock on Signal handling (should help with freeze) 2021-05-21 18:17:41 +02:00
ptitSeb ca95cdcb91 Added 0F FB opcodes ([DYNAREC] too) 2021-05-20 14:07:19 +02:00
ptitSeb bf046a68c4 Added signal mask handling in setjmp/longjmp functions 2021-05-18 11:12:59 +02:00
ptitSeb 490a4ab31c [DYNAREC] Fix unaligned LOCK INC/DEC opcodes 2021-05-17 16:01:59 +02:00
ptitSeb 205133554f [DYNAREC] Fixed some issue were x87 cache is not purged correctly 2021-05-16 15:22:09 +02:00
ptitSeb 4df9b9ac6f [DYNAREC] Force separation of x87 and mmx cache usage 2021-05-16 13:43:48 +02:00
ptitSeb 0b5a943799 Set theme jekyll-theme-hacker 2021-05-16 10:40:16 +02:00
ptitSeb ede0e9d4c3 Added wrapped libexpat (minium symbols for torchlight2) 2021-05-16 10:32:37 +02:00
ptitSeb d33d231120 Small hack to elfloader, so dosbox, unity3d and torchlight2 all seems to works now 2021-05-16 10:05:06 +02:00
ptitSeb 0c1ee23f55 Better log for my_open64 2021-05-12 10:34:03 +02:00
ptitSeb f5554dec6e [DYNAREC] Small fixes for BTC/BSR/BSF opcodes 2021-05-10 10:30:22 +02:00
ptitSeb 6239168118 [DYNAREC] Better race when jumping to nowhere for Trace enabled build 2021-05-10 10:29:31 +02:00
ptitSeb fe9fea0807 [DYNAREC] Small optim on NOT reg8bits opcode 2021-05-10 10:27:53 +02:00
ptitSeb d33917421b [DYNAREC] Fixed 66 0F C8..CF BSWAP opcode 2021-05-09 09:36:35 +02:00
ptitSeb 7c0b11e5e0 [DYNAREC] Added support for unaligned LOCK INC/DEC Ed opcode 2021-05-03 10:15:08 +02:00
ptitSeb 6a84e2eee9 Added support for unaligned LOCK INC/DEC Ed opcode 2021-05-03 10:07:59 +02:00
ptitSeb 26bad84244 Changed canary to have last byte NULL (not randomly placed) 2021-04-25 11:43:05 +02:00
ptitSeb eafd7081f3 Added some tips for winetricks desktop shortcut (for #380) 2021-04-25 10:30:00 +02:00
ptitSeb 2ad2851b2c Added basic support for Symbol Versionning (only consume, not generate yet), and use SymbolVersion on old pthread_cond* functions 2021-04-23 13:51:21 +02:00
ptitSeb f4924f6fd3 [DYNAREC] Added 66 0F F7 opcode 2021-04-23 08:24:36 +02:00
ptitSeb 78920a61ad Fixed some crash with wrapped libSDL_sound 2021-04-22 12:00:05 +02:00
ptitSeb 160f9f964f Added somesupport for R_386_TLS_TPOFF32 reloc (not sure it's 100% correct) 2021-04-22 11:36:55 +02:00
ptitSeb f81435cc2e Added 2 curl wrapped functions 2021-04-22 08:13:32 +02:00
ptitSeb 62df3cbe98 Added 1 more funciton to libSDL2 2021-04-21 15:29:58 +02:00
ptitSeb b0b000a3f2 Added Syscall 331 2021-04-20 20:39:04 +02:00
ptitSeb 9e244e068d Added some more gtk wrapped functions 2021-04-20 18:58:19 +02:00
ptitSeb 4a8d19da78 Another small change to custommem MaxFreeblock handling 2021-04-20 12:17:20 +02:00
ptitSeb 5a0fbcd7ba Fixed a typo in libatk-bridge-2.0.so.0 wrapping 2021-04-19 19:40:44 +02:00
ptitSeb 1ca20269b7 Improvments to ElfLoader Reloc handling 2021-04-19 14:44:26 +02:00
ptitSeb 5b3eb577fc Fixed a small issue with Custom Mem handler and MexFreeBlock calculation 2021-04-19 14:44:09 +02:00
ptitSeb 337d08d466 Added a few more FreeType wrapped functions 2021-04-18 10:40:44 +02:00
ptitSeb e784c34cb4 [DYNAREC] Try to fix some problem when re-loading a lib 2021-04-17 18:09:27 +02:00
ptitSeb 525c54a035 Added wrapped libXft 2021-04-17 17:12:30 +02:00
ptitSeb 65cc054c9c Fixed signature for wrapped function syslog 2021-04-17 16:46:13 +02:00
ptitSeb 64639ae623 Better handling of long double 2021-04-17 13:21:24 +02:00
ptitSeb 74fb70a675 [DYNAREC] Hack for sequence of FLD / FSTP tbytes 2021-04-17 13:20:58 +02:00
ptitSeb ca142fbc56 Use actual curl4 wrapping for curl3 2021-04-16 15:34:28 +02:00
ptitSeb af498728b0 Better trace for semop 2021-04-16 15:34:08 +02:00
ptitSeb a68c5dc00e Added DF D0..D7 opcodes 2021-04-16 08:10:24 +02:00
ptitSeb 7e279e1963 Added 65 40..4F opcodes 2021-04-15 16:20:50 +02:00
ptitSeb 01395347ce Added F3 C0/D0 ocpodes 2021-04-15 16:20:28 +02:00
ptitSeb b5493c779f [DYNAREC] fixed x86size of dynablock sons 2021-04-15 14:11:34 +02:00
ptitSeb 919b071990 Small improvement on custommem handlier 2021-04-15 14:11:02 +02:00
ptitSeb 46a9718d29 Fixed the unload of libs at exit 2021-04-15 13:08:30 +02:00
ptitSeb 82e3fbfbad Better wrapping and trace for __vsprintf_chk 2021-04-15 11:22:35 +02:00
ptitSeb 9004d2b80f Update FUNDING.yml 2021-04-15 10:48:20 +02:00
ptitSeb ddb91106c2 Merge pull request #377 from rajdakin/libFreeOrder
Libraries free order fix
2021-04-14 20:19:55 +02:00
rajdakin 9d7505a61c Fixed the exit crash... 2021-04-14 20:12:09 +02:00
rajdakin e1140c0401 (Hopefully) fixed the library freeing ordering (avoid crash) 2021-04-14 20:06:21 +02:00
ptitSeb 76a0d9bfa3 Also handle internal mutex in my_sighandler 2021-04-14 18:05:44 +02:00
ptitSeb a015c7a368 [DYNAREC] Fixed MVN emitter 2021-04-14 17:36:04 +02:00
ptitSeb 329ed0bb5b Merge pull request #376 from rajdakin/fix11
Stabilized test 11
2021-04-14 11:16:00 +02:00
rajdakin c3bc2808e9 Stabilized test 11 2021-04-14 10:42:50 +02:00
ptitSeb 584586dea8 Added wrapped libSDL_net-1.2.so 2021-04-14 08:53:03 +02:00
ptitSeb 8f84f73162 Added wrapped libSDL2_net-2.0.so (backported from box64) 2021-04-14 08:41:05 +02:00
ptitSeb ce3bf7151a Added wrapped libSDL_sound-1.0.so.1 2021-04-14 08:36:24 +02:00
ptitSeb 5cb5eb296d Merge pull request #375 from rajdakin/addDoc
Added documentation to the python scripts
2021-04-14 07:51:12 +02:00
rajdakin 336b0a42e9 Added a pseudo-documentation for the second generator 2021-04-13 22:32:13 +02:00
ptitSeb a32af2cf76 Adjusted Youtube channels comment on README 2021-04-13 22:21:34 +02:00
rajdakin 307a4f5010 Automated libbz2 and libcrypto 2021-04-13 22:15:11 +02:00
rajdakin 5320b4f22f Added some documentation 2021-04-13 22:14:41 +02:00
ptitSeb 70a1d452f3 Merge pull request #374 from rajdakin/mergeBox64
Improved box86 a bit, added an automation
2021-04-13 21:26:05 +02:00
rajdakin 61869a91c7 Re-added AuxVec 32 (vsyscall) 2021-04-13 21:12:26 +02:00
rajdakin 68bc003fd2 Improved box86 a bit, added an automation 2021-04-13 20:59:32 +02:00
ptitSeb f29912620d Fixed Non-Android build 2021-04-13 18:22:02 +02:00
ptitSeb 4a780af9fe Merge pull request #372 from io12/android
Initial Android support attempt
2021-04-13 17:56:47 +02:00
Benjamin Levy 6b6e6c874b Initial Android support attempt 2021-04-13 10:46:28 -04:00
ptitSeb d42d067945 Enable TokiTori2+ patch for RK3399 too 2021-04-13 11:46:24 +02:00
ptitSeb 17e80a3a09 Added a few syscall around inotify 2021-04-13 10:53:09 +02:00
ptitSeb 674c5b5819 Added wrapped libatk-bridge-2.0.so 2021-04-13 09:36:37 +02:00
ptitSeb 01629e1faf Some function signatures changes and fixed (backported from box64) 2021-04-12 18:34:36 +02:00
ptitSeb 38a33ab15b Fixed 0F E3 opcode 2021-04-11 16:38:08 +02:00
ptitSeb 2163365115 Improvement in internal mutex handling on signal, and [DYNAREC] multitasking changes to the JmpTable 2021-04-11 12:04:41 +02:00
ptitSeb f67902f098 Added F3 A0/E0 opcodes 2021-04-11 08:49:03 +02:00
ptitSeb bfe47b408d Removed a useless definition 2021-04-10 16:12:35 +02:00
ptitSeb aa2bea2d84 Fixed non-Dynarec build 2021-04-10 16:12:20 +02:00
ptitSeb 40c5b1b8d3 Added F3 80 opcode ([DYNAREC] too) 2021-04-10 08:13:35 +02:00
ptitSeb ee714259df Added wrapped GtkWindowClass 2021-04-08 14:26:42 +02:00
ptitSeb aa7b620d8e Some add/changes to libcrypto (for 1.0.2 on 1.1 emulation) 2021-04-07 15:24:59 +02:00
ptitSeb 794c16644b [DYNAREC] Ok, need to save D8..D15 in prolog / restaor them in epilog, they are callee saved 2021-04-07 13:20:02 +02:00
ptitSeb dda64c5b5e And another fix for potential deadlock (after a fork) 2021-04-06 11:55:55 +02:00
ptitSeb 6784a79db0 Fixed SDL AudioSpec structure definition 2021-04-06 11:01:53 +02:00
ptitSeb 564dfea143 Fixed some potentiel deadlock with bridge creation 2021-04-06 08:16:05 +02:00
ptitSeb 7e9f514d8b Removed a debug leftover 2021-04-05 18:38:23 +02:00
ptitSeb 68809a753d Added some more GL wrapped functions 2021-04-05 17:45:02 +02:00
ptitSeb 4ba390abd6 [DYNAREC] On useless test, store the values so defered flags can be computed 2021-04-05 17:44:42 +02:00
ptitSeb fe2b4cb8f3 Improve end of a program (backported frm box64) 2021-04-05 17:43:48 +02:00
ptitSeb dbef73bd75 Fix potential issue on GL when used via SDL2 only 2021-04-05 15:14:37 +02:00
ptitSeb ec19cc1e41 Removed a debugg leftover 2021-04-05 11:06:40 +02:00
ptitSeb 63e099a912 [DYNAREC] Added 66 87 and 66 0F C1/C8..CF opcodes 2021-04-05 11:04:57 +02:00
ptitSeb 282309ee9b Ignore a segfault on access when everything seems fine (probably a multitask glitch, makes linux Terraria works 2021-04-04 22:33:15 +02:00
ptitSeb bd48cae19f Simplified signal handling and [DYNAREC] Simplified dynablock/memory handling (backported from box64) 2021-04-04 18:17:24 +02:00
ptitSeb b2d8a5ceb8 Ooops, this typo must have broken some multitrheads apps 2021-04-04 15:17:48 +02:00
ptitSeb 438677e61a Small changes, mostly cosmetics ([DYNAREC] too) 2021-04-04 15:17:23 +02:00
ptitSeb 44a7535791 Added wrapped FcFreeTypeCharIndex to libfontconfig 2021-04-01 21:57:44 +02:00
ptitSeb 2117a62dc1 Added libdl.so as a dependancy to libGL.so 2021-04-01 21:06:25 +02:00
ptitSeb 99c27bed99 Added wrapped FcCharSetCount function to libfontconfig 2021-04-01 21:03:49 +02:00
ptitSeb 161cd9dc3f [DYNAREC] Change dlog level of this message (to much spam on LOG_INFO) 2021-04-01 18:57:00 +02:00
ptitSeb 0228fcd7d3 Added wrapped FcNameRegisterObjectTypes function to libfontconfig 2021-04-01 16:23:34 +02:00
ptitSeb 3da4e03ddc Merge pull request #367 from rajdakin/fix_rootc
[CMAKE] Fixed builds with '.c' in the path
2021-03-28 20:05:11 +02:00
rajdakin 8030af55b8 [CMAKE] Fixed builds with '.c' in the path 2021-03-28 20:01:56 +02:00
ptitSeb ee757c117c Use a simple pthread_exit wrapping, to not mess with pthread cancel stuff 2021-03-28 17:30:11 +02:00
ptitSeb a93665abf4 Fixed a warning 2021-03-28 14:05:24 +02:00
ptitSeb e3c39f4f97 Better handling of Stacks 2021-03-28 14:03:50 +02:00
ptitSeb 9bf5c20a9a Reworked README a bit 2021-03-27 19:48:55 +01:00
ptitSeb c02a069c5e Fixed aio_suspend64 function signature (fixing file transfert for TeamSpeak Server) 2021-03-27 19:15:08 +01:00
ptitSeb e5bf05c5c2 [DYNAREC] Better handling of bridge 2021-03-27 19:14:17 +01:00
ptitSeb 017d82d16e [DYNAREC] Removed lock on Memory Protection, and change Dynarec generation to have anticiped ending if a block already exist for next address (should help C# and Unity3D softwares) 2021-03-27 12:50:20 +01:00
ptitSeb 5f6d75da12 Added libudev1 as alternative to libudev0 2021-03-27 08:29:07 +01:00
ptitSeb 633919dd74 Small changes t libc and libdbus 2021-03-27 08:00:56 +01:00
ptitSeb e83a119cbb Added one more symbol from libfontconfig 2021-03-26 14:21:49 +01:00
ptitSeb 00ac8ec1aa Added some symbols from SDL2.0.12 and 2.0.14 2021-03-26 14:21:05 +01:00
ptitSeb 491f111caf [DYNAREC] Fixed F3 0F BC opcode 2021-03-25 15:07:52 +01:00
ptitSeb 8e92453f4c Cosmetic changes to some wrapped function signatures from libresolv 2021-03-25 13:58:06 +01:00
ptitSeb bc198c37d7 Improve shutdown sequence 2021-03-25 11:48:46 +01:00
ptitSeb 5ab84a6e78 Minor cosmetic changes to some libc wrapped functions signatures 2021-03-25 11:48:31 +01:00
ptitSeb 334080dfd0 Merge pull request #363 from Jai-JAP/patch-1
Add RPI4ARM64 compiling instructions.
2021-03-25 07:56:06 +01:00
Jai-JAP 46012a6a8c Update COMPILE.md
Add RPI4ARM64 compiling instructions.
2021-03-25 10:45:40 +05:30
ptitSeb 3b546a6048 Smale cosmetic changes 2021-03-24 19:28:52 +01:00
ptitSeb 522b8d5fc0 Fix non-Dynarec build that would crash at start 2021-03-24 19:28:52 +01:00
ptitSeb 74d3bb76da Various small (cosmetics) fixes 2021-03-24 11:42:28 +01:00
ptitSeb a28080e065 Better mecanism for pthreard_once callback handling 2021-03-24 11:42:09 +01:00
ptitSeb 638b341ba5 Avoid potential deadlock on bridge creation with dynarec (may help #217) 2021-03-18 14:26:05 +01:00
ptitSeb c254dc3121 Made the mutex for memory protection recursive, to try mitigate lock on #217 2021-03-17 08:43:43 +01:00
ptitSeb fe0778656b [DYNAREC] cosmetic change 2021-03-17 08:42:42 +01:00
ptitSeb e478b99307 [DYNAREC] Fixed NEON used reg push/pop when calling C function from dynablock 2021-03-15 13:47:59 +01:00
ptitSeb 9d2cd89a7c [DYNAREC] Fixed comment on dynarec on CMake project 2021-03-15 13:47:15 +01:00
ptitSeb be82ccbfcd Merged MMX and x87 regs (like in actual hardware) 2021-03-13 19:13:30 +01:00
ptitSeb 18dfbb61b4 Fixed a few minor leaks 2021-03-13 16:43:29 +01:00
ptitSeb 0f8e39d785 Another batch of various fix, mostly cosmetics 2021-03-13 14:36:02 +01:00
ptitSeb c4fdf490a2 Improve handling of rounding of SSE ([DYNAREC] too) 2021-03-13 08:56:10 +01:00
ptitSeb 55764011db Fixed png16 wrapped png_create_read_struct function signature 2021-03-13 08:51:03 +01:00
ptitSeb 9a483890b6 Merge pull request #360 from WheezyE/patch-3
Update X86WINE.md
2021-03-11 21:35:01 +01:00
Eric Wiessner (KI7POL) 4421377624 Update X86WINE.md
Fixed a typo in the example code section (downloaded libfaudio twice).  Also made more small cosmetic changes.
2021-03-11 13:32:55 -07:00
ptitSeb f817d06e14 Added a workaround for the '...' of g_set_error wrapped function 2021-03-11 17:37:46 +01:00
ptitSeb 6b0b389a69 Merge pull request #359 from Itai-Nelken/patch-1
Improve X86WINE.md
2021-03-10 20:33:07 +01:00
Itai Nelken 496899ffe3 Update X86WINE.md 2021-03-10 21:28:07 +02:00
ptitSeb 7a05331e76 Merge pull request #358 from WheezyE/patch-1
Update X86WINE.md
2021-03-10 19:58:34 +01:00
ptitSeb e7e725cb5e Merge pull request #357 from WheezyE/patch-2
Update README.md
2021-03-10 19:57:39 +01:00
Eric Wiessner (KI7POL) 8385f6ad4e Update README.md
Added Wine installation instructions
2021-03-10 11:19:18 -07:00
Eric Wiessner (KI7POL) aeb3f7a438 Update X86WINE.md
Moved things around a little for readability
2021-03-10 11:13:28 -07:00
ptitSeb d9fa04d2ed Merge pull request #356 from meveric/master
working on glib2 and png16
2021-03-10 11:29:03 +01:00
meveric d4b5e585d1 fixing typos 2021-03-10 10:09:02 +00:00
meveric 8579037bb1 copied symbols from png12 to png16 2021-03-10 09:59:48 +00:00
ptitSeb 13cce1a4dd Various (mostly cosmetics) adjustments to wrapped functions signature 2021-03-09 21:52:07 +01:00
meveric 5724dfad87 wrapped g_cond_init, g_cond_clear, g_cond_wait of glib2 2021-03-09 20:02:53 +00:00
ptitSeb f370bf77a8 [DYNAREC] Better handling of SMC dynablocks 2021-03-08 14:52:17 +01:00
ptitSeb fc3540ac08 Fixed libGLU callback wrapped function, and added libalure wrapped (was ready for a long time in fact) 2021-03-07 18:17:59 +01:00
ptitSeb c16f361c4a Refined .gitignore for TwisterOS Armbian 2021-03-07 17:14:49 +01:00
ptitSeb 92a0f507af Small cosmetics changes in signal handler 2021-03-07 16:54:28 +01:00
ptitSeb 6bb7cdbdd4 Some small improvment on interpretor fow a few MMX opcodes 2021-03-07 16:34:07 +01:00
ptitSeb 1809a2bac3 Small adjustments to pthread cancel handling and a few libc functions signatures 2021-03-07 14:20:44 +01:00
ptitSeb 430658c1a4 Merge pull request #353 from WheezyE/patch-1
Update X86WINE.md
2021-03-07 07:54:17 +01:00
Eric Wiessner (KI7POL) 746383b72b Update X86WINE.md
Just tidying things up a bit more.
2021-03-06 19:52:25 -07:00
ptitSeb d244151ca2 Added 65 13 ADC Gd,GS:Ed opcode (for #349) 2021-03-06 09:20:42 +01:00
ptitSeb e4c1626638 Fix a build error with NOALIGN 2021-03-06 09:20:11 +01:00
ptitSeb c07cee0d01 Merge pull request #350 from WheezyE/patch-1
Create X86WINE.md
2021-03-06 09:16:23 +01:00
Eric Wiessner (KI7POL) 43132bd9b0 Create X86WINE.md
Installation and use of x86 Wine for Box86
2021-03-05 23:37:21 -07:00
ptitSeb ed982e1d2c [DYNAREC] Fixed NotEqual on float/double SSE flag handling (help ut99 build 469) 2021-03-05 16:18:35 +01:00
ptitSeb 7420ea052d Small fix on atol function signature 2021-03-05 15:02:10 +01:00
ptitSeb 044326d337 Added 65 0F B6 opcode 2021-03-03 20:07:42 +01:00
ptitSeb 96c126bbcc Update Zydis header to latest version 2021-03-03 18:55:26 +01:00
ptitSeb ba0e524805 Merge pull request #348 from mobilegmYT/patch-1
Move install instructions higher up and add pi-apps mention
2021-03-02 19:40:57 +01:00
RPI News ba19f56338 Add RPI to pi-apps 2021-03-02 11:26:59 -07:00
RPI News 14df602fa4 Moved install instructions higher up and added pi-apps 2021-03-01 20:06:47 -07:00
ptitSeb d972e205ac Fixed jpeg62 compress issue (should help #343, WeChat and other Wine app that create jpeg with windowscodec) 2021-02-27 16:31:04 +01:00
ptitSeb 114f2b8cd2 Wrapped libtiff.so.5 (minimal set of functions for Wine) 2021-02-27 16:31:04 +01:00
ptitSeb 87f8830d16 [DYNAREC] Fixed DD /1 FISTTP opcode (fixed WK issue) 2021-02-26 11:21:43 +01:00
ptitSeb a0afe05995 [DYNAREC] Added new option BOX86_NODYNAREC to forbid creation of Dynablock in an interval range (to debug difference between Dynarec and Interpretor) 2021-02-26 10:16:35 +01:00
ptitSeb ddd4d37ad1 Merge pull request #345 from SpacingBat3/patch-2
Fixed link to "x86primop.c".
2021-02-25 20:53:14 +01:00
SpacingBat3 ede296ef01 Fixed link to "x86primop.c".
It seems that original link has been broken earlier and I haven't checked that earlier.
This commit should change that.
2021-02-25 20:07:29 +01:00
ptitSeb 1307ce364d [DYNAREC] Small fix for previous commit, adjusting ARM PC 2021-02-25 13:54:34 +01:00
ptitSeb 37fa84d762 [DYNAREC] Get a warning on trace build when jump to NULL address (with some info of the origin of the jump) 2021-02-25 13:46:06 +01:00
ptitSeb b3e984bd22 More fixes to elfloader when hinted memory is not satisfied 2021-02-23 18:43:26 +01:00
ptitSeb 7da5b9b7eb Added some log for elfloader with ET_DYN and hinted addr 2021-02-23 18:36:30 +01:00
ptitSeb 55b979f656 More try at fixing elfloader with ET_DYN that have hinted vaddr 2021-02-23 18:04:18 +01:00
ptitSeb 815a6c3ade More fixes to elfloader for ET_DYN type of elf 2021-02-23 16:04:01 +01:00
ptitSeb 33db7a8005 New change on elfloader and mmap handling 2021-02-23 15:18:49 +01:00
ptitSeb 963ac3039e Deactivated wine_prereserve if not wine_preloaded 2021-02-23 12:09:37 +01:00
ptitSeb 552db005b1 [DYNAREC] Fixed a compilation warning 2021-02-23 09:49:47 +01:00
ptitSeb 2d1e8cf1f2 Deactivated wine_preload again, the order between lib load and wine_preload doesn't seem correct 2021-02-23 07:51:30 +01:00
ptitSeb 8e44e8bf13 Fixed elfloader when using wine_preload (which need MAP_FIXED on mmap) 2021-02-22 22:02:56 +01:00
ptitSeb e7cc7b3409 [DYNAREC] quick fix to the ARM->x87 flags conversion improvment 2021-02-22 20:12:11 +01:00
ptitSeb 4e5473150a Use mmap for custommem (hardcoded optionnal for now), and improve JMPTABLE, DYNAMAP and MEMPROT memory handling 2021-02-22 19:10:09 +01:00
ptitSeb e8e7597c62 Reactivated and improved wine_loader detection and wine_prereserve mecanism 2021-02-22 19:10:09 +01:00
ptitSeb f9b03600d1 Added an error if elfloader mmap are not at the requested address 2021-02-22 19:10:09 +01:00
ptitSeb 88a8ebb1dc Removed the MAP_FIXED flag to elfloader mmap (maybe need to add a warning if allocated mem is at a different location?) 2021-02-22 19:10:09 +01:00
ptitSeb 4445785ee1 [DYNAREC] Improved the CALL 0 hack to make it more generic 2021-02-22 19:10:09 +01:00
ptitSeb 3b3460cbba [DYNAREC] Removed a useless opcode in FNSTSW AX opcode 2021-02-22 19:10:09 +01:00
ptitSeb 7eb6789a25 [DYNAREC] Fixed a warning 2021-02-22 19:10:09 +01:00
ptitSeb 870fed75ad [DYNAREC] Fixed ARM->x87/SSE flag conversion 2021-02-22 19:10:09 +01:00
ptitSeb 833c2809d9 Merge pull request #340 from SpacingBat3/patch-1
Some documentation fixes and improvements.
2021-02-22 09:55:25 +01:00
SpacingBat3 24ec881fe5 Update COMPILE.md
Use "make" command with a parallel jobs limited to the number of the CPU threads for "ODROID", "Other ARM Linux platforms" and "x86 Linux" (which should speed up compiling process for these platforms).
2021-02-20 13:31:06 +01:00
SpacingBat3 d7d7bc91a2 A fix for broken link in README.md
There was one broken link (pointing to `docs/src/` instead to `docs/`).
2021-02-20 12:43:58 +01:00
ptitSeb 1ea8dc828a Merge pull request #339 from SpacingBat3/master
Moved the documentation to "docs/" folder.
2021-02-19 11:53:32 +01:00
ptitSeb ade7d82e52 Test for mutex alignment on pthread_cond_timedwait and pthread_cond_wait 2021-02-18 11:45:31 +01:00
ptitSeb fa5c6652b6 [DYNAREC] Small change to LOCK XADD 2021-02-18 11:44:41 +01:00
ptitSeb a5ab6b1520 Added better way to generate SIGILL (and added 0F 3F Illegal Opcode) 2021-02-18 09:41:28 +01:00
ptitSeb bf74640917 [DYNAREC] Some speedup of signal handling, to help C# and Mono stuffs 2021-02-17 18:18:04 +01:00
ptitSeb 420d309db6 Some more fixes to elfloader (to get both CMR and Potatoman running) 2021-02-17 18:17:13 +01:00
ptitSeb c4d170ebb8 Added 3 data in glib2 wrapped lib 2021-02-17 17:54:06 +01:00
ptitSeb 9cc69095d5 Some fixes to elfloader (fixes SuperHexagon, maybe more) 2021-02-16 14:42:33 +01:00
SpacingBat3 eb5dd2c005 Moved the icon/logo to the "docs/img/" folder. 2021-02-16 14:21:44 +01:00
SpacingBat3 39fbbe61a3 Moved documentation to "docs/" folder. 2021-02-16 14:01:57 +01:00
ptitSeb ba71080fb2 Fixed a warning on threads 2021-02-15 11:41:44 +01:00
ptitSeb db176ad3e3 Update CHANGELOG.md 2021-02-11 21:08:29 +01:00
ptitSeb 002638ef96 Added _pthread_cleanup_pop and _pthread_cleanup_push wrapped function to pthreads lib 2021-02-10 14:33:55 +01:00
ptitSeb 22b74477ac Fixed vfprintf wrapped function for non POWERPCLE build 2021-02-10 14:33:16 +01:00
ptitSeb 9c5a9ebba7 [DYNAREC] Don't allocate too much memory blindly 2021-02-09 16:56:58 +01:00
ptitSeb fce3f38e3a [DYNAREC] Fixed previous optim on mem protectio handling for some special cases 2021-02-09 16:09:05 +01:00
ptitSeb aabb600aed [DYNAREC] Some optimisation with memory protection managment 2021-02-09 14:41:29 +01:00
ptitSeb a062a8efa6 Fixed many SDL2 issue with RWops 2021-02-08 20:18:58 +01:00
ptitSeb 9b690667dc Fixed a warning 2021-02-08 16:18:26 +01:00
ptitSeb de7897c5c2 Wrapped custom mremap to handle memory protection 2021-02-08 14:20:21 +01:00
ptitSeb d3d431d5b1 Improve memory protection managment and multi-threads 2021-02-08 14:19:49 +01:00
ptitSeb 6409f5d40a Merge branch 'master' of https://github.com/ptitSeb/box86 2021-02-08 13:09:11 +01:00
ptitSeb aeab3c815e Improved handling of R_386_COPY and R_386_GLOB_DAT reloc in elfloader (helps c++ progs) 2021-02-08 13:08:36 +01:00
ptitSeb 4837797fae Merge branch 'master' of https://github.com/ptitSeb/box86 2021-02-08 09:59:51 +01:00
ptitSeb 0ffc8682b1 Wrapped libcrypt.so.1 2021-02-07 16:21:01 +01:00
ptitSeb cb35a8d85c Merge branch 'master' of https://github.com/ptitSeb/box86 2021-02-06 14:11:07 +01:00
ptitSeb 5999255b5d Merge pull request #328 from rajdakin/rbit_clz
Added the CLZ and RBIT opcodes
2021-02-06 13:42:30 +01:00
rajdakin a7654c6a80 [PRINTER] Added the CLZ and RBIT opcodes 2021-02-06 13:39:10 +01:00
ptitSeb 2b3791f701 Fixed 2 wrapped functions signature from libudev.so.1 2021-02-06 13:31:42 +01:00
ptitSeb 7f52a18fac Simplified (again?) cancel thread handling 2021-02-05 12:36:44 +01:00
ptitSeb ff8bb3b2e4 [DYNAREC] Changed a bit how arm_lock_storeifnull works 2021-02-05 12:35:23 +01:00
ptitSeb 5b7cc6d4de Improved detection of non-libc header when building elfload_dump.c (should help #327) 2021-02-05 11:37:50 +01:00
ptitSeb 1d9774c913 [DYNAREC] Fixed shrd32c and shld32c emiter when used with c > 0x1f (helps WeChat #324) 2021-02-04 13:28:17 +01:00
ptitSeb 8b13ba26d7 [DYNAREC] Removed a useless opcode on 0F C0 XADD 2021-02-04 13:27:05 +01:00
ptitSeb 8730f4daa6 Merge pull request #325 from MichaIng/patch-1
Update notes about Steam
2021-02-03 12:03:15 +01:00
MichaIng 52f4d2a1a6 Update notes about Steam
The "Remember password" feature works only if libnm is installed, otherwise the next starts hang infinite.

Steam can be started with the small mode mini games list opened directly by using the "+open steam://open/minigameslist" command line arguments.

The Steam for Linux issues have been sorted into a listing, to get a better overview and separation between each issues. The Steam for Windows note has been mode below the list.

A few minor spelling and wording fixes have been applied: "Steam" always with capital S, full sentences, aligned package install instruction on Debian.

Signed-off-by: MichaIng <[email protected]>
2021-02-03 11:39:25 +01:00
ptitSeb 6a498c373c Creation of new bridge is now protected by a mutex 2021-02-02 15:49:03 +01:00
ptitSeb 007c7a887e Added 64 9C PUSHFD opcode (ignoring 64 prefix) 2021-02-02 09:44:28 +01:00
ptitSeb 922a8864e8 [DYNAREC] Optimized 0F BA opcodes 2021-02-01 17:17:24 +01:00
ptitSeb 16383f4577 [DYNAREC] Added 66 0F BA BT/BTS/BTR/BTC Ew, Ib opcodes 2021-02-01 17:17:06 +01:00
ptitSeb bc66bb5be9 [DYNAREC] Added handling of null-sized Dynablock (fixed avgn, maybe other too) 2021-02-01 15:13:32 +01:00
ptitSeb 84360f24c1 Another change on Elfloader to help loading c++ programs 2021-01-31 10:36:34 +01:00
ptitSeb cad160205f Fixed wrapped libusb transfert callbacks (should help #323) 2021-01-30 13:16:05 +01:00
ptitSeb 807519e3c4 Small change to elfloader to help Unity3D games, hopefully without breaking something else 2021-01-29 16:31:54 +01:00
ptitSeb 425ffb6e68 Added an empty crashhandler wrapped lib specific to steam (should help steam stability a bit) 2021-01-28 16:59:43 +01:00
ptitSeb 0ede6b8fa5 Various small fixes are warning removal (especialy for non-dynarec build) 2021-01-28 15:38:39 +01:00
ptitSeb 381d723462 Added preloaded libasan handling (same as libtcmalloc_minimum) 2021-01-28 15:31:05 +01:00
ptitSeb cad8de8cd8 [DYNAREC] Pre-calc entry point for thread only if dynarec is activated 2021-01-28 09:40:19 +01:00
ptitSeb 7d7d275e7e [DYNAREC] Sligtly improved dynarec log at DEBUG level 2021-01-28 09:39:29 +01:00
ptitSeb 80db7d9a21 [DYNAREC] Free all dynablockslist when exiting 2021-01-28 09:38:38 +01:00
ptitSeb d8943af79a [DYNAREC] Changed log level of the Wild block appear warning 2021-01-27 14:51:45 +01:00
ptitSeb bcbf9360af Small leak fix in pathcoll sources 2021-01-27 14:51:13 +01:00
ptitSeb 6320b0928e Improved handling of RPATH 2021-01-27 08:20:35 +01:00
ptitSeb 74afa2551a [DYNAREC] Fixed PF flag computation for TEST opcode that was broken a few commit ago 2021-01-26 15:34:40 +01:00
ptitSeb dd733c4128 [DYNAREC] Some more fixes for special cases in the handling of memory protection (should help #227) 2021-01-25 20:09:12 +01:00
ptitSeb 0eaa1b6c5e Added F3 50..62 opcodes 2021-01-24 16:45:24 +01:00
ptitSeb f595859cf0 [DYNAREC] Small optim on LL/GE/LE/G flahs handling 2021-01-24 16:26:10 +01:00
ptitSeb 85e0d01451 Some fixes for some BOX86_LOG=2 function call details 2021-01-24 15:24:53 +01:00
ptitSeb ec57e035d6 [DYNAREC] Small optim to avoidDefered flag handling when doing ADD/SUB on ESP with a constant 2021-01-24 13:54:21 +01:00
ptitSeb 0d0b4d7364 [DYNAREC] More work on logic and shift emiters and PF flag handling 2021-01-24 12:19:38 +01:00
ptitSeb aeb91fce74 [DYNAREC] Small optim of CF and ZF flag handling on emiters 2021-01-23 12:18:57 +01:00
ptitSeb e163bd842e [DYNAREC] Small optim on MOV32 pseudo arm opcode 2021-01-23 11:45:07 +01:00
ptitSeb 2ff7bd1bc7 [DYNAREC] Small optim on AND32c emiter 2021-01-23 10:45:22 +01:00
ptitSeb 533c703b0d [DYNAREC] Remove workaround for Unreal FMOD SMC code in 81 CMP i32 opcode as it's not more needed 2021-01-23 10:05:25 +01:00
ptitSeb 1d1a82f529 [DYNAREC] Small optim to LEA opcode 2021-01-23 09:50:29 +01:00
ptitSeb 911b95a505 [DYNAREC] Remove dynarec linker mecanism and use generic TableJump instead (also all memory that have a dynablock is protected now, should improve compatibility with C# and program taht use SelfModifyCode) 2021-01-22 16:16:12 +01:00
ptitSeb 8209cf8398 [DYNAREC] Fix a bug when freeing a large dynablock allocation 2021-01-21 18:35:21 +01:00
ptitSeb 02423d4a2d [DYNAREC] Small optim on JumpTable reset function 2021-01-21 16:10:47 +01:00
ptitSeb ba5c13fb6c [DYNAREC] Fixed previous commit, PvZ work again now 2021-01-21 15:58:33 +01:00
ptitSeb ddd13bcab0 [DYNAREC] Removed CALL/RET optimization and replace it with a generic JumpTable mecaniism (get a 10% speedup minimum, probably much more on Wine software) 2021-01-21 11:23:45 +01:00
ptitSeb 3b6800e38e Fixed some warning in RunFS66 function 2021-01-20 12:19:15 +01:00
ptitSeb 6c2ebf91c0 [DYNAREC] Change log level for the Call to 0x0 Warning 2021-01-20 12:09:16 +01:00
ptitSeb a64d1de7cd Added a workaround for glXSwapIntervalMESA to have a stub function if it's not exposed 2021-01-20 10:05:56 +01:00
ptitSeb d6ce7f5c16 Some small changes and trace improvement around glXGetProcAddress and Int 3 2021-01-20 09:00:56 +01:00
ptitSeb 1fe29c512f Added some code to check alignment on mutex and use a aligned one if needed (it's good 99% of the time) 2021-01-19 13:43:24 +01:00
ptitSeb e76176b663 Changed a bit how 66 64 prefix is handled 2021-01-18 16:39:39 +01:00
ptitSeb acbe0527d7 Small improvment to Unimplemented Opcode log 2021-01-18 16:39:21 +01:00
ptitSeb 81d8f2f5c3 Changed 660F opcodes back to a switch (no reason to keep the array of label here) 2021-01-18 14:46:37 +01:00
ptitSeb 8976e77109 Various small improvments to 64 and 65 prefixed opcodes 2021-01-18 14:30:47 +01:00
ptitSeb 31bd7ebfbc Added support for FO 0F BA/5 BTS opcode ([DYNAREC] Too) and fixed some F0 opcodes too (helps #314) 2021-01-18 11:41:30 +01:00
ptitSeb 487b979842 Added some F4 HLT opcode implementation, not sure if it's the best way to do it 2021-01-17 17:12:28 +01:00
ptitSeb efd1408809 Improved log on Double Segfault 2021-01-16 15:30:10 +01:00
ptitSeb 867e8aaa00 Small change in signal handling to allow multiple time a memory protection on same address 2021-01-16 15:28:54 +01:00
ptitSeb e3e5fd7568 Added 65 06 and 65 07 opcodes 2021-01-15 20:08:34 +01:00
ptitSeb 7e6b012a08 Fixed 66 F0 xx opcodes 2021-01-15 18:43:13 +01:00
ptitSeb 546fe18836 Added F0 66 83 ocpcode (only 66 F0 83 was there before) 2021-01-15 16:09:37 +01:00
ptitSeb 1cb7683636 Merge pull request #311 from heavygabriel/master
Clarified a bit more documentation, fixed a lot of typos and removed some redundant codes.
2021-01-14 23:14:00 +01:00
heavygabriel f89c7faf3c Changed documentation per PtitSeb's code review. 2021-01-14 15:12:02 -05:00
heavygabriel cf36c668b3 Merge pull request #1 from ptitSeb/master
sync fork with box86
2021-01-14 14:38:24 -05:00
ptitSeb dd41352392 Added 64 67 3B opcode (for #304) 2021-01-13 19:36:16 +01:00
ptitSeb ec42322f23 Start of a new dev. cycle 2021-01-13 19:35:27 +01:00
heavygabriel 3b8a9b5cc5 Fixed a few typos in README.md 2021-01-12 17:12:12 -05:00
heavygabriel 6d3b2fe902 Simplified some code. 2021-01-12 17:04:27 -05:00
heavygabriel 819ec41320 Updated Copyright year 2021-01-12 16:42:48 -05:00
heavygabriel 40fd950b40 Reworded a bunch of stuff, added consistent formatting and fixed typos. 2021-01-12 16:34:08 -05:00
heavygabriel 4f64c106a7 Removed a bunch of typos, reformulated a big batch of sentences. 2021-01-12 14:32:33 -05:00
ptitSeb b2d5587ea1 Bumped to v0.2.0 2021-01-12 19:44:14 +01:00
ptitSeb 4b020ab4f5 Merge pull request #309 from heavygabriel/master
Simplified code
2021-01-11 19:43:05 +01:00
heavygabriel 088a85c125 Update COMPILE.md 2021-01-11 11:45:54 -05:00
heavygabriel 2bf60dc00d Removed some typos. 2021-01-11 11:39:04 -05:00
unknown b5ffa0e92a Simplified a bunch of ifs and elses 2021-01-11 10:21:01 -05:00
ptitSeb 258f7f9b50 Added BOX86_NOVULKAN to disable loading of vulkan libs 2021-01-10 11:24:55 +01:00
ptitSeb 07c403243d Added 66 CB opcode 2021-01-10 11:03:19 +01:00
ptitSeb 709de6a858 Fix compilation for build without Dynarec 2021-01-09 19:35:41 +01:00
ptitSeb dfed557f61 [DYNAREC] Fixed SAKF opcode, and improved a but flag handling (fixing regression on GIG Installer from Dec. 30th commit) 2021-01-09 17:36:27 +01:00
ptitSeb f143771be8 Merge pull request #303 from heavygabriel/master
Remove the //TODO: in USAGE.md
2021-01-08 19:20:00 +01:00
heavygabriel fc20c410c0 Delete TROUBLESHOOTING.md 2021-01-08 10:23:37 -05:00
heavygabriel 677205a288 Update USAGE.md
removed //TODO:
2021-01-08 09:17:37 -05:00
heavygabriel abb9acfd42 Create TROUBLESHOOTING.md
Information on how to solve specific problems.
2021-01-08 09:16:29 -05:00
ptitSeb 75dca68db0 Fixed custom allocator for memory block >= 256k (should help old 32bits Factorio, and maybe #274) 2021-01-08 09:53:03 +01:00
ptitSeb 5c1a8ad128 Fixed USAGE.md, default log is now 0 2021-01-08 09:51:44 +01:00
ptitSeb e4cf8f8c94 Merge pull request #302 from heavygabriel/master
Updated documentation
2021-01-08 07:49:19 +01:00
heavygabriel 30968917a4 Merge pull request #7 from heavygabriel/patch-7
Update USAGE.md
2021-01-07 18:59:11 -05:00
heavygabriel 84ea9e3301 Merge branch 'master' into patch-7 2021-01-07 18:59:02 -05:00
heavygabriel 1f9c046919 Merge pull request #6 from heavygabriel/patch-8
Update USAGE.md
2021-01-07 18:48:28 -05:00
heavygabriel cefe210184 Merge pull request #5 from heavygabriel/patch-9
Update USAGE.md
2021-01-07 18:47:29 -05:00
heavygabriel 02aa791fd9 Merge pull request #4 from heavygabriel/patch-10
Update COMPILE.md
2021-01-07 18:45:58 -05:00
heavygabriel d8c1341068 Merge pull request #2 from heavygabriel/patch-2
Patch 2
2021-01-07 18:45:14 -05:00
heavygabriel ca648ea128 Merge pull request #3 from heavygabriel/patch-3
Patch 3
2021-01-07 18:43:43 -05:00
heavygabriel daf5a9d91d Merge pull request #1 from heavygabriel/patch-1
Patch 1
2021-01-07 18:43:02 -05:00
heavygabriel 16b95f2088 Update COMPILE.md
Added further clarifications, fixed typos ,etc.
2021-01-07 18:38:26 -05:00
heavygabriel 41dfcb559a Update USAGE.md
Added a bit of documentation, fixed things, etc. (This really needs some love, can anyone better suited for the task contribute? thanks.
2021-01-07 18:32:11 -05:00
heavygabriel 37c871ec2e Update USAGE.md
Added a bit of documentation, fixed things, etc. (This really needs some love, can anyone better suited for the task contribute? thanks.
2021-01-07 18:31:18 -05:00
heavygabriel 34bd1ff42f Update USAGE.md
Added a bit of documentation, fixed things, etc. (This really needs some love, can anyone better suited for the task contribute? thanks.
2021-01-07 18:30:34 -05:00
heavygabriel e0f1d4fecf Update README.md
Changed how things are worded (again again+3 ) . Added some new clarification in the documentation (Need to see how to reword the box86 discord mentionning thingy) etc.
2021-01-07 18:16:37 -05:00
heavygabriel c94d992ef6 Update README.md
Changed how things are worded (again again+3 ) . Added some new clarification in the documentation (Need to see how to reword the box86 discord mentionning thingy) etc.
2021-01-07 18:16:34 -05:00
ptitSeb bfe83d827d Fixed a potential BUSERROR on 66 0F 12 opcode 2021-01-07 19:44:06 +01:00
ptitSeb 1c45795828 Merge pull request #298 from heavygabriel/patch-1
Update README.md
2021-01-07 16:09:30 +01:00
heavygabriel 8dc5c164d8 Update README.md
again, updated typos.
2021-01-07 09:34:47 -05:00
heavygabriel 326032aa23 Update README.md
Changed the notes for raspberry pi a bit, changed how the unity section is worded and generally changed small little typos and things.
2021-01-07 09:24:25 -05:00
ptitSeb b79e234da2 Merge pull request #297 from kalashnikovdmitryv/patch-1
Add flag for RPI4 with arm64+armhf multiatch
2021-01-06 20:32:50 +01:00
kalashnikovdmitryv 5bc6962a9d Update CMakeLists.txt 2021-01-06 22:23:21 +03:00
ptitSeb 168717a90a Added some more functions t wrapped libxslt 2021-01-06 20:02:56 +01:00
ptitSeb dd6b0f6c9a [DYNAREC] Tiny optim on dynablock creation 2021-01-05 22:04:27 +01:00
ptitSeb 0a3c678877 Fixed compilation on non Dynarec build 2021-01-04 18:57:26 +01:00
ptitSeb e2df6f6ce0 Added 66 F0 81/83 opcodes 2021-01-04 08:35:25 +01:00
ptitSeb e58ebdac18 [TRACE] Fix build when trace is enabled 2021-01-03 18:16:10 +01:00
ptitSeb 537312a91f Use Custom allocator for all hash map 2021-01-03 16:39:58 +01:00
ptitSeb 11c08acd6c [DYNAREC] Need to improve this optimization, reverting for now (help Unity3D games) 2021-01-03 15:40:48 +01:00
ptitSeb cf9a38fb02 [DYNBAREC] Try to make dynarec more resiliant on heavily multi-threaded program 2021-01-03 11:20:56 +01:00
ptitSeb 83dff2bf25 Merge branch 'master' of https://github.com/ptitSeb/box86 2021-01-03 10:43:03 +01:00
ptitSeb 49694f300a Fixed a warning on wrapped libdl 2021-01-03 10:21:10 +01:00
ptitSeb daddc8246e Small fixes in xcb wrapped functions signature 2021-01-03 10:20:14 +01:00
ptitSeb 9f92377edc Small change to some pthread wrapped functions 2021-01-02 16:18:21 +01:00
ptitSeb 1ce392d968 Fixed the added flags in O_* converters 2021-01-02 15:03:46 +01:00
ptitSeb bf730b43e2 Add a few more flags in O_* converters 2021-01-02 14:57:38 +01:00
ptitSeb a4adb47caf Various small changes in some libc functions signature 2021-01-02 14:47:19 +01:00
ptitSeb 9317572874 Minor changes to O_* flags handling and conversion 2021-01-02 13:13:58 +01:00
ptitSeb eca39e6a8f Improve Signal and Memory protection Handling on multi-thread program, and added BOX86_JITGDB=2 (Should help #273, KSP old linux32 version now works, should also help .net programs) 2021-01-01 18:32:18 +01:00
ptitSeb 4639dc8ffd Minor signature changes for some libpulse functions 2021-01-01 18:32:18 +01:00
ptitSeb 5a9b34f54b Added log for waitpid 2021-01-01 18:32:18 +01:00
ptitSeb dc07d477de Added syscall 318 getcpu (should help #217) 2021-01-01 18:09:53 +01:00
ptitSeb db5efa8908 Fix compile on non-Dynarec build 2021-01-01 11:12:38 +01:00
ptitSeb 7d462dd837 Try to detect Excution error on Signal handling, to help .net programs 2021-01-01 10:37:56 +01:00
ptitSeb 76010f63c0 Fixed BOX86_LOG=2 on some wrapped libc functions 2021-01-01 09:40:17 +01:00
ptitSeb be7f72808b Merge pull request #292 from Hacker1245/patch-1
Fix a typo
2020-12-31 16:27:01 +01:00
ptitSeb 25f1e8e6fa Fixed some lib pulse callback (should help both #193 and #293 and maybe other pulseaudio apps) 2020-12-31 16:25:10 +01:00
ptitSeb 047df311f0 Added xcb_send_request_with_fds64 to wrapped lib xcb 2020-12-31 16:23:24 +01:00
ptitSeb bcdd99328c [DYNAREC] Fixed a samll issue with Logs 2020-12-31 16:22:40 +01:00
ptitSeb 5cc76a0071 [DYNAREC] Another small optim on flags handling 2020-12-31 12:53:55 +01:00
ptitSeb dee55a9ac2 [DYNAREC] Fixed a potential segfault 2020-12-31 08:59:04 +01:00
ptitSeb 9ff20da9bb Added more slots for pulse audio callback (should help #293) 2020-12-30 22:56:42 +01:00
Hacker1245 0520f5abcd Fix a typo 2020-12-30 22:07:19 +01:00
ptitSeb e1201ff0de [DYNAREC] Optimize test emiter to avoid BFI/UBFX when possible 2020-12-30 18:13:32 +01:00
ptitSeb bc2d7e7396 [DYNAREC] Optimize shift emiter to avoid BFI/UBFX when possible 2020-12-30 17:50:58 +01:00
ptitSeb 9a058a2416 [DYNAREC] Optimize logic emiter to avoid BFI/UBFX when possible 2020-12-30 17:29:51 +01:00
ptitSeb 49fea86b28 [DYNAREC] Optimized math emiter to avoid UBFX/BFI when possible 2020-12-30 16:52:34 +01:00
ptitSeb 1617439d37 Flags are only handled in packed form now, removed Unpacked array 2020-12-30 15:58:07 +01:00
ptitSeb 540459cb78 [DYNAREC] Now used r14 (so lr) instead of r12 for EIP/scratch register 2020-12-29 20:02:12 +01:00
ptitSeb 54b8522df6 [DYNAREC] Added SHLD32c emiter 2020-12-29 16:27:27 +01:00
ptitSeb bf65e606d3 [DYNAREC] Minor reordering of operation in DB E2 opcode 2020-12-29 16:27:01 +01:00
ptitSeb 5335a641df [DYNAREC] Fixed 66 99 CWD opcode 2020-12-29 16:26:16 +01:00
ptitSeb 323ece7417 [DYNAREC] Added amiter for SHRD32c 2020-12-29 13:37:57 +01:00
ptitSeb ca1fc0ffad [DYNAREC] Fix a potential memory corruption on exit 2020-12-29 11:18:30 +01:00
ptitSeb c0706e227e [DYNAREC] Removed a warning 2020-12-29 09:40:48 +01:00
ptitSeb 995e4a9b68 [DYNAREC] Switch POP/PUSH from STM/LDM to LDR/STR, so there is no alignment constraint anymore 2020-12-29 08:43:56 +01:00
ptitSeb 7f53379552 Don't printf Segfault handler message if custom handler is setuped on LOG_NONE level 2020-12-28 16:12:26 +01:00
ptitSeb 3e17299a34 Made 8F opcode consistant on segfault ([DYNAREC] too) 2020-12-28 16:11:06 +01:00
ptitSeb c63cdc9506 Added 66 CC opcode, and handling of CC by using raise(SIGTRAP) if SIGTRAP is handled ([DYNAREC] too) 2020-12-28 10:26:09 +01:00
ptitSeb 7965186817 Added TSC flag to CPUID cpu capabilities 2020-12-28 07:57:35 +01:00
ptitSeb f107612753 Force PROT_REAT when PROT_WRITE is set, as it's implicit on i386 2020-12-28 07:40:45 +01:00
ptitSeb 2295f7bb8b Added 66 0F D0 opcode ([DYNAREC] too) 2020-12-28 05:48:57 +01:00
ptitSeb cc0845a9d3 Added wrapped function glib_check_version 2020-12-27 15:22:31 +01:00
ptitSeb e9019461b7 [DYNAREC] Added 0F E1/E2/E3 opcodes 2020-12-27 15:22:07 +01:00
ptitSeb a19e3ed3dd [DYNAREC] Small optim on new memory protection tracker 2020-12-27 16:11:37 +01:00
ptitSeb 10ec424e96 More separation between POWERPC and ARM 2020-12-27 15:58:15 +01:00
ptitSeb b838c8a7d0 [DYNAREC] Fixed new memory protection tracking 2020-12-27 15:15:24 +01:00
ptitSeb 0331af0643 Track memory protection also on mmap/munmap/mprotect syscall 2020-12-27 12:38:24 +01:00
ptitSeb 24561fc37c [WINE] Removed wine_prereserve handling, it seems to be working better without it 2020-12-27 11:41:35 +01:00
ptitSeb d4ad5334b8 [DYNAREC] Some fixes to new memory protection tracking 2020-12-26 18:30:34 +01:00
ptitSeb 7fe3299282 Refined POWERPC support to less impact ARM 2020-12-26 18:27:21 +01:00
ptitSeb 23fef75ed5 [DYNAREC] Fixed FISTTP opcode 2020-12-26 09:55:10 +01:00
ptitSeb 62722b0618 Merge pull request #279 from eerykitty/master
Basic support for little-endian PowerPC and POWER9.
2020-12-25 09:29:10 +01:00
Joseph Allen e810dba2c9 Fixes semctl and a number of variadic functions. 2020-12-24 22:47:23 -06:00
Joseph Allen 7dfe545161 Basic support for little-endian PowerPC and POWER9. 2020-12-24 15:14:50 -06:00
ptitSeb a5f3966b44 Merge pull request #275 from SpacingBat3/master
Updated the PKGBUILDS
2020-12-24 09:38:53 +01:00
ptitSeb 886573ed8b Merge pull request #276 from RickAndTired/patch-1
Typo fix
2020-12-24 09:38:27 +01:00
RickAndTired 2758c1c955 Typo fix
Line 105 typo: kernle
2020-12-23 21:56:13 -08:00
ptitSeb 591bafe8c3 [DYNAREC] Try to improve the marking mecanism to include blocks that are shadowed by others 2020-12-23 09:21:50 +01:00
ptitSeb 211a8f42db Small cosmetic changes to wrapped libsdl2 2020-12-22 22:01:44 +01:00
ptitSeb fbc9029a8e [DYNAREC] Removed unused fiel in dynablocklist structure 2020-12-22 20:01:57 +01:00
ptitSeb ceb4b8b06d Removed a debug leftover 2020-12-22 15:13:29 +01:00
ptitSeb b88dda442f [DYNAREC] Improved block extender mecanism 2020-12-22 14:42:57 +01:00
ptitSeb 6e8163bded [DYNAREC] Moved fakeed function for helper to functions 2020-12-22 13:32:36 +01:00
ptitSeb 9b253abb53 More jpeg62 compress function wrapping (should help #271) 2020-12-22 11:31:09 +01:00
ptitSeb e5e51e3ea3 [DYNAREC] Fix a potential SIGBUS on 66 0F 12 opcode 2020-12-21 17:37:29 +01:00
ptitSeb 6a2d9d7663 Try to avoid a segfault on quit with libpulse 2020-12-21 17:36:51 +01:00
ptitSeb 0546b1e212 Try to fix wrapped Compress functions of libjpeg62 (for #271) 2020-12-21 11:17:03 +01:00
ptitSeb 320e6dae72 [DYNAREC] Reworked a bit the unaligned stack handling workaround to limit console spam 2020-12-21 10:47:16 +01:00
ptitSeb 96f944c804 More fixes to build new memory tracking whithout dynarec 2020-12-20 23:53:40 +01:00
ptitSeb fd0e2195f7 Fix build of memory tracking whithout dynarec 2020-12-20 23:49:31 +01:00
ptitSeb d2f130a834 Memory protection tracking is not only with Dynarec ON now 2020-12-20 23:38:32 +01:00
ptitSeb a3459712ce Fix 66 F0 0F B1 opcode 2020-12-20 23:37:57 +01:00
ptitSeb 8bf2e49164 Reorganised 8F POP Ed opcode to better handle Ed referencing ESP ([DYNAREC] too) 2020-12-20 15:35:57 +01:00
ptitSeb 0f5cd39a64 [DYNAREC] Refined the SIGBUS recovery to limit to push/pop/call/ret opcode (as FPU/SIMD regs are not saved/restored from Signal for now) 2020-12-20 14:13:24 +01:00
ptitSeb e0ed0076f2 [DYNAREC] When a SIGBUS occurs in a dynablock, invalidate the block at that address and try again with interpretor (fix MapleLegends Setup with its strangely aligned stack) 2020-12-20 12:09:51 +01:00
ptitSeb bfd4ad39af [DYNAREC] Fixed some issue with the memory protection mecanism 2020-12-20 11:06:31 +01:00
ptitSeb a8ff7d8769 [DYNAREC] Improved Memory Protection Tracking 2020-12-20 10:30:37 +01:00
ptitSeb 39c77beb1c Fixed Signal handling for PAGEFAULT with Write Error (helps Wine) 2020-12-20 10:11:59 +01:00
ptitSeb d576f7af39 Cleaner version of TEST Eb, Ib and TEST Ed, Id opcodes 2020-12-20 10:10:10 +01:00
ptitSeb 74c3f43f75 [DYNAREC] Better hanling of memory protection for elf memory 2020-12-20 10:09:12 +01:00
ptitSeb ecacace01d [DYNAREC] Added some handlng of protection for malloc'd memory 2020-12-20 10:08:21 +01:00
ptitSeb a3b0149a84 Added 66 1F opcode 2020-12-19 18:18:04 +01:00
ptitSeb 63111577ec Added 64 66 8B opcode 2020-12-19 17:45:55 +01:00
ptitSeb eb68520709 [DYNAREC] Some fixes to improved Memory protection tracker 2020-12-19 17:09:35 +01:00
ptitSeb a7bf2c6cc3 Fixed a potential SIGBUS on 66 0F 13 ocpode 2020-12-19 14:46:57 +01:00
ptitSeb 190788efd9 Added gss_wrap_iov function to wraped libgssapi_krb5 (still for wine) 2020-12-19 13:42:47 +01:00
ptitSeb 2592a6a342 Added gss_wrap function to wraped libgssapi_krb5 (still for wine) 2020-12-19 12:17:01 +01:00
ptitSeb 16ee4c348d [RK3399] Fixed a warning 2020-12-19 12:02:37 +01:00
ptitSeb 8389097cd3 [DYNAREC] Improved memory protection tractick 2020-12-19 11:44:02 +01:00
ptitSeb 79a885c15e Set theme jekyll-theme-hacker 2020-12-19 10:24:18 +01:00
ptitSeb eb7c683a6d Also added gss_verify_mic to libgssapi_krb5 2020-12-18 16:42:26 +01:00
ptitSeb 95b2b314f6 Wrapped libkrb5 and libgssapi_krb5 (minimum functions for wine) 2020-12-18 15:55:34 +01:00
ptitSeb 07eb0aa5cd [DYNAREC] Don't free dynarec elf memory durring elf unloading, it will be free later anyway 2020-12-18 13:56:09 +01:00
ptitSeb fdce28590a Added alternate way to handle some vaarg wrapped functions 2020-12-18 12:24:10 +01:00
ptitSeb 572613e377 Fixed wrapping of Compress structure on libjpeg62 (for #271) 2020-12-18 11:14:42 +01:00
ptitSeb 29e597b4ed Fixed another potential SIGBUS, in CMPXCHG this time 2020-12-17 21:39:23 +01:00
ptitSeb 981c464c36 Fixed a potential SIGBUS with XADD Gd, Ed opcode 2020-12-17 20:52:48 +01:00
ptitSeb d406c5717c Wrapping Compress functions callbacks for libjpeg.so.62 (shoudl help #271) 2020-12-17 10:44:37 +01:00
ptitSeb 92208efd24 Start of a new dev. cycle 2020-12-17 10:43:31 +01:00
ptitSeb 3c98cbccbe Bumped to v0.1.8 2020-12-16 07:58:23 +01:00
ptitSeb 3a5c6751e2 Many fixes to Double->Int x87 opcodes ([DYNAREC] too) 2020-12-15 15:53:38 +01:00
ptitSeb 002d3d7b9b This also fixes 66 D9 and 66 DD opcodes 2020-12-15 15:52:53 +01:00
ptitSeb e57a66da04 [DYNAREC] Fixed AAD opcode 2020-12-15 15:51:13 +01:00
ptitSeb b1ecad2d49 Fixed 66 D9 and 66 DD opcodes 2020-12-15 15:50:18 +01:00
ptitSeb 658a107f60 Better log for FE xx and FF xx Illegal Instructions on interpretor 2020-12-15 15:49:39 +01:00
ptitSeb 7b419ce5f1 Fix a callback for pulse audio (help #268, seems to be working now) 2020-12-15 15:40:58 +01:00
ptitSeb 367df08989 Fix Zoom hack for libturbojpeg.so (for #268) 2020-12-15 07:59:04 +01:00
ptitSeb 2004006a9d Added Zoom detection and hack to first try to use system libturbojpeg.so if loaded (still for #268) 2020-12-14 21:45:57 +01:00
ptitSeb bed0f24f2b Wrapped libturbojpeg.so.0 with a small set of functions (should help #268) 2020-12-14 20:48:56 +01:00
ptitSeb 7995dfc70a Fixed a potential SIGBUS on DF /7 FISTP opcode 2020-12-14 14:12:43 +01:00
ptitSeb b29d569f6b Reworked libpulse wrappers (should be more stable and little tad faster) 2020-12-14 12:22:39 +01:00
ptitSeb 3c166c438a [DYNAREC] Added BOX86_DYNAREC_SAFEMMAP (can be usefull to speedup Wine progs, but may also introduce crash) 2020-12-13 20:25:55 +01:00
ptitSeb 03dac0ef6a [DYNAREC] Use a table read that is not thread safe in linker (I don't think thread safe is a must-have in this case) 2020-12-13 19:26:31 +01:00
ptitSeb 27cb5219ae [DYNAREC] Various simplifications 2020-12-13 19:24:27 +01:00
ptitSeb 97a7459f5d [DYNAREC] Small optims 2020-12-13 16:12:17 +01:00
ptitSeb 1eac337e59 [DYNAREC] Don't flush dynarec_log 2020-12-13 16:11:59 +01:00
ptitSeb 1613358927 [DYNAREC] Fixed a type is FS: Cache handling (should give back some speed on Wine stuff) 2020-12-13 15:38:32 +01:00
ptitSeb 2f0da26f14 [DYNAREC] Presize dblists 2020-12-13 14:21:05 +01:00
ptitSeb 45fa32cb9d [DYNAREC] Small fixes for cancelled dynablock 2020-12-13 14:19:56 +01:00
ptitSeb 9e9f2a37be [DYNAREC] Precalc exact instsize array size 2020-12-13 14:19:04 +01:00
ptitSeb 7b37bb6825 [DYNAREC] simplify this structure 2020-12-13 14:18:36 +01:00
ptitSeb 081378a178 Added empty wrapped libnsl.so 2020-12-13 10:05:28 +01:00
ptitSeb ff72343429 [DYNAREC] Removed a debug leftover 2020-12-13 10:04:57 +01:00
ptitSeb b0b8a2ca1c Fixed a warning 2020-12-13 09:09:35 +01:00
ptitSeb 55be6835b8 Removed a debug leftover (should help #227 and box-compatibility-list/#46) 2020-12-13 08:38:43 +01:00
ptitSeb c465e1de21 [VULKAN] fixed SDL2 wrapping of SDL_Vulkan_GetVkGetInstanceProcAddr 2020-12-12 19:50:04 +01:00
ptitSeb 0f255de201 Made box86context_t lighter for easier debugging (also reorganised member order) 2020-12-12 19:50:04 +01:00
ptitSeb deb04610b5 Revert commit 31a108b685, previous method seems better 2020-12-12 19:25:53 +01:00
ptitSeb a9887fe471 Fixed an old type on Bridge handling 2020-12-12 17:09:35 +01:00
ptitSeb 4b3c5a7f6f [DYNAREC] Reworked Dynablock memory manager 2020-12-12 15:24:05 +01:00
ptitSeb 0058d3563d Added 66 F0 0F B1 opcode 2020-12-12 10:18:13 +01:00
ptitSeb 52a4808f2c Added a few more function to wrapped libfontconfig 2020-12-12 10:09:17 +01:00
ptitSeb 7a0874165f Added 1 wrapped function to libfontconfig 2020-12-12 09:37:44 +01:00
ptitSeb 7c7acd134b Small wrapped libmpg123 and pulse change 2020-12-11 22:27:43 +01:00
ptitSeb ddd4874baa [DYNAREC] Some small optim on support function for the Dynarec 2020-12-11 21:04:11 +01:00
ptitSeb 23f91b1a0d [DYNAREC] All Interpretor to switch back to Dynarec on more opcodes 2020-12-11 20:47:23 +01:00
ptitSeb b8c32d580b [DYNAREC] If a block wasn't created because executable memory was not allocated, delete the whole dynablocks to try again later 2020-12-11 20:35:39 +01:00
ptitSeb c0e67004d5 [DYNAREC] Reworked the dynarec signal handling, to improve its performances 2020-12-11 20:25:24 +01:00
ptitSeb 38a557b7e9 [DYNAREC] Don't try to create 0 sized Map block 2020-12-11 17:28:32 +01:00
ptitSeb 7d6d5d673d [DYNAREC] added 64 A2 opcode 2020-12-11 17:27:23 +01:00
ptitSeb 2cf067f004 [DYNAREC] Don't try to a free a 0 sized of NULL pos Map 2020-12-11 17:27:08 +01:00
ptitSeb 92d9bc525f [DYNAREC] Try to avoid some deadlock with dynarec that could happens in some specific cases involving signals 2020-12-11 16:43:25 +01:00
ptitSeb dca91b1efc added 64 A0 opcode ([DYNAREC] too) 2020-12-11 16:32:14 +01:00
ptitSeb 6bf1ea7539 [DYNAREC] Remove some old code behind ifdefs 2020-12-11 14:23:18 +01:00
ptitSeb 670b13595b Improved the PltRelocator detection of elfloader 2020-12-10 17:14:17 +01:00
ptitSeb dcbb8b29de Added some X11 wrapped functions 2020-12-10 17:12:40 +01:00
ptitSeb 7284c817b2 And more libxcb* wrapped functions 2020-12-10 17:05:54 +01:00
ptitSeb b16912132f Added some xcb_xrandr wrapped functions 2020-12-10 15:44:53 +01:00
ptitSeb 9805ad7f3a Initialize context as soon as possible in library (should help #265 and #266) 2020-12-10 15:11:26 +01:00
ptitSeb 4e7e0f6aab Added a few libdrm wrapped function 2020-12-10 13:56:24 +01:00
ptitSeb c905ebfdd2 Added wrapped libSDL2_ttf-2.0.so.0 (copy if the sdl1 version) 2020-12-10 13:51:31 +01:00
ptitSeb b5c787938c Fixed commented code, in case it gets uncommented someday 2020-12-10 13:38:59 +01:00
ptitSeb 69ca5351b4 Added a bunch of wrapped xcb* functions 2020-12-10 12:35:52 +01:00
ptitSeb 3f42372603 Added liblcms2 wrapped lib (partial wrapping, just enough for wine) 2020-12-09 15:54:33 +01:00
ptitSeb 595028e9ec Reworked Exit, to avoid segfault and lockup and end of execution 2020-12-09 11:25:14 +01:00
ptitSeb 7358a049ef Huge refactoring (again), completly removed old Callback mecanism (working to have only 1 x86emu_t structure per thread, almost there) 2020-12-08 22:38:51 +01:00
ptitSeb 792aeda72e Be more smart to when to apply PltRelacator or not (fix SuperHexagon's libGLEW loading) 2020-12-08 21:44:21 +01:00
ptitSeb 53bf2d277b Added wrapped libldap_r and liblber 2020-12-08 08:10:02 +01:00
ptitSeb 0cbc55ba24 Fix potential build error on old system (at least with old headers) 2020-12-08 07:56:18 +01:00
ptitSeb 7b0d228972 Added a few XTandr wrapped functions 2020-12-08 07:54:40 +01:00
ptitSeb 8ac0b66836 Improved Segment offset Cache, and enable GS: caching (some speed boost on Linux apps) 2020-12-07 13:56:29 +01:00
ptitSeb 2756b1b9dd [DYNAREC] fixed some warning and a typo from last commit 2020-12-06 22:31:15 +01:00
ptitSeb e3f44bae26 [DYNAREC] Huge refactor to simplify Dynablock handling 2020-12-06 21:52:27 +01:00
ptitSeb 1963589186 Mooore Thread Cancel slots 2020-12-06 21:14:38 +01:00
ptitSeb a5c9675b84 [DYNAREC] Removed Mark mecanism (it needs mutex to run properly, so it's too heavy) 2020-12-06 15:13:40 +01:00
ptitSeb 76747d5c38 [DYNAREC] Immprove log for SMC debugging option 2020-12-06 15:12:36 +01:00
ptitSeb 59bfeb9fb2 [DYNAREC] This barrier optimization seems to break Mono on Linux, so reverting it for now 2020-12-06 13:15:09 +01:00
ptitSeb c40669b429 [DYNAREC] Optimized AddMark function to not redo what is already done 2020-12-05 23:22:09 +01:00
ptitSeb d83cdbfeeb Fixed a potential segfault 2020-12-05 23:21:29 +01:00
ptitSeb d8773e96d6 Not sure if awesomium_process needs or not emulated libpng12. Commenting for now 2020-12-05 20:59:24 +01:00
ptitSeb 78571698c2 Some improvements in wrapped libpng handling 2020-12-05 19:43:52 +01:00
ptitSeb 77282f1ff1 Added one more wrapped function to libglib2 2020-12-05 17:07:57 +01:00
ptitSeb 953fcb7f1b Fixed handling of TLS object with a 0 offset (help Garry's Mod, probably a few other too) 2020-12-05 16:59:08 +01:00
SpacingBat3 edef6d7f99 Updated the PKGBUILDS
Improved old PKGBUILDs and added the PKGBUILD for the RK3399 targets.
2020-12-05 16:43:47 +01:00
ptitSeb 1905e4a7f6 Better handling of libtcmalloc_minimum.so.4 2020-12-05 16:15:35 +01:00
ptitSeb 31e6ae0705 Improved the BOX86_NOBANNER behaviour 2020-12-05 12:49:17 +01:00
ptitSeb 31a108b685 Change method used for Thread Cancel registeration 2020-12-04 21:47:39 +01:00
ptitSeb b122c68b16 Improved a bit XImage handling 2020-12-04 21:47:04 +01:00
ptitSeb 0efae1fdf5 Added BOX86_NOGTK to disable use of wrapped gtk libs (can be used with Steam) 2020-12-04 19:52:10 +01:00
ptitSeb 0850180861 Fixed and improved wrapped libdbus-1 2020-12-04 19:49:25 +01:00
ptitSeb 528478b379 Improved a bit wrapped libusb-1 2020-12-04 17:55:30 +01:00
ptitSeb 65302010db Small remork on cancel tread registration mecanism (should fix memory leaks) 2020-12-03 12:01:07 +01:00
ptitSeb 6b32440347 Small fix (mostly cosmetic) in a pthread wrapped function signature 2020-12-03 12:00:32 +01:00
ptitSeb 5a0b6c419e [DYNAREC] Fixed some memory leak 2020-12-03 11:59:43 +01:00
ptitSeb 94c5d0205b fixed some warning 2020-12-03 11:58:49 +01:00
ptitSeb 0f2998a672 More libxml2 wrapping improvment for wine 2020-12-02 21:39:27 +01:00
ptitSeb 1ba7936ef7 Improve wrapping of libxml2 (especially for wine msxml3.dll.so) 2020-12-02 21:16:19 +01:00
ptitSeb 5192aacb22 [RPI] Added runtime hack to get TokiTori2+ running on Pi 2020-12-01 15:13:22 +01:00
ptitSeb ac2adcaf52 A bit more logs when function name is not found 2020-12-01 15:01:12 +01:00
ptitSeb 1b3e707f62 Added SDL_LogGetOutputFunction to wrapped libsdl2 and refactored remaining callback functions 2020-12-01 08:59:01 +01:00
ptitSeb 925fc67c66 Fixed a typo in wrapped libxml2 2020-12-01 08:33:47 +01:00
ptitSeb 54ce6deb1c Wrapped libxslt (should help #259) 2020-11-30 20:02:57 +01:00
ptitSeb 754859d28a Wrapped libxml2 (should help #259) 2020-11-30 18:42:09 +01:00
ptitSeb 269bc9e289 [DYNAREC] Disable one of the new optim, it breaks some installer 2020-11-29 17:26:54 +01:00
ptitSeb 35c768c040 [DYNAREC] Fixed an issue with an optimisation that was too agressive 2020-11-29 13:51:11 +01:00
ptitSeb ff45cfed83 [DYNAREC] Various fixes on some dynarec optimisation mecanism 2020-11-28 16:07:04 +01:00
ptitSeb 38c5c1c17a [DYNAREC] Added 64 FF /2 CALL FS:Ed opcode 2020-11-28 15:32:22 +01:00
ptitSeb 423b301596 Added syscal 356 (and code to emulate it if not present) 2020-11-28 12:26:40 +01:00
ptitSeb 000c11f9ea [PANDORA] Added basic implementation of renameat2 2020-11-28 12:17:12 +01:00
ptitSeb cea4a02ad9 Fixed RPATH handling when a list of path was set 2020-11-28 11:10:01 +01:00
ptitSeb 4e9bc39381 [DYNAREC] Some rework on dynablock management 2020-11-27 17:40:16 +01:00
ptitSeb ad084da13d Start a new dev. cycle with v0.1.7 2020-11-27 10:18:13 +01:00
ptitSeb 27e5262f1d Bumped to v0.1.6 2020-11-26 09:43:33 +01:00
ptitSeb 363464092e [DYNAREC] Added 66 60/61 16bits PUSHA/POPA opcodes 2020-11-25 12:04:47 +01:00
ptitSeb b2cab70427 [DYNAREC] Improved 16bits immediate PUSH opcodes 2020-11-25 12:04:46 +01:00
ptitSeb 44d5301244 [DYNAREC] Improved 16bits PUSH/POP opcodes 2020-11-25 12:04:46 +01:00
ptitSeb 8e4f4feb3c Updated CHANGELOG 2020-11-25 12:04:46 +01:00
ptitSeb e9f6f8824c [DYNAREC] Fixed a potential SIGBUS with int64->double loading 2020-11-24 12:04:03 +01:00
ptitSeb be6f9870d0 Added 64 01/03/11/2B opcodes 2020-11-23 18:41:20 +01:00
ptitSeb bb086223c7 Update README.md 2020-11-23 13:33:36 +01:00
ptitSeb be6a3bff3f Fixed 2 wrapped functions signature in libappindicator (help Steam) 2020-11-22 20:42:49 +01:00
ptitSeb adfc5fda2e Fixed a SEGBUS on RK339 build 2020-11-22 20:31:33 +01:00
ptitSeb d833f136a0 Enable the 'GOG Linux install hack' also for RK3399 platforms 2020-11-22 18:41:37 +01:00
ptitSeb 1703e9d1b7 Refined CMakeList a bit 2020-11-22 18:41:05 +01:00
ptitSeb 011b9f93e4 [DYNAREC] Fixed 66 0F EA/EE opcodes (should fix #253 this time) 2020-11-22 17:30:30 +01:00
ptitSeb e449a4e247 Launch natively program if elf is not recognised as an i386, or not an elf 2020-11-22 14:08:11 +01:00
ptitSeb fe7f0ff842 Fixed potential BUSERROR with LOCK CMPXCHG8B opcode on interpretor 2020-11-22 13:52:44 +01:00
ptitSeb 2033e5764d Fixed potential segfault when using BOX86_LOG=2 2020-11-22 13:05:28 +01:00
ptitSeb 55175263ac [DYNAREC] Added 0F BA /5 and /7 opcodes 2020-11-22 10:52:40 +01:00
ptitSeb c484221cd6 Remove the 'suspicious segment' left over debug code 2020-11-22 10:21:55 +01:00
ptitSeb e9862cb30d [DYNAREC] Fix potential issue when multiple similar thread are launched at the same time (will help #253) 2020-11-21 20:32:52 +01:00
ptitSeb 0c7b99cbc6 [DYNAREC] Changed how opcodes 66 0F 38 08/09/0A are coded (this fixes the md5 error in #253) 2020-11-21 18:36:55 +01:00
ptitSeb 824f39e4db [DYNAREC] Potential fix for 66 0F 38 1C/1D/1E when Gx==Ex and Gx is not cached yet (help #253, but still some issues) 2020-11-21 15:31:27 +01:00
ptitSeb 66a5ce1e52 [DYNAREC] Fixed 66 0F 38 1C/1D/1E opcode (for #253, still not ok, how many opcodes are borked?) 2020-11-21 15:18:22 +01:00
ptitSeb f39637a652 [DYNAREC] Fixed 66 0F EE opcode (for #253, but still not enough) 2020-11-21 15:10:03 +01:00
ptitSeb eaf7d0a277 [DYNAREC] Fixed 66 0F 38 08/09/0A opcode (should help #253 a bit) 2020-11-21 14:54:25 +01:00
ptitSeb b61bb908a2 Improve handling of signals with threads or functions call 2020-11-21 11:06:16 +01:00
ptitSeb 2e891b807c [DYNAREC] Added 66 0F 38 08/09/0A opcodes (for #253 again) 2020-11-20 21:44:47 +01:00
ptitSeb f0b236df88 [DYNAREC] Added 66 0F 38 1C/1D/1E opcodes (still for #253) 2020-11-20 21:18:42 +01:00
ptitSeb 08904dbe0d [DYNAREC] Added 66 0F E4/E5/EA/EE opcodes (should help #253) 2020-11-20 21:04:45 +01:00
ptitSeb c9c4e226af Added 0F DA PMINUB and 0F DE PMAXUB opcodes ([DYNAREC] too) 2020-11-18 21:21:42 +01:00
ptitSeb ab3dc70145 Added 2 clipboard function to gtk2 wrapped lib 2020-11-18 20:50:06 +01:00
ptitSeb 4d8c841f3f [DYNAREC] Fix potential BUSERROR of F3 0F 2C and F3 0F 2D opcode, and fixed a typo on F3 0F E6 opcode 2020-11-18 20:44:38 +01:00
ptitSeb a8b247cde9 More improvments and fixes to signal handler 2020-11-18 19:29:52 +01:00
ptitSeb 416e161285 Added F2 0F D0 ADDSUBPS Gx, Ex opcode 2020-11-18 15:28:21 +01:00
ptitSeb cc8d1f9bf2 Better handling of signals 2020-11-18 09:58:55 +01:00
ptitSeb ae95f1b0e5 One more wrapped func tion with callback to gtk2 2020-11-17 10:35:29 +01:00
ptitSeb c10441bec4 Added g_timeout_* wrapped functions to libglib2 2020-11-17 10:27:43 +01:00
ptitSeb 6ab334fc34 Fixed a nasty typo in wrapped libgobject2 2020-11-17 10:27:20 +01:00
ptitSeb 10e849ce60 Fixed a warning in generated wrapper.c 2020-11-17 10:03:35 +01:00
ptitSeb c2206f5452 Aligned most of GValue handling in gtk libs 2020-11-17 09:41:18 +01:00
ptitSeb 3b66cd3cee Merge branch 'master' of https://github.com/ptitSeb/box86 2020-11-16 22:20:11 +01:00
ptitSeb 731a083bb7 Merge pull request #251 from daitj/makemkvtest
added few more wrapper for libcrypto (for #250)
2020-11-16 22:18:25 +01:00
Binay Devkota d35c6ab864 added more wrapper function for #250 2020-11-16 22:51:28 +02:00
Binay Devkota e9cade872c fixed previous commit as i am blind 2020-11-16 20:42:46 +02:00
Binay Devkota b2a8146851 added missing wrapped function for libcrypto #250 2020-11-16 20:15:53 +02:00
ptitSeb 6fd3d6c452 Improved handling of 'marshal' function in gobject2 2020-11-16 19:06:25 +01:00
ptitSeb bc3e72a87d Added a few more wrapped function to libcrypto (for #250) 2020-11-16 17:28:18 +01:00
ptitSeb e50e050aa9 Added some AES_* wrapped funciton to libcrypto (for #250) 2020-11-16 16:45:36 +01:00
ptitSeb c1a75607fa Fixed 'Alternate' autobridge on Interpretor 2020-11-16 14:57:37 +01:00
ptitSeb b203cd2af3 Added system 242 and 241 (for #250) 2020-11-16 14:39:39 +01:00
ptitSeb 84063f026f Added gtk_recent_filter_* wrapped function to gtk2 2020-11-16 14:39:12 +01:00
ptitSeb 3ec1ce25d7 [DYNAREC] Remove a leftover of debug trace 2020-11-16 14:35:54 +01:00
ptitSeb 0e70c543ee Added 'Aternate' solution for Gtk Classes functions beeing called in x86 code 2020-11-16 14:19:16 +01:00
ptitSeb e4d522a8d2 Refactored Gtk Class wrapping code 2020-11-16 10:25:32 +01:00
ptitSeb 272ecbd8ff More gtk class wrapping 2020-11-16 09:44:01 +01:00
ptitSeb 369fa03f9b Better handling of gtk signals 2020-11-15 18:28:25 +01:00
ptitSeb 1675ea3ba2 Added 2 functions wrapped libX11 2020-11-15 17:12:43 +01:00
ptitSeb 5b7a1bb9e6 Added phtread_spin handling 2020-11-15 17:07:07 +01:00
ptitSeb ace3effa2d Improved GCallback handling and fixed g_action_group_add_actions 2020-11-15 17:04:07 +01:00
ptitSeb bd0a14b3ce Added g_list_find_custom wrapped function to libglib2 2020-11-15 16:21:55 +01:00
ptitSeb 29a82f83c5 Added g_queue_find_custom to wrapped libglib2 2020-11-15 16:13:17 +01:00
ptitSeb f7232f09de Fixed a warning 2020-11-15 16:12:47 +01:00
ptitSeb f3eeae9edd Implemented gtk_builder_connect_signals to wrapped gtk2 2020-11-15 15:29:44 +01:00
ptitSeb 874468ca07 Added gtk_cell_layout_set_cell_data_func to gtk2 wrapped lib 2020-11-15 13:49:59 +01:00
ptitSeb 7a972af610 Fixed potential issue with gobject2 signal handler 2020-11-15 12:57:37 +01:00
ptitSeb 4ed42c38c9 Added wrapping of GtkLabel class to gtk2/3 libs 2020-11-15 12:55:31 +01:00
ptitSeb 6a73719a6b One more wrapped function to gtk2 2020-11-15 12:29:58 +01:00
ptitSeb 6efcfc6b93 Added 2 more g_list_ function to wrapped libglib2 2020-11-15 12:28:38 +01:00
ptitSeb 25f30c220e Added gtk_viewport_* wrapped function to gtk2 2020-11-15 12:24:42 +01:00
ptitSeb 2e9665f10e One more glib2 wrapped function 2020-11-15 12:22:23 +01:00
ptitSeb 197881b430 Fixed g_build_path wrapped function 2020-11-15 12:20:37 +01:00
ptitSeb 96fe98d71f Added gtk_cell_renderer_* wrapped function to gtk2 2020-11-15 11:54:35 +01:00
ptitSeb d1ecd4c933 Added g_build_path wrapped function to libglib2 2020-11-15 11:44:15 +01:00
ptitSeb fad25caa08 Added g_content_type_* function to wrapped libgio2 2020-11-15 11:34:25 +01:00
ptitSeb 98c481e045 Added gtk_tree_store wrapped functions to gtk2 lib 2020-11-15 11:29:48 +01:00
ptitSeb 6082e655e6 Added g_slist_sort and g_slist_sort_with_data to wrapped libglib2 2020-11-15 11:11:44 +01:00
ptitSeb 6a97367242 Made GetNativeFnc smarter, and should find more native funcs now 2020-11-15 11:05:07 +01:00
ptitSeb bbcfffdab9 Added gtk_container_foreach and fixed gtk_binding_entry_add_signal when n is 0 in wrapped gtk2 2020-11-15 10:28:22 +01:00
ptitSeb 2dfb6c1012 Added g_regex function to wrapped libglib2 2020-11-15 10:11:12 +01:00
ptitSeb 82317343aa Added GtkAction wrapped functions 2020-11-15 09:58:55 +01:00
ptitSeb 0ea0d0ec98 Better handling of custom gtk class, plus a bunch of gtk wrapeed functions 2020-11-15 09:48:10 +01:00
ptitSeb 33aa27c590 Added GtkAction Class handling (gtk2 and gtk3, hopefully it's the same) 2020-11-14 16:17:04 +01:00
ptitSeb c31f990183 Added F3 0F 12 MOVSLDUP Ex, Gx opcode ([DYNAREC] too) 2020-11-14 15:11:52 +01:00
ptitSeb 791956bee0 More wrapped function to gtk2 lib 2020-11-14 15:03:57 +01:00
ptitSeb 6cebf4f6fd Added more wrapped functions to gtk2 lib 2020-11-14 14:46:02 +01:00
ptitSeb 1782136e02 Added F3 0F 16 MOVSHDUP Ex, Gx opcode ([DYNAREC] too) 2020-11-14 14:30:44 +01:00
ptitSeb 2f381192dd Added some queue wrapped function to libglib2 2020-11-14 13:30:51 +01:00
ptitSeb dac2009cab Added the random functions to wrapped libglib2 2020-11-14 12:39:17 +01:00
ptitSeb d592af694f Added some more wrapped functions to libglib2 2020-11-14 12:18:56 +01:00
ptitSeb e5ea3f9e49 Added g_set_print_handler and g_set_printerr_handler to wrapped libglib2 2020-11-14 11:55:01 +01:00
ptitSeb f0af865401 Fix potential crash on exit for app using Pulse (fixes Iconoclash crash on exit) 2020-11-14 11:37:30 +01:00
ptitSeb 1e20a9effe Improved and simplifiex SDL2_mixer wrapped library 2020-11-13 22:33:34 +01:00
ptitSeb ce968f7756 Added some precision on 32bits build over 64bits OS 2020-11-12 17:43:03 +01:00
ptitSeb 00aaf316ef Added RK3399 target and compilation guide (plus some restructuration in CMake project 2020-11-11 18:08:16 +01:00
ptitSeb 3ad9a0ca73 [DYNAREC] Added ability to track exact x86 address in dynablocks for signal handling 2020-11-11 14:08:53 +01:00
ptitSeb 14a2d24fba [DYNAREC] Better way to prevent difference in emited dynablock between pass2 and pass3 2020-11-10 19:13:07 +01:00
ptitSeb e374886fcf AddedF0 90..97 opcode, simply ignoring F0 LOCK prefix ([DYNREC] too) 2020-11-09 15:09:43 +01:00
ptitSeb e25b373f00 Fixed gtk_menu_item_set_use_underline wrapped function signature 2020-11-09 12:06:57 +01:00
ptitSeb 6fbd270d24 [DYNAREC] cosmetic change 2020-11-08 13:40:40 +01:00
ptitSeb 6adb55a9c4 [DYNAREC] Try to fix the randow issue were a block have a different emited size between pass2 and pass3 2020-11-08 13:40:14 +01:00
ptitSeb 16aa5cac04 Fixed a warning with wrapped posix_spawnp 2020-11-08 13:39:06 +01:00
ptitSeb dca0009df5 [DYNAREC] Fix 66 0F 16 MOVHPD opcode and improved 66 0F C6 SHUFPD 2020-11-08 13:32:28 +01:00
ptitSeb 1cae441cbc More glib2 wrapped functions 2020-11-07 11:27:28 +01:00
ptitSeb 8b21d8f74a [DYNAREC] Added some dump of block when incosistancy between pass2 and pass3 is detected 2020-11-07 11:26:40 +01:00
ptitSeb ff141e30ee Added handling of environ instead of envv for box86 called with spawnp 2020-11-07 11:25:54 +01:00
ptitSeb 2c970a1b8d Added wrapped posix_spawnp function 2020-11-07 11:25:12 +01:00
ptitSeb b433f8194e Improved a bit the fork wrapped function 2020-11-06 17:47:53 +01:00
ptitSeb 7b2f5e5de0 Improved some BOX86_LOG=2 traces 2020-11-06 17:47:26 +01:00
ptitSeb 3d1400e347 Added preliminary gtk3/gdk3 wrapped lib (based on gtk2/gdk2 wrapping) 2020-11-06 14:08:10 +01:00
ptitSeb 8b5d68f79b Use std=gnu11 to avoid some warning when using clang 2020-11-05 14:01:32 +01:00
ptitSeb ded4b461b4 Some more check to help build on some Linux on Android env. 2020-11-05 12:48:44 +01:00
ptitSeb 13a7be57f2 Check some define to help build on some Linux on Android env. 2020-11-05 12:21:55 +01:00
ptitSeb e8fdcd5c06 Added a bunch of gtk wrapped functions 2020-11-05 11:34:11 +01:00
ptitSeb b8e263d7e6 Removed a warning in wrapped SDL_mixer 2020-11-05 11:33:50 +01:00
ptitSeb b76d17e7b9 Update ChangeLog 2020-11-04 13:15:57 +01:00
ptitSeb ce3151b256 Fixed some (XX)printf alignement issue when formating have %+ or %- command 2020-11-02 16:19:39 +01:00
ptitSeb dd0c3ac51e [VULKAN] More work on vulkan wrapper 2020-11-02 13:32:38 +01:00
ptitSeb f06c5897db Merge pull request #245 from linkmauve/patch-1
Fix install target after previous change
2020-11-02 12:51:14 +01:00
linkmauve 7dac72f796 Fix install target after previous change
#244 broke the install target because system/box86.conf should
now be taken from the build directory, sorry for that.
2020-11-02 12:10:29 +01:00
ptitSeb e5a55114b7 Merge pull request #239 from SpacingBat3/master
PKGBUILDs for Arch Linux.
2020-11-02 12:02:57 +01:00
ptitSeb a66d0b3d39 Merge pull request #244 from linkmauve/fix-binfmt-path
Generate binfmt so it points to the correct path
2020-11-02 12:00:29 +01:00
Emmanuel Gil Peyrot b01ad69ba1 Generate binfmt so it points to the correct path
CMake’s templating language is suitable for this kind of generation, as
it knows about all of the variables that have been set at configure-
time.
2020-11-02 10:52:25 +00:00
ptitSeb bbe183e8d4 Do not try to run winedbg 2020-11-01 23:29:20 +01:00
ptitSeb f6c9e5079a Small improvement on BOX86_LOG=2 2020-11-01 23:28:54 +01:00
ptitSeb 0b8408d50a [VULKAN] Fixed vkGetPhysicalDeviceImageFormatProperties signature 2020-11-01 22:42:20 +01:00
ptitSeb 51682eac11 [VULKAN] Fixed vkalignStruct/vkunalignStruct (and now Sascha-willems samples start working) 2020-11-01 21:34:23 +01:00
ptitSeb aea38c682c [VULKAN] More vulka wrapping work 2020-11-01 21:12:56 +01:00
ptitSeb 6edbe97290 Added the last function not wrapped in SDL1_mixer, and redid the wrapping of the callback (for #243) 2020-11-01 20:11:23 +01:00
ptitSeb 304eaab4d2 [VULKAN] Fixed a warning 2020-11-01 17:11:53 +01:00
ptitSeb f4e5839931 [VULKAN] Morework on wrapped functions 2020-11-01 15:35:53 +01:00
ptitSeb 4bac9ea9d5 [VULKAN] More work on vulkan wrapper 2020-11-01 10:04:30 +01:00
ptitSeb 64c9b21849 [VULKAN] Alignment of many structures. Now a simple TriangleDrawing windows App works 2020-10-31 22:58:58 +01:00
SpacingBat3 34828b66a2 Added a PKGBUILDs for other platforms. 2020-10-31 17:35:06 +01:00
SpacingBat3 957ba00723 Added a PKGBUILD for other raspberries.
Added a unified PKGBUILD to install box86 on all RPi-based machines (that are fully supported by box86) and did some changes to README.md.
2020-10-31 17:32:45 +01:00
SpacingBat3 d548ee48c1 Added a RPI4B PKGBUILD.
It is possible now to install the `box86` using the PKBUILD providen in the repository.
2020-10-31 16:57:09 +01:00
ptitSeb d0e93a22a2 Better vulkan log 2020-10-31 09:55:49 +01:00
ptitSeb fe6c1e260b Added one more vulkan extension 2020-10-31 09:55:33 +01:00
ptitSeb 1e5add91d3 Fixed many vulkan wrapped function (and now vulkaninfo works) 2020-10-30 22:12:55 +01:00
ptitSeb f4c7329c30 Forgotten in previous commit 2020-10-30 22:12:11 +01:00
ptitSeb b1742ccb8e Added some minimum wrapped libwayland-client 2020-10-30 22:11:37 +01:00
ptitSeb 870a0d8361 [VULKAN] Fixed library not found even if present 2020-10-30 17:52:44 +01:00
ptitSeb 1f0adf92d4 Added 64 8E MOV Seg, FS:Ed opcode (for #241) 2020-10-30 16:15:45 +01:00
ptitSeb 18ce562698 Wrapping of vulkan (untested yet) 2020-10-30 16:08:46 +01:00
ptitSeb 77af926336 Added 64 8C MOV FS:Ed, Seg opcode (for #241) 2020-10-30 10:44:32 +01:00
ptitSeb 33f2269896 [DYNAREC] removes some compile warning 2020-10-30 10:43:52 +01:00
ptitSeb c477e14a04 [DYNAREC] Minor chenges to some 67 xx opcodes 2020-10-30 10:10:36 +01:00
ptitSeb 373494094a [DYNAREC] Forgot that file on previous commit 2020-10-30 10:08:46 +01:00
ptitSeb 72ca666007 [DYNAREC] Added 65 80/82 opcodes 2020-10-30 10:07:47 +01:00
ptitSeb 5be299b897 [DYNAREC] Cosmetic change 2020-10-30 10:06:55 +01:00
ptitSeb 49afd5077b [DYNAREC] Fixed some function that needs flags before CALL (fixed some ESP not properly preserved on some Windows programs) 2020-10-30 10:05:47 +01:00
ptitSeb e7336de8a7 Change COMPILE.md for Pi4: make -j4 is enough 2020-10-30 10:03:10 +01:00
ptitSeb 5b0f4f5b94 Start a new developpement cycle 2020-10-30 10:02:17 +01:00
ptitSeb 0edc037441 Bumped version to v0.1.4 2020-10-24 15:34:34 +02:00
ptitSeb d4a7f7e658 Simplified glib2 wrapped lib 2020-10-24 12:38:28 +02:00
ptitSeb fcf9668e8b Fixed wrapped g_variant_get function 2020-10-24 12:36:17 +02:00
ptitSeb 76e53e0869 Fixed execvp wrapped function to use PATH / BOX86_PATH to look for binary if needed 2020-10-24 10:47:59 +02:00
ptitSeb 74764253b4 Fixed pango_attribute_init wrapped function 2020-10-24 00:12:35 +02:00
ptitSeb c029c6c152 [DYNAREC] Avoid potential SIGBUS on 66 0F 13MOVLPD and 66 0F 16/17 MOVHPD opcodes 2020-10-24 00:11:44 +02:00
ptitSeb bb4b0d5f92 [DYNAREC] Avoid potential SIGBUS on F3 0F E6 CVTDQ2PD opcode 2020-10-24 00:10:04 +02:00
ptitSeb a355cf941b [DYNAREC] cosmetic changes on dynarec_arm_dd.c 2020-10-24 00:07:32 +02:00
ptitSeb e7c5ef1cca Added some wrapped function to lib pango and pangoft2 2020-10-23 20:03:07 +02:00
ptitSeb 09d0f7a3cb Fixed GVariant creation on wrapped glib2 2020-10-23 20:02:28 +02:00
ptitSeb 3e7dd07b4c Added a libpangoft2-1.0.so as wrapped too 2020-10-23 20:02:02 +02:00
ptitSeb c536eed349 [DYNAREC] Changed a bit how comon dynablock is selected 2020-10-23 20:00:29 +02:00
ptitSeb 93948021e6 Added DE D0..D7 FCOMP ([DYNAREC] too) 2020-10-23 19:59:40 +02:00
ptitSeb 77317f87c0 Simplify SDL2 Event Handler 2020-10-23 19:58:37 +02:00
ptitSeb b091ea9c6d Fixed wrapped lib appindicator 2020-10-23 14:36:56 +02:00
ptitSeb 208493da88 It seems mpg123 use 64bits off_t 2020-10-23 13:04:00 +02:00
ptitSeb 7015745c4f Silence a warning, and don't create a fake /sys/devices/system/cpu/cpuX/topology/core_id file if it exist 2020-10-22 23:50:59 +02:00
ptitSeb 41a5c72d46 [PANDORA] put all define at the same place (for #233) 2020-10-22 23:48:04 +02:00
ptitSeb 2b428641fb [PANDORA] forgot to close the ifdef (for #233) 2020-10-22 23:43:00 +02:00
ptitSeb 4ebb1e60db [PANDORA] Fix potential build issue (for #233) 2020-10-22 23:31:56 +02:00
ptitSeb 5e4c1feed1 [DYNAREC] Fixed the Free of Dynablock that weren't always sane (fixes RGPMaker 2000, among aother things) 2020-10-22 19:24:11 +02:00
ptitSeb d13e1da1a7 [DYNAREC] Added undocummented BOX86_DYNAREC_SMC to detect special case of SMC (slow things down, so use wizely) 2020-10-22 19:24:11 +02:00
ptitSeb 9f57cff43b [README] Fixed address of 86box github project (still for #232) 2020-10-22 17:40:56 +02:00
ptitSeb b9d9776d5c Added 86box precision on README, plus PILab Discord channel link (to mitigate #232) 2020-10-22 16:52:02 +02:00
ptitSeb b57ab8470d [DYNAREC] Some more small optims to some of the LOCK opcodes 2020-10-21 19:08:29 +02:00
ptitSeb fe402d2faa [DYNAREC] Use posix_memalign instead of mmap to for Dynarec block memory 2020-10-21 18:58:50 +02:00
ptitSeb 3d38210752 Improved (once more) signal handling 2020-10-21 17:52:42 +02:00
ptitSeb 6c4b047b58 Changed slightly the win prereserve mecanism 2020-10-20 11:00:22 +02:00
ptitSeb e861d3415a Changed, once again, the loading position of box86 2020-10-20 10:59:55 +02:00
ptitSeb cb251fe88b [DYNAREC] Fixed F0 0F B0 LOCK CMPXCHG Eb, Gb opcode (help KaM Remake) 2020-10-19 21:28:11 +02:00
ptitSeb b1e594f4d7 More work on signal handling 2020-10-19 11:04:45 +02:00
ptitSeb f9505f3c9f Improved a bit wrappedlibc 2020-10-19 11:03:02 +02:00
ptitSeb 52ee2bb769 A bit more logs when using BOX86_LOG=2 2020-10-19 11:01:45 +02:00
ptitSeb f0471fac14 Merge pull request #231 from icecream95/nine-2
Create a fake IDirect3D9 object instead of changing the vtable
2020-10-19 09:57:26 +02:00
Icecream95 7baac98959 Create a fake Direct3D9 object instead of changing the vtable
This means both x86 and ARM code can have the right function pointers
at the same time, allowing a hack in Gallium Nine to be removed.
2020-10-19 20:02:49 +13:00
ptitSeb 9119443c2a [DYNAREC] Go back to X_PEND (as it's more optimized) on end of block (now PvZ still works, thanks to previous commit) 2020-10-17 17:29:38 +02:00
ptitSeb c9c33929f0 [DYNAREC] Fixed (and optimized a bit) some Math emiter 2020-10-17 17:27:16 +02:00
ptitSeb 60717d38d4 Added wrapped libcups with a few functions 2020-10-17 15:21:27 +02:00
ptitSeb 858757f8d1 Merge pull request #230 from mogwa1/master
Fix presumable typo in wrappedlibncurses files
2020-10-17 09:38:22 +02:00
Bart De Vries f15a22a3cb Fix presumable typo in wrappedlibncurses files
A call to vmprintw is made, which is a non-existent function.
Presumably, vwprintw is meant to be called.
2020-10-17 09:34:24 +02:00
ptitSeb f6022de7d3 Don't try to alloc elf section that have so read/write/execute flags 2020-10-16 13:19:17 +02:00
ptitSeb 8214301231 Added handling of /sys/devices/system/cpu/cpuX/topology/core_id file 2020-10-16 13:17:59 +02:00
ptitSeb a4745098c5 Don't inject PLTResolver if it's not needed (should help #195) 2020-10-15 11:04:00 +02:00
ptitSeb 647b06a615 Fixed an issue with box86 shutdown 2020-10-15 10:51:49 +02:00
ptitSeb a7cbafee07 Added libssl.so.1.1 as a alt name for wrapped libssl 2020-10-14 21:18:32 +02:00
ptitSeb ee0eb2345c Added libcrytpo.so.1.1 as a alt name for wrapped libcrypto 2020-10-14 21:16:50 +02:00
ptitSeb d37c42761d Don't try to use XSAVE/XRSTR yet on signal handling 2020-10-14 20:06:05 +02:00
ptitSeb d4984fd0ee New attemps at improving Signal Handling 2020-10-14 17:43:08 +02:00
ptitSeb c770ea1859 Added an option to disable the loading of pulse audio libs 2020-10-14 09:29:59 +02:00
ptitSeb 4d1307e223 Improve signal handling, again (to help windows exception managers) 2020-10-12 22:16:23 +02:00
ptitSeb e9308c11ba [DYNAREC] Added 67 64 xx opcode (copy of 64 67 xx, need to factorise all this) 2020-10-12 21:50:48 +02:00
ptitSeb 5206ec0fcb Fixed 1 wrapped function signature in libXext 2020-10-12 21:50:12 +02:00
ptitSeb c65671a6f9 Added more libXext wrapped functions (for #226) 2020-10-12 10:40:33 +02:00
ptitSeb ec99203dc6 Better log for FF illegzal opcode 2020-10-12 10:22:05 +02:00
ptitSeb 1cdde047ff Added more ncurses wrapped function (for #215) 2020-10-12 08:35:30 +02:00
ptitSeb 2375d70782 [DYNAREC] Fixed a typo in 8D LEA Gd, Ed opcode 2020-10-11 22:10:44 +02:00
ptitSeb 5b0c395293 Added a even more wrapped libcrypto functions 2020-10-11 20:47:36 +02:00
ptitSeb ea0c1abb0b Added a few more wrapped libcrypto functions 2020-10-11 20:13:37 +02:00
ptitSeb cc841812ce Added 1 wrapped function to libcrypto 2020-10-11 19:07:48 +02:00
ptitSeb 5104bce7bb [DYNAREC] Added (fake) F2/F3 EB opcode 2020-10-11 18:28:45 +02:00
ptitSeb 357ce483a8 [DYNAREC] Added a workaround for some SMC trick using PUSH Id followed by RET (help RPGMaker RunTime) 2020-10-11 18:21:17 +02:00
ptitSeb 1a40b4b984 [DYNAREC] Added D9 F6/F7 FDECSTP/FINCSTP opcode 2020-10-11 15:30:02 +02:00
ptitSeb cdd0e542f1 Added (faked) XACQURE/XRELEASE prefix 2020-10-11 14:21:20 +02:00
ptitSeb a9d87a938d Added (fake?) 63 ARPL Ed, Gd opcode 2020-10-10 18:30:22 +02:00
ptitSeb 549ff980a3 [DYNAREC] Added FPREM1 opcode 2020-10-10 16:33:46 +02:00
ptitSeb 545af93972 [DYNAREC] Added FBSTSW opcode 2020-10-10 16:33:10 +02:00
ptitSeb 72b9ed9f54 Even more libjpeg.so.62 improvements 2020-10-10 15:01:27 +02:00
ptitSeb 536c7dd04b Big improvement in libjpeg.so.62 handling 2020-10-10 13:46:04 +02:00
ptitSeb 274d5d1e75 Also trap SIGILL now, like SIGSEGV and SIGBUS 2020-10-10 10:42:47 +02:00
ptitSeb 7b478e42c0 Improved libjpeg.so.8 and libjpeg.so.62 handling 2020-10-10 10:31:27 +02:00
ptitSeb d0ac1e61d4 Added libjpeg.so.62 as for wrapped libjpeg 2020-10-09 20:13:58 +02:00
ptitSeb 31d73927a3 [README] Added a Steam paragraph (for #223) 2020-10-09 17:38:45 +02:00
ptitSeb 7713bd042a Added wcsnlen wrapped function to libc 2020-10-08 12:00:16 +02:00
ptitSeb 664dab76e3 Fixed improved signal handler. It seems to work a bit now 2020-10-07 21:38:38 +02:00
ptitSeb 6e2c33866d Add DB E1 FDISI8087_NOP as NOP ([DYNAREC] too) 2020-10-07 20:03:43 +02:00
ptitSeb 7b6dd6765e Rermoved a forgotten debug trace 2020-10-07 19:57:50 +02:00
ptitSeb d55d2d0303 [DYNAREC] Added D5 Ib AAM and D6 Ib AAD opcodes 2020-10-07 19:37:40 +02:00
ptitSeb 4df7bec913 Some fixes to new signal handling functions 2020-10-07 19:15:44 +02:00
ptitSeb 4ddab1b691 Made fork to reset the main hread emu if needed 2020-10-07 19:14:54 +02:00
ptitSeb b0c0e96fca [DYNAREC] Added D6 SALC opcode 2020-10-07 19:12:34 +02:00
ptitSeb aeee2fc391 Try to better handle Signals when signal handler change any context value 2020-10-07 12:07:52 +02:00
ptitSeb 4f28cb5617 Added wrapped funciton logl to libm (help KeeperRL) 2020-10-07 11:42:46 +02:00
ptitSeb a442a841f2 Added wrapped function curl_free to libcurl (help KeeperRL) 2020-10-07 11:42:10 +02:00
ptitSeb 9201170ab8 [DYNAREC] Fixed and optimized F3 0F E6 CVTDQ2PD opcode 2020-10-06 23:12:32 +02:00
ptitSeb 4f06cfa0da [DYNAREC] Added F3 0F E6 CVTDQ2PD Gx, Ex opcode 2020-10-06 16:19:25 +02:00
ptitSeb fe03daa01f [DYNAREC] Cosmetic change in one of the emmiter 2020-10-06 16:18:57 +02:00
ptitSeb b64c4f6043 Better handling of path with space (for #220, but seriously, space in folder name are evil) 2020-10-06 13:04:07 +02:00
ptitSeb 5884c78b56 Use CMAKE_SOURCE_DIR instead of CMAKE_HOME_DIRECTORY as recommended in cmake documentation 2020-10-06 11:59:33 +02:00
ptitSeb b01b7373ac [DYNAREC] Added workaround for unaligned LOCK XADD Ed, Gd 2020-10-06 11:53:28 +02:00
ptitSeb 3cc9482a08 [DYNAREC] Added a workaround for unaligned LOCK SUB Ed, Id/Ib 2020-10-06 11:12:16 +02:00
ptitSeb 83c6b01fae Added a NOGIT option to build from sources that are not a git clone (should help #220) 2020-10-06 10:59:20 +02:00
ptitSeb 1f169bc67e [DYNAREC] Added a workaround for unaligned LOCK ADD Ed, Id/Ib and also fix potential issues when an opcode have internal jump 2020-10-06 08:05:40 +02:00
ptitSeb ea25675264 Merge pull request #221 from Botspot/patch-1
Optimize compilation & full install commands
2020-10-06 07:59:29 +02:00
Botspot c302cd680c Optimize compilation & full install commands 2020-10-05 18:28:43 -05:00
ptitSeb ebf46d0cfd Added a few more symbols and dependancies to gtk wrapped libs (should help #193) 2020-10-05 22:38:28 +02:00
ptitSeb 2c9b504688 Improve dlsym mecanism (should help #193) 2020-10-05 21:13:45 +02:00
ptitSeb 41d3de565c Added 2 symbols in wrapped libgtk-x11 2020-10-05 20:15:25 +02:00
ptitSeb 88430d845d Fixed an issue with a log of wrapped dlopen 2020-10-05 20:15:24 +02:00
ptitSeb c6e5e5d27e Added wrapped libxcb-present (partial) 2020-10-05 15:20:26 +02:00
ptitSeb cd673028b7 Added wrapped libxcb-dri2 and libxcb-dri3 (partial) 2020-10-05 14:29:56 +02:00
ptitSeb 2cafe12e4f Default to BOX86_LOG=NONE (use BOX86_LOG=1 to get previous behaviour) 2020-10-05 11:54:55 +02:00
ptitSeb febbaca66b Added BOX86_NOBANNER env. var. plus default to printing box86 version and build number at start 2020-10-05 11:53:46 +02:00
ptitSeb e410ca748a Merge pull request #219 from icecream95/nine
Wrap Gallium Nine
2020-10-05 10:02:15 +02:00
ptitSeb 524c04296e Fixed FXSR opcodes (should help #218) 2020-10-05 09:52:06 +02:00
Icecream95 ef360bf93e Add a final NULL to environment variables
Fixes Wine crashes with certain numbers of environment variables present.
2020-10-05 14:44:50 +13:00
Icecream95 bd4f7a4783 Update generated functions 2020-10-05 14:44:50 +13:00
Icecream95 3c2c242225 Add wrapping for d3d9 2020-10-05 14:44:50 +13:00
Icecream95 a8e657c86e Add some headers for d3d9 wrapping 2020-10-05 14:44:50 +13:00
Icecream95 70e103af49 Wrap some more libxcb functions 2020-10-05 14:44:50 +13:00
ptitSeb 006f7a79b4 Added C4 LES Gd, Ed opcode 2020-10-04 22:08:02 +02:00
ptitSeb c7a4dbe84b Fixed __res_state that is wrapped function and not a data in libc 2020-10-04 18:29:27 +02:00
ptitSeb 31c0c52d7f Added a few more wrapped function to libdbus 2020-10-04 17:28:07 +02:00
ptitSeb a4590d3771 Fix for commit 85dd704f86 2020-10-04 16:58:32 +02:00
ptitSeb 02b5e39c39 Improved signal handling 2020-10-04 16:23:11 +02:00
ptitSeb 85dd704f86 Don't protect executable memory until it's actually executed 2020-10-04 16:22:55 +02:00
ptitSeb b4d4efd40c Added 2 more wrapped functions to libdbus 2020-10-04 16:18:13 +02:00
ptitSeb 8745b0f31a Small changes in thread handling ([DYNAREC] Pre-compute first dynarec of thread function before creating a thread) 2020-10-04 10:59:36 +02:00
ptitSeb 3787b3bbfc Minor changein trace handling 2020-10-04 10:58:42 +02:00
ptitSeb 765e1b1231 [DYNAREC] Changed __builtin___clear_cache with __clear_cache 2020-10-04 10:58:09 +02:00
ptitSeb 2a2e2bf957 Improved a bit SIGSEGV/SIGBUS log message 2020-10-04 10:57:32 +02:00
ptitSeb c93913732b Added C5 LDS Gd, Ed opcode (not sure it's correct) 2020-10-04 10:54:11 +02:00
ptitSeb f5bbc99d7d Change how LD2D works, to avoid potential BusError 2020-10-03 21:42:54 +02:00
ptitSeb 27ce42b9b0 Added g_log_set_default_handler to wrapped glib2 lib 2020-10-03 09:10:43 +02:00
ptitSeb 008d51aeec Added in6addr_loopback data to wrapped libc 2020-10-03 09:10:06 +02:00
ptitSeb 8d0d264c0f Add some data to wrapped ncurses libs (should help #215) 2020-10-03 08:06:47 +02:00
ptitSeb 28717352b4 Improved detail when using BOX86_DLSYM_ERROR=1 2020-10-02 15:52:28 +02:00
ptitSeb f9e492dfdc Added FXSR in the CPU ID flags 2020-10-02 15:51:48 +02:00
ptitSeb a8e029f0e0 [DYNAREC] Added DF C0..C7 FFREEP opcode 2020-10-01 10:13:46 +02:00
ptitSeb f5be4503c5 Added DF C0..C7 FREEP opcode 2020-10-01 10:13:19 +02:00
ptitSeb cd1d3f5026 Added tputs wrapped function to libtsinfo.so.5 and libtsinfo.so.6 (for #211) 2020-10-01 09:38:46 +02:00
ptitSeb 4f55733bdd Added msgctl wrapped function to libc 2020-09-30 18:14:38 +02:00
ptitSeb 81819d04e8 Added msgsnd and msgrcv wrapped function to libc 2020-09-30 17:57:55 +02:00
ptitSeb 4d4adea6eb Added msgget wrapped function to libc 2020-09-30 17:36:08 +02:00
ptitSeb ca981fbc8e [DYNAREC] Added 66 0F 38 01/02/03/05 opcodes 2020-09-30 17:25:12 +02:00
ptitSeb b4c64abd1e Added 66 0F 38 03 PHADDSW opcode 2020-09-30 17:24:18 +02:00
ptitSeb a8787330d8 [DYNAREC] Added F2 0F F0 LDDQU opcode 2020-09-30 17:20:18 +02:00
ptitSeb 7725234b69 Added F2 0F F0 LDDQ opcode 2020-09-30 17:19:50 +02:00
ptitSeb 062d897fb1 Added 66 0F 38 05 PHSUBW opcode 2020-09-30 16:50:59 +02:00
ptitSeb e1ed95a638 Added a few more xcb wrapped functions 2020-09-30 16:35:08 +02:00
ptitSeb 7ffa5d076c Changed a bit FF /6 opcode to avoid potential issues with Ed with ESP 2020-09-30 16:32:51 +02:00
ptitSeb 1ae0ae630a Fixed some typo on some segments opcode ([DYNAREC] too) 2020-09-30 11:05:11 +02:00
ptitSeb d3e8daa9b5 Removed workaround that disabled SSSE3 for Steam, it's not needed anymore 2020-09-30 10:20:19 +02:00
ptitSeb 5f8be26b73 Added xcb_setup_roots_length wrapped function to libxcb (for #193) 2020-09-30 08:24:21 +02:00
ptitSeb 0eb575b472 Fixed some wrapped libXRandr functions 2020-09-28 15:03:47 +02:00
ptitSeb 1888d905a4 Try to handle SIGBUS like SIGSEGV 2020-09-28 15:03:18 +02:00
ptitSeb 3bc4dc8450 Fixed handling of file not found at start 2020-09-28 10:21:12 +02:00
ptitSeb 78719df8d4 Try to implement sigset wrapped function (for #211) 2020-09-27 15:03:17 +02:00
ptitSeb d3616b335f Improved wrapped ncurses / tsinfo symbols (for #209 and #211) 2020-09-27 14:38:40 +02:00
ptitSeb e72cd086b4 Better handling of /proc/PID/xxx in wrapped files open function (for #202) 2020-09-27 14:14:31 +02:00
ptitSeb c82e67c39a Added 66 0F 38 08/09/0A PSIGN(B/W/D) opcode 2020-09-27 14:02:38 +02:00
ptitSeb 9885cf6f10 [DYNAREC] Assorted fix and optim for some SSE2/SSSE3 opcodes 2020-09-27 13:42:26 +02:00
ptitSeb d923b5bc0f [DYNAREC] better log for unimplemented opcode 2020-09-27 09:39:25 +02:00
ptitSeb 611d2fcaff Assorted interpretor fixes for some SSE2 opcodes 2020-09-27 09:38:58 +02:00
ptitSeb 9b2b312719 Merge branch 'master' of https://github.com/ptitSeb/box86 2020-09-26 19:18:49 +02:00
ptitSeb f84161dafc Merge pull request #210 from rajdakin/printerFix
Fixed some instructions printer
2020-09-26 19:16:14 +02:00
rajdakin 8546a0d0bd [PRINTER] Fixed some instructions printer 2020-09-26 18:43:02 +02:00
ptitSeb 09f5873806 Fixed 66 0F E8 PSUBSB opcode 2020-09-26 13:49:14 +02:00
ptitSeb 18dc905a8c [DYNAREC] Various small optimisations, mainly SSE oriented 2020-09-26 11:48:19 +02:00
ptitSeb 30d64a0aa5 Small fix on 66 0F 67 PACKSSDW opcode 2020-09-26 10:24:46 +02:00
ptitSeb 8359c9e19f [DYNAREC] Added D9 /6 FNSTENV opcode 2020-09-26 10:23:48 +02:00
ptitSeb 571f0c0564 Small optim on D9 /6 FNSTENV opcode 2020-09-26 10:23:21 +02:00
ptitSeb 736a9ef442 Fixed 66 0F 67 PACKUSWB when EX and GX are the same 2020-09-25 13:49:43 +02:00
ptitSeb aee94b0e14 A bit more work on cpow(f) wrapped function 2020-09-25 12:08:54 +02:00
ptitSeb 4cfed0d394 [DYNAREC] Fixed 66 0F 38 04 PMADDUBSW opcode 2020-09-25 10:51:11 +02:00
ptitSeb c714d5d881 Fixed 0F 38 00 PSHUFB to use MM regs instead of XMM 2020-09-25 10:35:34 +02:00
ptitSeb 1c2d07ee56 [DYNAREC] Change implementation for 66 0F 6E MOVD Gx, Ex opcode 2020-09-25 08:25:06 +02:00
ptitSeb 96f7f3d88f Change implementation for 66 0F 3A 0F PALIGNR opcode 2020-09-25 08:24:17 +02:00
ptitSeb c743577369 Added 0F C3 MOVNTI opcode ([DYNAREC] too) 2020-09-25 08:21:28 +02:00
ptitSeb e5ea60fe88 Added more complex functions to wrapped libm 2020-09-24 21:39:05 +02:00
ptitSeb 330d93f335 Fixed wrapped libm function taht return float complex, plus added a few complex functions 2020-09-24 19:42:10 +02:00
ptitSeb f4936144d0 0F 38 01/02 PHADD(W/D) opcode 2020-09-24 19:41:33 +02:00
ptitSeb bbaa5dde92 Refactored gigantic Run function to create Run660F and try speedup build a bit 2020-09-24 17:45:37 +02:00
ptitSeb e6b46151ec Added (66) 0F 38 1C/1D/1E PABS(B/W/D) opcode 2020-09-24 17:23:12 +02:00
ptitSeb 655a8de652 Added 66 0F 7C HADDPD opcode 2020-09-24 16:53:44 +02:00
ptitSeb 771d69f38b [DYNAREC] Some (S)SSE2/3 opcodes fixes 2020-09-24 16:35:14 +02:00
ptitSeb 2a46dbf149 A bit more (S)SSE3 opcodes fixes 2020-09-24 16:34:49 +02:00
ptitSeb 95a0535462 Try to fix 0F 38 0B PMULHRSW opcode 2020-09-24 16:34:10 +02:00
ptitSeb 041758fead Fixed (66) 0F 38 04 PMULHRSW opcode 2020-09-24 11:59:20 +02:00
ptitSeb d6bb723c6a [DYNAREC] Added 0F E0 PAVGB Gm, Em opcode 2020-09-24 11:58:43 +02:00
ptitSeb 95f97e1c9f [DYNAREC] Added (66) 0F 38 0B PMULHRSW opcodes 2020-09-24 10:56:42 +02:00
ptitSeb b029292dd2 Added 0F 38 0B PMULHRSW Gm, Em opcode 2020-09-24 10:56:15 +02:00
ptitSeb 82ba663c24 [DYNAREC] Fixed 0F 38 00 opcode 2020-09-24 10:17:46 +02:00
ptitSeb fabd5b9d32 Added 0F 38 00 PSHUFB opcode ([DYNAREC] too) 2020-09-24 08:39:28 +02:00
ptitSeb 58736b707d [DYNAREC] Added workaround for unaligned LOCK CMPXCHG and LOCK CMPXCHG8B (fixes Unity Games and Steam) 2020-09-23 22:10:06 +02:00
ptitSeb 9219384650 [DYNAREC] Changed the method used on ARM to simulate LOCK prefix 2020-09-23 20:22:44 +02:00
ptitSeb 14a904cfa9 Added all 64 67 opcodes to 67 64 ... 2020-09-23 10:24:17 +02:00
ptitSeb e73f7a9c10 Added 67 64 FF /6 PUSH FS:Ew16 opcode 2020-09-23 07:50:24 +02:00
ptitSeb 09acd36c08 [DYNAREC] Make end of block need a X_ALL, but end because recursive loop need X_PEND (helps PvZ) 2020-09-22 18:11:19 +02:00
ptitSeb 69a6f44b8b Refined .gitignore for TwisterOS 2020-09-22 18:11:08 +02:00
ptitSeb 3ee8fd4ec6 [DYNAREC] Try to optimize runtime speed a bit 2020-09-22 12:21:55 +02:00
ptitSeb 4f6c0b45f8 [DYNAREC] Avoid deleting block that are not supposed to be volatile 2020-09-22 11:38:50 +02:00
ptitSeb 06a756a5eb [DYNAREC] Small optimization for 64 A1 and 64 A3 opcodes 2020-09-22 11:17:01 +02:00
ptitSeb b312df3b53 Bugfixe on Interpretor for some 64, 65, 66 and 67 prefixed opcodes 2020-09-22 11:16:18 +02:00
ptitSeb 8e4b2a90a4 [DYNAREC] Fixed 64 67 8F POP FS:Ew16 opcode 2020-09-21 23:03:23 +02:00
ptitSeb 85b3091b8a [DYNAREC] Added 64 67 A1 MOV EAX, FS:Ow opcode 2020-09-21 18:16:58 +02:00
ptitSeb 3838fc3d22 [DYNAREC] Added 64 67 8F POP FS:Ew16 opcode 2020-09-21 18:14:45 +02:00
ptitSeb 0f4722d580 Improved (f)open(64) wrapped function a bit more 2020-09-21 15:37:53 +02:00
ptitSeb 4241258158 Added a workaround for steam requieremnt checker 2020-09-21 15:37:23 +02:00
ptitSeb 13c446c918 Wrapped libappindicator (seems to fix Steam starting issues) 2020-09-21 06:17:08 -05:00
ptitSeb 9255026b84 [DYNAREC] Fix build 2020-09-21 11:56:32 +02:00
ptitSeb 119eb57a38 Added an option to Launch GDB when a Segfault occur (JIT Debugging) 2020-09-21 09:41:20 +02:00
ptitSeb 731f379bed Fixed a bug in FindDynablockDynablocklist(...) function, making message on segfault with dynarec more precise 2020-09-20 21:43:00 +02:00
ptitSeb bedcf304e1 Added 65 EB and 65 E9 opcode (also [DYNAREC]) 2020-09-20 16:50:33 +02:00
ptitSeb a4655484cb Added 64 EB and 64 E9 opcode (also [DYNAREC]) 2020-09-20 16:44:40 +02:00
ptitSeb babc5aba4f Added a few more wrapped functions to libc (for #204) 2020-09-20 09:45:55 +02:00
ptitSeb 763a6f8b02 Added syscall handling for syscall 11: execve (for #203) 2020-09-20 08:15:03 +02:00
ptitSeb b08960d4b9 Fixed some rounding issues with x87 interpretor (thx @pale) 2020-09-19 22:12:56 +02:00
ptitSeb 2c6e91622f Try to handle NULL argv and NULL envp in execv(e) wrapped function (still for #203) 2020-09-19 18:12:09 +02:00
ptitSeb 4679977612 Small optims on x87 interpretor 2020-09-19 18:03:18 +02:00
ptitSeb 0e387904b0 More work on execv(e) wrapped functions (still for #203) 2020-09-19 15:01:53 +02:00
ptitSeb f4238621a6 Handling of /proc/self/exe in execv(p) function (for #203) 2020-09-19 14:23:27 +02:00
ptitSeb 2fa19e8cae Handling of /proc/self/exe in (f)open(64) (for #202) 2020-09-19 14:13:41 +02:00
ptitSeb ab644d0638 Made same hacks for fopen64 as for fopen 2020-09-19 12:48:58 +02:00
ptitSeb 8d1db88e1a [DYNAREC] Free of dynablock log level is now DEBUG instead of INFO 2020-09-18 18:00:58 +02:00
ptitSeb 12215ac5dd Removed FLOAT build (was not compatible with Dynarec anyway) 2020-09-18 17:52:28 +02:00
ptitSeb 97d0b386ba Added more mpg123 wrapped functions 2020-09-16 08:33:47 +02:00
ptitSeb f8526be667 Reworked FPREM, FPREM1 and FXTRACT opcodes 2020-09-15 14:47:44 +02:00
ptitSeb 22624f6a29 Added g_pattern_spec_* wrapped functions to glib2.0 2020-09-15 10:39:31 +02:00
ptitSeb e70584e7fc Added some wrapped function to mpg123 2020-09-15 10:35:43 +02:00
ptitSeb ebd2346f3e Added some GLib2 wrapped functions 2020-09-15 10:08:38 +02:00
ptitSeb 03ce553620 Added 66 0F 38 0B PMULHRSW Gx, Ex opcode 2020-09-15 08:45:46 +02:00
ptitSeb 9418a37846 Added (F2) EB opcode 2020-09-14 08:01:23 +02:00
ptitSeb 4f186dec68 g_variant_new_va use va_list* and not just va_list... 2020-09-13 20:57:41 +02:00
ptitSeb 5867fd9912 Added D6 SACL opcode 2020-09-12 18:46:27 +02:00
ptitSeb cd327cfc5a Fixed a message when detecting Steam thta was obsolete 2020-09-11 15:06:21 +02:00
ptitSeb a3f95871b2 Fix loading of elf that have no header sections at all 2020-09-11 15:05:57 +02:00
ptitSeb 53021b770b Added 66 0F DA PMINUB Gx, Ex opcode ([DYNAREC] too) 2020-09-10 16:47:38 +02:00
ptitSeb 7f93731d0c [DYNAREC] Added 66 0F 50 MOVMSKPD Gd, Ex opcode 2020-09-10 16:30:44 +02:00
ptitSeb 570f82d7f8 Improved trace with pid when using fork 2020-09-10 11:27:59 +02:00
ptitSeb 2c8a069f47 Improved LOCK opcodes and locking on dynarec dumper 2020-09-09 20:19:19 +02:00
ptitSeb bbf23be1f3 Merge pull request #201 from rajdakin/NEONprinter_fix
Forgot to add those files
2020-09-08 23:15:56 +02:00
rajdakin accca4e700 [PRINTER] Also fixed VRSHL, VQSHL and VQRSHL 2020-09-08 23:11:40 +02:00
rajdakin ecc8ebef6a [PRINTER] Forgot to add those files 2020-09-08 19:04:35 +02:00
ptitSeb 6c8a807c8c Merge pull request #200 from rajdakin/NEONprinter_fix
Various printer fixes
2020-09-08 18:59:22 +02:00
rajdakin dfb2d5eaaa [PRINTER] Fixed the VMOV.<dt> R, D[imm] instruction printer 2020-09-08 18:52:12 +02:00
rajdakin 71c7ec6fed [PRINTER] Fixed a class of var. size opcodes printer 2020-09-08 18:30:35 +02:00
ptitSeb 55d216f024 [DYNAREC] Thoses fixes to 8bits and 16bits opcodes should have been pushed yesterday already 2020-09-08 08:35:30 +02:00
ptitSeb 5e22febd54 Fixed 0F BA /6 BTS opcode (thx @hmilyyang) 2020-09-08 08:34:21 +02:00
ptitSeb 436d871ea9 Reorganized a bit FreeBox86Context function 2020-09-08 08:33:20 +02:00
ptitSeb 02099912c5 [DYNAREC] Fixed (66) 0F D7 PMOVMSKB for good this time 2020-09-07 19:51:48 +02:00
ptitSeb 601aedb25a More improved to env. var. and other misc. attributes 2020-09-07 10:49:36 +02:00
ptitSeb c65aa3d507 Improvment to Env Var handling 2020-09-07 10:24:27 +02:00
ptitSeb 9b02837d5a Another small improvement to wrapped X11 2020-09-07 10:24:06 +02:00
ptitSeb dbbff7b833 Some fixes to some wrapped X11 function callbacks 2020-09-07 08:10:04 +02:00
ptitSeb e306db4d0c Added F2 25 opcode 2020-09-07 07:29:17 +02:00
ptitSeb 985266fc77 Small cosmetic change to one xcb wrapped function 2020-09-07 07:29:03 +02:00
ptitSeb a3f771cc7c Added a bunch of X11 / Xext / FontConfig wrapped functions 2020-09-06 17:05:09 +02:00
ptitSeb 71a1bea9c7 A few more xcb wrapped functions 2020-09-06 14:26:49 +02:00
ptitSeb 565543fbba Added a few more xcb wrapped functions 2020-09-06 12:20:19 +02:00
ptitSeb 9193194596 Less alarming error message on default log level when loading libraries 2020-09-06 11:03:54 +02:00
ptitSeb 83ea28ded7 Made BOX86_LOG=2 a bit less chatty 2020-09-06 10:55:35 +02:00
ptitSeb 1a69782f51 Added more libSSL/libcrypto wrapped functions 2020-09-05 21:10:48 +02:00
ptitSeb 394ea0f3d3 Added more xcb* wrapped functions 2020-09-05 16:09:27 +02:00
ptitSeb 0241bbdbc0 Added xcb_connect to wrapped libxcb 2020-09-05 14:51:14 +02:00
ptitSeb 5e00739776 Added more pulseaudio wrapped functions 2020-09-05 13:22:21 +02:00
ptitSeb 5d214ac965 Added some more libasound wrapped functions 2020-09-05 12:11:32 +02:00
ptitSeb d35ae51fbb Oops, fixed libxrandr and libxcb-randr private mixup 2020-09-05 11:19:29 +02:00
ptitSeb 717f319dc7 Fixed CPUID command 0 Max basic command supported 2020-09-05 11:18:56 +02:00
ptitSeb fbd2f52da2 Added a few xcb_*_id to xcb-* wrapped libs 2020-09-05 10:57:08 +02:00
ptitSeb 853d89ca9c Added (stub) mcount to wrapped libc 2020-09-05 10:56:44 +02:00
ptitSeb 9c9e3cef29 Added getentropy to wrapped libc 2020-09-05 10:46:46 +02:00
ptitSeb 2237afceff Some fixes to the new empty xcb-* wrapped libs 2020-09-05 10:34:10 +02:00
ptitSeb 180d036fd4 Added some empty xcb-* wrapped lib 2020-09-04 23:57:12 +02:00
ptitSeb 7248ee7ed2 Update README.md 2020-09-04 23:56:57 +02:00
ptitSeb d1e7944ad2 Fix shrd16/shld16 opcode (thx to @hmilyyang) 2020-09-03 13:28:04 +02:00
ptitSeb 2f53752e05 Added a workaround for Unreal, to avoid segfault when launching it whithout leading './' 2020-09-03 10:41:13 +02:00
ptitSeb 3c0de68a00 Fixes to PMOVMSKB opcode ([DYNREC] too, avoiding a segfault) 2020-09-02 14:09:32 +02:00
ptitSeb ef22236f35 [DYNAREC] Another attempt to fix 66 0F D7 PMOVMSKB opcode 2020-09-02 10:19:42 +02:00
ptitSeb 563fc27eae [DYNAREC] Try to fix 66 0F D7 PMOVMSKB opcode 2020-09-02 08:48:59 +02:00
ptitSeb d453e120c8 Added F2 0F 80..8F (BND) Jxx opcodes 2020-09-01 22:29:08 +02:00
ptitSeb 57bd72f147 [DYNAREC] Added 66 0F F1/F2/F3 PSLL(W/D/Q) opcodes 2020-09-01 18:42:23 +02:00
ptitSeb 298c62e00b [DYNAREC] 66 0F D7 PMOVMSKB Gd, Ex opcode 2020-09-01 18:41:31 +02:00
ptitSeb 3d4abfeba2 [DYNAREC] Fix(?) 0F D7 PMOVMSKB Gd, Em opcode 2020-09-01 18:40:43 +02:00
ptitSeb b412118a79 [DYNAREC] Added 66 0F D3 PSRLQ Gx, Ex opcode 2020-09-01 18:05:42 +02:00
ptitSeb c2b5c32a14 Added CB FAR RET opcode 2020-08-31 10:45:11 +02:00
ptitSeb 06cd0a518f Added 64 67 8F POP FS:Ew16 opcode 2020-08-29 21:21:58 +02:00
ptitSeb 947dcc3f3d Added 0F 1A NOP / BNDLDX (ignored) opcode 2020-08-28 17:04:26 +02:00
ptitSeb fa5eb23cae Added 0F 1B NOP / BNDSTX (ignored) opcode 2020-08-28 10:55:45 +02:00
ptitSeb c43895b602 Update CHANGELOG.md 2020-08-27 22:07:18 +02:00
ptitSeb 18cb2a2047 [DYNAREC] Added 64 67 89 MOV Gd, FS:Ew16 opcode 2020-08-26 18:07:18 +02:00
ptitSeb 91637c7b11 [DYNAREC] Added 66 9C PUSHF and 66 9D POPF opcodes 2020-08-26 17:50:24 +02:00
ptitSeb 7b70e987ba [DYNAREC] Added 64 67 FF /6 PUSH FS:Ew16 2020-08-26 16:56:26 +02:00
ptitSeb 74dfef3424 [DYNAREC] Added 64 67 8B MOV Gd, FS:Ew16 and 64 67 A3 MOV FS:Ow, EAX opcodes 2020-08-26 16:26:28 +02:00
ptitSeb 65255edec5 [DYNAREC] Added 66 F8 CLC and 66 F9 STC opcodes 2020-08-26 15:11:29 +02:00
ptitSeb 5b00412ba0 [DYNAREC] Added D7 XLAT opcode 2020-08-26 15:05:51 +02:00
ptitSeb ef43e3f8a0 [DYNAREC] Added 0F EA PMINPS Gm, Em opcode 2020-08-26 14:24:29 +02:00
ptitSeb 3fa06d865a [DYNAREC] Added 66 99 CWD opcode 2020-08-26 14:01:15 +02:00
ptitSeb 96f2f12dec [DYNAREC] Added 66 EE PMAXW Gm, Em opcode 2020-08-26 13:43:06 +02:00
ptitSeb 972079532c [DYNAREC] Added 0F 74 PCMPEQB opcode 2020-08-26 13:11:02 +02:00
ptitSeb 996d4efa32 [DYNAREC] Added PADDUSW opcode 2020-08-25 13:55:45 +02:00
ptitSeb 4704bfb7e6 Added 66 0F DD PADDUSW opcode 2020-08-24 17:58:33 +02:00
ptitSeb 5d3b237854 [DYNAREC] Don't delete volatile dynablock (just invalidate) when memory block loose it's eXecutable flag 2020-08-24 14:00:17 +02:00
ptitSeb dca290b3f0 [DYNAREC] Fixed potential bus error on 0F 13 MOVLPS and 0F 17 MOVHPS opcodes 2020-08-23 15:55:44 +02:00
ptitSeb a84473036d [DYNAREC] End of block now provoque an X_PEND flags instead of X_ALL, also, removed the hl_linux workaround (and made C3 RET also needing an X_PEND flags) 2020-08-23 15:17:48 +02:00
ptitSeb 1b3cb7abb5 Merge pull request #191 from rajdakin/ubfx_fix
[DYNAREC] Fixed the UBFX and others instructions
2020-08-23 14:05:44 +02:00
rajdakin 7dd99ae13e [DYNAREC] Fixed the UBFX and others instructions 2020-08-23 13:54:16 +02:00
ptitSeb 7af511b01a Added 66 0F E4 PMULHUW Gx, Ex opcode 2020-08-23 11:41:58 +02:00
ptitSeb bb3dc2d889 Added 66 0F BA /7 BTC Ew, Ib 2020-08-22 11:05:57 +02:00
ptitSeb 76268c41bc Added 66 0F BA /5 BTS Ew, Ib 2020-08-22 10:24:54 +02:00
ptitSeb b6963ba7c6 Added 66 0F C8..CF BSWAP Reg16 opcode 2020-08-22 04:21:20 +02:00
ptitSeb bd3ff8f828 [DYNAREC] Add a temporary workaround to have HalfLife 2 Engine running correctly 2020-08-20 13:47:30 +02:00
ptitSeb 385326f3a8 [DYNAREC] Fixed RETN with N on 2 bytes (should help #188) 2020-08-19 15:21:07 +02:00
ptitSeb d896fd9106 Merge pull request #186 from shahidali55/patch-1
Removed backslash which was breaking ccmake
2020-08-18 10:06:28 +02:00
shahidali55 9c18afee35 Removed backslash which was breaking ccmake 2020-08-18 13:23:58 +05:30
ptitSeb f0b87c8312 Try to fix the gtk_display workaround when using gtk-1.2 instead of gtk-2.0 2020-08-17 20:24:10 +02:00
ptitSeb 297b7d548a [DYNAREC] Added a few GS: and FS opcodes 2020-08-17 17:07:49 +02:00
ptitSeb 7c406e8f8a [DYNAREC] Fixed CF flag for SHL32c emiter (fixed Sega Rally with Dynarec) 2020-08-16 20:55:23 +02:00
ptitSeb f458d8dc39 [DYNAREC] Optimized a bit BT Ed, Ib opcode 2020-08-16 20:54:47 +02:00
ptitSeb 66ed78cf4d [TRACE][DYNAREC] Small cosmetic changes to block that generate trace 2020-08-16 20:53:56 +02:00
ptitSeb f6205182b9 [TRACE] Fix trace that was disabled at first signal handling 2020-08-16 20:53:11 +02:00
ptitSeb a661016824 Avoid a BUSERROR on FISTP Ed, ST0 (help Sega Rally with Interpretor) 2020-08-16 20:52:28 +02:00
ptitSeb 448afcea7a [DYNAREC] Don't optimize flags on C3 RET opcode, some app count on it (help PlantsVsZombies and GOG Setup under wine, maybe more, #183) 2020-08-16 12:17:58 +02:00
ptitSeb 23881ad861 [DYNAREC] Avoid potential BUSERROR on FIST(P)64 2020-08-16 12:16:40 +02:00
ptitSeb 9d41f49741 {DYNAREC] Fixed a crash that can occur on multithreaded apps (fix regression on NFS2SE) 2020-08-16 10:58:00 +02:00
ptitSeb b302ebfbb5 [DYNAREC] Added F2/F3 9C PUSHF 2020-08-16 09:35:40 +02:00
ptitSeb 88d428f03c Added F2/F3 9C PUSHF opcode 2020-08-16 09:25:58 +02:00
ptitSeb 7396b30615 Fixed some '67' opcodes 2020-08-15 19:27:14 +02:00
ptitSeb 6fe1cc9ed7 [DYNAREC] Fixed 66 0F 5B CVTPS2DQ opcode 2020-08-15 19:25:52 +02:00
ptitSeb 7622959657 Generate git_head.h (and so build build_info.c) only when something else needs to be built 2020-08-15 17:44:34 +02:00
ptitSeb 6f94fdf133 [DYNAREC] Changed PUSHAD to have ESP always up-to-date 2020-08-15 14:49:18 +02:00
ptitSeb b348ce3660 Fixed git_head.h no generated at every build (it's build 2 times now with Dynrarec) 2020-08-15 14:23:37 +02:00
ptitSeb f8638fef92 Added 0F 01 /4 SMSW (dummy) opcode 2020-08-15 14:22:56 +02:00
ptitSeb 9e895da7ed Added wrapped gnutls_check_version function 2020-08-15 13:00:37 +02:00
ptitSeb cb659fef0d Added 66 0F B7 MOVZX Gw, Ew ([DYNAREC] too) 2020-08-15 12:53:13 +02:00
ptitSeb 1a9042c8d1 [DYNAREC] Simplified and optimized Dynablocklist Hash 2 Direct handling 2020-08-15 12:33:10 +02:00
ptitSeb aac8cb9775 [DYNAREC] Optimized dynablock handling 2020-08-15 12:31:37 +02:00
ptitSeb 99962a68b6 [DYNAREC] Removed dynablocks from elfheader, only using global one now 2020-08-15 10:56:39 +02:00
ptitSeb 8ce6d7f369 [DYNAREC] The 'volatile' dynablocks are now 4096 bytes of size, like a page (instead of 65536) 2020-08-15 09:48:59 +02:00
ptitSeb 3bc5a586fa Started v0.1.3 dev. cycle 2020-08-15 09:47:49 +02:00
ptitSeb f7630dec30 Bumped to v0.1.2 2020-08-14 10:04:55 +02:00
ptitSeb 031f41a333 Added build info (time and date) and git hash tag, rebuilt at each build 2020-08-14 10:03:32 +02:00
ptitSeb d18eb1c9c5 Added version and help options to box86 2020-08-14 09:13:12 +02:00
ptitSeb a666619de7 Added 0F BA /7 BTC opcode 2020-08-13 19:31:21 +02:00
ptitSeb a6d55175ac Added 0E PUSH CS opcode 2020-08-13 19:17:31 +02:00
ptitSeb b33d952b47 [DYNAREC] Some minor changes to emit_cmp16 2020-08-13 18:13:44 +02:00
ptitSeb 65fc0f36e7 [DYNAREC] Added 0F E8 PSUBSB and 0F E9 PSUBSW opcodes 2020-08-13 16:31:09 +02:00
ptitSeb 4bb743bde0 [DYNAREC] Fixed emit_sub16c (fixed sound in DeusEx) 2020-08-13 16:20:33 +02:00
ptitSeb 1b8f92249d [DYNAREC] Minor changes, to avoid potential BUSERROR mainly 2020-08-13 16:18:46 +02:00
ptitSeb 42838834f6 [DYNAREC] More log info on Unimplemented opcode 2020-08-13 16:18:13 +02:00
ptitSeb 83508fa322 Added F1 INT1 dummy opcode 2020-08-12 18:05:28 +02:00
ptitSeb 044d667b9e Added GL_EXT_multisampled_render_to_texture wrapped functions to libGL 2020-08-12 16:58:11 +02:00
ptitSeb 97274871c8 Protect memory only if Dynarec is used 2020-08-12 16:29:31 +02:00
ptitSeb e5fabc828c [DYNAREC] Added utility function to get dynarecblock from arm native dynarec address (and used it in SegFault handler) 2020-08-12 14:01:52 +02:00
ptitSeb e5601cb09c [DYNAREC] Made 81 /7 CMP Ed, Id opcode resiliant to SMC (fixes DeusEx, maybe other too) 2020-08-12 13:58:05 +02:00
ptitSeb 6f87bd8570 Added 67 E8 xx opcode (should help #179 too) 2020-08-11 17:41:04 +02:00
ptitSeb b393923c6e Added 65 2B SUB Gd, GS:Ed and 65 03 ADD Gd, GS:Ed opcode ([DYNAREC] too) (should help #179) 2020-08-11 16:54:00 +02:00
ptitSeb 37ab148df6 Simplified a bit ResolveFile utility function 2020-08-11 13:58:37 +02:00
ptitSeb 2f977f200b Added libcurl-gnutls.so.4 as a synonym a libcurl.so.4 2020-08-11 11:18:15 +02:00
ptitSeb e674f1a528 Changed PltResolver, to be inject in PLT.GOT instead of GOT.PLT before GOT (fixes Don't Starve) 2020-08-11 11:17:28 +02:00
ptitSeb fc93d47b14 Removed some useless code in wrapped glib2 lib 2020-08-10 18:55:50 +02:00
ptitSeb 3028d096b9 Merge pull request #178 from rajdakin/makefix
x86 build fix
2020-08-10 16:52:19 +02:00
rajdakin e7313a4df4 [BOX86] Fixed multiple non-extern definitions (x86 build) 2020-08-10 16:49:24 +02:00
rajdakin 31af5ec181 [LIBTOOLS] Fixed x86 builds (__i386 is defined, not __x86__) 2020-08-10 16:48:13 +02:00
ptitSeb 98222c75c2 Merge pull request #177 from rajdakin/VMOVinsn_fix
[DYNAREC] Fixed the four VMOV VFPU instructions printer
2020-08-10 16:35:51 +02:00
rajdakin d0380eccf7 [DYNAREC] Fixed the four VMOV VFPU instructions printer 2020-08-10 16:28:03 +02:00
ptitSeb f570ee0ea2 Fixed nanoslepp that was broken with last commit 2020-08-09 15:38:43 +02:00
ptitSeb 6ac716b8ba Update README.md 2020-08-09 10:10:22 +02:00
ptitSeb e8a080f5c0 Added COLOR_PAIRS to ncurses* (help Dwarf Fortress in text mode) 2020-08-08 17:45:53 +02:00
ptitSeb 67237e54f9 Added some workaround for nanosleep with null parameter 2020-08-08 17:20:29 +02:00
ptitSeb 4acf0f080e refactored CPUID opcode, and added a few more SubCommand (80000001..80000005) 2020-08-08 11:23:09 +02:00
ptitSeb 8e576f3f7d Merge pull request #176 from spacepilotAV/patch-1
Fix spelling of surprisingly in README.md
2020-08-07 19:32:10 +02:00
ra1n 037859b007 Fix spelling of surprisingly in README.md
speeling is important guys ;)
2020-08-07 13:14:39 -04:00
ptitSeb e81e7c7ebd Allow the use of #ifndef in wrapper _private headers 2020-08-07 15:45:17 +02:00
ptitSeb a50079b920 Better wrapping of g_variant_new_va (should help #167) 2020-08-07 15:43:48 +02:00
ptitSeb 4a38d8199f Merge pull request #175 from truboxl/patch-1
Make test10 more robust
2020-08-06 12:38:27 +02:00
Jia Yuan Lo 4dd9337528 Make test10 more robust
Test10 currently only passes after "make install" (no regard to x86lib directory needed) or we build directly inside box86 folder.
This change make sure x86lib folder is properly located so that we can also "ctest" inside build folder after compile without "make install".

Signed-off-by: Jia Yuan Lo <[email protected]>
2020-08-06 18:22:01 +08:00
ptitSeb c6db07039f Merge pull request #174 from Icenowy/fld-double-sigbus
[DYNAREC] Avoid SIGBUS on FLD double
2020-08-06 09:57:43 +02:00
Icenowy Zheng 9294b59aae [DYNAREC] Avoid SIGBUS on FLD double
Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-06 05:53:11 +08:00
ptitSeb 490f595d6d [DYNAREC] Avoid BUSERROR on 0F 7F MOVQ (should help #167) 2020-08-05 18:52:12 +02:00
ptitSeb 67af7a0baf [DYNAREC] Fixed freeze issue introduce with previous commit 2020-08-05 15:10:00 +02:00
ptitSeb 7da89748bb [DYNAREC] Small change on nolinker block handling (when son is outside the range of the parent) 2020-08-05 12:02:15 +02:00
ptitSeb 72a82ebece [DYNAREC] Reordered the cleaning of dynablocks / dynablocks list to avoid segfault 2020-08-05 11:17:21 +02:00
ptitSeb 12e44a3e62 Merge pull request #173 from Icenowy/blocks_hashmap_check
check whether blocks hashmap exists when removing block from it
2020-08-05 10:01:30 +02:00
Icenowy Zheng 5dd94df9dd check whether blocks hashmap exists when removing block from it
Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-05 15:57:23 +08:00
ptitSeb 79051e04b4 Merge pull request #172 from Icenowy/dynablock_mark_foreach_fix
dynablock: do not access value when foreach on marks
2020-08-05 09:46:40 +02:00
ptitSeb 02a0a77bda Merge pull request #170 from Icenowy/sdl_tolowerupper
wrap SDL_to{lower,upper}
2020-08-05 09:39:33 +02:00
Icenowy Zheng b3c5115707 dynablock: do not access value when foreach on marks
Accessing the value of a kh_set (which has no values set) is an
undefined behavior, which may make monsters to appear.

Add a kh_foreach_key macro that do not touch values at all, and use it
when ennuerating marks in dynablock, to prevent SIGSEGV of accessing
non-existent values.

Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-05 15:26:55 +08:00
Icenowy Zheng e069681cfd wrap SDL_to{lower,upper}
These are very simple function that accepts an int and returns an int.

Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-05 15:00:30 +08:00
ptitSeb c93356fb1a Deactivated Segment optim for GS (should help #167) 2020-08-04 16:19:56 +02:00
ptitSeb c398c938e1 Added F2/F2 18..1D opcode (F2/F3 ignored) 2020-08-04 15:43:20 +02:00
ptitSeb f3c6dc31ac Added 66 36 prefix (and fixed 66 2E and 66 26 prefixes) 2020-08-04 15:28:44 +02:00
ptitSeb 06403425f9 Merge pull request #166 from Icenowy/ld_library_path_prepend
prepending LD_LIBRARY_PATH
2020-08-04 10:25:30 +02:00
ptitSeb a9fa9095d5 Merge pull request #165 from Icenowy/g_utf8_skip
wrap g_utf8_skip in glib, which is a pointer to an array of char
2020-08-04 09:40:17 +02:00
Icenowy Zheng 617eacfcd3 prepending LD_LIBRARY_PATH
LD_LIBRARY_PATH should be able to override system libraries, this is the
behavior of ld-linux.so.

Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-04 04:34:54 +08:00
Icenowy Zheng 7ba89639da wrap g_utf8_skip in glib, which is a pointer to an array of char
Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-04 02:14:05 +08:00
ptitSeb 2914ed358e [DYNAREC] Don't allocate Direct Dynablock on mmap 2020-08-03 00:10:17 +02:00
ptitSeb 72041b6873 Make bridges allocate larger chunk 2020-08-03 00:09:41 +02:00
ptitSeb bf8da23a76 Added SS_ONSTACK fake handling to sigaltstack, so Unity game don't assert at start 2020-08-02 20:06:34 +02:00
ptitSeb f3f3d9cdfe Some small fixes to Segment offset cache mecanism 2020-08-02 19:57:43 +02:00
ptitSeb 05c7d8fec9 Use a Cache (per thread) of Segment Offset, to sppedup GS: and FS: access 2020-08-02 16:04:27 +02:00
ptitSeb 5201aeffa6 [DYNAREC] Small optim in GetDynablocksFromAddress, starting with fast getDBFromAddress before looking içnto elf memory 2020-08-02 16:03:55 +02:00
ptitSeb 2fba190d8b [DYNAREC] Improved son creation for large dynablock (or block near end of dynablocklist) by allow the use of a different dynablocklist parent 2020-08-02 14:17:54 +02:00
ptitSeb 9e669ad06b [DYNAREC] Added 66 F2/F3 A7 REP(N)Z CMPSW and 66 F2/F3 AF REP(N)Z SCASW 2020-08-02 14:16:36 +02:00
ptitSeb 7f66be599c [DYNAREC] Added D9 /4 FLDENV Ed opcode 2020-08-02 13:55:36 +02:00
ptitSeb 7d1f429ead [DYNAREC] Added 66 91..97 XCHG AX, reg opcode 2020-08-02 13:55:07 +02:00
ptitSeb 4e602abfcb Try to improve (and fix) obstack wrapping (should help #160) 2020-08-02 10:08:05 +02:00
ptitSeb aad016d418 Merge pull request #163 from Icenowy/obstack_free
Add an automatic wrapper for {,_}obstack_free
2020-08-01 22:12:25 +02:00
Icenowy Zheng 3544428e18 Add an automatic wrapper for {,_}obstack_free
Signed-off-by: Icenowy Zheng <[email protected]>
2020-08-02 04:07:29 +08:00
ptitSeb 459c3ef530 Various small x87 adjustments 2020-08-01 17:58:09 +02:00
ptitSeb a01f5b1f3f [DYNAREC] Added a warning when a son have no code 2020-08-01 17:57:52 +02:00
ptitSeb 9183391ab0 Forgot the EXPORT for my__obstack_begin (should help #160) 2020-08-01 17:56:51 +02:00
ptitSeb c22ca077ba [DYNAREC] Added CF IRET opcode 2020-08-01 15:11:17 +02:00
ptitSeb 63c224b073 Ajusted D9 F5 FPREM1 opcode 2020-08-01 14:07:48 +02:00
ptitSeb f36567593a Added _obstack_begin wrapped function to libc (for #160) 2020-07-31 18:11:10 +02:00
ptitSeb b2efee99fa Merge pull request #159 from Icenowy/main-fix
Fix compliation of non-dynarec build
2020-07-30 20:39:27 +02:00
Icenowy Zheng 6510dc9e45 Fix compliation of non-dynarec build
sysconf() is part of unistd.h, and src/main.c uses it. However, this
source code file only includes <unistd.h> when DYNAREC, makes
non-dynarec build fail for missing _SC_PAGESIZE macro.

Move the inclusion of <unistd.h> out of #ifdef DYNAREC.

Signed-off-by: Icenowy Zheng <[email protected]>
2020-07-31 01:55:06 +08:00
ptitSeb 213beed360 Merge branch 'master' of https://github.com/ptitSeb/box86 2020-07-29 17:24:13 +02:00
ptitSeb 801f374a66 Added a workaround to get wine run under interpretor only 2020-07-29 17:23:51 +02:00
ptitSeb 7f3eecec4c Merge pull request #157 from icecream95/cmsg
Add a wrapped function for __cmsg_nxthdr
2020-07-29 13:16:40 +02:00
Icecream95 bd92f64df9 Add a wrapped function for __cmsg_nxthdr 2020-07-29 22:55:02 +12:00
ptitSeb ab2617c20f [DYNAREC] This +1 was not needed, end is alread aligned and all 2020-07-29 08:00:39 +02:00
ptitSeb cd958240df [DYNAREC] More small change on memory protection scheme 2020-07-28 17:34:06 +02:00
ptitSeb 4254a2a2f7 Small change to vfprintf wrapped function 2020-07-28 16:57:38 +02:00
ptitSeb 9735f21f65 [DYNAREC] Some more small fixes on memory protection scheme 2020-07-28 13:25:59 +02:00
ptitSeb 62343cbb77 Made bridge structure slightly bigger so it align 2020-07-28 13:24:46 +02:00
ptitSeb 23eca257f4 Merge pull request #156 from Newbytee/patch-1
Language fixup in README
2020-07-27 15:41:02 +02:00
Newbyte 5a3c17e831 Language fixup in README
I did some language fixes in README. During this I took some liberties to improve consistently, like always writing Box86 with a capital B. I am not sure whether you have a preferred way to stylise it, but as it is prior to this PR the README mixes box86 and Box86 heavily, and I decided to go with the latter. If you prefer it to always be written box86 with a lowercase b I can change it to be so.
2020-07-27 15:11:05 +02:00
ptitSeb de1bb7e438 Improved internal path resolution (should help #154) 2020-07-27 10:03:56 +02:00
ptitSeb 6216d06d0e [DYNAREC] Fine-tuned, again, how cleanDBFromAddressRange worked 2020-07-27 09:03:13 +02:00
ptitSeb cb03a51d40 [DYNAREC] Fixed a crash in later dynarec log level 2020-07-27 09:01:41 +02:00
ptitSeb 09a65a622a [DYNAREC] Small change in protection of dynarec volatile block, with a better detection of start address to scan 2020-07-26 20:42:25 +02:00
ptitSeb 95f6ce1f3e Fixed a potentiel read isse with execv method 2020-07-25 16:48:38 +02:00
ptitSeb 7ede988cb1 Added 64 67 A3 xx xx MOV FS:[Ov], EAX 2020-07-24 15:32:52 +02:00
ptitSeb a06e05dc9e Added 64 67 89 MOV FS:ED16,GD opcode 2020-07-23 10:13:27 +02:00
ptitSeb 2a3c6dc55c Added 6E/6F OUTSB/OUTSD (faked) opcode 2020-07-23 10:12:13 +02:00
ptitSeb 814701324c Added F2/F3 66 A7 REP(N)Z CMPSW 2020-07-22 15:41:43 +02:00
ptitSeb 01fea9ce3f Checked all wrapped function used by ntdlls.so, fixing some of them 2020-07-21 08:06:39 +02:00
ptitSeb da5e795858 [DYNAREC] Disable the use of SWP arm opcode for XCHG x86 opcode, while the 8bit verison seems ok, the 32bits is not 2020-07-20 08:30:52 +02:00
ptitSeb b491241307 Added 64 67 FF /6 PUSH FS:[Ed16] opcode 2020-07-20 08:29:40 +02:00
ptitSeb 81f6e87416 Fixed glXCreatePbuffer wrapped function signature 2020-07-19 23:20:06 +02:00
ptitSeb 20a680561a Added wrapped libncurses.so.6 and libtsinfo.so.6 (based on .5 version) 2020-07-19 18:21:45 +02:00
ptitSeb a4f2a19505 Added EC INSB AL, DX 2020-07-18 12:47:32 +02:00
ptitSeb a263283c93 Added 16 PUSH SS and 17 POP SS opcodes 2020-07-17 20:36:41 +02:00
ptitSeb ac2cdc65a8 Added a few off opcodes 2020-07-17 16:08:37 +02:00
ptitSeb c1b7740ac4 Added 66 91..97 XCHG AX, Reg opcodes 2020-07-17 08:21:57 +02:00
ptitSeb a1c8868159 Added 66 60 and 66 61 PUSHA POPA opcodes 2020-07-16 21:38:05 +02:00
ptitSeb a157acd185 Added 64 67 A1 xx xx opcode 2020-07-16 20:19:32 +02:00
ptitSeb 12ec1309bb Added option to disable the hack to force X11 GLX Extension beeing detected (help wine stuff while gl4es is not uet compatible) 2020-07-16 09:22:37 +02:00
ptitSeb 042d55f734 Added 66 F3 A4 (alt) MOV SB ([DYNAREC] too) 2020-07-16 08:17:21 +02:00
ptitSeb 67f8c6df42 Added F2/F3 40..4F (alt)INC/DEC reg opcode 2020-07-15 20:38:15 +02:00
ptitSeb c9d6c72fe0 Added 0F F7 MASKMOVQ opcode 2020-07-15 15:41:08 +02:00
ptitSeb e5fcadae30 Fixed signature for XGetAtomNames wrapped function 2020-07-15 13:42:00 +02:00
ptitSeb cb0ee7990a Added a workaround to ignore failed test of GLX extension in X11 2020-07-15 13:33:14 +02:00
ptitSeb 0eea4c5913 Added 0F E7 MOVNTQ opcode ([DYNAREC] too) 2020-07-15 09:14:36 +02:00
ptitSeb 5a8466b0d7 Fix compilation for non-dynarec build 2020-07-15 08:36:46 +02:00
ptitSeb 372d811f66 Added 65 8A MOV Gb, GS:Eb 2020-07-14 23:48:13 +02:00
ptitSeb ff2027846b [DYNAREC] Fixed issue when dlclose then dlopen a library 2020-07-14 20:26:37 +02:00
ptitSeb 8318eb1a0d Added 0F BA /5 BTS Ed, Ib opcode 2020-07-14 19:20:31 +02:00
ptitSeb 57c0751793 Added 66 FF /6 PUSH Ed opcode 2020-07-14 19:19:58 +02:00
ptitSeb 86b00ef7fe Added 66 9D POPF opcode 2020-07-14 18:59:56 +02:00
ptitSeb 6e12a556ec Fixed a warning 2020-07-14 18:06:01 +02:00
ptitSeb fba165d121 Added 64 67 8B opcode 2020-07-14 18:05:40 +02:00
ptitSeb 68d77636b0 Changed again a bit the destruction sequence for box86context 2020-07-14 14:37:11 +02:00
ptitSeb 394d46f731 Added 66 0F BA BTR opcode 2020-07-14 14:36:44 +02:00
ptitSeb 702a9f6aa5 Added dummy 0F 00 VERR/VERW and 0F EA PMAXSW opcode 2020-07-14 13:48:41 +02:00
ptitSeb 7ae3813ac5 Set my_context to NULL when context is beeing destroyed 2020-07-14 12:13:55 +02:00
ptitSeb 34a933af0b Try to get more info on segfault (not sure it's a good idea) 2020-07-14 12:13:22 +02:00
ptitSeb 4ac5d6df7f Added 36 SS: (ignored) prefix ([DYNAREC] too) 2020-07-14 11:29:52 +02:00
ptitSeb 0260548d9c Fixed a few glX wrapped functions 2020-07-14 11:29:22 +02:00
ptitSeb 5b64623f50 [DYNAREC] Fix a potential crash when a volite dynablock is 0 len 2020-07-14 10:18:29 +02:00
ptitSeb 233e472503 Added 0F EA PMINSW Gm, Em opcode 2020-07-14 09:58:36 +02:00
ptitSeb 335512e96a Added fake 62 BOUND GD, Ed opcode ([DYNAREC] too) 2020-07-14 09:47:13 +02:00
ptitSeb d451a3fdd7 Added 64 3B CMP Gd,FS:Ed ([DYNAREC] too) 2020-07-14 09:13:50 +02:00
ptitSeb 499de4fd60 Oops, forgot to remove some debug code 2020-07-13 21:05:18 +02:00
ptitSeb caf9abc16f Added also F2/F3 E9 opcode ([DYNAREC] too) 2020-07-13 19:12:35 +02:00
ptitSeb 5dfce69c37 Added F2/F3 E8 opcode ([DYNAREC] too) 2020-07-13 19:04:03 +02:00
ptitSeb 8f12829e95 Added some more wrapper to opengl 2020-07-13 18:23:13 +02:00
ptitSeb 15a42f5407 Added some wine prereserve mecanism 2020-07-13 17:38:45 +02:00
ptitSeb c8cdd3f432 [DYNAREC] Added F2/F3 66 AF REP(N)Z SCASW opcode 2020-07-13 17:38:19 +02:00
ptitSeb ac7c72396d Added F2/F3 66 AF REP(N)Z SCASW opcode 2020-07-13 17:37:43 +02:00
ptitSeb ce3271f095 Fixed some case of bad error with mmap / mmap64, plus improve trace of it 2020-07-13 17:36:32 +02:00
ptitSeb 3ff4b04e52 [DYNAREC] More alignment fixes 2020-07-13 17:35:05 +02:00
ptitSeb ecd90a41d5 [DYNAREC] Try to avoid some SIGBUS on DC xx opcodes 2020-07-13 14:50:58 +02:00
ptitSeb 87695cf84b [DYNAREC] Try to avoid potention SIGBUS on some F2 0F xx opcodes 2020-07-13 14:32:12 +02:00
ptitSeb 3bb93e1fd9 Added F2 0F 7C HADDPS opcode ([DYNAREC] too) 2020-07-13 11:30:24 +02:00
ptitSeb 69279b2233 Added D9 F6 FDECSTP and D9 F7 FINCSTP opcodes 2020-07-13 10:54:46 +02:00
ptitSeb 7c811666fe Added 0F A0/A1/A8/A9 PUSH/POP FS/GS opcodes ([DYNAREC] too) 2020-07-13 10:43:49 +02:00
ptitSeb 9a18dd3718 Added 0F D7 PMOVMSKB opcode ([DYNAREC] too) 2020-07-12 15:03:06 +02:00
ptitSeb 3338d26aaa Add 2 more wrapped function to libpulse 2020-07-12 12:38:58 +02:00
ptitSeb 167ea1587e Chnaged a bit signals debug 2020-07-12 12:38:31 +02:00
ptitSeb 7ad6399940 Added workaround for _finite function not always present in libm, using regular function as fallback (should help #138) 2020-07-12 10:39:03 +02:00
ptitSeb 71db6b3275 Some changes to the interpretor to ensure R_EIP is always correct 2020-07-11 18:12:03 +02:00
ptitSeb 00626b9f3e Fixed an issue with FS: access (or any other custom selector) 2020-07-11 16:11:48 +02:00
ptitSeb d0fa79c9ca [DYNAREC] Fixed PUSH FS:Ed opcode 2020-07-11 15:54:10 +02:00
ptitSeb fc1f75c3f6 [DYNAREC] Added 2 segment related opcodes 2020-07-11 15:17:15 +02:00
ptitSeb 21b9676093 Added some wrapped function to libusb-1.0 2020-07-11 14:38:36 +02:00
ptitSeb ea2a7204df Forgot that fix for libpng12 2020-07-11 14:38:10 +02:00
ptitSeb bcdd09a2e6 Removed dup'd function in wrapped libpng16 2020-07-11 14:28:37 +02:00
ptitSeb 7c394ddeee Show args for emulated program on BOX86_LOG=1 at start 2020-07-11 13:57:23 +02:00
ptitSeb 50d7e2d1d7 Some fixes to wrapped libpng16 and libpng12 2020-07-11 13:55:10 +02:00
ptitSeb 395cecb082 More change on signal handler. Still not complete enough 2020-07-10 20:46:20 +02:00
ptitSeb c8888915d7 [DYNAREC] Very small optim on CALL Ed opcode 2020-07-09 22:13:00 +02:00
ptitSeb 38740ce1c9 [DYNAREC] Try to avoid a segfault, bad mix with PltResolver that can hapens (should help #145) 2020-07-08 22:46:43 +02:00
ptitSeb 73b893215e [DYNAREC] Added FSAVE and FRSTOR opcode 2020-07-08 22:45:58 +02:00
ptitSeb e93c3f0028 Added option to have different trace per pid (to avoid overwritting when multiple process are spawning) 2020-07-08 18:21:49 +02:00
ptitSeb be2e35381e Removed a dupe in wrapped lib xrender 2020-07-08 16:46:57 +02:00
ptitSeb c79f59c86f Added one more wrapped function to libxi 2020-07-08 16:30:10 +02:00
ptitSeb 6f02d5f2c4 Added more gnutls wrapped functions 2020-07-08 16:23:40 +02:00
ptitSeb 969bd84f1d Added more FreeType wrapped functions 2020-07-08 15:36:20 +02:00
ptitSeb 8865b7bfec Added wrapped libgnutls (with some wrapped functions) 2020-07-08 15:15:11 +02:00
ptitSeb f60ecc3626 Added more wrapped function to libpng16 2020-07-08 14:10:36 +02:00
ptitSeb 824b230bd0 Added some support for modify_ldt syscall, but pretty useless whle 16bits is not supported 2020-07-08 13:38:13 +02:00
ptitSeb 71a208334d [DYNAREC] Changed a bit what PUSH/POP DS/ES emit (more in line with PUSH/POP reg) 2020-07-08 13:37:08 +02:00
ptitSeb 1d75d23772 Added wrapped libmpg123 lib (partial) 2020-07-07 09:40:16 +02:00
ptitSeb 6dd848eac5 Added F2/F3 70..7F (BND) Jxx and 64 8F PUSH FS:Ed opcodes 2020-07-07 07:50:17 +02:00
ptitSeb 0c0684bfb7 Added support for set_thread_area and handling of FS: 2020-07-06 21:57:46 +02:00
ptitSeb b56337df19 [DYNAREC] Fix potential crash when deleting a dynoblock without map 2020-07-06 21:57:46 +02:00
ptitSeb 0f0512c67c Merge pull request #144 from Mashintime/master
Update CMakeLissts.txt to copy libstdc++.so.5
2020-07-06 21:35:46 +02:00
Mashintime b677261976 Update CMakeLissts.txt to copy libstdc++.so.5
Included in x86libs but not copied to /usr/lib when 'make installing'
2020-07-06 15:25:24 -04:00
ptitSeb 0d0a75319c Fixed an old typo on impacting thread_attr_setstacksize 2020-07-06 21:24:53 +02:00
ptitSeb 0d283757d5 Update README.md 2020-07-06 07:48:19 +02:00
ptitSeb c09f477251 Improvement to the trace of called wrapped functions 2020-07-05 18:48:13 +02:00
ptitSeb 1d2bf3cb48 Try to make the O_XXXX convert function more portable 2020-07-05 14:28:25 +02:00
ptitSeb 7057160b3e Improved handling of pthread get/set affinit (old and new version) 2020-07-04 18:53:26 +02:00
ptitSeb 4244f41c41 Added helper function to get function name based on address 2020-07-04 15:41:28 +02:00
ptitSeb 70f587e305 Fixed potential issue with cmake 2020-07-04 14:20:51 +02:00
ptitSeb 97c5119807 Update README.md 2020-07-03 21:04:08 +02:00
ptitSeb 77a74d64bf [DYNAREC] Try to avoid a crash caused by a bad mix of dynarec and unresolved plt 2020-07-02 09:53:55 +02:00
ptitSeb 0547cec24d More SDL2 wrapped function with dummy fallback (plus some refactor and a fix probably) 2020-06-30 19:51:20 +02:00
ptitSeb 6837f58a0e Added 1 unofficial wrapped function (with dummy fallback) to SDL2 2020-06-30 18:28:32 +02:00
ptitSeb 2518377f83 Some fix to SDL2 wrapped lib 2020-06-30 14:14:24 +02:00
ptitSeb d38e67f539 Improved libx11 callback handling 2020-06-30 13:55:09 +02:00
ptitSeb a3d16d3c71 [DYNAREC] Fixed a warning 2020-06-30 12:48:41 +02:00
ptitSeb 14e1363930 Changed how FXSAVE/FXRSTOR works (in [DYNAREC] too) 2020-06-30 12:45:54 +02:00
ptitSeb 86eba0aaeb [DYNAREC] Actually use 64 FS: prefix 2020-06-30 12:06:39 +02:00
ptitSeb 10d7e28de3 Added some wrapped functions to a few libs 2020-06-30 09:49:02 +02:00
ptitSeb 082d08755e Stop ignoring tgsysall for now 2020-06-30 09:41:38 +02:00
ptitSeb 195bbddd6f This should avoid the 'wall of segfault' that happens sometimes 2020-06-30 09:06:43 +02:00
ptitSeb d68cbfd837 Added CF IRET opcode (not sure if correct) 2020-06-30 00:42:21 +02:00
ptitSeb 851d487015 [DYNAREC] Fixed FXSAVE / FXRSTOR (partial) opcode 2020-06-30 00:16:18 +02:00
ptitSeb 0a3ae03043 Added libncurses.so.5 wrapped function (bases libncursesw) and added 1 wrapped function to lbtsinfo.so.5 2020-06-30 00:09:59 +02:00
ptitSeb d56fea52f3 Added preliminary dlinfo wrapped function 2020-06-29 23:25:08 +02:00
ptitSeb 1de0f14194 [DYNAREC] Fix hang when call address 0 2020-06-29 23:24:48 +02:00
ptitSeb d3addae744 Fixed a warning in x86tls.c 2020-06-29 21:30:22 +02:00
ptitSeb ee0e831efe [DYNAREC] Added some FS: opcode (copy of GS: ones) 2020-06-29 20:41:44 +02:00
ptitSeb 59559efbb5 Handling default value for FS when creating new x86emu_t structure 2020-06-29 19:52:56 +02:00
ptitSeb 05e2a9c824 Fixed pwrite64 wrapped function signature 2020-06-29 19:39:41 +02:00
ptitSeb 9038d94184 Added a few wrapped function to libm 2020-06-29 18:25:51 +02:00
ptitSeb 08a93fc5ae Added memccpy wrapped function to libc 2020-06-29 18:09:04 +02:00
ptitSeb 6b6075ca48 Fixed dladdr wrapped function 2020-06-29 17:43:54 +02:00
ptitSeb 51135b9222 Added support for DT_RUNPATH (handed the same way as DT_RPATH) 2020-06-29 16:49:39 +02:00
ptitSeb 922c1770a0 [DYNAREC] Fix PUSH/POP DS/ES that should handle 32bits value on the stack (even if segment is 16bits) 2020-06-29 14:24:11 +02:00
ptitSeb b9dc8d79e0 Added 1 wrapped function to libX11 2020-06-29 13:03:11 +02:00
ptitSeb 7b823e4185 Changed execv wrapped function to automaticaly call box86(t) for x86 binary (help valgrind with --trace-children=yes) 2020-06-29 12:27:53 +02:00
ptitSeb fbdb4aa619 Changed how actual box86 fullpath is found 2020-06-29 12:24:55 +02:00
ptitSeb 7716936f77 [DYNAREC] Better way to free dynablocks (when a son would be free because his parent is freed, but still accessed to check if it can be freed) 2020-06-29 12:02:25 +02:00
ptitSeb 9636fec9da Free elfs first thing in FreeBox86Context 2020-06-29 12:01:15 +02:00
ptitSeb e15676e946 Changed how argv strings are handled 2020-06-29 11:41:07 +02:00
ptitSeb 28fb4ed090 [DYNAREC] Fixed a small potential memory overwritting 2020-06-29 11:19:55 +02:00
ptitSeb 8b5474d0a8 Added a few libX11 wrapped functions 2020-06-29 10:02:17 +02:00
ptitSeb 35e5a48e63 Added some FreeType wrapped functions 2020-06-29 08:56:47 +02:00
ptitSeb 470446a104 Removed some debug leftover 2020-06-29 08:56:26 +02:00
ptitSeb c0cc48d129 Added preliminary support for FS: and set_thread_area 2020-06-29 08:44:13 +02:00
ptitSeb 1134294037 [DYNAREC] Fix (66) 8E MOV Seg,Ew opcodes 2020-06-29 07:45:25 +02:00
ptitSeb f0f49d4f8f [DYNAREC] Fixed 66 8C MOV Ew, Seg and 66 8E MOV Seg, Ew opcodes 2020-06-28 19:22:19 +02:00
ptitSeb 5f361cbd2d Added exception for win-preloader in main (to not preload but load directly) 2020-06-28 18:01:54 +02:00
ptitSeb 20d65d3685 Wrapped lib now have path set to actual name 2020-06-28 17:16:50 +02:00
ptitSeb 51f0780c66 [DYNAREC] Added 0F 63 PACKSSWB opcode 2020-06-28 16:22:02 +02:00
ptitSeb b3db9aece7 [DYNAREC] Fixed PUSH ES / POP ES 2020-06-28 15:58:29 +02:00
ptitSeb 4e22fd1a69 Enabled SYS_RECVMMSG and SYS_SENDMMSG on syscall 102 even if those 2 macro are not defined 2020-06-28 11:23:42 +02:00
ptitSeb d290ccee7f [DYNAREC] Added 0F 51 SQRTPS and 0F 52 RSQRTPS opcodes 2020-06-27 20:13:42 +02:00
ptitSeb 4d227ef882 [DYNAREC] Added MINPD and MAXPD 66 0F 5D and 66 0F 5F opcodes 2020-06-27 18:28:40 +02:00
ptitSeb 6f842cea8b Changed the way NEEDED lib and GLOBAL symbol are fetched (again, for good this time hopefully, at least is seems to fix #136) 2020-06-27 14:02:56 +02:00
ptitSeb 36da25e08e Added 1 wrapped function to x11 lib 2020-06-27 08:57:45 +02:00
ptitSeb f586bb2617 Added syscall 196 sys_lstat64 2020-06-26 23:10:31 +02:00
ptitSeb f3a81ac635 Added syscall 66 sys_setsid 2020-06-26 19:37:31 +02:00
ptitSeb 266fc0961b Added syscall 271: sys_utimes 2020-06-26 19:09:11 +02:00
ptitSeb 824ae55d77 Added DS: prefix (ignored), can be used as hint, along with CS: in conditionnal jump (also ignored) 2020-06-26 18:22:41 +02:00
ptitSeb 656bfdc569 Fixed a small warning in gio2 wrapped lib 2020-06-26 09:01:53 +02:00
ptitSeb 0f45dd5fee Added libc syscall 174 (rt_sigaction) 2020-06-25 08:53:28 +02:00
ptitSeb 82e7faf83d Added more slot for pthread_once_callback 2020-06-24 18:24:20 +02:00
ptitSeb 0c7310b18d Really fixed epoll_create1 2020-06-24 16:00:28 +02:00
ptitSeb 2cedd0d2c6 Do not convert argument for epoll_create1 2020-06-24 15:15:44 +02:00
ptitSeb b63d087d5c Improved trace on semop wrapped function 2020-06-24 15:15:16 +02:00
ptitSeb bccdb36bd3 Added 2 x11 related wrapped functions 2020-06-23 07:47:24 +02:00
ptitSeb 298ef551ce Merge pull request #132 from rajdakin/explicitELF64
Explicit error message when having 64-bits ELFs
2020-06-21 20:46:39 +02:00
rajdakin 9b23a0a7ab [ELF] Explicit error message when having 64-bits ELFs 2020-06-21 20:44:54 +02:00
ptitSeb 5e2546dd0c Try to stop at double-segfault 2020-06-21 17:44:57 +02:00
ptitSeb 4e9bef301d Reworks INIT/FINI process, and fixed epoll syscall (now Half-Life quit properly) 2020-06-21 15:45:31 +02:00
ptitSeb be5d718280 [DYNAREC] Fixed a warning 2020-06-21 10:45:21 +02:00
ptitSeb 3bc1d6d0a1 Added alternative name for libopenal.so as openal.so 2020-06-21 09:25:34 +02:00
ptitSeb 2d23169ea5 [DYNAREC] Fixed many F3 0F xxxxSS opcodes 2020-06-20 19:48:59 +02:00
ptitSeb b486c60d5e Merge pull request #130 from rajdakin/printer
Dynarec printer fix
2020-06-20 18:22:25 +02:00
rajdakin 3246d2bbb6 [SIGNAL] Fixed unknown architecture build 2020-06-20 18:13:09 +02:00
rajdakin 7d7765ce14 [DYNAREC] Fixed one more time the printer (VMOV.F32 S, imm) 2020-06-20 18:12:46 +02:00
ptitSeb c1f2750b05 [DYNAREC] Fixed some printer issue with VFPU registers 2020-06-20 17:39:12 +02:00
ptitSeb bb4d44499c [DYNAREC] Added 66 0F C2 CMPPD opcode 2020-06-20 15:32:37 +02:00
ptitSeb 195ac3e5b6 [DYNAREC] Added 0F 2D CVTPS2PI opcode 2020-06-20 15:22:14 +02:00
ptitSeb bc9679cad9 [DYNAREC] Added 66 0F E6 CVTTPD2DQ opcode 2020-06-20 14:55:08 +02:00
ptitSeb a603b58970 [DYNAREC] Fixed 66 0F 5E DIVPD opcode 2020-06-20 14:39:06 +02:00
ptitSeb a740dbf871 [DYNAREC] Added 66 0F 5E DIVPD and 66 0F 15 UNPCKHPD opcode 2020-06-20 14:32:26 +02:00
ptitSeb b10e462e03 [DYNAREC] Added (naive) 0F 50 MOVMSKPS opcode 2020-06-20 14:19:37 +02:00
ptitSeb 6f28eb16c6 [DYNAREC] Fixed another potential BUSERROR 2020-06-20 12:53:22 +02:00
ptitSeb 140a41141c Fixed a potential BUSERROR 2020-06-20 12:03:46 +02:00
ptitSeb 6f00b50c6e Added Faked libtcmalloc_minimal (empty wrapped, use regular malloc/new functions) 2020-06-20 11:45:16 +02:00
ptitSeb a9cb19933a Change order of Global and Weak symbol fetching. Should be good this time 2020-06-20 10:50:03 +02:00
ptitSeb cbd8ce408e Enabled Trace in LOCAL function works now 2020-06-20 09:51:44 +02:00
ptitSeb 9837888e50 Allow Trace on LOCAL symbol loaded at start (was ok on dlopenned libs) 2020-06-20 09:28:28 +02:00
ptitSeb 42176b6593 Added a few dbus and gtk wrapped functions 2020-06-19 21:05:10 +02:00
ptitSeb a320528e64 Added some workaround for g_threads_got_initialized 2020-06-19 20:13:26 +02:00
ptitSeb 69a9175c67 Small changes to atfork handling 2020-06-19 18:55:01 +02:00
ptitSeb 9fdc3196d9 Fixed loaing of dependant libs of a local lib 2020-06-19 17:12:36 +02:00
ptitSeb 0b271fc44f Added PltResolver, so JmpSlot symbols are resolved at runtime now 2020-06-19 16:26:21 +02:00
ptitSeb 0fa2f7b8f1 Added one wrapped function to FontConfig 2020-06-18 22:30:44 +02:00
ptitSeb 41c775fb44 Fixed a warning 2020-06-18 22:10:31 +02:00
ptitSeb 28b06f45fe Fixed R_386_TLS_TPOFF relocation (fixed libtcmalloc_minimal.so.4 loading) 2020-06-18 22:06:28 +02:00
ptitSeb 083b3d2a1c Improved vfprintf trace 2020-06-18 22:05:51 +02:00
ptitSeb 61866f6dae [DYNAREC] Made the printing of a segfault a permanent printf for now 2020-06-18 22:05:34 +02:00
ptitSeb 39d7274359 Changed BOX86 load address to a low address 2020-06-18 22:04:46 +02:00
ptitSeb a9b4d994eb [DYNAREC] Added F3 0F 1E and F3 0F 1F multibte NOP, also used a ENDBR opcode 2020-06-18 08:46:55 +02:00
ptitSeb 3701dcd0b4 Added F3 0F 1E and F3 0F 1F multibte NOP, also used a ENDBR opcode 2020-06-18 08:46:18 +02:00
ptitSeb efe2588fd9 Added__libc_dlXXX wrapped function 2020-06-18 08:45:10 +02:00
ptitSeb 3c17d886cc Added many libcrypto and libSSL wrapped functions (and now Minit runs) 2020-06-17 18:51:21 +02:00
ptitSeb 83fe3605f6 Merge pull request #129 from rajdakin/fixes
Fixed ARMS (ARM shifted) instruction category
2020-06-17 12:08:52 +02:00
rajdakin dec474953b [DYNAREC] Ran the printer generator 2020-06-17 11:50:08 +02:00
rajdakin f80964d8d7 [DYNAREC] Fixed ARMS (ARM shifted) instruction category 2020-06-17 11:41:09 +02:00
ptitSeb a43687ee30 Change how symbol are fetched in Elf Relocate mecanism (hacky and probably wrong, but seems to work pretty well) 2020-06-17 00:07:26 +02:00
ptitSeb e04233a897 Some debugging helper 2020-06-16 18:22:21 +02:00
ptitSeb 93cd9b00bd [DYNAREC] Made x86emu_t structure up-to-date when calling arm_linker 2020-06-16 18:21:59 +02:00
ptitSeb 3a592ca9c4 [DYNAREC] Added a special case on 'read' wrapped function when reading on a write protected block (because it's an executable one) 2020-06-16 18:18:48 +02:00
ptitSeb 555d0d51b0 CPUID detection actualy need this bit to be changeable, not fixed 2020-06-16 18:10:53 +02:00
ptitSeb a70f29a8c9 Merge pull request #128 from rajdakin/fixesARMs
Fixed the ARMs and ARM$ instructions type for the printer
2020-06-16 11:36:37 +02:00
ptitSeb dad53a84c8 Merge pull request #127 from rajdakin/fixes
Fixed the U/SXT* opcodes print (and probably others too)
2020-06-16 11:35:56 +02:00
rajdakin d03b21ee19 [DYNAREC] Fixed the ARMs and ARM$ instructions type for the printer 2020-06-16 11:34:50 +02:00
rajdakin 1a1bf5f76a [DYNAREC] Oops, fixed the fix that removes rbrackets of reglists 2020-06-16 11:28:27 +02:00
rajdakin 0ebc0f19b8 [DYNAREC] Fixed the U/SXT* opcodes print (and probably others too) 2020-06-16 11:23:25 +02:00
ptitSeb d4cfa94aaa Merge pull request #126 from M-HT/old_glibc
Allow compilation with older version of glibc
2020-06-16 07:58:20 +02:00
M-HT 383d4c8f9a Allow compilation with older version of glibc 2020-06-16 07:35:33 +02:00
ptitSeb 48b187edd1 [DYNAREC] Don't create a son at the 1st instruction 2020-06-15 18:15:48 +02:00
ptitSeb 316e18f8c5 The syscall 254 sys_epoll_create use a flags parameter that need transform... 2020-06-15 17:59:07 +02:00
ptitSeb 657595d363 Rollback: don't ignore unsupported Int 2020-06-15 17:59:07 +02:00
ptitSeb 9cd9ad16b2 Some fixes t DBUS wrapped lib 2020-06-15 16:50:33 +02:00
ptitSeb 7d49d0fc8a Complete handling of LOCAL/GLOBAL on glopen wrapped function 2020-06-15 16:25:38 +02:00
ptitSeb fa9bdbfd64 Added a few more syscall 2020-06-15 16:23:45 +02:00
ptitSeb 558dc58a52 Don't stop on unknown interrupt, just skip it 2020-06-15 16:23:15 +02:00
ptitSeb 383b1afe0b Try to handle LOCAL/GLOBAL on dlopen wrapped function 2020-06-14 22:32:11 +02:00
ptitSeb 3d757a2af6 Merge pull request #124 from M-HT/fix_64bit_inodes
Fix 64bit inodes in readdir and readdir_r functions
2020-06-14 13:49:31 +02:00
M-HT 2cb20b665d Fix 64bit inodes in readdir and readdir_r functions 2020-06-14 13:16:57 +02:00
ptitSeb eadb36bcdd Merge pull request #123 from M-HT/fix_64bit_inodes
Add option to fix 64bit inodes
2020-06-13 23:27:23 +02:00
M-HT a3bbaeb11b Add option to fix 64bit inodes 2020-06-13 23:03:30 +02:00
ptitSeb 816ee7e23b Fixed last commit 2020-06-10 21:54:45 +02:00
ptitSeb 2a10da129e [TRACE] Allow tracing function in the Init part of a dlopen lib 2020-06-10 18:58:10 +02:00
ptitSeb 9784c3bf2d Compensate for bad lib dependacie in libmss.so.6 (fixes #121 Neverwinter Night Diamond Edition) 2020-06-07 22:40:18 +02:00
ptitSeb f64a7e2c5b Added some png12 and libc wrapped functions 2020-06-07 18:17:54 +02:00
ptitSeb f01359a62e Added some pango wrapped functions 2020-06-07 17:26:57 +02:00
ptitSeb 729f392148 Added a large batch of cairo wrapped functions 2020-06-07 17:20:11 +02:00
ptitSeb e48802c898 Added a dbus wrapped function 2020-06-07 16:42:32 +02:00
ptitSeb 34ed9f03e1 Added cairo_pango wrapped functions 2020-06-07 15:54:25 +02:00
ptitSeb 4990b6db94 Added some FreeType wrapped functions 2020-06-07 15:54:25 +02:00
ptitSeb ecf50c8181 Added 2 wrapped functions to libfontconfig 2020-06-07 15:54:25 +02:00
ptitSeb 927159011c Some small fixes to cpuinfo file creation 2020-06-07 13:46:31 +02:00
ptitSeb 640db5e667 Added some cairo wrapped functions 2020-06-07 13:18:05 +02:00
ptitSeb 509f09dfbc Refined gdk_display hack 2020-06-07 13:07:40 +02:00
ptitSeb 4f42ae0d81 Added a few libm wrapped functions 2020-06-07 12:44:18 +02:00
ptitSeb 1b4391ac23 Added some DBus wrapped functions 2020-06-07 12:39:39 +02:00
ptitSeb 5cb6894657 Added a workaround, again, for gdk_display symbol 2020-06-07 12:14:39 +02:00
ptitSeb be66c8bffa Create a fake /proc/cpuinfo instead of opening the real one 2020-06-07 11:48:37 +02:00
ptitSeb 5f71bcfe9a Slight change in elfloader 2020-06-06 11:10:53 +02:00
ptitSeb 95d786e9a8 Added a special case for libSgGL to load libGL as needed (fixes Hotline Miami) 2020-06-06 11:08:52 +02:00
ptitSeb 8b5e977868 Improved wrapping of curl (and now UrbanTerror download maps) 2020-06-05 17:20:51 +02:00
ptitSeb 49a631b475 Forgot a debug printf in mmap 2020-06-05 16:26:53 +02:00
ptitSeb 8b98a68d1a Update README with latest improvments 2020-06-05 11:42:31 +02:00
ptitSeb c03e46814b [BOX86LIB] Some slight adjustments for box86 as a lib 2020-06-05 11:41:58 +02:00
ptitSeb 7efac81f8b Force RelWithDebInfo build type if none was specified 2020-06-05 08:28:34 +02:00
ptitSeb 58e98e9580 [DYNAREC] Change a message log level, so it's less alarming 2020-06-04 17:58:53 +02:00
ptitSeb 56c211fbeb Added a few libpng12 wrapped function (fixed old FTL 1.5.13) 2020-06-04 17:23:18 +02:00
ptitSeb 2aa2e53fef [DYNAREC] Use a mecanism with Memory Protection to handle JIT'd code (good improvment in speed for Unity games at least) 2020-06-04 16:56:00 +02:00
ptitSeb 3993c88fbb Simplified Lib/Elf loading process (hopefully fixing some bugs in the process) 2020-06-03 19:53:17 +02:00
ptitSeb f706e7eecc Added a few __libc_XXXX wrapped function 2020-06-03 18:54:36 +02:00
ptitSeb 549de25a49 Improved trace a bit (lib name added in front of function name) 2020-06-03 18:54:14 +02:00
ptitSeb 217b05fb80 Small change to Interpretor in non-trace build 2020-06-03 18:53:14 +02:00
ptitSeb e1b9d40ca6 Fixed TRACE build 2020-06-03 17:50:41 +02:00
ptitSeb 0eeba809f2 Added one GS:ADD and one GS:ADC opcode (fixes Arma3 DS, #120, but it crashes after loading everything) 2020-06-03 16:29:59 +02:00
ptitSeb 4a0df1042d Fixed 'Unimplemented Opcode' message that would crash without showing in certain cases on no trace build (mainly with Dynarec) 2020-06-03 16:18:00 +02:00
ptitSeb e7a4274511 [DYNAREC] Try to avoid to keep a reference of a block that will potentially get removed 2020-06-02 16:36:36 +02:00
ptitSeb b3def68a4f Added Logo and Icon from @grayduck 2020-06-01 21:50:16 +02:00
ptitSeb 3c67de08a3 [DYNAREC] Create a temp variable there, that seems more safe 2020-06-01 21:49:27 +02:00
ptitSeb cec67ef3e3 Fixed the TRACE that was broken since last refactor 2020-06-01 17:37:04 +02:00
ptitSeb 881501b278 Fixed issue with glDebugMessageCallbackARB (now 140 run with mesa) 2020-06-01 12:12:18 +02:00
ptitSeb d09a949755 Fixed PREFETCH opcode (especially for the Interpretor) 2020-06-01 11:42:27 +02:00
ptitSeb bf6fa0f335 Added sbrk and brk functions to wrapped libc 2020-05-31 09:28:40 +02:00
ptitSeb 9dcfa322a5 Added SDL_Sem function to wrapped SDL2 2020-05-30 18:15:46 +02:00
ptitSeb a1c21ce05f [DYNAREC] More improvements to FreeDynablock 2020-05-30 09:59:28 +02:00
ptitSeb 22be56179d [DYNAREC] Improved FreeDynablock function 2020-05-29 20:16:58 +02:00
ptitSeb 24da6fcb3b [DYNAREC] Add dest reference in table only when dest as a mark set 2020-05-28 21:48:15 +02:00
ptitSeb 8078b27172 [DYNAREC] Chnage DBGetBlock to forget current block if it gets removed 2020-05-27 21:21:22 +02:00
ptitSeb 89d1254106 [DYNAREC] Added 66 F3 variant for REP MOVSW and REP STOSW 2020-05-27 14:16:32 +02:00
ptitSeb 497f66f5dc Fix for previous fix, for some (not so?) rare cases 2020-05-26 19:37:30 +02:00
ptitSeb a321d54142 Fix a small issue when detecting owner of some memory 2020-05-26 18:49:45 +02:00
ptitSeb 8495b461b8 [DYNAREC] Added protect/unprotect of an address range (will be used later) 2020-05-24 18:35:21 +02:00
ptitSeb 35d6354898 [DYNAREC] Detect PageSize (will be used later) 2020-05-24 17:57:30 +02:00
ptitSeb a2b4af137c Update README.md 2020-05-23 21:03:09 +02:00
ptitSeb 756d1c12fd Update README.md 2020-05-23 21:01:46 +02:00
ptitSeb 63f2e52edb Merge branch 'master' of https://github.com/ptitSeb/box86 2020-05-21 13:54:37 +02:00
ptitSeb fd704eca00 Remove the creation of x86emu_t structure from the stack when using RunFunction, use the thread local onee now 2020-05-20 20:42:38 +02:00
ptitSeb 8c233f1861 Removed emu from context structure, and made a per thread one 2020-05-20 19:01:22 +02:00
ptitSeb 669bb00590 Added libudev.so.1 wrapped lib (straight copy of libudev.so.0 for now) 2020-05-18 10:54:01 +02:00
ptitSeb 815fd918cb Fixed non-dynarec build (#116) 2020-05-15 13:09:47 +02:00
ptitSeb 4249adbe4e Update COMPILE.md 2020-05-14 08:49:00 +02:00
ptitSeb 1aec17da4d Update COMPILE.md 2020-05-14 08:45:59 +02:00
ptitSeb 3680a3092e [DYNAREC] Made FillBlock candidate for threading 2020-05-13 16:47:52 +02:00
ptitSeb b11a269867 [DYNAREC] Fixed TRACE build 2020-05-13 14:52:26 +02:00
ptitSeb cccbf75878 Simplified some function, removing the x86emu_t* argument 2020-05-13 13:17:03 +02:00
ptitSeb 5ce309e64b [DYNAREC] 66 0F D6 MOVQ can be unaligned... (should help #115) 2020-05-12 22:08:11 +02:00
ptitSeb 4b48a43413 Removed a small warning in new pthread_cond handling 2020-05-12 16:08:35 +02:00
ptitSeb a05df24c8b Changed, again, how phtread_conditions are handled 2020-05-12 16:06:59 +02:00
ptitSeb 4f599b521a Improved a bit the handling of thread conditions 2020-05-12 11:13:02 +02:00
ptitSeb 44cf2fc4fb [DYNAREC] Removed some warning 2020-05-12 11:12:30 +02:00
ptitSeb 0ca9f70796 [DYNAREC] Add father/son notion in dynablock, to allow branging in the middle of a dynablock (and avoid generating a new one) 2020-05-11 19:54:54 +02:00
ptitSeb 83cb2dbc4d [DYNAREC] Added mecanism to allow liner with volite code blocks 2020-05-11 08:54:39 +02:00
ptitSeb b09937ad3d [DYAREC] Added a few more NOP variant 2020-05-10 16:21:08 +02:00
ptitSeb c88d5d462c Use another method to handle errors in wrapped libjpeg 2020-05-10 13:12:18 +02:00
ptitSeb 78c971cb87 Added a few more SDL2 wrapped functions 2020-05-09 10:39:59 +02:00
ptitSeb 1bafddcfe2 Rewrapped some non-64 libc functions, to avoid mixing with 64 bits on some plateforms (fixes Saves of IcewindDale on Pi4) 2020-05-08 22:20:53 +02:00
ptitSeb 047b2071f5 [BOX86LIB] Added some libs to the linking of libbox86.so 2020-05-07 20:15:25 +02:00
ptitSeb 8aca039ca6 Added some old and rarely used opcode (helps ZeldaClassic) 2020-05-07 11:50:49 +02:00
ptitSeb db8c6b0c9e Fixed build with cmake less than 3.13.5 (fix for #112) 2020-05-06 20:49:32 +02:00
ptitSeb dbc6aa83f3 Merge pull request #111 from rajdakin/cmake-fix
Fix configuration on older CMake
2020-05-06 20:03:06 +02:00
rajdakin 08472aa68b [CMake] Fix configuration on older CMake 2020-05-06 19:59:57 +02:00
ptitSeb 3010068660 Try a fix on Python finding with old cmake (should fix #110) 2020-05-06 19:28:22 +02:00
ptitSeb 5e2faff01d [DYNAREC] Small changes 2020-05-06 19:12:49 +02:00
ptitSeb 598338809f Take LD_PRELOAD into account if BOX86_LD_PRELOAD is not present 2020-05-06 19:12:11 +02:00
ptitSeb 4778760622 [DYNAREC] Improved handling of JIT'd code by marking potentialy changed block as dirty instead of purging the whole block 2020-05-06 16:41:59 +02:00
ptitSeb 3a23cc42f6 Small cosmetic changes 2020-05-06 14:16:56 +02:00
ptitSeb e23283e794 [BOX86LIB] Improved the Build as a lib version, and introduced build as dynamic lib 2020-05-06 14:09:56 +02:00
ptitSeb 4d730a31c4 Merge pull request #109 from icecream95/posix_spawn
Wrap some posix_spawn functions
2020-05-06 07:37:02 +02:00
ptitSeb 216b6407f3 Merge pull request #108 from rajdakin/reprinter
Printer automation
2020-05-05 20:38:11 +02:00
rajdakin e95988f402 [DYNAREC] Forgot to increase the version number 2020-05-05 19:32:40 +02:00
rajdakin 1ce3731d7d [DYNAREC] Refactored the printer generator (8) 2020-05-05 19:27:32 +02:00
rajdakin 7420d3c8de [DYNAREC] Refactored the printer generator (7) 2020-05-05 19:27:32 +02:00
rajdakin f1edcc06d3 [DYNAREC] Refactored the printer generator (6) 2020-05-05 19:27:32 +02:00
rajdakin ce5c3db346 [DYNAREC] Refactored the printer generator (5) 2020-05-05 19:27:32 +02:00
rajdakin cc0b7b3719 [DYNAREC] Refactored the printer generator (4) + major bug fix 2020-05-05 19:27:32 +02:00
rajdakin 7854fa2e18 [DYNAREC] Removed WIP spacing 2020-05-05 19:27:32 +02:00
rajdakin 1b7bc825d5 [DYNAREC] Refactored the printer generator (3) 2020-05-05 19:27:32 +02:00
rajdakin e65f58acb2 [DYNAREC] Refactored the printer generator (2) 2020-05-05 19:27:32 +02:00
rajdakin 18fe17dc2d [DYNAREC] Refactored the printer generator (1) 2020-05-05 19:27:32 +02:00
rajdakin 8098461e0f [DYNAREC] Changed a little how the printer generator works 2020-05-05 19:27:32 +02:00
rajdakin bf8e9f9242 [DYNAREC] Added an ARM instructions printer generator 2020-05-05 19:27:32 +02:00
rajdakin 4838067440 [WRAPPERS] Rewrote the wrappers generator a bit 2020-05-05 19:27:32 +02:00
rajdakin 53a080e32e [CMake] Cleanup the CMakeLists.txt file a bit 2020-05-05 19:27:32 +02:00
rajdakin 3ac41770b8 [CMake] Force the use of Python3 2020-05-05 19:27:32 +02:00
ptitSeb 6fe51fd7f4 [DYNAREC] Finaly found why Unreal crashes when CPUID detection was enabled: linfmod use some SMC, that's bad. So found some workaround 2020-05-05 17:16:46 +02:00
ptitSeb a6cbe15b5e [DYNAREC] Some small optim on 32bits float access 2020-05-05 17:15:33 +02:00
ptitSeb 3313eba45c [DYNAREC] When using BOX86_DYNAREC_DUMP, use some mutexes to avoid mixing block in dump 2020-05-05 17:14:04 +02:00
Icecream95 b01150f707 Wrap some posix_spawn functions 2020-05-05 14:13:52 +12:00
ptitSeb 4502948f89 Changed a bit the thread creation / cancellation, and associted mutex 2020-05-04 22:47:37 +02:00
ptitSeb 8cb2ffbd2e Added some crude (maybe incorrect?) workaround for function with 0 size in elf header (fixed some libfmod function, somehow) 2020-05-04 15:45:34 +02:00
ptitSeb be80cb03d6 Changed how Trace ona Function works, so it can works on defered (dlopen'd) library 2020-05-04 15:44:43 +02:00
ptitSeb 13d6e96cdc Set trace begin/end as global 2020-05-04 14:04:18 +02:00
ptitSeb 9f280b1f9c Set CPU Family to 6 (instead of 1) in CPUID 2020-05-03 18:53:43 +02:00
ptitSeb 786dfa6700 [DYNAREC] Small optimization on x87 Stack sync 2020-05-03 18:52:36 +02:00
ptitSeb e260aee2e6 [DYNAREC] Use NOP instead of B to ext instruction 2020-05-03 18:51:59 +02:00
ptitSeb 504c27c934 [DYNAREC], Nope, that Unreal bug is still not fixed, not enable CPUID detection yet 2020-05-03 18:51:25 +02:00
ptitSeb c4ba481561 In trace, function name with 0 sized are like infinite size 2020-05-03 18:48:43 +02:00
ptitSeb 841770aed1 [DYNAREC] Small dump improvment 2020-05-03 18:48:01 +02:00
ptitSeb 1a4643f3a2 [DYNAREC] Small improvment on x87 cache access 2020-05-03 12:56:17 +02:00
ptitSeb e89702d99d [DYNAREC] Fixed printer for rotated immadiate 2020-05-03 12:55:46 +02:00
ptitSeb 250e3820df [DYNAREC] Small fixe to the printer to get more printed opcodes in dumps 2020-05-03 11:14:36 +02:00
ptitSeb 8b2a509a32 [DYNAREC] A bit more color in dump 2020-05-02 19:48:31 +02:00
ptitSeb 6db92c56b9 [DYNAREC] Some trace improvments 2020-05-02 19:17:44 +02:00
ptitSeb e4914a2139 Rollback CPUID detection code until I found why Unreal crashes with it 2020-05-01 21:42:18 +02:00
ptitSeb 704c4b36ab Added support for CPUID detection in PUSHF/POPF 2020-05-01 09:32:47 +02:00
ptitSeb b9d61108bf Added a few wrapped function (should help X3) 2020-05-01 09:01:56 +02:00
ptitSeb e92d2f737b Small thread improvment 2020-04-30 21:10:10 +02:00
ptitSeb 6ec36072c4 A bit more wrapped libz functions 2020-04-30 15:06:00 +02:00
ptitSeb ab18d4d23a [DYNAREC] Fix build for non-trace enabled build (fix #105) 2020-04-30 14:01:28 +02:00
ptitSeb 1e6893a9d9 [DYNAREC] Added a few more opcodes (Int3 and FXSAVE/FXRSTOR) 2020-04-30 11:08:34 +02:00
ptitSeb 01bcc957e8 Added PSUBB opcode (should help 'The Journey Down Chapter One') 2020-04-29 14:44:39 +02:00
ptitSeb 3c989cfa04 Removed that yield in cond_broadcast, useless, and probably harming the performances 2020-04-28 18:55:18 +02:00
ptitSeb bde29ef155 Fixed some libz wrapped functions (fixed AM2R) 2020-04-28 18:41:23 +02:00
ptitSeb cee4cd26e0 [DYNAREC] Don't use x1, x2 or x3 scratch before use READFLAGS, also fixed the the bordercase fix call/ret optim (all this fixed zsnes and starfox) 2020-04-28 17:42:57 +02:00
ptitSeb f774b88211 [DYNAREC] Fixed PUSHAD/POPAD opcode, also small fix on border case for Call/Ret optimisation 2020-04-28 17:42:57 +02:00
ptitSeb 251f9b7338 Update README.md 2020-04-27 10:24:17 +02:00
ptitSeb dd5fc10a95 [DYNAREC] Optimised CALL/RET by using a local stack in x6emu_t struct (large improvment in some game, but doesn't help ShovelKnight) 2020-04-26 22:39:40 +02:00
ptitSeb 5e84efc542 Remove test on x87 stack status 2020-04-26 15:15:25 +02:00
ptitSeb b29fd4abbd [DYNAREC] Added missing change from previous commit 2020-04-26 15:15:03 +02:00
ptitSeb 1c6f2254f3 [DYNAREC] Store current block in table linker, to help find next block 2020-04-25 15:14:23 +02:00
ptitSeb 73685273f4 Added wrapped libdrm (almost empty) 2020-04-24 19:26:59 +02:00
ptitSeb 76d070777f Added a few wrapped functions to xcb, fontconfig and freetype 2020-04-24 17:23:21 +02:00
ptitSeb 42d18f7302 Added libstdc++.so.5 (along with the .6) in x86libs (usefull in some older games) 2020-04-24 16:15:25 +02:00
ptitSeb 963a7a527a On system where getrandom syscall is not supported, read /dev/urandom and not /dev/random 2020-04-24 12:02:05 +02:00
ptitSeb df61ed3048 [DYNAREC] Fixed potential issue when an opcode is not handled by the dynarec (fixed TeamSpeak3, for good) 2020-04-24 12:01:16 +02:00
ptitSeb 2a8e6061a2 Added BOX86_NOSIGILL 2020-04-24 11:11:22 +02:00
ptitSeb 96c4fe7057 Some changes in signal hanbdling (not sure it's a good idea) 2020-04-24 10:51:11 +02:00
ptitSeb 124df9ae83 Also add my_getrandom fallback to wrapped libc syscall 2020-04-24 08:30:49 +02:00
ptitSeb 62b2eecf6e Some system (like the Pandora) don't have the getrandom syscall 2020-04-24 08:26:29 +02:00
ptitSeb 9fb6b7bbd9 Use align on come fctnl function (fixes TeamSpeak3 server) 2020-04-23 22:27:15 +02:00
ptitSeb 0ac7929230 Added syscall 355 2020-04-23 21:39:38 +02:00
ptitSeb d16e8f1c51 Added some aio_*64 wrapped function to librt 2020-04-23 21:30:39 +02:00
ptitSeb 4b59f04930 Small fixes to some gobject signals 2020-04-23 16:06:12 +02:00
ptitSeb 7a375136cc Cosmetics in myalign.c 2020-04-23 16:05:49 +02:00
ptitSeb 62a328af45 Go back to using SharedCallback for qsort and qsort_r (should be faster and more reliable) 2020-04-23 08:37:42 +02:00
ptitSeb aafe35dca7 Changed how MMAP memory is alloced/freed 2020-04-22 14:40:27 +02:00
ptitSeb c73b728255 More cosmetic changes 2020-04-22 14:40:01 +02:00
ptitSeb 1186072e48 Added a sched_yield before cond_brodcast, just in case Dynarec is building a block with a cond_wait inside (to be tested) 2020-04-22 14:38:42 +02:00
ptitSeb 141de19804 Misc cosmetic changes 2020-04-22 14:37:41 +02:00
ptitSeb 97d71dfe09 [DYNAREC] Fixed some printer issues 2020-04-22 14:32:30 +02:00
ptitSeb f05b4fa7ff Some small changes to pthread_register_cancel, again, to hopefully have something working 100% 2020-04-21 19:34:37 +02:00
ptitSeb 2f36ec82f9 Made my_context global, plus some warning hunting... 2020-04-21 15:12:29 +02:00
ptitSeb c386a0a356 [DYNAREC] Warning hunt... 2020-04-21 15:11:57 +02:00
ptitSeb 4ba1f972b5 [DYNAREC] Fixed some emiter (missing parenthesis) 2020-04-21 13:50:08 +02:00
ptitSeb 525eb10854 [DYNAREC] Ooops, fixed ROR Ed, Ib opcode 2020-04-20 18:36:16 +02:00
ptitSeb 7176b08882 Fixed some potentiel memory overwrite (should help #102) 2020-04-20 16:57:32 +02:00
ptitSeb a6f4248502 [DYNAREC] Added complete emiter for ror32c 2020-04-20 12:18:14 +02:00
ptitSeb f0da6dd64f [DYNAREC] Added complete emiter for rol32c 2020-04-20 11:31:03 +02:00
ptitSeb af3c9042c3 Disabling that pthread_cancel test, box86 is still too unstable on that it seems 2020-04-19 21:38:40 +02:00
ptitSeb d8aa65bc17 Update README.md 2020-04-19 19:40:27 +02:00
ptitSeb da6ab3f752 Update README.md 2020-04-19 19:39:33 +02:00
ptitSeb 3cdf7fe742 Update README.md 2020-04-19 19:38:38 +02:00
ptitSeb cb54d7e343 Update README.md 2020-04-19 19:38:02 +02:00
ptitSeb 60611e54f3 [RPI] Call sanitize_mojosetup_gtk_background also on uninstall, to avoid extreme sluginess of the GUI 2020-04-19 19:33:17 +02:00
ptitSeb a4a78681ef More improvement to pthread_register_cancel handling 2020-04-19 17:56:15 +02:00
ptitSeb 4d85147077 Fixed a mamory averwriting issue 2020-04-19 17:55:27 +02:00
ptitSeb 857048f47c Small change in the init phase 2020-04-19 17:19:15 +02:00
ptitSeb 6084102d20 More improvement to thread_cancel_register mecanism 2020-04-19 16:52:31 +02:00
ptitSeb 2dc1fcc875 Improved handling of __pthread_register_cancel (and add a unit test about that) 2020-04-19 15:58:54 +02:00
ptitSeb 584479c10d Move around a bit thread helper initialization 2020-04-19 15:39:35 +02:00
ptitSeb 3430550dac Some attempt to improve __pthread_cancel_(un)register wrapped functions 2020-04-19 13:33:19 +02:00
ptitSeb 81f5bc79aa Various improvement to thread handling (should solve some memory issue when a lot of thread are created) 2020-04-19 13:33:19 +02:00
ptitSeb e20ccb7991 More changes to exec (now steam can start some game directly) 2020-04-19 13:33:19 +02:00
ptitSeb 5cf4af83b0 Update README.md 2020-04-18 15:42:47 +02:00
ptitSeb e5cb34d1f8 Update FUNDING.yml 2020-04-18 15:41:55 +02:00
ptitSeb 91c46f99a0 Update FUNDING.yml 2020-04-18 15:38:50 +02:00
ptitSeb dbdcaf8962 Create FUNDING.yml 2020-04-18 15:38:08 +02:00
ptitSeb 230d6246c6 Fixed a warning from previous commit 2020-04-18 15:32:20 +02:00
ptitSeb 066e5f966a Simplified some phtread wrapped functions 2020-04-18 15:24:16 +02:00
ptitSeb ff615cba03 Added preliminary FS: support 2020-04-18 15:06:08 +02:00
ptitSeb 631fa0f536 Move box86 on top of user memory (help Witcher 2, but not enough, as it use FS:) 2020-04-18 14:35:50 +02:00
ptitSeb ce2eb76703 Small changes in sem_open and set priority on threads 2020-04-18 10:56:15 +02:00
ptitSeb 9422039e09 Added IMG_LoadTexture and friend wrapped funcito to sdl2image 2020-04-17 22:24:47 +02:00
ptitSeb 0f13eb8611 More log for exev* wrapped functions 2020-04-17 21:49:59 +02:00
ptitSeb 196394f666 Added dummy syscall 243 (need work for a proper implementation 2020-04-17 21:49:21 +02:00
ptitSeb 9b2f7029df Improved elfloader to support elf with 'fragmented' memory map 2020-04-17 15:48:35 +02:00
ptitSeb a2e6b57c35 Simplified handling of exevl* 2020-04-17 14:02:24 +02:00
ptitSeb e5fdb4ba85 [DYNAREC] Added complete emiter for sar32c 2020-04-17 14:02:03 +02:00
ptitSeb 0c83522296 [DYNAREC] Fixed needed_flags function 2020-04-16 19:23:54 +02:00
ptitSeb f59e30442a Proprer support for timer_create with notify to SIGEV_THREAD 2020-04-16 17:40:00 +02:00
ptitSeb b67b750009 [DYNAREC] Added shr32c complete emiter 2020-04-16 15:41:02 +02:00
ptitSeb 61f2a43628 [DYNAREC] Reduce the recursivity of needed_flags function 2020-04-16 12:09:08 +02:00
ptitSeb 769545ccd7 Add proper support for RPATH with 2020-04-16 11:15:46 +02:00
ptitSeb c0b9272b82 Fixed ODroid and GameShell profile help that were mixed up 2020-04-16 09:30:40 +02:00
ptitSeb d5e5cbb393 Added ODROID profile 2020-04-16 07:52:09 +02:00
ptitSeb d8251ec441 Fix link on non-dynarec build 2020-04-16 07:40:47 +02:00
ptitSeb 0a04ef44d4 [DYNAREC] Fix issue when code use lots of FPU code with a few jump (i.e. x87 with loops), on dynarec pass 1 (helps Hotline Miami, and probably others) 2020-04-15 22:25:50 +02:00
ptitSeb 79ada49fdc Added some workaround to get steam somehow running 2020-04-15 21:36:08 +02:00
ptitSeb 1bf134c3ef Fixed interpretor for PALIGNR SSSE3 opcode 2020-04-15 16:54:56 +02:00
ptitSeb 38098290b7 [DYNAREC] Fixed psrlw and psraw opcode 2020-04-15 15:49:46 +02:00
ptitSeb b66c95d920 [DYNAREC] Added neg8 complete emiter 2020-04-15 15:42:35 +02:00
ptitSeb 25ae0f9311 [DYNAREC] Added neg16 complete emiter 2020-04-15 13:04:08 +02:00
ptitSeb f63799ecbb [DYNAREC] Small fixes to NEG and XADD opcodes 2020-04-15 12:03:25 +02:00
ptitSeb f2de080c68 [DYNAREC] Added shl32c complete emiter 2020-04-15 11:28:22 +02:00
ptitSeb 4ceaa7bd4b More workround on fcntl F_SETFL 2020-04-15 11:20:02 +02:00
ptitSeb 5753983f41 Fixed fctnl and fcntl64 wrapped function that weren't converting some parameter (should help OSS game, among other things) 2020-04-15 08:40:16 +02:00
ptitSeb 58768ca886 Merge pull request #97 from PokeEngineer/master
Include sysmacros.h in elfloader.c
2020-04-15 07:38:40 +02:00
Jacob Mullins d3d740c38f Included sysmacros.h
Some compilers (like the one on the GameShell) need this to be included or you get undefined references to "major," "minor," and "makedev."
2020-04-15 00:43:57 -04:00
ptitSeb 27f99bd3c0 Added some basic /proc/self/maps emulation (missing heap, stack and loaded lib) 2020-04-14 20:18:22 +02:00
ptitSeb 230fa96d2b Added basic support for RPATH 2020-04-14 14:27:08 +02:00
ptitSeb 1e7f5692ce Added syscall 266 2020-04-13 10:41:40 +02:00
ptitSeb af884e427d [DYNAREC] Added PSRAW/PSRAD/PRSRLW/PSRLD opcodes 2020-04-12 10:53:58 +02:00
ptitSeb 00b2002855 Added PAVGB and PAVGW SSE2 opcodes (also in DYNAREC) 2020-04-12 10:10:47 +02:00
ptitSeb e5d20ea8ae [DYNAREC] Fixed isue with CLC and STC opcodes 2020-04-12 09:37:01 +02:00
ptitSeb 3b4ca235d5 [DYNAREC] Added neg32 complete emiter with flags 2020-04-11 18:37:40 +02:00
ptitSeb 8633aca6fa Fixes isNativeCall (help FTL) 2020-04-11 18:17:14 +02:00
ptitSeb 85dde4b9d0 [DYNAREC] Assorted bugfixes (but still an issue in zsnes somewhere) 2020-04-11 15:30:58 +02:00
ptitSeb 43e981579f [DYNAREC] Added sbb8 and sbb16 complete emiter with flags 2020-04-10 10:44:31 +02:00
ptitSeb f12706599e [DYNAREC] Added sbb32 complete emiter with flags 2020-04-10 09:57:58 +02:00
ptitSeb 650668eaf7 [DYNAREC] Added adc16 complete emiter with flags 2020-04-10 08:41:43 +02:00
ptitSeb 6093589e41 [DYNAREC] Added adc8 complete emiter with flags 2020-04-09 23:38:37 +02:00
ptitSeb ce777c9393 [DYNAREC] Added complete emiter with flags for adc32 2020-04-09 22:55:50 +02:00
ptitSeb 983523c2f6 [DYNAREC] Inc/Dec doesn't change CC, plus many fixes on emiter with flags... 2020-04-09 20:02:47 +02:00
ptitSeb 8f5843e0fe [DYNAREC] Added or16/xor16/and16 and use the emiters 2020-04-09 18:24:09 +02:00
ptitSeb 98b0602ae5 [DYNAREC] Added complete emiter for sub16, and converted SUB and INC/DEC 16 opcodes 2020-04-09 17:06:10 +02:00
ptitSeb 0286e8362e [DYNAREC] Use emit_add8/32 and emit_sub8/32 for inc/dec opcodes 2020-04-09 16:20:38 +02:00
ptitSeb bcfc464f24 [DYNAREC] Fixed add8/sub8 and added complete emiter with flags for add16 2020-04-09 14:51:42 +02:00
ptitSeb 7a9e9df3c0 [DYNAREC] Added complete emiter with flags for or8, xor8 and and8 2020-04-09 11:49:28 +02:00
ptitSeb 829bf941f4 [DYNAREC] Added complete emiter for sub8 opcodes 2020-04-09 10:48:26 +02:00
ptitSeb 3e42161c35 [DYNAREC] Also use emit_addXX on XADD opcodes 2020-04-09 10:47:54 +02:00
ptitSeb 9cdaa5e028 [DYNAREC] Fixed some logic complete emiter (with constant) 2020-04-09 08:02:35 +02:00
ptitSeb 34ef7b9b79 [DYNAREC] Added more complete emiter, plus some reorganisation of sources 2020-04-08 21:59:56 +02:00
ptitSeb 201677899b [DYNAREC] Created emiter (with flags) for add32 and sub32 2020-04-08 18:56:00 +02:00
ptitSeb fd563c5b4b [DYNAREC] Fun with flags: improved Carry flag handling 2020-04-07 17:50:15 +02:00
ptitSeb d5b5031f5c [DYNAREC] Fun with flags: added the X_PEND flags to calculate flags + setting defered 2020-04-07 17:40:32 +02:00
ptitSeb 08f2fcd1b9 [DYNAREC] Fun with flags: done all test emiter too. 2020-04-06 16:38:45 +02:00
ptitSeb f7da6bc070 [DYNAREC] Fun with flags: Continue adding all cmp emiter, plus some bug fixes 2020-04-06 16:02:31 +02:00
ptitSeb 1414fed3b2 [DYNAREC] Added optionnal Coloring to Dump 2020-04-06 16:01:36 +02:00
ptitSeb 13ff5c80be [DYNAREC] Fun with flags: Optimized cmp16_0 emiter 2020-04-05 21:17:29 +02:00
ptitSeb 782dd645c3 [DYNAREC] Fun with flags: Optimized cmp16 emiter 2020-04-05 21:13:47 +02:00
ptitSeb 020bcd46c2 [DYNAREC] Fun with flags: Optimized cmp32_0 emiter 2020-04-05 21:08:02 +02:00
ptitSeb fefb01f930 [DYNAREC] Func with flags: optimzed cmp32 emiter 2020-04-05 21:02:38 +02:00
ptitSeb 6489a2ca3b [DYNAREC] Fun with flags: fixed a typo 2020-04-05 21:02:16 +02:00
ptitSeb cbe4ec30d1 [DYNAREC] Fun with flags: optimize FCOMI emiter 2020-04-05 20:35:22 +02:00
ptitSeb 38a9b04ce0 [DYNAREC] Change the way X86 Flags are handled 2020-04-05 20:10:18 +02:00
ptitSeb 7de59621c4 Changed how ROR and ROL handle flags (less exact but faster, seems ok on all tests) 2020-04-04 11:11:46 +02:00
ptitSeb e9560dd916 [DYNAREC] Improved is_nops function 2020-04-02 18:19:50 +02:00
ptitSeb 91fec006ae [DYNAREC] Improved dynarec by allowing each block to be bigger 2020-04-02 08:26:18 +02:00
ptitSeb 82af74c459 [PANDORA] Fix for the use of tremor in SDL(1/2)_mixer 2020-04-01 15:35:47 +02:00
ptitSeb 32dc46efac [DYNAREC] Improve DUMP info a bit 2020-04-01 13:05:41 +02:00
ptitSeb 020b94794b [DYNAREC] Removed duplicate include 2020-03-31 21:52:27 +02:00
ptitSeb bb59ef692e Improved a bit a warning message 2020-03-31 21:51:58 +02:00
ptitSeb 8280d4628d Fixed a few wrapped functions prototypes 2020-03-30 16:39:46 +02:00
ptitSeb 91c6a71353 [DYNAREC] Fixed CMPXCHG opcode (helps Telsagrad, and probably others) 2020-03-30 16:21:10 +02:00
ptitSeb fa9e8223b9 [DYNAREC] Fixed memory allocated with mmap64 that was tracked (fix Unity/Mono JIT not beeing Dynarec'd correctly) 2020-03-30 15:11:08 +02:00
ptitSeb 7057ce7a2c Fixes to some libc wrapper functions with callback (fixed Teslagrad) 2020-03-30 14:16:04 +02:00
ptitSeb b98febce24 Added one more synonim for SDL2 2020-03-29 15:52:40 +02:00
ptitSeb 11758cfa90 Improvments to libc wrapped function with callback 2020-03-29 09:38:26 +02:00
ptitSeb a37928110d Some improvments to vorbisfile wrapped lib 2020-03-29 09:38:02 +02:00
ptitSeb a3c7674676 [DYNAREC] Added PMADDUBSW opcode 2020-03-28 20:43:07 +01:00
ptitSeb ed68b17bac [DYNAREC] Added PACKSSWB opcode, and changed a MOVD one to avoid some BusError 2020-03-28 17:40:24 +01:00
ptitSeb aa86b8ecf4 [DYNAREC] Added PADDSB opcode 2020-03-28 17:04:44 +01:00
ptitSeb e0c5630ed7 [DYNAREC] Added PSUBSB opcode 2020-03-28 17:01:39 +01:00
ptitSeb c4b4107f57 [DYNAREC] Added PCMPEQB opcode 2020-03-28 16:58:08 +01:00
ptitSeb d198f6c64a [DYNAREC] Added PADDUSB opcode 2020-03-28 16:52:05 +01:00
ptitSeb fd3812c27e [DYNAREC] Added PSADBW and PMAXUB 2020-03-28 16:46:08 +01:00
ptitSeb ddbffd874b [DYNAREC] Added PSHUFB SSE3 opcode 2020-03-28 15:02:08 +01:00
ptitSeb bc1b5bed0b Refactored (and simplified) libc functions with callbacks 2020-03-28 14:04:37 +01:00
ptitSeb f7019e0ff8 Added 2 SSE3 opcodes 2020-03-28 14:01:58 +01:00
ptitSeb e47f88f4f3 Changed (optimized?) a bit the idiv operations 2020-03-28 14:01:35 +01:00
ptitSeb baf750b89a Added one dummy libc wrapped function 2020-03-28 10:39:30 +01:00
ptitSeb bea256ddc6 Added wrapped lib Xmu (with 2 functions) 2020-03-28 10:25:28 +01:00
ptitSeb e7f841b71e Made looking for emulated libs more resiliant 2020-03-27 22:19:54 +01:00
ptitSeb 1df10d7a48 [DYNAREC] Added UD2 opcode 2020-03-27 21:50:54 +01:00
ptitSeb 53c4a0d418 More SDL2 wrapped functions 2020-03-26 20:48:19 +01:00
ptitSeb 883f1990c6 Added some more GS: opcodes 2020-03-25 23:02:22 +01:00
ptitSeb c2efed56e0 Added 1 libX11 wrapped function 2020-03-25 19:28:21 +01:00
ptitSeb 37814194ae [PANDORA] Try some workaround for Xxf86vm Gamma issues 2020-03-25 14:29:54 +01:00
ptitSeb 03cc86c6d1 Added a few libc wrapped functions 2020-03-25 11:58:42 +01:00
ptitSeb 206f5d3aa8 Added barely used 82 opcode (same as 80) [DYNAREC] too 2020-03-25 11:41:36 +01:00
ptitSeb d5c71f3dcc Added FPREM1 opcode 2020-03-25 11:14:55 +01:00
ptitSeb 1ed35d06c7 Add some fail safe on program that use _IO_2_1_st* symbols 2020-03-25 08:56:31 +01:00
ptitSeb 4456ab2ab5 Add a libc symbol 2020-03-25 08:55:55 +01:00
ptitSeb 645297de61 Added one new syscall 2020-03-24 18:02:25 +01:00
ptitSeb 71dbfda219 Added 2 X11 wrapped functions 2020-03-24 17:06:28 +01:00
ptitSeb c8977e68d0 Added a wrapped x11 function 2020-03-23 13:57:58 +01:00
ptitSeb 9b1bfb17b0 Expose SSE3 and SSSE3 2020-03-23 13:46:25 +01:00
ptitSeb 95858b46b0 [DYNAREC] Changed MOVQ 0f 7f opcode to avoid potential Bus Error (helps steam) 2020-03-23 13:31:48 +01:00
ptitSeb d7ca13e7f7 Added wrapped libnm (also as a replacement for libnm-glib and libnm-util, to help steam, but need network-manager-gnome package) 2020-03-22 19:05:33 +01:00
ptitSeb a17dfe8ed6 Added a few gtk wrapped functions 2020-03-22 17:10:45 +01:00
ptitSeb 1d9eb8fa17 Added some more gio2 wrapped functions 2020-03-22 16:58:16 +01:00
ptitSeb 6d8e64a213 Added gudev wrapped functions 2020-03-22 14:55:45 +01:00
ptitSeb c5859a0d92 Added a large bunch of glib2 / gobject2 / gio2 wrapped functions 2020-03-22 14:38:23 +01:00
ptitSeb 058b199606 Added a large bunch of dbus and dbus-glib1 wrapped functions 2020-03-22 08:45:29 +01:00
ptitSeb 5b58985fdf One more glib2 wrapped function 2020-03-21 20:42:44 +01:00
ptitSeb b9e1192d69 Added more slot to gobject2 callbacks 2020-03-21 19:31:42 +01:00
ptitSeb 1d0a575773 Try to define all gobject cclosur_marshaler as DATA and not wrapped functions 2020-03-21 19:22:29 +01:00
ptitSeb 72e3e36f1b Added wrapped dbusmenu-glib library 2020-03-21 18:54:35 +01:00
ptitSeb bd2271de86 Fixed a wrapped gobject2 function (and steam is almost starting) 2020-03-21 17:52:42 +01:00
ptitSeb ffa2aa6f1c Added a few more libc wrapped functions 2020-03-21 16:44:49 +01:00
ptitSeb c0d35aa6e7 Some (speed) improvement to wrapped pulse library 2020-03-21 15:58:07 +01:00
ptitSeb 11c1396d83 Small change in epool_ctl wrapped function 2020-03-21 15:57:43 +01:00
ptitSeb 41e6ba1030 Init new stacks to 0 (in line with x86 behavour?) 2020-03-21 15:57:13 +01:00
ptitSeb e92e9043fa Fixed some multi-threaded libpulse wrapped functions 2020-03-21 15:29:56 +01:00
ptitSeb c53ab30b2e Improved autodetect of binary, and added special case for steam 2020-03-21 12:34:53 +01:00
ptitSeb c763ca269a Smalls changes on libudev wrapped function 2020-03-21 11:59:16 +01:00
ptitSeb bf4c05c41c Added a few more gobject2 wrapped functions 2020-03-21 10:06:22 +01:00
ptitSeb 9b9130ed57 Added a few more dbug-glib2 wrapped functions 2020-03-20 19:51:18 +01:00
ptitSeb 5fde277748 Added a wrapped function to gobject2 2020-03-19 21:39:07 +01:00
ptitSeb 7757666a0b Added some more glib2 wrapped functions 2020-03-18 21:00:29 +01:00
ptitSeb 4bc52873f7 Added some glib2 wrapped functions 2020-03-17 22:16:53 +01:00
ptitSeb a5a38203ae Added some gio dbus wrapped functions 2020-03-16 17:57:23 +01:00
ptitSeb 1209862996 Fixed fprintf trace (in case it's in fact __fprintf_chk that is called) 2020-03-16 17:56:57 +01:00
ptitSeb 4f0bb1010d Fixed return value for dladdr wrapped function 2020-03-15 15:29:03 +01:00
ptitSeb 050b974051 [DYNAREC] Fixed a MOVQ mmx opcode 2020-03-15 12:41:13 +01:00
ptitSeb 88fb7efec3 Use fopen64 and fseeko64 on main binary so >4Gb file can be open (now psychonauts installer can be run) 2020-03-15 09:53:39 +01:00
ptitSeb a91c562dcf Removed old monounity wrapped lib attempt (not working well enough) 2020-03-14 12:52:27 +01:00
ptitSeb f1a136c9b4 Added libXdamage wrapped lib (complete) 2020-03-13 20:21:43 +01:00
ptitSeb 57583b39e7 Added libXcomposite wrapped library (complete) 2020-03-13 19:31:13 +01:00
ptitSeb 3467ea2476 Added some more libcrypto wrapped functions 2020-03-12 20:23:23 +01:00
ptitSeb 0e6daf412d Fixed execl wrapped functions 2020-03-12 20:23:11 +01:00
ptitSeb 8468c5318d Improve trace, especialy in BUILDLIB scenario 2020-03-11 20:29:49 +01:00
ptitSeb 853f4865ce [BUILDLIB] Add some failsafe fallback for getauxval 2020-03-10 20:57:21 +01:00
ptitSeb 0742c694b0 Added a few gtk wrapped functions 2020-03-09 20:13:13 +01:00
ptitSeb 247622a6db [DYNAREC] Small change in how JIT'd code in handled in the linker 2020-03-08 16:36:26 +01:00
ptitSeb cbd4b4f73a Fixed an issue with TLS data (and now hotline_launcher works) 2020-03-08 15:59:05 +01:00
ptitSeb 3782d7f4df [TRACE] Fixed start of symbol that was not printed in the trace 2020-03-08 12:08:20 +01:00
ptitSeb bc13894b31 Added lots of libxcb wrapped functions 2020-03-08 11:24:57 +01:00
ptitSeb d6ff293d7f [BUILD] Added dependancie on wrapped functions between .c and _private.h 2020-03-07 17:11:11 +01:00
ptitSeb 9e2ba671b8 Added some FontConfig wrapped functions 2020-03-07 16:19:44 +01:00
ptitSeb fb56c5f422 Added a few more X11 wrapped functions 2020-03-07 13:03:54 +01:00
ptitSeb a45d6bd79b Added some wrapped function used by gtk-1.2 2020-03-06 15:53:47 +01:00
ptitSeb 28a26db054 Added dontstarve autodetect to force use of emulated SDL2 2020-03-06 10:17:35 +01:00
ptitSeb 95782e7311 Remove import glob from wrapper generator, not used anymore 2020-03-06 09:51:17 +01:00
ptitSeb 5f6221de7f [DYNAREC] Added TZCNT opcode 2020-03-06 09:50:26 +01:00
ptitSeb b42ac3eb11 Revert stat / lstat change 2020-03-05 18:32:32 +01:00
ptitSeb 2964727959 Reworked py generator to avoid useless recompiles 2020-03-05 17:05:15 +01:00
ptitSeb fca7808b55 [DYNAREC] Added a few more opcodes 2020-03-05 14:21:15 +01:00
ptitSeb 07c98d30ad [DYNAREC] Add preliminary support for JIT'd code 2020-03-05 11:41:43 +01:00
ptitSeb a7c95a783e [DYNAREC] Added a few opcodes 2020-03-05 11:40:49 +01:00
ptitSeb e84ebce421 [DYNAREC] Dump of Dynarec blocks is now a seprated option 2020-03-05 11:39:56 +01:00
ptitSeb 0df765bbbd Fixed some type in USAGE 2020-03-04 13:19:02 +01:00
ptitSeb 2af2fbfe6d [DYNAREC] Preliminary work to support JIT'd code in Dynarec 2020-03-03 16:09:24 +01:00
ptitSeb 96f5f92b09 Fixed some typo is libgthread2 wrapped lib 2020-03-03 10:25:01 +01:00
ptitSeb dedd7f4827 Use lstat instead of stat on filexist function (alow use of symlink of libs) 2020-03-02 16:57:52 +01:00
ptitSeb 28a066a7c9 Added a few more pulse wrapped functions (should help Paper, Please) 2020-03-02 14:40:43 +01:00
ptitSeb 6377884c4a Improved emulation of dl_iterate_phdr (fixed Paper, Please) 2020-03-02 13:56:23 +01:00
ptitSeb 41cc61e4c7 Fixed an issue with a wrapped function in gtk 2020-03-01 14:40:04 +01:00
ptitSeb 73e13baa84 And more SDL2 wrapped functions 2020-03-01 13:03:23 +01:00
rajdakin 403707bb5b A few more SDL2 wrapped functions 2020-03-01 11:02:06 +01:00
ptitSeb 873bdd793a Some more SDL2 wrapped functions 2020-02-29 09:49:41 +01:00
ptitSeb edbd6cdfa5 A few more SDL2 wrapped functions 2020-02-28 18:37:50 +01:00
ptitSeb e7a9679a20 More SDL2 wrapped functions 2020-02-27 21:28:20 +01:00
ptitSeb b9d09acf92 Added a few SDL2 wrapped functons 2020-02-26 22:04:30 +01:00
ptitSeb 7a02b1720e Fixed glXProcAddress and alGetProcAddress when querying a my_ wrapped functions (fixed Isaac Aftyerbirth, and probably others games) 2020-02-15 21:26:53 +01:00
ptitSeb 3c88e8aac0 Added a few wrapped functions to wrandr and dbus 2020-02-15 20:11:29 +01:00
ptitSeb df4e93973b [DYNAREC] revert the use of TryLock, it fallback to interpretor too often 2020-02-15 19:48:59 +01:00
ptitSeb c3dbe47f3c [DYNAREC] Fixed x87 TAG issues (causing massive FPU under/over flow messages) 2020-02-15 19:48:25 +01:00
ptitSeb af91d80c94 Added some handling of TAG for x87 emulation (DYNAREC too) 2020-02-15 18:22:46 +01:00
ptitSeb a133621934 Use Trylock instead of Lock RWMutex in Dynarec block creation, to allow fallback to Interpreter instead of waiting 2020-02-15 16:00:48 +01:00
ptitSeb 329bddc4f6 Avoid Dynarec in signal handler, to avoid potentiel deadlocks 2020-02-15 15:59:57 +01:00
ptitSeb 31785d6fbe Added wrapped mkstemps64 function 2020-02-15 12:53:45 +01:00
ptitSeb c7bf006b49 Added better support for pthread_cleanup_push and pop macros (help Unity games) 2020-02-14 10:47:15 +01:00
ptitSeb 3fc1458cc2 Added a few more SDL2 wrapped functions 2020-02-13 20:21:29 +01:00
ptitSeb 53be7dad84 Added better handing of thread stack querying 2020-02-12 17:29:46 +01:00
ptitSeb 7507a0f20f Added a few SDL2 wrapped functions 2020-02-11 20:20:12 +01:00
ptitSeb 32a6711898 Small improvment on trace, to avoid potention deadlock or segfault 2020-02-10 20:19:42 +01:00
ptitSeb 223c6513ba Simplified pulsesimple, as it use full pulse now 2020-02-09 10:47:41 +01:00
ptitSeb d395df1f37 [DYNAREC] Prepare SDIV and UDIV emmiter (but no use yet) 2020-02-08 15:58:28 +01:00
ptitSeb f5a7d96a77 [DYNAREC] Added support for SWP opcode when handling XCHG x86 opcode 2020-02-08 12:34:38 +01:00
ptitSeb 81ae020273 [DYNAREC] Added detection of hardware cpu extensions 2020-02-08 10:57:24 +01:00
ptitSeb 57024db6e6 Improved getauxval handling 2020-02-07 08:18:25 +01:00
ptitSeb e507b964a1 Added actual getauxval wrapped function, and support for native getauxval 2020-02-06 22:48:12 +01:00
ptitSeb d2bff48e88 New developpement cycle 2020-02-06 22:01:12 +01:00
ptitSeb ba364f629f Bump version to v0.1.0 2020-02-05 18:46:10 +01:00
ptitSeb ae723c42fe Merge pull request #92 from madcock/patch-2
Clean up Gameshell section
2020-02-05 12:47:18 +01:00
Michael Adcock 8cf46bb5a8 Clean up Gameshell section
It's the same as RPI2, without the extra RPI definitions. ;-)
(We can use ASM flags too.)
2020-02-05 03:04:54 -08:00
ptitSeb ffadb9df59 Small improvment on auxiliary vector emulation 2020-02-04 11:39:15 +01:00
ptitSeb 87c55d434c Fix a warning 2020-02-03 17:23:09 +01:00
ptitSeb ae513fd908 Fix build on x86 platform 2020-02-03 17:22:14 +01:00
ptitSeb 4683f2194d Updated README and CHANGELOG 2020-02-02 18:01:15 +01:00
ptitSeb 823174af3e Improved support for XESetWireToEvent and XESetEventToWire (descent3 should be able to start a new game on every platform now) 2020-02-02 16:41:07 +01:00
ptitSeb 77c205cd78 Improved trace (print function name when possible) 2020-02-02 15:43:32 +01:00
ptitSeb ea047b1573 Fixed a typo in a function name 2020-02-02 14:46:20 +01:00
ptitSeb c4b9c107af Fixed wrapped alGetProcAddress and alcGetProcAddress 2020-02-02 14:04:42 +01:00
ptitSeb 5bb580a9e0 [DYNAREC] Use dynarec for elf inits (to speedup loading) 2020-02-02 12:09:50 +01:00
ptitSeb b82e0f124a [DYNAREC] Try to use rwlock instead of mutex for Dynarec blocks creations 2020-02-02 11:51:36 +01:00
ptitSeb 4e5512ecb3 Refined XCHG opcode in interpretor 2020-02-02 11:40:22 +01:00
ptitSeb 48dffd1d6e Use calloc instead of malloc, it seems x86 malloc mem is zero'd most of the time 2020-02-01 20:06:48 +01:00
ptitSeb a0820fcd2d Refined FTS handling 2020-02-01 20:06:18 +01:00
ptitSeb 0819240675 [TRACE] Add some padding to Formatter structure, because newer version are bigger 2020-02-01 16:41:10 +01:00
ptitSeb 1ae7e8f998 Fixed debug info for XCreateWindow 2020-02-01 15:57:43 +01:00
ptitSeb bfbf7c2d10 Added better debug for XCreateWindow 2020-02-01 15:52:55 +01:00
ptitSeb 8fb4d06858 Added fts_* wrapped functions support 2020-02-01 15:30:52 +01:00
ptitSeb 0bec217d1e Added one more wrapped function to libc 2020-02-01 10:28:01 +01:00
ptitSeb a0a7b8b758 Added a few wrapped function to libc 2020-01-31 12:18:32 +01:00
ptitSeb 5e344b7db6 Added a wrapped function to libjpeg 2020-01-31 11:49:52 +01:00
ptitSeb a954773ba6 Simplified libpng12 wrapped and add a few wrapped functions 2020-01-31 11:37:14 +01:00
ptitSeb ee27dfd927 [DYNAREC] Fix build issue 2020-01-30 11:38:27 +01:00
ptitSeb 44995a791f [DYNAREC] Added 3 GS: opcode (need testing) 2020-01-30 11:08:14 +01:00
ptitSeb df69100282 [DYNAREC] Added 66 0F F8 PSUBB OpCode (should help FTL 1.6.12) 2020-01-30 10:41:49 +01:00
ptitSeb c6b6247812 Fixed test02 2020-01-29 19:35:46 +01:00
ptitSeb 466b9e88b0 Syscall IPC doesn't exist everywhere. Fix build for now. Will need implementation 2020-01-29 17:32:53 +01:00
ptitSeb 1c51f99ed4 Added a couple of wrapped function (to be tested) 2020-01-29 17:30:02 +01:00
ptitSeb 2a68db14dc A bit more work in syscall (still to be validated) 2020-01-29 15:38:13 +01:00
ptitSeb b5bbd3e6d9 Some work on syscall, to try get old statically linked loki games working 2020-01-29 14:59:37 +01:00
ptitSeb 3ccdce5df4 Avoid a malloc when creating a new x86emu_t struct 2020-01-29 09:04:27 +01:00
ptitSeb 6c9195bae8 Improved wrapped SDL_RWops for SDL1, potentially fixing many games (at least fixes Robin Hood) 2020-01-28 21:42:43 +01:00
ptitSeb ed324369a0 Improved handling of FreeType, when using custom stream to load fonts (to be perfected, but that's a start) 2020-01-28 20:57:38 +01:00
ptitSeb 37efbe3f4b Improved, again, gtk signal handling (but more work is needed) 2020-01-28 18:18:08 +01:00
ptitSeb 0e2f4cd25a Improved debug a bit on wrapped gtk functions and callbacks 2020-01-27 23:02:43 +01:00
ptitSeb d773410d6b Some fixes / improvements to gtk and signal handling (again) 2020-01-27 17:47:10 +01:00
ptitSeb 1db72cb2fe Allow to run program with missing needed lib, with an env. var. 2020-01-27 17:22:02 +01:00
ptitSeb cd952734e5 Added a few SDL2 wrapped functions 2020-01-27 12:03:09 +01:00
ptitSeb 6b134cc102 Added a few wrapped function gobject2 2020-01-26 16:34:30 +01:00
ptitSeb 55c399bab6 Added some wrapped function in libgdk 2020-01-26 16:30:04 +01:00
ptitSeb 60a3214375 A few more wrapped function to libc, and one for libX11 2020-01-26 16:20:11 +01:00
ptitSeb f992b50444 Added empty wrapped libs gstreamer-0.10 and gstinterfaces-0.10 2020-01-26 15:29:45 +01:00
ptitSeb 65a62df0b1 Added a few wrapped functions to libc 2020-01-26 15:08:32 +01:00
ptitSeb a154752c1a Added dlsym as a fallback for dlvsym 2020-01-26 15:08:09 +01:00
ptitSeb 9ee6dcd27b Added 0F 2B MOVNTPS opcode (DYNAREC too) 2020-01-26 11:10:54 +01:00
ptitSeb fc5f512d24 Added a bunch of gtk wrapped functions 2020-01-26 10:36:53 +01:00
ptitSeb 089ed989f2 Try to improve handling of setjmp and libjpeg error handler (still something wrong somewhere) 2020-01-25 17:40:21 +01:00
ptitSeb b26c2253af Fixed an issue with pulseaudio (fixing ShovelKnight, again, on Pi4, and probably many other) 2020-01-25 16:24:26 +01:00
ptitSeb 647429d822 Fixed potential cPandora compilation issue (should fix #90) 2020-01-25 13:58:46 +01:00
ptitSeb 8c1368a79f Added MASKMOVDQU opcode (helps emulated libjpeg.so.8, for crimsonland) 2020-01-25 09:30:25 +01:00
ptitSeb cf37e29f96 Added MOVNTDQ opcode (in the dynarec too) 2020-01-24 22:47:29 +01:00
ptitSeb ce9a991a28 Small clean up in library_private structure 2020-01-23 22:52:15 +01:00
ptitSeb 4faf21a899 [BUILD_LIB] Fixed a few issues with initialization when built as lib 2020-01-22 23:33:53 +01:00
ptitSeb 8f2c02ec2a Added 2 more wrapped functions to libpng12 2020-01-22 21:11:15 +01:00
ptitSeb 872bd0042c Add a new function to run functions 2020-01-22 21:10:53 +01:00
ptitSeb c8c2d8de61 Fixed a few gtk wrapped functions 2020-01-21 16:05:15 +01:00
ptitSeb 30e8ebccb7 Added a few X11 wrapped functions 2020-01-20 08:18:57 +01:00
ptitSeb 7b0efb110f Added RCPPS opcode (and now AnomalyWarzoneEarth boots) 2020-01-19 19:01:15 +01:00
ptitSeb e553d93b17 Added a few wrapped functions (plus a faked MinorityMix_SetPosition for AntiChamber) 2020-01-18 21:30:40 +01:00
ptitSeb 41ba98dc84 Fixed some bus error in the Interpretor 2020-01-18 18:26:48 +01:00
ptitSeb 1dd53d4a03 Merge pull request #87 from PokeEngineer/master
Create an uninstall target
2020-01-18 17:10:57 +01:00
Jacob Mullins 00b1132fcf Created an uninstall target 2020-01-18 10:38:44 -05:00
ptitSeb 4d1fa73ac7 Removed some warning 2020-01-16 16:41:46 +01:00
ptitSeb 5493e5c35c Refined the initialization part for BOX86 as a Lib 2020-01-15 11:14:03 +01:00
ptitSeb e9c5272435 Box86 as Lib need -fPIC 2020-01-15 08:49:02 +01:00
ptitSeb 807ad56a39 Reworked a bit to have easier box86 as a lib 2020-01-14 22:36:05 +01:00
ptitSeb 472aa40b53 Removed the option to build without GTK wrapper (too much changed in the python generator for now) 2020-01-14 21:49:05 +01:00
ptitSeb 64e2b3e6db Added (hidden) option to build as a static lib 2020-01-14 21:40:43 +01:00
ptitSeb 5dc6f268c7 Refined NOGTK option 2020-01-14 20:37:23 +01:00
ptitSeb 931ef0c0c1 Added (hidden) option to not built GTK wrappers 2020-01-14 20:33:50 +01:00
ptitSeb 290adf2434 Merge pull request #86 from mittorn/master
Implement some FS opcodes used in windows dlls
2020-01-13 14:38:28 +01:00
mittorn 554c1c36bc Implement some FS opcodes used in windows dlls 2020-01-13 21:13:39 +07:00
ptitSeb 0e5994a0f9 And a bit more wrapped gtk functions 2020-01-12 19:15:08 +01:00
ptitSeb e3fb2b63c9 Some more wrapped gtk functions 2020-01-12 19:09:48 +01:00
ptitSeb 82c67783c1 Fixed libcairo that wasn't properly wrapped 2020-01-12 17:33:41 +01:00
ptitSeb 9799bbfedb Added more wrapped function to gtk (mainly around cairo) 2020-01-12 17:16:59 +01:00
ptitSeb e8a1196674 Added wrapped libXpm 2020-01-12 11:26:33 +01:00
ptitSeb 48a4e81214 Try to use gtk-2 for gtk-1.2 apps, but structs size are different, so disabling for now 2020-01-12 10:37:40 +01:00
ptitSeb bf441d6918 Added a few SDL 1 wrapped functions 2020-01-11 19:45:03 +01:00
ptitSeb aab4089986 Tried to improve signal handling (still not 100% ok) 2020-01-11 18:52:12 +01:00
ptitSeb c7cf40d55e Merge pull request #82 from madcock/patch-1
Update Gameshell params
2020-01-11 14:14:13 +01:00
Michael Adcock b977e3063f Update Gameshell params
Removed -march and added -mpcu to fix [cc: error: unrecognized argument in option ‘-march=armv7-a+fp’]
2020-01-11 03:28:24 -08:00
ptitSeb e5181e75be Added a few more wrapped function to freetype (and Arkos Traker 2 works again) 2020-01-11 11:47:02 +01:00
ptitSeb 58c903467e Fixed some warning 2020-01-11 11:02:17 +01:00
ptitSeb a615e0b627 Wrapped some new libc functions 2020-01-11 10:47:40 +01:00
ptitSeb b6c729f2d3 Added some wrapped function on x11 and friends 2020-01-10 22:39:09 +01:00
ptitSeb ff437ce8cf [DYNAREC] Some fixes for bordercase use of VSHR 2020-01-10 19:29:04 +01:00
ptitSeb 66a986c76f [DYNAREC] Fixed VLD1QALL_32 opcode (this fixes #81) 2020-01-10 19:28:33 +01:00
ptitSeb 410729e91a Merge pull request #80 from BlackHazel/patch-1
Update CMakeLists.txt (Typo)
2020-01-10 15:15:46 +01:00
BlackHazel 916f758e8c Update CMakeLists.txt (Typo) 2020-01-10 14:49:36 +01:00
ptitSeb 8affc5529e Rename FreeLibrary to Free1Library (not ideal, but that should solve #79) 2020-01-10 11:40:04 +01:00
ptitSeb efa07f3ad5 Added some libatk wrapped functions 2020-01-10 07:53:44 +01:00
ptitSeb 9a7daf4cd4 Added one data symbol to wrapped libc 2020-01-09 21:59:00 +01:00
ptitSeb c5068ea1d1 Added all wrapped function to libgmodule2 2020-01-09 21:36:06 +01:00
ptitSeb 0db1306563 Fixed some mystake in previous commit 2020-01-09 21:35:47 +01:00
ptitSeb 6b42fd6a24 Added a few wrapped function to libXtst 2020-01-09 20:57:12 +01:00
ptitSeb d418e67c77 Added a few wrapped functions to libm 2020-01-09 20:32:19 +01:00
ptitSeb 26bfef4161 Added 1 wrapped function to libasound 2020-01-09 20:32:04 +01:00
ptitSeb c64cffa352 Added deprecated SDL_mutexP and SDL_mutexV as alias 2020-01-09 16:41:41 +01:00
ptitSeb 863019f113 [DYNAREC]Added PUSH/POP ES and ES: prefix opcodes 2020-01-09 09:40:15 +01:00
ptitSeb c60581d7d3 Fixed BOX86_LIBGL, that was not always working correctly 2020-01-09 08:48:31 +01:00
ptitSeb a1abae4717 Fixed old issue aboug glXGetprocAddressARB (and a few other) not beeing visible in glXGetProcAddress 2020-01-08 22:14:47 +01:00
ptitSeb f970138c5f Added ES: prefix handling, along with push/pop es 2020-01-08 21:35:15 +01:00
ptitSeb 560e88f379 [DYNAREC] Changed most LDRD/STRD with dual LDR/STR to avoid bus erros 2020-01-08 11:43:30 +01:00
ptitSeb 18ff3c0b2c A few more wrapped function signature fixes for gtk stuffs 2020-01-08 08:19:28 +01:00
ptitSeb b92f20fa62 Some signature fixes for a few gtk wrapped functions 2020-01-07 16:31:21 +01:00
ptitSeb 2d22e18f5a Try to make Dynarec compile by default for Pandora/Pyra/Gameshell/RPix 2020-01-07 08:29:57 +01:00
ptitSeb 82fce8520c Added one wrapped function to freetype (and now WakingMars works) 2020-01-06 21:48:52 +01:00
ptitSeb 21ad3afce8 Now BOX86_EMULATED_LIBS allow to force libs to be emulated and not wrapped, and also added a detection on LittleInferno that needed that workaround for libvorbis 2020-01-05 15:47:10 +01:00
ptitSeb 5b680d4925 Added a few more wrapped functions for libogg 2020-01-05 15:46:24 +01:00
ptitSeb cabcf2cc39 Made loading of lib a bit more configurable (soon) 2020-01-05 14:15:23 +01:00
ptitSeb 9cc5f50f95 Added 2 more wrapped functions to libc 2020-01-04 18:40:49 +01:00
ptitSeb 2097af4172 [RPI] Added a workaround for GoG mojosetup (issue is with the background picture that is 5000x3000, so workaround is to delete it) 2020-01-04 17:09:56 +01:00
ptitSeb 141595e2d5 Fixed gtk_image_new function signature 2020-01-04 11:25:09 +01:00
ptitSeb 461f8d0e84 Make the stack bigger for RunFunction 2020-01-04 10:35:46 +01:00
ptitSeb 1775f4a47e Changed a bit of gobject2 signal connection is done 2020-01-04 09:53:17 +01:00
ptitSeb 48a271105d [DYNAREC] More MMX and SSE opcodes 2020-01-04 09:52:52 +01:00
ptitSeb 01bac8e3c4 Some more SSE opcodes 2020-01-04 09:52:32 +01:00
ptitSeb 9f6f94d504 [DYNAREC] More work on MMX opcodes 2020-01-03 21:33:21 +01:00
ptitSeb cd8ceda3ee [DYNAREC] Added a few more MMX opcodes 2020-01-02 19:35:42 +01:00
ptitSeb cd6cb90576 [DYNAREC] And a few more MMX opcodes 2020-01-02 08:37:15 +01:00
ptitSeb b69ed41ea6 [DYNAREC] Added a few more mmx opcode, and fixing an SSE one 2020-01-01 23:27:57 +01:00
ptitSeb 0d66d57806 [DYNAREC] Added 0f 67, 0f 68 and 0f 6a opcodes 2020-01-01 22:32:04 +01:00
ptitSeb 5762d865bb [DYNAREC] Added PMULLW and fix VQSUBxxx emitter 2020-01-01 20:42:45 +01:00
ptitSeb bac874ce38 [DYNAREC] Added PREFETCHh and PSHUFW mmx opcode, plus improvment to a few existing ones 2020-01-01 18:05:53 +01:00
ptitSeb fdf0aaacf1 Change some warning log level to LOG_INFO 2020-01-01 18:05:04 +01:00
ptitSeb f810e7a5f3 [DYNAREC] Added PUNPCKLBW, PUNPCKLWD and PUNPCKLDQ MMX opcode, plus improved a few other 0x0F MMX ones 2020-01-01 15:26:36 +01:00
ptitSeb 13fa2c74ef [DYNAREC] Added PSRLD, PSRAD, PSLLD, PMULHW and PMULHUW MMX opcodes (need testing) 2020-01-01 14:18:48 +01:00
ptitSeb f24bbd1e5f Added PSRLD, PSRAD, PSLLD and PMULHUW MMX opcodes 2020-01-01 14:17:40 +01:00
ptitSeb ab5f21c34d [DYNAREC] Added PSUBUSB and PSUBUSW opcode 2020-01-01 13:19:54 +01:00
ptitSeb ad6ee87e4f Added PSUBUSW opcode 2020-01-01 13:13:49 +01:00
ptitSeb b9478291bc Reworked gtk signal handling, to make it lighter (and now The Binding of Isaac boot, before finding unimplemented opcodes) 2020-01-01 12:44:34 +01:00
ptitSeb 59228657e5 Fixed signature for wrapped gdk_window_get_origin function 2019-12-31 19:37:43 +01:00
ptitSeb 3db1ab2b3e Added some wrapped function libudev-0 2019-12-31 18:42:46 +01:00
ptitSeb 8d75b56a2c Changed a bit how GTypeInfo and friends are wrapped 2019-12-31 18:07:23 +01:00
ptitSeb 1499ef31a9 Fix dl_iterate_phdr 1st iteration (name should be empty) 2019-12-31 17:35:00 +01:00
ptitSeb cdc1e4e18e Added a few SDL2 wrapped functions 2019-12-31 17:25:33 +01:00
ptitSeb 6f5102689f Added a last large btch of gtk wrapped functions 2019-12-31 16:15:20 +01:00
ptitSeb decc1af534 Added some more gtk wrapped functions (Hollyplayer is happy now, no more missing functions) 2019-12-31 13:08:02 +01:00
ptitSeb a912c34b9d Impoved libasound wrapper (and now there is sound in Hollywood Player) 2019-12-31 12:57:11 +01:00
ptitSeb 0fc22270b7 Fixed a mystake in gdk_window_get_root_origin wrapped function 2019-12-31 12:46:23 +01:00
ptitSeb 0ff9da5d4e Added a few more gtk-2 wrapped functions 2019-12-31 12:00:09 +01:00
ptitSeb 887ef22002 Fixed and issue with g_main_context_get_poll_func 2019-12-31 11:59:52 +01:00
ptitSeb c9adb6bf97 Added a few cURL wrapped functions 2019-12-31 11:18:29 +01:00
ptitSeb 33f2c63278 Added more gtk stuff, and improve Callbacks Arg handling 2019-12-31 11:12:27 +01:00
ptitSeb 950e6d99d3 Allow custom gtk class to be derived from GTKCaintainerClass now 2019-12-31 09:18:32 +01:00
ptitSeb d4ab117327 Added a large set of wrapped function to gtk-2 2019-12-30 23:08:17 +01:00
ptitSeb 419f2a5707 Added a global structure to libXt (but it may need some heavy wrapping...) 2019-12-30 19:40:13 +01:00
ptitSeb 0fac701577 Added more wrapped gtk-2 functions 2019-12-30 19:15:38 +01:00
ptitSeb c3ea1b17ac More function about pixbuff and image if gdk libs 2019-12-30 18:31:20 +01:00
ptitSeb 8ad4bd5178 Added a few fontconfig and freetype wrapped functions 2019-12-30 17:59:53 +01:00
ptitSeb c7896186b0 Add _XtInherit wrapped function to libXt 2019-12-30 17:59:37 +01:00
ptitSeb 43bd57cf4c Added 2 wrapped libX11 functions 2019-12-30 17:40:21 +01:00
ptitSeb 199d9503b3 Added 2 (untested, may need alignment) wrapped functions to libc 2019-12-30 17:38:15 +01:00
ptitSeb 1d2347f742 Add som libXt wrapped functions 2019-12-30 17:28:35 +01:00
ptitSeb f0c55d2e45 Added 2 functions to wrapped libc 2019-12-30 17:08:17 +01:00
ptitSeb 60a18f7e2d Add most menu wrapped functions to gtk-2 2019-12-30 17:02:47 +01:00
ptitSeb 369ffeb64a Added a new bunch of glib2 wrapped functions 2019-12-30 16:30:24 +01:00
ptitSeb 3f624ab813 Added some workaround for global gdk_display and g_threads_got_initialized 2019-12-30 13:08:07 +01:00
ptitSeb 590abc18f9 Added a few more gtk and co wrapped functions 2019-12-30 00:43:17 +01:00
ptitSeb 48f4ccce5d And added a large bunch of gdk wrapped functions 2019-12-29 23:28:07 +01:00
ptitSeb 28787055e0 Added tab wrapped functions to pango 2019-12-29 20:35:12 +01:00
ptitSeb ba42e0e3e4 Added a new large bunch of glib2 and gobject2 wrapped functions 2019-12-29 20:15:57 +01:00
ptitSeb 6aabb24b34 And a bit more gtk and gdk stuff (tests with scribble-xinput gtk tuto) 2019-12-29 18:31:28 +01:00
ptitSeb 5ab5e07775 Added more gtk and gdk wrapped functions (tested with scribble-simple gtk tuto) 2019-12-29 18:03:27 +01:00
ptitSeb f78ea33be6 Fix wrapped gtk libs, so custom widget can be created (tested with gtkdial tuto, only widget can be the parent class for now) 2019-12-29 17:46:02 +01:00
ptitSeb 5fbc9b637e Fixed some more gobject2 wrapped function (tested with gtk tictactoe tutorial) 2019-12-28 19:23:59 +01:00
ptitSeb a0e6a3edb9 Added wrapped g_print and g_printerr to glib2, plus some small fixes too (g_print tested) 2019-12-28 16:44:13 +01:00
ptitSeb 29c594ad6b And more wrapped gobject2 functions 2019-12-28 16:22:18 +01:00
ptitSeb ed52a461db Added a few more wrapped glib2 functions 2019-12-28 14:20:13 +01:00
ptitSeb 448313858e Added wrapped widget functions to gtk-2 2019-12-28 14:00:27 +01:00
ptitSeb 965cc02452 Added a buch of gobject wrapped functions 2019-12-28 13:18:30 +01:00
ptitSeb 2dc3a02623 Added g_source_new and friends to glib2 wrapped lib 2019-12-28 12:59:04 +01:00
ptitSeb 737df4b330 Added a bunch of gtk-2 wrapped functions 2019-12-28 12:20:17 +01:00
ptitSeb c8f66e72b9 Added most wrapped g_main_ functions to glib2 2019-12-28 12:04:14 +01:00
ptitSeb f9b121034f Added most wrapped list functions to glib2 2019-12-28 11:41:19 +01:00
ptitSeb 305002c295 Added most wrapped text_tag_table functions to gtk-2 2019-12-28 11:33:57 +01:00
ptitSeb 3ae728ddc2 Added wrapped gc function to gdk-2 2019-12-28 11:31:49 +01:00
ptitSeb f0b7b36aea Added wrapped colormap gdk-2 functions 2019-12-28 11:15:46 +01:00
ptitSeb dbeb70c08f Added wrapped option_menu functions to gtk-2 2019-12-28 11:01:10 +01:00
ptitSeb 7a8e911cf0 Added some wrapped pixbuff functions to gdk-x11-2 2019-12-28 10:59:01 +01:00
ptitSeb 9a560c2e95 Added wrapped tree_selection functions to gtk-2 2019-12-28 10:52:10 +01:00
ptitSeb befb826287 Added gtk_dialog_color_seelction wrapped functions to gtk-2 2019-12-28 10:45:27 +01:00
ptitSeb 9613686764 Added all wrapped _get_type functions to gtk-2 2019-12-28 10:42:47 +01:00
ptitSeb d4a2c50164 Added some tree_* wrapped function to gtk-2 2019-12-28 10:28:02 +01:00
ptitSeb e1b83d432a Added wrapped dialog functions to gtk-2 2019-12-28 10:13:13 +01:00
ptitSeb fc2ef2b5f1 Added adjustment_* wrapped functions to gtk-2 2019-12-28 10:05:30 +01:00
ptitSeb 24243ec0e4 Added most wrapped windows function to gdk-x11-2 2019-12-28 09:58:30 +01:00
ptitSeb 65ce48c2a1 Wrapped pango_context_* function in pango 2019-12-27 21:18:18 +01:00
ptitSeb 063968bd3a More wrapped tree view function in gtk-2 2019-12-27 21:13:01 +01:00
ptitSeb 0e9fea45fd Added wrapped text_iter function to gtk-2 2019-12-27 20:07:10 +01:00
ptitSeb ba10fdc2b7 Added x11 interaction wrapped function to gdk-x11-2 2019-12-27 19:45:15 +01:00
ptitSeb 4a9ced0854 Added wrapped pango function in gdk-x11-2 2019-12-27 19:24:26 +01:00
ptitSeb f1ef36a0e4 Added wrapped im_multicontext functions to gtk-2 2019-12-27 19:16:51 +01:00
ptitSeb 857b68a22c Added wrapped functions on layout to pango 2019-12-27 19:14:07 +01:00
ptitSeb acfd95c0e0 Added some more gtk wrapped functions (text_buffer stuff) 2019-12-27 18:51:03 +01:00
ptitSeb a57e4871a3 Added wrapped libgthread-2.0.so.0 (partial) 2019-12-27 18:26:31 +01:00
ptitSeb b5754732d9 Added a few more glib2 wrapped functions 2019-12-27 18:26:13 +01:00
ptitSeb d29f7d6ba8 Added some gtk wrapped list functions 2019-12-27 17:34:30 +01:00
ptitSeb bc928bb412 Removed duplicates from wrapped libncursesw (already in libtinfo) 2019-12-27 17:22:31 +01:00
ptitSeb 14de9efaff Added wrapped libtinfo, and moved symbols from libncursesw (mojosetup is happy now) 2019-12-27 17:01:45 +01:00
ptitSeb 2254ba15d3 Merge pull request #78 from rajdakin/master
Fixed the ncurses' ulong problem, added formw to the wrapped lib list
2019-12-27 16:32:03 +01:00
rajdakin 9318f7f596 Fixed the ncurses' ulong problem, added formw to the wrapped library list 2019-12-27 16:07:48 +01:00
ptitSeb 5d1fb26f15 Added 2 wrapped functions in libncursesw (still some issues) 2019-12-27 15:42:47 +01:00
ptitSeb e33df891a4 Merge pull request #77 from rajdakin/master
Added libncursesw to the wrapped libraries
2019-12-27 15:11:26 +01:00
rajdakin 243d185a44 Added libncursesw to the wrapped libraries 2019-12-27 15:08:10 +01:00
ptitSeb 7729dfa6c0 Added some pango wrapped functions 2019-12-27 14:51:21 +01:00
ptitSeb 120eb3271d Added a few more gtk wrapped functions 2019-12-27 14:35:57 +01:00
ptitSeb 7a9f4c2e50 Added most wrapped functions for libSM 2019-12-27 14:26:25 +01:00
ptitSeb eb2f60b8f6 More gtk wrapped functions 2019-12-27 13:41:27 +01:00
ptitSeb e63053ba48 Added some gtk window wrapped functions 2019-12-27 13:11:59 +01:00
ptitSeb bab12a3af3 Added some glib2 wrapped functions 2019-12-27 12:43:03 +01:00
ptitSeb 86f36deee7 Changed how GO2 define'd symbol resolved the alias name (searching all symbol if not found in current lib) 2019-12-27 12:42:43 +01:00
ptitSeb 15724a34f6 Added a few gdk wrapped functions 2019-12-27 11:26:19 +01:00
ptitSeb 33063f11b3 Added some more gtk wrapped functions 2019-12-26 23:10:18 +01:00
ptitSeb 415bcd544f Added a few wide char wrapped libc functions 2019-12-26 21:43:05 +01:00
ptitSeb 5409e8030b Added wrapped libXt (partial) 2019-12-26 21:30:06 +01:00
ptitSeb 16aba6c8bb Changed Test and install to use x86 libs 2019-12-25 11:54:17 +01:00
ptitSeb 026b2593bb Moved x86 libs to specific folder 2019-12-25 11:50:37 +01:00
ptitSeb 3e8e0ef0f3 Add libstdc++ and libgcc_s x86 binaries 2019-12-25 11:47:37 +01:00
ptitSeb a626c79b8b Update COMPILE.md 2019-12-24 11:48:57 +01:00
ptitSeb dc6dba42c4 Update COMPILE.md 2019-12-24 11:46:11 +01:00
ptitSeb b98f7a8459 Added a few more freetype wrapped functions 2019-12-23 15:14:10 +01:00
ptitSeb 4845ab0d40 Added some more wrapped function libpng12 (help BeatHazard) 2019-12-23 13:03:55 +01:00
ptitSeb 831fead5ed Added some freetype wrapped functions (should help Knytt Underground) 2019-12-23 12:04:03 +01:00
ptitSeb 658e2c4200 Added a few gobject wrapped functions 2019-12-23 11:44:16 +01:00
ptitSeb 83e4df1c79 Added a few libm and pthread wrapped functions 2019-12-23 11:06:20 +01:00
ptitSeb 125f204d58 Changed again (seriously, will it work perfectly one day) elf loader (fixing trine loading, checked with unreal, ut99, mohaa, worldofgoo, supermeatboy, superhexagon and limbo and it seems all is good) 2019-12-23 11:05:44 +01:00
ptitSeb 94a75a8e71 Added lib32 and x86 to implicit BOX86_LD_LIBRARY_PATH 2019-12-22 16:35:25 +01:00
ptitSeb 52412e8a23 Added barrier stuff in wrapped pthreads lib 2019-12-22 16:28:54 +01:00
ptitSeb f931db1c8d Added a few gio2 wrapped functions 2019-12-22 16:28:08 +01:00
ptitSeb 85363c677b Allow x8emu_t structure to be created on the stack 2019-12-22 16:16:28 +01:00
ptitSeb 7634447fda Even more wrapped functions from libpulse 2019-12-22 15:06:23 +01:00
ptitSeb 660d1e9ccd More wrapped function from libpulse 2019-12-22 14:06:14 +01:00
ptitSeb e73d0157df Refactored wrapped libpulse (seems better now) 2019-12-22 13:58:38 +01:00
ptitSeb 92ebb07369 Added many wrapped functions in glib2 around gvariant 2019-12-21 16:08:00 +01:00
ptitSeb ad19ca0f44 Added BOX86_X11THREADS env. var. 2019-12-21 15:13:15 +01:00
ptitSeb aacf835609 [DYNAREC] Added PEXTRW and improved PINSRW opcodes 2019-12-21 14:24:50 +01:00
ptitSeb 29690127d2 Added a few more emitter (and precised signed/unsigned) 2019-12-21 13:47:01 +01:00
ptitSeb 5da1de32f0 Added almost all libusb-1 wrapped functions 2019-12-21 13:15:20 +01:00
ptitSeb 98035453b8 Added a few more emitter 2019-12-21 13:15:02 +01:00
ptitSeb 2ef3c925db Added more wrapped gtk function 2019-12-21 11:27:59 +01:00
ptitSeb e671b8acfa More gtk wrapped functions 2019-12-21 11:10:54 +01:00
ptitSeb 58626e9c0b More gtk wrapped functions 2019-12-21 10:59:57 +01:00
ptitSeb 650ede22e0 More gtk wrapped function (and a few libc too) 2019-12-21 10:36:12 +01:00
ptitSeb a2648ce970 Merge branch 'master' of https://github.com/ptitSeb/box86 2019-12-21 10:18:00 +01:00
ptitSeb fdc587b964 Added more functions to wrapped libpulse 2019-12-21 10:16:22 +01:00
ptitSeb 537d447a28 Added empty wrapped libgudev-1.0 2019-12-21 00:07:13 +01:00
ptitSeb b8eb8d5b4e Added 2 more syscall (311 and 312) 2019-12-21 00:06:49 +01:00
ptitSeb 823dd8f6cc Added empty wrapped dbus-glib-1 2019-12-20 23:49:14 +01:00
ptitSeb 80ce6c091c Added empty wrapped libusb-1.0 2019-12-20 23:27:38 +01:00
ptitSeb ff740f4983 Fixed wrapped libfontconfig and FcAddPattern wrapped function 2019-12-20 23:18:14 +01:00
ptitSeb 5e16c59b72 Fixed wrapped libSM and libpulse 2019-12-20 23:17:51 +01:00
ptitSeb 4c0c6a4348 Lets just ignore int 3 instead of quit 2019-12-20 21:50:11 +01:00
ptitSeb 587f38be50 Wrapped a few libSM and libICE functions 2019-12-20 21:45:03 +01:00
ptitSeb 6e2f5b09f8 Added empty wrapped libSM.so and libICE.so 2019-12-20 21:09:20 +01:00
ptitSeb b238ab7c64 Added Profile for Pyra and RPI2/3/4. Also 'make install' is now possible 2019-12-20 19:42:12 +01:00
ptitSeb 6568138155 Changes wrapped libpulse to use hash map for callbacks 2019-12-20 11:32:47 +01:00
ptitSeb c167acd84c More functions wrapped in libpulse (but really, there are too many callback in this API) 2019-12-19 23:40:14 +01:00
ptitSeb cbd0d9b798 Added beggining of wrapped libpulse 2019-12-18 23:43:18 +01:00
ptitSeb 51902d0ec5 Fixed (again) wrapped libXtst lib 2019-12-18 23:07:54 +01:00
ptitSeb 1669f5d261 Fixed wrapped libXtst lib 2019-12-18 23:02:22 +01:00
ptitSeb 1b5500f7dd Added wrapped libXtst lib (almost complete, untested) 2019-12-18 22:55:26 +01:00
ptitSeb 3f273d4362 Added wrapped bz2 lib (complete but untested) 2019-12-18 22:32:02 +01:00
ptitSeb f540c20cde Added a few more gtk wrapped functions 2019-12-18 20:46:47 +01:00
ptitSeb 042c4f5935 Fixed 1 wrapped function in gdk-pixbuff (should help mojosetup) 2019-12-18 17:38:54 +01:00
ptitSeb 134f63ef59 Fixed psrad opcode with Interpretor 2019-12-18 15:14:54 +01:00
ptitSeb 731f12e114 Removed some harmless warnings 2019-12-18 15:07:28 +01:00
ptitSeb 2eea0b7f7d Added a few wrapped freetype functions 2019-12-18 09:08:39 +01:00
ptitSeb 1734916c7a [DYNAREC] Fixed 66 0F C4 PINSRW Gx,Ew,Ib Opcode (Fixing regression #76 on ShovelKight) 2019-12-17 22:26:50 +01:00
ptitSeb c83f1a2f3b Fixed 0F F2 PSLLD Gm, Em Opcode 2019-12-17 22:25:43 +01:00
ptitSeb 3497a9e081 [DYNAREC] Fixed (again, for good this time) 0F 6E MOVD Gm, Ed mmx opcode 2019-12-17 08:38:20 +01:00
ptitSeb cb133cef99 [DYNAREC] Fixed some ARM printer (VLD1_32/VST1_32) for logs 2019-12-17 08:37:38 +01:00
ptitSeb db2e6a23b8 [DYNAREC] Fixed another MMX instruction (and now Steam bootstrap does download its datas) 2019-12-17 00:02:45 +01:00
ptitSeb 469e8318ac Added more debug info to a gtk signal full wrapped function 2019-12-17 00:01:52 +01:00
ptitSeb 91bf052e7c Added a few xcb function (mostly unchecked) 2019-12-16 21:21:43 +01:00
ptitSeb f42c6ee7a3 Fixed (rarely used) PUSH/POP Segment (32bits with 0 padded segment value) 2019-12-16 21:21:04 +01:00
ptitSeb 395f734c46 Change box86.conf to point to /usr/local/bin/box86 2019-12-16 13:04:32 +01:00
ptitSeb a990273258 Added a bunch of gtk functions (not enough for Beathazard) 2019-12-15 22:37:56 +01:00
ptitSeb d05528ec5c Added a lot of wrapped libs, and now gtk2 mojosetup seems happy 2019-12-15 20:46:48 +01:00
ptitSeb 3770cc3a5f Remove a chance for bus error in dynarec, and added UD2 in interpretor 2019-12-15 19:51:31 +01:00
ptitSeb 143b5e8ec7 Added a few wrapped functions (libc and png12) and fixed XRRConfigSize (and now Knytt Underground works) 2019-12-15 14:17:08 +01:00
ptitSeb dfaa3d6e8a Some fixes to MMX and SSE opcodes 2019-12-15 13:42:10 +01:00
ptitSeb 9df95f96c2 Added 3 more wrapped functions (libc and sdl2) 2019-12-15 11:01:40 +01:00
ptitSeb 926f2f3dcd Fixed _IO_XXXX functions 2019-12-14 22:58:39 +01:00
ptitSeb d275fd3dba Try to wrap sf_open_virtual from sndfile lib 2019-12-14 21:50:05 +01:00
ptitSeb c986f8749d Also use LD_LIBRARY_PATH and PATH env. var. (the BOX86_ version have the priority) 2019-12-14 19:45:28 +01:00
ptitSeb 01f055ef31 Fixed some stupid typo in gtk-2 wrapped libs 2019-12-14 18:23:21 +01:00
ptitSeb 0b2ba32219 And some last work on gtk-2 wrapped lib (all function for mojo installer should be there now) 2019-12-14 18:03:41 +01:00
ptitSeb 79f2eb8f1e And a few more work on gtk-2 wrapped lib (almost there) 2019-12-14 17:44:33 +01:00
ptitSeb 5857eeb532 And even more work on gtk-2 wrapped lib 2019-12-14 17:16:05 +01:00
ptitSeb 714018b715 And more work on gtk-2 wrapped lib 2019-12-14 16:47:19 +01:00
ptitSeb bf2c2d4f3b More work with wrapped gtk-2 2019-12-14 16:05:34 +01:00
ptitSeb 80a4578bc3 Fixed CPUID leaf 7 2019-12-14 13:47:55 +01:00
ptitSeb 1e918f3226 Added and Fixed some MMX opcodes (including in Dynarec) 2019-12-14 12:32:02 +01:00
ptitSeb 51552f232e Added wrapped fontconfig library (partial) 2019-12-13 09:05:48 +01:00
ptitSeb 9ebc0463bf Added a few more SSE opcode (and Pier Solar boots now) 2019-12-13 08:31:11 +01:00
ptitSeb 8b6ce21884 Wrapped correctly XextAddDisplay 2019-12-13 00:12:31 +01:00
ptitSeb 3132398bae Fixed a crash when looking for a callback if it's NULL 2019-12-13 00:11:55 +01:00
ptitSeb ff8f50cbf8 Added crude version of FXSAVE and FXRSTOR 2019-12-13 00:08:52 +01:00
ptitSeb 15b0580133 Refactored a bit wrapped X11 lib 2019-12-12 23:04:28 +01:00
ptitSeb eced4f290a removed a warning in wrapped libdl 2019-12-12 23:04:10 +01:00
ptitSeb 8b6e6cfbe9 Added pshufb, another sse3 opcode 2019-12-12 20:29:07 +01:00
ptitSeb 3d46df6922 Fixed dependancies for wrapped dbusmenu-gtk library 2019-12-12 09:40:34 +01:00
ptitSeb 71604cf176 Added wrapped dbusmenu-gtk library 2019-12-12 09:35:53 +01:00
ptitSeb 1ad7a4f6ca Added PALIGNR opcode (in dynarec too) 2019-12-12 09:35:33 +01:00
ptitSeb 03be3e23d4 Added some dbus wrapped functions 2019-12-11 21:38:09 +01:00
ptitSeb 3d7ae93e6c Added wrapped libsndfile (but 1 function that contains callback needs better wrapping) 2019-12-10 23:59:21 +01:00
ptitSeb dc028adc56 Added a few more gtk function (and dwarf fortress runs now) 2019-12-10 23:19:37 +01:00
ptitSeb fc7740a4ce More wrapping around gtk (and some workaround for g_signal_connect_data signal callback) 2019-12-10 23:06:04 +01:00
ptitSeb 2b8b6ee5cc And more gtk-2 wrapped function. Still not enough to be somehow functionnal 2019-12-09 23:57:05 +01:00
ptitSeb 081388d4dc Added one more function to CPUID 2019-12-09 22:33:07 +01:00
ptitSeb 5259e8f122 Added more gtk wrapped functions 2019-12-09 22:17:15 +01:00
ptitSeb 39284057c8 Added wrapped fopencookie function 2019-12-09 21:54:43 +01:00
ptitSeb f9a072ada5 Added (mostly empty) wrapped gtk-2 2019-12-09 21:20:30 +01:00
ptitSeb bff5bdd5dc And a few more wrapped functions 2019-12-09 19:22:41 +01:00
ptitSeb 3f9d60238c Added 2 MMX opcodes, in DYNAREC too (because now, software seems to detect MMX and use it) 2019-12-09 07:38:48 +01:00
ptitSeb ae457d72c4 [DYNAREC] Small optimisation, to reduce time spent looking for next block 2019-12-08 22:57:36 +01:00
ptitSeb bd0e7b7f3f Fixed SDL2 Timer callback (and now Tales of Maj'Eyal boots) 2019-12-08 21:21:00 +01:00
ptitSeb a955c6ea7e Wrapped realpath so self point to emulated binary and not box86 (helps Tales of Maj'Eyal) 2019-12-08 21:08:36 +01:00
ptitSeb ce647c4f90 A few more libpng12 wrapped functions 2019-12-08 21:00:07 +01:00
ptitSeb 92ea53a218 Fixed CPU emulation of ID bit (now Lua Jit accept that emulated CPU) 2019-12-08 20:46:58 +01:00
ptitSeb b7a7dce80d And a new small batch of wrapped functions 2019-12-08 11:16:57 +01:00
ptitSeb b6b1667365 Added openal.so as synonym for openal.so.1 wrapped lib 2019-12-08 11:02:57 +01:00
ptitSeb def9166e43 Added __wprintf_chk wrapped function 2019-12-08 10:52:04 +01:00
ptitSeb 509fc59ede Added some wrapped functions (should help Star Ruler 2) 2019-12-08 09:57:15 +01:00
ptitSeb c5bfa7db40 Disable wrapped libmono for now, as wrapping is to incomplete 2019-12-08 09:18:46 +01:00
ptitSeb ca383864bb Improved a bit error callback handling in x11 (still some issues in Pier Solar) 2019-12-07 23:34:06 +01:00
ptitSeb 4d6ea9d8f9 Added 2 more wrapped function (and The Bard's Tale runs now) 2019-12-07 16:31:11 +01:00
ptitSeb 3859dcea09 Use syscall for file access in syscall instead of a mix of libc/syscall 2019-12-07 14:50:25 +01:00
ptitSeb 1c6f7071bf Better log on syscalls 2019-12-07 14:34:50 +01:00
ptitSeb bb0714b624 Made one emu context per signhandler 2019-12-07 13:51:20 +01:00
ptitSeb 992c530ed5 Also some Align work on SMPEG2 (still no sound in ATDeluxe intro) 2019-12-07 10:36:27 +01:00
ptitSeb 9376d776de Fixed some OggVorbis alignment functions, and fixed SMPEG that needed alignment too (fixed Loki Heroes 3) 2019-12-07 10:17:15 +01:00
ptitSeb 359e5a28c6 Don't reference _IO_2_1_stdXXX_ directly, that should fix build for some platform 2019-12-07 08:55:24 +01:00
ptitSeb 4262beb545 Made some change for software that use _IO_2_2_stdXXX_ (help Loki titles) 2019-12-06 22:32:00 +01:00
ptitSeb 20e3fb7d70 Improve wrapped SDL1 SDL_GetWMinfo function 2019-12-06 00:19:10 +01:00
ptitSeb cfc08dfea9 Added BOX86_LD_PRELOAD to load manualy some libraries 2019-12-05 23:36:40 +01:00
ptitSeb c288ac6514 Two new _IO_proc wrapped function to libc 2019-12-05 22:57:43 +01:00
ptitSeb 326c983bf1 Added wrapped msync function to libc 2019-12-05 22:34:43 +01:00
ptitSeb 073ebaadfc Small change in sys_select and sys_newselect syscalls 2019-12-05 21:52:07 +01:00
ptitSeb 250145530f Small Syscall improvements 2019-12-04 21:39:57 +01:00
ptitSeb 3eacb55dbc Added l and L in wrapper definition (to handle signed and unsigned long) 2019-12-04 14:45:20 +01:00
ptitSeb b1958a81a3 Changed Wrapper, to use K instead of L for faked long double (so L will be free to use for unsigned long) 2019-12-04 10:56:54 +01:00
ptitSeb e04324df79 Made SDL_VIDEO_GL_DRIVER a synonim of BOX86_LIBGL 2019-12-04 08:19:40 +01:00
ptitSeb d048d4964e Allow setting any OpenGL library (doesn't overload SDL_VIDEO_GL_DRIVER variable for SDL/SDL2 program) 2019-12-03 23:25:08 +01:00
ptitSeb 53b56ba123 Added some SDL2 and libc wrapped lib stuff (and now Torchlight2 boots) 2019-12-03 08:47:13 +01:00
ptitSeb 36dc893334 Added more _IO_XXXX wrapped function to libc 2019-12-02 22:01:03 +01:00
ptitSeb 470db114bd Added INSB and INSD (fake) opcodes 2019-12-02 21:56:15 +01:00
ptitSeb 8e02b0f75a Added a couple of syscall (nedded by smac) 2019-12-01 20:18:23 +01:00
ptitSeb 2950c0b8dc Added some old pthread stuff (and now sc3ku 2.0 works) 2019-12-01 19:55:32 +01:00
ptitSeb d03f420b92 Added a few more pulse symbols in pulse-simple wrapped lib 2019-12-01 19:08:12 +01:00
ptitSeb f005e269c9 Added a few more wrapped function for libc and pthread (helps MB: Warband) 2019-12-01 18:00:20 +01:00
ptitSeb d5cd2b009b Move, again, position where box86 load (should help big program) 2019-12-01 17:45:05 +01:00
ptitSeb dd8c5a3b81 Added a mecanism to unload/reload lib with dlclose/dlopen (and now, mohaa can change map) 2019-12-01 17:38:45 +01:00
ptitSeb 3f0a82503f Added a few libc wrapped functions 2019-12-01 17:38:14 +01:00
ptitSeb c82927f841 And rechanged a bit elf symbol resolution/relocation (mohaa still works, unreal works again, nothing seems broken now) 2019-12-01 12:27:42 +01:00
ptitSeb 213f5bf616 Changed loading address of box86, to be < 0x80000000 (this fixed mohaa loading crash) 2019-12-01 00:04:04 +01:00
ptitSeb 87f5f26ecb Changed (again...) a bit how symbol are loaded in elfloader (this fix mohaa loading hang) 2019-12-01 00:03:18 +01:00
ptitSeb ec49241cef Some fix to a few libc wrapped functions 2019-11-30 18:27:49 +01:00
ptitSeb 14f1a8f17b Added some libm,libc and pthread wrapped function, and fixed execvp 2019-11-30 12:22:30 +01:00
ptitSeb aee17dc28a Added a few pulse function in pulse-simple wrapper (may help Warband) 2019-11-30 11:46:05 +01:00
ptitSeb 5828e5a5a7 Added some vorbis/ogg function, and fixed align/unalign of OggVorbis_File struture (that fixes SuperHexxagon) 2019-11-30 11:36:52 +01:00
ptitSeb 6d13315fdb Corrected a typo in wrapped libx11 2019-11-29 11:29:21 +01:00
ptitSeb 75f224ccf8 [DYNAREC] Fixed xchg Reg, Reg on same register (helps steam) 2019-11-28 22:52:20 +01:00
ptitSeb 85646182e0 Fixed a small memory leak 2019-11-27 05:50:58 +01:00
ptitSeb 17654cfe24 Added more slot to NextWireToEvent and NectEventToWire X11 functions 2019-11-26 08:05:26 +01:00
ptitSeb 5286f42314 [DYNAREC] Added a few more 66 0F opcodes 2019-11-25 21:50:14 +01:00
ptitSeb ae9bb4e1c5 Merge branch 'master' of https://github.com/ptitSeb/box86 2019-11-25 20:57:33 +01:00
ptitSeb 77f041505b Fixed a bug in 66 0F opcodes that could have affected many SSE/SSE2 programs 2019-11-25 20:57:17 +01:00
ptitSeb 6d5487da24 Added syscall 164 2019-11-25 10:32:23 +01:00
ptitSeb e4738ab016 Fixed compilation issue on x86 platform 2019-11-25 10:29:44 +01:00
ptitSeb 10d830aba1 Added binfmt box86.conf template 2019-11-25 06:20:20 +01:00
ptitSeb 62e97c8a3e Added syscall 76 2019-11-24 23:57:30 +01:00
ptitSeb 83e9d4606a More changes on TLS data handling 2019-11-24 22:50:49 +01:00
ptitSeb d496fd8977 Fixed some issue when loading a lib after initial load that contains TLS data 2019-11-24 18:56:32 +01:00
ptitSeb f008a397d0 Changed a bit execv so calling x86 binary will use box86 automaticaly 2019-11-24 11:14:39 +01:00
ptitSeb d7c636cf23 [DYNAREC] Optimized (again) how geted works 2019-11-23 23:51:17 +01:00
ptitSeb 2094122541 [DYNAREC] Small optim wgen using cmp against #0 2019-11-23 14:51:03 +01:00
ptitSeb 5b0769fba3 [DYNAREC] Various small fixes and optims 2019-11-23 13:19:52 +01:00
ptitSeb 5323837c32 Changed how RDTSC instruction is done, using clock_gettime (old method with gettimeofday still available) 2019-11-23 12:50:52 +01:00
ptitSeb ade0289e63 FIx an potential issue with __vsprintf_chk wrapped function 2019-11-23 10:08:04 +01:00
ptitSeb 156e45d5a2 Some changes and improvments in some syscalls (mainly around signal handling, but still not enough to be able to run mugen) 2019-11-22 23:15:00 +01:00
ptitSeb 2d47c5502d Some improvements in syscalls (but not enough to run un-upx'd mugen) 2019-11-21 09:04:39 +01:00
ptitSeb 2c963e4e63 Added support for elf with no header section (load upx files, but it wont decompress them yet) 2019-11-20 08:20:47 +01:00
ptitSeb fd890a2eba Try to add pa_strerror function is wrapped pulse-simple 2019-11-19 22:56:54 +01:00
ptitSeb 04df667d0c Some more libc wrapped function (for ut99) 2019-11-19 08:11:00 +01:00
ptitSeb 1853a0f11c Some fixes to Data symbol from native that were not always found 2019-11-19 07:56:05 +01:00
ptitSeb f53f22f53b Made x11 lib access a bit faster 2019-11-19 07:55:19 +01:00
ptitSeb 08d3239129 Made default stack 8Mb 2019-11-19 00:18:32 +01:00
ptitSeb d4b9134bee Some more old functions wrapped (more are needed for Loki SimCity3000 Unlimited) 2019-11-18 08:20:44 +01:00
ptitSeb fce200380c Some syscall and dynarec changes to accomodate SC3k Loki install 2019-11-17 23:29:43 +01:00
ptitSeb a6c82cce5a [DYNAREC] Added DIVPS, SQRTSS and SQRTSD opcodes 2019-11-17 19:33:46 +01:00
ptitSeb 09a1fa0dac [DYNAREC] Added PACKSSDW, PACKUSWB, PCMPGTW and PCMPGTB (helps Desperado) 2019-11-17 18:42:12 +01:00
ptitSeb 7b2064fcd8 [DYNAREC] Added PSHUFLW and PSHUFHW opcodes 2019-11-17 18:06:30 +01:00
ptitSeb d0f19c9378 Added libGL.so in the list a wrapped lib (same as libGL.so.1) 2019-11-17 14:11:20 +01:00
ptitSeb 0c48bc2293 Added a fake IN EAX, Ib opcode 2019-11-17 14:10:41 +01:00
ptitSeb e1efc1682b Added some partial support for XESetWireToEvent and XESetEventToWire (should help descent3 loki demo) 2019-11-17 12:58:03 +01:00
ptitSeb fc1dac64d3 Added a slot for arg[0]... 2019-11-17 12:57:27 +01:00
ptitSeb b1c1558aa3 Added a buch of old syscall (used by some Loki installer) 2019-11-17 11:50:55 +01:00
ptitSeb caee60d13b Added alternate name for libSDL2-2.0.so.0 and libsdl2-2.0.so.0 2019-11-17 10:01:02 +01:00
ptitSeb 26405c2da6 Added a Video using the Dynarec on the readme (needs to do more of them) 2019-11-16 22:12:15 +01:00
ptitSeb 78cb58b146 Fixed a warning 2019-11-16 22:01:21 +01:00
ptitSeb 3a4c2e5b65 Merge pull request #73 from ptitSeb/dynarec
Dynarec
2019-11-16 21:39:11 +01:00
ptitSeb 0b08c51036 [DYNAREC] Add some MMX opcodes (used by fmodex) 2019-11-16 21:05:01 +01:00
ptitSeb 2837f63312 Added real implementation for dl_iterate_phdr (still partially implemented, but enough to run Unreal) 2019-11-16 17:51:46 +01:00
ptitSeb 2119fd8dd3 Added some stuff to ChangeLog 2019-11-16 17:51:00 +01:00
ptitSeb 6e2a7cd0ab [DYNAREC] Added RDTSC opcode 2019-11-16 15:04:43 +01:00
ptitSeb a1b997966e Fix building on non-dynarec 2019-11-16 14:38:59 +01:00
ptitSeb 11c374a4b3 Added a test for swapcontext and friends 2019-11-16 13:55:46 +01:00
ptitSeb 577c5ac45b Added real support for getcontext / setcontext / makecontext and swapcontext (and now DotT Remastered wboots) 2019-11-16 13:52:25 +01:00
ptitSeb 3110ed8df7 Added 2 wrapped functions needed by Eets 2 2019-11-16 11:04:15 +01:00
ptitSeb 421d33772b Added libpulse-simple wrapper (no libpulse for now) 2019-11-15 23:55:11 +01:00
ptitSeb c7366c2e5c [DYNAREC] Fixed SAR for 8 and 16bits (fixed some carts in ZSNES and, at last, The Profile Save bug in WorldOfGoo) 2019-11-15 21:43:11 +01:00
ptitSeb bb59140a06 More Thread hacking, needed by Guacamelee: this need to be uderstood and done a bit better, the hack is very crude for now 2019-11-14 00:06:58 +01:00
ptitSeb 0a89b2777a Removed wrapper.h dependancy also from bridge.h 2019-11-14 00:06:09 +01:00
ptitSeb 4ae0ef5f0d Hacked some Thread function to avoid thread creation failure on arm (fixed Guacamelee) 2019-11-13 23:17:15 +01:00
ptitSeb 475a3374d9 Change comment on Mix_RegisterEffect, but still no support for it 2019-11-13 23:02:43 +01:00
ptitSeb 13a0943ce8 Added a few more wrapped functions (will help Guacamelee later) 2019-11-12 22:52:38 +01:00
ptitSeb 11de135dbe Removed dependancy of wrappers.h from bridge_private.h 2019-11-12 22:51:46 +01:00
ptitSeb 55a4d96814 [DYNAREC] removed obsolete comment 2019-11-12 22:51:09 +01:00
ptitSeb f3fdd52c2a [DYNAREC] Fixed 2 issues with flags (that fixes zsnes, but still not the profile saving of WorldOfGoo) 2019-11-11 23:30:45 +01:00
ptitSeb 04fcdbb989 [DYNAREC] Small change on an unused functionality of get_ed 2019-11-11 23:26:37 +01:00
ptitSeb b6882e4c8b Added another form of MOV Seg, Ew 2019-11-11 23:25:39 +01:00
ptitSeb c18ae816e9 [DYNAREC] And a few more opcodes added 2019-11-10 12:44:07 +01:00
ptitSeb fefc0383b8 [DYNAREC] Added BSR/BSF 32 and 16 bits opcodes 2019-11-10 11:37:59 +01:00
ptitSeb 453c26d648 [DYNAREC] added a new batch of opcodes 2019-11-10 10:32:51 +01:00
ptitSeb eb32c93750 Added Mov Seg, Reg opcode (zsnes seems to run now) 2019-11-10 09:04:50 +01:00
ptitSeb d9907f1e88 [DYNAREC] Fixed LAHF opcode (that didn't fixed WorldOfGoo profiles issue) 2019-11-10 09:04:16 +01:00
ptitSeb 29706f815b Fixed SDL1 RWops that were partly broken since last refactor 2019-11-09 13:36:28 +01:00
ptitSeb 777d20651e [DYNAREC] Added a few more 66 0F opcode (this somefixes fixes #2 on the Pandora) 2019-11-09 12:34:30 +01:00
ptitSeb c62448e866 Merge pull request #72 from icecream95/png
Add some png functions for glmark2
2019-11-09 09:35:13 +01:00
Icecream95 eabe18ba6f Add some png functions for glmark2 2019-11-09 18:21:14 +13:00
ptitSeb 2bbc33bf0d Reworked TLS handling (and now Arkos Tracker 2 seems to load file) 2019-11-08 22:40:18 +01:00
ptitSeb 36f1c54dbf Merge pull request #70 from slock83/dynarec
Added required flags in CMakeLists for dynarec compilation
2019-11-07 18:23:53 +01:00
Anthony Rossi 0ce8b2321c Made a new gameshell target 2019-11-07 18:20:11 +01:00
ptitSeb f5668cce2c More libc wrapped function from @icecream95 2019-11-06 21:41:07 +01:00
ptitSeb c75d658238 change wrapped XInitImage to Bridge the callback function inside the XImage 2019-11-06 07:54:45 +01:00
ptitSeb 718ceacee6 Merge pull request #71 from icecream95/arkos
Add some wrapped functions for Arkos Tracker 2
2019-11-06 07:45:29 +01:00
Icecream95 1444cf979d Add some wrapped functions for Arkos Tracker 2 2019-11-06 18:21:30 +13:00
ptitSeb de4ae72ed7 Use similar code for SDL1.2 RWops than SDL2 RWops, and added smpeg 0.4 wrapped lib 2019-11-05 22:51:27 +01:00
ptitSeb 57fa84f9e7 Removed a warning on pthread_mutexattr_settype undefined 2019-11-05 19:53:14 +01:00
Anthony Rossi 7df5001472 Added required flags in CMakeLists for dynarec compilation 2019-11-05 19:03:26 +01:00
ptitSeb f1e049e8be New fix for the O_ flag convert (and thanks again @icecream95 for all the findings and testing on this) 2019-11-05 09:20:49 +01:00
ptitSeb f664797a36 Added a few more wrapped function (and now, Heretic 2 v1.06c works) 2019-11-05 09:15:33 +01:00
ptitSeb 7bb7c5747a Change previous commit, because it's not AT_ flags but O_ flags that needs convert 2019-11-05 08:50:54 +01:00
ptitSeb aad4c91e01 Try some workaround for AT_ constant not beeing indentical between x86 and ARM (solution is too ARM specific for now, a more generic one need to be done) 2019-11-05 08:23:51 +01:00
ptitSeb 9dc1f02d06 Some opcodes and functions (and now Heretic 2 starts, at least in software mode) 2019-11-05 00:39:46 +01:00
ptitSeb 59be622226 [DYNAREC] Added Compilation help in COMPILE.md 2019-11-05 00:00:47 +01:00
ptitSeb 30cecc7694 Added some check to avoid a crash when tracing __open with a NULL parameter 2019-11-04 23:57:04 +01:00
ptitSeb 18237cbfd9 Added some syscall (so Heretic 2 old text mode installer seems to works) 2019-11-04 23:36:08 +01:00
ptitSeb b4a98f67ee Added 2 libc wrapped functions 2019-11-04 10:41:53 +01:00
ptitSeb 2fef0f9652 [DYNAREC] Fixed FIST(T)(P) on 16bit value 2019-11-04 09:43:47 +01:00
ptitSeb 48c3f927eb [DYNAREC] Try to not mix NEON and VFPU VMOV opcodes 2019-11-03 23:32:04 +01:00
ptitSeb b6e9acc3c3 [WRAPPER] Improved generated dependancy handling again, so _private.h file also trigger a rebuild 2019-11-03 21:12:03 +01:00
ptitSeb 0b74e623d9 [DYNAREC] Fix build system to handle Wrapper dependancy correctly 2019-11-03 20:55:56 +01:00
ptitSeb 88b2d7933b Added a few more Wrapped function (Cook, Serve, Delicious is happy now) 2019-11-03 19:28:59 +01:00
ptitSeb 1b97a18d17 [DYNAREC] Fix rounding for FIST(P) to int32 opcode (Fix HollywoodPlayer) 2019-11-03 10:48:49 +01:00
ptitSeb 2279bc7187 [DYNAREC] Fixed FSCALE opcode (fixing sound and music in Broken Sword 1) 2019-11-02 22:54:35 +01:00
ptitSeb d1903570de [DYNAREC] Fixed emitter for STREXD (should fix Broken Sword 1, among other things) 2019-11-02 22:10:31 +01:00
ptitSeb 92c947e419 [DYNAREC] Added an hidden (for now) option to enable Dynarec on all address (not recomended) 2019-11-02 21:07:41 +01:00
ptitSeb 34061ad32c [DYNAREC] Added MOVHPD opcodes 2019-11-02 19:43:02 +01:00
ptitSeb a1e639dce5 [DYNAREC] Added CVTPD2PS opcode 2019-11-02 16:52:30 +01:00
ptitSeb a29da7ee6a [DYNAREC] Fixed one FISTP that was not restaoring rounding state correctly 2019-11-02 16:52:05 +01:00
ptitSeb 1e8291c3ed [DYNAREC] Added CMPPS and MOVDDUP opcodes 2019-11-02 16:28:55 +01:00
ptitSeb d7d3bcc868 [DYNAREC] Added FISTTP i64, ST0 opcode 2019-11-02 15:16:34 +01:00
ptitSeb a9c45098c7 [DYNAREC] Added push/pop DS/ES and 8bits value as 16bits 2019-11-02 15:01:26 +01:00
ptitSeb 10b1dbefd2 [DYNAREC] Small changes in Linker 2019-11-02 14:44:46 +01:00
ptitSeb 0df5881023 [DYNAREC] Improved cmp/test inlined version, and fixed imul16 opcode 2019-11-02 14:20:26 +01:00
ptitSeb 93c945b2c8 [DYNAREC] Fixed SAR Ed, 1 opcode (and NWN starts again) 2019-11-02 13:57:31 +01:00
ptitSeb 8782441b86 [DYNAREC] Added imul16 inlined version 2019-11-02 11:27:53 +01:00
ptitSeb ab8edf9bec [DYNAREC] Improved a bit D1 and D3 opcode by splitting the code 2019-11-02 11:27:30 +01:00
ptitSeb 2e5b11af1d [DYNAREC] Aligned start of block, to easy debugging a bit 2019-11-02 00:34:44 +01:00
ptitSeb 2e6ea6018e [DYNAREC] Fixed B_MARK macro 2019-11-02 00:33:59 +01:00
ptitSeb f84871cf01 [DYNAREC] Used LDREXD/STREXD to update table jump of linker, and avoid issue with concurent access 2019-11-01 22:02:44 +01:00
ptitSeb 9648517b15 [DYNAREC] And added test32 / test16 / test8 too 2019-11-01 18:51:32 +01:00
ptitSeb 008f612c08 [DYNAREC] Added a dynarec verison of cmp32, cmp16 (still unused) and cmp8 2019-11-01 17:30:56 +01:00
ptitSeb 9bd2a19901 [DYNAREC] Changed how x87 save S32 and S16, should be better 2019-11-01 13:38:11 +01:00
ptitSeb ce8c82042a [DYNAREC] Refactored x87 opcode that used CALL, to avoid purge of all FPU cache 2019-11-01 11:01:03 +01:00
ptitSeb 1310eba02c [DYNAREC] Refactor FPU reg allocation, that is now dynamic for x87 and sse 2019-11-01 09:12:31 +01:00
ptitSeb 2e2b4d4e08 [DYNAREC] Some changes to prepare next refactor on FPU reg, to have dynamic allocation for both x87 and SSE (and MMX when it will be added) 2019-10-31 20:38:55 +01:00
ptitSeb 41bbdca01d [DYNAREC] Fixed Direct Mapping of blocks, that was not always working correctly (espacially for libs) 2019-10-31 08:34:39 +01:00
ptitSeb 0acd350d7f [DYNAREC] Fixed an issue with MOVLPS Gx, Ex (Not a Hero start now) 2019-10-30 22:17:24 +01:00
ptitSeb e7216d42aa [DYNAREC] Added a few more instruction (Risk of Rain works, but a bit slow ingame. Not a Hero crash after selecting language) 2019-10-30 22:03:30 +01:00
ptitSeb 3b33059900 [DYNAREC] A new batch of fixes and improvments (and now FTL runs, and with good speed) 2019-10-30 21:08:18 +01:00
ptitSeb 4c671d9d85 [DYNAREC] This should fix / improved a few things (but FTL still have some issue, main menu is now missing backgound picture and music) 2019-10-30 19:00:06 +01:00
ptitSeb 5004a5f482 [DYNAREC] Fixed a bunch of issue (FTL doesn't crash anymore, but the text in loading screen is still missing) 2019-10-30 09:11:13 +01:00
ptitSeb daab23978b [DYNAREC] Changed the way Dynablocks are allocated and searched, reducing CPU (at the cost of memory footprint) used to search blocks 2019-10-30 07:48:04 +01:00
ptitSeb 6e0d8e000b Don't cleanup Callback for now 2019-10-29 18:47:21 +01:00
ptitSeb 5dc5aeabb8 Bump version, will be 0.1.0 when Dynarec will be mostly complete 2019-10-29 18:47:00 +01:00
ptitSeb faf52f39b5 Extract '.text' for latter use 2019-10-29 18:46:32 +01:00
ptitSeb 5f173bf10a [DYNAREC] Added a few more F2 0F SSE2 opcodes 2019-10-29 08:30:44 +01:00
ptitSeb 14b13b7074 [DYNAREC] Fixed PMULUDQ to used unsigned VMULL (fixing sound in Memoranda) 2019-10-29 08:06:59 +01:00
ptitSeb a84d4f4fa0 [DYNAREC] Fixed some limit usecase of PSRL(D/Q) opcode (but Memoranda sound is still partly broken) 2019-10-28 23:57:49 +01:00
ptitSeb f0b49dfce4 [DYNAREC] Added a new batch of SSE/SSE2 opcodes (UNDERTALE is happy now, at least until the title screen) 2019-10-28 22:46:03 +01:00
ptitSeb a199873854 [DYNAREC] Added more 66 0F SSE/SSE2 opcodes 2019-10-28 20:53:50 +01:00
ptitSeb 0257cbaa14 [DYNAREC] Added a few more 0F opcodes 2019-10-28 18:53:17 +01:00
ptitSeb 73cb0c9ee5 [DYNAREC] Some more SSE/SSE2 opcodes 2019-10-28 15:42:29 +01:00
ptitSeb f754b6269e [DYNAREC] Added UNPCKLPS and UNPCKHPS opcodes 2019-10-27 15:49:19 +01:00
ptitSeb 22c0ae5a49 [DYNAREC] Added a few more opcode, and fixed fpu scratch register helper 2019-10-27 15:14:30 +01:00
ptitSeb 1b23f36ecd [DYNAREC] And a few more SSE opcodes 2019-10-27 11:19:33 +01:00
ptitSeb 35c60d2a11 [DYNAREC] Added a bunch of SSE opcodes 2019-10-27 10:58:25 +01:00
ptitSeb 828fb05d52 [DYNAREC] Added some F3 0F opcodes 2019-10-27 09:51:53 +01:00
ptitSeb fb983c53bf [DYNAREC] Added MOVDQU and XORPS opcodes 2019-10-26 20:33:27 +02:00
ptitSeb 08ef7aa5a0 [DYNAREC] Added POR opcode 2019-10-26 18:56:37 +02:00
ptitSeb 9ac85482ca Added PANDN opcode 2019-10-26 18:52:38 +02:00
ptitSeb 189915f200 [DYNAREC] Added PSRLD and PSRAD opcodes 2019-10-26 18:43:09 +02:00
ptitSeb d68a9cd996 [DYNAREC] Added PCMPEQD opcode 2019-10-26 18:15:33 +02:00
ptitSeb 1a8fd4a979 [DYNAREC] Added PAND opcode 2019-10-26 18:02:49 +02:00
ptitSeb b45c92cf98 [DYNAREC] Fixed VADD(Q) emitte and printer 2019-10-26 17:36:15 +02:00
ptitSeb 11b3d62d16 [DYNAREC] Push/Pop SSE Cache when calling a C function 2019-10-26 17:04:03 +02:00
ptitSeb a46ad1e66e [DYNAREC] Added PADDD opcode 2019-10-26 16:46:08 +02:00
ptitSeb 970135e098 [DYNAREC] Added PSHUFLD opcode 2019-10-26 15:19:04 +02:00
ptitSeb ccec11c059 [DYNAREC] Added a MOVD opcode 2019-10-26 11:44:24 +02:00
ptitSeb 40412a5257 [DYNAREC] Added PXOR opcode 2019-10-25 16:31:29 +02:00
ptitSeb dc07f8666b [DYNAREC] Added MOVDQA opcode 2019-10-25 15:55:58 +02:00
ptitSeb d622dba733 [DYNAREC] Fixed BOX86_DYNAREC_LOG env var 2019-10-25 14:35:09 +02:00
ptitSeb 1dd9c2dddf [DYNAREC] Added DIVSD opcode 2019-10-25 11:46:04 +02:00
ptitSeb 979f49a8b9 [DYNAREC] Added a few more SSE opcodes 2019-10-25 11:40:49 +02:00
ptitSeb 9a11ee556c [DYNAREC] Added ADDSD and MULSD and fixed CVT SI to/from SD 2019-10-24 11:04:44 +02:00
ptitSeb 192b9b8f60 [DYNAREC] Added PUNPCKLQDQ and CMOVxx Gw, Ew 2019-10-24 10:28:25 +02:00
ptitSeb d6485f88fd [DYNAREC] Fixed LODSW and MOVAPS opcodes 2019-10-24 10:13:44 +02:00
ptitSeb bbce797c14 [DYNAREC] Added a 1st SSE opcode 2019-10-24 00:27:03 +02:00
ptitSeb e978d42834 [DYNAREC] Added some NEON infrastructure for SSE 2019-10-23 23:41:12 +02:00
ptitSeb 2d9b5d0f20 [DYNAREC] Some refactoring around VFPU/NEON register, paving to way to SSE/SSE2 2019-10-23 22:17:22 +02:00
ptitSeb 37d2c4ec22 [DYNAREC] fixed IP for CPUID opcode 2019-10-23 21:35:48 +02:00
ptitSeb 4b60120754 [DYNAREC] Added MOSW/STOSW/SCASW/CMPSW/LODSW opcodes 2019-10-23 21:33:57 +02:00
ptitSeb 02ff4614a2 [DYNAREC] Added CPUID, and refactored a bit to avoid useless re-compilaiton when adding a function to dynarec_arm_functions 2019-10-23 21:17:43 +02:00
ptitSeb a0b15aa6c2 Added one more test, not yet integrated in cmake 2019-10-23 20:25:08 +02:00
ptitSeb ca21c41bfc [DYNAREC] Added 2 x87 opcodes 2019-10-23 20:24:41 +02:00
ptitSeb 0591033231 [DYNAREC] Added 2 more adc/sbb 8bits opcodes 2019-10-23 08:19:54 +02:00
ptitSeb c984423c4d {DYNAREC] Fixed issue with LEA reg, [reg-0x80000000] Opcode 2019-10-23 01:08:09 +02:00
ptitSeb 805397b530 [DYNAREC] Added epilog for instructions, to help handling barriers 2019-10-21 22:03:41 +02:00
ptitSeb 394c1bd571 Added 2 more function to SDL2 so VVVVV runs now 2019-10-21 21:59:43 +02:00
ptitSeb c1a016baad [DYNAREC] Fixed opcode F3 C3 that also needs a Barrier (fixes Maldita Castilla) 2019-10-21 00:38:02 +02:00
ptitSeb c667bbcaa6 [DYNAREC] To avoid bus error on some games (like NWN) 2019-10-20 22:03:05 +02:00
ptitSeb 38e7165433 [DYNAREC] Fixed the Call 0 / pop reg hack (and now NeverWinterNight boots again) 2019-10-20 22:02:41 +02:00
ptitSeb e02a8a63e4 [DYNAREC] Fixed an issue with the Barrier optimization (that fix AsciiSector that was broken for some timme) 2019-10-20 19:27:05 +02:00
ptitSeb 420d6e6648 [DYNAREC] Assorted fixed and small improvements. SuperMeatBoy runs again, but WorldOfGoo still don't s't save it's persistant data correctly 2019-10-20 17:16:57 +02:00
ptitSeb a78380a3b4 [DYNAREC] Finished some leftover in local branch refactoring 2019-10-20 08:11:52 +02:00
ptitSeb fe7c2bd388 [DYNAREC] Added one more FLD wrapped function 2019-10-19 19:06:52 +02:00
ptitSeb 930f7ce973 [DYNAREC] Various small changes to try get the Hash for blocks more efficient 2019-10-19 18:17:28 +02:00
ptitSeb 9f0ad317ad [DYNAREC] For now, don't push/pop d8-d15, to save a bit of time 2019-10-19 16:49:17 +02:00
ptitSeb 1a95ca5065 [DYNAREC] Added a few more x87 opcodes 2019-10-19 16:39:17 +02:00
ptitSeb 5b912fd9b3 [DYNAREC] Created (and applied) a macro helper for local branch 2019-10-19 15:37:02 +02:00
ptitSeb ec1ddbd646 [DYNAREC] Added (LOCK) CMPXCHG8b opcode 2019-10-19 15:05:28 +02:00
ptitSeb 8e4fbe58b5 [DYNAREC] Added (LOCK) XADD 8b and 32b 2019-10-19 14:47:34 +02:00
ptitSeb 544e8fb582 [DYNAREC] Added (LOCK) CMPXCHG 8b and 32b opcodes 2019-10-19 14:34:26 +02:00
ptitSeb bd7c19520d [DYNAREC] Added some LOCK: opcodes 2019-10-19 14:03:40 +02:00
ptitSeb 74817f6959 [DYNAREC] Fixed a typo in last refactoring 2019-10-19 14:03:23 +02:00
ptitSeb 6d6d548284 [DYNAREC] Factorised LOCK/UNLOCK for later use in F0 prefix 2019-10-19 13:42:19 +02:00
ptitSeb 4104d6c128 [DYNAREC] Small refactoring on opcode generators 2019-10-19 13:08:12 +02:00
ptitSeb 312e9c7634 [DYNAREC] Added Int 32 bits x87 opeations opcodes 2019-10-19 12:10:30 +02:00
ptitSeb a427be2390 [DYNAREC] Added FCMOVxx opcodes 2019-10-19 12:00:07 +02:00
ptitSeb 33215027e6 [DYNAREC] Added FRNDINT opcode (not sure if perfect) 2019-10-19 10:44:08 +02:00
ptitSeb 9ed1be3632 [DYNAREC] Added FCHS/FABS/FSQRT opcode 2019-10-19 10:18:03 +02:00
ptitSeb 23d4759e16 [DYNAREC] Fixed FCOMI/FCOMIP that weren't setting flags properly (WorldOfGoo works again) 2019-10-19 10:05:49 +02:00
ptitSeb 239acd0733 [DYNAREC] Added FCOMI/FCOMIP and FNSTSW 2019-10-18 23:52:25 +02:00
ptitSeb cdd830c256 [DYNAREC] Improved VCMP printer 2019-10-18 23:51:53 +02:00
ptitSeb f5f5a7533f [DYNAREC] Added VCMP printer 2019-10-18 23:49:29 +02:00
ptitSeb a87c542d6b [DYNAREC] Added FCOM/FCOMP/FUCOM/FUCOMP 2019-10-18 22:57:03 +02:00
ptitSeb 2470905bf8 [DYNAREC] Try to implement a hot block detection to get them local dynablock hash 2019-10-18 21:28:37 +02:00
ptitSeb d1d67b4cf5 [DYNAREC] Added MOVZX/MOVSX Gw, Eb 2019-10-18 19:51:23 +02:00
ptitSeb c010c899b7 [DYNAREC] Added more x87 opcodes (DC series) 2019-10-18 19:45:27 +02:00
ptitSeb 57f1bb36ea [DYNAREC] Made callback to also use Dynarec 2019-10-18 18:44:34 +02:00
ptitSeb 8637c3a8cf [DYNAREC] Added FDIV/FDIVR opcodes 2019-10-18 18:43:59 +02:00
ptitSeb e431c5f4e1 [DYNAREC] Fixed FILD ST0, Ew (and now Castilla Maldita runs fine) 2019-10-18 18:43:22 +02:00
ptitSeb 84e175b265 [DYNAREC] Added some function to help debugging 2019-10-18 18:42:37 +02:00
ptitSeb 34facb1bd4 [DYNAREC] Samll improvements for debugging in-dynarec Native Call and linker effeciancy (Maldita Castila still have issues) 2019-10-18 17:12:44 +02:00
ptitSeb 710d8b311c [DYNAREC] Allow small NativeCall block to be created, even if not in Elf memory 2019-10-18 13:43:35 +02:00
ptitSeb efa5701654 [DYNAREC] So this is still needed (issue can be ssen on pico8 0.11 with disapearing menu in splore) 2019-10-18 13:42:21 +02:00
ptitSeb 2b3ececc3f [DYNAREC] A large bunch of x87 fixes. Now dynarec can run correctly on the (still incomplete) x87, making some speed boost in some cases (like the loading of FTL that is 10x faster now) 2019-10-18 13:11:44 +02:00
ptitSeb eec37508f4 [DYNAREC] Added some Float to Integer opcode (complicated, but seems ok). Still some odd behavour when switching from dynarec to interpretor 2019-10-17 23:46:41 +02:00
ptitSeb dd7f508a91 [DYNAREC] Added FSUB and FSUBR opcodes 2019-10-17 17:59:01 +02:00
ptitSeb d05db1c8d4 [DYNAREC] Some small optim in x87 Cache purge 2019-10-17 17:52:41 +02:00
ptitSeb ef534db878 [DYNAREC] Added some FLD and fixed stack not always updated correctly 2019-10-17 17:39:26 +02:00
ptitSeb 48b4b3d4ae [DYNAREC] Fixed some VCVT print 2019-10-17 17:38:51 +02:00
ptitSeb a15c4771c8 [DYNAREC] Added more FADD opcodes 2019-10-17 17:09:38 +02:00
ptitSeb fc929f622b [DYNAREC] Added an FADD opcode 2019-10-17 17:05:00 +02:00
ptitSeb 707be246e9 [DYNAREC] Optim on stack managment, plus a bunch of fixes and more FMUL opcodes 2019-10-17 16:56:22 +02:00
ptitSeb 3eee490042 [DYNAREC] added a FMULP opcode 2019-10-17 15:44:24 +02:00
ptitSeb 9d3d250545 [DYNAREC] Added FILD opcode 2019-10-17 15:04:36 +02:00
ptitSeb e912e0a98a [DYNAREC] More FPU conversion emitter/printer 2019-10-17 14:54:24 +02:00
ptitSeb 20ca0566be [DYNAREC] oops, fixed FST/FSTP with float conversion 2019-10-17 14:00:21 +02:00
ptitSeb d092d2e6e9 [DYNAREC] Added some FLD/FST/FSTP with float conversion 2019-10-17 13:58:03 +02:00
ptitSeb 180e49847b [DYNAREC] and more FST/FSTP opcodes 2019-10-17 13:33:01 +02:00
ptitSeb 62c055f7ac [DYNAREC] More FST/FSTP opcodes 2019-10-17 13:26:04 +02:00
ptitSeb 3a4753ef70 [DYNAREC] FSTP tbytes works now 2019-10-17 13:18:21 +02:00
ptitSeb 43d02c8f3e [DYNAREC] Fixed current batch of x87 opcodes 2019-10-17 12:52:43 +02:00
ptitSeb b7d6955b43 [DYNAREC] Added a few more x87 opcodes (but they all needs some debugging) 2019-10-17 11:52:37 +02:00
ptitSeb 2941140df6 [DYNAREC] Added a few more x87 opcodes 2019-10-17 11:27:10 +02:00
ptitSeb 47bd2db9c3 [DYNAREC] Added a few more instructions 2019-10-17 11:14:14 +02:00
ptitSeb e7460dc878 [DYNAREC] Added some first x87 opcodes 2019-10-17 10:45:57 +02:00
ptitSeb 89504ca289 [DYNAREC] More infrastructure for x87 opcodes 2019-10-17 10:40:52 +02:00
ptitSeb 652b2d9d86 [DYNAREC] More emitter / printer for x87 2019-10-17 09:37:48 +02:00
ptitSeb c46dff15dc Merge branch 'dynarec' of https://github.com/ptitSeb/box86 into dynarec 2019-10-16 22:57:42 +02:00
ptitSeb b121064454 [DYNAREC] Added one D9 x87 instruction 2019-10-16 22:57:20 +02:00
ptitSeb ce952b9ab9 [DYNAREC] Added some emitter and printer for future x87 emulation 2019-10-16 22:57:20 +02:00
ptitSeb 3567d9eccf [DYNAREC] Added some infrastructure for newt step in opcode implementation 2019-10-16 22:57:20 +02:00
ptitSeb 34e24f6fa4 [DYNAREC] Added ROL/ROR/RCL/RCR/SHL/SHR/SAR 8bits opcodes 2019-10-16 22:57:19 +02:00
ptitSeb 4084c5a448 [DYNAREC] added INC/DEC 16bits 2019-10-16 22:57:19 +02:00
ptitSeb e0e426fe53 [DYNAREC] Fixed DAA/DAS/AAA/AAS opcodes and improved POPF 2019-10-16 22:57:19 +02:00
ptitSeb cede4198fa [DYNAREC] Updated README and USAGE with DynaRec infos 2019-10-16 22:57:19 +02:00
ptitSeb 249d008272 [DYNAREC] Added DAA/DAS/AAA/AAS opcodes 2019-10-16 22:57:19 +02:00
ptitSeb 9ba8db83bd [DYNAREC] Small smart linker improvment 2019-10-16 22:57:19 +02:00
ptitSeb de3202630d [DYNAREC] Made the linker smarter, so it can handled changing jump address 2019-10-16 22:57:19 +02:00
ptitSeb db5a19ec82 [DYNAREC] Don't force linker when jumping to [0xCONSTANT], as it may change (fix pico8 parser) 2019-10-16 22:57:18 +02:00
ptitSeb 5a140abd05 [DYNAREC] Made the Out-of-block epilog to forece last opcode to caclulate flag 2019-10-16 22:57:18 +02:00
ptitSeb c6b6e9e78f [DYNAREC] Fixed some ADC/SBB and all RCL/RCR opcode that was missing USEFLAG macro (GeminiRue boots, but deadlock in menu, pico8 still broken) 2019-10-16 22:57:18 +02:00
ptitSeb f35975e748 [DYNAREC] A few more Fixes and some cosmetics changes (GeminiRue still have parsing issues) 2019-10-16 22:57:18 +02:00
ptitSeb 0056aaf687 [DYNAREC] Fixed regression introduced with last refactoring 2019-10-16 22:57:18 +02:00
ptitSeb bf6ccfbf1e [DYNAREC] Small refactoring 2019-10-16 22:57:18 +02:00
ptitSeb 1467c8f48f [DYNAREC] Fixedsome LDR(B)/STR(B) emitter (but not enough to fix gemini_rue or pico8) 2019-10-16 22:57:18 +02:00
ptitSeb c334e3b4da [DYNAREC] Fixed some 0F prefixed opcode (pico8 still not behave correctly) 2019-10-16 22:57:18 +02:00
ptitSeb c7b6dc0762 [DYNAREC] Fixed some 16bits opcode (now BrokenSword 1 starts, but pico8 still fail with a syntax error when loading some working cards) 2019-10-16 22:57:18 +02:00
ptitSeb 03045e2a78 [DYNAREC] Fixed GETEW/EWBACK and GETEB/EBBACK macro, and now things are working, and faster then without Dynarec 2019-10-16 22:57:18 +02:00
ptitSeb 628bbc5810 [DYNAREC] Fixed GWBACK macro, and added fixedaddress detection when resolving ED, to use Linker when address is fixed 2019-10-16 22:57:18 +02:00
ptitSeb e2ddaa67fa [DYNAREC] Numerous fixes and some refactoring, mostly around 8bits opcodes (stll WorldOfGoo 1.53 cannot boot properly, with libpng errors 2019-10-16 22:57:17 +02:00
ptitSeb dba3675688 [DYNAREC] Added option to disable Linker from command line 2019-10-16 22:57:17 +02:00
ptitSeb 54073bb12f Better wrapped fprintf log 2019-10-16 22:57:17 +02:00
ptitSeb d512a56bb9 [DYNAREC] Added more BT/BTR 32 opcodes 2019-10-16 22:57:17 +02:00
ptitSeb e2e63d3121 [DYNAREC] Fixed some 8bits add/sub opcode (now asciisector runs, faster then without dynarec, but the circle fadeout of the map just doesn't work, so still something wrong somewhere 2019-10-16 22:57:17 +02:00
ptitSeb e51a5682b5 Added some comment for easier debugging 2019-10-16 22:57:17 +02:00
ptitSeb 38991a4b2e [DYNAREC] Added BTC 16/32 opcode 2019-10-16 22:57:17 +02:00
ptitSeb bb368f910c [DYNAREC] Added BTS/BTR 32/16 2019-10-16 22:57:17 +02:00
ptitSeb a68c9f2f65 [DYNAREC] Fixed 66 81 and 66 83 opcodes (Undertale now boot, and is faster, but the splash screen is garbled there there is still something wrong somewhere) 2019-10-16 22:57:17 +02:00
ptitSeb f3535225ab [DYNAREC] Added 66 81 and 66 83 opcode 2019-10-16 22:57:17 +02:00
ptitSeb e20f7663f1 [DYNAREC] Messed up a bit with flags and falgs optim. Seems better but should be refactor 2019-10-16 22:57:16 +02:00
ptitSeb c222cb4e0d [DYNAREC] Fixed shrd/shrld 32/16 opcode (some bugs are still there, at least 1, shown in pico8 0.11 with splore menu going blank) 2019-10-16 22:57:16 +02:00
ptitSeb bcb03fc62f [DYNAREC] Added BT 16 opcode 2019-10-16 22:57:16 +02:00
ptitSeb 51c0afa1a1 [DYNAREC] Added shld/shrd 16 opcode 2019-10-16 22:57:16 +02:00
ptitSeb 6008798b99 [DYNAREC] Added shld/shrd opcodes 2019-10-16 22:57:16 +02:00
ptitSeb 9e1376657b [DYNAREC] Added rol/ror/rcl/rcr/shl/shr/sar 8 opcodes 2019-10-16 22:57:16 +02:00
ptitSeb 572ebc27fa [DYNAREC] rol/ror/rcl/rcr/shl/shr 16 opcodes 2019-10-16 22:57:16 +02:00
ptitSeb 363c851f2b [DYNAREC] Added 66 F7 opcode 2019-10-16 22:57:16 +02:00
ptitSeb 516b4bdbbd [DYNAREC] Added inc/dec reg16 2019-10-16 22:57:16 +02:00
ptitSeb 47f4ca2b3a [DYNAREC] fixed 1 cmp 16 opcode 2019-10-16 22:57:16 +02:00
ptitSeb 4808a19633 [DYNAREC] Added adc/sbc 16 opcodes 2019-10-16 22:57:16 +02:00
ptitSeb b2e61ea5f6 [DYNAREC] The check didn't find that typo in a sub 16 opcode 2019-10-16 22:57:16 +02:00
ptitSeb 5f698e971e [DYNAREC] Add/check sbb 8/32 and add/sub 16 2019-10-16 22:57:15 +02:00
ptitSeb 71ed1c374b [DYNAREC] Add/check/fix the (rep) stos/movs/scas/cmps/lods 8/32bits opcodes 2019-10-16 22:57:15 +02:00
ptitSeb 757ee37905 [DYNAREC] Changed TST emitter, and now valgrind is ok 2019-10-16 22:57:15 +02:00
ptitSeb eee9899cbe [DYNAREC] check/fix rol/ror/rcl/rcr/srl/shr 32 2019-10-16 22:57:15 +02:00
ptitSeb ab00993f21 [DYNAREC] Added pushf/pop and started checking opcode (add32/8, sub32/8, inc32/8, dec32/8, neg32/8, not32/8 and/or/xor/cmp/test32/8 are ok) 2019-10-16 22:57:15 +02:00
ptitSeb 29590f0327 [DYNAREC] Added a few more 8bits opcodes 2019-10-16 22:57:15 +02:00
ptitSeb 459f209a20 [DYNAREC] Some more 16bits instructions 2019-10-16 22:57:15 +02:00
ptitSeb 6f2e829e87 [DYNAREC] Fixed NativeCall hack when RETN is used, and added missing ADC opcode (UNDERTALE now boots, but get stuck after splash screen) 2019-10-16 22:57:14 +02:00
ptitSeb 1d5b98f564 [DYNAREC] Refactored sources, to try reduce compile time 2019-10-16 22:57:14 +02:00
ptitSeb f3837e2954 [DYNAREC] A few more 8bits opcodes 2019-10-16 22:57:14 +02:00
ptitSeb 99306352a3 [DYNAREC] Added a test to not call UpdateFlags if flags are clean 2019-10-16 22:57:14 +02:00
ptitSeb 5e95c04139 [DYNAREC] Fixed some copypasta bugs in 8bits mul/div opcode, and added CALL macro an option to save more regs 2019-10-16 22:57:14 +02:00
ptitSeb ae7f6de506 [DYNAREC] Small (mostly cosmetics) changes 2019-10-16 22:57:13 +02:00
ptitSeb 650ae663e4 [DYNAREC] More 8bits opcodes 2019-10-16 22:57:13 +02:00
ptitSeb 88cffdf4ec [DYNAREC] Added BSWAP opcode 2019-10-16 22:57:13 +02:00
ptitSeb 824547a96d [DYNAREC] Some more 16bits CMP opcode 2019-10-16 22:57:13 +02:00
ptitSeb ad9b6e570b [DYNAREC] Added some 32bits ROR, ROL, RCL and RCR opcodes 2019-10-16 22:57:13 +02:00
ptitSeb 9c9e1944f8 [DYNAREC] added 2 16bits opcodes 2019-10-16 22:57:13 +02:00
ptitSeb 043db28b00 [DYNAREC] Added some ADC and SBB opcode 2019-10-16 22:57:13 +02:00
ptitSeb e8c1af8822 [DYNAREC] Aving multiple mutex is a bad idea, that will lead to deadlock, so reverted to only 1 mutex for dynablocks 2019-10-16 22:57:13 +02:00
ptitSeb 18316aca9a [DYNAREC] Made dynablock per elfimage, and selection with address (that will avoid dynarec'ing a block of code that is not from an elf image, like a JIT'd code, because it may be not constant) 2019-10-16 22:57:13 +02:00
ptitSeb e86df52fbb [DYNAREC] Moved block mutex inside dynablocks structure 2019-10-16 22:57:12 +02:00
ptitSeb b66d0fe188 [DYNAREC] Some small changes in 8bits opcode, and disabled code for adc/sbb opcode (in wrapped C function) 2019-10-16 22:57:12 +02:00
ptitSeb 076fa22486 [DYNAREC] Added more 8bit opcodes 2019-10-16 22:57:12 +02:00
ptitSeb 5b433fd6d0 [DYNAREC] Added some TST opcode 2019-10-16 22:57:12 +02:00
ptitSeb 1aa37cec89 [DYNAREC] Fixed REPx CMPSx and REPx SCASx, and added REP LODSx (and pico8 intro sound is back) 2019-10-16 22:57:12 +02:00
ptitSeb 2c8cd5e4fa [DYNAREC] Added some REP XXX opcode (but it seems the intro sound of pico8 is broken now, at least silent) 2019-10-16 22:57:12 +02:00
ptitSeb 20bd4aed8f [DYNAREC] Added ADC and SBB opcode (wrapper to C implementation for now) 2019-10-16 22:57:12 +02:00
ptitSeb a01ba37d6c [DYNAREC] More 8bits opcodes 2019-10-16 22:57:12 +02:00
ptitSeb 79926534cb [DYNAREC] Added 1 version of 8bit OR and ADD opcode 2019-10-16 22:57:12 +02:00
ptitSeb 695adb718d [DYNAREC] Aded SETxx opcodes 2019-10-16 22:57:12 +02:00
ptitSeb 5284e9270a [DYNAREC] Revert a change that break printer in many opcode. Strange, this need to be analysed latter 2019-10-16 22:57:12 +02:00
ptitSeb e260019df8 [DYNAREC] Fixed a bug with 8bit reg access (still not enough to get undertale to run) 2019-10-16 22:57:12 +02:00
ptitSeb 6c8c4b3e45 [DYNAREC] More bug fixes, but Undertale still crashes 2019-10-16 22:57:11 +02:00
ptitSeb 295d5db77a [DYNAREC] More fixes and improvments, but still some issues with pico8 when using SPLORE 2019-10-16 22:57:11 +02:00
ptitSeb 3e556eae78 [DYNAREC] Fixed Native call when return address is not the expected one (like with set_jump functions). Fixes pixo8, at last 2019-10-16 22:57:11 +02:00
ptitSeb a97f278bb1 [DYNAREC] Fixed NEG opcode (plus a few other cosmetics changes). This fixes airstrike, but not pico8 unfortunatly. 2019-10-16 22:57:11 +02:00
ptitSeb 6cd864e64e [DYNAREC] Fixed a typo in previous refactoring 2019-10-16 22:57:11 +02:00
ptitSeb 1002a23b71 [DYNAREC] Made some macro for scratch register, to cleary see difference between Register and Litteral (also fixed a few things in the process) 2019-10-16 22:57:11 +02:00
ptitSeb 694a6052fe [DYNAREC] And a few more fixes, mainly SUB with flags opcode (still some more fixes to find) 2019-10-16 22:57:11 +02:00
ptitSeb 80bfdf62e9 [DYNAREC] Fixed BT opcode (not enough to fix Airstrike or Pico8) 2019-10-16 22:57:11 +02:00
ptitSeb 6f58c7200c [DYNAREC] Added some 8b opcodes 2019-10-16 22:57:11 +02:00
ptitSeb fce629c1f0 [DYNAREC] One more GS: opcode 2019-10-16 22:57:11 +02:00
ptitSeb 93dad28d0b [DYNAREC] More changes (simplifications), using some armv7 instructions 2019-10-16 22:57:10 +02:00
ptitSeb a7b2a140a9 [DYNAREC] Added a TODO comment 2019-10-16 22:57:10 +02:00
ptitSeb 08a4ba0614 [DYNAREC] Fixed NativeCall Hack 2019-10-16 22:57:10 +02:00
ptitSeb 6275d20fb1 [DYNAREC] Try to improve the geted part 2019-10-16 22:57:10 +02:00
ptitSeb 1318798124 [DYNAREC] Simplified some opcodes 2019-10-16 22:57:10 +02:00
ptitSeb 3f86366cfa [DYNAREC] Added and Fix a bunch of stuff, but there is still something broken somewhere (pico8 doesn't load carts, undertale segfault) 2019-10-16 22:57:10 +02:00
ptitSeb bf5485a268 [DYNAREC] Added XCHG with lock opcode 2019-10-16 22:57:10 +02:00
ptitSeb e34934fd92 [DYNAREC] Added a few more opcodes, including DIVs and MULs 2019-10-16 22:57:09 +02:00
ptitSeb a350f7f955 [DYNAREC] More logic and arithmetics opcodes 2019-10-16 22:57:09 +02:00
ptitSeb 25ddf08f88 [DYNAREC] Added another IMUL opcode 2019-10-16 22:57:09 +02:00
ptitSeb b131c5ee64 [DYNAREC] Added LEAVE opcode 2019-10-16 22:57:09 +02:00
ptitSeb 6b4b19f9da [DYNAREC] And more logic opcodes 2019-10-16 22:57:09 +02:00
ptitSeb 4d7a788598 [DYNAREC] Added BT opcode 2019-10-16 22:57:09 +02:00
ptitSeb 957b85d72e [DYNAREC] Fixed printer for some MOV LSR cases 2019-10-16 22:57:09 +02:00
ptitSeb beed90e6e9 [DYNAREC] Added Mov Eb, Gb opcode 2019-10-16 22:57:08 +02:00
ptitSeb 2c561b1e80 [DYNAREC] Added an OR opcode 2019-10-16 22:57:08 +02:00
ptitSeb e9622d7738 [DYNAREC] Fixed a bug with optimizations. (now FTL starts again) 2019-10-16 22:57:08 +02:00
ptitSeb d285951785 [DYNAREC] Added some hack for regular method to grab EIP 2019-10-16 22:57:08 +02:00
ptitSeb b3bf4a161d [DYNAREC] Added Mov Gw, Ew opcode 2019-10-16 22:57:08 +02:00
ptitSeb ed187e4513 [DYNAREC] Fixed Mov Ew, Gw opcode (Undertale works again correctly, still slower) 2019-10-16 22:57:08 +02:00
ptitSeb 79df27c12b [DYNAREC] Added support for GOT/PLT style Native Call (but there is still something wrong somewhere, Undertale doesn't wrk correctly anymore) 2019-10-16 22:57:08 +02:00
ptitSeb 1fb9a4297c [DYNAREC] Added a movzx opcode 2019-10-16 22:57:08 +02:00
ptitSeb 9b914a7791 [DYNAREC] Added a imul opcode 2019-10-16 22:57:08 +02:00
ptitSeb 8891cbee05 [DYNAREC] Added CMOVxx opcode 2019-10-16 22:57:08 +02:00
ptitSeb 3c36e8bfe6 [DYNAREC] More dynarec opcode 2019-10-16 22:57:08 +02:00
ptitSeb 3e55dd04f2 [DYNAREC] Added another 16bit opcode 2019-10-16 22:57:08 +02:00
ptitSeb 96f084d69e [DYNAREC] Added Syscall opcode 2019-10-16 22:57:08 +02:00
ptitSeb 4c69e02643 [DYNAREC] Fix and improvement to printer 2019-10-16 22:57:07 +02:00
ptitSeb 0b4015fa9f [DYNAREC] Added a 16bit opcode 2019-10-16 22:57:07 +02:00
ptitSeb 3f09f67fca [DYNAREC] Small refactoring of dynarec 2019-10-16 22:57:07 +02:00
ptitSeb b170e39523 [DYNAREC] Small fix on Exitx86emu opcode 2019-10-16 22:57:07 +02:00
ptitSeb 119a42d696 [DYNAREC] Added native call in dynarec, and fixed lastest change in trace that was consuming useless cpu 2019-10-16 22:57:07 +02:00
ptitSeb 613f46e8a7 [DYNAREC] More conditionnal jump 2019-10-16 22:57:07 +02:00
ptitSeb 2f32f36e47 [DYNAREC] Fixed Mov Reg, Id, fixing dynarec with undertale (still not faster) 2019-10-16 22:57:07 +02:00
ptitSeb 754844d4bd [DYNAREC] Generated code can now also emit trace (for easier debugging) 2019-10-16 22:57:07 +02:00
ptitSeb 91dfeba954 [DYNAREC] Implemented Barrier on optim propagation 2019-10-16 22:57:07 +02:00
ptitSeb af24315968 [DYNAREC] Added a small optimisation about flags handling 2019-10-16 22:57:07 +02:00
ptitSeb af7cb756cd [DYNAREC] Fixed a few stuff in opcode 2019-10-16 22:57:07 +02:00
ptitSeb de403a57e1 [DYNAREC] Added a few more opcode 2019-10-16 22:57:06 +02:00
ptitSeb 386e8e5383 [DYNAREC] Fixed LDR and STM print 2019-10-16 22:57:06 +02:00
ptitSeb 19cfbd07b5 [DYNAREC] More opcode 2019-10-16 22:57:06 +02:00
ptitSeb 69e2b511af [DYNAREC] Added a few more instructions 2019-10-16 22:57:06 +02:00
ptitSeb c7b1564a20 [DYNAREC] Fixed B(L) printer 2019-10-16 22:57:06 +02:00
ptitSeb b313e75ef6 [DYNAREC] A few simplification in the dynarec writing 2019-10-16 22:57:06 +02:00
ptitSeb d43072e902 [DYNAREC] Added a few more opcodes 2019-10-16 22:57:06 +02:00
ptitSeb 5d7c1e84bc [DYNAREC] Change handling of FLAGS, now using same mecanism than Interpretor 2019-10-16 22:57:06 +02:00
ptitSeb 9e57593a79 Fixed fork 2019-10-16 22:57:06 +02:00
ptitSeb 2a8fc16241 [DYNAREC] Fixed B(L) emitter 2019-10-16 22:57:06 +02:00
ptitSeb 7c1ca92fcb [DYNAREC] Fix arm_printer for BLX opcode 2019-10-16 22:57:06 +02:00
ptitSeb dd81e06d35 [DYNAREC] Added a few more opcode 2019-10-16 22:57:06 +02:00
ptitSeb 6f17e1e0e8 [DYNAREC] Fixed linker (was useless before), and added JZ opcode 2019-10-16 22:57:05 +02:00
ptitSeb 8c4a4c2999 [DYNAREC] Added a few more instructions 2019-10-16 22:57:05 +02:00
ptitSeb ed92cd0945 [DYNAREC] Fixed issue with flags, now all test are OK 2019-10-16 22:57:05 +02:00
ptitSeb eeeaa6d339 [DYNAREC] Another small improvment in dynarec dump 2019-10-16 22:57:05 +02:00
ptitSeb 8c8782d1e5 [DYNAREC] Better dynarec dump in some cases 2019-10-16 22:57:05 +02:00
ptitSeb 6b6b926347 [DYNAREC] Small optimization of get_ed 2019-10-16 22:57:05 +02:00
ptitSeb 2ef3b9689e [DYNAREC] Fixed an issue with arm_printer 2019-10-16 22:57:05 +02:00
ptitSeb 023b0723ea Refined .gitignore 2019-10-16 22:57:05 +02:00
ptitSeb 97d2e4bc30 [DYNAREC] Added a crude Arm opcode printer, to help debugging 2019-10-16 22:57:05 +02:00
ptitSeb c2b2a73329 [DYNAREC] Small improvement in dynarec logs 2019-10-16 22:57:05 +02:00
ptitSeb 4185a6a144 [DYNAREC] Fixed and add some opcode, still some bug to fix (test10 broken) 2019-10-16 22:57:05 +02:00
ptitSeb 3eb2ef6cfd [DYNAREC] Created and changed some macro to simplify opcode writing 2019-10-16 22:57:05 +02:00
ptitSeb 0b1fec3927 [DYNAREC] Fixed some opcode, all tests pass now 2019-10-16 22:57:04 +02:00
ptitSeb 25f8668b88 [DYNAREC] Enabled dynarec in more case than just thread, and clear cache for newly filled dynarec block (still test 10 and 12 broken) 2019-10-16 22:57:04 +02:00
ptitSeb 1b47bed603 [DYNAREC] Add runtime linker between blocks 2019-10-16 22:57:04 +02:00
ptitSeb bf418055a3 [DYNAREC] Small typo 2019-10-16 22:57:04 +02:00
ptitSeb 125224f976 [DYNAREC], Change the way mmap is called (batched now), and put many things behind mutex (still issues with threads 2019-10-16 22:57:04 +02:00
ptitSeb af34862b9c [DYNAREC] Fixed Flags mirroring 2019-10-16 22:57:04 +02:00
ptitSeb d6121c4d82 [DYNAREC] Added XOR Gd, Ed opcode 2019-10-16 22:57:04 +02:00
ptitSeb 11f03846ab [DYNAREC] Small geted optimization 2019-10-16 22:57:04 +02:00
ptitSeb d4ad0bf00a [DYNAREC] Added GS: Infrastructure 2019-10-16 22:57:04 +02:00
ptitSeb ed12f40b32 [DYNAREC] Added a global switch, plus some 0xFF opcodes 2019-10-16 22:57:04 +02:00
ptitSeb f018edcc5b [DYNAREC] Added Sub Ed, Ix and Mov Ed, Id opcode 2019-10-16 22:57:03 +02:00
ptitSeb 078742c054 [DYNAREC] Added Ret opcode 2019-10-16 22:57:03 +02:00
ptitSeb 3e05a60d38 [DYNAREC] Added Mov Gd, Ed 2019-10-16 22:57:03 +02:00
ptitSeb 6cacba1a67 [DYNAREC] Added Call relative opcode 2019-10-16 22:57:03 +02:00
ptitSeb 21bb5d5e2a [DYNAREC] Added simple Mov Ed, Gd opcode, and improved Push 2019-10-16 22:57:03 +02:00
ptitSeb 57c13b9a73 [DYNAREC] First working draft of the Dynarec. Only PUSH instruction for now, so not usefull yet 2019-10-16 22:57:03 +02:00
ptitSeb 5a41eaaa6f [DYNAREC] More infrastructure, no emiter yet 2019-10-16 22:57:03 +02:00
ptitSeb 71efacc050 [DYNAREC] Put some atomic to lock concurent access to dynablock list 2019-10-16 22:57:03 +02:00
ptitSeb e64b6cf64a [DYNAREC] Added some basic infrastructure 2019-10-16 22:57:03 +02:00
ptitSeb bff43a86e8 Update wrappedalut.c 2019-10-16 22:55:18 +02:00
ptitSeb 1de4494bc2 [DYNAREC] Added one D9 x87 instruction 2019-10-16 19:49:52 +02:00
ptitSeb 7edace78f7 [DYNAREC] Added some emitter and printer for future x87 emulation 2019-10-16 19:33:33 +02:00
ptitSeb 106ebc1abd [DYNAREC] Added some infrastructure for newt step in opcode implementation 2019-10-16 14:16:56 +02:00
ptitSeb 884aebab48 [DYNAREC] Added ROL/ROR/RCL/RCR/SHL/SHR/SAR 8bits opcodes 2019-10-15 23:06:48 +02:00
ptitSeb fec4803386 [DYNAREC] added INC/DEC 16bits 2019-10-15 22:56:48 +02:00
ptitSeb c39c8cceef [DYNAREC] Fixed DAA/DAS/AAA/AAS opcodes and improved POPF 2019-10-15 19:46:52 +02:00
ptitSeb 34f71cf75a [DYNAREC] Updated README and USAGE with DynaRec infos 2019-10-15 14:39:33 +02:00
ptitSeb c631ee1292 [DYNAREC] Added DAA/DAS/AAA/AAS opcodes 2019-10-15 14:13:59 +02:00
ptitSeb df9cbc04a8 [DYNAREC] Small smart linker improvment 2019-10-15 09:24:14 +02:00
ptitSeb bd2728399d [DYNAREC] Made the linker smarter, so it can handled changing jump address 2019-10-15 08:44:14 +02:00
ptitSeb 556465529b [DYNAREC] Don't force linker when jumping to [0xCONSTANT], as it may change (fix pico8 parser) 2019-10-15 08:20:40 +02:00
ptitSeb 4033c7aef0 [DYNAREC] Made the Out-of-block epilog to forece last opcode to caclulate flag 2019-10-15 08:19:49 +02:00
ptitSeb 09609997b3 [DYNAREC] Fixed some ADC/SBB and all RCL/RCR opcode that was missing USEFLAG macro (GeminiRue boots, but deadlock in menu, pico8 still broken) 2019-10-14 22:49:56 +02:00
ptitSeb dd510d9086 [DYNAREC] A few more Fixes and some cosmetics changes (GeminiRue still have parsing issues) 2019-10-14 21:37:49 +02:00
ptitSeb d65e14910b [DYNAREC] Fixed regression introduced with last refactoring 2019-10-14 19:58:53 +02:00
ptitSeb fe0809cef8 [DYNAREC] Small refactoring 2019-10-14 18:33:34 +02:00
ptitSeb 0532f5adc3 [DYNAREC] Fixedsome LDR(B)/STR(B) emitter (but not enough to fix gemini_rue or pico8) 2019-10-13 22:53:36 +02:00
ptitSeb fadee457ba [DYNAREC] Fixed some 0F prefixed opcode (pico8 still not behave correctly) 2019-10-13 21:12:06 +02:00
ptitSeb 10bda2b797 [DYNAREC] Fixed some 16bits opcode (now BrokenSword 1 starts, but pico8 still fail with a syntax error when loading some working cards) 2019-10-13 20:40:00 +02:00
ptitSeb 262e93a6b4 [DYNAREC] Fixed GETEW/EWBACK and GETEB/EBBACK macro, and now things are working, and faster then without Dynarec 2019-10-13 18:06:46 +02:00
ptitSeb 8c4b2bb777 [DYNAREC] Fixed GWBACK macro, and added fixedaddress detection when resolving ED, to use Linker when address is fixed 2019-10-13 17:23:57 +02:00
ptitSeb f7fff13094 [DYNAREC] Numerous fixes and some refactoring, mostly around 8bits opcodes (stll WorldOfGoo 1.53 cannot boot properly, with libpng errors 2019-10-13 17:01:43 +02:00
ptitSeb e0b2560ffa [DYNAREC] Added option to disable Linker from command line 2019-10-13 14:23:41 +02:00
ptitSeb dc5fc68387 Better wrapped fprintf log 2019-10-13 12:14:04 +02:00
ptitSeb b3027741f6 [DYNAREC] Added more BT/BTR 32 opcodes 2019-10-13 11:27:28 +02:00
ptitSeb ad8c74e0c3 [DYNAREC] Fixed some 8bits add/sub opcode (now asciisector runs, faster then without dynarec, but the circle fadeout of the map just doesn't work, so still something wrong somewhere 2019-10-13 11:26:49 +02:00
ptitSeb 7c569f5b80 Added some comment for easier debugging 2019-10-13 11:21:45 +02:00
ptitSeb 06d07b200e [DYNAREC] Added BTC 16/32 opcode 2019-10-13 10:51:36 +02:00
ptitSeb 19c6e4e79d [DYNAREC] Added BTS/BTR 32/16 2019-10-13 10:44:52 +02:00
ptitSeb f78ea4d279 [DYNAREC] Fixed 66 81 and 66 83 opcodes (Undertale now boot, and is faster, but the splash screen is garbled there there is still something wrong somewhere) 2019-10-12 23:24:52 +02:00
ptitSeb e95142fffc [DYNAREC] Added 66 81 and 66 83 opcode 2019-10-12 23:02:38 +02:00
ptitSeb 7f181e09da [DYNAREC] Messed up a bit with flags and falgs optim. Seems better but should be refactor 2019-10-12 22:38:13 +02:00
ptitSeb 5276449269 [DYNAREC] Fixed shrd/shrld 32/16 opcode (some bugs are still there, at least 1, shown in pico8 0.11 with splore menu going blank) 2019-10-12 20:37:39 +02:00
ptitSeb f63cc905d5 [DYNAREC] Added BT 16 opcode 2019-10-12 19:37:21 +02:00
ptitSeb fa51cb3ea1 [DYNAREC] Added shld/shrd 16 opcode 2019-10-12 19:18:14 +02:00
ptitSeb 1fb5dd39ed [DYNAREC] Added shld/shrd opcodes 2019-10-12 19:07:31 +02:00
ptitSeb 1d85be7bb2 [DYNAREC] Added rol/ror/rcl/rcr/shl/shr/sar 8 opcodes 2019-10-12 18:47:42 +02:00
ptitSeb e7ffc6d0d3 [DYNAREC] rol/ror/rcl/rcr/shl/shr 16 opcodes 2019-10-12 18:26:41 +02:00
ptitSeb dc9d6ff55a [DYNAREC] Added 66 F7 opcode 2019-10-12 18:05:36 +02:00
ptitSeb 335dbf233c [DYNAREC] Added inc/dec reg16 2019-10-12 17:52:02 +02:00
ptitSeb cb8cb43194 [DYNAREC] fixed 1 cmp 16 opcode 2019-10-12 17:45:23 +02:00
ptitSeb c234a4fefc [DYNAREC] Added adc/sbc 16 opcodes 2019-10-12 17:42:41 +02:00
ptitSeb 682ec6745c [DYNAREC] The check didn't find that typo in a sub 16 opcode 2019-10-12 17:26:15 +02:00
ptitSeb 5de4ec65e2 [DYNAREC] Add/check sbb 8/32 and add/sub 16 2019-10-12 17:24:25 +02:00
ptitSeb e15e8259a2 [DYNAREC] Add/check/fix the (rep) stos/movs/scas/cmps/lods 8/32bits opcodes 2019-10-12 16:41:20 +02:00
ptitSeb aac6571998 [DYNAREC] Changed TST emitter, and now valgrind is ok 2019-10-12 14:43:19 +02:00
ptitSeb 129730e73f [DYNAREC] check/fix rol/ror/rcl/rcr/srl/shr 32 2019-10-12 14:36:34 +02:00
ptitSeb f9ab62025d [DYNAREC] Added pushf/pop and started checking opcode (add32/8, sub32/8, inc32/8, dec32/8, neg32/8, not32/8 and/or/xor/cmp/test32/8 are ok) 2019-10-12 11:26:22 +02:00
ptitSeb 7a61fff0c8 [DYNAREC] Added a few more 8bits opcodes 2019-10-11 23:05:57 +02:00
ptitSeb 43f407559d [DYNAREC] Some more 16bits instructions 2019-10-11 22:23:38 +02:00
ptitSeb b2eefc00e8 [DYNAREC] Fixed NativeCall hack when RETN is used, and added missing ADC opcode (UNDERTALE now boots, but get stuck after splash screen) 2019-10-11 20:54:18 +02:00
ptitSeb 21ca9af789 [DYNAREC] Refactored sources, to try reduce compile time 2019-10-11 16:26:48 +02:00
ptitSeb 068b259777 [DYNAREC] A few more 8bits opcodes 2019-10-11 14:06:23 +02:00
ptitSeb 15225bed69 [DYNAREC] Added a test to not call UpdateFlags if flags are clean 2019-10-11 11:50:21 +02:00
ptitSeb 6dd402978f [DYNAREC] Fixed some copypasta bugs in 8bits mul/div opcode, and added CALL macro an option to save more regs 2019-10-11 11:22:09 +02:00
ptitSeb 717e6ac0f9 [DYNAREC] Small (mostly cosmetics) changes 2019-10-11 09:29:00 +02:00
ptitSeb ed3c1ccf49 [DYNAREC] More 8bits opcodes 2019-10-10 23:01:16 +02:00
ptitSeb b8f540474d [DYNAREC] Added BSWAP opcode 2019-10-10 22:13:58 +02:00
ptitSeb 32562b84bf [DYNAREC] Some more 16bits CMP opcode 2019-10-10 21:53:58 +02:00
ptitSeb 488932fa17 [DYNAREC] Added some 32bits ROR, ROL, RCL and RCR opcodes 2019-10-10 21:02:43 +02:00
ptitSeb 2e61a2a4db [DYNAREC] added 2 16bits opcodes 2019-10-10 20:22:48 +02:00
ptitSeb fd9f620bab [DYNAREC] Added some ADC and SBB opcode 2019-10-10 20:12:44 +02:00
ptitSeb ac72791a48 [DYNAREC] Aving multiple mutex is a bad idea, that will lead to deadlock, so reverted to only 1 mutex for dynablocks 2019-10-10 19:51:06 +02:00
ptitSeb 171f9b317c [DYNAREC] Made dynablock per elfimage, and selection with address (that will avoid dynarec'ing a block of code that is not from an elf image, like a JIT'd code, because it may be not constant) 2019-10-10 16:48:11 +02:00
ptitSeb f311a6f566 [DYNAREC] Moved block mutex inside dynablocks structure 2019-10-10 15:07:11 +02:00
ptitSeb df0084e037 [DYNAREC] Some small changes in 8bits opcode, and disabled code for adc/sbb opcode (in wrapped C function) 2019-10-10 09:35:47 +02:00
ptitSeb 4ec601b537 [DYNAREC] Added more 8bit opcodes 2019-10-10 08:31:32 +02:00
ptitSeb 29da3f9408 [DYNAREC] Added some TST opcode 2019-10-10 08:11:17 +02:00
ptitSeb aa014eaf14 [DYNAREC] Fixed REPx CMPSx and REPx SCASx, and added REP LODSx (and pico8 intro sound is back) 2019-10-10 07:54:27 +02:00
ptitSeb e2306956a5 [DYNAREC] Added some REP XXX opcode (but it seems the intro sound of pico8 is broken now, at least silent) 2019-10-10 00:13:37 +02:00
ptitSeb d604f0f746 [DYNAREC] Added ADC and SBB opcode (wrapper to C implementation for now) 2019-10-09 22:13:24 +02:00
ptitSeb 6fff9c1314 [DYNAREC] More 8bits opcodes 2019-10-09 22:02:51 +02:00
ptitSeb faec52284f [DYNAREC] Added 1 version of 8bit OR and ADD opcode 2019-10-09 21:49:26 +02:00
ptitSeb bf1c6ee242 [DYNAREC] Aded SETxx opcodes 2019-10-09 21:32:04 +02:00
ptitSeb 330da45dca [DYNAREC] Revert a change that break printer in many opcode. Strange, this need to be analysed latter 2019-10-09 15:56:32 +02:00
ptitSeb c79bd682e5 [DYNAREC] Fixed a bug with 8bit reg access (still not enough to get undertale to run) 2019-10-09 08:39:08 +02:00
ptitSeb e9f6992059 [DYNAREC] More bug fixes, but Undertale still crashes 2019-10-09 00:26:07 +02:00
ptitSeb 289d6beb17 Merge pull request #66 from kant/patch-2
Syntax issues fixed
2019-10-08 23:49:06 +02:00
ptitSeb e11e825c3a Merge pull request #65 from kant/patch-1
Syntax issue on line 17
2019-10-08 23:48:40 +02:00
ptitSeb 2916541885 [DYNAREC] More fixes and improvments, but still some issues with pico8 when using SPLORE 2019-10-08 22:47:48 +02:00
Darío Hereñú 3eac50321c Syntax issues fixed 2019-10-08 17:44:06 -03:00
Darío Hereñú 1f2442f384 Syntax issue on line 17 2019-10-08 17:39:17 -03:00
ptitSeb 0ea6c8e1e2 [DYNAREC] Fixed Native call when return address is not the expected one (like with set_jump functions). Fixes pixo8, at last 2019-10-08 21:44:18 +02:00
ptitSeb 0a6d6cee32 [DYNAREC] Fixed NEG opcode (plus a few other cosmetics changes). This fixes airstrike, but not pico8 unfortunatly. 2019-10-08 20:51:05 +02:00
ptitSeb c8debfd8ed [DYNAREC] Fixed a typo in previous refactoring 2019-10-08 17:50:17 +02:00
ptitSeb c6ef22a226 [DYNAREC] Made some macro for scratch register, to cleary see difference between Register and Litteral (also fixed a few things in the process) 2019-10-08 16:21:56 +02:00
ptitSeb 0d8a21e85b [DYNAREC] And a few more fixes, mainly SUB with flags opcode (still some more fixes to find) 2019-10-08 08:41:00 +02:00
ptitSeb 88f97ebaf3 [DYNAREC] Fixed BT opcode (not enough to fix Airstrike or Pico8) 2019-10-07 23:38:22 +02:00
ptitSeb b652e9959c [DYNAREC] Added some 8b opcodes 2019-10-07 21:59:34 +02:00
ptitSeb cadea596e1 [DYNAREC] One more GS: opcode 2019-10-07 21:26:57 +02:00
ptitSeb f7074bcce9 [DYNAREC] More changes (simplifications), using some armv7 instructions 2019-10-07 21:19:22 +02:00
ptitSeb 6ab8e78133 [DYNAREC] Added a TODO comment 2019-10-07 15:31:34 +02:00
ptitSeb a8c53255a8 [DYNAREC] Fixed NativeCall Hack 2019-10-07 15:17:14 +02:00
ptitSeb aaeb4677e1 [DYNAREC] Try to improve the geted part 2019-10-07 14:50:55 +02:00
ptitSeb 269535411b [DYNAREC] Simplified some opcodes 2019-10-07 09:28:15 +02:00
ptitSeb 33f179b78f [DYNAREC] Added and Fix a bunch of stuff, but there is still something broken somewhere (pico8 doesn't load carts, undertale segfault) 2019-10-07 00:01:08 +02:00
ptitSeb abe6d22870 [DYNAREC] Added XCHG with lock opcode 2019-10-06 14:36:24 +02:00
ptitSeb 2ac095fd04 [DYNAREC] Added a few more opcodes, including DIVs and MULs 2019-10-06 14:04:27 +02:00
ptitSeb a319b98daf [DYNAREC] More logic and arithmetics opcodes 2019-10-06 11:21:14 +02:00
ptitSeb 547ed02318 [DYNAREC] Added another IMUL opcode 2019-10-06 10:06:17 +02:00
ptitSeb 15faf7e061 [DYNAREC] Added LEAVE opcode 2019-10-05 22:46:34 +02:00
ptitSeb afc91dfc4d [DYNAREC] And more logic opcodes 2019-10-05 22:40:08 +02:00
ptitSeb 8a6ccf6ddf [DYNAREC] Added BT opcode 2019-10-05 22:03:04 +02:00
ptitSeb 7014b1a1c0 [DYNAREC] Fixed printer for some MOV LSR cases 2019-10-05 22:02:39 +02:00
ptitSeb 6b12ad18ef [DYNAREC] Added Mov Eb, Gb opcode 2019-10-05 21:11:26 +02:00
ptitSeb 8f6021657f [DYNAREC] Added an OR opcode 2019-10-05 20:18:32 +02:00
ptitSeb 185fe1f092 [DYNAREC] Fixed a bug with optimizations. (now FTL starts again) 2019-10-05 19:54:49 +02:00
ptitSeb ca0d56e33e [DYNAREC] Added some hack for regular method to grab EIP 2019-10-05 19:14:46 +02:00
ptitSeb fb1b84c12e [DYNAREC] Added Mov Gw, Ew opcode 2019-10-05 17:29:08 +02:00
ptitSeb bfcff3170e [DYNAREC] Fixed Mov Ew, Gw opcode (Undertale works again correctly, still slower) 2019-10-05 17:23:23 +02:00
ptitSeb e864759628 [DYNAREC] Added support for GOT/PLT style Native Call (but there is still something wrong somewhere, Undertale doesn't wrk correctly anymore) 2019-10-05 16:43:55 +02:00
ptitSeb 14ba777e85 [DYNAREC] Added a movzx opcode 2019-10-05 15:07:19 +02:00
ptitSeb 268d68927d [DYNAREC] Added a imul opcode 2019-10-05 14:44:05 +02:00
ptitSeb 70ac928a78 [DYNAREC] Added CMOVxx opcode 2019-10-05 13:41:15 +02:00
ptitSeb c16987c1b6 [DYNAREC] More dynarec opcode 2019-10-05 13:08:55 +02:00
ptitSeb 3f45496b70 [DYNAREC] Added another 16bit opcode 2019-10-05 12:54:58 +02:00
ptitSeb 58ebd0f1a3 [DYNAREC] Added Syscall opcode 2019-10-05 12:41:19 +02:00
ptitSeb 56ce86b08b [DYNAREC] Fix and improvement to printer 2019-10-05 12:41:04 +02:00
ptitSeb 4d6e6c43fd [DYNAREC] Added a 16bit opcode 2019-10-05 12:19:14 +02:00
ptitSeb 08d8f98742 [DYNAREC] Small refactoring of dynarec 2019-10-05 11:02:57 +02:00
ptitSeb d501c6f321 [DYNAREC] Small fix on Exitx86emu opcode 2019-10-05 10:56:33 +02:00
ptitSeb 6ff13a1c5d [DYNAREC] Added native call in dynarec, and fixed lastest change in trace that was consuming useless cpu 2019-10-05 10:46:42 +02:00
ptitSeb 35a3cf229a [DYNAREC] More conditionnal jump 2019-10-05 09:46:53 +02:00
ptitSeb 9619b023c7 [DYNAREC] Fixed Mov Reg, Id, fixing dynarec with undertale (still not faster) 2019-10-04 21:42:59 +02:00
ptitSeb c0251d78a2 [DYNAREC] Generated code can now also emit trace (for easier debugging) 2019-10-04 21:16:23 +02:00
ptitSeb 4877ea333d [DYNAREC] Implemented Barrier on optim propagation 2019-10-04 19:26:16 +02:00
ptitSeb e11da4bc5f [DYNAREC] Added a small optimisation about flags handling 2019-10-04 18:12:07 +02:00
ptitSeb 0d0ac4e7f5 [DYNAREC] Fixed a few stuff in opcode 2019-10-04 16:42:25 +02:00
ptitSeb 7b33635997 [DYNAREC] Added a few more opcode 2019-10-04 16:07:47 +02:00
ptitSeb 47fd5dc02f [DYNAREC] Fixed LDR and STM print 2019-10-04 16:07:32 +02:00
ptitSeb 37568985ac [DYNAREC] More opcode 2019-10-04 11:25:20 +02:00
ptitSeb 0dc1fcebc3 [DYNAREC] Added a few more instructions 2019-10-04 11:18:02 +02:00
ptitSeb ea6d20f154 [DYNAREC] Fixed B(L) printer 2019-10-04 10:35:55 +02:00
ptitSeb cb430ac2b1 [DYNAREC] A few simplification in the dynarec writing 2019-10-04 08:45:54 +02:00
ptitSeb fbf7e5b92b [DYNAREC] Added a few more opcodes 2019-10-04 00:11:46 +02:00
ptitSeb 04bae841bf [DYNAREC] Change handling of FLAGS, now using same mecanism than Interpretor 2019-10-03 23:54:42 +02:00
ptitSeb c2ae984b2c Fixed fork 2019-10-03 21:51:31 +02:00
ptitSeb c78a0c31b5 [DYNAREC] Fixed B(L) emitter 2019-10-03 21:49:57 +02:00
ptitSeb 64f519b094 [DYNAREC] Fix arm_printer for BLX opcode 2019-10-03 10:21:44 +02:00
ptitSeb 4fc50631c1 [DYNAREC] Added a few more opcode 2019-10-02 23:36:45 +02:00
ptitSeb 1e0411b303 [DYNAREC] Fixed linker (was useless before), and added JZ opcode 2019-10-02 23:12:50 +02:00
ptitSeb 16c77bedde [DYNAREC] Added a few more instructions 2019-10-02 20:21:15 +02:00
ptitSeb 5c143cf736 [DYNAREC] Fixed issue with flags, now all test are OK 2019-10-02 20:06:15 +02:00
ptitSeb ffe8831ff6 [DYNAREC] Another small improvment in dynarec dump 2019-10-02 18:20:16 +02:00
ptitSeb 9395c39d4f [DYNAREC] Better dynarec dump in some cases 2019-10-02 18:00:35 +02:00
ptitSeb 827c9169f9 [DYNAREC] Small optimization of get_ed 2019-10-02 16:55:21 +02:00
ptitSeb d3f17d0ced [DYNAREC] Fixed an issue with arm_printer 2019-10-02 16:54:59 +02:00
ptitSeb a8cfb46964 Refined .gitignore 2019-10-02 16:20:21 +02:00
ptitSeb 11dbb69635 [DYNAREC] Added a crude Arm opcode printer, to help debugging 2019-10-02 16:20:00 +02:00
ptitSeb 5a8f986748 [DYNAREC] Small improvement in dynarec logs 2019-10-02 10:40:31 +02:00
ptitSeb ce766cea74 [DYNAREC] Fixed and add some opcode, still some bug to fix (test10 broken) 2019-10-02 09:18:21 +02:00
ptitSeb 8f2da8fe37 [DYNAREC] Created and changed some macro to simplify opcode writing 2019-10-02 08:42:30 +02:00
ptitSeb 360ba93e4c [DYNAREC] Fixed some opcode, all tests pass now 2019-10-02 08:05:33 +02:00
ptitSeb f17b1f8e67 [DYNAREC] Enabled dynarec in more case than just thread, and clear cache for newly filled dynarec block (still test 10 and 12 broken) 2019-10-01 23:46:59 +02:00
ptitSeb e52681e3f1 [DYNAREC] Add runtime linker between blocks 2019-10-01 22:00:13 +02:00
ptitSeb 6b14acfb93 Merge branch 'master' into dynarec 2019-10-01 21:28:42 +02:00
ptitSeb d5c6847d1f [DYNAREC] Small typo 2019-10-01 21:21:03 +02:00
ptitSeb 2fc49d5d68 [DYNAREC], Change the way mmap is called (batched now), and put many things behind mutex (still issues with threads 2019-10-01 21:20:36 +02:00
ptitSeb 2c68b3933d Merge pull request #63 from rajdakin/master
Fixed the PSRAQ instruction
2019-10-01 21:17:59 +02:00
rajdakin cea91ec477 Fixed the PSRAQ instruction 2019-10-01 21:11:04 +02:00
ptitSeb 375717346b [DYNAREC] Fixed Flags mirroring 2019-09-30 21:33:41 +02:00
ptitSeb ef856ce1ce [DYNAREC] Added XOR Gd, Ed opcode 2019-09-29 22:38:11 +02:00
ptitSeb 2da87ea466 [DYNAREC] Small geted optimization 2019-09-29 22:24:45 +02:00
ptitSeb c1ee773c83 [DYNAREC] Added GS: Infrastructure 2019-09-29 22:16:27 +02:00
ptitSeb ca1f0e11ff [DYNAREC] Added a global switch, plus some 0xFF opcodes 2019-09-29 19:31:45 +02:00
ptitSeb 83cf1a8662 [DYNAREC] Added Sub Ed, Ix and Mov Ed, Id opcode 2019-09-29 18:35:14 +02:00
ptitSeb a68aef90f5 [DYNAREC] Added Ret opcode 2019-09-29 16:12:29 +02:00
ptitSeb 0b432e8139 [DYNAREC] Added Mov Gd, Ed 2019-09-29 15:54:28 +02:00
ptitSeb cb795b8089 [DYNAREC] Added Call relative opcode 2019-09-29 15:45:15 +02:00
ptitSeb 949e781e64 [DYNAREC] Added simple Mov Ed, Gd opcode, and improved Push 2019-09-29 15:32:31 +02:00
ptitSeb 8de42fc6d3 [DYNAREC] First working draft of the Dynarec. Only PUSH instruction for now, so not usefull yet 2019-09-29 13:05:13 +02:00
ptitSeb e9f07fa36a [DYNAREC] More infrastructure, no emiter yet 2019-09-29 10:23:23 +02:00
ptitSeb 5f91619de7 [DYNAREC] Put some atomic to lock concurent access to dynablock list 2019-09-28 16:20:52 +02:00
ptitSeb df7818bc87 [DYNAREC] Added some basic infrastructure 2019-09-28 16:11:14 +02:00
ptitSeb e381c79535 Merge pull request #61 from afonso360/mmx
Implement all MMX Instructions + Tests
2019-09-28 00:02:46 +02:00
ptitSeb 055dcb8cf5 Added some libc function needed by mohaa linux server 2019-09-27 21:01:24 +02:00
Afonso Bordado b679fade0b Add MMX test binary and reference output 2019-09-27 09:50:18 +00:00
Afonso Bordado b9d35c3327 Minor cleanups 2019-09-26 22:24:28 +00:00
Afonso Bordado f1a01e7563 Implement MMX Shifts 2019-09-26 22:15:05 +00:00
Afonso Bordado a2735296b7 Use intruction names in tests 2019-09-26 21:25:31 +00:00
Afonso Bordado a4b26be5e7 Add MMX Shift instructions 2019-09-26 21:22:31 +00:00
Afonso Bordado 0d4e4081c4 Add MMX compare ops 2019-09-26 16:56:19 +00:00
Afonso Bordado 2099b0866c Add MMX Unpack tests 2019-09-26 16:18:31 +00:00
Afonso Bordado 07cc1a7fc5 Add debug info when test fails 2019-09-26 16:08:41 +00:00
Afonso Bordado 8ceedc8c9e Fix error loading MMX registers 2019-09-26 16:08:05 +00:00
Afonso Bordado c8735a444e Add MMX paccksswb and tests 2019-09-26 15:44:09 +00:00
Afonso Bordado 352da49fdc Add MMX Multiply instructions 2019-09-26 14:37:56 +00:00
Afonso Bordado 0285cd1522 Add MMX Logical Ops 2019-09-26 13:06:12 +00:00
Afonso Bordado 8d4ff9076d Add MMX SUB Instructions + tests 2019-09-26 07:41:23 +00:00
Afonso Bordado 5053141678 MMX Test: Use instruction name intrinsic 2019-09-26 06:17:41 +00:00
Afonso Bordado 3075400211 Add MMX ADD instructions 2019-09-25 21:46:15 +00:00
Afonso Bordado b301237ac6 Add psrlq and paddb + tests 2019-09-25 20:43:46 +00:00
Afonso Bordado c6f071d37d Add MMX cpuid tests 2019-09-25 19:26:35 +00:00
ptitSeb 85011ebd1e Update README.md 2019-09-24 21:11:39 +02:00
ptitSeb bb783ca8eb Merge pull request #60 from afonso360/fix-o0-build
Fix undefined reference to inline functions when building with O0
2019-09-21 19:09:31 +02:00
Afonso Bordado 61fecbab28 Fix undefined reference to inline function when building with O0
Currently building with O0 causes these functions to fail linking.
2019-09-21 17:03:25 +00:00
ptitSeb fc5562e110 Added more video (not from me) on the Readme. 2019-09-16 10:23:23 +02:00
ptitSeb 82d3bc26ca Update README.md 2019-09-16 10:13:36 +02:00
ptitSeb e7d9ec3875 Fixed a small bug in BOX86_ default PATH and LD_LIBRARY_PATH 2019-09-15 21:34:26 +02:00
ptitSeb 6359841f34 Fixed SDL1 SDL_EventFilter handling 2019-09-15 18:24:38 +02:00
ptitSeb 7d2f002139 Fixed issue with the GOS wrapped macro (so SDL_JoystickGetGUID is found now) 2019-09-15 15:20:08 +02:00
ptitSeb 86fe4487d0 Added mktemp wrapped function 2019-09-15 14:47:23 +02:00
ptitSeb b9aebfbe50 Added a small batch of wrapped functions 2019-09-15 14:00:32 +02:00
ptitSeb 350f77397d Added 2 more wrapped GL 4.4 functions 2019-09-15 11:48:18 +02:00
ptitSeb 5d6a4fc068 Custom wrapper for SDL 1.2 version of SDL_LoadObject, SDL_LoadFunction and SDL_UnloadObject 2019-09-15 09:44:49 +02:00
ptitSeb 71ae77070e Use any Python interpretor that in found on the system to generate wrappers 2019-09-15 09:05:32 +02:00
ptitSeb 4867096bba Better error message when file is not a file or not executable 2019-09-15 08:33:05 +02:00
ptitSeb db495d3331 Small change in help, again 2019-09-15 08:15:19 +02:00
ptitSeb 33c34a9f2c Merge pull request #52 from voltagex/patch-1
Fix some spelling and grammar in the help text
2019-09-15 08:04:32 +02:00
Adam Baxter 9024d36bb0 Fix some spelling and grammar in the help text 2019-09-15 15:52:38 +10:00
ptitSeb 083d4d3ebb Merge pull request #51 from ctoth/master
README fixes
2019-09-15 07:43:54 +02:00
Christopher Toth 1fc0ac852f README fixes 2019-09-14 23:32:44 -06:00
ptitSeb 402f1af78d Removed a warning in x86 build 2019-09-13 09:55:00 +02:00
ptitSeb c1b9c43c08 Merge pull request #48 from M-HT/fixes
New instruction and minor fixes
2019-09-12 22:35:04 +02:00
M-HT 08680c30bc Fix compilation instructions 2019-09-12 22:24:18 +02:00
M-HT 9db394408c Fix function vsprintf in libc 2019-09-12 22:21:37 +02:00
M-HT 1575c15a2b Add instruction 'rep stosw' 2019-09-12 22:20:13 +02:00
ptitSeb a019198997 Merge pull request #47 from M-HT/fixes
Fix wrapper generator to work with python2 and python3
2019-09-09 21:04:43 +02:00
M-HT ada81a7129 Fix wrapper generator to work with python2 and python3 2019-09-09 20:41:26 +02:00
ptitSeb 4f833dbf60 Merge pull request #46 from rajdakin/fixes
Fixes
2019-09-08 20:14:44 +02:00
rajdakin 50fed3ee4b Fixed the *stsymbolmap type 2019-09-08 19:48:58 +02:00
rajdakin 429dbd78cc Fixed the x86emu_fork function 2019-09-08 19:48:17 +02:00
rajdakin 3c354dc67b Forced the use of Python2 with the wrappers 2019-09-08 19:47:34 +02:00
ptitSeb 79ecafe9a6 Added alternate names for libssl and libcrypto (should help running on some debian system) 2019-08-25 10:53:03 +02:00
ptitSeb 3a69598d93 Try a better way for the hack for open(64) of /proc/self/cmdline 2019-08-15 19:21:41 +02:00
ptitSeb 6f8f539c47 Fixed flock wrapped function (helps Steam and SteamCMD) 2019-08-15 19:13:44 +02:00
ptitSeb ee49cec5ae Fixed open64 trace 2019-08-15 19:08:10 +02:00
ptitSeb f231f70d7f [PANDORA] Add X11 32bits -> 16bits automatic conversion option 2019-08-15 15:08:14 +02:00
ptitSeb acedd159ad Better logging macro 2019-08-15 10:10:39 +02:00
ptitSeb 8cfdaeeac7 Added a bunch of SDL2 wrapped functions 2019-08-13 21:23:15 +02:00
ptitSeb 059ad7b0c2 Some additions to wrapped libm 2019-08-11 17:13:55 +02:00
ptitSeb a05cda5d72 The box86 binary that have trace enabled is named box86t now... 2019-08-11 17:13:35 +02:00
ptitSeb 82a5870e39 Better log for fmodf and fmod wrapped functions 2019-08-06 17:45:12 +02:00
ptitSeb 77fdb3ad1f Added a bunch of wrapped function (and fixed a few X11 function with callback) 2019-08-06 17:21:11 +02:00
ptitSeb b1c6cb605e Fixed some issue with dlsym 2019-08-04 19:38:35 +02:00
ptitSeb 13ecf84ae0 Fixed a potential issue with dlsym on RTLD_NEXT (thanks @rajdakin) 2019-08-04 14:38:06 +02:00
ptitSeb 69e3489ef8 Added new opcode (handling segment, hopfully it's ok) 2019-08-03 21:22:58 +02:00
ptitSeb f45e64dbb9 No need to clean stack for new thread 2019-08-03 21:22:34 +02:00
ptitSeb 390b2e0601 Added a few more wrapped functions in SDL2 mainly 2019-08-03 20:03:23 +02:00
ptitSeb f7b97e556d Added a few more asound wrapped functions 2019-08-03 19:32:37 +02:00
ptitSeb 02dd7f7554 Added snd_pcm_avail so wrapped libasound 2019-08-02 21:29:47 +02:00
ptitSeb eb817d4469 Added a few more X11 wrapped functions 2019-08-01 18:05:58 +02:00
ptitSeb 55e37b7605 Better dependancies on wrapped X11 extensions libs 2019-08-01 16:48:16 +02:00
ptitSeb 7cf51a387c Added mincore and setcontext (untested) wrapped functions 2019-08-01 15:39:57 +02:00
ptitSeb a93fb9c690 Added 1 SSE opcode 2019-08-01 15:39:37 +02:00
ptitSeb b7e963f005 Changed the way dlsym look for the symbol (search also in dependant libs) 2019-08-01 15:21:37 +02:00
ptitSeb 12f2d917d3 Added some wrapped function (including 2 functions with callback in png16) for Trine 2019-07-31 22:22:03 +02:00
ptitSeb eb4172c08d Added SDL_utf8strlcpy to wrapped function 2019-07-31 21:30:18 +02:00
ptitSeb 0bd6a97867 Fixed SDL2_snprintf and added 2 new wrapped function (for La-Mulana) 2019-07-31 14:58:27 +02:00
ptitSeb 52a78b7ac2 Even better fix when calling XSetErrorHandler with a NULL handler 2019-07-31 11:57:22 +02:00
ptitSeb f8d56351b9 Fixed an issue when calling XSetErrorHandler with a NULL handler 2019-07-31 11:56:34 +02:00
ptitSeb 5ac9477284 Added 1 MMX Opcode 2019-07-30 22:48:13 +02:00
ptitSeb 73b76d3fd7 Fixed 2 wrapped SDL2 function (they return a struct and should have some special care taken) 2019-07-30 22:15:46 +02:00
ptitSeb c835972b8b Fixed an issue with function that return structures 2019-07-30 22:15:00 +02:00
ptitSeb d6341fd2de Fixed issues with the new SDL2 RWops handling 2019-07-30 20:21:18 +02:00
ptitSeb e5140393de Try to change handling of SDL2 RWops, hopefully fixing 'size' use and other cases 2019-07-30 16:51:38 +02:00
ptitSeb a24946719c Added a hack for RWops static function stdio_size (used on RWFromFP and RWFromFile) 2019-07-29 19:04:49 +02:00
ptitSeb c7018d1dac Added wrapped toascii libc function 2019-07-29 15:48:21 +02:00
ptitSeb 015f1551aa Added wrapped libresolv (partial) 2019-07-29 15:06:49 +02:00
ptitSeb fe9417f217 Added more libGL wrapped function (4.4 and 4.5) 2019-07-29 12:26:25 +02:00
ptitSeb 80d28b50e0 Made the message if not finding a Weak symbol as a Warning instead of an Error 2019-07-29 10:29:51 +02:00
ptitSeb 9d60c8ef1a More SDL2 symbol, and fixed a few other 2019-07-29 10:26:54 +02:00
ptitSeb 6aea2acad0 Added STT_NOTYPE to Symbol referenced (helps libfodex.so) 2019-07-29 08:20:07 +02:00
ptitSeb 31f0efd7cd Added a few more symbols 2019-07-29 07:49:18 +02:00
ptitSeb 7bb7d8857d Organized the project, with folders... 2019-07-28 14:01:19 +02:00
ptitSeb 9f59d66ab7 Start support Unity games (WIP...) 2019-07-28 12:14:29 +02:00
ptitSeb 0b16044f1a Added a few wrapped functions 2019-07-27 09:31:14 +02:00
ptitSeb 6b45e4886a Small changes/fixes to wrapped openal and alut 2019-07-21 20:18:41 +02:00
ptitSeb b3472e35f1 Improved tracing of Native wrapped functions 2019-07-19 11:04:18 +02:00
ptitSeb c42574030d Changed the way phtread_cond_t are handled 2019-07-15 15:13:58 +02:00
ptitSeb 6040f1316f Fixed SDL2 ReadXX wrapped functions 2019-07-15 11:38:14 +02:00
ptitSeb 196a73d416 Fixed (hopefully) and completed openal wrapper 2019-07-15 09:05:27 +02:00
ptitSeb 20f3bb2fa0 Some more finetuning to libvorbis alignments 2019-07-15 00:00:51 +02:00
ptitSeb aac73a1476 Aligned some more libvorbis structure, and checked all functions (and added a few too) 2019-07-14 23:47:18 +02:00
ptitSeb 92ec9a8446 Added wrapped libXdmcp (complete) 2019-07-14 21:43:38 +02:00
ptitSeb 9c7e5ffc18 Added wrapped libXau (complete) 2019-07-14 21:23:16 +02:00
ptitSeb 98eeaebdae And another small batch of SDL2 wrapped functions 2019-07-14 17:46:15 +02:00
ptitSeb fafd015424 Added a few SDL2 wrapped functions (help pico8_dyn) 2019-07-14 17:17:38 +02:00
ptitSeb 7109034f4b Added 2 wrapped libc functions 2019-07-14 16:28:03 +02:00
ptitSeb df5f152ba8 One more png16 wrapped function 2019-07-14 15:18:17 +02:00
ptitSeb 5aa35b98bc Made LOCK function fallback to regular unlock on Ivalid Lock Opcode, plus added a variant of BTR opcode 2019-07-14 15:04:24 +02:00
ptitSeb e362963d2a Added wrapped libsdl1ttf (complete) 2019-07-14 14:29:19 +02:00
ptitSeb 34dc5355bc Added libGL as prerequisite for libGLU 2019-07-14 14:28:56 +02:00
ptitSeb 9812c5250d Changed the way Threads are created 2019-07-14 12:23:36 +02:00
ptitSeb 0432851f94 Added libjpeg.so.62 as an alias for libjpeg.so.8 2019-07-14 12:23:17 +02:00
ptitSeb a8721b637c Trace can be now >2GB 2019-07-13 18:00:49 +02:00
ptitSeb 26c2dafaf8 Small check on FindNearestSymbolName 2019-07-13 14:53:33 +02:00
ptitSeb e6f85c01bd Added a few openal wrapped functions 2019-07-13 14:39:15 +02:00
ptitSeb edcc388dd4 Some more opcode for GS: 2019-07-13 14:33:59 +02:00
ptitSeb 965bf6af4e Wrapped vswscanf 2019-07-13 13:40:50 +02:00
ptitSeb 834b3f7dfb A few more thread wrapped functions 2019-07-13 13:05:21 +02:00
ptitSeb 141d57f5b0 Added Wrapped libuuid (complete) 2019-07-13 12:56:53 +02:00
ptitSeb 8c285de23c uname now return i686 as machine 2019-07-13 10:48:34 +02:00
ptitSeb 034f290d9c Less traces in DEBUG mode for libc syscall 2019-07-13 10:48:12 +02:00
ptitSeb a38c98dccd Update README.md 2019-07-11 15:31:26 +02:00
ptitSeb 325582b295 Fixed implementation of sys_clone 2019-07-10 07:42:27 +02:00
ptitSeb f024818d2e Added partial implementation of getcontext 2019-07-10 07:41:56 +02:00
ptitSeb 6699449e9f Added some command in USAGE.md 2019-07-10 07:41:21 +02:00
ptitSeb 18860e2980 Log XLoadQueryFont 2019-07-09 07:56:14 +02:00
ptitSeb 7a1cc9925d [PANDORA] Add crude font substitution on XFontQueryLoad on Pandora for 9x15 => 6x13 2019-07-09 07:55:31 +02:00
ptitSeb de99a7af47 Also log success call to dlsym with BOX86_DLSYM_ERROR (maybe introduce =2 for more loggin?) 2019-07-09 07:54:40 +02:00
ptitSeb e15647ae1b Fix build with TRACE activated 2019-07-07 20:17:06 +02:00
ptitSeb d897087b3d Improved trace by creating a map of native symbol used instead of using dladdr 2019-07-06 12:24:27 +02:00
ptitSeb b4a788e03a Merge pull request #33 from M-HT/fixes
Fix function vsscanf in libc wrapper
2019-07-05 14:58:05 +02:00
M-HT fb0928c0f5 Fix function vscanf in libc wrapper 2019-07-05 13:28:55 +02:00
ptitSeb 1e449415b1 Added syscall 45 2019-07-03 18:06:30 +02:00
ptitSeb dc672db867 Add a few wrapped functions 2019-07-03 16:06:18 +02:00
ptitSeb 50a300ddd7 Remove some warning 2019-07-03 16:06:02 +02:00
ptitSeb 55224d6f4c BOX86_DLSYM_ERROR will also log dlopen errors 2019-07-03 15:12:15 +02:00
ptitSeb 80d9ce417c Added proprer bejavour for dlerror 2019-07-01 20:31:19 +02:00
ptitSeb d28a3b7c30 And a few more wrapped libc and pthread functions 2019-07-01 17:29:12 +02:00
ptitSeb f3b80cbb4b Allow lib to have no entry point 2019-07-01 15:54:41 +02:00
ptitSeb 5b0d212ba2 A few more wrapped functions 2019-07-01 15:47:12 +02:00
ptitSeb 5741d76b96 Add proprer handling of TLS -both main elf and libraries 2019-06-30 19:47:54 +02:00
ptitSeb 86d7f65026 Fixed __thread test (test11 was outputing it's location) 2019-06-30 17:34:21 +02:00
ptitSeb 9f0b1af6b7 Lets have thread_once acting thread local 2019-06-30 12:10:43 +02:00
ptitSeb e9b90ee58e Added one more instruction in GS: part of x86 interpretor (still partly wrong) 2019-06-30 11:28:33 +02:00
ptitSeb 8e1ab7d505 Added a new test on __thread local variable (not working yet) 2019-06-30 11:27:05 +02:00
ptitSeb 21a72bd2e5 Added R_386_TLS_TPOFF to the dump list 2019-06-27 23:00:17 +02:00
ptitSeb 245c4eaacb Added some utilities functions on elf and function name and finding 2019-06-27 19:31:19 +02:00
ptitSeb d08a85eeae More libcrypto wrapped functions 2019-06-27 19:30:48 +02:00
ptitSeb 92bb8906ca Fix an issue with wrapped sigaction when act is NULL 2019-06-27 12:41:11 +02:00
ptitSeb 1caf52e02a Get tid of process when calling a wrapped function only when logging function call 2019-06-27 12:18:07 +02:00
ptitSeb 9ac44be751 A few more c wrapped functions 2019-06-27 12:17:31 +02:00
ptitSeb 9ace74fee7 Added ability to open SELF to wrapped dlopen 2019-06-27 12:02:24 +02:00
ptitSeb a8f1d26ea9 Added a few wrapped libm functions 2019-06-27 11:34:15 +02:00
ptitSeb d8ae82c5f9 Added completely wrapped libutil.so.1 2019-06-27 11:27:36 +02:00
ptitSeb 56552528cb Added a wrapped function and syscall 355 (getrandom) 2019-06-26 22:28:49 +02:00
ptitSeb 0cab13f614 More wrapped function. Now dropbox kind of start, before crashing for unsupported lnx.armv7l platform on the Pandora 2019-06-26 22:17:41 +02:00
ptitSeb 020327969f [PANDORA] Add definition to __NR_sendmmsg if not present (should be ok, it's added in kernel since 3.2 and current one is 3.2.102) 2019-06-26 19:21:58 +02:00
ptitSeb e269cdaa6d And more libc wrapped function 2019-06-26 18:29:09 +02:00
ptitSeb c0f04ccf0e Added tentative wrapped version of fcntl64 (and lockf64 too) 2019-06-26 17:58:46 +02:00
ptitSeb d45f94ee2e Add some dbus wrapped function, including callbacks 2019-06-26 17:47:51 +02:00
ptitSeb 32017cdf6b A few wrapped functions for libc and pthread 2019-06-26 16:34:16 +02:00
ptitSeb 36db516db5 Added some more wrapped libc functions 2019-06-26 16:07:59 +02:00
ptitSeb 1d0bfe643e Fixed __udivdi3 and __umoddi3 wrapped functions 2019-06-23 21:27:26 +02:00
ptitSeb 269a96c5eb Merge pull request #29 from rajdakin/python_fix
Correct fix for the generator bug
2019-06-23 21:01:56 +02:00
rajdakin b9a160320b Updated version 2019-06-23 20:39:29 +02:00
rajdakin bb075ea82e Correct fix for the generator bug 2019-06-23 20:35:42 +02:00
ptitSeb fd873f8b8f Added a few functions to libc wrapper 2019-06-23 18:03:40 +02:00
ptitSeb 29a33b9836 Fix wrapper generator 2019-06-23 17:40:39 +02:00
ptitSeb 6b01e4226c Merge pull request #28 from rajdakin/python_fix
Upgrade the python generator
2019-06-23 16:57:59 +02:00
rajdakin 9aa0a6352d Forgot to check if the defines are configurable 2019-06-23 16:27:09 +02:00
rajdakin 26f50ca98c Upgrade the python generator (no more config skip) 2019-06-23 16:21:31 +02:00
ptitSeb 1e605a9561 Rebuilt test10 with g++ 5.5 (instead of 7.4), to lower requirement on x86 libstdc++/libgcc_s 2019-06-23 14:50:39 +02:00
ptitSeb 556ac3db76 Merge pull request #27 from rajdakin/test10
Test 10
2019-06-23 14:40:03 +02:00
rajdakin 83d1b68ef5 Added test number 10 (needs x86 library though) 2019-06-23 14:33:54 +02:00
ptitSeb 917d6df290 Added libpng12 wrapper with a few functions 2019-06-23 14:12:28 +02:00
ptitSeb 65d4af771d Don't put a message on NONE debug level if a Weak symbol is not found for Jump slot 2019-06-23 12:37:13 +02:00
rajdakin 34ae8d5274 Fixed a warning 2019-06-23 12:20:11 +02:00
ptitSeb f3d20f5605 Fixed some LOCK Opcode 2019-06-23 12:15:28 +02:00
ptitSeb de879d55e0 Added a few more Opcode to LOCK 2019-06-23 12:09:52 +02:00
ptitSeb 9271efd4ed Added LOCK mecanism (hopefully working well enough for GCC Atomics), and reorganised GS: opcodes too 2019-06-23 11:46:15 +02:00
ptitSeb 12c2798017 Wrappers in ARM version 2019-06-23 11:45:34 +02:00
ptitSeb e5d0da5042 Merge pull request #26 from rajdakin/python_fix
Python generator enhancement
2019-06-22 19:05:39 +02:00
rajdakin 3b29a5d7c6 Implemented the bad middle letter rejection 2019-06-22 18:01:54 +02:00
rajdakin 938bdabd26 Probably fixed some typos 2019-06-22 17:48:40 +02:00
ptitSeb 454fd20cf5 Merge pull request #25 from rajdakin/warning_removal
Fixed an ignored warning
2019-06-22 17:48:13 +02:00
rajdakin 03277cbf42 Use the correct define, enhance files
Enhances CMakeLists and the Python wrapper generator script
2019-06-22 17:46:46 +02:00
rajdakin 41433715c1 Fixed an ignored warning 2019-06-22 17:00:43 +02:00
ptitSeb b59e38519b Added ld-linux-armhf.so.3 to list of openned native ld-linux libs 2019-06-21 08:26:32 +02:00
ptitSeb 7500aa3c6d Small changes on FPU Round helper 2019-06-20 21:08:27 +02:00
ptitSeb 7655700eff Fix ARM build 2019-06-20 21:04:59 +02:00
ptitSeb 666cd30c2b Merge pull request #23 from rajdakin/warnings_removal
Remove almost all GCC warnings
2019-06-20 20:33:06 +02:00
rajdakin 9a2b00891b Merge branch 'master' of https://github.com/ptitSeb/box86 into warnings_removal 2019-06-20 18:53:13 +02:00
rajdakin 80c0213543 Major (unsure) fixes 2019-06-20 18:44:06 +02:00
rajdakin 0d9f841123 Minor fixes 2019-06-20 18:43:24 +02:00
rajdakin fe0bc588a8 Warnings removal 2019-06-20 18:42:39 +02:00
ptitSeb 9bc2b1fe44 Merge pull request #22 from rajdakin/master
Fixed the `NOLOADADDR` option
2019-06-20 17:38:12 +02:00
rajdakin 912e9388ba Fixed the NOLOADADDR option
Fixed the `NOLOADADDR` option: it can now be enabled (whereas before it was `NOLOADADDR,`, which is different)
2019-06-20 16:50:19 +02:00
ptitSeb a4078c5e73 Added NOLOADADDR cmake option 2019-06-20 11:09:17 +02:00
ptitSeb b0faec1c87 Try to implement olduname (109) and newuname (122) syscalls 2019-06-20 11:00:25 +02:00
ptitSeb 5f2ac78654 Added SDL_SetWindowDisplayMode wrapped function 2019-04-19 17:56:24 +02:00
ptitSeb 853552ca3a Added a few libc wrapped functions 2019-04-03 21:54:34 +02:00
ptitSeb dd00f1b1a1 Added sys_geteuid and sys_getegid syscall 2019-04-02 07:41:58 +02:00
ptitSeb 19095d3fd3 Merge pull request #18 from meveric/master
adding more missing functions
2019-03-31 12:19:05 +02:00
meveric 5cc4da0364 adding libc madvise and gnu_dev_makedev
see https://0x48.pw/libssh/include/x86_64-linux-gnu/sys/sysmacros.h.html for gnu_dev_makedev
2019-03-31 10:07:38 +00:00
meveric 565a0fdb1b adding libpthread __pthread_unwind_next 2019-03-31 09:59:10 +00:00
meveric 19a4b3188e adding libc ftok 2019-03-31 09:56:17 +00:00
meveric a9f584575a adding libc getresgid and getresuid 2019-03-31 09:54:25 +00:00
meveric 3030cb2fdc adding libc sigsuspend 2019-03-31 09:52:35 +00:00
meveric 21107c9a42 adding libc sigblock, siggetmask, sigsetmask, sigvec 2019-03-31 09:50:22 +00:00
meveric cb19661909 adding libc __fgets_chk 2019-03-31 09:46:43 +00:00
meveric 70845c2977 adding libc sigdelset and sigismember 2019-03-31 09:44:17 +00:00
meveric a2bf66da50 adding libc __signbit and __signbitf 2019-03-31 09:41:24 +00:00
meveric 2710f621ae adding libpthread __pthread_register_cancel and __pthread_unregister_cancel 2019-03-31 09:32:10 +00:00
meveric 370fbd6072 adding libc __libc_current_sigrtmax 2019-03-31 09:28:26 +00:00
meveric 6ce990ce36 adding libc wordexp, wordfree 2019-03-31 09:21:52 +00:00
meveric 235e99de96 adding libc wait3, wait4 2019-03-31 09:20:08 +00:00
meveric 08a0b537e8 adding libc __sched_cpucount 2019-03-31 09:16:59 +00:00
meveric 285f30c8c0 adding libc strnlen 2019-03-31 09:14:24 +00:00
meveric 48cea000dc adding libc creat64 2019-03-31 09:12:43 +00:00
meveric b405516719 adding libx11 XkbSetDetectableAutoRepeat 2019-03-31 09:10:11 +00:00
meveric d278f8c77a adding libm __expf_finite 2019-03-31 09:08:24 +00:00
meveric 58a731e6fd adding libc getdtablesize 2019-03-31 09:05:06 +00:00
meveric b9f0754140 adding x11 XScreenCount 2019-03-31 09:03:09 +00:00
meveric 1c0b79d783 adding libc getprotoent, getprotobyname, getprotobynumber, setprotoent, endprotoent 2019-03-31 08:57:48 +00:00
meveric 84ed9f5c50 adding libx11 XGetFontPath 2019-03-31 08:54:26 +00:00
meveric 691296bb57 adding libpthread pthread_mutexattr_setpshared 2019-03-31 08:44:56 +00:00
meveric 6af7acc980 adding libm feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag, fetestexcept, fegetround, fesetround, fegetenv, feholdexcept, fesetenv, feupdateenv, feenableexcept, fedisableexcept, fegetexcept 2019-03-31 08:42:08 +00:00
ptitSeb b5c0ec57ec Added minimal libcrypto and libssl native support (Memoranda works now, even if not all needed functions are wrapped) 2019-03-30 11:09:50 +01:00
ptitSeb e3e3aafc29 Added sys_personality syscall 2019-03-28 07:37:38 +01:00
ptitSeb 30d585e008 Added another batch of MMX/SSE opcodes (for Rocketbird) 2019-03-25 17:10:53 +01:00
ptitSeb fa630b07f8 Fixed POP ESP 2019-03-25 15:51:08 +01:00
ptitSeb 95b32ae801 Improving cpu trace in multi-thread context 2019-03-25 15:48:04 +01:00
meveric 4abc5ca757 started working on Gratuitous Space Battles (#17)
* adding X11 XChangeWindowAttributes

* adding sdl2 SDL_SetRelativeMouseMode

* adding libc strverscmp

* adding libc getauxval (available in glibc 2.16 or higher)

* adding libc mlock, mlockall, munlock, munlockall

* adding libc inet_nsap_ntoa

* adding libc random_r, srandom_r, initstate_r, setstate_r

* adding libc ngettext, dngettext, dcngettext

* adding x11 XGetDefault

* adding libc bcopy

* adding x11 XAddExtension
2019-03-25 13:44:06 +01:00
ptitSeb ddc0523c10 Added a new batch of SSE/MMX opcodes 2019-03-25 10:45:53 +01:00
ptitSeb af8b188336 Added thread id on Unimplemented opcode message 2019-03-25 09:49:29 +01:00
ptitSeb b6bc5ccef0 Add aligment for epoll_event structure (and now steamcmd should the prompt) 2019-03-24 16:43:21 +01:00
ptitSeb daca7ac870 Some changes to thread and callbacks 2019-03-24 15:22:42 +01:00
ptitSeb 310c618a48 And one more, SSE this time 2019-03-24 13:30:41 +01:00
ptitSeb f8ce687308 And again one more mmx opcode 2019-03-24 12:16:55 +01:00
ptitSeb cafc5b07b7 Aded 2 more MMX opcodes 2019-03-24 11:35:54 +01:00
ptitSeb 18f07083b2 Added mmx version of pxor 2019-03-24 10:49:12 +01:00
ptitSeb d67bba49e4 Improvment to callbacks interface 2019-03-24 09:23:02 +01:00
ptitSeb 9d4af2ae1f And one more MMX opcode 2019-03-24 09:22:34 +01:00
ptitSeb 76ade17a44 Added dummy __(de)register_frame_info functions 2019-03-24 08:34:37 +01:00
ptitSeb 238c294a98 Try to improve a bit linked Shared Callback. Also use asked stacksize on Thread creation 2019-03-24 08:30:05 +01:00
ptitSeb d0c4223b2d Added PSHUFW MMX opcode 2019-03-24 07:51:36 +01:00
ptitSeb c01850ff6a Added more opcodes 2019-03-23 20:29:16 +01:00
ptitSeb bda2fca514 Added PADDW SSE2 opcode 2019-03-23 19:51:01 +01:00
ptitSeb 8857c4e566 Made init(s) of loaded libs have a correctly setupped stack (helps steamcmd) 2019-03-23 17:41:44 +01:00
ptitSeb 26c901a84d Try to let cache handle itself more (need to check which of 0 or 3 is better). Also added forgoten label from previous commit 2019-03-23 17:25:28 +01:00
ptitSeb 54382bcb22 Added PMULLW SSE opcode 2019-03-23 16:19:09 +01:00
ptitSeb 78a4e7046d Added an option to avoid handling of SigSEGV (can be usefull for debugging) 2019-03-23 16:19:09 +01:00
ptitSeb f8b795b0e6 Merge pull request #16 from meveric/master
Some cleanup and trying to get Rocketbirds to run
2019-03-23 16:04:31 +01:00
meveric e39bdb0078 adding missing libGL function glXGetCurrentDrawable 2019-03-23 14:53:50 +00:00
meveric 1656400a08 Merge branch 'master' of https://github.com/ptitSeb/box86 2019-03-23 13:35:56 +00:00
ptitSeb 816ee723ad Added two more wrapped functions 2019-03-23 14:34:19 +01:00
ptitSeb b489bc4b54 Added a precision on a log 2019-03-23 14:34:00 +01:00
ptitSeb d2ef0f0c6d Put some mutex on trace 2019-03-23 14:33:32 +01:00
meveric 4fe93aef9d adding missing #ifdef LD80BITS for several functions 2019-03-23 12:55:51 +00:00
ptitSeb 261e32ab8b Added some more wrapped function (and empty getcontext / makecontext) 2019-03-23 09:33:13 +01:00
ptitSeb 388eba5d2f Merge pull request #15 from meveric/master
working on A Bird Story
2019-03-23 08:07:39 +01:00
meveric 8196b61a3c autogen functions 2019-03-22 23:19:13 +00:00
meveric bfad527fcc adding libc sigaltstack 2019-03-22 23:18:01 +00:00
meveric 70c7adb06a adding libm acosh, acoshf, acoshl, acosl, asinl 2019-03-22 23:15:59 +00:00
meveric 1aeb73b040 adding libc ffs, ffsl, ffsll 2019-03-22 23:10:25 +00:00
meveric ad1a24c541 adding libc posix_fadvise64
unsure about off64_t it's said to be always 64 bit, but also said to be off_t on a 32bit system which is only 32bit.
2019-03-22 23:05:37 +00:00
meveric 6da33d8192 adding libc pipe2 2019-03-22 22:45:45 +00:00
meveric 33ad1a998c adding libm tgamma, tgammal, tgammaf, lgamma_r, lgammal_r, lgammaf_r, lgamma, lgammal and lgammaf 2019-03-22 22:41:35 +00:00
meveric 8e96b1e948 adding libc getgroups
not 100% sure of type gid_t list[] took it as gid_t = uint
2019-03-22 22:34:02 +00:00
meveric 7eacd670bc adding libc erfc, erfcf and erfcl 2019-03-22 22:27:59 +00:00
meveric 9a66e188d4 adding libc swapcontext, and libm asinh, asinhf, asinhl 2019-03-22 16:06:38 +00:00
meveric 469fb711a8 adding libc setrlimit64 2019-03-22 15:27:10 +00:00
meveric b903d208dd adding libc atanh, atanhf, atanhl 2019-03-22 15:25:13 +00:00
meveric ca31e209ec adding libc seekdir 2019-03-22 15:22:26 +00:00
meveric bff8f2fc19 adding libc ppoll 2019-03-22 15:19:46 +00:00
meveric bce1bbd9a2 adding libc chroot 2019-03-22 15:16:22 +00:00
meveric dcccc8bcfd adding libc setgroups 2019-03-22 15:15:25 +00:00
meveric fe1bf1b562 adding libc killpg 2019-03-22 15:13:18 +00:00
meveric 0c95fc166e adding libc initgroups 2019-03-22 15:05:31 +00:00
meveric 149d707edb adding libc getpgrp and setpgrp 2019-03-22 15:03:15 +00:00
meveric 37c1fffd97 adding libc getrlimit64 2019-03-22 14:29:01 +00:00
meveric 68863455fc adding libc euidaccess and eaccess 2019-03-22 14:25:22 +00:00
meveric da8f26e309 adding libc dup3 2019-03-22 14:23:11 +00:00
meveric b49d726835 adding libc telldir 2019-03-22 14:21:02 +00:00
meveric ba4722aeec adding libm erf, erff, erfl 2019-03-22 14:12:20 +00:00
meveric 8bbd79a065 adding libpthread pthread_attr_setguardsize and pthread_attr_getguardsize 2019-03-22 14:07:22 +00:00
meveric 426fdee8b7 adding libpthread pthread_getattr_np 2019-03-22 14:03:35 +00:00
meveric 0f025df81f fixing libc setresgid 2019-03-22 13:53:25 +00:00
meveric 13c8c97f2a adding libc setresuid 2019-03-22 13:51:44 +00:00
meveric 5eaccc69c4 adding libc utimensat 2019-03-22 13:31:16 +00:00
meveric 6c0942d9ca adding libpthread pthread_attr_getstack and pthread_attr_setstack 2019-03-22 13:12:39 +00:00
meveric c90bfa252f added missing libc function __libc_alloca_cutoff 2019-03-22 12:36:41 +00:00
meveric d4c5e5e332 adding libc __stpncpy 2019-03-22 12:26:54 +00:00
meveric 4cb2ee6803 added libc __read 2019-03-22 12:13:59 +00:00
ptitSeb 37961f5e4d Merge pull request #13 from M-HT/fixes
New instructions and other fixes
2019-03-22 07:37:17 +01:00
M-HT 93ec8163f0 Fix div function in libc wrapper 2019-03-22 00:25:16 +01:00
M-HT 026520da2f Add fnstsw, lahf, rep movsw instructions; Fix div function in libc wrapper; Use dummy error handler in function my_snd_lib_error_set_handler in libasound wrapper; Add interrupt flag to default emu flags 2019-03-21 22:39:58 +01:00
ptitSeb 09ca4b0398 Let's be less dramatic in the README 2019-03-21 22:29:49 +01:00
ptitSeb d7e5790cce Added a few more wrapped functions 2019-03-20 23:42:21 +01:00
ptitSeb 39822d9c20 Merge pull request #12 from meveric/master
most stuff needed for factorio
2019-03-20 19:05:04 +01:00
meveric 61a4b6bf26 adding glXGetConfig and XRootWindow 2019-03-20 17:55:02 +00:00
meveric fe95e0b4e4 fixing long double functions fmodl, powl and cbrtl 2019-03-20 17:42:34 +00:00
meveric f8c53bfd20 Merge branch 'master' of https://github.com/ptitSeb/box86 2019-03-20 17:34:05 +00:00
ptitSeb e5912fda9d Added syscall 265 2019-03-20 18:32:14 +01:00
meveric 82f7eb268c Merge branch 'master' of https://github.com/ptitSeb/box86 2019-03-20 17:25:25 +00:00
ptitSeb 8abb139f29 Added syscall 109 2019-03-20 18:24:24 +01:00
meveric f48e68402b adding libm __fpclassify and __fpclassifyf 2019-03-20 17:19:21 +00:00
meveric 210d571296 try adding powl 2019-03-20 17:17:01 +00:00
meveric 7b4266f443 adding libc fmodl 2019-03-20 17:08:26 +00:00
meveric 4db0e4c1ae adding mblen 2019-03-20 17:06:46 +00:00
meveric 36e8e55522 adding if_nametoindex and if_indextoname 2019-03-20 17:04:38 +00:00
meveric 0cb23d957a adding malloc_trim, __asinf_finite and __asin_finite 2019-03-20 17:00:40 +00:00
meveric fdea5394df wrapped libm cbrt, cbrtl, cbrtf functions 2019-03-20 16:47:32 +00:00
meveric 8c4bea9e52 adding wrapper for times function 2019-03-20 16:36:21 +00:00
ptitSeb e4a2fea4df Added on more opcode 2019-03-20 16:59:27 +01:00
ptitSeb cd6b9f69b3 A few more wrapped function (and now steamcmd start) 2019-03-20 15:04:22 +01:00
ptitSeb 54f785888d Fixed scandir64 wrapped function (steamcmd now updated itself) 2019-03-20 12:32:01 +01:00
ptitSeb ba44d9c07c More fixes to SSE2 opcodes (now steamcmd download updates) 2019-03-20 12:00:27 +01:00
ptitSeb d84888ec7c Fixed PACKUSWB opcode 2019-03-20 09:40:09 +01:00
ptitSeb c760f52e6d Revert to before SIMD Evrywhere. It's slower then before and also have some bugs. But there are some bug fixes too, so still need to study the opcodes 2019-03-20 08:11:11 +01:00
ptitSeb 7e0ce2cbce Some fixes to SIMD Evrywhere and some opcodes 2019-03-20 01:11:16 +01:00
ptitSeb c9868e094b Now using SIMD Everywhere for MMX/SSE/SSE2 emulation. Needs more testing but that seems to have fixed a lot of stuffs 2019-03-20 00:04:21 +01:00
ptitSeb 76d6dfe2bf Simplified a bit some primary operations 2019-03-18 23:24:10 +01:00
ptitSeb b0f15ea3ed Log output buff of snprintf when uisng BOX86_LOG=DEBUG 2019-03-18 23:23:41 +01:00
ptitSeb ebb6f3bcdb Merge pull request #11 from meveric/master
Working on KotoR2 adding functions on the way
2019-03-18 22:50:48 +01:00
meveric 20eb136c76 Working on KotoR2 adding functions on the way 2019-03-18 21:06:23 +00:00
ptitSeb 31dea5eccd Two more wrapped function, and some warning removed 2019-03-18 18:00:47 +01:00
ptitSeb fe2850a50a Merge pull request #10 from meveric/master
Add more wrapper functions
2019-03-18 17:46:29 +01:00
meveric ce16ff49cd Add more wrapper functions 2019-03-18 16:29:18 +00:00
ptitSeb 0af1112020 Added option to load PIE Program at a specific address (to help debugging) 2019-03-18 17:28:21 +01:00
ptitSeb ac441ab136 A new bunch of wrapped functions 2019-03-18 12:15:36 +01:00
ptitSeb f275040887 Added some more wrapped functions 2019-03-18 12:04:31 +01:00
ptitSeb 2f3efa1bec Added one more option to curl_easy_setopt 2019-03-18 11:54:05 +01:00
ptitSeb d1103f4ac6 Preliminary (incomplete) support for wrapped curl_easy_setopt 2019-03-18 11:39:49 +01:00
ptitSeb 7a25243cd2 Added MOVDDUP opcode 2019-03-18 10:08:43 +01:00
ptitSeb 5fb5872d0d Added a few more wrapped functions 2019-03-18 09:33:59 +01:00
ptitSeb b6ebf9f4ad Small changes to ioctl and fcntl to take into account the last param as vaarg 2019-03-17 21:35:58 +01:00
ptitSeb 080dc51f4b Small improvements to debug trace 2019-03-17 21:35:06 +01:00
ptitSeb 4ff6e20073 Merge pull request #9 from M-HT/fixes
Fixes for various issues
2019-03-17 20:46:26 +01:00
M-HT 44c9c28fa3 Add div, fcloseall, sync functions in libc wrapper 2019-03-17 20:00:01 +01:00
M-HT 7e8794fcf0 Add cmc, enter, pushfw instructions 2019-03-17 19:55:55 +01:00
M-HT 76b3afe8f9 Fix daa, das, imul, mul, shld, shrd instructions 2019-03-17 19:47:23 +01:00
M-HT 20db25cf89 Fix libasound wrapper 2019-03-17 19:43:27 +01:00
M-HT 7abea0870f Fix for filesystems with 64-bit inodes 2019-03-17 19:41:57 +01:00
ptitSeb 1ab062d899 Small optim for pshufd where src==dest 2019-03-17 14:37:35 +01:00
ptitSeb d60f7c319c Use direct native wrapped function for SDL1 version of SDL_BuildAudioCVT and SDL_ConvertAudio (for #7) 2019-03-17 14:36:30 +01:00
ptitSeb 0398803f1b This should take care of shared callback created and free inside callback (should fix #8) 2019-03-17 14:22:13 +01:00
ptitSeb 2538e7ef8c Added (untested, probably buggy) handling of syscall 120 (sys_clone) 2019-03-17 11:43:47 +01:00
ptitSeb f122665e3c Added syscall 42 2019-03-17 10:25:33 +01:00
ptitSeb 3e691791b6 better debug for statfv64 wrapped function 2019-03-17 10:14:57 +01:00
ptitSeb 430303d9c0 Forgot the table jump entry for rdtsc 2019-03-17 10:14:28 +01:00
ptitSeb ecdb0aab03 Added rdtsc instruction 2019-03-17 10:10:25 +01:00
ptitSeb 2522e9bb1d Removed the printf on tgkill 2019-03-16 21:30:59 +01:00
ptitSeb 822d8f45b6 Oops, another typo... 2019-03-16 21:27:38 +01:00
ptitSeb d036cab4c1 Slight change to poll wrapped function 2019-03-16 21:06:34 +01:00
ptitSeb 3ee1c2b282 Fixed a stupid typo, again 2019-03-16 21:06:18 +01:00
ptitSeb b2b2775504 Small fix for x86 build 2019-03-16 19:24:19 +01:00
ptitSeb 3a5ea0379a Special handling of open(64) when accessing /proc/sef/cmdline 2019-03-16 17:46:54 +01:00
ptitSeb dc3281203d Don't print Setting trace if trace is not enabled 2019-03-16 17:46:21 +01:00
ptitSeb d94a049cfd Some more cpuid leafs 2019-03-16 16:28:34 +01:00
ptitSeb c7b1c337e2 Small improvements to debug wrapped function traces 2019-03-16 16:28:09 +01:00
ptitSeb 116eaefd8f Added preliminary Signal handling 2019-03-16 12:21:20 +01:00
ptitSeb 8c70a9395d Added some support for atfork function 2019-03-16 10:09:51 +01:00
ptitSeb 29fbe46d41 Add proprer timer_create wrapped function (but because of the lack of signal handling, the timer will probably crash the app later) 2019-03-13 21:49:51 +01:00
ptitSeb aa4d982d4c Fixed some typo, fixing sdl1image, sdl2image and sdl1mixer (Also fix 'Benri and the Bandits') 2019-03-13 21:35:21 +01:00
ptitSeb fa6ab1c8c4 Change BOX86_LOG=DEBUG so a wrapped call that segfault is anyway printed in the log 2019-03-13 21:29:47 +01:00
ptitSeb a9216705e1 Added a few more wrapped function (should help 'Berni and the Bandits') 2019-03-12 08:25:57 +01:00
ptitSeb 20828213b2 Added a few wrapped function (should help Hollywood Player) 2019-03-11 22:04:58 +01:00
ptitSeb f4e228730f Added a few opcodes, needed by PixelJunk Shooter (also need LIBGL_GL=21 with gl4es) 2019-03-10 21:39:10 +01:00
ptitSeb bd9c8f0f12 Flush log trace at each write, to avoid half-written trace when segfault occurs 2019-03-10 18:09:05 +01:00
ptitSeb d07db1054a Added some more wrapped functions 2019-03-10 11:11:55 +01:00
ptitSeb 18deecddea Added a few more GS: operations 2019-03-10 11:11:29 +01:00
ptitSeb f3991199dd Improved trace with SDL_RWFromFile 2019-03-10 11:11:02 +01:00
ptitSeb 007411411b Some work to avoid Bus Error (NWN now enter in game... but crashes immediatly) 2019-03-05 21:48:48 +01:00
ptitSeb 75124ba900 Changed (again) the way elf dependancies are loaded to avoid beeing sensitive to the order of loading (fixes NWN, that crash just before the game with BusError) 2019-03-04 21:15:06 +01:00
ptitSeb 1d9589c093 New dev cycle 2019-03-04 20:47:28 +01:00
ptitSeb 6974d96f6e Update README.md 2019-03-03 21:30:04 +01:00
ptitSeb 5584e62db3 Bumped to v0.0.4 2019-03-03 21:24:04 +01:00
ptitSeb 9b968777a0 Refined the README 2019-03-03 21:04:07 +01:00
ptitSeb 62b7326a75 Remove the (now) useless while in main loop 2019-03-03 21:03:38 +01:00
ptitSeb 6b7275f475 Small syscall imrprovment 2019-03-03 19:30:52 +01:00
ptitSeb 7f174da3c7 Slightly improve debug trace 2019-03-03 18:58:29 +01:00
ptitSeb 5a1c7b50e7 Make sure Flags are clean when entering or leaving x86 emu 2019-03-03 16:59:25 +01:00
ptitSeb 39283bf99e Added (faked) CPUID Leaf 2 2019-03-03 16:58:59 +01:00
ptitSeb 95ec71bd0a Small work on syscalls 2019-03-03 16:58:22 +01:00
ptitSeb 756a7fddf2 Correct handling of .init_array sections 2019-03-03 15:52:49 +01:00
ptitSeb e1f897cab9 Added a few more syscall 2019-03-03 15:52:02 +01:00
ptitSeb eb35ed9a1b Added some more Desktop GL wrapped functions (GL 4.5 mainly) 2019-03-03 12:10:49 +01:00
ptitSeb f439a401a0 Update README.md 2019-03-03 09:24:22 +01:00
ptitSeb bfd4c8cb5c Fixed a stupid mistake on callback, fixing a large memory leak 2019-03-03 08:43:58 +01:00
ptitSeb 3fca45b256 Fixed SAHF opcode 2019-03-02 20:42:59 +01:00
ptitSeb bda27e69ba Added improved trace for glVertex2f 2019-03-02 20:15:19 +01:00
ptitSeb 1e88171d45 Added a few x87 opcodes 2019-03-02 17:23:02 +01:00
ptitSeb d9a2f6b7bb NeededLib are now loaded in the same order as listed in elf 2019-03-02 16:15:05 +01:00
ptitSeb 94de344d05 Fixed bad printing of missing symbol when applying R_386_TLS_DTPOFF32 or R_386_JMP_SLOT relocation 2019-03-02 15:58:24 +01:00
ptitSeb 3dd188dedd Added a bunch of NV and SGIX extentions to wrapped GL (should help run HumandRessouceMachine with NVidia card #2) 2019-03-02 15:51:17 +01:00
rajdakin a5562ea8bd Fixed i386 and amd64 build in wrappedlibc 2019-03-02 15:41:39 +01:00
ptitSeb 8f86acfef6 Try to avoid some warning 2019-03-02 14:39:24 +01:00
ptitSeb 890cf8841a Added some more libc wrapped functions 2019-03-02 14:36:19 +01:00
ptitSeb 55e0e5571b Added partial dladdr 2019-03-02 14:10:37 +01:00
ptitSeb 19e062a79c Setup stack before calling init instead of after in my___libc_start_main 2019-03-02 13:57:01 +01:00
ptitSeb 916a10fae8 Added some more wrapped functions 2019-03-02 08:35:06 +01:00
ptitSeb 4f8849e914 Forgot that one in previous commit 2019-03-01 18:36:30 +01:00
ptitSeb 713098471e Added a few (mostly undone) wrapped libs, plus some wrapped functions 2019-03-01 18:36:02 +01:00
ptitSeb bab00e6e42 Added 2 more opcodes 2019-03-01 17:13:52 +01:00
ptitSeb c0836a75ed Removed a warning 2019-03-01 16:46:38 +01:00
ptitSeb 6cb611971a Update README.md 2019-02-28 15:31:44 +01:00
ptitSeb 3ba09947d2 Update README.md 2019-02-27 10:40:11 +01:00
ptitSeb 523c3db8c4 Update README.md 2019-02-27 10:39:40 +01:00
ptitSeb d94b7fba23 Update README.md 2019-02-27 10:37:48 +01:00
ptitSeb ae76bbcafe Small changes in a few 0x66 prefixes opcodes 2019-02-26 07:48:56 +01:00
ptitSeb b987e9086a the mul and imul opcode now have defered flags 2019-02-25 21:36:39 +01:00
ptitSeb 47fc82a839 Remove the -no-pie and -fjump-table parameter option in the cmake, it's probably not really usefull 2019-02-25 21:36:00 +01:00
ptitSeb fcff7e85fe Some minor change to a few opcodes 2019-02-25 19:05:06 +01:00
ptitSeb 147ec021ea Implemented same fix for wide-char printf variants 2019-02-24 22:01:57 +01:00
ptitSeb cb7f4d373e Fix some border case (v/s/f)printf plus added a few wrapped functions 2019-02-24 22:00:14 +01:00
ptitSeb 3db9dfd7ea Fixed regular build (without USE_FLOAT) 2019-02-24 21:03:30 +01:00
ptitSeb 18fa4d2134 Improved callbacks, with shared and small variant 2019-02-24 16:45:58 +01:00
ptitSeb b63ec10cf7 Added a workaround for pthread_cond_t initialized statically 2019-02-24 14:49:32 +01:00
ptitSeb c44ce3acbd Fixed issue with pthread_cond_t statically initialized 2019-02-24 14:35:01 +01:00
ptitSeb fbd494d348 Added USE_FLOAT build option (hopefully a bit faster on the Pandora) 2019-02-24 13:58:31 +01:00
ptitSeb b98412de11 Added a few more instructions (Neverwinter Night start now) 2019-02-24 11:12:34 +01:00
ptitSeb cd17162a00 Save more register in EmuCall 2019-02-24 11:11:54 +01:00
ptitSeb dd63e8cc86 Made thread_once mecanism much simpler 2019-02-24 11:11:12 +01:00
ptitSeb 1d0ca9bf0c Some simplifications and improvments to emulated functions call 2019-02-24 11:10:33 +01:00
ptitSeb c0704f6a34 Update README.md 2019-02-24 09:02:05 +01:00
ptitSeb a7750a38b9 Added dependant libs when loading SDL1 2019-02-23 14:17:11 +01:00
ptitSeb 58307888df Added warning when symbol is not found on R_386_PC32 reloc 2019-02-23 14:16:39 +01:00
ptitSeb b1ad6f19c0 Added (dummy) Push/Pop ES and DS 2019-02-23 14:15:59 +01:00
ptitSeb b254c69771 Simplified thread handling, and implemented some workaround around pthread_cond_init 2019-02-23 12:42:35 +01:00
ptitSeb 0360d2562d Added a few data in wrapped libc 2019-02-23 12:41:53 +01:00
ptitSeb 2df3d1967e Fixed issue with DATAM and DATAW macros 2019-02-23 12:40:50 +01:00
ptitSeb 54c600660b Use prefetch with '3' as hint instead of '2' (not sure it changes anything on arm) 2019-02-23 11:14:43 +01:00
ptitSeb 4e8e889900 Fixed an issue with R_386_PC32 relocation 2019-02-23 11:13:39 +01:00
ptitSeb 66ed58df03 added a few more wrapped functions 2019-02-22 14:07:43 +01:00
ptitSeb a8d4175cd1 Added another readlink hack for self 2019-02-22 11:45:41 +01:00
ptitSeb 1c286c1c5e Added libopenal.so.0 alternative 2019-02-22 11:45:13 +01:00
ptitSeb 011a1057bf Handling of OggVorbis_File structure, that is 704 bytes on x86 and 720 on ARM (fixing Gemini Rue) 2019-02-22 09:58:14 +01:00
ptitSeb 1d8af4b523 Improve Trace handling 2019-02-22 09:57:27 +01:00
ptitSeb cbb12339c9 Added BOX86_TRACE_START (of course this slow down the HAVE_TRACE version) 2019-02-20 18:14:48 +01:00
ptitSeb c4c2a525fb Fixed setjmp/longjmp (fixing Pico8) 2019-02-20 18:13:01 +01:00
ptitSeb fd1a581598 Added a large bunch of wrapped function and library 2019-02-20 12:48:01 +01:00
ptitSeb 4902ba83c4 Added some EPI History when aborting with stack corrupted 2019-02-20 12:47:33 +01:00
ptitSeb 5c6453f931 Added syscall 242 2019-02-20 12:46:17 +01:00
ptitSeb 880de4491c added one mode to CPUID opcode 2019-02-20 12:46:00 +01:00
ptitSeb e9ed82bdc5 Added libudev.so.0 wrapped lib 2019-02-20 09:58:51 +01:00
ptitSeb 048acfda7b Added many X11 related wrapped functions and libs 2019-02-19 20:51:59 +01:00
ptitSeb ca2013fb97 Added an env. var. to have detail dlsym error 2019-02-19 18:24:25 +01:00
ptitSeb dad24e4fba Added MIT Licence 2019-02-19 15:23:49 +01:00
ptitSeb 0fea396a1b Added fpu rounding handling (fixes SuperMeatBoy) 2019-02-18 20:04:18 +01:00
ptitSeb 393358d936 Fixed libname for SDL2 2019-02-18 17:57:00 +01:00
ptitSeb 236e0f1f75 Try to improve ELFLoader... 2019-02-18 15:35:57 +01:00
ptitSeb cf78416e24 Fixed fork that was broken for some time 2019-02-18 11:59:20 +01:00
ptitSeb 80e64bab6d Added a few more libc wrapped functions 2019-02-17 21:30:47 +01:00
ptitSeb 98725002e6 A few more wrapped functions 2019-02-16 14:34:07 +01:00
ptitSeb e834fd31c8 Added a few more libc wrapped function (trip.bit.runner now seems to works) 2019-02-16 14:28:15 +01:00
ptitSeb 53d00d528c Fixed vorbisfile ov_open_callbaks, at last (but gemini_rue still crashes after 1st screen) 2019-02-16 13:08:17 +01:00
ptitSeb e6b31b2d7e Better handling of the 'self' notion in elfloader 2019-02-16 12:28:01 +01:00
ptitSeb b61ed02ee4 Add fixed a type in my_ov_open_callbacks 2019-02-16 12:27:35 +01:00
ptitSeb 512d06ae48 Some fixes to a few wrapped functions 2019-02-16 12:22:04 +01:00
ptitSeb 66c2faf379 Added a few libc wrapped functions 2019-02-15 23:17:57 +01:00
ptitSeb 4ba2a4ec27 Added wrapped function onXext for Shm XImage stuffs 2019-02-15 23:08:29 +01:00
ptitSeb 6d2d8b8a3c Added wrapped libXcursor (mostly complete) 2019-02-15 22:46:18 +01:00
ptitSeb e9570fe320 Improved CImage handling (help Xenonauts) 2019-02-15 22:14:24 +01:00
ptitSeb 97c5983a4e Added Wrapped libXrender (complete) 2019-02-14 08:32:42 +01:00
ptitSeb 4bdbb91d4d And a new batch of wrapped functions 2019-02-13 23:40:32 +01:00
ptitSeb e84ab5d5dd Added wrapped libXfixes (complete) 2019-02-13 22:54:23 +01:00
ptitSeb 4aaea970cd Added wrapped libogg and libvorbis (partial) 2019-02-13 22:41:44 +01:00
ptitSeb 614300d911 Enabled that one in libasound 2019-02-13 22:41:22 +01:00
ptitSeb ab4c78c288 Fix a small typo 2019-02-13 22:40:50 +01:00
ptitSeb d4590ee13e Disablings cleanup for now, the order seems incorrect (at least provoques some double-free) 2019-02-13 22:25:05 +01:00
ptitSeb 456d4f999d Added wrapped libXinerama 2019-02-13 21:20:44 +01:00
ptitSeb 1ecc2d930a Small fix for Pandora only 2019-02-13 21:12:17 +01:00
ptitSeb 7881e1ec14 Added a bunch of wrapped functions, including ov_open_callbacks 2019-02-13 18:49:27 +01:00
ptitSeb b9184bba5d Add a few more opcode, Xenonauts now start 2019-02-13 17:51:50 +01:00
ptitSeb ff51cf7c72 Added some more GS: stuffs (some are wild guess) 2019-02-13 17:02:35 +01:00
ptitSeb 18f13de0f0 Added 2 more X11 wrapped functions 2019-02-13 15:36:33 +01:00
ptitSeb fe1652bf7f Fixed a typo with SDL_GetEnv 2019-02-13 15:36:02 +01:00
ptitSeb 06c7772c0a Fixed a typo in SDL2 wrapper 2019-02-13 11:43:25 +01:00
ptitSeb dd56fd116e Fix for SDL_GameControllerButtonBindForAxis wrapped function 2019-02-13 11:30:07 +01:00
ptitSeb e7db118ef4 Optimized some callback, when it's just called inside the function 2019-02-13 11:27:21 +01:00
ptitSeb 14964b55b9 Added a bunch of wrapped function (needed by Xenonauts) 2019-02-13 08:51:31 +01:00
ptitSeb cf59aef0f5 Added a few wrapped functions 2019-02-12 23:07:28 +01:00
ptitSeb 59ccc7fdef Fixed a typo in the system lib folders 2019-02-12 22:07:14 +01:00
ptitSeb 5bb72f548f Added some 'system' path fr x86 libs 2019-02-12 21:41:08 +01:00
ptitSeb 58d96434e8 Fix a typo in a comment 2019-02-12 21:40:20 +01:00
ptitSeb a1093a9b37 Added a few more opcode 2019-02-12 18:02:46 +01:00
ptitSeb cccf15ce6c SDL_JoystickGetDeviceGUID also return a struct... 2019-02-12 17:59:09 +01:00
ptitSeb f977f8067e Add proprer (hopefully) handling of wrapped function that returns structs 2019-02-12 16:29:28 +01:00
ptitSeb 656e407e6d Fixed readlink hack with '/proc/self/exe' 2019-02-12 15:11:30 +01:00
ptitSeb 0b0309d5c3 Fixed ldiv wrapped function that return a struct (and so use a shadow pointer as 1st arg) 2019-02-12 12:24:35 +01:00
ptitSeb 112cee940e Added special case for readlink and '/proc/self/exe' 2019-02-12 12:05:51 +01:00
ptitSeb 82f5a3bff4 Added a few glX wrapped functions and extensions 2019-02-12 11:03:00 +01:00
ptitSeb 24c1fae0ce Small opcode optim 2019-02-12 10:49:38 +01:00
ptitSeb 9c8f25777c Ooops, fixed bsearch wrapped function 2019-02-12 10:49:25 +01:00
ptitSeb 3ec4dce187 Added a large bunch of wrapped functions (and callbacks) and a few opcodes 2019-02-12 07:59:23 +01:00
ptitSeb 9f7c0fa57a Added a generic error in dlerror (instead of aborting emulation) 2019-02-11 17:55:37 +01:00
ptitSeb fff085a79b Fixed my_zlib_free wrapper 2019-02-11 17:41:07 +01:00
ptitSeb 1ce5dcf37d Added wrapped libjpeg, libXext (partial), libcurl (partial) and add some handling of custom allocator in libz 2019-02-11 17:21:59 +01:00
ptitSeb 4b6a9486d8 Added a couple of x87 opcode 2019-02-11 12:18:34 +01:00
ptitSeb 8f1096a082 Added SDL_GL_ProcAddress toSDL1 and 2, plus a fix in putc, and added a few missing SDL2 wrapped functions 2019-02-11 12:13:54 +01:00
ptitSeb bee55277d9 New developpement cycle 2019-02-11 09:47:22 +01:00
624 changed files with 140726 additions and 17156 deletions

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: ptitSeb
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: paypal.me/0ptitSeb
+7 -2
View File
@@ -1,3 +1,8 @@
build
build_llvm
build/
build*/
.vscode
.gdb_history
src/git_head.h
backup/
box86_update.sh
restore_backup.sh
-15
View File
@@ -1,15 +0,0 @@
v0.0.2
=======
* A full commercial games runs fine on the Pandora: Airline Tycoon Deluxe
* Implemented all planed subpart of Box86 except JIT
* CPU Emulation is at 75%, roughly, including x87 and SSE/SSE2. MMX is barely implemented, but barely used anyway
* x87 emulation is simplified, no real x87 State handling (but should not be mandatory, as native libm is used)
* No Signal handling yet
* ELF Loader is crude and probably full of bug. Also, the Init of libs is defered after all symbols are resolved for now.
* Wrapped lib include libc, libm, rt, pthread, libdl, dllinux, libasound, GL, GLU, SDL1/mixer/image, SDL2/mixer/image/smpeg, OpenAL/ALUT, libz, libpng16, vorbisfile, x11/xrandr/xxf86vm.
* Most wrapped libs are still partially implemented (SDL1 & GL should be complete)
* Implemented specific mecanism for SDL(1/2) RWops, to be able to used them both in Native and x86 world
* WorldOfGoo works, but painfully slow on th Pandora (too much double math, and lack of JIT)
* FTL works, but sound is broken (issue with thread? asound? or CPU core?)
* Limbo launch but crash before main menu
+595 -77
View File
@@ -1,21 +1,135 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.0)
project(box86)
option(PANDORA "Set to ON if targeting an OpenPandora device" ${PANDORA})
option(PYRA "Set to ON if targeting an OpenPandora device" ${PYRA})
option(RPI2 "Set to ON if targeting an RaspberryPI2 device" ${RPI2})
option(RPI3 "Set to ON if targeting an RaspberryPI3 device" ${RPI3})
option(RPI4 "Set to ON if targeting an RaspberryPI4 device" ${RPI4})
option(RPI4ARM64 "Set to ON if targeting an RaspberryPI4 device with multiarch arm64 and armhf" ${RPI4ARM64})
option(RK3399 "Set to ON if targeting an Rockchip RK3399 based device" ${RK3399})
option(GAMESHELL "Set to ON if targeting a GameShell device" ${GAMESHELL})
option(ODROID "Set to ON if targeting an ODroid device" ${ODROID})
option(POWER9 "Set to ON if targeting a POWER9 processor" ${POWER9})
option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})
option(HAVE_TRACE "Set to ON to have Trace ability (needs ZydisInfo library)" ${HAVE_TRACE})
option(NOLOADADDR "Set to ON to avoid fixing the load address of Box86" ${NO_LOADAADR})
option(NOGETCLOCK "Set to ON to avoid using clock_gettime with CLOCK_MONOTONIC_COARSE for RDTSC opcode (use gltimeofday instead)" ${NOGETCLOCK})
option(NOGIT "Set to ON if not building from a git clone repo (like when building from a zip download from github)" ${NOGIT})
if(PANDORA OR PYRA OR RPI2 OR RPI3 OR RPI4 OR GAMESHELL OR ODROID OR RK3399 OR RPI4ARM64)
set(LD80BITS OFF CACHE BOOL "")
set(NOALIGN OFF CACHE BOOL "")
set(ARM_DYNAREC ON CACHE BOOL "")
endif()
if(ANDROID)
set(NOLOADADDR ON CACHE BOOL "")
endif()
option(LD80BITS "Set to ON if host device have 80bits long double (i.e. i386)" ${LD80BITS})
option(NOALIGN "Set to ON if host device doesn't need re-align (i.e. i386)" ${NOALIGN})
option(ARM_DYNAREC "Set to ON to use ARM Dynamic Recompilation" ${ARM_DYNAREC})
option(POWERPCLE "Set to ON if targeting a little-endian PowerPC device" ${POWERPCLE})
option(SYSV_VARARG "Set to ON if host device uses SysVR4 vararg calling convention" ${SYSV_VARARG})
if(${CMAKE_VERSION} VERSION_LESS "3.12.2")
find_package(PythonInterp 3)
if(NOT PYTHONINTERP_FOUND)
message( FATAL_ERROR "You need a Python interpretor, CMake will exit." )
endif()
if(${PYTHON_VERSION_MAJOR} LESS 3)
message( FATAL_ERROR "You need a Python 3 interpretor, CMake will exit." )
endif()
else()
find_package(Python3)
if(NOT Python3_Interpreter_FOUND)
message( FATAL_ERROR "You need a Python interpretor, CMake will exit." )
endif()
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE INTERNAL "The Python3 executable" FORCE)
endif()
if(RK3399 OR RPI4ARM64)
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
#set(CMAKE_ASM_COMPILER arm-linux-gnueabihf-as) #will use gcc in fact
set(CMAKE_C_COMPILER_TARGET arm-linux-gnueabihf)
endif()
project(box86 C ASM)
enable_testing()
option(PANDORA "Set to ON if targeting an OpenPandora device" ${PANDORA})
option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})
option(LD80BITS "Set to ON if host device have 80bits long double (i.e. i386)" ${LD80BITS})
option(NOALIGN "Set to ON if host device doesn't need re-align (i.e. i386)" ${NOALIGN})
option(HAVE_TRACE "Set to ON to have Trace ability (needs ZydisInfo library)" ${HAVE_TRACE})
set(default_build_type "RelwithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Pandora
if(PANDORA)
add_definitions(-DPANDORA)
#add_definitions(-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -ffast-math)
endif()
if(GAMESHELL)
add_definitions(-DGAMEHELL)
add_definitions(-marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard)
set(CMAKE_ASM_FLAGS "-marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard")
endif()
if(PYRA)
add_definitions(-DPYRA)
add_definitions(-mcpu=cortex-a15 -mfpu=neon -mfloat-abi=hard -marm)
set(CMAKE_ASM_FLAGS "-marm -mcpu=cortex-a15 -mfpu=neon -mfloat-abi=hard")
endif()
if(RPI2)
add_definitions(-DRPI)
add_definitions(-DRPI2)
add_definitions(-marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard)
set(CMAKE_ASM_FLAGS "-marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard")
endif()
if(RPI3)
add_definitions(-DRPI)
add_definitions(-DRPI3)
add_definitions(-marm -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard)
set(CMAKE_ASM_FLAGS "-marm -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard")
endif()
if(RPI4)
add_definitions(-DRPI)
add_definitions(-DRPI4)
add_definitions(-marm -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard)
set(CMAKE_ASM_FLAGS "-marm -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard")
endif()
if(RPI4ARM64)
add_definitions(-DRPI)
add_definitions(-DRPI4ARM64)
add_definitions(-marm -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard)
set(CMAKE_ASM_FLAGS "-marm -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard")
endif()
if(ODROID)
add_definitions(-DODROID)
add_definitions(-mcpu=cortex-a9 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm)
set(CMAKE_ASM_FLAGS "-marm -mcpu=cortex-a9 -mfpu=neon-vfpv4 -mfloat-abi=hard")
endif()
if(RK3399)
add_definitions(-DRK3399)
add_definitions(-pipe -march=armv8-a+crc+simd+crypto -mcpu=cortex-a72+crypto)
set(CMAKE_ASM_FLAGS "-pipe -march=armv8-a+crc+simd+crypto -mcpu=cortex-a72+crypto")
endif()
if(POWER9)
add_definitions(-mcpu=power9 -mtune=power9)
endif()
if(NOGIT)
add_definitions(-DNOGIT)
endif()
if(BOX86LIB)
set(BOX86 box86)
elseif(HAVE_TRACE)
set(BOX86 box86t)
else()
set(BOX86 box86)
endif()
set(BOX86_ELF_ADDRESS "0x62800000")
if(LD80BITS)
add_definitions(-DHAVE_LD80BITS)
@@ -29,7 +143,40 @@ if(HAVE_TRACE)
add_definitions(-DHAVE_TRACE)
endif()
add_definitions(-g -std=gnu99 -funwind-tables -O3 -fvisibility=hidden -no-pie -fjump-tables)
if(ARM_DYNAREC)
add_definitions(-DDYNAREC)
add_definitions(-DARM)
add_definitions(-marm)
enable_language(ASM)
endif()
if(POWERPCLE)
add_definitions(-DPOWERPCLE)
endif()
if(SYSV_VARARG)
add_definitions(-DSYSV_VARARG)
endif()
if(NOGETCLOCK)
add_definitions(-DNOGETCLOCK)
endif()
if(BOX86LIB)
add_definitions(-DBUILD_LIB)
if(BOX86DYNAMIC)
add_definitions(-DBUILD_DYNAMIC)
endif()
add_definitions(-fPIC)
if(NOT BOX86_ROOT)
message(FATAL_ERROR "BOX86_ROOT not set when build as lib")
endif()
else()
set(BOX86_ROOT ${CMAKE_SOURCE_DIR})
endif()
add_definitions(-std=gnu11 -funwind-tables -fvisibility=hidden)
if(USE_CCACHE)
find_program(CCACHE_FOUND ccache)
@@ -39,114 +186,485 @@ if(USE_CCACHE)
endif()
endif()
#include_directories(include)
include_directories(
"${BOX86_ROOT}/src/include"
"${BOX86_ROOT}/src"
"${BOX86_ROOT}/src/wrapped/generated"
)
# git_head.h is a generated file
set_source_files_properties(
"${BOX86_ROOT}/src/git_head.h"
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE)
set(ELFLOADER_SRC
"${CMAKE_HOME_DIRECTORY}/src/bridge.c"
"${CMAKE_HOME_DIRECTORY}/src/main.c"
"${CMAKE_HOME_DIRECTORY}/src/pathcoll.c"
"${CMAKE_HOME_DIRECTORY}/src/box86context.c"
"${CMAKE_HOME_DIRECTORY}/src/fileutils.c"
"${CMAKE_HOME_DIRECTORY}/src/elfloader.c"
"${CMAKE_HOME_DIRECTORY}/src/elfparser.c"
"${CMAKE_HOME_DIRECTORY}/src/elfload_dump.c"
"${CMAKE_HOME_DIRECTORY}/src/library.c"
"${CMAKE_HOME_DIRECTORY}/src/librarian.c"
"${CMAKE_HOME_DIRECTORY}/src/stack.c"
"${CMAKE_HOME_DIRECTORY}/src/threads.c"
"${CMAKE_HOME_DIRECTORY}/src/wrapper.c"
"${CMAKE_HOME_DIRECTORY}/src/x86emu.c"
"${CMAKE_HOME_DIRECTORY}/src/x86run.c"
"${CMAKE_HOME_DIRECTORY}/src/x86run66.c"
"${CMAKE_HOME_DIRECTORY}/src/x86run_private.c"
"${CMAKE_HOME_DIRECTORY}/src/x86syscall.c"
"${CMAKE_HOME_DIRECTORY}/src/x86primop.c"
"${CMAKE_HOME_DIRECTORY}/src/x86trace.c"
"${CMAKE_HOME_DIRECTORY}/src/x86int3.c"
"${CMAKE_HOME_DIRECTORY}/src/x87emu_private.c"
"${CMAKE_HOME_DIRECTORY}/src/x87run.c"
"${CMAKE_HOME_DIRECTORY}/src/myalign.c"
"${CMAKE_HOME_DIRECTORY}/src/callback.c"
"${CMAKE_HOME_DIRECTORY}/src/sdl1rwops.c"
"${CMAKE_HOME_DIRECTORY}/src/sdl2rwops.c"
"${BOX86_ROOT}/src/main.c"
"${BOX86_ROOT}/src/box86context.c"
"${BOX86_ROOT}/src/build_info.c"
"${BOX86_ROOT}/src/custommem.c"
"${BOX86_ROOT}/src/tools/bridge.c"
"${BOX86_ROOT}/src/tools/pathcoll.c"
"${BOX86_ROOT}/src/tools/fileutils.c"
"${BOX86_ROOT}/src/tools/callback.c"
"${BOX86_ROOT}/src/tools/box86stack.c"
"${BOX86_ROOT}/src/tools/my_cpuid.c"
"${BOX86_ROOT}/src/tools/gtkclass.c"
"${BOX86_ROOT}/src/tools/wine_tools.c"
"${BOX86_ROOT}/src/elfs/elfloader.c"
"${BOX86_ROOT}/src/elfs/elfparser.c"
"${BOX86_ROOT}/src/elfs/elfload_dump.c"
"${BOX86_ROOT}/src/librarian/library.c"
"${BOX86_ROOT}/src/librarian/librarian.c"
"${BOX86_ROOT}/src/emu/x86emu.c"
"${BOX86_ROOT}/src/emu/x86run.c"
"${BOX86_ROOT}/src/emu/x86run66.c"
"${BOX86_ROOT}/src/emu/x86run660f.c"
"${BOX86_ROOT}/src/emu/x86run_private.c"
"${BOX86_ROOT}/src/emu/x86syscall.c"
"${BOX86_ROOT}/src/emu/x86primop.c"
"${BOX86_ROOT}/src/emu/x86trace.c"
"${BOX86_ROOT}/src/emu/x86int3.c"
"${BOX86_ROOT}/src/emu/x86tls.c"
"${BOX86_ROOT}/src/emu/x87emu_private.c"
"${BOX86_ROOT}/src/emu/x87run.c"
"${BOX86_ROOT}/src/libtools/auxval.c"
"${BOX86_ROOT}/src/libtools/myalign.c"
"${BOX86_ROOT}/src/libtools/myalign64.c"
"${BOX86_ROOT}/src/libtools/myfts.c"
"${BOX86_ROOT}/src/libtools/sdl1rwops.c"
"${BOX86_ROOT}/src/libtools/sdl2rwops.c"
"${BOX86_ROOT}/src/libtools/signals.c"
"${BOX86_ROOT}/src/libtools/threads.c"
"${BOX86_ROOT}/src/libtools/vkalign.c"
"${BOX86_ROOT}/src/dynarec/dynarec.c"
"${BOX86_ROOT}/src/wrapped/generated/wrapper.c"
)
if(NOT ANDROID)
list(APPEND ELFLOADER_SRC "${BOX86_ROOT}/src/libtools/obstack.c")
endif()
set(WRAPPEDS
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibc.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibpthread.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibrt.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibgl.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibglu.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibx11.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibasound.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibdl.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibm.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl1.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl1mixer.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl1image.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl2.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl2mixer.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsdl2image.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedsmpeg2.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedvorbisfile.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedpng16.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxxf86vm.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibxrandr.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedlibz.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedopenal.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedalut.c"
"${CMAKE_HOME_DIRECTORY}/src/wrappedldlinux.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibc.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibpthread.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibrt.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibgl.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibglu.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibx11.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibasound.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibdl.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibm.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl1.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl1mixer.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl1net.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl1image.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl1sound.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl1ttf.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl2.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl2mixer.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl2net.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl2image.c"
"${BOX86_ROOT}/src/wrapped/wrappedsdl2ttf.c"
"${BOX86_ROOT}/src/wrapped/wrappedsmpeg.c"
"${BOX86_ROOT}/src/wrapped/wrappedsmpeg2.c"
"${BOX86_ROOT}/src/wrapped/wrappedvorbisfile.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibvorbis.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibogg.c"
"${BOX86_ROOT}/src/wrapped/wrappedpng12.c"
"${BOX86_ROOT}/src/wrapped/wrappedpng16.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxxf86vm.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxrandr.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxext.c"
"${BOX86_ROOT}/src/wrapped/wrappedxinerama.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxfixes.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcursor.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxrender.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxft.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxi.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxss.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxpm.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxau.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxdmcp.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibx11xcb.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcb.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbxfixes.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbshape.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbshm.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbrandr.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbimage.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbkeysyms.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbxtest.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbdri2.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbdri3.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcbpresent.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxtst.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxt.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxcomposite.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxdamage.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibxmu.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibz.c"
"${BOX86_ROOT}/src/wrapped/wrappedopenal.c"
"${BOX86_ROOT}/src/wrapped/wrappedalure.c"
"${BOX86_ROOT}/src/wrapped/wrappedalut.c"
"${BOX86_ROOT}/src/wrapped/wrappedcurl.c"
"${BOX86_ROOT}/src/wrapped/wrappedudev0.c"
"${BOX86_ROOT}/src/wrapped/wrappedudev1.c"
"${BOX86_ROOT}/src/wrapped/wrappeddbus.c"
"${BOX86_ROOT}/src/wrapped/wrappediconv.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibdrm.c"
"${BOX86_ROOT}/src/wrapped/wrappedcrypto.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibssl.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibcrypt.c"
"${BOX86_ROOT}/src/wrapped/wrappedutil.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibuuid.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibresolv.c"
"${BOX86_ROOT}/src/wrapped/wrappedpulsesimple.c"
"${BOX86_ROOT}/src/wrapped/wrappedpulse.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibsndfile.c"
"${BOX86_ROOT}/src/wrapped/wrappedfontconfig.c"
"${BOX86_ROOT}/src/wrapped/wrappedfreetype.c"
"${BOX86_ROOT}/src/wrapped/wrappedbz2.c"
"${BOX86_ROOT}/src/wrapped/wrappedexpat.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibsm.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibice.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibusb1.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibncursesw.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibformw.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibncurses.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibtinfo.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibncurses6.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibtinfo6.c"
"${BOX86_ROOT}/src/wrapped/wrappedgtkx112.c"
"${BOX86_ROOT}/src/wrapped/wrappedgdkx112.c"
"${BOX86_ROOT}/src/wrapped/wrappedgtk3.c"
"${BOX86_ROOT}/src/wrapped/wrappedgdk3.c"
"${BOX86_ROOT}/src/wrapped/wrappedgdkpixbuf2.c"
"${BOX86_ROOT}/src/wrapped/wrappedgio2.c"
"${BOX86_ROOT}/src/wrapped/wrappedgmodule2.c"
"${BOX86_ROOT}/src/wrapped/wrappedgobject2.c"
"${BOX86_ROOT}/src/wrapped/wrappedglib2.c"
"${BOX86_ROOT}/src/wrapped/wrappedgstreamer010.c"
"${BOX86_ROOT}/src/wrapped/wrappedgstinterfaces010.c"
"${BOX86_ROOT}/src/wrapped/wrappeddbusmenugtk.c"
"${BOX86_ROOT}/src/wrapped/wrappeddbusmenuglib.c"
"${BOX86_ROOT}/src/wrapped/wrappedappindicator.c"
"${BOX86_ROOT}/src/wrapped/wrappedatk.c"
"${BOX86_ROOT}/src/wrapped/wrappedatkbridge.c"
"${BOX86_ROOT}/src/wrapped/wrappedpangoft2.c"
"${BOX86_ROOT}/src/wrapped/wrappedpangocairo.c"
"${BOX86_ROOT}/src/wrapped/wrappedgthread2.c"
"${BOX86_ROOT}/src/wrapped/wrappedcairo.c"
"${BOX86_ROOT}/src/wrapped/wrappedpango.c"
"${BOX86_ROOT}/src/wrapped/wrappeddbusglib1.c"
"${BOX86_ROOT}/src/wrapped/wrappedgudev1.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibnm.c"
"${BOX86_ROOT}/src/wrapped/wrappedtcmallocminimal.c"
"${BOX86_ROOT}/src/wrapped/wrappedmpg123.c"
"${BOX86_ROOT}/src/wrapped/wrappedgnutls.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibcups.c"
"${BOX86_ROOT}/src/wrapped/wrappedd3dadapter9.c"
"${BOX86_ROOT}/src/wrapped/wrappedvulkan.c"
"${BOX86_ROOT}/src/wrapped/wrappedwaylandclient.c"
"${BOX86_ROOT}/src/wrapped/wrappedxml2.c"
"${BOX86_ROOT}/src/wrapped/wrappedxslt.c"
"${BOX86_ROOT}/src/wrapped/wrappedldapr.c"
"${BOX86_ROOT}/src/wrapped/wrappedlber.c"
"${BOX86_ROOT}/src/wrapped/wrappednsl.c"
"${BOX86_ROOT}/src/wrapped/wrappedlcms2.c"
"${BOX86_ROOT}/src/wrapped/wrappedkrb5.c"
"${BOX86_ROOT}/src/wrapped/wrappedgssapikrb5.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibtiff.c"
"${BOX86_ROOT}/src/wrapped/wrappedldlinux.c"
"${BOX86_ROOT}/src/wrapped/wrappedcrashhandler.c"
)
set(WRAPPER "${CMAKE_HOME_DIRECTORY}/src/wrapper.c" "${CMAKE_HOME_DIRECTORY}/src/wrapper.h")
add_custom_command(OUTPUT ${WRAPPER} COMMAND "${CMAKE_HOME_DIRECTORY}/rebuild_wrappers.py" "${CMAKE_HOME_DIRECTORY}" MAIN_DEPENDENCY "${CMAKE_HOME_DIRECTORY}/rebuild_wrappers.py" DEPENDS ${WRAPPEDS})
set_source_files_properties(${WRAPPER} PROPERTIES GENERATED TRUE)
if(NOT ANDROID)
list(APPEND WRAPPEDS
"${BOX86_ROOT}/src/wrapped/wrappedlibjpeg.c"
"${BOX86_ROOT}/src/wrapped/wrappedlibjpeg62.c"
"${BOX86_ROOT}/src/wrapped/wrappedturbojpeg.c"
)
endif()
add_executable(box86 ${ELFLOADER_SRC} ${WRAPPEDS})
target_link_libraries(box86 m dl rt pthread)
# If BOX86_ROOT contains a ".c", the build breaks...
string(REPLACE ".c" "_private.h" MODROOT ${BOX86_ROOT})
set(WRAPPEDS_HEAD "")
foreach(A ${WRAPPEDS})
string(REPLACE ".c" "_private.h" C ${A})
string(REPLACE "${MODROOT}" "${BOX86_ROOT}" B ${C})
set(WRAPPEDS_HEAD ${WRAPPEDS_HEAD} ${B})
set_source_files_properties(${A} PROPERTIES OBJECT_DEPENDS ${B})
endforeach()
target_link_libraries(box86 -no-pie -Wl,-Ttext-segment,0xA8000000)
set(WRAPPER "${BOX86_ROOT}/src/wrapped/generated/wrapper.c" "${BOX86_ROOT}/src/wrapped/generated/wrapper.h")
add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_custom_command(
OUTPUT "${BOX86_ROOT}/src/wrapped/generated/functions_list.txt"
COMMAND "${PYTHON_EXECUTABLE}" "${BOX86_ROOT}/rebuild_wrappers.py"
"${BOX86_ROOT}"
"PANDORA" "HAVE_LD80BITS" "NOALIGN" "HAVE_TRACE" "POWERPCLE" "ANDROID" "--"
${WRAPPEDS_HEAD}
MAIN_DEPENDENCY "${BOX86_ROOT}/rebuild_wrappers.py"
DEPENDS ${WRAPPEDS} ${WRAPPEDS_HEAD}
BYPRODUCTS ${WRAPPER}
)
add_custom_command(
OUTPUT "${BOX86_ROOT}/src/dynarec/last_run.txt"
COMMAND "${PYTHON_EXECUTABLE}" "${BOX86_ROOT}/rebuild_printer.py" "${BOX86_ROOT}"
MAIN_DEPENDENCY "${BOX86_ROOT}/rebuild_printer.py"
DEPENDS "${BOX86_ROOT}/src/dynarec/arm_instructions.txt"
BYPRODUCTS "${BOX86_ROOT}/src/dynarec/arm_printer.c"
)
add_custom_target(WRAPPERS DEPENDS "${BOX86_ROOT}/src/wrapped/generated/functions_list.txt")
add_custom_target(PRINTER DEPENDS "${BOX86_ROOT}/src/dynarec/last_run.txt")
if(ARM_DYNAREC)
set(DYNAREC_SRC
"${BOX86_ROOT}/src/dynarec/dynablock.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_functions.c"
"${BOX86_ROOT}/src/dynarec/arm_printer.c"
"${BOX86_ROOT}/src/dynarec/arm_prolog.S"
"${BOX86_ROOT}/src/dynarec/arm_epilog.S"
"${BOX86_ROOT}/src/dynarec/arm_next.S"
"${BOX86_ROOT}/src/dynarec/arm_lock_helper.S"
)
set(DYNAREC_PASS
"${BOX86_ROOT}/src/dynarec/dynarec_arm_helper.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_emit_tests.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_emit_math.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_emit_logic.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_emit_shift.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_pass.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_00.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_0f.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_64.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_65.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_66.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_67.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_d8.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_d9.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_da.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_db.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_dc.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_dd.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_de.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_df.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_f0.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_660f.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_f20f.c"
"${BOX86_ROOT}/src/dynarec/dynarec_arm_f30f.c"
)
set(DYNAREC_PASS "${BOX86_ROOT}/src/wrapped/generated/wrapper.h" ${DYNAREC_PASS})
add_library(dynarec_arm OBJECT ${DYNAREC_SRC})
add_library(arm_pass0 OBJECT ${DYNAREC_PASS})
set_target_properties(arm_pass0 PROPERTIES COMPILE_FLAGS "-DSTEP=0")
add_library(arm_pass1 OBJECT ${DYNAREC_PASS})
set_target_properties(arm_pass1 PROPERTIES COMPILE_FLAGS "-DSTEP=1")
add_library(arm_pass2 OBJECT ${DYNAREC_PASS})
set_target_properties(arm_pass2 PROPERTIES COMPILE_FLAGS "-DSTEP=2")
add_library(arm_pass3 OBJECT ${DYNAREC_PASS})
set_target_properties(arm_pass3 PROPERTIES COMPILE_FLAGS "-DSTEP=3")
add_dependencies(arm_pass0 WRAPPERS)
add_dependencies(arm_pass1 WRAPPERS)
add_dependencies(arm_pass2 WRAPPERS)
add_dependencies(arm_pass3 WRAPPERS)
add_library(dynarec STATIC
$<TARGET_OBJECTS:dynarec_arm>
$<TARGET_OBJECTS:arm_pass0>
$<TARGET_OBJECTS:arm_pass1>
$<TARGET_OBJECTS:arm_pass2>
$<TARGET_OBJECTS:arm_pass3>
)
endif()
# creates git_head.h
if(ARM_DYNAREC)
add_custom_command(
OUTPUT "${BOX86_ROOT}/src/git_head.h"
COMMAND bash -c "echo \\\#define GITREV \\\"$(git rev-parse --short HEAD)\\\">\"${BOX86_ROOT}/src/git_head.h\""
DEPENDS dynarec ${ELFLOADER_SRC} ${WRAPPEDS}
VERBATIM)
else()
add_custom_command(
OUTPUT "${BOX86_ROOT}/src/git_head.h"
COMMAND bash -c "echo \\\#define GITREV \\\"$(git rev-parse --short HEAD)\\\">\"${BOX86_ROOT}/src/git_head.h\""
DEPENDS ${ELFLOADER_SRC} ${WRAPPEDS}
VERBATIM)
endif()
if(BOX86LIB)
#build a static or dynamic lib...
if(BOX86DYNAMIC)
add_library(box86 SHARED ${ELFLOADER_SRC} ${WRAPPEDS} "${BOX86_ROOT}/src/git_head.h")
else()
add_library(${BOX86} OBJECT ${ELFLOADER_SRC} ${WRAPPEDS} "${BOX86_ROOT}/src/git_head.h")
endif()
if(ARM_DYNAREC)
if(ANDROID)
target_link_libraries(${BOX86} dynarec m dl)
else()
target_link_libraries(${BOX86} dynarec m dl rt pthread)
endif()
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.13")
set_target_properties(${BOX86} PROPERTIES LINK_FLAGS -rdynamic)
else()
target_link_options(${BOX86} PUBLIC -rdynamic)
endif()
add_dependencies(${BOX86} WRAPPERS)
add_dependencies(${BOX86} PRINTER)
add_custom_target(buildinfo ${BOX86}
DEPENDS dynarec ${BOX86} )
else(BOX86LIB)
add_executable(${BOX86} ${ELFLOADER_SRC} ${WRAPPEDS} "${BOX86_ROOT}/src/git_head.h")
add_dependencies(${BOX86} WRAPPERS)
add_dependencies(${BOX86} PRINTER)
if(ANDROID)
target_link_libraries(${BOX86} m dl)
else()
target_link_libraries(${BOX86} m dl rt pthread)
endif()
if(ARM_DYNAREC)
target_link_libraries(${BOX86} dynarec)
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.13")
if(NOT NOLOADADDR)
set_target_properties(${BOX86} PROPERTIES LINK_FLAGS "-rdynamic -Wl,-Ttext-segment,${BOX86_ELF_ADDRESS}")
else()
set_target_properties(${BOX86} PROPERTIES LINK_FLAGS -rdynamic)
endif()
else()
target_link_options(${BOX86} PUBLIC -rdynamic)
if(NOT NOLOADADDR)
target_link_options(${BOX86} PUBLIC -Wl,-Ttext-segment,${BOX86_ELF_ADDRESS})
endif()
endif()
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "i686" _x86)
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "x86_64" _x86_64)
if(NOT _x86 AND NOT _x86_64)
install(TARGETS ${BOX86}
RUNTIME DESTINATION bin)
configure_file(system/box86.conf.cmake system/box86.conf)
install(FILES ${CMAKE_BINARY_DIR}/system/box86.conf DESTINATION /etc/binfmt.d/)
install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.6 DESTINATION /usr/lib/i386-linux-gnu/)
install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.5 DESTINATION /usr/lib/i386-linux-gnu/)
install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libgcc_s.so.1 DESTINATION /usr/lib/i386-linux-gnu/)
endif()
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
add_test(NAME bootSyscall COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test01 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref01.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test02 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME bootSyscallC COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test02 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref02.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test03 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME printf COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test03 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref03.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test04 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME args COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test04 -D TEST_ARGS2=yeah -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref04.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test05 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME maths1 COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test05 -D TEST_ARGS2=7 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref05.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test06 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME threadsStart COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test06 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref06.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test07 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME trig COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test07 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref07.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test08 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME pi COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test08 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref08.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(test09 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
add_test(NAME fork COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test09 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref09.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(NAME cppThreads COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test10 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref10.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(NAME tlsData COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test11 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref11.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(NAME fpu COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test12 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref12.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(NAME contexts COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test13 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref13.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
add_test(NAME conditionalThreads COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test14 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref14.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
# WIP
#add_test(NAME linkingIndirectNoversion COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test15 -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref15.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
#
#add_test(NAME linkingIndirectVersion COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test16 -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref16.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
file(GLOB extension_tests "${CMAKE_SOURCE_DIR}/tests/extensions/*.c")
foreach(file ${extension_tests})
get_filename_component(testname "${file}" NAME_WE)
add_test(NAME "${testname}" COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/extensions/${testname} -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/extensions/${testname}.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake)
endforeach()
endif(BOX86LIB)
-18
View File
@@ -1,18 +0,0 @@
# box86
Linux Userspace x86 Emulator with a twist
Box86 will let run x86 Linux program (games) on non-x86 Linux, like ARM (needs to be 32bits little-endian).
Also, Box86 use native version for some "system" libraries, like libc, libm, or SDL and OpenGL, leading to more performance and easier integration with host system.
Most x86 Games needs OpenGL, so on ARM platform, a solution like gl4es is probably needed.
Current version is higly experimental and early, and most stuff wont run and run correctly. For now, WorldOfGoo does run correctly. FTL runs but sound is distorted...
If you are serious about developping Box86, you should install ccache and activate it's support in the cmake project (use ccmake for example)
To have the TRACE enabled (i.e. dumping to stdout all individual x86 instruction execute, with dump of registers), you'll also need [Zydis library](https://github.com/zyantific/zydis) accessible on your system.
Some x86 internal opcode use parts of "Realmode X86 Emulator Library", see [x86primop.c](src/x86primop.c) for copyright details
Change log is accessible [here](CHANGELOG.md)
+1
View File
@@ -0,0 +1 @@
theme: jekyll-theme-hacker
+44
View File
@@ -0,0 +1,44 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-arm-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${_pkgname%-arm-git}-git" "${_pkgname%-arm-git}")
conflicts=("${pkgname%-git}" "${_pkgname%-arm-git}-git" "${_pkgname%-arm-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-arm-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-arm-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-arm-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-arm-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+44
View File
@@ -0,0 +1,44 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-gameshell-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${pkgname%-gameshell-git}-git" "${pkgname%-gameshell-git}")
conflicts=("${pkgname%-git}" "${pkgname%-gameshell-git}-git" "${pkgname%-gameshell-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-gameshell-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-gameshell-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DGAMESHELL=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-gameshell-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-gameshell-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+44
View File
@@ -0,0 +1,44 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-odroid-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${_pkgname%-odroid-git}-git" "${_pkgname%-odroid-git}")
conflicts=("${pkgname%-git}" "${_pkgname%-odroid-git}-git" "${_pkgname%-odroid-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-odroid-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-odroid-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DODROID=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-odroid-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-odroid-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+45
View File
@@ -0,0 +1,45 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-pandora-git
_pkgname=box86-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${pkgname%-pandora-git}"-git "${pkgname%-pandora-git}")
conflicts=("${pkgname%-git}" "${pkgname%-pandora-git}"-git "${pkgname%-pandora-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-pandora-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-pandora-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DPANDORA=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-pandora-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+45
View File
@@ -0,0 +1,45 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-pyra-git
_pkgname=box86-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${pkgname%-pyra-git}-git" "${pkgname%-pyra-git}")
conflicts=("${pkgname%-git}" "${pkgname%-pyra-git}-git" "${pkgname%-pyra-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-pyra-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-pyra-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DPYRA=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-pyra-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-pyra-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+60
View File
@@ -0,0 +1,60 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-rpi-git
_pkgname=box86-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${pkgname%-rpi-git}-git" "${pkgname%--rpi-git}")
conflicts=("${pkgname%-git}" "${pkgname%-rpi-git}-git" "${pkgname%--rpi-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
_pimodel=`tr -d '\0' < /sys/firmware/devicetree/base/model`
pkgver() {
cd "$srcdir/${pkgname%-rpi-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-rpi-git}"
# Check for Pi version number
if [[ ${_pimodel} =~ "Raspberry Pi 4" ]]; then
_piversion=4
elif [[ ${_pimodel} =~ "Raspberry Pi 3" ]]; then
_piversion=3
elif [[ ${_pimodel} =~ "Raspberry Pi 2" ]]; then
_piversion=2
else
# This RPI is not supported or this device is not a pi.
# We should cancel then the build.
echo -e "\033[01m\033[01;31m==> ERROR:\033[00;01m Your device is not supported! This script is for RPi model 4/3/2 (1/0 isn't supported yet).\033[00m"
exit 1
fi
echo -e "\033[01m\033[01;34m==> INFO:\033[00;01m Your detected Pi verion number is: \033[01;31m${_piversion}\033[01m.\033[00m"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DRPI${_piversion}=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-rpi-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-rpi-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+39
View File
@@ -0,0 +1,39 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-rk3399-git
_pkgname=box86-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('armv7h')
url="https://github.com/ptitSeb/box86"
license=('MIT')
optdepends=('gl4es: OpenGL 2 for GLES 2 devices')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-git}" "${pkgname%-rk3399-git}-git" "${pkgname%-rk3399-git}")
conflicts=("${pkgname%-git}" "${pkgname%-rk3399-git}-git" "${pkgname%-rk3399-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-rk3399-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-rk3399-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DRK3399=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-rk3399-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-rk3399-git}/build"
make DESTDIR="${pkgdir}/" install
}
+44
View File
@@ -0,0 +1,44 @@
# Maintainer: SpacingBat3 <[email protected]>
# Contributor: Sebastien Chevalier <[email protected]>
pkgname=box86-x86-git
_pkgname=box86-git
pkgver=r2798.0edc0374
pkgrel=1
pkgdesc="Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices."
arch=('i386')
url="https://github.com/ptitSeb/box86"
license=('MIT')
makedepends=('git' 'cmake' 'make')
provides=("${pkgname%-x86-git}")
conflicts=("${pkgname%-x86-git}")
source=('git+https://github.com/ptitSeb/box86')
md5sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-x86-git}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${pkgname%-x86-git}"
if [[ ! -d ./build ]]; then
mkdir build && cd build
cmake .. -DLD80BITS=1 -DNOALIGN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
fi
}
build() {
cd "$srcdir/${pkgname%-x86-git}/build"
make -j$(nproc)
}
package() {
cd "$srcdir/${pkgname%-x86-git}/build"
make DESTDIR="${pkgdir}/" install
# /usr/local/bin isn't in PATH by the default,
# we should move it to /usr/bin
cd ${pkgdir}
mv usr/local/bin/ usr/bin/
# cleanup when dir is empty
rmdir usr/local || exit 0
}
+21
View File
@@ -0,0 +1,21 @@
# The directory containing all PKGBUILDs for BOX86
## FAQ
### 1. How to use it?
Just download the `PKGBUILD-<your-platform>` (no need to download the whole repository), go to directory where you downloaded and type:
```sh
mv ./PKGBUILD-<your-platform> ./PKGBUILD
cd ..
makepkg -si
```
This will copy the PKGBUILD for your platform (where you type your platform name instead of `<your-platform>`), build it and install the PKGBUILD on 32-bit Archlinux ARM.
In the future, I might try to do an unified PKGBUILD for all platforms that will recognize your platform automatically.
### 2. What platforms are currently supported.
All specified in [COMPILE.md](../COMPILE.md).
### 3. Any advantages with that sollution?
This might give you some advantages like those:
- automatic updates (with some AUR frontends like [`pamac-aur`](https://aur.archlinux.org/packages/pamac-aur/) or [`yay`](https://aur.archlinux.org/packages/yay));
- easily uninstall with `pacman -R` when no needed (no need other scripts nor Makefile to do this);
- your `box86` installation is recognized as a package (where it wasn't when installing with `make install`).
+21
View File
@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
+131
View File
@@ -0,0 +1,131 @@
v0.2.2
======
* Reworked some elfloader relocation mecanism
* Removed old "smart linker" and replace with a simple "jump table"
* Also removed CALL/RET optomisation from Dynarec, simple Jump Table is faster
* Reworked all memory protection tracking
* A few more wrapped libs and wrapped functions
* A few more opcodes
* A few more dynarec opcodes
* Some optimisation in Dynarec around ZF and CF flags handlings, and LL/GE/LE/G conditionnal opcodes
* Some changes to the "cancel threads" handling
* Some changes to the "thread once" handling
v0.2.0
======
* Improvements on x86 Flags handling.
* A few more opcode has been added.
* A few potential BusError are now fixed.
* Added the BOX86_NOVULKAN en. var. . This is used to disable the wrapping of vulkan libraries.
* Improvments on libc O_XXXX flags handling.
* Box86 now uses a custom allocator for Dynarec and Hash tables.
* Improved the wrapping of pulse audio.
* Optimisation to a few Dynarec opcode (like SHRD/SHLD).
* Improved the tracking of memory protection.
* A few more wrapping of libraries (like libgssapi_krb5).
* More function wrapping on libturbojpeg
* Preliminary support for POWER9 (ppcle) build
* Many contributions to remove typos and rephrase the README, COMPILE and USAGE documents
v0.1.8
======
* Fixes on some float to int x86 convertions opcodes.
* Reworked all callback mecanisms.
* Added libturbojpeg wrapping (and a hack for zoom to force using native one).
* Added the BOX86_SAFEMMAP env. var.
* Reworked Dynarec's memory manager.
* Added a few opcodes.
* Improve elfloader to not force PltResolver all the time (fixing SuperHexagon and maybe other)
* Reworked Exet and Cancel Thread mecanism.
* Added wrapped libldap_r and liblber library (used by wine)
* Reworked Dynarec block handling, and remove the "AddMark" mecanism that wasn't efficient enough
* Added TokiTori 2+ detection and runtime patch on the Raspberry Pi platform
* Fixes on elfloader with TLS object.
v0.1.6
======
* Changes in Dynarec to make flags optimizations before CALL and RET opcode less aggressive.
* Added a Vulkan wrapper.
* Improved wrapping of SDL_mixer/ SDL2_mixer libraries.
* Improved wrapping of some GTK structures.
* Added a quick and dirty wrapping of GTK3 (based on current GTK2).
* Improved the signal handling, should be more stable now (the signal handler from syscall still need some works).
* Added the RK3399 profile, and some hints to build 32bits box86 on 64bits OS.
* Fixed some wrapped printf formating not handled correctly.
* Fixed some buserror with the new LOCK mecanism handling.
* A few more Dynarec opcodes added.
* If winedbg is tried to be launched, exit without launching it (it doesn't work anyways).
v0.1.4
======
* Change in Dynarec's memory handling, to simplify it (and hopefully optimized it).
* Even more opcodes added.
* And some more Dynarec opcodes.
* Fixed some issue were PltResolver was injected but should not be.
* Fixed many Dynarec and non dynarec opcodes.
* Improved Signal handling.
* Added a few more wrapped libraries (like curl).
* Gallium9 is now wrapped (thx @icecream95).
* Fixed and simplied many wrapped functions (especialy the one where a callback is involved).
* Fixed Dynarec "freeing" a Dynablock sometimes causing a corruption of the heap (generally happens in case of JIT code).
* Optimized the way LOCK prefix work when using Dynarec on ARM.
* improvements to the ARM opcode Printer (for dumping Dynarec blocks) improvement (thx @rajdakin).
v0.1.2
======
* The Dynarec now handle JIT code
* Added support for Unity games (not perfect yet).
* Added support for Wine (not perfect yet). You need an x86 build of Wine to use it.
* Added support for Steam (not perfect yet). Note that Steam have limited functionalities on 32bits (only mini-mode is available).
* More wrapped libs
* Added support for the "PltResolver". This makes the order of libraries less important and many symbols are now resolved at runtime.
* Added an option to build Box86 as a library (to wrap dynamic library).
* Better Signal handling (not perfect yet).
* More opcodes added, more opcode fixes.
* More Dynarec opcodes.
* Added support for FS:, and creating custom selector (needed by Wine).
* There is now 1 x86emu_t structure per thread (simplifying/optimising many callback handling).
* Box86 now has a logo!
* Added options handling (only version and help for now). Now it's much usefull exept for version printing.
v0.1.0
=======
* Dynarec!!! Only for ARM (note that Dynarec doesn't support JITed code for now).
* Added real support for getcontext/set/context/makecontext/swapcontext.
* Preliminary signal handling.
* Fixes to SDL(1/2) Image and SDL1 Mixer, and to SDL1.2 RWops usage.
* Fixed numerous issues in opcodes (both interpretor and dynarec). FTL works fine now, among many others.
* Added wrapped GTK support (still ongoing, many libraries involved).
* Make loading of libraries more configurable.
* If a wrapped native library is not found, try to use an emulated one.
* Added an env. var. to force the use of emulated libraries for certain libraries.
* Added an env. var. to precise which libGL to use.
* Added Install / Uninstall target (using systemd binfmt).
* Added more hardware targets (RPis, GameShell...).
* Wrapped more libraries (including FreeType, smpeg, ncurses, sndfile...).
v0.0.4
=======
* Improved the initialisation of dependent libraries. More things work now.
* Added a lot of wrapped functions.
* Added a few wrapped libraries (like libz or some other x11 related library).
* For trace enabled build, Trace can be enabled only after a certain amount of opcodes (still, a debugger would be better).
* Some fixes in a few opcodes, and implemented x87 rounding (SuperMeatBoy behaves better now).
* FTL 1.6.9 still has corrupted music, but older 1.5.13 seems fine (different set of libraries).
v0.0.2
=======
* A full commercial games runs fine on the Pandora platform: Airline Tycoon Deluxe.
* Implemented all planned subparts of Box86 except JIT support.
* CPU Emulation is at roughly 75%. This includes x87 and SSE/SSE2. MMX is barely implemented (but barely used anyway).
* x87 emulation is simplified, no real x87 State handling (but should not be mandatory, as the native libm library is used)
* No Signal handling yet
* ELF Loader is crude and probably full of bugs. Also, the initialisation of libraries are defered after all symbols are resolved for now.
* Wrapped libraries include libc, libm, rt, pthread, libdl, dllinux, libasound, GL, GLU, SDL1/mixer/image, SDL2/mixer/image/smpeg, OpenAL/ALUT, libz, libpng16, vorbisfile, x11/xrandr/xxf86vm.
* Most wrapped libraries are still partially implemented ( the SDL1 & GL libraries should be complete).
* Implemented specific mecanism for SDL(1/2) RWops, to be able to used them both in Native and x86 world.
* WorldOfGoo works, but is painfully slow on the Pandora platform (there is too much double math, and lack of JIT).
* FTL works, but sound is broken (issue with thread? asound? or CPU core?)
* Limbo launches but crashes before main menu.
+81
View File
@@ -0,0 +1,81 @@
Compiling
----
#### for Pandora
`mkdir build; cd build; cmake .. -DPANDORA=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make`
#### for Pyra
`mkdir build; cd build; cmake .. -DPYRA=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make`
#### for Gameshell
`mkdir build; cd build; cmake .. -DGAMESHELL=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make`
#### for Raspberry Pi
_a build for model 2, 3 and 4 can be done. Model 1 and 0 cannot (at least not with Dynarec, as they lack NEON support)_
```
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
sudo make install
sudo systemctl restart systemd-binfmt
```
_For Pi4. Change to RPI2 or RPI3 for other models. Change to RPI4ARM64 for compiling on arm64. (armhf multiarch or chroot required alongside armhf gcc. Install it with 'sudo apt install gcc-arm-linux-gnueabihf'.)_
#### for ODROID
`mkdir build; cd build; cmake .. -DODROID=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)`
#### for RK3399
`mkdir build; cd build; cmake .. -DRK3399=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j4`
As most RK3399 device run AARCH64 OS, you'll need an `armhf` multiarch environment, and an armhf gcc: On debian, install it with `sudo apt install gcc-arm-linux-gnueabihf`.
#### for Other ARM Linux platforms
`mkdir build; cd build; cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)`
#### for x86 Linux
`mkdir build; cd build; cmake .. -DLD80BITS=1 -DNOALIGN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)`
#### use ccmake
Alternatively, you can use the curses-bases ccmake (or any other gui frontend for cmake) to select wich platform to use interactively.
#### Customize your build
*use ccache if you have it*
Add `-DUSE_CCACHE=1` if you have ccache (it's better if you plan to touch the sources)
*have some debug info*
The `-DCMAKE_BUILD_TYPE=RelWithDebInfo` argument makes a build that is both optimized for speed, and has debug information embedded. That way, if you have a crash or try to analyse performance, you'll have some symbols.
*to have a Trace Enabled build*
To have a trace enabled build ( ***it will be slower***), add `-DHAVE_TRACE=1` but you will need, at runtime, to have the [Zydis library](https://github.com/zyantific/zydis) library in your `LD_LIBRARY_PATH` or in the system library folders.
*to have ARM Dynarec*
The Dynarec is only available on the ARM architecture(Right now, anyways.). Notes also that VFPv3 and NEON are required for the Dynarec. Activate it by using `-DARM_DYNAREC=1`. Also, be sure to use `-marm` in compilation flags (because many compileur use Thumb as default, and the dynarec will not work in this mode).
*not building from a git clone*
If you are not building from a git clone (for example, downloading a release source zipped from github), you need to activate `-DNOGIT=1` from cmake to be able to build (normal process include git sha1 of HEAD in the version that box86 print).
----
Testing
----
A few tests are included.
They can be launched with `ctest`
They are very basic and don't test much for now.
Executable
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2018-2021 Sebastien Chevalier ("ptitSeb")
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Executable
+114
View File
@@ -0,0 +1,114 @@
# box86
![Official logo](img/Box86Logo.png "Official Logo")
Linux Userspace x86 Emulator with a twist
----
Compiling/Installation
----
> Compilation instructions can be found [here](COMPILE.md)
> Instructions for installing Wine for Box86 can be found [here](X86WINE.md)
Box86 lets you run x86 Linux programs (such as games) on non-x86 Linux systems, like ARM (host system needs to be 32bit little-endian).
You *NEED* a 32-bit subsystem to run and build Box86. Box86 is useless on 64-bit only systems. Also, you *NEED* a 32-bit toolchain to build Box86. A toolchain that only supports 64-bit will not compile Box86, and you'll get errors (typically on aarch64, you get "-marm" not recognized, and you'll need a multiarch or chroot environnement).
Because Box86 uses the native versions of some "system" libraries, like libc, libm, SDL, and OpenGL, it's easy to integrate and use with most applications, and performance can be surprisingly high in some cases.
Most x86 Games need OpenGL, so on ARM platforms an solution like [gl4es](https://github.com/ptitSeb/gl4es) is usually necessary. (Most ARM platforms only support OpenGL ES and/or their OpenGL implementation is dodgy (see OpenGL on Android).)
Box86 now integrates a DynaRec (dynamic recompiler) for the ARM platform, providing a speed boost between 5 to 10 times faster than only using the interpreter.
Many games already work without much tweaking, for example: WorldOfGoo, Airline Tycoon Deluxe, and FTL. Many of the GameMaker Linux games also run fine. (there's a long list, among them are UNDERTALE, A Risk of Rain, and Cook Serve Delicious)
If you are serious about developing Box86, you should install ccache and build Box86 with it. (Use ccmake for example.)
To enable TRACE (i.e. dumping to stdout all individual x86 instructions executed, with dump of registers), you'll also need [Zydis library](https://github.com/zyantific/zydis) available on your system.
Some x86 internal opcodes use parts of "Realmode X86 Emulator Library", see [x86primop.c](../src/emu/x86primop.c) for copyright details
Here's 6 videos, the first 2 videos are videos of "Airline Tycoon Deluxe" and "Heretic 2" running on a GigaHertz OpenPandora (the second one is using the dynarec), and the next 2 videos are videos of of "Bit.Trip.Runner" and "Neverwinter Night" running on an ODroid XU4 (without dynarec), and the last 2 videos are on on a Pi4: Shovel Knight (video from @ITotalJustice) and Freedom Planet (video from @djazz), also without dynarec.
[![Play on Youtube](https://img.youtube.com/vi/bLt0hMoFDLk/3.jpg)](https://www.youtube.com/watch?v=bLt0hMoFDLk) [![Play on Youtube](https://img.youtube.com/vi/MM7kWYts7IA/3.jpg)](https://www.youtube.com/watch?v=MM7kWYts7IA) [![Play on Youtube](https://img.youtube.com/vi/8hr71S029Hg/1.jpg)](https://www.youtube.com/watch?v=8hr71S029Hg) [![Play on Youtube](https://img.youtube.com/vi/B4YN37z3-ws/1.jpg)](https://www.youtube.com/watch?v=B4YN37z3-ws) [![Play on Youtube](https://img.youtube.com/vi/xk8Q30mxqPg/1.jpg)](https://www.youtube.com/watch?v=xk8Q30mxqPg) [![Play on Youtube](https://img.youtube.com/vi/_QMRMVvYrqU/1.jpg)](https://www.youtube.com/watch?v=_QMRMVvYrqU)
You can find many more Box86 video on Youtube in the [Pi Labs Channel](https://www.youtube.com/channel/UCgfQjdc5RceRlTGfuthBs7g) or [The Byteman Channel](https://www.youtube.com/channel/UCEr8lpIJ3B5Ctc5BvcOHSnA)
Compatibility list is there: https://github.com/ptitSeb/box86-compatibility-list/issues
<img src="img/Box86Icon.png" width="96" height="96">
Logo and Icon made by @grayduck, thanks!
Note that this project is not to be mistaken with [86box](https://github.com/86Box/86Box), a nice "Full system" emulator specialized in early (to fairly recent) PC hardware.
----
Discord
----
If you want to discuss (or have any problems) about box86, feel free to join the [Pi Labs Discord Server](https://discord.gg/Fh8sjmu)!
----
Usage
----
There are a few environment variables to control the behaviour of Box86.
See [here](USAGE.md) for all environment variables and what they do.
Note: Box86's Dynarec uses a mechanism with Memory Protection and a SegFault signal handler to handle JIT code. In simpler terms, if you want to use GDB to debug a running program that use JIT'd code (like mono/Unity3D), you will still have many "normal" segfaults triggering. It is suggested to use something like `handle SIGSEGV nostop` in GDB to not stop at each segfault, and maybe put a breakpoint inside `my_memprotectionhandler` in `signals.c` if you want to trap SegFaults.
----
Version history
----
The change log is available [here](CHANGELOG.md)
----
Notes about 64-bit platforms
----
Because Box86 works by directly translating function calls from x86 to host system, the host system (the one Box86 is running on) needs to have 32-bit libraries. Box86 doesn't include any 32-bit <-> 64-bit translation. So basically, to run Box86 on, for example, an ARM64 platform, you will need to build Box86 for ARM 32-bit, and also need to have a chroot with 32-bit libraries.
Also note that, even if, on day, there is a Box86_64, this one will only be able to run x86_64 binaries on 64-bit platforms. You will still need Box86 (and a 32-bit chroot) to run x86 binaries (in fact, the same is the case on actual x86_64 Linux).
----
A note about Unity game emulation
----
Running Unity games is a hit or miss for now. Unity uses Mono (which uses signals that are not well emulated enough), and a runtime embedded in the main binary. A solution would be to use a native version of the libmono library used by Unity (it can be found here: https://github.com/Unity-Technologies/mono and needs to be built from source). But the wrapping of this lib is tricky, and not done for now, so the only solution is to emulate everything. The tricky part is to emulate the "JIT" code emitted by Mono, however with the new "protected memory" mechanism implemented it should be running with correct performance now.
You should also note that some Unity3D games require OpenGL 3+ which can be tricky to provide on ARM SBC (single-board computers) for now.
TL;DR: Not all Unity games work and can require a high OpenGL profile, but the speed, for the ones running, should be correct now.
----
Notes about Steam
----
Linux Steam's can run now with box86. But it's still a bit unstable, and not everything works:
- First problem is Steam crashing after the sign-in window, if you encounter this issue, you may need to add libappindicator. To install it on Debian, run `sudo apt install libappindicator1`.
- If you select to "Remember password", Steam is crashing on subsequent starts, unless you have libnm intalled. To install it on Debian, run `sudo apt install libnm0`.
- Once open, Steam will only work on "Small Mode" and in "Big Picture", not in the regular "Large Mode". This is because some Steam components used in the browser view are only 64-bit now. So go in the "View" menu and switch to "Small view", else the list will stay empty. Alternatively, Steam can be started in small mode directly by using `+open steam://open/minigameslist` command line arguments.
- To avoid the "libc.so.6 is absent" message, you can use `STEAMOS=1` and `STEAM_RUNTIME=1` as environment variables.
- Some Steam games (most Source engine games, like "Portal" or "Half-Life 2") use libtcmalloc. Box86 will detect it and will try to LD_PRELOAD it, for better compatibility. While it should work without the aformentionned feature, it is safer to add it to your system if you intend to play those game. To install it on Debian, run `sudo apt install libtcmalloc-minimal4`.
Steam for Windows installs fine but doesn't work yet.
----
Notes about Wine
----
Wine is now partly supported. Wine integrated program all runs, and some windows programs and games now runs fine. Don't forget most Windows games use Direct3D, this may require a complete OpenGL driver and as high profile as possible (and gl4es with ES2 backend have issue with Wine for now). Also, vulkan is not wrapped on box86, so vk3d is not usable yet, even if supported by the hardware.
Note: if you plan to use box86 with Wine on Raspberry Pi 3 or earlier, those models use a default OS that have a kernel with a 2/2 Split (meaning 2G of space for user program, and 2G of space for the Kernel). This is not compatible with Wine programs that needs to access memory > 2Gb address. So you'll need to reconfigure your kernel for a 3G/1G split.
----
Final words
----
(If you use Box86 in your project, please don't forget to mention Box86!)
Executable
+161
View File
@@ -0,0 +1,161 @@
Usage
----
There are many environment variables to control Box86 behaviour.
#### BOX86_LOG
Controls the Verbosity level of the logs
* 0: NONE : No message (except some fatal error). (Default.)
* 1: INFO : Show some minimum log (Example: librairies not found)
* 2: DEBUG : Details a lot of stuff (Example: relocations or functions called).
* 3: DUMP : All DEBUG plus DUMP of all ELF Info.
#### BOX86_NOBANNER
Disables Box86 printing its version and build
* 0 : Enable printing its banner. (Default.)
* 1 : Disable printing its banner.
#### BOX86_LD_LIBRARY_PATH
Path to look for x86 libraries. Default is current folder and `lib` in current folder.
Also, `/usr/lib/i386-linux-gnu` and `/lib/i386-linux-gnu` are added if they exist.
#### BOX86_PATH
Path to look for x86 executable. Default is current folder and `bin` in current folder.
#### BOX86_DLSYM_ERROR
Enables/Disables the logging of `dlsym` errors.
* 0 : Don't log `dlsym` errors. (Default.)
* 1 : Log dlsym errors.
#### BOX86_TRACE_FILE
Send all log and trace to a file instead of `stdout`
Also, if name contains `%pid` then this is replaced by the actual PID of box86 instance
#### BOX86_TRACE
Only on build with trace enabled. Trace allow the logging of all instruction executed, along with register dump
* 0 : No trace. (Default.)
* 1 : Trace enabled. Trace start after the initialisation of all depending libraries is done.
* symbolname : Trace only `symbolname` (trace is disable if the symbol is not found).
* 0xXXXXXXX-0xYYYYYYY : Trace only between the 2 addresses.
#### BOX86_TRACE_INIT
Use BOX86_TRACE_INIT instead of BOX_TRACE to start trace before the initialisation of libraries and the running program
* 0 : No trace. (Default.)
* 1 : Trace enabled. The trace start with the initialisation of all depending libraries is done.
#### BOX86_TRACE_START
Only on builds with trace enabled.
* NNNNNNN : Start trace only after NNNNNNNN opcode execute (number is an `uint64_t`).
#### BOX86_TRACE_XMM
Only on builds with trace enabled.
* 0 : The XMM (i.e. SSE/SSE2) register will not be logged with the general and x86 registers. (Default.)
* 1 : Dump the XMM registers.
#### BOX86_LOAD_ADDR
Try to load at 0xXXXXXX main binary (if binary is a PIE)
* 0xXXXXXXXX : The load address . (Only active on PIE programs.)
#### BOX86_NOSIGSEGV
Disable handling of SigSEGV. (Very useful for debugging.)
* 0 : Let the x86 program set sighandler for SEGV (Default.)
* 1 : Disable the handling of SigSEGV.
#### BOX86_NOSIGILL
Disable handling of SigILL (to ease debugging mainly).
* 0 : Let x86 program set sighandler for Illegal Instruction
* 1 : Disables the handling of SigILL
#### BOX86_X11COLOR16
PANDORA only: Try converting X11 color from 32 bits to 16 bits (to avoid light green on light cyan windows).
* 0 : Don't touch X11 colors. (Default.)
* 1 : Change colors arguments in XSetForeground, XSetBackground and XCreateGC.
#### BOX86_X11THREADS
Call XInitThreads when loading X11. (This is mostly for old Loki games with the Loki_Compat library.)
* 0 : Don't force call XInitThreads. (Default.)
* 1 : Call XInitThreads as soon as libX11 is loaded.
#### BOX86_X11GLX
Force libX11's GLX extension to be present.
* 0 : Do not force libX11's GLX extension to be present.
* 1 : GLX will always be present when using XQueryExtension. (Default.)
#### BOX86_DYNAREC_DUMP
Enables/disables Box86's Dynarec's dump.
* 0 : Disable Dynarec's blocks dump. (Default.)
* 1 : Enable Dynarec's blocks dump.
* 2 : Enable Dynarec's blocks dump with some colors.
#### BOX86_DYNAREC_LOG
Set the level of DynaRec's logs.
* 0 : NONE : No Logs for DynaRec. (Default.)
* 1 :INFO : Minimum Dynarec Logs (only unimplemented OpCode).
* 2 : DEBUG : Debug Logs for Dynarec (with details on block created / executed).
* 3 : VERBOSE : All of the above plus more.
#### BOX86_DYNAREC
Enables/Disables Box86's Dynarec.
* 0 : Disables Dynarec.
* 1 : Enable Dynarec. (Default.)
#### BOX86_DYNAREC_TRACE
Enables/Disables trace for generated code.
* 0 : Disable trace for generated code. (Default.)
* 1 : Enable trace for generated code (like regular Trace, this will slow down the program a lot and generate huge logs).
#### BOX86_NODYNAREC
Forbid dynablock creation in the interval specified (helpfull for debugging behaviour difference between Dynarec and Interpretor)
* 0xXXXXXXXX-0xYYYYYYYY : define the interval where dynablock cannot start (inclusive-exclusive)
#### BOX86_LIBGL
* libXXXX set the name for libGL (defaults to libGL.so.1).
* /PATH/TO/libGLXXX : Sets the name and path for libGL
You can also use SDL_VIDEO_GL_DRIVER
#### BOX86_LD_PRELOAD
* XXXX[:YYYYY] force loading XXXX (and YYYY...) libraries with the binary
PreLoaded libs can be emulated or native, and are treated the same way as if they were comming from the binary
#### BOX86_EMULATED_LIBS
* XXXX[:YYYYY] force lib XXXX (and YYYY...) to be emulated (and not wrapped)
Some games uses an old version of some libraries, with an ABI incompatible with native version.
Note that LittleInferno for example is auto detected, and libvorbis.so.0 is automatical added to emulated libs, and same for Don't Starve (and Together / Server variant) that use an old SDL2 too
#### BOX86_ALLOWMISSINGLIBS
Allow Box86 to continue even if a library is missing.
* 0 : Box86 will stop if a library cannot be loaded. (Default.)
* 1 : Continue even if a needed library cannot be loaded. Unadvised, this will, in most cases, crash later on.
#### BOX86_NOPULSE
Disables the load of pulseaudio libraries.
* 0 : Load pulseaudio libraries if found. (Default.)
* 1 : Disables the load of pulse audio libraries (libpulse and libpulse-simple), both the native library and the x86 library
#### BOX86_NOGTK
Disables the loading of wrapped GTK libraries.
* 0 : Load wrapped GTK libraries if found. (Default.)
* 1 : Disables loading wrapped GTK libraries (can be used with Steam, along with STEAM_RUNTIME=1 to use the i386 version of GTK).
#### BOX86_NOVULKAN
Disables the load of vulkan libraries.
* 0 : Load vulkan libraries if found.
* 1 : Disables the load of vulkan libraries, both the native and the i386 version (can be useful on Pi4, where the vulkan driver is not quite there yet.)
#### BOX86_FIX_64BIT_INODES
Fix/Don't fix 64bit inodes
* 0 : Don't fix 64bit inodes. (Default.)
* 1 : Fix 64bit inodes. Helps when running on Filesystems with 64bit inodes. Is useful when a program uses API functions which doesn't support it and the program doesn't use inodes information.
#### BOX86_JITGDB
* 0 : Just print the Segfault message on segfault (default)
* 1 : Launch `gdb` when a segfault, bus error or illegal instruction signal is trapped, attached to the offending process and go in an endless loop, waiting.
When in gdb, you need to find the correct thread yourself (the one with `my_box86signalhandler` in is stack)
then probably need to `finish` 1 or 2 functions (inside `usleep(..)`) and then you'll be in `my_box86signalhandler`,
just before the printf of the Segfault message. Then simply
`set waiting=0` to exit the infinite loop.
* 2 : Launch `gdbserver` when a segfault, bus error or illegal instruction signal is trapped, attached to the offending process, and go in an endless loop, waiting.
Use `gdb /PATH/TO/box86` and then `target remote 127.0.0.1:1234` to connect to the gdbserver (or use actual IP if not on the machine). After that, the procedure is the same as with ` BOX86_JITGDB=1`.
This mode can be usefullwhen programs redirect all console output to a file (like Unity3D Games)
+143
View File
@@ -0,0 +1,143 @@
# Installing Wine (and winetricks)
Using Wine with Box86 allows (x86) Windows programs to run on ARM Linux computers (x64 is not yet implemented).
See installation steps below (in the [Examples](#examples) section).
_TwisterOS users, take note: Wine, winetricks, and Box86 are pre-installed in TwisterOS. TwisterOS users do not have to install anything._
Box86 actually needs `wine-i386` to be installed **manually** on ARM devices. Even though `wine-armhf` is available in many repo's on ARM devices (ie using _apt-get_ will attempt to install `wine-armhf` by default), `wine-armhf` will not work with Box86. Note that manual installation is required since using `multiarch` will result in your ARM device thinking it needs to install lots of i386 dependencies to make `wine-i386` work. The "twist" in Box86 is that Box86 "wraps" many Windows and Wine i386 libraries (`.so` or `.dll` files) so that they will work with your ARM device's libraries. Also note that wrapping libraries is an ongoing process throughout Box86 development and that some programs may not run properly until all of their i386 library dependencies are wrapped.
Installation files for Wine can be found in the [WineHQ repository](https://dl.winehq.org/wine-builds/debian/dists/buster/main/binary-i386/), the [TwisterOS FAQ](https://twisteros.com/faq.html) page, or the [PlayOnLinux website repository](https://www.playonlinux.com/wine/). Box86 requires the "i386" (x86) versions of Wine install files (even though we are installing it on an ARM processor). Box86 "wraps" many of Wine's core Linux i386 libraries so that their calls are interpretable by Linux ARM libraries. Below are examples of how to install Wine from each of those places.
_Raspberry Pi users: Wine requires a 3G/1G split memory kernel. Raspberry Pi OS for the Pi 4 has a 3G/1G split kernel, but **the Pi 3 and earlier models have a 2G/2G kernel by default and will need you to install a custom-compiled 3G/1G kernel to get Wine to work.**
## Overview
The general procedure for installing Wine for Box86 is to...
- Download all the install files (.deb, .zip, or even .pol files) for the version of Wine you wish to install
- Unzip or dpkg the install files into one folder
- Move that folder to the directory that you wish Wine to run from (in TwisterOS, this is `~/wine/` by default)
- Go to `/usr/local/bin` and make symlinks or scripts that will point to your main wine binaries (`wine`, `winecfg`, and `wineserver`).
- Boot wine to create a new wineprefix (`wine wineboot`).
- Download winetricks (which is simply a very complicated bash script), make it executable, then copy it to `/usr/local/bin`.
## Examples
_These examples were all tested on Raspberry Pi 4. Note the similarities between the different install methods._
### Installing wine-devel, wine-stable, or wine-staging for Raspberry Pi OS Buster from WineHQ deb files
_Links from the [WineHQ repo](https://dl.winehq.org/wine-builds/debian/dists/buster/main/binary-i386/)_
```
# Backup any old wine installations
sudo mv ~/wine ~/wine-old
sudo mv ~/.wine ~/.wine-old
sudo mv /usr/local/bin/wine /usr/local/bin/wine-old
sudo mv /usr/local/bin/wineboot /usr/local/bin/wineboot-old
sudo mv /usr/local/bin/winecfg /usr/local/bin/winecfg-old
sudo mv /usr/local/bin/wineserver /usr/local/bin/wineserver-old
# Download, extract wine, and install wine
# (Replace the links/versions below with links/versions from the WineHQ site for the version of wine you wish to install. Note that we need the i386 version for Box86 even though we're installing it on our ARM processor.)
# (Pick an i386 version of wine-devel, wine-staging, or wine-stable)
cd ~/Downloads
wget https://dl.winehq.org/wine-builds/debian/dists/buster/main/binary-i386/wine-devel-i386_5.21~buster_i386.deb # NOTE: Replace this link with the version you want
wget https://dl.winehq.org/wine-builds/debian/dists/buster/main/binary-i386/wine-devel_5.21~buster_i386.deb # NOTE: Also replace this link with the version you want
dpkg-deb -xv wine-devel-i386_5.21~buster_i386.deb wine-installer # NOTE: Make sure these dpkg command matches the filename of the deb package you just downloaded
dpkg-deb -xv wine-devel_5.21~buster_i386.deb wine-installer
mv ~/Downloads/wine-installer/opt/wine* ~/wine
rm wine*.deb # clean up
rm -rf wine-installer # clean up
# Install shortcuts (make 32bit launcher & symlinks. Credits: grayduck, Botspot)
echo -e '#!/bin/bash\nsetarch linux32 -L '"$HOME/wine/bin/wine "'"$@"' | sudo tee -a /usr/local/bin/wine >/dev/null # Create a script to launch wine programs as 32bit only
#sudo ln -s ~/wine/bin/wine /usr/local/bin/wine # You could aslo just make a symlink, but box86 only works for 32bit apps at the moment
sudo ln -s ~/wine/bin/wineboot /usr/local/bin/wineboot
sudo ln -s ~/wine/bin/winecfg /usr/local/bin/winecfg
sudo ln -s ~/wine/bin/wineserver /usr/local/bin/wineserver
sudo chmod +x /usr/local/bin/wine /usr/local/bin/wineboot /usr/local/bin/winecfg /usr/local/bin/wineserver
# These packages are needed for running wine-staging on RPi 4 (Credits: chills340)
sudo apt install libstb0 -y
cd ~/Downloads
wget -r -l1 -np -nd -A "libfaudio0_*~bpo10+1_i386.deb" http://ftp.us.debian.org/debian/pool/main/f/faudio/ # Download libfaudio i386 no matter its version number
dpkg-deb -xv libfaudio0_*~bpo10+1_i386.deb libfaudio
sudo cp -TRv libfaudio/usr/ /usr/
rm libfaudio0_*~bpo10+1_i386.deb # clean up
rm -rf libfaudio # clean up
# Boot wine (make fresh wineprefix in ~/.wine )
wine wineboot
```
### Installing Wine for Raspberry Pi OS from the Twister OS FAQ page
_Links from the [TwisterOS FAQ](https://twisteros.com/faq.html)_
```
# Backup any old wine installations
sudo mv ~/wine ~/wine-old
sudo mv ~/.wine ~/.wine-old
sudo mv /usr/local/bin/wine /usr/local/bin/wine-old
sudo mv /usr/local/bin/wineboot /usr/local/bin/wineboot-old
sudo mv /usr/local/bin/winecfg /usr/local/bin/winecfg-old
sudo mv /usr/local/bin/wineserver /usr/local/bin/wineserver-old
# Download, extract wine, and install wine (last I checked, the Twister OS FAQ page had Wine 5.13-devel)
wget https://twisteros.com/wine.tgz -O ~/wine.tgz
tar -xzvf ~/wine.tgz
rm ~/wine.tgz # clean up
# Install shortcuts (make launcher & symlinks. Credits: grayduck, Botspot)
echo -e '#!/bin/bash\nsetarch linux32 -L '"$HOME/wine/bin/wine "'"$@"' | sudo tee -a /usr/local/bin/wine >/dev/null # Create a script to launch wine programs as 32bit only
#sudo ln -s ~/wine/bin/wine /usr/local/bin/wine # You could aslo just make a symlink, but box86 only works for 32bit apps at the moment
sudo ln -s ~/wine/bin/wineboot /usr/local/bin/wineboot
sudo ln -s ~/wine/bin/winecfg /usr/local/bin/winecfg
sudo ln -s ~/wine/bin/wineserver /usr/local/bin/wineserver
sudo chmod +x /usr/local/bin/wine /usr/local/bin/wineboot /usr/local/bin/winecfg /usr/local/bin/wineserver
# Boot wine (make fresh wineprefix in ~/.wine )
wine wineboot
```
## Installing winetricks
Winetricks is a script which makes it easier to install & configure any desired Windows core system software packages which may be dependencies for certain Windows programs.
```
# Backup old winetricks
sudo mv /usr/local/bin/winetricks /usr/local/bin/winetricks-old
# Download
cd ~/Downloads
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
# Install
sudo chmod +x winetricks
sudo mv winetricks /usr/local/bin/
# winetricks needs this installed
sudo apt-get install cabextract -y
```
If you have a desktop menu itm for wintricks, you may need to edit it to add the nobanner env var. Do so by edition `/usr/share/applications/winetricks.desktop` with your favorite text editor (not that you'll need `sudo` to save the file) and change from `Exec=winetricks --gui` to `Exec=env BOX86_NOBANNER=1 winetricks --gui`
## Example commands
Here is an example of how we should run a winetricks command with box86:
`BOX86_NOBANNER=1 winetricks -q corefonts vcrun2010 dotnet20sp1`
_This command will silently install three packages in series: Windows core fonts, VC++ 2010 Runtimes, and .NET 2.0 SP1. `-q` is the "install silent/quiet" command._
Whenever we run winetricks, we must suppress Box86's banner by typing `BOX86_NOBANNER=1` to prevent winetricks from crashing. Invoking Box86's logging features (with `BOX86_LOG=1` or similar) will also cause winetricks to crash. (If Box86 logging is necessary though, we can patch winetricks to avoid these crashes - see the *Troubleshooting* section) # future work.
For a list of all the different Windows packages & libraries that winetricks can help you install, run `winetricks list-all`
## Other notes
### Wineprefixes (and Wine initialization)
The first time Wine is run (`wine wineboot`), it will create a fresh wineprefix for you (by default, located in the hidden folder `~/.wine`). Think of a wineprefix as Wine's virtual 'harddrive' where it installs software and saves settings. Wineprefixes are portable and deletable.
If you at any point corrupt something inside your default wineprefix, you can start "fresh" by deleting your `~/.wine` directory (with the `rm -rf ~/.wine` command) and boot wine again to create a new default wineprefix.
### Transplanting wineprefixes (side-loading)
When you first run or boot Wine (`wine wineboot`), Wine will create a new user environment within which to install Windows software. This user environment is called a "wineprefix" (or "wine bottle") and is located (by default) in `~/.wine` (note that Linux folders with a `.` in front of them are "hidden" folders). For more Wine documentation, see [WineHQ](https://www.winehq.org/documentation).
If software isn't installing in Wine with Box86, but is installing for you in Wine on a regular x86 Linux computer, you can copy a wineprefix from your x86 Linux computer to the device you're running Box86 on. This is most easily done by tarring the `~/.wine` folder on your x86 Linux computer (`tar -cvf winebottle.tar ~/.wine`), transferring the tar file to your device, then un-tarring the tar file (`tar -xf winebottle.tar`) on your device running Box86 & Wine. Tarring the wineprefix preserves any symlinks that are inside it.
### Swapping out different versions of Wine
Some versions of Wine work better with certain software. It is best to install a version of Wine that is known to work with the software you would like to run. There are three main development branches of Wine you can pick from, referred to as wine-stable, wine-devel, and wine-staging. _Note that the wine-staging branch requires extra installation steps on Raspberry Pi._
Your entire Wine installation can reside within a single folder on your Linux computer. TwisterOS assumes that your Wine installation is located inside the `~/wine/` directory. The actual directory where you put your `wine` folder doesn't matter as long as you have symlinks within the `/usr/local/bin/` directory which point to the `wine` folder so that Linux can find Wine when you type `wine` into the terminal).
You can change which version of Wine you are running simply by renaming your old `wine` and `.wine` folders to something else, then putting a new `wine` folder (containing your new version of Wine) in its place. Running `wine wineboot` again will make a fresh wineprefix with your new version of Wine. You can check which version of Wine you're running with the `wine --version` command.
+1
View File
@@ -0,0 +1 @@
theme: jekyll-theme-hacker
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

+1985
View File
File diff suppressed because it is too large. Load diff
+638 -127
View File
@@ -1,100 +1,493 @@
#!/usr/bin/env python
import os
import glob
import sys
values = ['E', 'e', 'v', 'c', 'w', 'i', 'I', 'C', 'W', 'u', 'U', 'f', 'd', 'D', 'L', 'p', 'V']
"""
Generates all files in src/wrapped/generated
===
TL;DR: Automagically creates type definitions (/.F.+/ functions/typedefs...).
All '//%' in the headers are used by the script.
Reads each lines of each "_private.h" headers (plus wrappedd3dadapter9_gen.h as a special case).
For each of them:
- If if starts with a #ifdef, #else, #ifndef, #endif, it memorizes which definition is required
- If it starts with a "GO", it will do multiple things:
- It memorizes the type used by the function (second macro argument)
- It memorizes the type it is mapped to, if needed (eg, iFEv is mapped to iFE: the second argument is dropped)
- It checks if the type given (both original and )
- If the signature contains a 'E', it will memorize the original function's signature:
- If it is the special file case, or if the line contains "//%%", it stops there.
- Otherwise, if it starts with "GOS":
- It will search for the special marker "//%".
That special marker is used to detect the following step:
- If the marker is followed by a registered structure ID (see later), it transforms the assembly function signature
into the original signature (eg, transforms pFEp into XFv if //%X was used)
- If the marker is followed by a '{', it will not attempt to alter the given signature, and instead use the
signature between '{' and '}'
- Otherwise, if the line contains '//%{', like before it will use the signature given and not the original one.
- Finally, if it still didn't stop, it will use the assembly signature (without the emulator).
- If the line starts with a '//%'
`gbl` contains the first list, `redirects` the second, `mytypedefs` the third.
`mystructs` and `mystructs_vals` constains data about the structures.
After sorting the data, it generates:
wrapper.c
---------
(Private) type definitions (/.F.+_t/)
Function definitions (/.F.+/ functions, that actually execute the function given as argument)
isSimpleWrapper definition
wrapper.h
---------
Generic "wrapper_t" type definition
Function declarations (/.F.+/ functions)
*types.h
--------
Local types definition, for the original signatures (eg, XFv for the earlier example)
The SUPER() macro definition, used to generate and initialize the `*_my_t` library structure
(TODO: also automate this declaration/definition? It would require more metadata,
and may break sometime in the future due to the system changing...)
"""
# Free values:
# AB F H J QR T XYZab gh jk mno qrst xyz
values = ['E', 'e', 'v', 'c', 'w', 'i', 'I', 'C', 'W', 'u', 'U', 'f', 'd', 'D', 'K', 'l', 'L', 'p', 'V', 'O', 'S', '2', 'P', 'G', 'N', 'M']
def splitchar(s):
ret = [len(s)]
i = 0
for c in s:
i = i + 1
if i == 2:
continue
ret.append(values.index(c))
try:
ret = [len(s), values.index(s[0])]
for c in s[2:]:
ret.append(values.index(c))
return ret
except ValueError as e:
raise ValueError("Value is " + s) from e
def value(define):
return define[9:-1] if define.startswith("!") else define[8:-1]
def splitdef(dnf, defines):
cunjs = dnf.split(" || ")
clauses = [c.split(" && ") for c in cunjs]
ret = [len(cunjs)]
for cunj in clauses:
for c in cunj:
ret.append(len(c))
for cunj in clauses:
for c in cunj:
ret.append(defines.index(value(c)) * 2 + (1 if c.startswith("!") else 0))
ret.append(0)
return ret
def main(root):
# Initialize variables: gbl for all values, vals for file-per-file values, redirects for redirections
gbl = []
vals = {}
redirects = {}
def invert(define):
return define[1:] if define.startswith("!") else ("!" + define)
def main(root, defines, files, ver):
global values
# Initialize variables: gbl for all values, redirects for redirections
# mytypedefs is a list of all functions per "*FE*" types per filename, mystructs of structures per filename
gbl = {}
redirects = {}
mytypedefs = {}
mystructs = {}
mystructs_vals = {}
# First read the files inside the headers
for filepath in glob.glob(os.path.join(root, "src", "wrapped*_private.h")):
# TODO: remove the special case...
for filepath in files + [os.path.join(root, "src", "wrapped", "wrappedd3dadapter9_gen.h")]:
filename = filepath.split("/")[-1]
locval = []
dependants = []
with open(filepath, 'r') as file:
for line in file:
def fail(s, causedby=None):
if causedby:
raise NotImplementedError(s + " ({0}:{1})".format(filename, line[:-1])) from causedby
else:
raise NotImplementedError(s + " ({0}:{1})".format(filename, line[:-1]))
ln = line.strip()
# If the line is a `#' line (#ifdef LD80BITS/#ifndef LD80BITS/header)
if ln.startswith("#"):
preproc_cmd = ln[1:].strip()
try:
if preproc_cmd.startswith("if defined(GO)"):
continue #if defined(GO) && defined(GOM)...
elif preproc_cmd.startswith("if !(defined(GO)"):
continue #if !(defined(GO) && defined(GOM)...)
elif preproc_cmd.startswith("error"):
continue #error meh!
elif preproc_cmd.startswith("include"):
continue #inherit other library
elif preproc_cmd.startswith("endif"):
if dependants != []:
dependants.pop()
elif preproc_cmd.startswith("ifdef"):
if preproc_cmd[5:].strip() not in defines:
raise KeyError(preproc_cmd[5:].strip())
dependants.append("defined(" + preproc_cmd[5:].strip() + ")")
elif preproc_cmd.startswith("ifndef"):
if preproc_cmd[6:].strip() not in defines:
raise KeyError(preproc_cmd[6:].strip())
dependants.append("!defined(" + preproc_cmd[6:].strip() + ")")
elif preproc_cmd.startswith("else"):
dependants[-1] = invert(dependants[-1])
else:
fail("Unknown preprocessor directive: {0}".format(preproc_cmd.split(" ")[0]))
except KeyError as k:
fail("Unknown key: {0}".format(k.args[0]), k)
# If the line is a `GO...' line (GO/GOM/GO2/...)...
if ln.startswith("GO"):
elif ln.startswith("GO"):
# ... then look at the second parameter of the line
gotype = ln.split("(")[0].strip()
funname = ln.split(",")[0].split("(")[1].strip()
ln = ln.split(",")[1].split(")")[0].strip()
if len(ln) < 3:
fail("Type {0} too short".format(ln))
if "E" in ln:
if ("E" in ln[:2]) or ("E" in ln[3:]):
fail("emu64_t* not as the first parameter")
if len(ln) < 4:
fail("Type {0} too short".format(ln))
if ln[0] not in values:
fail("Invalid return type {0}".format(ln[0]))
if ln[1] != "F":
fail("Bad middle letter {0}".format(ln[1]))
if any(c not in values for c in ln[2:]) or (('v' in ln[2:]) and (len(ln) > 3)):
old = ln
# This needs more work
acceptables = ['v', 'o', '0', '1'] + values
acceptables = ['v', '0', '1'] + values
if any(c not in acceptables for c in ln[2:]):
raise NotImplementedError("{0} ({1})".format(ln[2:], line))
# Ok, this is acceptable: there is 0, 1, stdout and void
ln = (ln
fail("Invalid type {0}".format(ln[2:]))
# Ok, this is acceptable: there is 0, 1 and/or void
ln = ln[:2] + (ln[2:]
.replace("v", "") # void -> nothing
.replace("o", "p") # stdout -> pointer
.replace("0", "p") # 0 -> pointer
.replace("1", "i")) # 1 -> integer
redirects[old] = ln
redirects.setdefault(" && ".join(dependants), {})
redirects[" && ".join(dependants)][old] = ln
# Simply append the function name if it's not yet existing
if ln not in locval:
locval.append(ln)
if ln not in gbl:
gbl.append(ln)
# Sort the file local values and add it to the dictionary
locval.sort(key=lambda v: splitchar(v))
vals[filename] = locval
gbl.setdefault(" && ".join(dependants), [])
if ln not in gbl[" && ".join(dependants)]:
gbl[" && ".join(dependants)].append(ln)
if filename == "wrappedd3dadapter9_gen.h":
pass # Special case...
elif ln[2] == 'E':
if "//%%" in line:
# Do not dlsym functions containing "//%%" as metadata
pass
elif gotype == "GOS":
# Scan the rest of the line to extract the return structure ID
if filename[:-10] not in mystructs:
fail("No structure info in the file")
if "//%" not in line:
fail("Invalid GOS (missing structure ID info)")
if ln[0] != 'p':
fail("Invalid GOS return type ('{0}' and not 'p')".format(ln[0]))
#if (ln[2] != 'p') and ((ln[2] != 'E') or (ln[3] != 'p')): -> only allow pFEp for now
# fail("Invalid GOS first parameter ('{0}' and not 'p' or 'Ep')".format(ln[2:4]))
if (ln[2] != 'E') or (ln[3] != 'p'):
fail("Invalid GOS first parameter ('{0}' and not 'Ep')".format(ln[2:4]))
sid = line.split("//%")[1].split(" ")[0].strip()
if sid[0] == '{':
# Change type completely, not just the return type...
if sid[-1] != '}':
fail("Invalid type (EOL or space met, expected '}')")
if len(sid) < 5:
fail("Invalid type (Type {0} too short)".format(sid[1:-1]))
if sid[2] != "F":
fail("Invalid type (Bad middle letter {0})".format(sid[2]))
inval_char = lambda c:\
(c not in mystructs[filename[:-10]]) and (c not in acceptables) \
or (c == 'E') or (c == 'e')
if inval_char(sid[1]):
fail("Invalid type (Invalid return type {0})".format(sid[1]))
if any(map(inval_char, sid[3:-1])):
fail("Invalid type (Invalid type {0})".format(sid[3:-1]))
mytypedefs.setdefault(filename[:-10], {})
mytypedefs[filename[:-10]].setdefault(sid[1:-1], [])
mytypedefs[filename[:-10]][sid[1:-1]].append((0, funname))
else:
if len(sid) != 1:
fail("Invalid structure ID {0} (length is too big)".format(sid))
if sid not in mystructs[filename[:-10]]:
fail("Invalid structure ID {0} (unknown ID)".format(sid))
mytypedefs.setdefault(filename[:-10], {})
mytypedefs[filename[:-10]].setdefault(sid + "F" + ln[4:], [])
mytypedefs[filename[:-10]][sid + "F" + ln[4:]].append((1, funname))
elif "//%{" in line:
# Change type completely...
# ...Maybe?
if filename[:-10] not in mystructs:
fail("No structure info in the file")
newtype = line.split("//%")[1].split(" ")[0].strip()
if newtype[-1] != '}':
fail("Invalid type (EOL or space met, expected '}')")
if len(newtype) < 5:
fail("Invalid type (Type {0} too short)".format(newtype[1:-1]))
if newtype[2] != "F":
fail("Invalid type (Bad middle letter {0})".format(newtype[2]))
inval_char = lambda c:\
(c not in mystructs[filename[:-10]]) and (c not in acceptables) \
or (c == 'E') or (c == 'e')
if inval_char(newtype[1]):
fail("Invalid type (Invalid return type {0})".format(newtype[1]))
if any(map(inval_char, newtype[3:-1])):
fail("Invalid type (Invalid type {0})".format(newtype[3:-1]))
mytypedefs.setdefault(filename[:-10], {})
mytypedefs[filename[:-10]].setdefault(newtype[1:-1], [])
mytypedefs[filename[:-10]][newtype[1:-1]].append((2, funname))
else:
# filename isn't stored with the '_private.h' part
if not filename.endswith('_private.h'):
fail("??? {0}".format(filename))
if len(ln) > 3:
ln = ln[:2] + ln[3:]
else:
ln = ln[:2] + "v"
mytypedefs.setdefault(filename[:-10], {})
mytypedefs[filename[:-10]].setdefault(ln, [])
mytypedefs[filename[:-10]][ln].append((3, funname))
elif ln.startswith("//%S"):
# Extract a structure ID-name pair
data = [s for s in map(lambda s: s.strip(), ln.split(" ")) if s != ""]
if len(data) != 3:
fail("Too much data ({0})".format(len(data)))
if not filename.endswith('_private.h'):
fail("??? {0}".format(filename))
if (data[0] != "//%S") or (len(data[1]) != 1):
fail("Invalid structure data {0} {1}".format(data[0], data[1]))
if data[1] in values:
fail("{0} cannot be used as a structure type".format(data[1]))
mystructs.setdefault(filename[:-10], {})
if data[1] in mystructs[filename[:-10]]:
fail("Duplicate structure ID {0} ({1}/{2})".format(data[1], mystructs[filename[:-10]], data[2]))
mystructs[filename[:-10]][data[1]] = data[2]
mystructs_vals.setdefault(filename[:-10], [])
mystructs_vals[filename[:-10]].append(data[1])
# Sort the table
gbl.sort(key=lambda v: splitchar(v))
if ("" not in gbl) or ("" not in redirects):
print("\033[1;31mThere is suspiciously not many types...\033[m")
print("Check the CMakeLists.txt file. If you are SURE there is nothing wrong"
" (as a random example, `set()` resets the variable...), then comment out the following return.")
print("(Also, the program WILL crash later if you proceed.)")
return 2 # Check what you did, not proceeding
def length(s):
l = len(s)
if l < 10:
ret = "0" + str(l)
gbl_vals = {}
for k in gbl:
ks = k.split(" && ")
for v in gbl[k]:
if k == "":
gbl_vals[v] = []
continue
if v in gbl_vals:
if gbl_vals[v] == []:
continue
for other_key in gbl_vals[v]:
other_key_vals = other_key.split(" && ")
for other_key_val in other_key_vals:
if other_key_val not in ks:
break
else:
break
else:
gbl_vals[v].append(k)
else:
gbl_vals[v] = [k]
for v in gbl_vals:
for k in gbl_vals[v]:
if " && ".join([invert(v2) for v2 in k.split(" && ")]) in gbl_vals[v]:
gbl_vals[v] = []
break
gbl = {}
gbl_idxs = []
for k in gbl_vals:
if len(gbl_vals[k]) == 1:
key = gbl_vals[k][0]
else:
ret = str(l)
return ret
key = "(" + (") || (".join(gbl_vals[k])) + ")"
gbl[key] = gbl.get(key, []) + [k]
if (key not in gbl_idxs) and (key != "()"):
gbl_idxs.append(key)
gbl_idxs.sort(key=lambda v: splitdef(v, defines))
redirects_vals = {}
for k in redirects:
ks = k.split(" && ")
for v in redirects[k]:
if k == "":
redirects_vals[(v, redirects[k][v])] = []
continue
if (v, redirects[k][v]) in redirects_vals:
if redirects_vals[(v, redirects[k][v])] == []:
continue
for other_key in redirects_vals[(v, redirects[k][v])]:
if other_key == "()":
break
other_key_vals = other_key.split(" && ")
for other_key_val in other_key_vals:
if other_key_val not in ks:
break
else:
break
else:
redirects_vals[(v, redirects[k][v])].append(k)
else:
redirects_vals[(v, redirects[k][v])] = [k]
redirects = {}
redirects_idxs = []
for k, v in redirects_vals:
key = "(" + (") || (".join(redirects_vals[(k, v)])) + ")"
if key in redirects:
redirects[key].append([k, v])
else:
redirects[key] = [[k, v]]
if (key not in redirects_idxs) and (key != "()"):
redirects_idxs.append(key)
redirects_idxs.sort(key=lambda v: splitdef(v, defines))
# Sort the tables
for k in gbl:
gbl[k].sort(key=lambda v: splitchar(v))
values = values + ['0', '1']
for k in redirects:
redirects[k].sort(key=lambda v: splitchar(v[0]) + [-1] + splitchar(v[1]))
values = values[:-2]
mytypedefs_vals = {}
for fn in mytypedefs:
if fn in mystructs:
values = values + list(mystructs[fn].keys())
mytypedefs_vals[fn] = sorted(mytypedefs[fn].keys(), key=lambda v: splitchar(v))
if fn in mystructs:
values = values[:-len(mystructs[fn])]
for v in mytypedefs_vals[fn]:
mytypedefs[fn][v].sort()
# Check if there was any new functions
functions_list = ""
for k in ["()"] + gbl_idxs:
for v in gbl[k]:
functions_list = functions_list + "#" + k + " " + v + "\n"
for k in ["()"] + redirects_idxs:
for v in redirects[k]:
functions_list = functions_list + "#" + k + " " + v[0] + " -> " + v[1] + "\n"
for fn in sorted(mystructs.keys()):
for t in mystructs_vals[fn]:
# Structure Definition
functions_list = functions_list + fn + "/Sd" + t + mystructs[fn][t] + "\n"
for fn in sorted(mytypedefs.keys()):
for t in mytypedefs_vals[fn]:
# Structure Usage
for tnum, f in mytypedefs[fn][t]:
functions_list = functions_list + fn + "/Su" + t + str(tnum) + f + "\n"
# functions_list is a unique string, compare it with the last run
try:
last_run = ""
with open(os.path.join(root, "src", "wrapped", "generated", "functions_list.txt"), 'r') as file:
last_run = file.read()
if last_run == functions_list:
# Mark as OK for CMake
with open(os.path.join(root, "src", "wrapped", "generated", "functions_list.txt"), 'w') as file:
file.write(functions_list)
return 0
except IOError:
# The file does not exist yet, first run
pass
# Now the files rebuilding part
# File headers and guards
files_headers = {
# Files header and guard
files_header = {
"wrapper.c": """/*****************************************************************
* File automatically generated by rebuild_wrappers.py (v1.0.0.02)
* File automatically generated by rebuild_wrappers.py (v{version})
*****************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "wrapper.h"
#include "x86emu_private.h"
#include "x87emu_private.h"
#include "emu/x86emu_private.h"
#include "emu/x87emu_private.h"
#include "regs.h"
#include "x86emu.h"
typedef union ui64_s {
typedef union ui64_s {lbr}
int64_t i;
uint64_t u;
uint32_t d[2];
} ui64_t;
{rbr} ui64_t;
typedef struct _2uint_struct_s {lbr}
uint32_t a;
uint32_t b;
{rbr} _2uint_struct_t;
extern void* my__IO_2_1_stderr_;
extern void* my__IO_2_1_stdin_ ;
extern void* my__IO_2_1_stdout_;
static void* io_convert(void* v)
{lbr}
if(!v)
return v;
if(v==my__IO_2_1_stderr_)
return stderr;
if(v==my__IO_2_1_stdin_)
return stdin;
if(v==my__IO_2_1_stdout_)
return stdout;
return v;
{rbr}
typedef struct my_GValue_s
{lbr}
int g_type;
union {lbr}
int v_int;
int64_t v_int64;
uint64_t v_uint64;
float v_float;
double v_double;
void* v_pointer;
{rbr} data[2];
{rbr} my_GValue_t;
static void alignGValue(my_GValue_t* v, void* value)
{lbr}
v->g_type = *(int*)value;
memcpy(v->data, value+4, 2*sizeof(double));
{rbr}
static void unalignGValue(void* value, my_GValue_t* v)
{lbr}
*(int*)value = v->g_type;
memcpy(value+4, v->data, 2*sizeof(double));
{rbr}
void* VulkanFromx86(void* src, void** save);
void VulkanTox86(void* src, void* save);
#define ST0val ST0.d
int of_convert(int);
""",
"wrapper.h": """/*****************************************************************
* File automatically generated by rebuild_wrappers.py (v1.0.0.02)
* File automatically generated by rebuild_wrappers.py (v{version})
*****************************************************************/
#ifndef __WRAPPER_H_
#define __WRAPPER_H_
#include <stdint.h>
#include <string.h>
typedef struct x86emu_s x86emu_t;
@@ -103,126 +496,244 @@ typedef void (*wrapper_t)(x86emu_t* emu, uintptr_t fnc);
// list of defined wrapper
// v = void, i = int32, u = uint32, U/I= (u)int64
// l = signed long, L = unsigned long (long is an int with the size of a pointer)
// p = pointer, P = callback
// f = float, d = double, D = long double, L = fake long double
// f = float, d = double, D = long double, K = fake long double
// V = vaargs, E = current x86emu struct, e = ref to current x86emu struct
// 0 = constant 0, 1 = constant 1
// o = stdout
// C = unsigned byte c = char
// W = unsigned short w = short
// O = libc O_ flags bitfield
// S = _IO_2_1_stdXXX_ pointer (or FILE*)
// Q = ...
// S8 = struct, 8 bytes
// 2 = struct of 2 uint
// P = Vulkan struture pointer
// G = a single GValue pointer
// N = ... automatically sending 1 arg
// M = ... automatically sending 2 args
""",
"fntypes.h": """/*****************************************************************
* File automatically generated by rebuild_wrappers.py (v{version})
*****************************************************************/
#ifndef __{filename}TYPES_H_
#define __{filename}TYPES_H_
#ifndef LIBNAME
#error You should only #include this file inside a wrapped*.c file
#endif
#ifndef ADDED_FUNCTIONS
#define ADDED_FUNCTIONS()
#endif
"""
}
files_guards = {"wrapper.c": """""",
files_guard = {"wrapper.c": """""",
"wrapper.h": """
#endif //__WRAPPER_H_
#endif // __WRAPPER_H_
""",
"fntypes.h": """
#endif // __{filename}TYPES_H_
"""
}
# Transform strings into arrays
gbl = [[c for c in v] for v in gbl]
# Rewrite the wrapper.h file:
with open(os.path.join(root, "src", "wrapper.h"), 'w') as file:
file.write(files_headers["wrapper.h"])
for v in gbl:
file.write("void " + ''.join(v) + "(x86emu_t *emu, uintptr_t fnc);\n")
for v in redirects:
file.write("void " + ''.join(v) + "(x86emu_t *emu, uintptr_t fnc);\n")
file.write(files_guards["wrapper.h"])
# E e v c w i I C W u U f d D K l L p V O S 2 P G N M
tdtypes = ["x86emu_t*", "x86emu_t**", "void", "int8_t", "int16_t", "int32_t", "int64_t", "uint8_t", "uint16_t", "uint32_t", "uint64_t", "float", "double", "long double", "double", "intptr_t", "uintptr_t", "void*", "void*", "int32_t", "void*", "_2uint_struct_t", "void*", "void*", "...", "..."]
if len(values) != len(tdtypes):
raise NotImplementedError("len(values) = {lenval} != len(tdtypes) = {lentypes}".format(lenval=len(values), lentypes=len(tdtypes)))
def generate_typedefs(arr, file):
for v in arr:
file.write("typedef " + tdtypes[values.index(v[0])] + " (*" + v + "_t)"
+ "(" + ', '.join(tdtypes[values.index(t)] for t in v[2:]) + ");\n")
# Rewrite the wrapper.c file:
with open(os.path.join(root, "src", "wrapper.c"), 'w') as file:
file.write(files_headers["wrapper.c"])
with open(os.path.join(root, "src", "wrapped", "generated", "wrapper.c"), 'w') as file:
file.write(files_header["wrapper.c"].format(lbr="{", rbr="}", version=ver))
# First part: typedefs
for v in gbl:
# E e v c w i I C W u U f d D L p V
types = ["x86emu_t*", "x86emu_t**", "void", "int8_t", "int16_t", "int32_t", "int64_t", "uint8_t", "uint16_t", "uint32_t", "uint64_t", "float", "double", "long double", "double", "void*", "void*"]
if len(values) != len(types):
raise NotImplementedError("len(values) = {lenval} != len(types) = {lentypes}".format(lenval=len(values), lentypes=len(types)))
file.write("typedef " + types[values.index(v[0])] + " (*" + ''.join(v) + "_t)"
+ "(" + ', '.join(types[values.index(t)] for t in v[2:]) + ");\n")
generate_typedefs(gbl["()"], file)
for k in gbl_idxs:
file.write("\n#if " + k + "\n")
generate_typedefs(gbl[k], file)
file.write("#endif\n")
file.write("\n")
# Next part: function definitions
# Helper variables
arg = [
"emu, ", # E
"&emu, ", # e
"", # v
"*(int8_t*)(R_ESP + {p}), ", # c
"*(int16_t*)(R_ESP + {p}), ", # w
"*(int32_t*)(R_ESP + {p}), ", # i
"*(int64_t*)(R_ESP + {p}), ", # I
"*(uint8_t*)(R_ESP + {p}), ", # C
"*(uint16_t*)(R_ESP + {p}), ", # W
"*(uint32_t*)(R_ESP + {p}), ", # u
"*(uint64_t*)(R_ESP + {p}), ", # U
"*(float*)(R_ESP + {p}), ", # f
"*(double*)(R_ESP + {p}), ", # d
"LD2localLD((void*)(R_ESP + {p})), ", # D
"FromLD((void*)(R_ESP + {p})), ", # K
"*(intptr_t*)(R_ESP + {p}), ", # l
"*(uintptr_t*)(R_ESP + {p}), ", # L
"*(void**)(R_ESP + {p}), ", # p
"(void*)(R_ESP + {p}), ", # V
"of_convert(*(int32_t*)(R_ESP + {p})), ", # O
"io_convert(*(void**)(R_ESP + {p})), ", # S
"(_2uint_struct_t){{*(uintptr_t*)(R_ESP + {p}),*(uintptr_t*)(R_ESP + {p} + 4)}}, ", # 2
"arg{p}, ", # P
"&arg{p}, ", # G
"*(void**)(R_ESP + {p}), ", # N
"*(void**)(R_ESP + {p}),*(void**)(R_ESP + {p} + 4), ", # M
]
# E e v c w i I C W u U f d D K l L p V O S 2 P G N, M
deltas = [0, 0, 4, 4, 4, 4, 8, 4, 4, 4, 8, 4, 8, 12, 12, 4, 4, 4, 0, 4, 4, 8, 4, 4, 0, 0]
vals = [
"\n#error Invalid return type: emulator\n", # E
"\n#error Invalid return type: &emulator\n", # e
"fn({0});", # v
"R_EAX=fn({0});", # c
"R_EAX=fn({0});", # w
"R_EAX=fn({0});", # i
"ui64_t r; r.i=fn({0}); R_EAX=r.d[0]; R_EDX=r.d[1];", # I
"R_EAX=(unsigned char)fn({0});", # C
"R_EAX=(unsigned short)fn({0});", # W
"R_EAX=(uint32_t)fn({0});", # u
"ui64_t r; r.u=(uint64_t)fn({0}); R_EAX=r.d[0]; R_EDX=r.d[1];", # U
"float fl=fn({0}); fpu_do_push(emu); ST0val = fl;", # f
"double db=fn({0}); fpu_do_push(emu); ST0val = db;", # d
"long double ld=fn({0}); fpu_do_push(emu); ST0val = ld;", # D
"double db=fn({0}); fpu_do_push(emu); ST0val = db;", # K
"R_EAX=(intptr_t)fn({0});", # l
"R_EAX=(uintptr_t)fn({0});", # L
"R_EAX=(uintptr_t)fn({0});", # p
"\n#error Invalid return type: va_list\n", # V
"\n#error Invalid return type: at_flags\n", # O
"\n#error Invalid return type: _io_file*\n", # S
"\n#error Invalid return type: _2uint_struct\n", # 2
"\n#error Invalid return type: Vulkan Struct\n", # P
"\n#error Invalid return type: GValue Pointer\n", # G
"\n#error Invalid return type: ... with 1 arg\n", # N
"\n#error Invalid return type: ... with 2 args\n", # M
]
# Asserts
if len(values) != len(arg):
raise NotImplementedError("len(values) = {lenval} != len(arg) = {lenarg}".format(lenval=len(values), lenarg=len(arg)))
if len(values) != len(deltas):
raise NotImplementedError("len(values) = {lenval} != len(deltas) = {lendeltas}".format(lenval=len(values), lendeltas=len(deltas)))
if len(values) != len(vals):
raise NotImplementedError("len(values) = {lenval} != len(vals) = {lenvals}".format(lenval=len(values), lenvals=len(vals)))
# Helper functions to write the function definitions
def function_args(args, d=4):
if len(args) == 0:
return ""
if d % 4 != 0:
raise ValueError("{d} is not a multiple of 4. Did you try passing a V and something else?")
raise ValueError("{d} is not a multiple of 4. Did you try passing a V and something else?".format(d=d))
if args[0] == "0":
return "(void*)(R_ESP + {p}), ".format(p=d) + function_args(args[1:], d + 4)
elif args[0] == 1:
elif args[0] == "1":
return "1, " + function_args(args[1:], d)
arg = [
"emu, ", # E
"&emu, ", # e
"", # v
"*(int8_t*)(R_ESP + {p}), ", # c
"*(int16_t*)(R_ESP + {p}), ", # w
"*(int32_t*)(R_ESP + {p}), ", # i
"*(int64_t*)(R_ESP + {p}), ", # I
"*(uint8_t*)(R_ESP + {p}), ", # C
"*(uint16_t*)(R_ESP + {p}), ", # W
"*(uint32_t*)(R_ESP + {p}), ", # u
"*(uint64_t*)(R_ESP + {p}), ", # U
"*(float*)(R_ESP + {p}), ", # f
"*(double*)(R_ESP + {p}), ", # d
"*(long double*)(R_ESP + {p}), ", # D
"FromLD((void*)(R_ESP + {p})), ", # L
"*(void**)(R_ESP + {p}), ", # p
"(void*)(R_ESP + {p}), " # V
]
# E e v c w i I C W u U f d D L p V
deltas = [0, 0, 4, 4, 4, 4, 8, 4, 4, 4, 8, 4, 8, 12, 12, 4, 0]
if len(values) != len(arg):
raise NotImplementedError("len(values) = {lenval} != len(arg) = {lenarg}".format(lenval=len(values), lenarg=len(arg)))
if len(values) != len(deltas):
raise NotImplementedError("len(values) = {lenval} != len(deltas) = {lendeltas}".format(lenval=len(values), lendeltas=len(deltas)))
return arg[values.index(args[0])].format(p=d) + function_args(args[1:], d + deltas[values.index(args[0])])
def function_writer(f, N, W, rettype, args):
f.write("void {0}(x86emu_t *emu, uintptr_t fcn) {2} {1} fn = ({1})fcn; ".format(N, W, "{"))
vals = [
"\n#error Invalid return type: emulator\n", # E
"\n#error Invalid return type: &emulator\n", # e
"fn({0});", # v
"R_EAX=fn({0});", # c
"R_EAX=fn({0});", # w
"R_EAX=fn({0});", # i
"ui64_t r; r.i=fn({0}); R_EAX=r.d[0]; R_EDX=r.d[1];", # I
"R_EAX=(unsigned char)fn({0});", # C
"R_EAX=(unsigned short)fn({0});", # W
"R_EAX=(uint32_t)fn({0});", # u
"ui64_t r; r.u=(uint64_t)fn({0}); R_EAX=r.d[0]; R_EDX=r.d[1];", # U
"float fl=fn({0}); fpu_do_push(emu); ST0.d = fl;", # f
"double db=fn({0}); fpu_do_push(emu); ST0.d = db;", # d
"long double ld=fn({0}); fpu_do_push(emu); ST0.d = ld;", # D
"double db=fn({0}); fpu_do_push(emu); ST0.d = db;", # L
"R_EAX=(uintptr_t)fn({0});", # p
"\n#error Invalid return type: va_list\n", # V
]
if len(values) != len(vals):
raise NotImplementedError("len(values) = {lenval} != len(vals) = {lenvals}".format(lenval=len(values), lenvals=len(vals)))
f.write(vals[values.index(rettype)].format(function_args(args)[:-2]) + " }\n")
if any(cc in 'PG' for cc in args):
# Vulkan struct or GValue pointer, need to unwrap functions at the end
delta = 4
for c in args:
if c == 'P':
f.write("void* save{d}=NULL; void *arg{d} = VulkanFromx86(*(void**)(R_ESP + {d}), &save{d}); ".format(d=delta))
if c == 'G':
f.write("my_GValue_t arg{d}; alignGValue(&arg{d}, *(void**)(R_ESP + {d})); ".format(d=delta))
delta = delta + deltas[values.index(c)]
f.write(vals[values.index(rettype)].format(function_args(args)[:-2]) + " ")
delta = 4
for c in args:
if c == 'P':
f.write("VulkanTox86(arg{d}, save{d}); ".format(d=delta))
if c == 'G':
f.write("unalignGValue(*(void**)(R_ESP + {d}), &arg{d}); ".format(d=delta))
delta = delta + deltas[values.index(c)]
f.write("}\n")
else:
# Generic function
f.write(vals[values.index(rettype)].format(function_args(args)[:-2]) + " }\n")
for v in gbl:
function_writer(file, ''.join(v), ''.join(v) + "_t", v[0], v[2:])
for v in redirects:
function_writer(file, v, redirects[v] + "_t", v[0], v[2:])
for v in gbl["()"]:
function_writer(file, v, v + "_t", v[0], v[2:])
for k in gbl_idxs:
file.write("\n#if " + k + "\n")
for v in gbl[k]:
function_writer(file, v, v + "_t", v[0], v[2:])
file.write("#endif\n")
file.write("\n")
for v in redirects["()"]:
function_writer(file, v[0], v[1] + "_t", v[0][0], v[0][2:])
for k in redirects_idxs:
file.write("\n#if " + k + "\n")
for v in redirects[k]:
function_writer(file, v[0], v[1] + "_t", v[0][0], v[0][2:])
file.write("#endif\n")
file.write(files_guards["wrapper.c"])
file.write(files_guard["wrapper.c"].format(lbr="{", rbr="}", version=ver))
# Rewrite the wrapper.h file:
with open(os.path.join(root, "src", "wrapped", "generated", "wrapper.h"), 'w') as file:
file.write(files_header["wrapper.h"].format(lbr="{", rbr="}", version=ver))
for v in gbl["()"]:
file.write("void " + v + "(x86emu_t *emu, uintptr_t fnc);\n")
for k in gbl_idxs:
file.write("\n#if " + k + "\n")
for v in gbl[k]:
file.write("void " + v + "(x86emu_t *emu, uintptr_t fnc);\n")
file.write("#endif\n")
file.write("\n")
for v in redirects["()"]:
file.write("void " + v[0] + "(x86emu_t *emu, uintptr_t fnc);\n")
for k in redirects_idxs:
file.write("\n#if " + k + "\n")
for v in redirects[k]:
file.write("void " + v[0] + "(x86emu_t *emu, uintptr_t fnc);\n")
file.write("#endif\n")
file.write(files_guard["wrapper.h"].format(lbr="{", rbr="}", version=ver))
for fn in mytypedefs:
with open(os.path.join(root, "src", "wrapped", "generated", fn + "types.h"), 'w') as file:
file.write(files_header["fntypes.h"].format(lbr="{", rbr="}", version=ver, filename=fn))
if fn in mystructs:
values = values + mystructs_vals[fn]
tdtypes = tdtypes + [mystructs[fn][k] for k in mystructs_vals[fn]]
generate_typedefs(mytypedefs_vals[fn], file)
if fn in mystructs:
values = values[:-len(mystructs_vals[fn])]
tdtypes = tdtypes[:-len(mystructs_vals[fn])]
file.write("\n#define SUPER() ADDED_FUNCTIONS()")
for v in mytypedefs_vals[fn]:
for t, f in mytypedefs[fn][v]:
assert(t in [0, 1, 2, 3])
file.write(" \\\n\tGO({0}, {1}_t)".format(f, v))
file.write("\n")
file.write(files_guard["fntypes.h"].format(lbr="{", rbr="}", version=ver, filename=fn))
# Save the string for the next iteration, writing was successful
with open(os.path.join(root, "src", "wrapped", "generated", "functions_list.txt"), 'w') as file:
file.write(functions_list)
return 0
if __name__ == '__main__':
if main(sys.argv[1]) != 0:
limit = []
for i, v in enumerate(sys.argv):
if v == "--":
limit.append(i)
if main(sys.argv[1], sys.argv[2:limit[0]], sys.argv[limit[0]+1:], "1.2.0.09") != 0:
exit(2)
exit(0)
+16 -1
View File
@@ -13,6 +13,15 @@ if( NOT TEST_REFERENCE )
endif( NOT TEST_REFERENCE )
set(ENV{BOX86_LOG} 0)
set(ENV{BOX86_NOBANNER} 1)
if( EXISTS ${CMAKE_SOURCE_DIR}/x86lib )
# we are inside box86 folder
set(ENV{LD_LIBRARY_PATH} ${CMAKE_SOURCE_DIR}/x86lib)
else()
# we are inside build folder
set(ENV{LD_LIBRARY_PATH} ${CMAKE_SOURCE_DIR}/../x86lib)
endif( EXISTS ${CMAKE_SOURCE_DIR}/x86lib )
# run the test program, capture the stdout/stderr and the result var
execute_process(
COMMAND ${TEST_PROGRAM} ${TEST_ARGS} ${TEST_ARGS2}
@@ -23,17 +32,23 @@ execute_process(
# if the return value is !=0 bail out
if( TEST_RESULT )
get_filename_component(TESTNAME "${TEST_ARGS}" NAME)
file(RENAME "${TEST_OUTPUT}" "${CMAKE_BINARY_DIR}/${TESTNAME}.out")
file(WRITE "${CMAKE_BINARY_DIR}/${TESTNAME}.err" ${TEST_ERROR})
message( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}" )
endif( TEST_RESULT )
# now compare the output with the reference
execute_process(
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT} ${TEST_REFERENCE}
COMMAND "${CMAKE_COMMAND}" -E compare_files "${TEST_OUTPUT}" "${TEST_REFERENCE}"
RESULT_VARIABLE TEST_RESULT
)
# again, if return value is !=0 scream and shout
if( TEST_RESULT )
get_filename_component(TESTNAME "${TEST_ARGS}" NAME)
file(RENAME "${TEST_OUTPUT}" "${CMAKE_BINARY_DIR}/${TESTNAME}.out")
file(WRITE "${CMAKE_BINARY_DIR}/${TESTNAME}.err" ${TEST_ERROR})
message( FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
endif( TEST_RESULT )
+278 -47
View File
@@ -1,8 +1,9 @@
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include <signal.h>
#include "box86context.h"
#include "elfloader.h"
@@ -13,89 +14,303 @@
#include "bridge.h"
#include "library.h"
#include "callback.h"
#include "wrapper.h"
#include "myfts.h"
#include "threads.h"
#include "x86trace.h"
#include "signals.h"
#include <sys/mman.h>
#include "custommem.h"
#ifdef DYNAREC
#include "dynablock.h"
#include "dynarec/arm_lock_helper.h"
#endif
EXPORTDYN
void initAllHelpers(box86context_t* context)
{
static int inited = 0;
if(inited)
return;
my_context = context;
init_pthread_helper();
init_signal_helper(context);
inited = 1;
}
EXPORTDYN
void finiAllHelpers(box86context_t* context)
{
static int finied = 0;
if(finied)
return;
fini_pthread_helper(context);
fini_signal_helper();
cleanAlternate();
fini_custommem_helper(context);
finied = 1;
}
void x86Syscall(x86emu_t *emu);
/// maxval not inclusive
int getrand(int maxval)
{
if(maxval<1024) {
return ((random()&0x7fff)*maxval)/0x7fff;
}
uint64_t r = random();
r = (r*maxval) / RAND_MAX;
return r;
}
void free_tlsdatasize(void* p)
{
if(!p)
return;
tlsdatasize_t *data = (tlsdatasize_t*)p;
free(data->tlsdata);
free(p);
}
int unlockMutex()
{
int ret = unlockCustommemMutex();
int i;
#define GO(A, B) \
i = checkUnlockMutex(&A); \
if(i) { \
ret|=(1<<B); \
}
GO(my_context->mutex_once, 5)
GO(my_context->mutex_once2, 6)
GO(my_context->mutex_trace, 7)
#ifdef DYNAREC
GO(my_context->mutex_dyndump, 8)
#else
GO(my_context->mutex_lock, 8)
#endif
GO(my_context->mutex_tls, 9)
GO(my_context->mutex_thread, 10)
#undef GO
return ret;
}
void relockMutex(int locks)
{
relockCustommemMutex(locks);
#define GO(A, B) \
if(locks&(1<<B)) \
pthread_mutex_lock(&A); \
GO(my_context->mutex_once, 5)
GO(my_context->mutex_once2, 6)
GO(my_context->mutex_trace, 7)
#ifdef DYNAREC
GO(my_context->mutex_dyndump, 8)
#else
GO(my_context->mutex_lock, 8)
#endif
GO(my_context->mutex_tls, 9)
GO(my_context->mutex_thread, 10)
#undef GO
}
static void init_mutexes(box86context_t* context)
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
pthread_mutex_init(&context->mutex_once, &attr);
pthread_mutex_init(&context->mutex_once2, &attr);
pthread_mutex_init(&context->mutex_trace, &attr);
#ifndef DYNAREC
pthread_mutex_init(&context->mutex_lock, &attr);
#else
pthread_mutex_init(&context->mutex_dyndump, &attr);
#endif
pthread_mutex_init(&context->mutex_tls, &attr);
pthread_mutex_init(&context->mutex_thread, &attr);
pthread_mutexattr_destroy(&attr);
}
static void atfork_child_box64context(void)
{
// (re)init mutex if it was lock before the fork
init_mutexes(my_context);
}
EXPORTDYN
box86context_t *NewBox86Context(int argc)
{
#ifdef BUILD_DYNAMIC
if(my_context) {
++my_context->count;
return my_context;
}
#endif
// init and put default values
box86context_t *context = (box86context_t*)calloc(1, sizeof(box86context_t));
box86context_t *context = my_context = (box86context_t*)calloc(1, sizeof(box86context_t));
#ifdef BUILD_LIB
context->deferedInit = 0;
#else
context->deferedInit = 1;
#endif
context->sel_serial = 1;
context->maplib = NewLibrarian();
init_custommem_helper(context);
context->maplib = NewLibrarian(context, 1);
context->local_maplib = NewLibrarian(context, 1);
context->system = NewBridge();
// create vsyscall
context->vsyscall = AddBridge(context->system, vFv, x86Syscall);
context->vsyscall = AddBridge(context->system, vFv, x86Syscall, 0);
#ifdef BUILD_LIB
context->box86lib = RTLD_DEFAULT; // not ideal
#else
context->box86lib = dlopen(NULL, RTLD_NOW|RTLD_GLOBAL);
#endif
context->dlprivate = NewDLPrivate();
context->callbacks = NewCallbackList();
context->argc = argc;
context->argv = (char**)calloc(context->argc, sizeof(char*));
context->argv = (char**)calloc(context->argc+1, sizeof(char*));
pthread_mutex_init(&context->mutex_once, NULL);
init_mutexes(context);
pthread_atfork(NULL, NULL, atfork_child_box64context);
pthread_key_create(&context->tlskey, free_tlsdatasize);
InitFTSMap(context);
for (int i=0; i<4; ++i) context->canary[i] = 1 + getrand(255);
context->canary[/*getrand(4)*/0] = 0;
printf_log(LOG_DEBUG, "Setting up canary (for Stack protector) at GS:0x14, value:%08X\n", *(uint32_t*)context->canary);
initAllHelpers(context);
return context;
}
EXPORTDYN
void FreeBox86Context(box86context_t** context)
{
#ifdef BUILD_DYNAMIC
if(--(*context)->count)
return;
#endif
if(!context)
return;
if(--(*context)->forked >= 0)
return;
if((*context)->emu)
FreeX86Emu(&(*context)->emu);
box86context_t* ctx = *context; // local copy to do the cleanning
FreeCollection(&(*context)->box86_path);
FreeCollection(&(*context)->box86_ld_lib);
if((*context)->zydis)
DeleteX86Trace(*context);
if(ctx->local_maplib)
FreeLibrarian(&ctx->local_maplib, NULL);
if(ctx->maplib)
FreeLibrarian(&ctx->maplib, NULL);
if((*context)->deferedInitList)
free((*context)->deferedInitList);
if((*context)->box86lib)
dlclose((*context)->box86lib);
FreeDLPrivate(&(*context)->dlprivate);
if((*context)->maplib)
FreeLibrarian(&(*context)->maplib);
for(int i=0; i<(*context)->argc; ++i)
free((*context)->argv[i]);
free((*context)->argv);
for (int i=0; i<(*context)->envc; ++i)
free((*context)->envv[i]);
free((*context)->envv);
for(int i=0; i<(*context)->elfsize; ++i) {
FreeElfHeader(&(*context)->elfs[i]);
for(int i=0; i<ctx->elfsize; ++i) {
FreeElfHeader(&ctx->elfs[i]);
}
free((*context)->elfs);
free(ctx->elfs);
free((*context)->stack);
FreeFTSMap(ctx);
FreeBridge(&(*context)->system);
FreeCollection(&ctx->box86_path);
FreeCollection(&ctx->box86_ld_lib);
FreeCollection(&ctx->box86_emulated_libs);
// stop trace now
if(ctx->dec)
DeleteX86TraceDecoder(&ctx->dec);
if(ctx->zydis)
DeleteX86Trace(ctx);
if((*context)->glwrappers)
freeProcWrapper(&(*context)->glwrappers);
if((*context)->alwrappers)
freeProcWrapper(&(*context)->alwrappers);
if(ctx->deferedInitList)
free(ctx->deferedInitList);
FreeCallbackList(&(*context)->callbacks);
free(ctx->argv);
for (int i=0; i<ctx->envc; ++i)
free(ctx->envv[i]);
free(ctx->envv);
pthread_mutex_destroy(&(*context)->mutex_once);
if(ctx->atfork_sz) {
free(ctx->atforks);
ctx->atforks = NULL;
ctx->atfork_sz = ctx->atfork_cap = 0;
}
free(*context);
*context = NULL;
for(int i=0; i<MAX_SIGNAL; ++i)
if(ctx->signals[i]!=0 && ctx->signals[i]!=1) {
signal(i, SIG_DFL);
}
*context = NULL; // bye bye my_context
CleanStackSize(ctx);
#ifndef BUILD_LIB
if(ctx->box86lib)
dlclose(ctx->box86lib);
#endif
FreeDLPrivate(&ctx->dlprivate);
// free(ctx->stack); // don't free the stack, it's owned by main emu!
free(ctx->fullpath);
free(ctx->box86path);
FreeBridge(&ctx->system);
freeGLProcWrapper(ctx);
freeALProcWrapper(ctx);
void* ptr;
if ((ptr = pthread_getspecific(ctx->tlskey)) != NULL) {
free_tlsdatasize(ptr);
pthread_setspecific(ctx->tlskey, NULL);
}
pthread_key_delete(ctx->tlskey);
if(ctx->tlsdata)
free(ctx->tlsdata);
for(int i=0; i<3; ++i) {
if(ctx->segtls[i].present) {
// key content not handled by box86, so not doing anything with it
pthread_key_delete(ctx->segtls[i].key);
}
}
pthread_mutex_destroy(&ctx->mutex_once);
pthread_mutex_destroy(&ctx->mutex_once2);
pthread_mutex_destroy(&ctx->mutex_trace);
#ifndef DYNAREC
pthread_mutex_destroy(&ctx->mutex_lock);
#else
pthread_mutex_destroy(&ctx->mutex_dyndump);
#endif
pthread_mutex_destroy(&ctx->mutex_tls);
pthread_mutex_destroy(&ctx->mutex_thread);
free_neededlib(&ctx->neededlibs);
if(ctx->emu_sig)
FreeX86Emu(&ctx->emu_sig);
finiAllHelpers(ctx);
free(ctx);
}
int AddElfHeader(box86context_t* ctx, elfheader_t* head) {
@@ -110,3 +325,19 @@ int AddElfHeader(box86context_t* ctx, elfheader_t* head) {
printf_log(LOG_DEBUG, "Adding \"%s\" as #%d in elf collection\n", ElfName(head), idx);
return idx;
}
int AddTLSPartition(box86context_t* context, int tlssize) {
int oldsize = context->tlssize;
context->tlssize += tlssize;
context->tlsdata = realloc(context->tlsdata, context->tlssize);
memmove(context->tlsdata+tlssize, context->tlsdata, oldsize); // move to the top, using memmove as regions will probably overlap
memset(context->tlsdata, 0, tlssize); // fill new space with 0 (not mandatory)
// clean GS segment for current emu
if(my_context) {
ResetSegmentsCache(thread_get_emu());
if(!(++context->sel_serial))
++context->sel_serial;
}
return -context->tlssize; // negative offset
}
-83
View File
@@ -1,83 +0,0 @@
#ifndef __BOX86CONTEXT_H_
#define __BOX86CONTEXT_H_
#include <stdint.h>
#include <pthread.h>
#include "pathcoll.h"
typedef struct elfheader_s elfheader_t;
typedef struct x86emu_s x86emu_t;
typedef struct zydis_s zydis_t;
typedef struct lib_s lib_t;
typedef struct bridge_s bridge_t;
typedef struct dlprivate_s dlprivate_t;
typedef struct kh_symbolmap_s kh_symbolmap_t;
typedef struct callbacklist_s callbacklist_t;
typedef struct library_s library_t;
typedef void* (*procaddess_t)(const char* name);
typedef struct box86context_s {
path_collection_t box86_path; // PATH env. variable
path_collection_t box86_ld_lib; // LD_LIBRARY_PATH env. variable
int x86trace;
zydis_t *zydis; // dlopen the zydis dissasembler
void* box86lib; // dlopen on box86 itself
int argc;
char** argv;
int envc;
char** envv;
char* fullpath;
uint32_t stacksz;
int stackalign;
void* stack; // alocated stack
elfheader_t **elfs; // elf headers and memory
int elfcap;
int elfsize; // number of elf loaded
uintptr_t ep; // entry point
x86emu_t *emu; // CPU / FPU / MMX&SSE regs
lib_t *maplib; // lib and symbols handling
bridge_t *threads; // threads
bridge_t *system; // other bridges
uintptr_t vsyscall; // vsyscall bridge value
dlprivate_t *dlprivate; // dlopen library map
kh_symbolmap_t *glwrappers; // the map of wrapper for glProcs (for GLX or SDL1/2)
procaddess_t glxprocaddress;
kh_symbolmap_t *alwrappers; // the map of wrapper for alGetProcAddress
callbacklist_t *callbacks; // all callbacks
pthread_mutex_t mutex_once;
library_t *libclib; // shortcut to libc library (if loaded, so probably yes)
library_t *sdl1lib; // shortcut to SDL1 library (if loaded)
library_t *sdl1mixerlib;
library_t *sdl1imagelib;
library_t *sdl2lib; // shortcut to SDL2 library (if loaded)
library_t *sdl2mixerlib;
library_t *sdl2imagelib;
int deferedInit;
elfheader_t **deferedInitList;
int deferedInitSz;
int deferedInitCap;
int forked; // how many forks... cleanup only when < 0
} box86context_t;
box86context_t *NewBox86Context(int argc);
void FreeBox86Context(box86context_t** context);
int AddElfHeader(box86context_t* ctx, elfheader_t* head); // return the index of header
#endif //__BOX86CONTEXT_H_
+1 -1
View File
@@ -2,7 +2,7 @@
#define __BOX86_VERSION_H_
#define BOX86_MAJOR 0
#define BOX86_MINOR 0
#define BOX86_MINOR 2
#define BOX86_REVISION 2
#endif //__BOX86_VERSION_H_
-85
View File
@@ -1,85 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "bridge.h"
#include "bridge_private.h"
#include "wrapper.h"
#include "khash.h"
KHASH_MAP_INIT_INT(bridgemap, uintptr_t)
#define NBRICK 16
typedef struct brick_s brick_t;
typedef struct brick_s {
onebridge_t b[NBRICK];
int sz;
brick_t *next;
} brick_t;
typedef struct bridge_s {
brick_t *head;
brick_t *last; // to speed up
kh_bridgemap_t *bridgemap;
} bridge_t;
bridge_t *NewBridge()
{
bridge_t *b = (bridge_t*)calloc(1, sizeof(bridge_t));
b->head = (brick_t*)calloc(1, sizeof(brick_t));
b->last = b->head;
b->bridgemap = kh_init(bridgemap);
return b;
}
void FreeBridge(bridge_t** bridge)
{
brick_t *b = (*bridge)->head;
while(b) {
brick_t *n = b->next;
free(b);
b = n;
}
kh_destroy(bridgemap, (*bridge)->bridgemap);
free(*bridge);
*bridge = NULL;
}
uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc)
{
brick_t *b = bridge->last;
if(b->sz == NBRICK) {
b->next = (brick_t*)calloc(1, sizeof(brick_t));
b = b->next;
bridge->head = b;
}
b->b[b->sz].CC = 0xCC;
b->b[b->sz].S = 'S'; b->b[b->sz].C='C';
b->b[b->sz].w = w;
b->b[b->sz].f = (uintptr_t)fnc;
b->b[b->sz].C3 = 0xC3;
// add bridge to map, for fast recovery
int ret;
khint_t k = kh_put(bridgemap, bridge->bridgemap, (uintptr_t)fnc, &ret);
kh_value(bridge->bridgemap, k) = (uintptr_t)&b->b[b->sz].CC;
return (uintptr_t)&b->b[b->sz++].CC;
}
uintptr_t CheckBridged(bridge_t* bridge, void* fnc)
{
// check if function alread have a bridge (the function wrapper will not be tested)
khint_t k = kh_get(bridgemap, bridge->bridgemap, (uint32_t)fnc);
if(k==kh_end(bridge->bridgemap))
return 0;
return kh_value(bridge->bridgemap, k);
}
void* GetNativeFnc(uintptr_t fnc)
{
onebridge_t *b = (onebridge_t*)fnc;
if(b->CC != 0xCC || b->S!='S' || b->C!='C' || b->C3!=0xC3)
return NULL; // not a bridge?!
return (void*)b->f;
}
-17
View File
@@ -1,17 +0,0 @@
#ifndef __BRIDGE_H_
#define __BRIDGE_H_
#include <stdint.h>
#include "wrapper.h"
typedef struct x86emu_s x86emu_t;
typedef struct bridge_s bridge_t;
bridge_t *NewBridge();
void FreeBridge(bridge_t** bridge);
uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc);
uintptr_t CheckBridged(bridge_t* bridge, void* fnc);
void* GetNativeFnc(uintptr_t fnc);
#endif //__BRIDGE_H_
+27
View File
@@ -0,0 +1,27 @@
#include <stdio.h>
#include "debug.h"
#include "box86version.h"
#ifdef NOGIT
#define GITREV "nogit"
#else
#include "git_head.h"
#endif
void PrintBox86Version()
{
printf("Box86%s%s v%d.%d.%d %s built on %s %s\n",
#ifdef HAVE_TRACE
" with trace",
#else
"",
#endif
#ifdef DYNAREC
" with Dynarec",
#else
"",
#endif
BOX86_MAJOR, BOX86_MINOR, BOX86_REVISION,
GITREV,
__DATE__, __TIME__);
}
+6
View File
@@ -0,0 +1,6 @@
#ifndef __BUILD_INFO_H__
#define __BUILD_INFO_H__
void PrintBox86Version();
#endif //__BUILD_INFO_H__
-134
View File
@@ -1,134 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "debug.h"
#include "x86emu.h"
#include "x86run.h"
#include "x86emu_private.h"
#include "x86run_private.h"
#include "box86context.h"
#include "stack.h"
#include "khash.h"
typedef struct onecallback_s {
x86emu_t *emu;
uintptr_t fnc;
int nb_args;
void* arg[8];
void* stack;
} onecallback_t;
KHASH_MAP_INIT_INT(callbacks, onecallback_t*)
typedef struct callbacklist_s {
kh_callbacks_t *list;
int cap;
int sz;
} callbacklist_t;
x86emu_t* AddCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4)
{
callbacklist_t *callbacks = emu->context->callbacks;
int stsize = 1024*1024;
void* stack = malloc(stsize);
x86emu_t * newemu = NewX86Emu(emu->context, fnc, (uintptr_t)stack, stsize);
SetupX86Emu(newemu, emu->shared_global, emu->globals);
newemu->trace_start = emu->trace_start;
newemu->trace_end = emu->trace_end;
onecallback_t * cb;
int ret;
khint_t k = kh_put(callbacks, callbacks->list, (uintptr_t)newemu, &ret);
cb = kh_value(callbacks->list, k) = (onecallback_t*)calloc(1, sizeof(onecallback_t));
cb->stack = stack;
cb->emu = newemu;
cb->fnc = fnc;
cb->nb_args = nb_args;
cb->arg[0] = arg1;
cb->arg[1] = arg2;
cb->arg[2] = arg3;
cb->arg[3] = arg4;
return newemu;
}
onecallback_t* FindCallback(x86emu_t* emu)
{
// find the callback first
callbacklist_t *callbacks = emu->context->callbacks;
khint_t k = kh_get(callbacks, callbacks->list, (uintptr_t)emu);
if(k==kh_end(callbacks->list))
return NULL;
return kh_value(callbacks->list, k);
}
void FreeCallback(x86emu_t* emu)
{
// find the callback first
callbacklist_t *callbacks = emu->context->callbacks;
khint_t k = kh_get(callbacks, callbacks->list, (uintptr_t)emu);
if(k==kh_end(callbacks->list))
return;
onecallback_t* cb = kh_value(callbacks->list, k);
FreeX86Emu(&cb->emu);
free(cb->stack);
free(cb);
kh_del(callbacks, callbacks->list, k);
}
uint32_t RunCallback(x86emu_t* emu)
{
onecallback_t *cb = FindCallback(emu);
if(cb) {
for (int i=cb->nb_args-1; i>=0; --i) // reverse order
Push(emu, (uint32_t)cb->arg[i]);
EmuCall(emu, cb->fnc);
return R_EAX;
}
printf_log(LOG_INFO, "Warning, Callback not found?!\n");
return 0;
}
void SetCallbackArg(x86emu_t* emu, int arg, void* val)
{
onecallback_t *cb = FindCallback(emu);
if(cb) {
cb->arg[arg] = val;
}
}
void SetCallbackNArg(x86emu_t* emu, int narg)
{
onecallback_t *cb = FindCallback(emu);
if(cb) {
cb->nb_args = narg;
}
}
callbacklist_t* NewCallbackList()
{
callbacklist_t* callbacks = (callbacklist_t*)calloc(1, sizeof(callbacklist_t));
callbacks->list = kh_init(callbacks);
return callbacks;
}
void FreeCallbackList(callbacklist_t** callbacks)
{
if(!callbacks)
return;
if(!*callbacks)
return;
onecallback_t* cb;
kh_foreach_value((*callbacks)->list, cb,
FreeX86Emu(&cb->emu);
free(cb->stack);
free(cb);
);
kh_destroy(callbacks, (*callbacks)->list);
free(*callbacks);
*callbacks = NULL;
}
-18
View File
@@ -1,18 +0,0 @@
#ifndef __CALLBACK_H__
#define __CALLBACK_H__
#include <stdint.h>
typedef struct callbacklist_s callbacklist_t;
typedef struct x86emu_s x86emu_t;
callbacklist_t* NewCallbackList();
void FreeCallbackList(callbacklist_t** callbacks);
x86emu_t* AddCallback(x86emu_t* emu, uintptr_t fnc, int nb_args, void* arg1, void* arg2, void* arg3, void* arg4);
void FreeCallback(x86emu_t* emu);
uint32_t RunCallback(x86emu_t* emu);
void SetCallbackArg(x86emu_t* emu, int arg, void* val);
void SetCallbackNArg(x86emu_t* emu, int narg);
#endif //__CALLBACK_H__
+774
View File
@@ -0,0 +1,774 @@
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <signal.h>
#include "box86context.h"
#include "elfloader.h"
#include "debug.h"
#include "x86trace.h"
#include "x86emu.h"
#include "librarian.h"
#include "bridge.h"
#include "library.h"
#include "callback.h"
#include "wrapper.h"
#include "myfts.h"
#include "threads.h"
#include "x86trace.h"
#include "signals.h"
#include <sys/mman.h>
#include "custommem.h"
#include "threads.h"
#ifdef DYNAREC
#include "dynablock.h"
#include "dynarec/arm_lock_helper.h"
#include "khash.h"
#define USE_MMAP
// init inside dynablocks.c
KHASH_MAP_INIT_INT(dynablocks, dynablock_t*)
static dynablocklist_t* dynmap[DYNAMAP_SIZE]; // 4G of memory mapped by 4K block
static pthread_mutex_t mutex_mmap;
static mmaplist_t *mmaplist;
static int mmapsize;
static kh_dynablocks_t *dblist_oversized; // store the list of oversized dynablocks (normal sized are inside mmaplist)
static uintptr_t *box86_jumptable[JMPTABL_SIZE];
static uintptr_t box86_jmptbl_default[1<<JMPTABL_SHIFT];
#endif
#define MEMPROT_SHIFT 12
#define MEMPROT_SIZE (1<<(32-MEMPROT_SHIFT))
static uint8_t memprot[MEMPROT_SIZE] = {0}; // protection flags by 4K block
static int inited = 0;
typedef struct blocklist_s {
void* block;
int maxfree;
size_t size;
} blocklist_t;
#define MMAPSIZE (256*1024) // allocate 256kb sized blocks
static pthread_mutex_t mutex_blocks;
static int n_blocks = 0; // number of blocks for custom malloc
static blocklist_t* p_blocks = NULL; // actual blocks for custom malloc
typedef union mark_s {
struct {
unsigned int fill:1;
unsigned int size:31;
};
uint32_t x32;
} mark_t;
typedef struct blockmark_s {
mark_t prev;
mark_t next;
} blockmark_t;
// get first subblock free in block. Return NULL if no block, else first subblock free (mark included), filling size
static void* getFirstBlock(void* block, int maxsize, int* size)
{
// get start of block
blockmark_t *m = (blockmark_t*)block;
while(m->next.x32) { // while there is a subblock
if(!m->next.fill && m->next.size>=maxsize+sizeof(blockmark_t)) {
*size = m->next.size-sizeof(blockmark_t);
return m;
}
m = (blockmark_t*)((uintptr_t)m + m->next.size);
}
return NULL;
}
static int getMaxFreeBlock(void* block, size_t block_size)
{
// get start of block
blockmark_t *m = (blockmark_t*)((uintptr_t)block+block_size-sizeof(blockmark_t)); // start with the end
int maxsize = 0;
while(m->prev.x32) { // while there is a subblock
if(!m->prev.fill && m->prev.size>maxsize) {
maxsize = m->prev.size;
if((uintptr_t)block+maxsize>(uintptr_t)m)
return (maxsize>=sizeof(blockmark_t))?(maxsize-sizeof(blockmark_t)):0; // no block large enough left...
}
m = (blockmark_t*)((uintptr_t)m - m->prev.size);
}
return (maxsize>=sizeof(blockmark_t))?(maxsize-sizeof(blockmark_t)):0;
}
static void* allocBlock(void* block, void *sub, int size)
{
blockmark_t *s = (blockmark_t*)sub;
blockmark_t *n = (blockmark_t*)((uintptr_t)s + s->next.size);
s->next.fill = 1;
s->next.size = size+sizeof(blockmark_t);
blockmark_t *m = (blockmark_t*)((uintptr_t)s + s->next.size); // this is new n
m->prev.fill = 1;
m->prev.size = s->next.size;
if(n!=m) {
// new mark
m->prev.fill = 1;
m->prev.size = s->next.size;
m->next.fill = 0;
m->next.size = (uintptr_t)n - (uintptr_t)m;
n->prev.fill = 0;
n->prev.size = m->next.size;
}
return (void*)((uintptr_t)sub + sizeof(blockmark_t));
}
static void freeBlock(void *block, void* sub)
{
blockmark_t *m = (blockmark_t*)block;
blockmark_t *s = (blockmark_t*)sub;
blockmark_t *n = (blockmark_t*)((uintptr_t)s + s->next.size);
if(block!=sub)
m = (blockmark_t*)((uintptr_t)s - s->prev.size);
s->next.fill = 0;
n->prev.fill = 0;
// check if merge with previous
if (s->prev.x32 && !s->prev.fill) {
// remove s...
m->next.size += s->next.size;
n->prev.size = m->next.size;
s = m;
}
// check if merge with next
if(n->next.x32 && !n->next.fill) {
blockmark_t *n2 = (blockmark_t*)((uintptr_t)n + n->next.size);
//remove n
s->next.size += n->next.size;
n2->prev.size = s->next.size;
}
}
// return 1 if block has been expanded to new size, 0 if not
static int expandBlock(void* block, void* sub, int newsize)
{
newsize = (newsize+3)&~3;
blockmark_t *s = (blockmark_t*)sub;
blockmark_t *n = (blockmark_t*)((uintptr_t)s + s->next.size);
if(s->next.fill)
return 0; // next block is filled
if(s->next.size + n->next.size < newsize)
return 0; // free space too short
// ok, doing the alloc!
s->next.size = newsize+sizeof(blockmark_t);
blockmark_t *m = (blockmark_t*)((uintptr_t)s + s->next.size); // this is new n
m->prev.fill = 1;
m->prev.size = s->next.size;
if(n!=m) {
// new mark
m->prev.fill = 1;
m->prev.size = s->next.size;
m->next.fill = 0;
m->next.size = (uintptr_t)n - (uintptr_t)m;
n->prev.fill = 0;
n->prev.size = m->next.size;
}
return 1;
}
// return size of block
static int sizeBlock(void* sub)
{
blockmark_t *s = (blockmark_t*)sub;
return s->next.size;
}
void* customMalloc(size_t size)
{
// look for free space
void* sub = NULL;
pthread_mutex_lock(&mutex_blocks);
for(int i=0; i<n_blocks; ++i) {
if(p_blocks[i].maxfree>=size) {
int rsize = 0;
sub = getFirstBlock(p_blocks[i].block, size, &rsize);
if(sub) {
void* ret = allocBlock(p_blocks[i].block, sub, size);
if(rsize==p_blocks[i].maxfree)
p_blocks[i].maxfree = getMaxFreeBlock(p_blocks[i].block, p_blocks[i].size);
pthread_mutex_unlock(&mutex_blocks);
return ret;
}
}
}
// add a new block
int i = n_blocks++;
p_blocks = (blocklist_t*)realloc(p_blocks, n_blocks*sizeof(blocklist_t));
size_t allocsize = MMAPSIZE;
if(size+2*sizeof(blockmark_t)>allocsize)
allocsize = size+2*sizeof(blockmark_t);
#ifdef USE_MMAP
void* p = mmap(NULL, allocsize, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
memset(p, 0, allocsize);
#else
void* p = calloc(1, allocsize);
#endif
p_blocks[i].block = p;
p_blocks[i].size = allocsize;
// setup marks
blockmark_t* m = (blockmark_t*)p;
m->prev.x32 = 0;
m->next.fill = 0;
m->next.size = allocsize-sizeof(blockmark_t);
m = (blockmark_t*)(p+allocsize-sizeof(blockmark_t));
m->next.x32 = 0;
m->prev.fill = 0;
m->prev.size = allocsize-sizeof(blockmark_t);
// alloc 1st block
void* ret = allocBlock(p_blocks[i].block, p, size);
p_blocks[i].maxfree = getMaxFreeBlock(p_blocks[i].block, p_blocks[i].size);
pthread_mutex_unlock(&mutex_blocks);
return ret;
}
void* customCalloc(size_t n, size_t size)
{
size_t newsize = n*size;
void* ret = customMalloc(newsize);
memset(ret, 0, newsize);
return ret;
}
void* customRealloc(void* p, size_t size)
{
if(!p)
return customMalloc(size);
uintptr_t addr = (uintptr_t)p;
pthread_mutex_lock(&mutex_blocks);
for(int i=0; i<n_blocks; ++i) {
if ((addr>(uintptr_t)p_blocks[i].block)
&& (addr<((uintptr_t)p_blocks[i].block+p_blocks[i].size))) {
void* sub = (void*)(addr-sizeof(blockmark_t));
if(expandBlock(p_blocks[i].block, sub, size)) {
p_blocks[i].maxfree = getMaxFreeBlock(p_blocks[i].block, p_blocks[i].size);
pthread_mutex_unlock(&mutex_blocks);
return p;
}
pthread_mutex_unlock(&mutex_blocks);
void* newp = customMalloc(size);
memcpy(newp, p, sizeBlock(sub));
customFree(p);
return newp;
}
}
pthread_mutex_unlock(&mutex_blocks);
if(n_blocks)
dynarec_log(LOG_NONE, "Warning, block %p not found in p_blocks for Realloc, Malloc'ng again without free\n", (void*)addr);
return customMalloc(size);
}
void customFree(void* p)
{
if(!p)
return;
uintptr_t addr = (uintptr_t)p;
pthread_mutex_lock(&mutex_blocks);
for(int i=0; i<n_blocks; ++i) {
if ((addr>(uintptr_t)p_blocks[i].block)
&& (addr<((uintptr_t)p_blocks[i].block+p_blocks[i].size))) {
void* sub = (void*)(addr-sizeof(blockmark_t));
freeBlock(p_blocks[i].block, sub);
p_blocks[i].maxfree = getMaxFreeBlock(p_blocks[i].block, p_blocks[i].size);
pthread_mutex_unlock(&mutex_blocks);
return;
}
}
pthread_mutex_unlock(&mutex_blocks);
if(n_blocks)
dynarec_log(LOG_NONE, "Warning, block %p not found in p_blocks for Free\n", (void*)addr);
}
#ifdef DYNAREC
typedef struct mmaplist_s {
void* block;
int maxfree;
size_t size;
kh_dynablocks_t* dblist;
uint8_t* helper;
} mmaplist_t;
uintptr_t FindFreeDynarecMap(dynablock_t* db, int size)
{
// look for free space
void* sub = NULL;
for(int i=0; i<mmapsize; ++i) {
if(mmaplist[i].maxfree>=size) {
int rsize = 0;
sub = getFirstBlock(mmaplist[i].block, size, &rsize);
if(sub) {
uintptr_t ret = (uintptr_t)allocBlock(mmaplist[i].block, sub, size);
if(rsize==mmaplist[i].maxfree)
mmaplist[i].maxfree = getMaxFreeBlock(mmaplist[i].block, mmaplist[i].size);
kh_dynablocks_t *blocks = mmaplist[i].dblist;
if(!blocks) {
blocks = mmaplist[i].dblist = kh_init(dynablocks);
kh_resize(dynablocks, blocks, 64);
}
khint_t k;
int r;
k = kh_put(dynablocks, blocks, (uintptr_t)ret, &r);
kh_value(blocks, k) = db;
for(int j=0; j<size; ++j)
mmaplist[i].helper[(uintptr_t)ret-(uintptr_t)mmaplist[i].block+j] = (j<256)?j:255;
return ret;
}
}
}
return 0;
}
uintptr_t AddNewDynarecMap(dynablock_t* db, int size)
{
int i = mmapsize++; // yeah, useful post incrementation
dynarec_log(LOG_DEBUG, "Ask for DynaRec Block Alloc #%d\n", mmapsize);
mmaplist = (mmaplist_t*)realloc(mmaplist, mmapsize*sizeof(mmaplist_t));
#ifndef USE_MMAP
void *p = NULL;
if(posix_memalign(&p, box86_pagesize, MMAPSIZE)) {
dynarec_log(LOG_INFO, "Cannot create memory map of %d byte for dynarec block #%d\n", MMAPSIZE, i);
--mmapsize;
return 0;
}
mprotect(p, MMAPSIZE, PROT_READ | PROT_WRITE | PROT_EXEC);
#else
void* p = mmap(NULL, MMAPSIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if(p==(void*)-1) {
dynarec_log(LOG_INFO, "Cannot create memory map of %d byte for dynarec block #%d\n", MMAPSIZE, i);
--mmapsize;
return 0;
}
#endif
setProtection((uintptr_t)p, MMAPSIZE, PROT_READ | PROT_WRITE | PROT_EXEC);
mmaplist[i].block = p;
mmaplist[i].size = MMAPSIZE;
mmaplist[i].helper = (uint8_t*)calloc(1, MMAPSIZE);
// setup marks
blockmark_t* m = (blockmark_t*)p;
m->prev.x32 = 0;
m->next.fill = 0;
m->next.size = MMAPSIZE-sizeof(blockmark_t);
m = (blockmark_t*)(p+MMAPSIZE-sizeof(blockmark_t));
m->next.x32 = 0;
m->prev.fill = 0;
m->prev.size = MMAPSIZE-sizeof(blockmark_t);
// alloc 1st block
uintptr_t sub = (uintptr_t)allocBlock(mmaplist[i].block, p, size);
mmaplist[i].maxfree = getMaxFreeBlock(mmaplist[i].block, mmaplist[i].size);
kh_dynablocks_t *blocks = mmaplist[i].dblist = kh_init(dynablocks);
kh_resize(dynablocks, blocks, 64);
khint_t k;
int ret;
k = kh_put(dynablocks, blocks, (uintptr_t)sub, &ret);
kh_value(blocks, k) = db;
for(int j=0; j<size; ++j)
mmaplist[i].helper[(uintptr_t)sub-(uintptr_t)mmaplist[i].block + j] = (j<256)?j:255;
return sub;
}
void ActuallyFreeDynarecMap(dynablock_t* db, uintptr_t addr, int size)
{
if(!addr || !size)
return;
for(int i=0; i<mmapsize; ++i) {
if ((addr>(uintptr_t)mmaplist[i].block)
&& (addr<((uintptr_t)mmaplist[i].block+mmaplist[i].size))) {
void* sub = (void*)(addr-sizeof(blockmark_t));
freeBlock(mmaplist[i].block, sub);
mmaplist[i].maxfree = getMaxFreeBlock(mmaplist[i].block, mmaplist[i].size);
kh_dynablocks_t *blocks = mmaplist[i].dblist;
if(blocks) {
khint_t k = kh_get(dynablocks, blocks, (uintptr_t)sub);
if(k!=kh_end(blocks))
kh_del(dynablocks, blocks, k);
for(int j=0; j<size; ++j)
mmaplist[i].helper[(uintptr_t)sub-(uintptr_t)mmaplist[i].block+j] = 0;
}
return;
}
}
if(mmapsize)
dynarec_log(LOG_NONE, "Warning, block %p (size %d) not found in mmaplist for Free\n", (void*)addr, size);
}
dynablock_t* FindDynablockFromNativeAddress(void* addr)
{
// look in actual list
for(int i=0; i<mmapsize; ++i) {
if ((uintptr_t)addr>=(uintptr_t)mmaplist[i].block
&& ((uintptr_t)addr<(uintptr_t)mmaplist[i].block+mmaplist[i].size)) {
if(!mmaplist[i].helper)
return FindDynablockDynablocklist(addr, mmaplist[i].dblist);
else {
uintptr_t p = (uintptr_t)addr - (uintptr_t)mmaplist[i].block;
while(mmaplist[i].helper[p]) p -= mmaplist[i].helper[p];
khint_t k = kh_get(dynablocks, mmaplist[i].dblist, (uintptr_t)mmaplist[i].block + p);
if(k!=kh_end(mmaplist[i].dblist))
return kh_value(mmaplist[i].dblist, k);
return NULL;
}
}
}
// look in oversized
return FindDynablockDynablocklist(addr, dblist_oversized);
}
uintptr_t AllocDynarecMap(dynablock_t* db, int size)
{
if(!size)
return 0;
if(size>MMAPSIZE-2*sizeof(blockmark_t)) {
#ifndef USE_MMAP
pthread_mutex_lock(&mutex_mmap);
void *p = NULL;
if(posix_memalign(&p, box86_pagesize, size)) {
dynarec_log(LOG_INFO, "Cannot create dynamic map of %d bytes\n", size);
return 0;
}
mprotect(p, size, PROT_READ | PROT_WRITE | PROT_EXEC);
#else
void* p = mmap(NULL, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
if(p==(void*)-1) {
dynarec_log(LOG_INFO, "Cannot create dynamic map of %d bytes\n", size);
return 0;
}
#endif
setProtection((uintptr_t)p, size, PROT_READ | PROT_WRITE | PROT_EXEC);
kh_dynablocks_t *blocks = dblist_oversized;
if(!blocks) {
blocks = dblist_oversized = kh_init(dynablocks);
kh_resize(dynablocks, blocks, 64);
}
khint_t k;
int ret;
k = kh_put(dynablocks, blocks, (uintptr_t)p, &ret);
kh_value(blocks, k) = db;
pthread_mutex_unlock(&mutex_mmap);
return (uintptr_t)p;
}
pthread_mutex_lock(&mutex_mmap);
uintptr_t ret = FindFreeDynarecMap(db, size);
if(!ret)
ret = AddNewDynarecMap(db, size);
pthread_mutex_unlock(&mutex_mmap);
return ret;
}
void FreeDynarecMap(dynablock_t* db, uintptr_t addr, uint32_t size)
{
if(!addr || !size)
return;
if(size>MMAPSIZE-2*sizeof(blockmark_t)) {
pthread_mutex_lock(&mutex_mmap);
#ifndef USE_MMAP
free((void*)addr);
#else
munmap((void*)addr, size);
#endif
kh_dynablocks_t *blocks = dblist_oversized;
if(blocks) {
khint_t k = kh_get(dynablocks, blocks, addr);
if(k!=kh_end(blocks))
kh_del(dynablocks, blocks, k);
}
pthread_mutex_unlock(&mutex_mmap);
return;
}
pthread_mutex_lock(&mutex_mmap);
ActuallyFreeDynarecMap(db, addr, size);
pthread_mutex_unlock(&mutex_mmap);
}
dynablocklist_t* getDB(uintptr_t idx)
{
return dynmap[idx];
}
// each dynmap is 64k of size
void addDBFromAddressRange(uintptr_t addr, uintptr_t size)
{
dynarec_log(LOG_DEBUG, "addDBFromAddressRange %p -> %p\n", (void*)addr, (void*)(addr+size-1));
uintptr_t idx = (addr>>DYNAMAP_SHIFT);
uintptr_t end = ((addr+size-1)>>DYNAMAP_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
if(!dynmap[i]) {
dynablocklist_t* p = NewDynablockList(i<<DYNAMAP_SHIFT, 1<<DYNAMAP_SHIFT, 0);
if(arm_lock_storeifnull(&dynmap[i], p)!=p)
FreeDynablockList(&p);
}
}
}
void cleanDBFromAddressRange(uintptr_t addr, uintptr_t size, int destroy)
{
dynarec_log(LOG_DEBUG, "cleanDBFromAddressRange %p -> %p %s\n", (void*)addr, (void*)(addr+size-1), destroy?"destroy":"mark");
uintptr_t idx = (addr>>DYNAMAP_SHIFT);
uintptr_t end = ((addr+size-1)>>DYNAMAP_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
dynablocklist_t* dblist = dynmap[i];
if(dblist) {
if(destroy)
FreeRangeDynablock(dblist, addr, size);
else
MarkRangeDynablock(dblist, addr, size);
}
}
}
#ifdef ARM
void arm_next(void);
#endif
void addJumpTableIfDefault(void* addr, void* jmp)
{
const uintptr_t idx = ((uintptr_t)addr>>JMPTABL_SHIFT);
if(box86_jumptable[idx] == box86_jmptbl_default) {
uintptr_t* tbl = (uintptr_t*)malloc((1<<JMPTABL_SHIFT)*sizeof(uintptr_t));
for(int i=0; i<(1<<JMPTABL_SHIFT); ++i)
tbl[i] = (uintptr_t)arm_next;
if(arm_lock_storeifref(&box86_jumptable[idx], tbl, box86_jmptbl_default)!=tbl)
free(tbl);
}
const uintptr_t off = (uintptr_t)addr&((1<<JMPTABL_SHIFT)-1);
arm_lock_storeifref(&box86_jumptable[idx][off], jmp, arm_next);
}
void setJumpTableDefault(void* addr)
{
const uintptr_t idx = ((uintptr_t)addr>>JMPTABL_SHIFT);
if(box86_jumptable[idx] == box86_jmptbl_default) {
return;
}
const uintptr_t off = (uintptr_t)addr&((1<<JMPTABL_SHIFT)-1);
box86_jumptable[idx][off] = (uintptr_t)arm_next;
}
int isJumpTableDefault(void* addr)
{
const uintptr_t idx = ((uintptr_t)addr>>JMPTABL_SHIFT);
if(box86_jumptable[idx] == box86_jmptbl_default) {
return 1;
}
const uintptr_t off = (uintptr_t)addr&((1<<JMPTABL_SHIFT)-1);
return (box86_jumptable[idx][off]==(uintptr_t)arm_next)?1:0;
}
uintptr_t getJumpTable()
{
return (uintptr_t)box86_jumptable;
}
uintptr_t getJumpTableAddress(uintptr_t addr)
{
const uintptr_t idx = ((uintptr_t)addr>>JMPTABL_SHIFT);
if(box86_jumptable[idx] == box86_jmptbl_default) {
uintptr_t* tbl = (uintptr_t*)malloc((1<<JMPTABL_SHIFT)*sizeof(uintptr_t));
for(int i=0; i<(1<<JMPTABL_SHIFT); ++i)
tbl[i] = (uintptr_t)arm_next;
if(arm_lock_storeifref(&box86_jumptable[idx], tbl, box86_jmptbl_default)!=tbl)
free(tbl);
}
const uintptr_t off = (uintptr_t)addr&((1<<JMPTABL_SHIFT)-1);
return (uintptr_t)&box86_jumptable[idx][off];
}
// Remove the Write flag from an adress range, so DB can be executed
// no log, as it can be executed inside a signal handler
void protectDB(uintptr_t addr, uintptr_t size)
{
dynarec_log(LOG_DEBUG, "protectDB %p -> %p\n", (void*)addr, (void*)(addr+size-1));
uintptr_t idx = (addr>>MEMPROT_SHIFT);
uintptr_t end = ((addr+size-1)>>MEMPROT_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
uint32_t prot = memprot[i];
if(!prot)
prot = PROT_READ | PROT_WRITE; // comes from malloc & co, so should not be able to execute
memprot[i] = prot|PROT_DYNAREC;
if(!(prot&PROT_DYNAREC))
mprotect((void*)(i<<MEMPROT_SHIFT), 1<<MEMPROT_SHIFT, prot&~PROT_WRITE);
}
}
// Add the Write flag from an adress range, and mark all block as dirty
// no log, as it can be executed inside a signal handler
void unprotectDB(uintptr_t addr, uintptr_t size)
{
dynarec_log(LOG_DEBUG, "unprotectDB %p -> %p\n", (void*)addr, (void*)(addr+size-1));
uintptr_t idx = (addr>>MEMPROT_SHIFT);
uintptr_t end = ((addr+size-1)>>MEMPROT_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
uint32_t prot = memprot[i];
memprot[i] = prot&~PROT_DYNAREC;
if(prot&PROT_DYNAREC) {
mprotect((void*)(i<<MEMPROT_SHIFT), 1<<MEMPROT_SHIFT, prot&~PROT_DYNAREC);
cleanDBFromAddressRange((i<<MEMPROT_SHIFT), 1<<MEMPROT_SHIFT, 0);
}
}
}
#endif
void updateProtection(uintptr_t addr, uintptr_t size, uint32_t prot)
{
const uintptr_t idx = (addr>>MEMPROT_SHIFT);
const uintptr_t end = ((addr+size-1)>>MEMPROT_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
uint32_t dyn=(memprot[i]&PROT_DYNAREC);
if(dyn && (prot&PROT_WRITE)) // need to remove the write protection from this block
mprotect((void*)(i<<MEMPROT_SHIFT), 1<<MEMPROT_SHIFT, prot&~PROT_WRITE);
memprot[i] = prot|dyn;
}
}
void setProtection(uintptr_t addr, uintptr_t size, uint32_t prot)
{
const uintptr_t idx = (addr>>MEMPROT_SHIFT);
const uintptr_t end = ((addr+size-1)>>MEMPROT_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
memprot[i] = prot;
}
}
uint32_t getProtection(uintptr_t addr)
{
const uintptr_t idx = (addr>>MEMPROT_SHIFT);
uint32_t ret = memprot[idx];
return ret;
}
int unlockCustommemMutex()
{
int ret = 0;
int i = 0;
#define GO(A, B) \
i = checkUnlockMutex(&A); \
if(i) { \
ret|=(1<<B); \
}
GO(mutex_blocks, 0)
#ifdef DYNAREC
GO(mutex_mmap, 1)
#endif
#undef GO
return ret;
}
void relockCustommemMutex(int locks)
{
#define GO(A, B) \
if(locks&(1<<B)) \
pthread_mutex_lock(&A); \
GO(mutex_blocks, 0)
#ifdef DYNAREC
GO(mutex_mmap, 1)
#endif
#undef GO
}
static void init_mutexes(void)
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
pthread_mutex_init(&mutex_blocks, &attr);
#ifdef DYNAREC
pthread_mutex_init(&mutex_mmap, &attr);
#endif
pthread_mutexattr_destroy(&attr);
}
static void atfork_child_custommem(void)
{
// (re))init mutex if it was lock before the fork
init_mutexes();
}
void init_custommem_helper(box86context_t* ctx)
{
if(inited) // already initialized
return;
inited = 1;
init_mutexes();
#ifdef DYNAREC
#ifdef ARM
for(int i=0; i<(1<<JMPTABL_SHIFT); ++i)
box86_jmptbl_default[i] = (uintptr_t)arm_next;
for(int i=0; i<JMPTABL_SIZE; ++i)
box86_jumptable[i] = box86_jmptbl_default;
#else
#error Unsupported architecture!
#endif
#endif
pthread_atfork(NULL, NULL, atfork_child_custommem);
}
void fini_custommem_helper(box86context_t *ctx)
{
if(!inited)
return;
inited = 0;
#ifdef DYNAREC
dynarec_log(LOG_DEBUG, "Free global Dynarecblocks\n");
for (int i=0; i<mmapsize; ++i) {
if(mmaplist[i].block)
#ifdef USE_MMAP
munmap(mmaplist[i].block, mmaplist[i].size);
#else
free(mmaplist[i].block);
#endif
if(mmaplist[i].dblist) {
kh_destroy(dynablocks, mmaplist[i].dblist);
mmaplist[i].dblist = NULL;
}
if(mmaplist[i].helper) {
free(mmaplist[i].helper);
mmaplist[i].helper = NULL;
}
}
if(dblist_oversized) {
kh_destroy(dynablocks, dblist_oversized);
dblist_oversized = NULL;
}
mmapsize = 0;
dynarec_log(LOG_DEBUG, "Free dynamic Dynarecblocks\n");
uintptr_t idx = 0;
uintptr_t end = ((0xFFFFFFFF)>>DYNAMAP_SHIFT);
for (uintptr_t i=idx; i<=end; ++i) {
dynablocklist_t* dblist = dynmap[i];
if(dblist) {
uintptr_t startdb = StartDynablockList(dblist);
uintptr_t enddb = EndDynablockList(dblist);
uintptr_t startaddr = 0;
if(startaddr<startdb) startaddr = startdb;
uintptr_t endaddr = 0xFFFFFFFF;
if(endaddr>enddb) endaddr = enddb;
FreeRangeDynablock(dblist, startaddr, endaddr-startaddr+1);
}
}
for (uintptr_t i=idx; i<=end; ++i)
if(dynmap[i])
FreeDynablockList(&dynmap[i]);
pthread_mutex_destroy(&mutex_mmap);
free(mmaplist);
for (int i=0; i<DYNAMAP_SIZE; ++i)
if(box86_jumptable[i]!=box86_jmptbl_default)
free(box86_jumptable[i]);
#endif
for(int i=0; i<n_blocks; ++i)
#ifdef USE_MMAP
munmap(p_blocks[i].block, p_blocks[i].size);
#else
free(p_blocks[i].block);
#endif
free(p_blocks);
pthread_mutex_destroy(&mutex_blocks);
}
-17
View File
@@ -1,17 +0,0 @@
#ifndef __DEBUG_H_
#define __DEBUG_H_
extern int box86_log; // log level
extern int trace_xmm; // include XMM reg in trace?
#define LOG_NONE 0
#define LOG_INFO 1
#define LOG_DEBUG 2
#define LOG_DUMP 3
extern FILE* ftrace;
#define printf_log(L, ...) if(L<=box86_log) fprintf(ftrace, __VA_ARGS__)
#define EXPORT __attribute__((visibility("default")))
#endif //__DEBUG_H_
+1260
View File
File diff suppressed because it is too large. Load diff
+27
View File
@@ -0,0 +1,27 @@
//arm epilog for dynarec
//Save stuff, prepare stack and register
//called with pointer to emu as 1st parameter
//and address to jump to as 2nd parameter
.text
.align 4
.global arm_epilog
arm_epilog:
//update register -> emu
//pop {r0}
stm r0, {r4-r12,r14} // put back reg value in emu, including EIP (so r14 must be EIP now)
//restore all used register
vpop {d8-d15}
pop {r4-r11, pc}
//end, return...
//bx lr
.global arm_epilog_fast
arm_epilog_fast:
//restore all used register
vpop {d8-d15}
pop {r4-r11, pc}
//end, return...
//bx lr
+596
View File
@@ -0,0 +1,596 @@
; TYPE fields separated by spaces Assembler syntax
; When there are mutiple assembler syntax (like for LDR (immediate)), separate them based on the bytes
; E.G. for LDR (immediate), there are 3 lines with the 3 different asm syntaxes
# Field options:
# --------------
# Syntax: ... field/coption1(coption2)* ... (inside fields)
# Where each c correspond to the option character
# and optionN to the Nth option value
# ---
# c = '0'..'9'/'A'..'F': option=[01]
# Force the cth bit (hex) of the field (starting from LSB) to be <option>
# c = '=': option=[01x]{field_len}
# Force the field to have the given bits (where x = anything, starts from MSB)
# Post-fields option:
# -------------------
# Syntax: [fields] @ typeoption1 args1 typeoption2 args2 @ [Assembler syntax]
# ---
# typeoption contains '=' (l=r): args1=((.*) )?([^, ]*),([^, ]*),([^, ]*)@
# Changes a value between two other depending on whether l == r
# \2 is init (suffixed by ';', optional), \3 is set to \4 if true or \5 if false
# (cf VMOV/VORR aka V\op\, VEOR/VBIF/VBIT/VBSL aka V\op\)
# The 'true regex' is typeoption=([^= ]*)(=([^= ]*))+
# args1=((.*) )?([^, ]*),(([^, ]*),)+([^, ]*)@
# with the number of typeoption:\2 being equal to the number of args1:\4
# <a>=<b>[=<c>...] <initialization> <variable-changed>,<changed-into-if-a=b>[,<changed-into-if-a=c>...],<changed-into-else>@
# OR
# typeoption is discarded and must be set to '=', args1=((.*) )?(@@ (( ?.*[^@])*)@ )+([^, ]*),(([^, ]*),)+([^, ]*)
# \2 is init (suffixed by ';', optional), \6 is set to \7 if true or \8 if false
# The difference with the simple switch is that \4 is the test (inside the `if`)
# If there are multiple @@s, there are multiple `if`s (separated by `else`s)
# The 'true regex' is [DISCARDED]typeoption==
# args1=((.*) )?(@@ (( ?.*[^@])*)@ )+([^, ]*),([^, ]*),([^, ]*)
# <.>=<.>[=<c>...] <initialization> @@ <test>@[ @@ <test2>@...] <variable-changed>,<changed-into-if-a=b>,<changed-into-else>
# OR
# args1=((.*) )?!@(( [^%]*[^%@])*)%(( ?[^%]*[^%@])*)@(( .*[^@])*)@(( .*[^@])*)@
# Replaced by '\1; if (<equality>) { \3\7\5; } else { \3\9\5; }'
# Meaning, <.=.> <initialization> !@ <common-left-part>%<common-right-part>@ <substitute-true>@ <substitute-false>@ <...>
# (cf VMOV/VORR, aka V\op\ with the lastop variable)
# You can also add more '=' with corresponding substitutes.
# You can also add more '%' with corresponding substitutes.
# ----
# Inside the assembler syntax, you can add \var\ to mark a variable to be replaced
# (Meaning, %s and `var` as argument to printf)
# Full syntax: \\(%[0-9+]*.)?(.*)\\
# If \1 != "", add \1 to the string in printf, and in any case append \2 as argument to printf
! HACKS: (list of notable differences between the doc and this file)
! ------
! In theory, (0) and (1) bits are as important as 0 and 1:
! > An instruction is UNPREDICTABLE if:
! > • It is declared as UNPREDICTABLE in an instruction description or in this chapter.
! > • The pseudocode for that encoding does not indicate that a different special case applies, and a bit marked (0)
! or (1) in the encoding diagram of an instruction is not 0 or 1 respectively.
! - ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition
! In practice, they are ignored here.
! SWP, SWPB, VMOV (VFPU): Rt2 (field and assembly) -> Rn (field and assembly)
! BKPT: must be AL, so cond (field) -> cond/=1110 (constrained field)
! PKHBT and PKHTB: {, LSL/ASR #<imm>} (assembly) -> {, <shift>} (assembly)
! PKHBT and PKHTB: immediate shift but shift & 1 -> ARMs (type)
! All NEON operations (advanced SIMD): limited, so multiply the lines
! VMOV (register): Vm ... Vm VMOV (field, assembly) -> Vn ... Vm @ m=n ...@ @ V\op\ (field, switchable var, assembly)
! VMOV is VORR constrained -> (removed VORR)
! VEOR, VBSL, VBIT, VBIF differ only depending on 2 bits: 0/1 0/1 ... VEOR -> @<2> ... @ ... @ V\op\ (field, switchable var, assembly)
! Three registers of different lengths (when having L and W variants): op (field) -> Q (field)
; ========== BEGINNING OF REGISTERED INSTRUCTIONS =========
# This instruction changes the instruction set to Thumb! Disabled (but valid)
#ARM_ 1 1 1 1 1 0 1 @<1> imm24 @ set imm24 = (imm24 << 2) + (param << 1)@ @ BLX <label>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 op 0 N Q M 0 Vm VH\(op ? "SUB" : "ADD")\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 0 0 N Q M 1 Vm VQADD<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 0 1 N Q M 0 Vm VRHADD<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 0 Vn Vd 0 0 0 1 N Q M 1 Vm VAND<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 1 Vn Vd 0 0 0 1 N Q M 1 Vm VBIC<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 1 0 Vn Vd 0 0 0 1 N Q M 1 Vm @ m=n const char* op op,"MOV","ORR"@ m=n char lastop[6] !@ %@ lastop[0] = '\0'@ sprintf(lastop, ", %s", vecname[(q << 5) + 0x20 + n])@ @ V\op\<c> <Qd>, <Qm>\lastop\
NEON 1 1 1 1 0 0 1 0 0 D 1 1 Vn Vd 0 0 0 1 N Q M 1 Vm VORN<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D @<2> Vn Vd 0 0 0 1 N Q M 1 Vm @ param=0b00=0b01=0b10 const char* op op,"EOR","BSL","BIT","BIF"@ @ V\op\<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 0 N Q M 1 Vm VQSUB<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 1 N Q M op Vm @ op=0 const char* strict strict,"T","E"@ @ VCG\strict\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 0 N Q M 0 Vm VSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 0 N Q M 1 Vm VQSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 1 N Q M 0 Vm VRSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 1 N Q M 1 Vm VQRSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 0 N Q M op Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ V\opname\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 1 N Q M 0 Vm VABD<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 1 N Q M 1 Vm VABA<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 op 0 D size Vn Vd 1 0 0 0 N Q M 0 Vm @ op=0 const char* opname opname,"ADD","SUB"@ @ V\opname\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm VTST<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm VCEQ<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 0 1 N Q M 0 Vm @ set size = 8 << size@ @ VML\(u ? "S" : "A")\<c>.I\%dsize\ <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 0 1 N Q M 1 Vm VMUL<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 1 0 N Q M op Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ VP\opname\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm VQDMULH<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm VQRDMULH<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 1 1 N Q/=0 M 1 Vm VPADD<c>.<dt> <Dd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 0 D U sz/=0 Vn Vd 1 1 0 0 N Q M 1 Vm @ u=0 const char* y y,"A","S"@ @ VFM\y\<c>.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D U sz/=0 Vn Vd 1 1 0 1 N Q M 0 Vm @ u=0 const char* op op,"ADD","SUB"@ @ V\op\<c>.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D 0 sz/=0 Vn Vd 1 1 0 1 N Q/=0 M 0 Vm VPADD.F32 <Dd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 1 0 D 1 sz/=0 Vn Vd 1 1 0 1 N Q M 0 Vm VABD.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D op sz/=0 Vn Vd 1 1 0 1 N Q M 1 Vm VML\(op ? "S" : "A")\<c>.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D 0 sz/=0 Vn Vd 1 1 0 1 N Q M 1 Vm VMUL.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 sz/=0 Vn Vd 1 1 1 0 N Q M 0 Vm VCEQ.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D op sz/=0 Vn Vd 1 1 1 0 N Q M 0 Vm @ op=1 const char* strict strict,"T","E"@ @ VCG\strict\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D op sz/=0 Vn Vd 1 1 1 0 N Q M 1 Vm @ op=1 const char* strict strict,"T","E"@ @ VACG\strict\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D op sz/=0 Vn Vd 1 1 1 1 N Q M 0 Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ V\opname\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D op sz/=0 Vn Vd 1 1 1 1 N Q M 0 Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ VP\opname\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 sz/=0 Vn Vd 1 1 1 1 N Q M 1 Vm VRECPS.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 1 sz/=0 Vn Vd 1 1 1 1 N Q M 1 Vm VRSQRTS.F32 <Qd>, <Qn>, <Qm>
INVALIDATE 1 1 1 1 0 0 1 <1> 0 <23>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx0 0 Q op/=0 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx1 0 Q op/=0 1 imm4 VORR<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x0 0 Q op/=0 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x1 0 Q op/=0 1 imm4 VORR<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=11xx 0 Q op/=0 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx0 0 Q op/=1 1 imm4 VMVN<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx1 0 Q op/=1 1 imm4 VBIC<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x0 0 Q op/=1 1 imm4 VMVN<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x1 0 Q op/=1 1 imm4 BIC<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=110x 0 Q op/=1 1 imm4 VMVN<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=1110 0 Q op/=1 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
;INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 0 0 0 <3> <4> <4>/=1111 0 <1> <1>/=1 1 <4>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 0 0 0 <11> 0 <2> 1 <4>
# Special case for VMOVL (harder to do it on the documented place)
NEON 1 1 1 1 0 0 1 0 1 D 0 0 1 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.S8 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D 0 1 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.S16 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D 1 0 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.S32 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 0 0 1 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.U8 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 0 1 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.U16 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 1 0 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.U32 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 0 0 L Q M 1 Vm VSHR<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 0 1 L Q M 1 Vm VSRA<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 1 0 L Q M 1 Vm VRSHR<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 1 1 L Q M 1 Vm VRSRA<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 1 1 D imm6 Vd 0 1 0 0 L Q M 1 Vm VSRI<c>.<size> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 0 1 D Imm6 Vd 0 1 0 1 L Q M 1 Vm VSHL<c>.I<size> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 1 1 D Imm6 Vd 0 1 0 1 L Q M 1 Vm VSLI<c>.<size> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D Imm6 Vd 0 1 1 op L Q M 1 Vm VQSHL\((u & op) ? "U" : "")\<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 0 1 D imm6 Vd 1 0 0 0 0 0 M 1 Vm @ set ++size@ @ VSHRN<c>.I<size> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 0 1 D imm6 Vd 1 0 0 0 0 1 M 1 Vm VRSHRN<c>.I<size> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 0 op 0 0 M 1 Vm VQSHR\((u & op) ? "U" : "")\N<c>.<dt> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 0 op 0 1 M 1 Vm VQRSHR\((u & op) ? "U" : "")\N<c>.<dt> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 1 0 0 M 1 Vm VSHLL<c>.<dt> <Qd>, <Dm>, #\%d8 &l&l size\
NEON 1 1 1 1 0 0 1 U 1 D Imm6 Vd 1 0 1 0 0 0 M 1 Vm VSHLL<c>.<dt> <Qd>, <Dm>, #<imm>
; VCVT: if imm6 IN "0xxxxx" then UNDEFINED;
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 0 <9> 1 1 1 <1> 0 <2> 1 <4>
NEON 1 1 1 1 0 0 1 0 1 D IMM6 Vd 1 1 1 0 0 Q M 1 Vm VCVT<c>.F32.S32 <Qd>, <Qm>, #<fbits>
NEON 1 1 1 1 0 0 1 0 1 D IMM6 Vd 1 1 1 1 0 Q M 1 Vm VCVT<c>.S32.F32 <Qd>, <Qm>, #<fbits>
NEON 1 1 1 1 0 0 1 1 1 D IMM6 Vd 1 1 1 0 0 Q M 1 Vm VCVT<c>.F32.U32 <Qd>, <Qm>, #<fbits>
NEON 1 1 1 1 0 0 1 1 1 D IMM6 Vd 1 1 1 1 0 Q M 1 Vm VCVT<c>.U32.F32 <Qd>, <Qm>, #<fbits>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <18> 1 <4>
NEON 1 1 1 1 0 0 1 0 1 D 1 1 Vn Vd IMM4 N Q M 0 Vm VEXT<c>.8 <Qd>, <Qn>, <Qm>, #<imm>
# size + param < 3
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=11 0 0 <4> 0 0 0 <2> <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=10 0 0 <4> 0 0 0 <2>/11 <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=10 0 0 <4> 0 0 0 <2>/01 <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=01 0 0 <4> 0 0 0 <2>/11 <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=00 0 0 <4> 0 0 0 <2>/=11 <2> 0 <4>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 0 0 @<2> Q M 0 Vm VREV\%d16 &l&l param\<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 0 1 0 U Q M 0 Vm VPADDL<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 0 Q M 0 Vm VCLS<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 1 Q M 0 Vm VCLZ<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=00 0 0 Vd 0 1 0 1 0 Q M 0 Vm VCNT<c>.8 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=00 0 0 Vd 0 1 0 1 1 Q M 0 Vm VMVN<c> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 0 U Q M 0 Vm VPADAL<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 0 Q M 0 Vm VQABS<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 1 Q M 0 Vm VQNEG<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 0 Q M 0 Vm VCGT<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 1 Q M 0 Vm VCGE<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 0 Q M 0 Vm VCEQ<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 1 Q M 0 Vm VCLE<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 0 0 Q M 0 Vm VCLT<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 0 Q M 0 Vm VABS<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 1 Q M 0 Vm VNEG<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=00 1 0 Vd 0 0 0 0 0 Q M 0 Vm VSWP<c> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 0 1 Q M 0 Vm VTRN<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 0 Q M 0 Vm VUZP<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 1 Q M 0 Vm VZIP<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 0 0 M 0 Vm VMOVN<c>.<dt> <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 0 1 M 0 Vm VQMOVUN<c>.S\%d16 &l&l size\ <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 1 U M 0 Vm @ set ++size@ @ VQMOVN<c>.<dt> <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 1 0 0 M 0 Vm VSHLL<c>.I\%d8 &l&l size\ <Qd>, <Dm>, #\%d8 &l&l size\
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=01 1 0 Vd 0 1 1 0 0 0 M 0 Vm VCVT<c>.F16.F32 <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=01 1 0 Vd 0 1 1 1 0 0 M 0 Vm VCVT<c>.F32.F16 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 0 Q M 0 Vm VRECPE<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 1 Q M 0 Vm VRSQRTE<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 0 0 Q M 0 Vm VCVT<c>.F32.S32 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 0 1 Q M 0 Vm VCVT<c>.S32.F32 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 1 0 Q M 0 Vm VCVT<c>.F32.U32 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 1 1 Q M 0 Vm VCVT<c>.U32.F32 <Qd>, <Qm>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <8> 0 <6> 0 <4>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 Vn Vd 1 0 @<2> N op M 0 Vm @ param=0b00 char list[10] !@ sprintf(list, %)@ "{%s}", vecname[0x20 + n]@ "{%s-%s}", vecname[0x20 + n], vecname[0x20 + n + param]@ @ VTB\(op ? "X" : "L")\<c>.8 <Dd>, \list\, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 imm4 Vd 1 1 0 0 0 Q M 0 Vm VDUP<c>.\%dsize\ <Qd>, <Dm[x]>
; size != 11
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 1 1 <13> 0 <1> 0 <4>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 0 0 Q N 0 M 0 Vm VADD\(q ? "W" : "L")\<c>.<dt> <qd>, <Qn>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 0 1 Q N 0 M 0 Vm VSUB\(q ? "W" : "L")\<c>.<dt> <qd>, <Qn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm @ set size = 16 << size@ @ VADDHN<c>.I\%dsize\ <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm VRADDHN<c>.<dt> <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 1 0 1 N 0 M 0 Vm VABAL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm VSUBHN<c>.<dt> <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm VRSUBHN<c>.<dt> <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 1 1 1 N 0 M 0 Vm VABDL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 1 0 op 0 N 0 M 0 Vm VML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 1 0 op 1 N 0 M 0 Vm VQDML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 1 1 0 0 N 0 M 0 Vm VMULL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 1 1 0 1 N 0 M 0 Vm VQDMULL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 U/=0 1 D size/=00 Vn Vd 1 1 1 0 N 0 M 0 Vm @ set uint8_t size = 0@ @ VMULL<c>.<dt> <Qd>, <Dn>, <Dm>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <16> 0 <1> 0 <4>
; Put after, otherwise some instructions are shadowed
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 0 op 0 F N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VML\(op ? "S" : "A")\<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 op 1 0 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 0 op 1 1 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQDML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 0 0 F N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VMUL<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 1 0 1 0 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VMULL<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 1 0 1 1 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQDMULL<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 1 0 0 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQDMULH<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 1 0 1 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQRDMULH<c>.<dt> <Qd>, <Qn>, <Dm[x]>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <16> 0 <1> 0 <4>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 0 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 1 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
;INVALIDATE 1 1 1 1 0 1 0 0 0 <1> 0 0 <22>
INVALIDATE 1 1 1 1 0 1 0 0 1 <1> 0 0 <8> 1 1 <10>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 @<4> 1 1 1 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 @<4> 1 1 0 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 @<4> Rm @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> Rm @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
;INVALIDATE 1 1 1 1 0 1 0 0 1 <1> 0 0 <20>
;INVALIDATE 1 1 1 1 0 1 0 0 <2> 0 0 <20>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 0 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 1 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
;INVALIDATE 1 1 1 1 0 1 0 0 0 <1> 1 0 <22>
INVALIDATE 1 1 1 1 0 1 0 0 1 <1> 1 0 <8> 1 1 <10>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 @<4> 1 1 1 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 @<4> 1 1 0 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 @<4> Rm @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> Rm @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
;INVALIDATE 1 1 1 1 0 1 0 0 1 <1> 1 0 <20>
;INVALIDATE 1 1 1 1 0 1 0 0 <2> 1 0 <20>
INVALIDATE 1 1 1 1 0 1 0 0 <3> 0 <20>
; ===== No more 1 1 1 1 ..., so invalidate all of them ====
INVALIDATE 1 1 1 1 <28>
ARMS cond 0 0 0 0 0 0 0 S Rn Rd imm5 type 0 Rm AND{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 0 0 S Rd (0) (0) (0) (0) Rm 1 0 0 1 Rn MUL{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 0 U 0 0 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm STRH<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 0 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRD<c> <Rt>, <Rt2>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 0 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm STRD<c> <Rt>, <Rt2>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm LDRH<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRSB<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm LDRSH<c> <Rt>, [<Rn>], +/-<Rm>
ARMS cond 0 0 0 0 0 0 1 S Rn Rd imm5 type 0 Rm EOR{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 0 1 S Rd Ra Rm 1 0 0 1 Rn MLA{S}<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 0 U 0 1 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm STRHT<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm LDRHT<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRSBT<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm LDRSHT<c> <Rt>, [<Rn>], +/-<Rm>
ARMS cond 0 0 0 0 0 1 0 S Rn Rd imm5 type 0 Rm SUB{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 1 0 0 RdHi RdLo Rm 1 0 0 1 Rn UMAAL<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARM_ cond 0 0 0 0 U 1 0 0 Rn Rt imm4H 1 0 1 1 imm4L STRH<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 0 Rn Rt imm4H 1 1 0 1 imm4L LDRD<c> <Rt>, <Rt2>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 0 Rn Rt imm4H 1 1 1 1 imm4L STRD<c> <Rt>, <Rt2>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 1 Rn Rt imm4H 1 0 1 1 imm4L LDRH<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 1 Rn Rt imm4H 1 1 0 1 imm4L LDRSB<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 1 Rn Rt imm4H 1 1 1 1 imm4L LDRSH<c> <Rt>, [<Rn>], #+/-<imm8>
ARMS cond 0 0 0 0 0 1 1 S Rn Rd imm5 type 0 Rm RSB{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 1 1 0 Rd Ra Rm 1 0 0 1 Rn MLS<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 0 U 1 1 0 Rn Rt imm4H 1 0 1 1 imm4L STRHT<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 0 1 1 imm4L LDRHT<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 1 0 1 imm4L LDRSBT<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 1 1 1 imm4L LDRSHT<c> <Rt>, [<Rn>], #+/-<imm8>
ARMS cond 0 0 0 0 1 0 0 S Rn Rd imm5 type 0 Rm ADD{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 0 0 S RdHi RdLo Rm 1 0 0 1 Rn UMULL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARMS cond 0 0 0 0 1 0 1 S Rn Rd imm5 type 0 Rm ADC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 0 1 S RdHi RdLo Rm 1 0 0 1 Rn UMLAL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARMS cond 0 0 0 0 1 1 0 S Rn Rd imm5 type 0 Rm SBC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 1 0 S RdHi RdLo Rm 1 0 0 1 Rn SMULL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARMS cond 0 0 0 0 1 1 1 S Rn Rd imm5 type 0 Rm RSC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 1 1 S RdHi RdLo Rm 1 0 0 1 Rn SMLAL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 0 0 0 Rn SMLABB<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 0 1 0 Rn SMLATB<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 1 0 0 Rn SMLABT<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 1 1 0 Rn SMLATT<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rn Rt (0) (0) (0) (0) 1 0 0 1 Rm SWP<c> <Rt>, <Rm>, [<Rn>]
ARM_ cond 0 0 0 1 U 0 W 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm STRH<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 0 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRD<c> <Rt>, <Rt2>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 0 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm STRD<c> <Rt>, <Rt2>, [<Rn>, +/-<Rm>]{!}
ARMS cond 0 0 0 1 0 0 0 1 Rn (0) (0) (0) (0) imm5 type 0 Rm TST<c> <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 U 0 W 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm LDRH<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRSB<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm LDRSH<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 0 1 Rm BX<c> <Rm>
ARM_ cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 1 0 Rm BXJ<c> <Rm>
ARM_ cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 1 1 Rm BLX<c> <Rm>
ARM_ cond/=1110 0 0 0 1 0 0 1 0 imm12 0 1 1 1 imm4 BKPT #<imm16>
ARMS cond 0 0 0 1 0 0 1 1 Rn (0) (0) (0) (0) imm5 type 0 Rm TEQ<c> <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 0 1 0 0 Rn Rt (0) (0) (0) (0) 1 0 0 1 Rm SWPB<c> <Rt>, <Rm>, [<Rn>]
ARM_ cond 0 0 0 1 0 1 1 0 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 0 1 Rm CLZ<c> <Rd>, <Rm>
ARM_ cond 0 0 0 1 U 1 W 0 Rn Rt imm4H 1 0 1 1 imm4L STRH<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 0 Rn Rt imm4H 1 1 0 1 imm4L LDRD<c> <Rt>, <Rt2>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 0 Rn Rt imm4H 1 1 1 1 imm4L STRD<c> <Rt>, <Rt2>, [<Rn>, #+/-<imm8>]{!}
ARMS cond 0 0 0 1 0 1 0 1 Rn (0) (0) (0) (0) imm5 type 0 Rm CMP<c> <Rn>, <Rm>{, <shift>}
ARMS cond 0 0 0 1 0 1 1 1 Rn (0) (0) (0) (0) imm5 type 0 Rm CMN<c> <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 U 1 W 1 Rn Rt imm4H 1 0 1 1 imm4L LDRH<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 1 Rn Rt imm4H 1 1 0 1 imm4L LDRSB<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 1 Rn Rt imm4H 1 1 1 1 imm4L LDRSH<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARMS cond 0 0 0 1 1 0 0 S Rn Rd imm5 type 0 Rm ORR{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 1 0 0 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREX<c> <Rd>, <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 0 0 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREX<c> <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd 0 0 0 0 0 0 0 0 Rm MOV{S}<c> <Rd>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 0 0 0 Rm LSL{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 0 0 1 Rn LSL{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 0 1 0 Rm LSR{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 0 1 1 Rn LSR{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 1 0 0 Rm ASR{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 1 0 1 Rn ASR{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd 0 0 0 0 0 1 1 0 Rm RRX{S}<c> <Rd>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 1 1 0 Rm ROR{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 1 1 1 Rn ROR{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREXD<c> <Rd>, <Rt>, <Rt2>, [<Rn>]
ARM_ cond 0 0 0 1 1 0 1 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREXD<c> <Rt>, <Rt2>, [<Rn>]
ARMS cond 0 0 0 1 1 1 0 S Rn Rd imm5 type 0 Rm BIC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 1 1 0 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREXB<c> <Rd>, <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 1 0 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREXB<c> <Rt>, [<Rn>]
ARMS cond 0 0 0 1 1 1 1 S (0) (0) (0) (0) Rd imm5 type 0 Rm MVN{S}<c> <Rd>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 1 1 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREXH<c> <Rd>, <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 1 1 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREXH<c> <Rt>, [<Rn>]
ARM_ cond 0 0 1 0 0 0 0 S Rn Rd imm12 AND{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 0 0 1 S Rn Rd imm12 EOR{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 0 1 0 S Rn Rd imm12 SUB{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 0 1 1 S Rn Rd imm12 RSB{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 0 0 S Rn Rd imm12 ADD{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 0 1 S Rn Rd imm12 ADC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 1 0 S Rn Rd imm12 SBC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 1 1 S Rn Rd imm12 RSC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 1 0 0 0 0 imm4 Rd imm12 MOVW<c> <Rd>, #<imm16>
ARM_ cond 0 0 1 1 0 0 0 1 Rn (0) (0) (0) (0) imm12 TST<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 0 0 0 NOP<c>
ARM_ cond 0 0 1 1 0 0 1 1 Rn (0) (0) (0) (0) imm12 TEQ<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 0 1 0 0 imm4 Rd imm12 MOVT<c> <Rd>, #<imm16>
ARM_ cond 0 0 1 1 0 1 0 1 Rn (0) (0) (0) (0) imm12 CMP<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 0 1 1 1 Rn (0) (0) (0) (0) imm12 CMN<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 1 0 0 S Rn Rd imm12 ORR{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 1 1 0 1 S (0) (0) (0) (0) Rd imm12 MOV{S}<c> <Rd>, #<const>
ARM_ cond 0 0 1 1 1 1 0 S Rn Rd imm12 BIC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 1 1 1 1 S (0) (0) (0) (0) Rd imm12 MVN{S}<c> <Rd>, #<const>
ARM_ cond 0 1 0 0 1 0 0 1 1 1 0 1 Rt 0 0 0 0 0 0 0 0 0 1 0 0 POP<c> {<Rt>}
ARM_ cond 0 1 0 0 U 0 0 0 Rn Rt imm12 STR<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 0 0 1 Rn Rt imm12 LDR<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 0 1 0 Rn Rt imm12 STRT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 0 1 1 Rn Rt imm12 LDRT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 0 0 Rn Rt imm12 STRB<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 0 1 Rn Rt imm12 LDRB<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 1 0 Rn Rt imm12 STRBT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 1 1 Rn Rt imm12 LDRBT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 1 0 0 1 0 1 1 0 1 Rt 0 0 0 0 0 0 0 0 0 1 0 0 PUSH<c> {<Rt>}
ARM_ cond 0 1 0 1 U 0 W 0 Rn Rt imm12 STR<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 0 1 U 0 W 1 Rn Rt imm12 LDR<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 0 1 U 1 W 0 Rn Rt imm12 STRB<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 0 1 U 1 W 1 Rn Rt imm12 LDRB<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm SSAX<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm SSUB16<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm SSUB8<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm USAX<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm USUB16<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm USUB8<c> <Rd>, <Rn>, <Rm>
ARMs cond 0 1 1 0 1 0 0 0 Rn Rd imm5 0 0 1 Rm PKHBT<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARMs cond 0 1 1 0 1 0 0 0 Rn Rd imm5 1 0 1 Rm PKHTB<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 1 1 0 1 0 0 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm SXTB16<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 0 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm SXTAB16<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARMs cond 0 1 1 0 1 0 1 sat_imm Rd imm5 sh 0 1 Rn SSAT<c> <Rd>, #<imm>, <Rn>{, <shift>}
ARM_ cond 0 1 1 0 1 0 1 0 sat_imm Rd (1) (1) (1) (1) 0 0 1 1 Rn SSAT16<c> <Rd>, #<imm>, <Rn>
ARM_ cond 0 1 1 0 1 0 1 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm SXTB<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 1 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm SXTAB<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 1 1 Rm REV<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 0 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 1 0 1 1 Rm REV16<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 0 1 1 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm SXTH<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 1 1 Rn Rd rotate (0) (0) 0 1 1 1 Rm SXTAH<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 0 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm UXTB16<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 0 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm UXTAB16<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARMs cond 0 1 1 0 1 1 1 sat_imm Rd imm5 sh 0 1 Rn USAT<c> <Rd>, #<imm>, <Rn>{, <shift>}
ARM_ cond 0 1 1 0 1 1 1 0 sat_imm Rd (1) (1) (1) (1) 0 0 1 1 Rn USAT16<c> <Rd>, #<imm>, <Rn>
ARM_ cond 0 1 1 0 1 1 1 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm UXTB<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 1 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm UXTAB<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 1 1 Rm RBIT<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 1 1 1 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm UXTH<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 1 0 1 1 Rm REVSH<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 1 1 1 Rn Rd rotate (0) (0) 0 1 1 1 Rm UXTAH<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARMs cond 0 1 1 0 U 0 0 0 Rn Rt imm5 type 0 Rm STR<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 0 0 1 Rn Rt imm5 type 0 Rm LDR<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 0 1 0 Rn Rt imm5 type 0 Rm STRT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 0 1 1 Rn Rt imm5 type 0 Rm LDRT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 0 0 Rn Rt imm5 type 0 Rm STRB<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 0 1 Rn Rt imm5 type 0 Rm LDRB<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 1 0 Rn Rt imm5 type 0 Rm STRBT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 1 1 Rn Rt imm5 type 0 Rm LDRBT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 1 U 0 W 0 Rn Rt imm5 type 0 Rm STR<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARMs cond 0 1 1 1 U 0 W 1 Rn Rt imm5 type 0 Rm LDR<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARMs cond 0 1 1 1 U 1 W 0 Rn Rt imm5 type 0 Rm STRB<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARMs cond 0 1 1 1 U 1 W 1 Rn Rt imm5 type 0 Rm LDRB<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARM_ cond 0 1 1 1 1 0 0 0 Rd 1 1 1 1 Rm 0 0 0 1 Rn USAD8<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 1 1 0 0 0 Rd Ra Rm 0 0 0 1 Rn USADA8<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 1 1 1 1 1 0 msb Rd lsb 0 0 1 1 1 1 1 BFC<c> <Rd>, #<lsb>, #<width>
ARM_ cond 0 1 1 1 1 1 0 msb Rd lsb 0 0 1 Rn BFI<c> <Rd>, <Rn>, #<lsb>, #<width>
ARM_ cond 0 1 1 1 1 1 1 widthm1 Rd lsb 1 0 1 Rn UBFX<c> <Rd>, <Rn>, #<lsb>, #<width>
ARM_ cond 1 0 0 0 0 0 W 0 Rn/=1101 register_list STMED<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 0 0 W 0 Rn register_list STMDA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 0 0 W 1 Rn/=1101 register_list LDMED<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 0 0 W 1 Rn register_list LDMDA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 1 0 W 0 Rn/=1101 register_list STMEA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 1 0 W 0 Rn register_list STM<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 1 0 0 1 Rn/=1101 register_list LDMEA<c> <Rn>, <registers>
ARM_ cond 1 0 0 0 1 0 1 1 1 1 0 1 register_list @ = const char* op @@ (reglist != 0) && ((reglist & (reglist - 1)) == 0)@ op,"POP","LDMEA"@ @ \op\<c> <registers>
ARM_ cond 1 0 0 0 1 0 W 1 Rn register_list LDM<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 0 0 0 0 Rn/=1101 register_list STMFD<c> <Rn>, <registers>
ARM_ cond 1 0 0 1 0 0 1 0 1 1 0 1 register_list @ = const char* op @@ (reglist != 0) && ((reglist & (reglist - 1)) == 0)@ op,"PUSH","STMFD"@ @ \op\<c> <registers>
ARM_ cond 1 0 0 1 0 0 W 0 Rn register_list STMDB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 0 0 W 1 Rn/=1101 register_list LDMFD<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 0 0 W 1 Rn register_list LDMDB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 0 Rn/=1101 register_list STMFA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 0 Rn register_list STMIB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 1 Rn/=1101 register_list LDMFA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 1 Rn register_list LDMIB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 1 0 imm24 B<c> <label>
ARM_ cond 1 0 1 1 imm24 BL<c> <label>
VFPU cond 1 1 0 0 0 1 0 0 Rn Rt 1 0 1 0 0 0 M 1 Vm VMOV<c> <Sm>, <Sm1>, <Rt>, <Rn>
VFPU cond 1 1 0 0 0 1 0 1 Rn Rt 1 0 1 0 0 0 M 1 Vm VMOV<c> <Rt>, <Rn>, <Sm>, <Sm1>
VFPU cond 1 1 0 0 0 1 0 0 Rn Rt 1 0 1 1 0 0 M 1 Vm VMOV<c> <Dm>, <Rt>, <Rn>
VFPU cond 1 1 0 0 0 1 0 1 Rn Rt 1 0 1 1 0 0 M 1 Vm VMOV<c> <Rt>, <Rn>, <Dm>
;INVALIDATE <4> 1 1 0 0 0 1 0 <9> 1 0 1 <9>
INVALIDATE <4> 1 1 0 0 0 <11> 1 0 1 <9>
INVALIDATE <4> 1 1 0 0 0 <11> 1 0 1 <9>
INVALIDATE <4> 1 1 0 1 1 <1> 1 <9> 1 0 1 <9>
INVALIDATE <4> 1 1 0 1 1 <1> 1 <9> 1 0 1 <9>
VFPU cond 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FSTMX<c> <LIst>
VFPU cond 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 sz imm8 VPUSH<c> <list>
VFPU cond 1 1 0 1 U D 0 0 Rn Vd 1 0 1 sz imm8 VSTR<c> <Dd>, [<Rn>{, #+/-<imm>}]
VFPU cond 1 1 0 @<2> D W 0 Rn Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FSTM\(param == 0b01 ? "IA" : "DB")\X<c> <Rn>{!}, <LIst>
VFPU cond 1 1 0 @<2> D W 0 Rn Vd 1 0 1 sz imm8 VSTM\(param == 0b01 ? "IA" : "DB")\<c> <Rn>{!}, <list>
VFPU cond 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FLDMX<c> <LIst>
VFPU cond 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 sz imm8 VPOP<c> <list>
VFPU cond 1 1 0 1 0 D 0 1 1 1 1 1 Vd 1 0 1 sz 0 0 0 0 0 0 0 0 VLDR<c> <Dd>, [PC, #-0]
VFPU cond 1 1 0 1 U D 0 1 1 1 1 1 Vd 1 0 1 sz imm8 VLDR<c> <Dd>, <label>
VFPU cond 1 1 0 1 U D 0 1 Rn Vd 1 0 1 sz imm8 VLDR<c> <Dd>, [<Rn>{, #+/-<imm>}]
VFPU cond 1 1 0 @<2> D W 1 Rn Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FLDM\(param == 0b01 ? "IA" : "DB")\X<c> <Rn>{!}, <LIst>
VFPU cond 1 1 0 @<2> D W 1 Rn Vd 1 0 1 sz imm8 VLDM\(param == 0b01 ? "IA" : "DB")\<c> <Rn>{!}, <list>
INVALIDATE <4> 1 1 0 <25>
INVALIDATE <4> 1 1 1 0 0 0 <1> 0 <8> 1 0 1 1 <1> 1 0 1 (0) (0) (0) (0)
;INVALIDATE <4> 1 1 1 0 1 <2> 0 <8> 1 0 1 1 <1> 0 <1> 1 (0) (0) (0) (0)
VFPU cond 1 1 1 0 0 0 0 0 Vn Rt 1 0 1 0 N (0) (0) 1 (0) (0) (0) (0) VMOV<c> <Sn>, <Rt>
VFPU cond 1 1 1 0 1 1 1 0 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0) VMSR<c> FPSCR, <Rt>
VFPU cond 1 1 1 0 0 @<2> 0 Vd Rt 1 0 1 1 D @<2> 1 (0) (0) (0) (0) @ set uint8_t opc = (param1_2 << 2) + param2_2@ = uint8_t shift @@ (opc & 0b1000) == 0b1000@ @@ (opc & 0b1001) == 0b0001@ @@ (opc & 0b1011) == 0b0000@ shift,0,1,2,0xFF@ set uint8_t decodedImm = (opc & 0x7) >> shift@ @ VMOV<c>.\%d8 &l&l shift\ <Dd[x]>, <Rt>
VFPU cond 1 1 1 0 1 0 Q 0 Vd Rt 1 0 1 1 D 0 0 1 (0) (0) (0) (0) VDUP<c>.32 <Qd>, <Rt>
VFPU cond 1 1 1 0 1 0 Q 0 Vd Rt 1 0 1 1 D 0 1 1 (0) (0) (0) (0) VDUP<c>.16 <Qd>, <Rt>
VFPU cond 1 1 1 0 1 1 Q 0 Vd Rt 1 0 1 1 D 0 0 1 (0) (0) (0) (0) VDUP<c>.8 <Qd>, <Rt>
VFPU cond 1 1 1 0 0 0 0 1 Vn Rt 1 0 1 0 N (0) (0) 1 (0) (0) (0) (0) VMOV<c> <Rt>, <Sn>
VFPU cond 1 1 1 0 1 1 1 1 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0) VMRS<c> <Rt>, FPSCR
VFPU cond 1 1 1 0 U @<2> 1 Vn Rt 1 0 1 1 N @<2> 1 (0) (0) (0) (0) @ set uint8_t opc = (u << 4) + (param1_2 << 2) + param2_2@ = uint8_t shift, size @@ (opc & 0b01000) == 0b01000@ @@ (opc & 0b01001) == 0b00001@ @@ (opc & 0b11011) == 0b00000@ shift,0,1,2,0xFF;size,0,1,2,4@ set uint8_t decodedImm = (opc & 0x7) >> shift@ @ VMOV<c>.<dt> <Rt>, <Dn[x]>
INVALIDATE <4> 1 1 1 0 <12> 1 0 1 <4> 1 <4>
VFPU cond 1 1 1 0 0 D 0 0 Vn Vd 1 0 1 sz N op M 0 Vm VML\(op ? "S" : "A")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm VNML\(op ? "S" : "A")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 0 M 0 Vm VMUL<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 1 M 0 Vm VNMUL<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 0 M 0 Vm VADD<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 1 M 0 Vm VSUB<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 0 0 Vn Vd 1 0 1 sz N 0 M 0 Vm VDIV<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm VFNM\(op ? "A" : "S")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 1 0 Vn Vd 1 0 1 sz N op M 0 Vm VFM\(op ? "S" : "A")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
!/VFPU cond 1 1 1 0 1 x 1 1 opc2 <4> 1 0 1 <1> - - <1> 0 opc4 Table A7-17
VFPU cond 1 1 1 0 1 D 1 1 @<4> Vd 1 0 1 0 (0) 0 (0) 0 @<4> @ set int8_t sign = (param1_4 >> 3) ? -1 : 1@ set uint8_t exp = ((param1_4 & 0b111) ^ 0b100)@ set float mantissa = 16 + param2_4@ set float imm = sign * (1 << exp) * mantissa / 128.@ @ VMOV<c>.F32 <Sd>, #\%fimm\
VFPU cond 1 1 1 0 1 D 1 1 @<4> Vd 1 0 1 1 (0) 0 (0) 0 @<4> @ set int8_t sign = (param1_4 >> 3) ? -1 : 1@ set uint8_t exp = ((param1_4 & 0b111) ^ 0b100)@ set double mantissa = 16 + param2_4@ set double imm = sign * (1 << exp) * mantissa / 128.@ @ VMOV<c>.F64 <Dd>, #\%fimm\
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 0 1 M 0 Vm VMOV<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 1 1 M 0 Vm VABS<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 0 1 M 0 Vm VNEG<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 1 1 M 0 Vm VSQRT<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 1 0 Vd 1 0 1 (0) @<1> 1 M 0 Vm VCVT\(param ? "T" : "B")\<c>.F32.F16 <Sd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 1 1 Vd 1 0 1 (0) @<1> 1 M 0 Vm VCVT\(param ? "T" : "B")\<c>.F16.F32 <Sd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 0 1 0 0 Vd 1 0 1 sz op 1 M 0 Vm VCMP\(op ? "E" : "")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 1 0 1 Vd 1 0 1 sz op 1 (0) 0 (0) (0) (0) (0) VCMP\(op ? "E" : "")\<c>.F\(size ? "64" : "32")\ <Dd>, #0.0
VFPU cond 1 1 1 0 1 D 1 1 0 1 1 1 Vd 1 0 1 0 1 1 M 0 Vm VCVT<c>.F64.F32 <Dd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 0 1 1 1 Vd 1 0 1 1 1 1 M 0 Vm VCVT<c>.F32.F64 <Sd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 1 0 0 0 Vd 1 0 1 sz op 1 M 0 Vm VCVT<c>.F\(size ? "64" : "32")\.\(op ? "S" : "U")\32 <Dd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 1 0 1 U Vd 1 0 1 sz op 1 i 0 imm4 @ set uint8_t td = (u << 2) + op + 1@ td=0b001=0b010=0b101 const char* Td Td,"S16","U16","S32","U32"@ set imm5 = (16 << op) - (imm5 >> 4) - ((imm5 & 0xF) << 1)@ @ VCVT<c>.F\(size ? "64" : "32")\.\Td\ <Dd>, <Dd>, #<imm>
VFPU cond 1 1 1 0 1 D 1 1 1 1 0 U Vd 1 0 1 sz op 1 M 0 Vm VCVT\(op ? "" : "R")\<c>.\(u ? "U" : "S")\32.F\(size ? "64" : "32")\ <Sd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 1 1 1 U Vd 1 0 1 sz op 1 i 0 imm4 @ set uint8_t td = (u << 2) + op + 1@ td=0b001=0b010=0b101 const char* Td Td,"S16","U16","S32","U32"@ set imm5 = (16 << op) - (imm5 >> 4) - ((imm5 & 0xF) << 1)@ @ VCVT<c>.\Td\.F\(size ? "64" : "32")\ <Dd>, <Dd>, #<imm>
;INVALIDATE <4> 1 1 1 0 1 <1> 1 1 <8> 1 0 1 <4> 0 <4>
;INVALIDATE <4> 1 1 1 0 <12> 1 0 1 <4> 0 <4>
; ============= END OF REGISTERED INSTRUCTIONS ============
INVALIDATE <32>
+108
View File
@@ -0,0 +1,108 @@
// arm lock helper
// there is 2 part: read and write
// write return 0 on success, 1 on fail (value has been changed)
.text
.align 4
.global arm_lock_read_b
.global arm_lock_write_b
.global arm_lock_read_h
.global arm_lock_write_h
.global arm_lock_read_d
.global arm_lock_write_d
.global arm_lock_read_dd
.global arm_lock_write_dd
.global arm_lock_xchg
.global arm_lock_storeifnull
.global arm_lock_storeifref
arm_lock_read_b:
// address is r0, return is r0
ldrexb r0, [r0]
bx lr
arm_lock_write_b:
// address is r0, value is r1, return is r0
mov r2, r0
strexb r0, r1, [r2]
bx lr
arm_lock_read_h:
// address is r0, return is r0
ldrexh r0, [r0]
bx lr
arm_lock_write_h:
// address is r0, value is r1, return is r0
mov r2, r0
strexh r0, r1, [r2]
bx lr
arm_lock_read_d:
// address is r0, return is r0
// r0 needs to be aligned
ldrex r0, [r0]
bx lr
arm_lock_write_d:
// address is r0, value is r1, return is r0
// r0 needs to be aligned
mov r2, r0
strex r0, r1, [r2]
bx lr
arm_lock_read_dd:
// address is r2, return is r0, r1
ldrexd r2, r3, [r2]
str r2, [r0]
str r3, [r1]
bx lr
arm_lock_write_dd:
// address is r2, value is r0, r1, return is r0
// r0 needs to be aligned
strexd r3, r0, r1, [r2]
mov r0, r3
bx lr
arm_lock_xchg:
// address is r0, value is r1, return old value in r0
// r0 needs to be aligned
ldrex r2, [r0]
strex r3, r1, [r0]
cmp r3, #1
beq arm_lock_xchg
mov r0, r2
bx lr
arm_lock_storeifnull:
// address is r0, value is r1, r1 store to r0 only if [r0] is 0. return new [r0] value (so r1 or old value)
// r0 needs to be aligned
ldrex r2, [r0]
cmp r2, #0
bne arm_lock_storeifnull_exit
mov r2, r1
strex r3, r2, [r0]
cmp r3, #1
beq arm_lock_storeifnull
arm_lock_storeifnull_exit:
mov r0, r2
bx lr
arm_lock_storeifref:
push {r4}
arm_lock_storeifref_loop:
// address is r0, value is r1, r1 store to r0 only if [r0] is r2. return new [r0] value (so r1 or old value)
ldrex r3, [r0]
cmp r3, r2
bne arm_lock_storeifref_exit
mov r3, r1
strex r4, r3, [r0]
cmp r4, #1
beq arm_lock_storeifref_loop
arm_lock_storeifref_exit:
mov r0, r3
pop {r4}
bx lr
+34
View File
@@ -0,0 +1,34 @@
#ifndef __ARM_LOCK_HELPER__H__
#define __ARM_LOCK_HELPER__H__
#include <stdint.h>
// LDREXB of ADDR
extern uint8_t arm_lock_read_b(void* addr);
// STREXB of ADDR, return 0 if ok, 1 if not
extern int arm_lock_write_b(void* addr, uint8_t val);
// LDREXH of ADDR
extern uint16_t arm_lock_read_h(void* addr);
// STREXH of ADDR, return 0 if ok, 1 if not
extern int arm_lock_write_h(void* addr, uint16_t val);
// LDREX of ADDR
extern uint32_t arm_lock_read_d(void* addr);
// STREX of ADDR, return 0 if ok, 1 if not
extern int arm_lock_write_d(void* addr, uint32_t val);
// LDREXD of ADDR
extern void arm_lock_read_dd(uint32_t* a, uint32_t* b, void* addr);
// STREX of ADDR, return 0 if ok, 1 if not
extern int arm_lock_write_dd(uint32_t a, uint32_t b, void* addr);
// Atomically exchange value at [p] with val, return old p
extern uintptr_t arm_lock_xchg(void* p, uintptr_t val);
// Atomically store value to [p] only if [p] is NULL. Return new [p] value (so val or old)
extern void* arm_lock_storeifnull(void* p, void* val);
// Atomically store value to [p] only if [p] is ref. Return new [p] value (so val or old)
extern void* arm_lock_storeifref(void* p, void* val, void* ref);
#endif //__ARM_LOCK_HELPER__H__
+23
View File
@@ -0,0 +1,23 @@
//arm update linker table for dynarec
//called with pointer to emu as 1st parameter
//and address of table to as 2nd parameter
//ip is at r12
.text
.align 4
.extern LinkNext
.global arm_next
arm_next:
// emu is r0
//stm r0, {r4-r12,r14} // don't put put back reg value in emu, faster but more tricky to debug
// IP address is r1
push {r0, r1, r12, r14}
// call the function
bl LinkNext
// return offset is jump address
mov r3, r0
pop {r0, r1, r12, r14}
bx r3
File diff suppressed because it is too large. Load diff
+6
View File
@@ -0,0 +1,6 @@
#ifndef _ARM_PRINTER_H_
#define _ARM_PRINTER_H_
const char* arm_print(uint32_t opcode);
#endif //_ARM_PRINTER_H_
+19
View File
@@ -0,0 +1,19 @@
//arm prologue for dynarec
//Save stuff, prepare stack and register
//called with pointer to emu as 1st parameter
//and address to jump to as 2nd parameter
.text
.align 4
.global arm_prolog
arm_prolog:
//save all used register
push {r4-r11, lr}
vpush {d8-d15}
//setup emu -> register
//push {r0}
ldm r0, {r4-r12} // all 8 register in direct access, plus flags, no EIP (so r14 can be used as scratch)
//TODO
//jump to function
bx r1
+424
View File
@@ -0,0 +1,424 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "tools/bridge_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynablock.h"
#include "dynablock_private.h"
#include "dynarec_private.h"
#include "elfloader.h"
#ifdef ARM
#include "dynarec_arm.h"
#include "arm_lock_helper.h"
#else
#error Unsupported architecture!
#endif
#include "custommem.h"
#include "khash.h"
KHASH_MAP_INIT_INT(dynablocks, dynablock_t*)
uint32_t X31_hash_code(void* addr, int len)
{
if(!len) return 0;
uint8_t* p = (uint8_t*)addr;
int32_t h = *p;
for (--len, ++p; len; --len, ++p) h = (h << 5) - h + (int32_t)*p;
return (uint32_t)h;
}
dynablocklist_t* NewDynablockList(uintptr_t text, int textsz, int direct)
{
if(!textsz) {
printf_log(LOG_NONE, "Error, creating a NULL sized Dynablock\n");
return NULL;
}
dynablocklist_t* ret = (dynablocklist_t*)calloc(1, sizeof(dynablocklist_t));
ret->text = text;
ret->textsz = textsz;
if(direct && textsz) {
ret->direct = (dynablock_t**)calloc(textsz, sizeof(dynablock_t*));
if(!ret->direct) {printf_log(LOG_NONE, "Warning, fail to create direct block for dynablock @%p\n", (void*)text);}
}
dynarec_log(LOG_DEBUG, "New Dynablocklist %p, from %p->%p\n", ret, (void*)text, (void*)(text+textsz));
return ret;
}
void FreeDynablock(dynablock_t* db)
{
if(db) {
dynarec_log(LOG_DEBUG, "FreeDynablock(%p), db->block=%p x86=%p:%p father=%p, with %d son(s) already gone=%d\n", db, db->block, db->x86_addr, db->x86_addr+db->x86_size, db->father, db->sons_size, db->gone);
if(db->gone)
return; // already in the process of deletion!
db->done = 0;
db->gone = 1;
// remove from direct if there
uintptr_t startdb = db->parent->text;
uintptr_t enddb = db->parent->text + db->parent->textsz;
if(db->parent->direct) {
uintptr_t addr = (uintptr_t)db->x86_addr;
if(addr>=startdb && addr<enddb)
db->parent->direct[addr-startdb] = NULL;
}
// remove jumptable
setJumpTableDefault(db->x86_addr);
// remove and free the sons
for (int i=0; i<db->sons_size; ++i) {
dynablock_t *son = (dynablock_t*)arm_lock_xchg(&db->sons[i], 0);
FreeDynablock(son);
}
// only the father free the DynarecMap
if(!db->father) {
dynarec_log(LOG_DEBUG, " -- FreeDyrecMap(%p, %d)\n", db->block, db->size);
FreeDynarecMap(db, (uintptr_t)db->block, db->size);
}
free(db->sons);
free(db->instsize);
free(db);
}
}
void FreeDynablockList(dynablocklist_t** dynablocks)
{
if(!dynablocks)
return;
if(!*dynablocks)
return;
dynarec_log(LOG_DEBUG, "Free Dynablocklist %p, with Direct Blocks %p\n", *dynablocks, (*dynablocks)->direct);
if((*dynablocks)->direct) {
for (int i=0; i<(*dynablocks)->textsz; ++i) {
if((*dynablocks)->direct[i] && !(*dynablocks)->direct[i]->father)
FreeDynablock((*dynablocks)->direct[i]);
}
free((*dynablocks)->direct);
}
(*dynablocks)->direct = NULL;
free(*dynablocks);
*dynablocks = NULL;
}
void MarkDynablock(dynablock_t* db)
{
if(db) {
if(db->father)
db = db->father; // mark only father
if(db->need_test)
return; // already done
db->need_test = 1; // test only blocks that can be marked (and so deleted)
setJumpTableDefault(db->x86_addr);
for(int i=0; i<db->sons_size; ++i)
setJumpTableDefault(db->sons[i]->x86_addr);
}
}
uintptr_t StartDynablockList(dynablocklist_t* db)
{
if(db)
return db->text;
return 0;
}
uintptr_t EndDynablockList(dynablocklist_t* db)
{
if(db)
return db->text+db->textsz-1;
return 0;
}
int IntervalIntersects(uintptr_t start1, uintptr_t end1, uintptr_t start2, uintptr_t end2)
{
if(start1 > end2 || start2 > end1)
return 0;
return 1;
}
void MarkDirectDynablock(dynablocklist_t* dynablocks, uintptr_t addr, uintptr_t size)
{
if(!dynablocks)
return;
if(!dynablocks->direct)
return;
uintptr_t startdb = dynablocks->text;
uintptr_t enddb = startdb + dynablocks->textsz -1;
uintptr_t start = addr;
uintptr_t end = addr+size-1;
if(start<startdb)
start = startdb;
if(end>enddb)
end = enddb;
dynablock_t *db;
if(end>startdb && start<enddb)
for(uintptr_t i = start; i<end; ++i)
if((db=dynablocks->direct[i-startdb]))
if(IntervalIntersects((uintptr_t)db->x86_addr, (uintptr_t)db->x86_addr+db->x86_size-1, addr, addr+size+1))
MarkDynablock(db);
}
void FreeRangeDynablock(dynablocklist_t* dynablocks, uintptr_t addr, uintptr_t size)
{
if(!dynablocks)
return;
if(dynablocks->direct) {
dynablock_t* db;
int ret;
khint_t k;
kh_dynablocks_t *blocks = kh_init(dynablocks);
// copy in a temporary list
if(dynablocks->direct) {
uintptr_t startdb = dynablocks->text;
uintptr_t enddb = startdb + dynablocks->textsz;
uintptr_t start = addr;
uintptr_t end = addr+size;
if(start<startdb)
start = startdb;
if(end>enddb)
end = enddb;
if(end>startdb && start<enddb)
for(uintptr_t i = start; i<end; ++i) {
db = (dynablock_t*)arm_lock_xchg(&dynablocks->direct[i-startdb], 0);
if(db) {
if(db->father)
db = db->father;
if(db->parent==dynablocks) {
k = kh_put(dynablocks, blocks, (uintptr_t)db, &ret);
kh_value(blocks, k) = db;
}
}
}
}
// purge the list
kh_foreach_value(blocks, db,
FreeDynablock(db);
);
kh_destroy(dynablocks, blocks);
}
}
void MarkRangeDynablock(dynablocklist_t* dynablocks, uintptr_t addr, uintptr_t size)
{
if(!dynablocks)
return;
if(dynablocks->direct) {
uintptr_t new_addr = addr - dynablocks->maxsz;
uintptr_t new_size = size + dynablocks->maxsz;
MarkDirectDynablock(dynablocks, new_addr, new_size);
// the blocks check before
for(int idx=(new_addr)>>DYNAMAP_SHIFT; idx<(addr>>DYNAMAP_SHIFT); ++idx)
MarkDirectDynablock(getDB(idx), new_addr, new_size);
}
}
dynablock_t* FindDynablockDynablocklist(void* addr, kh_dynablocks_t* dynablocks)
{
if(!dynablocks)
return NULL;
dynablock_t* db;
kh_foreach_value(dynablocks, db,
const uintptr_t s = (uintptr_t)db->block;
const uintptr_t e = (uintptr_t)db->block+db->size;
if((uintptr_t)addr>=s && (uintptr_t)addr<e)
return db->father?db->father:db;
)
return NULL;
}
static dynablocklist_t* getDBFromAddress(uintptr_t addr)
{
const int idx = (addr>>DYNAMAP_SHIFT);
return getDB(idx);
}
dynablock_t *AddNewDynablock(dynablocklist_t* dynablocks, uintptr_t addr, int* created)
{
if(!dynablocks) {
dynarec_log(LOG_INFO, "Warning: Ask to create a dynablock with a NULL dynablocklist (addr=%p)\n", (void*)addr);
*created = 0;
return NULL;
}
if((addr<dynablocks->text) || (addr>=(dynablocks->text+dynablocks->textsz))) {
// this should be useless
//dynarec_log(LOG_INFO, "Warning: Refused to create a Direct Block that is out-of-bound: dynablocks=%p (%p:%p), addr=%p\n", dynablocks, (void*)(dynablocks->text), (void*)(dynablocks->text+dynablocks->textsz), (void*)addr);
//*created = 0;
//return NULL;
return AddNewDynablock(getDBFromAddress(addr), addr, created);
}
dynablock_t* block = NULL;
// first, check if it exist in direct access mode
if(dynablocks->direct) {
block = dynablocks->direct[addr-dynablocks->text];
if(block) {
dynarec_log(LOG_DUMP, "Block already exist in Direct Map\n");
*created = 0;
return block;
}
}
if (!*created)
return block;
if(!dynablocks->direct) {
dynablock_t** p = (dynablock_t**)calloc(dynablocks->textsz, sizeof(dynablock_t*));
if(arm_lock_storeifnull(&dynablocks->direct, p)!=p)
free(p); // someone already create the direct array, too late...
}
// create and add new block
dynarec_log(LOG_DUMP, "Ask for DynaRec Block creation @%p\n", (void*)addr);
block = (dynablock_t*)calloc(1, sizeof(dynablock_t));
block->parent = dynablocks;
dynablock_t* tmp = (dynablock_t*)arm_lock_storeifnull(&dynablocks->direct[addr-dynablocks->text], block);
if(tmp != block) {
// a block appeard!
free(block);
*created = 0;
return tmp;
}
*created = 1;
return block;
}
/*
return NULL if block is not found / cannot be created.
Don't create if create==0
*/
static dynablock_t* internalDBGetBlock(x86emu_t* emu, uintptr_t addr, uintptr_t filladdr, int create, dynablock_t* current)
{
// try the quickest way first: get parent of current and check if ok!
dynablocklist_t *dynablocks = NULL;
dynablock_t* block = NULL;
if(current) {
dynablocks = current->parent;
if(dynablocks && !(addr>=dynablocks->text && addr<(dynablocks->text+dynablocks->textsz)))
dynablocks = NULL;
}
// nope, lets do the long way
if(!dynablocks) {
dynablocks = getDBFromAddress(addr);
if(!dynablocks) {
dynablocks = GetDynablocksFromAddress(emu->context, addr);
if(!dynablocks)
return NULL;
}
}
// check direct first, without lock
if(dynablocks->direct/* && (addr>=dynablocks->text) && (addr<(dynablocks->text+dynablocks->textsz))*/)
if((block = dynablocks->direct[addr-dynablocks->text]))
return block;
int created = create;
block = AddNewDynablock(dynablocks, addr, &created);
if(!created)
return block; // existing block...
#if 0
if(box86_dynarec_dump)
pthread_mutex_lock(&my_context->mutex_dyndump);
#endif
// fill the block
block->x86_addr = (void*)addr;
pthread_mutex_lock(&my_context->mutex_dyndump);
void* ret = FillBlock(block, filladdr);
pthread_mutex_unlock(&my_context->mutex_dyndump);
if(!ret) {
dynarec_log(LOG_DEBUG, "Fillblock of block %p for %p returned an error\n", block, (void*)addr);
void* old = (void*)arm_lock_storeifref(&dynablocks->direct[addr-dynablocks->text], 0, block);
if(old!=block && old) { // put it back in place, strange things are happening here!
dynarec_log(LOG_INFO, "Warning, a wild block appeared at %p: %p\n", (void*)addr, old);
// Doing nothing else, the block has not been written
}
free(block);
block = NULL;
}
#if 0
if(box86_dynarec_dump)
pthread_mutex_unlock(&my_context->mutex_dyndump);
#endif
// check size
if(block && block->x86_size) {
int blocksz = block->x86_size;
if(dynablocks->maxsz<blocksz) {
dynablocks->maxsz = blocksz;
for(int idx=(addr>>DYNAMAP_SHIFT)+1; idx<=((addr+blocksz)>>DYNAMAP_SHIFT); ++idx) {
dynablocklist_t* dblist;
if((dblist = getDB(idx)))
if(dblist->maxsz<blocksz)
dblist->maxsz = blocksz;
}
}
protectDB((uintptr_t)block->x86_addr, block->x86_size);
// fill-in jumptable
addJumpTableIfDefault(block->x86_addr, block->block);
for(int i=0; i<block->sons_size; ++i)
addJumpTableIfDefault(block->sons[i]->x86_addr, block->sons[i]->block);
}
dynarec_log(LOG_DEBUG, " --- DynaRec Block %s @%p:%p (%p, 0x%x bytes, with %d son(s))\n", created?"created":"recycled", (void*)addr, (void*)(addr+((block)?block->x86_size:0)), (block)?block->block:0, (block)?block->size:0, (block)?block->sons_size:0);
return block;
}
dynablock_t* DBGetBlock(x86emu_t* emu, uintptr_t addr, int create, dynablock_t** current)
{
dynablock_t *db = internalDBGetBlock(emu, addr, addr, create, *current);
if(db && db->done && db->block && (db->need_test || (db->father && db->father->need_test))) {
dynablock_t *father = db->father?db->father:db;
uint32_t hash = X31_hash_code(father->x86_addr, father->x86_size);
if(hash!=father->hash) {
dynarec_log(LOG_DEBUG, "Invalidating block %p from %p:%p (hash:%X/%X) with %d son(s) for %p\n", father, father->x86_addr, father->x86_addr+father->x86_size, hash, father->hash, father->sons_size, (void*)addr);
// no more current if it gets invalidated too
if(*current && father->x86_addr>=(*current)->x86_addr && (father->x86_addr+father->x86_size)<(*current)->x86_addr)
*current = NULL;
// Free father, it's now invalid!
FreeDynablock(father);
// start again... (will create a new block)
db = internalDBGetBlock(emu, addr, addr, create, *current);
} else {
father->need_test = 0;
protectDB((uintptr_t)father->x86_addr, father->x86_size);
// fill back jumptable
addJumpTableIfDefault(father->x86_addr, father->block);
for(int i=0; i<father->sons_size; ++i)
addJumpTableIfDefault(father->sons[i]->x86_addr, father->sons[i]->block);
}
}
return db;
}
dynablock_t* DBAlternateBlock(x86emu_t* emu, uintptr_t addr, uintptr_t filladdr)
{
dynarec_log(LOG_DEBUG, "Creating AlternateBlock at %p for %p\n", (void*)addr, (void*)filladdr);
int create = 1;
dynablock_t *db = internalDBGetBlock(emu, addr, filladdr, create, NULL);
if(db && db->done && db->block && (db->need_test || (db->father && db->father->need_test))) {
dynablock_t *father = db->father?db->father:db;
uint32_t hash = X31_hash_code(father->x86_addr, father->x86_size);
if(hash!=father->hash) {
dynarec_log(LOG_DEBUG, "Invalidating alt block %p from %p:%p (hash:%X/%X) with %d son(s) for %p\n", father, father->x86_addr, father->x86_addr+father->x86_size, hash, father->hash, father->sons_size, (void*)addr);
// Free father, it's now invalid!
FreeDynablock(father);
// start again... (will create a new block)
db = internalDBGetBlock(emu, addr, filladdr, create, NULL);
} else {
father->need_test = 0;
protectDB((uintptr_t)father->x86_addr, father->x86_size);
// fill back jumptable
addJumpTableIfDefault(father->x86_addr, father->block);
for(int i=0; i<father->sons_size; ++i)
addJumpTableIfDefault(father->sons[i]->x86_addr, father->sons[i]->block);
}
}
return db;
}
+36
View File
@@ -0,0 +1,36 @@
#ifndef __DYNABLOCK_PRIVATE_H_
#define __DYNABLOCK_PRIVATE_H_
typedef struct dynablocklist_s dynablocklist_t;
typedef struct instsize_s {
unsigned int x86:4;
unsigned int nat:4;
} instsize_t;
typedef struct dynablock_s {
dynablocklist_t* parent;
void* block;
int size;
void* x86_addr;
uintptr_t x86_size;
uint32_t hash;
uint8_t need_test;
uint8_t done;
uint8_t gone;
uint8_t dummy;
int isize;
dynablock_t** sons; // sons (kind-of dummy dynablock...)
int sons_size;
dynablock_t* father; // set only in the case of a son
instsize_t* instsize;
} dynablock_t;
typedef struct dynablocklist_s {
uintptr_t text;
int textsz;
int maxsz; // maxblock size (for this block or previous block)
dynablock_t** direct; // direct mapping (waste of space, so the array is created at first write)
} dynablocklist_t;
#endif //__DYNABLOCK_PRIVATE_H_
+226
View File
@@ -0,0 +1,226 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include <setjmp.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "tools/bridge_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "threads.h"
#ifdef DYNAREC
#include "dynablock.h"
#include "dynablock_private.h"
#endif
#ifdef ARM
void arm_prolog(x86emu_t* emu, void* addr) EXPORTDYN;
void arm_epilog() EXPORTDYN;
void arm_epilog_fast() EXPORTDYN;
#endif
#ifdef DYNAREC
#ifdef HAVE_TRACE
uintptr_t getX86Address(dynablock_t* db, uintptr_t arm_addr);
#endif
void* LinkNext(x86emu_t* emu, uintptr_t addr, void* x2)
{
#ifdef HAVE_TRACE
if(!addr) {
x2-=8; // actual PC is 2 instructions ahead
dynablock_t* db = FindDynablockFromNativeAddress(x2);
printf_log(LOG_NONE, "Warning, jumping to NULL address from %p (db=%p, x86addr=%p)\n", x2, db, db?(void*)getX86Address(db, (uintptr_t)x2):NULL);
}
#endif
dynablock_t* current = NULL;
void * jblock;
dynablock_t* block = DBGetBlock(emu, addr, 1, &current);
if(!block) {
// no block, let link table as is...
#ifdef HAVE_TRACE
dynablock_t* db = FindDynablockFromNativeAddress(x2);
printf_log(LOG_INFO, "Warning, jumping to a no-block address from %p (db=%p, x86addr=%p)\n", x2, db, db?(void*)getX86Address(db, (uintptr_t)x2):NULL);
#endif
//tableupdate(arm_epilog, addr, table);
return arm_epilog;
}
if(!block->done) {
// not finished yet... leave linker
//tableupdate(arm_linker, addr, table);
return arm_epilog;
}
if(!(jblock=block->block)) {
// null block, but done: go to epilog, no linker here
return arm_epilog;
}
//dynablock_t *father = block->father?block->father:block;
return jblock;
}
#endif
void DynaCall(x86emu_t* emu, uintptr_t addr)
{
// prepare setjump for signal handling
emu_jmpbuf_t *ejb = NULL;
int jmpbuf_reset = 0;
if(emu->type == EMUTYPE_MAIN) {
ejb = GetJmpBuf();
if(!ejb->jmpbuf_ok) {
ejb->emu = emu;
ejb->jmpbuf_ok = 1;
jmpbuf_reset = 1;
int a;
if((a=sigsetjmp((struct __jmp_buf_tag*)ejb->jmpbuf, 1))) {
printf_log(LOG_DEBUG, "Setjmp DynaCall %d, fs=0x%x\n", a, ejb->emu->segs[_FS]);
addr = R_EIP; // not sure if it should still be inside DynaCall!
if(a==2)
Run(emu, 1); // "single step" next instruction that is doing auto-smc
}
}
}
#ifdef DYNAREC
if(!box86_dynarec)
#endif
EmuCall(emu, addr);
#ifdef DYNAREC
else {
uint32_t old_esp = R_ESP;
uint32_t old_ebx = R_EBX;
uint32_t old_edi = R_EDI;
uint32_t old_esi = R_ESI;
uint32_t old_ebp = R_EBP;
uint32_t old_eip = R_EIP;
PushExit(emu);
R_EIP = addr;
emu->df = d_none;
dynablock_t* block = NULL;
dynablock_t* current = NULL;
while(!emu->quit) {
block = DBGetBlock(emu, R_EIP, 1, &current);
current = block;
if(!block || !block->block || !block->done) {
// no block, of block doesn't have DynaRec content (yet, temp is not null)
// Use interpreter (should use single instruction step...)
dynarec_log(LOG_DEBUG, "%04d|Calling Interpretor @%p, emu=%p\n", GetTID(), (void*)R_EIP, emu);
Run(emu, 1);
} else {
dynarec_log(LOG_DEBUG, "%04d|Calling DynaRec Block @%p (%p) of %d x86 instructions (father=%p) emu=%p\n", GetTID(), (void*)R_EIP, block->block, block->isize ,block->father, emu);
CHECK_FLAGS(emu);
// block is here, let's run it!
#ifdef ARM
arm_prolog(emu, block->block);
#endif
}
if(emu->fork) {
int forktype = emu->fork;
emu->quit = 0;
emu->fork = 0;
emu = x86emu_fork(emu, forktype);
if(emu->type == EMUTYPE_MAIN) {
ejb = GetJmpBuf();
ejb->emu = emu;
ejb->jmpbuf_ok = 1;
jmpbuf_reset = 1;
if(sigsetjmp((struct __jmp_buf_tag*)ejb->jmpbuf, 1)) {
printf_log(LOG_DEBUG, "Setjmp inner DynaCall, fs=0x%x\n", ejb->emu->segs[_FS]);
addr = R_EIP;
}
}
}
}
emu->quit = 0; // reset Quit flags...
emu->df = d_none;
if(emu->quitonlongjmp && emu->longjmp) {
emu->longjmp = 0; // don't change anything because of the longjmp
} else {
R_EBX = old_ebx;
R_EDI = old_edi;
R_ESI = old_esi;
R_EBP = old_ebp;
R_ESP = old_esp;
R_EIP = old_eip; // and set back instruction pointer
}
}
#endif
// clear the setjmp
if(ejb && jmpbuf_reset)
ejb->jmpbuf_ok = 0;
}
int DynaRun(x86emu_t* emu)
{
// prepare setjump for signal handling
emu_jmpbuf_t *ejb = NULL;
#ifdef DYNAREC
int jmpbuf_reset = 1;
#endif
if(emu->type == EMUTYPE_MAIN) {
ejb = GetJmpBuf();
if(!ejb->jmpbuf_ok) {
ejb->emu = emu;
ejb->jmpbuf_ok = 1;
int a;
#ifdef DYNAREC
jmpbuf_reset = 1;
#endif
if((a=sigsetjmp((struct __jmp_buf_tag*)ejb->jmpbuf, 1))) {
printf_log(LOG_DEBUG, "Setjmp DynaRun %d, fs=0x%x\n", a, ejb->emu->segs[_FS]);
if(a==2)
Run(emu, 1); // "single step" next instruction that is doing auto-smc
}
}
}
#ifdef DYNAREC
if(!box86_dynarec)
#endif
return Run(emu, 0);
#ifdef DYNAREC
else {
dynablock_t* block = NULL;
dynablock_t* current = NULL;
while(!emu->quit) {
block = DBGetBlock(emu, R_EIP, 1, &current);
current = block;
if(!block || !block->block || !block->done) {
// no block, of block doesn't have DynaRec content (yet, temp is not null)
// Use interpreter (should use single instruction step...)
dynarec_log(LOG_DEBUG, "%04d|Running Interpretor @%p, emu=%p\n", GetTID(), (void*)R_EIP, emu);
Run(emu, 1);
} else {
dynarec_log(LOG_DEBUG, "%04d|Running DynaRec Block @%p (%p) of %d x86 insts (father=%p) emu=%p\n", GetTID(), (void*)R_EIP, block->block, block->isize, block->father, emu);
// block is here, let's run it!
#ifdef ARM
arm_prolog(emu, block->block);
#endif
}
if(emu->fork) {
int forktype = emu->fork;
emu->quit = 0;
emu->fork = 0;
emu = x86emu_fork(emu, forktype);
if(emu->type == EMUTYPE_MAIN) {
ejb = GetJmpBuf();
ejb->emu = emu;
ejb->jmpbuf_ok = 1;
jmpbuf_reset = 1;
if(sigsetjmp((struct __jmp_buf_tag*)ejb->jmpbuf, 1))
printf_log(LOG_DEBUG, "Setjmp inner DynaRun, fs=0x%x\n", ejb->emu->segs[_FS]);
}
}
}
}
// clear the setjmp
if(ejb && jmpbuf_reset)
ejb->jmpbuf_ok = 0;
return 0;
#endif
}
+466
View File
@@ -0,0 +1,466 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include "debug.h"
#include "box86context.h"
#include "custommem.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "tools/bridge_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynablock.h"
#include "dynablock_private.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "dynarec_arm_functions.h"
#include "elfloader.h"
void printf_x86_instruction(zydis_dec_t* dec, instruction_x86_t* inst, const char* name) {
uint8_t *ip = (uint8_t*)inst->addr;
if(ip[0]==0xcc && ip[1]=='S' && ip[2]=='C') {
uint32_t a = *(uint32_t*)(ip+3);
if(a==0) {
dynarec_log(LOG_NONE, "%s%p: Exit x86emu%s\n", (box86_dynarec_dump>1)?"\e[1m":"", (void*)ip, (box86_dynarec_dump>1)?"\e[m":"");
} else {
dynarec_log(LOG_NONE, "%s%p: Native call to %p%s\n", (box86_dynarec_dump>1)?"\e[1m":"", (void*)ip, (void*)a, (box86_dynarec_dump>1)?"\e[m":"");
}
} else {
if(dec) {
dynarec_log(LOG_NONE, "%s%p: %s", (box86_dynarec_dump>1)?"\e[1m":"", ip, DecodeX86Trace(dec, inst->addr));
} else {
dynarec_log(LOG_NONE, "%s%p: ", (box86_dynarec_dump>1)?"\e[1m":"", ip);
for(int i=0; i<inst->size; ++i) {
dynarec_log(LOG_NONE, "%02X ", ip[i]);
}
dynarec_log(LOG_NONE, " %s", name);
}
// print Call function name if possible
if(ip[0]==0xE8 || ip[0]==0xE9) { // Call / Jmp
uintptr_t nextaddr = (uintptr_t)ip + 5 + *((int32_t*)(ip+1));
printFunctionAddr(nextaddr, "=> ");
} else if(ip[0]==0xFF) {
if(ip[1]==0x25) {
uintptr_t nextaddr = (uintptr_t)ip + 6 + *((int32_t*)(ip+2));
printFunctionAddr(nextaddr, "=> ");
}
}
// end of line and colors
dynarec_log(LOG_NONE, "%s\n", (box86_dynarec_dump>1)?"\e[m":"");
}
}
void add_next(dynarec_arm_t *dyn, uintptr_t addr) {
if(dyn->next_sz == dyn->next_cap) {
dyn->next_cap += 16;
dyn->next = (uintptr_t*)realloc(dyn->next, dyn->next_cap*sizeof(uintptr_t));
}
for(int i=0; i<dyn->next_sz; ++i)
if(dyn->next[i]==addr)
return;
dyn->next[dyn->next_sz++] = addr;
}
uintptr_t get_closest_next(dynarec_arm_t *dyn, uintptr_t addr) {
// get closest, but no addresses befores
uintptr_t best = 0;
int i = 0;
while((i<dyn->next_sz) && (best!=addr)) {
if(dyn->next[i]<addr) { // remove the address, it's before current address
memmove(dyn->next+i, dyn->next+i+1, (dyn->next_sz-i-1)*sizeof(uintptr_t));
--dyn->next_sz;
} else {
if((dyn->next[i]<best) || !best)
best = dyn->next[i];
++i;
}
}
return best;
}
#define PK(A) (*((uint8_t*)(addr+(A))))
int is_nops(dynarec_arm_t *dyn, uintptr_t addr, int n)
{
if(!n)
return 1;
if(PK(0)==0x90)
return is_nops(dyn, addr+1, n-1);
if(n>1 && PK(0)==0x66) // if opcode start with 0x66, and there is more after, than is *can* be a NOP
return is_nops(dyn, addr+1, n-1);
if(n>2 && PK(0)==0x0f && PK(1)==0x1f && PK(2)==0x00)
return is_nops(dyn, addr+3, n-3);
if(n>2 && PK(0)==0x8d && PK(1)==0x76 && PK(2)==0x00) // lea esi, [esi]
return is_nops(dyn, addr+3, n-3);
if(n>3 && PK(0)==0x0f && PK(1)==0x1f && PK(2)==0x40 && PK(3)==0x00)
return is_nops(dyn, addr+4, n-4);
if(n>3 && PK(0)==0x8d && PK(1)==0x74 && PK(2)==0x26 && PK(3)==0x00)
return is_nops(dyn, addr+4, n-4);
if(n>4 && PK(0)==0x0f && PK(1)==0x1f && PK(2)==0x44 && PK(3)==0x00 && PK(4)==0x00)
return is_nops(dyn, addr+5, n-5);
if(n>5 && PK(0)==0x8d && PK(1)==0xb6 && PK(2)==0x00 && PK(3)==0x00 && PK(4)==0x00 && PK(5)==0x00)
return is_nops(dyn, addr+6, n-6);
if(n>6 && PK(0)==0x0f && PK(1)==0x1f && PK(2)==0x80 && PK(3)==0x00 && PK(4)==0x00 && PK(5)==0x00 && PK(6)==0x00)
return is_nops(dyn, addr+7, n-7);
if(n>6 && PK(0)==0x8d && PK(1)==0xb4 && PK(2)==0x26 && PK(3)==0x00 && PK(4)==0x00 && PK(5)==0x00 && PK(6)==0x00) // lea esi, [esi+0]
return is_nops(dyn, addr+7, n-7);
if(n>7 && PK(0)==0x0f && PK(1)==0x1f && PK(2)==0x84 && PK(3)==0x00 && PK(4)==0x00 && PK(5)==0x00 && PK(6)==0x00 && PK(7)==0x00)
return is_nops(dyn, addr+8, n-8);
return 0;
}
// return size of next instuciton, -1 is unknown
// not all instrction are setup
int next_instruction(dynarec_arm_t *dyn, uintptr_t addr)
{
uint8_t opcode = PK(0);
uint8_t nextop;
switch (opcode) {
case 0x66:
opcode = PK(1);
switch(opcode) {
case 0x90:
return 2;
}
break;
case 0x81:
nextop = PK(1);
return fakeed(dyn, addr+2, 0, nextop)-addr + 4;
case 0x83:
nextop = PK(1);
return fakeed(dyn, addr+2, 0, nextop)-addr + 1;
case 0x84:
case 0x85:
case 0x88:
case 0x89:
case 0x8A:
case 0x8B:
case 0x8C:
case 0x8D:
case 0x8E:
case 0x8F:
nextop = PK(1);
return fakeed(dyn, addr+2, 0, nextop)-addr;
case 0x50:
case 0x51:
case 0x52:
case 0x53:
case 0x54:
case 0x55:
case 0x56:
case 0x57:
case 0x58:
case 0x59:
case 0x5A:
case 0x5B:
case 0x5C:
case 0x5D:
case 0x5E:
case 0x5F:
case 0x90:
case 0x91:
case 0x92:
case 0x93:
case 0x94:
case 0x95:
case 0x96:
case 0x97:
case 0x98:
case 0x99:
case 0x9B:
case 0x9C:
case 0x9D:
case 0x9E:
case 0x9F:
return 1;
case 0xA0:
case 0xA1:
case 0xA2:
case 0xA3:
return 5;
case 0xB0:
case 0xB1:
case 0xB2:
case 0xB3:
case 0xB4:
case 0xB5:
case 0xB6:
case 0xB7:
return 2;
case 0xB8:
case 0xB9:
case 0xBA:
case 0xBB:
case 0xBC:
case 0xBD:
case 0xBE:
case 0xBF:
return 5;
case 0xFF:
nextop = PK(1);
switch((nextop>>3)&7) {
case 0: // INC Ed
case 1: //DEC Ed
case 2: // CALL Ed
case 4: // JMP Ed
case 6: // Push Ed
return fakeed(dyn, addr+2, 0, nextop)-addr;
}
break;
default:
break;
}
return -1;
}
#undef PK
int is_instructions(dynarec_arm_t *dyn, uintptr_t addr, int n)
{
int i = 0;
while(i<n) {
int j=next_instruction(dyn, addr+i);
if(j<=0) return 0;
i+=j;
}
return (i==n)?1:0;
}
uint32_t needed_flags(dynarec_arm_t *dyn, int ninst, uint32_t setf, int recurse)
{
if(recurse == 10)
return X_PEND;
if(ninst == dyn->size)
return X_PEND; // no more instructions, or too many jmp loop, stop
uint32_t needed = dyn->insts[ninst].x86.use_flags;
if(needed) {
setf &= ~needed;
if(!setf) // all flags already used, no need to continue
return needed;
}
if(!needed && !dyn->insts[ninst].x86.set_flags && !dyn->insts[ninst].x86.jmp_insts) {
int start = ninst;
int end = ninst;
while(end<dyn->size && !dyn->insts[end].x86.use_flags && !dyn->insts[end].x86.set_flags && !dyn->insts[end].x86.jmp_insts)
++end;
needed = needed_flags(dyn, end, setf, recurse);
for(int i=start; i<end; ++i)
dyn->insts[i].x86.need_flags = needed;
return needed;
}
if(dyn->insts[ninst].x86.set_flags && (dyn->insts[ninst].x86.state_flags!=SF_MAYSET)) {
if((setf & ~dyn->insts[ninst].x86.set_flags) == 0)
return needed; // all done, gives all the flags needed
setf |= dyn->insts[ninst].x86.set_flags; // add new flags to continue
}
int jinst = dyn->insts[ninst].x86.jmp_insts;
if(dyn->insts[ninst].x86.jmp) {
dyn->insts[ninst].x86.need_flags = (jinst==-1)?X_PEND:needed_flags(dyn, jinst, setf, recurse+1);
if(dyn->insts[ninst].x86.use_flags) // conditionnal jump
dyn->insts[ninst].x86.need_flags |= needed_flags(dyn, ninst+1, setf, recurse);
} else
dyn->insts[ninst].x86.need_flags = needed_flags(dyn, ninst+1, setf, recurse);
if(dyn->insts[ninst].x86.state_flags==SF_MAYSET)
needed |= dyn->insts[ninst].x86.need_flags;
else
needed |= (dyn->insts[ninst].x86.need_flags & ~dyn->insts[ninst].x86.set_flags);
if(needed == (X_PEND|X_ALL))
needed = X_ALL;
return needed;
}
instsize_t* addInst(instsize_t* insts, size_t* size, size_t* cap, int x86_size, int arm_size)
{
// x86 instruction is <16 bytes
int toadd;
if(x86_size>arm_size)
toadd = 1 + x86_size/15;
else
toadd = 1 + arm_size/15;
if((*size)+toadd>(*cap)) {
*cap = (*size)+toadd;
insts = (instsize_t*)realloc(insts, (*cap)*sizeof(instsize_t));
}
while(toadd) {
if(x86_size>15)
insts[*size].x86 = 15;
else
insts[*size].x86 = x86_size;
x86_size -= insts[*size].x86;
if(arm_size>15)
insts[*size].nat = 15;
else
insts[*size].nat = arm_size;
arm_size -= insts[*size].nat;
++(*size);
--toadd;
}
return insts;
}
uintptr_t arm_pass0(dynarec_arm_t* dyn, uintptr_t addr);
uintptr_t arm_pass1(dynarec_arm_t* dyn, uintptr_t addr);
uintptr_t arm_pass2(dynarec_arm_t* dyn, uintptr_t addr);
uintptr_t arm_pass3(dynarec_arm_t* dyn, uintptr_t addr);
void* FillBlock(dynablock_t* block, uintptr_t addr) {
dynarec_log(LOG_DEBUG, "Asked to Fill block %p with %p\n", block, (void*)addr);
if(addr>=box86_nodynarec_start && addr<box86_nodynarec_end) {
dynarec_log(LOG_DEBUG, "Asked to fill a block in fobidden zone\n");
return NULL;
}
if(!isJumpTableDefault((void*)addr)) {
dynarec_log(LOG_DEBUG, "Asked to fill a block at %p, but JumpTable is not default\n", (void*)addr);
return NULL;
}
// init the helper
dynarec_arm_t helper = {0};
helper.start = addr;
uintptr_t start = addr;
uintptr_t end = arm_pass0(&helper, addr);
if(!helper.size) {
dynarec_log(LOG_DEBUG, "Warning, null-sized dynarec block (%p)\n", (void*)addr);
block->done = 1;
free(helper.next);
return (void*)block;
}
helper.cap = helper.size+3; // needs epilog handling
helper.insts = (instruction_arm_t*)calloc(helper.cap, sizeof(instruction_arm_t));
// already protect the block and compute hash signature
protectDB(addr, end-addr+1);
uint32_t hash = X31_hash_code((void*)addr, end-addr+1);
// pass 1, addresses, x86 jump addresses, flags
arm_pass1(&helper, addr);
// calculate barriers
for(int i=0; i<helper.size; ++i)
if(helper.insts[i].x86.jmp) {
uintptr_t j = helper.insts[i].x86.jmp;
if(j<start || j>=end)
helper.insts[i].x86.jmp_insts = -1;
else {
// find jump address instruction
int k=-1;
for(int i2=0; i2<helper.size && k==-1; ++i2) {
if(helper.insts[i2].x86.addr==j)
k=i2;
}
if(k!=-1) // -1 if not found, mmm, probably wrong, exit anyway
helper.insts[k].x86.barrier = 1;
helper.insts[i].x86.jmp_insts = k;
}
}
for(int i=0; i<helper.size; ++i)
if(helper.insts[i].x86.set_flags && !helper.insts[i].x86.need_flags) {
helper.insts[i].x86.need_flags = needed_flags(&helper, i+1, helper.insts[i].x86.set_flags, 0);
if((helper.insts[i].x86.need_flags&X_PEND) && (helper.insts[i].x86.state_flags==SF_MAYSET))
helper.insts[i].x86.need_flags = X_ALL;
}
// pass 2, instruction size
arm_pass2(&helper, addr);
// ok, now allocate mapped memory, with executable flag on
int sz = helper.arm_size;
void* p = (void*)AllocDynarecMap(block, sz);
if(p==NULL) {
dynarec_log(LOG_DEBUG, "AllocDynarecMap(%p, %d) failed, cancelling block\n", block, sz);
free(helper.insts);
free(helper.next);
return NULL;
}
helper.block = p;
helper.arm_start = (uintptr_t)p;
if(helper.sons_size) {
helper.sons_x86 = (uintptr_t*)calloc(helper.sons_size, sizeof(uintptr_t));
helper.sons_arm = (void**)calloc(helper.sons_size, sizeof(void*));
}
// pass 3, emit (log emit arm opcode)
if(box86_dynarec_dump) {
dynarec_log(LOG_NONE, "%s%04d|Emitting %d bytes for %d x86 bytes", (box86_dynarec_dump>1)?"\e[01;36m":"", GetTID(), helper.arm_size, helper.isize);
printFunctionAddr(helper.start, " => ");
dynarec_log(LOG_NONE, "%s\n", (box86_dynarec_dump>1)?"\e[m":"");
}
helper.arm_size = 0;
arm_pass3(&helper, addr);
if(sz!=helper.arm_size) {
printf_log(LOG_NONE, "BOX86: Warning, size difference in block between pass2 (%d) & pass3 (%d)!\n", sz, helper.arm_size);
uint8_t *dump = (uint8_t*)helper.start;
printf_log(LOG_NONE, "Dump of %d x86 opcodes:\n", helper.size);
for(int i=0; i<helper.size; ++i) {
printf_log(LOG_NONE, "%p:", dump);
for(; dump<(uint8_t*)helper.insts[i+1].x86.addr; ++dump)
printf_log(LOG_NONE, " %02X", *dump);
printf_log(LOG_NONE, "\t%d -> %d\n", helper.insts[i].size2, helper.insts[i].size);
}
printf_log(LOG_NONE, " ------------\n");
}
// all done...
__clear_cache(p, p+sz); // need to clear the cache before execution...
// keep size of instructions for signal handling
{
size_t cap = 1;
for(int i=0; i<helper.size; ++i)
cap += 1 + ((helper.insts[i].x86.size>helper.insts[i].size)?helper.insts[i].x86.size:helper.insts[i].size)/15;
size_t size = 0;
block->instsize = (instsize_t*)calloc(cap, sizeof(instsize_t));
for(int i=0; i<helper.size; ++i)
block->instsize = addInst(block->instsize, &size, &cap, helper.insts[i].x86.size, helper.insts[i].size/4);
block->instsize = addInst(block->instsize, &size, &cap, 0, 0); // add a "end of block" mark, just in case
}
// ok, free the helper now
free(helper.insts);
free(helper.next);
block->size = sz;
block->isize = helper.size;
block->block = p;
block->need_test = 0;
//block->x86_addr = (void*)start;
block->x86_size = end-start+1;
if(box86_dynarec_largest<block->x86_size)
box86_dynarec_largest = block->x86_size;
block->hash = X31_hash_code(block->x86_addr, block->x86_size);
// Check if something changed, to abbort if it as
if(block->hash != hash) {
dynarec_log(LOG_INFO, "Warning, a block changed while beeing processed hash(%p:%d)=%x/%x\n", block->x86_addr, block->x86_size, block->hash, hash);
free(helper.sons_x86);
free(helper.sons_arm);
FreeDynarecMap(block, (uintptr_t)p, sz);
return NULL;
}
// fill sons if any
dynablock_t** sons = NULL;
int sons_size = 0;
if(helper.sons_size) {
sons = (dynablock_t**)calloc(helper.sons_size, sizeof(dynablock_t*));
for (int i=0; i<helper.sons_size; ++i) {
int created = 1;
dynablock_t *son = AddNewDynablock(block->parent, helper.sons_x86[i], &created);
if(created) { // avoid breaking a working block!
son->block = helper.sons_arm[i];
son->x86_addr = (void*)helper.sons_x86[i];
son->x86_size = end-helper.sons_x86[i]+1;
if(!son->x86_size) {printf_log(LOG_NONE, "Warning, son with null x86 size! (@%p / ARM=%p)", son->x86_addr, son->block);}
son->father = block;
son->done = 1;
sons[sons_size++] = son;
if(!son->parent)
son->parent = block->parent;
}
}
if(sons_size) {
block->sons = sons;
block->sons_size = sons_size;
} else
free(sons);
}
free(helper.sons_x86);
free(helper.sons_arm);
block->done = 1;
return (void*)block;
}
+2654
View File
File diff suppressed because it is too large. Load diff
+2369
View File
File diff suppressed because it is too large. Load diff
+323
View File
@@ -0,0 +1,323 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecFS(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t opcode = F8;
uint8_t nextop;
int32_t i32, j32;
uint32_t u32;
uint8_t gd, ed;
uint8_t wback;
int fixedaddress;
MAYUSE(j32);
switch(opcode) {
case 0x03:
INST_NAME("ADD Gd, FS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_fsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_add32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x2B:
INST_NAME("SUB Gd, FS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_fsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_sub32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x33:
INST_NAME("XOR Gd, FS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_fsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_xor32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x3B:
INST_NAME("CMP Gd, FS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_fsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_cmp32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x67:
// reduced EA size...
opcode = F8;
switch(opcode) {
case 0x89:
INST_NAME("MOV FS:Ew16, Gw");
nextop = F8;
grab_fsdata(dyn, addr, ninst, x14);
GETGD; // don't need GETGW here
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
if(ed!=gd) {
BFI(ed, gd, 0, 16);
}
} else {
addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
STRH_REG(gd, x14, ed);
}
break;
case 0x8B:
INST_NAME("MOV Gd, FS:Ew16");
nextop=F8;
grab_fsdata(dyn, addr, ninst, x14);
GETGD;
if((nextop&0xC0)==0xC0) { // reg <= reg
MOV_REG(gd, xEAX+(nextop&7));
} else { // mem <= reg
addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(gd, ed, x14, 0);
}
break;
case 0x8F:
INST_NAME("POP FS:Ew16");
nextop=F8;
grab_fsdata(dyn, addr, ninst, x14);
if((nextop&0xC0)==0xC0) {
POP1(xEAX+(nextop&7)); // 67 ignored
} else {
addr = geted16(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
POP1(x2);
STR_REG_LSL_IMM5(x2, x1, x14, 0);
}
break;
case 0xA1:
INST_NAME("MOV EAX, FS:Ow");
grab_fsdata(dyn, addr, ninst, x1);
u32 = F16;
if(u32) {
MOV32(x2, u32);
ADD_REG_LSL_IMM5(x1, x1, x2, 0);
}
LDR_IMM9(xEAX, x1, 0);
break;
case 0xA3:
INST_NAME("MOV FS:Ow, EAX");
grab_fsdata(dyn, addr, ninst, x1);
u32 = F16;
if(u32) {
MOV32(x2, u32);
ADD_REG_LSL_IMM5(x1, x1, x2, 0);
}
STR_IMM9(xEAX, x1, 0);
break;
case 0xFF:
nextop = F8;
grab_fsdata(dyn, addr, ninst, x14);
switch((nextop>>3)&7) {
case 6: // Push Ed
INST_NAME("PUSH FS:Ew");
if((nextop&0xC0)==0xC0) { // reg
DEFAULT;
} else { // mem <= i32
addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(x3, ed, x14, 0);
PUSH1(x3);
}
break;
default:
DEFAULT;
}
break;
default:
DEFAULT;
}
break;
case 0x89:
INST_NAME("MOV FS:Ed, Gd");
grab_fsdata(dyn, addr, ninst, x14);
nextop=F8;
GETGD;
if((nextop&0xC0)==0xC0) { // reg <= reg
MOV_REG(xEAX+(nextop&7), gd);
} else { // mem <= reg
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
STR_REG_LSL_IMM5(gd, ed, x14, 0);
}
break;
case 0x8B:
INST_NAME("MOV Gd, FS:Ed");
grab_fsdata(dyn, addr, ninst, x14);
nextop=F8;
GETGD;
if((nextop&0xC0)==0xC0) { // reg <= reg
MOV_REG(gd, xEAX+(nextop&7));
} else { // mem <= reg
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(gd, ed, x14, 0);
}
break;
case 0x8F:
INST_NAME("POP FS:Ed");
grab_fsdata(dyn, addr, ninst, x14);
nextop = F8;
if((nextop&0xC0)==0xC0) {
POP1(xEAX+(nextop&7));
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
POP1(x2);
STR_REG_LSL_IMM5(x2, ed, x14, 0);
}
break;
case 0xA0:
INST_NAME("MOV AL, FS:Id");
grab_fsdata(dyn, addr, ninst, x1);
i32 = F32S;
if(i32>-4096 && i32<4096) {
LDRB_IMM9(xEAX, x1, i32);
} else {
MOV32(x2, i32);
LDRB_REG_LSL_IMM5(xEAX, x1, x2, 0);
}
break;
case 0xA1:
INST_NAME("MOV EAX, FS:Id");
grab_fsdata(dyn, addr, ninst, x1);
i32 = F32S;
if(i32>-4096 && i32<4096) {
LDR_IMM9(xEAX, x1, i32);
} else {
MOV32(x2, i32);
LDR_REG_LSL_IMM5(xEAX, x1, x2, 0);
}
break;
case 0xA2:
INST_NAME("MOV FS:Od, AL");
grab_fsdata(dyn, addr, ninst, x1);
i32 = F32S;
if(i32>-4096 && i32<4096) {
STRB_IMM9(xEAX, x1, i32);
} else {
MOV32(x2, i32);
STRB_REG_LSL_IMM5(xEAX, x1, x2, 0);
}
break;
case 0xA3:
INST_NAME("MOV FS:Od, EAX");
grab_fsdata(dyn, addr, ninst, x1);
i32 = F32S;
if(i32>-4096 && i32<4096) {
STR_IMM9(xEAX, x1, i32);
} else {
MOV32(x2, i32);
STR_REG_LSL_IMM5(xEAX, x2, x1, 0);
}
break;
case 0xC7:
INST_NAME("MOV FS:Ed, Id");
grab_fsdata(dyn, addr, ninst, x14);
nextop=F8;
if((nextop&0xC0)==0xC0) { // reg <= i32
i32 = F32S;
ed = xEAX+(nextop&7);
MOV32(ed, i32);
} else { // mem <= i32
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
i32 = F32S;
MOV32(x3, i32);
STR_REG_LSL_IMM5(x3, ed, x14, 0);
}
break;
case 0xE9:
case 0xEB:
INST_NAME("(ignored) FS:");
--addr;
break;
case 0xFF:
nextop = F8;
grab_fsdata(dyn, addr, ninst, x14);
switch((nextop>>3)&7) {
case 2: // CALL Ed
INST_NAME("CALL FS:Ed");
PASS2IF(ninst && dyn->insts && dyn->insts[ninst-1].x86.set_flags, 1) {
READFLAGS(X_PEND); // that's suspicious
} else {
SETFLAGS(X_ALL, SF_SET); //Hack to put flag in "don't care" state
}
if((nextop&0xC0)==0xC0) { // reg
MOV_REG(xEIP, xEAX+(nextop&7));
} else { // mem
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(xEIP, ed, x14, 0);
}
BARRIER(1);
BARRIER_NEXT(1);
if(!dyn->insts || ninst!=dyn->size-1) {
} else {
*need_epilog = 0;
*ok = 0;
}
MOV32(x2, addr);
PUSH1(x2);
jump_to_next(dyn, 0, xEIP, ninst);
break;
case 6: // Push Ed
INST_NAME("PUSH FS:Ed");
if((nextop&0xC0)==0xC0) { // reg
DEFAULT;
} else { // mem <= i32
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(x3, ed, x14, 0);
PUSH1(x3);
}
break;
default:
DEFAULT;
}
break;
default:
DEFAULT;
}
return addr;
}
+380
View File
@@ -0,0 +1,380 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecGS(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t opcode = F8;
uint8_t nextop;
int32_t i32, j32;
uint32_t u32;
uint8_t gd, ed;
uint8_t wback, wb1, wb2;
uint8_t u8;
int fixedaddress;
MAYUSE(j32);
MAYUSE(wback);
MAYUSE(wb2);
switch(opcode) {
case 0x03:
INST_NAME("ADD Gd, GS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_add32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x2B:
INST_NAME("SUB Gd, GS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_sub32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x33:
INST_NAME("XOR Gd, GS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_xor32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x3B:
INST_NAME("CMP Gd, GS:Ed");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
emit_cmp32(dyn, ninst, gd, ed, x3, x14);
break;
case 0x69:
INST_NAME("IMUL Gd, GS:Ed, Id");
SETFLAGS(X_ALL, SF_PENDING);
grab_tlsdata(dyn, addr, ninst, x14);
nextop = F8;
GETGD;
GETEDO(x14);
i32 = F32S;
MOV32(x14, i32);
UFLAG_IF {
SMULL(x3, gd, x14, ed);
UFLAG_OP1(x3);
UFLAG_RES(gd);
UFLAG_DF(x3, d_imul32);
} else {
MUL(gd, ed, x14);
}
break;
case 0x80:
case 0x82:
nextop = F8;
switch((nextop>>3)&7) {
case 0: //ADD
INST_NAME("ADD GS:Eb, Ib");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_add8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 1: //OR
INST_NAME("OR GS:Eb, Ib");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_or8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 2: //ADC
INST_NAME("ADC GS:Eb, Ib");
READFLAGS(X_CF);
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_adc8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 3: //SBB
INST_NAME("SBB GS:Eb, Ib");
READFLAGS(X_CF);
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_sbb8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 4: //AND
INST_NAME("AND GS:Eb, Ib");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_and8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 5: //SUB
INST_NAME("SUB GS:Eb, Ib");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_sub8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 6: //XOR
INST_NAME("XOR GS:Eb, Ib");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
emit_xor8c(dyn, ninst, x1, u8, x2, x14);
EBBACK;
break;
case 7: //CMP
INST_NAME("CMP GS:Eb, Ib");
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x1);
GETEBO(x1);
u8 = F8;
if(u8) {
MOVW(x2, u8);
emit_cmp8(dyn, ninst, x1, x2, x3, x14);
} else {
emit_cmp8_0(dyn, ninst, x1, x3, x14);
}
break;
}
break;
case 0x81:
case 0x83:
nextop = F8;
switch((nextop>>3)&7) {
case 0: //ADD
if(opcode==0x81) {
INST_NAME("ADD Ed, Id");
} else {
INST_NAME("ADD Ed, Ib");
}
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_add32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 1: //OR
if(opcode==0x81) {INST_NAME("OR Ed, Id");} else {INST_NAME("OR Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_or32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 2: //ADC
if(opcode==0x81) {INST_NAME("ADC Ed, Id");} else {INST_NAME("ADC Ed, Ib");}
READFLAGS(X_CF);
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_adc32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 3: //SBB
if(opcode==0x81) {INST_NAME("SBB Ed, Id");} else {INST_NAME("SBB Ed, Ib");}
READFLAGS(X_CF);
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_sbb32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 4: //AND
if(opcode==0x81) {INST_NAME("AND Ed, Id");} else {INST_NAME("AND Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_and32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 5: //SUB
if(opcode==0x81) {INST_NAME("SUB Ed, Id");} else {INST_NAME("SUB Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_sub32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 6: //XOR
if(opcode==0x81) {INST_NAME("XOR Ed, Id");} else {INST_NAME("XOR Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
emit_xor32c(dyn, ninst, ed, i32, x3, x14);
WBACK;
break;
case 7: //CMP
if(opcode==0x81) {INST_NAME("CMP Ed, Id");} else {INST_NAME("CMP Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
grab_tlsdata(dyn, addr, ninst, x14);
GETEDO2(x14);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
if(i32) {
MOV32(x2, i32);
emit_cmp32(dyn, ninst, ed, x2, x3, x14);
} else {
emit_cmp32_0(dyn, ninst, ed, x3, x14);
}
break;
}
break;
case 0x89:
INST_NAME("MOV GS:Ed, Gd");
grab_tlsdata(dyn, addr, ninst, x14);
nextop=F8;
GETGD;
if((nextop&0xC0)==0xC0) { // reg <= reg
MOV_REG(xEAX+(nextop&7), gd);
} else { // mem <= reg
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
STR_REG_LSL_IMM5(gd, ed, x14, 0);
}
break;
case 0x8B:
INST_NAME("MOV Gd, GS:Ed");
grab_tlsdata(dyn, addr, ninst, x14);
nextop=F8;
GETGD;
if((nextop&0xC0)==0xC0) { // reg <= reg
MOV_REG(gd, xEAX+(nextop&7));
} else { // mem <= reg
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(gd, ed, x14, 0);
}
break;
case 0x8F:
INST_NAME("POP GS:Ed");
grab_tlsdata(dyn, addr, ninst, x14);
nextop = F8;
if((nextop&0xC0)==0xC0) {
POP1((xEAX+(nextop&7)));
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
POP1(x2);
STR_REG_LSL_IMM5(x2, ed, x14, 0);
}
break;
case 0xA1:
INST_NAME("MOV EAX, GS:Id");
grab_tlsdata(dyn, addr, ninst, x1);
i32 = F32S;
if(i32>-4096 && i32<4096) {
LDR_IMM9(xEAX, x1, i32);
} else {
MOV32(x2, i32);
ADD_REG_LSL_IMM5(x1, x1, x2, 0);
LDR_IMM9(xEAX, x1, 0);
}
break;
case 0xA3:
INST_NAME("MOV GS:Od, EAX");
grab_tlsdata(dyn, addr, ninst, x1);
u32 = F32;
MOV32(x2, u32);
ADD_REG_LSL_IMM5(x2, x1, x2, 0);
STR_IMM9(xEAX, x2, 0);
break;
case 0xC7:
INST_NAME("MOV GS:Ed, Id");
grab_tlsdata(dyn, addr, ninst, x14);
nextop=F8;
if((nextop&0xC0)==0xC0) { // reg <= i32
i32 = F32S;
ed = xEAX+(nextop&7);
MOV32(ed, i32);
} else { // mem <= i32
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
i32 = F32S;
MOV32(x3, i32);
STR_REG_LSL_IMM5(x3, ed, x14, 0);
}
break;
case 0xE9:
case 0xEB:
INST_NAME("(ignored) GS:");
--addr;
break;
case 0xFF:
nextop = F8;
grab_tlsdata(dyn, addr, ninst, x14);
switch((nextop>>3)&7) {
case 6: // Push Ed
INST_NAME("PUSH GS:Ed");
if((nextop&0xC0)==0xC0) { // reg
DEFAULT;
} else { // mem <= i32
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(x3, ed, x14, 0);
PUSH1(x3);
}
break;
default:
DEFAULT;
}
break;
default:
DEFAULT;
}
return addr;
}
+1101
View File
File diff suppressed because it is too large. Load diff
+2064
View File
File diff suppressed because it is too large. Load diff
+194
View File
@@ -0,0 +1,194 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarec67(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop, opcode;
int8_t i8;
int32_t i32, j32;
uint32_t u32;
uint8_t gd, ed;
int fixedaddress;
MAYUSE(i32);
MAYUSE(j32);
nextop = F8;
switch(nextop) {
case 0x64:
// reduced EA size...
opcode = F8;
switch(opcode) {
case 0x89:
INST_NAME("MOV FS:Ew16, Gw");
nextop = F8;
grab_fsdata(dyn, addr, ninst, x14);
GETGD; // don't need GETGW here
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
if(ed!=gd) {
BFI(ed, gd, 0, 16);
}
} else {
addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
STRH_REG(gd, x14, ed);
}
break;
case 0x8B:
INST_NAME("MOV Gd, FS:Ew16");
nextop=F8;
grab_fsdata(dyn, addr, ninst, x14);
GETGD;
if((nextop&0xC0)==0xC0) { // reg <= reg
ed = xEAX+(nextop&7);
if(ed!=gd) {
BFI(gd, ed, 0, 16);
}
} else { // mem <= reg
addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(gd, x14, ed, 0);
}
break;
case 0x8F:
INST_NAME("POP FS:Ew16");
nextop=F8;
grab_fsdata(dyn, addr, ninst, x14);
if((nextop&0xC0)==0xC0) {
POP1(xEAX+(nextop&7)); // 67 ignored
} else {
addr = geted16(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
POP1(x2);
STR_REG_LSL_IMM5(x2, x14, ed, 0);
}
break;
case 0xA1:
INST_NAME("MOV EAX, FS:Ow");
grab_fsdata(dyn, addr, ninst, x1);
u32 = F16;
if(u32) {
MOV32(x2, u32);
ADD_REG_LSL_IMM5(x1, x1, x2, 0);
}
LDR_IMM9(xEAX, x1, 0);
break;
case 0xA3:
INST_NAME("MOV FS:Ow, EAX");
grab_fsdata(dyn, addr, ninst, x1);
u32 = F16;
if(u32) {
MOV32(x2, u32);
ADD_REG_LSL_IMM5(x1, x1, x2, 0);
}
STR_IMM9(xEAX, x1, 0);
break;
case 0xFF:
nextop = F8;
grab_fsdata(dyn, addr, ninst, x14);
switch((nextop>>3)&7) {
case 6: // Push Ed
INST_NAME("PUSH FS:Ew");
if((nextop&0xC0)==0xC0) { // reg
DEFAULT;
} else { // mem <= i32
addr = geted16(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 0, 0);
LDR_REG_LSL_IMM5(x3, ed, x14, 0);
PUSH1(x3);
}
break;
default:
DEFAULT;
}
break;
default:
DEFAULT;
}
break;
#define GO(NO, YES) \
BARRIER(2); \
JUMP(addr+i8);\
if(dyn->insts) { \
if(dyn->insts[ninst].x86.jmp_insts==-1) { \
/* out of the block */ \
i32 = dyn->insts[ninst+1].address-(dyn->arm_size+8); \
Bcond(NO, i32); \
jump_to_next(dyn, addr+i8, 0, ninst); \
} else { \
/* inside the block */ \
i32 = dyn->insts[dyn->insts[ninst].x86.jmp_insts].address-(dyn->arm_size+8); \
Bcond(YES, i32); \
} \
}
case 0xE0:
INST_NAME("LOOPNZ (16bits)");
READFLAGS(X_ZF);
i8 = F8S;
UXTH(x1, xECX, 0);
SUBS_IMM8(x1, x1, 1);
BFI(xECX, x1, 0, 16);
B_NEXT(cEQ); // CX is 0, no LOOP
TSTS_IMM8(xFlags, 1<<F_ZF);
GO(cNE, cEQ);
break;
case 0xE1:
INST_NAME("LOOPZ (16bits)");
READFLAGS(X_ZF);
i8 = F8S;
UXTH(x1, xECX, 0);
SUBS_IMM8(x1, x1, 1);
BFI(xECX, x1, 0, 16);
B_NEXT(cEQ); // CX is 0, no LOOP
TSTS_IMM8(xFlags, 1<<F_ZF);
GO(cEQ, cNE);
break;
case 0xE2:
INST_NAME("LOOP (16bits)");
i8 = F8S;
UXTH(x1, xECX, 0);
SUBS_IMM8(x1, x1, 1);
BFI(xECX, x1, 0, 16);
GO(cEQ, cNE);
break;
case 0xE3:
INST_NAME("JCXZ");
i8 = F8S;
UXTH(x1, xECX, 0);
TSTS_REG_LSL_IMM5(x1, x1, 0);
GO(cNE, cEQ);
break;
#undef GO
default:
DEFAULT;
}
return addr;
}
+291
View File
@@ -0,0 +1,291 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecD8(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
uint8_t ed;
uint8_t wback;
int v1, v2;
int s0;
int d1;
int fixedaddress;
int parity;
MAYUSE(d1);
MAYUSE(s0);
MAYUSE(v1);
MAYUSE(v2);
MAYUSE(ed);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FADD ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VADD_F64(v1, v1, v2);
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
INST_NAME("FMUL ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VMUL_F64(v1, v1, v2);
break;
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
INST_NAME("FCOM ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
break;
case 0xD8:
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
INST_NAME("FCOMP ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xE0:
case 0xE1:
case 0xE2:
case 0xE3:
case 0xE4:
case 0xE5:
case 0xE6:
case 0xE7:
INST_NAME("FSUB ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VSUB_F64(v1, v1, v2);
break;
case 0xE8:
case 0xE9:
case 0xEA:
case 0xEB:
case 0xEC:
case 0xED:
case 0xEE:
case 0xEF:
INST_NAME("FSUBR ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VSUB_F64(v1, v2, v1);
break;
case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
INST_NAME("FDIV ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VDIV_F64(v1, v1, v2);
break;
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
case 0xFC:
case 0xFD:
case 0xFE:
case 0xFF:
INST_NAME("FDIVR ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VDIV_F64(v1, v2, v1);
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FADD ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VADD_F64(v1, v1, d1);
break;
case 1:
INST_NAME("FMUL ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VMUL_F64(v1, v1, d1);
break;
case 2:
INST_NAME("FCOM ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VCMP_F64(v1, d1);
FCOM(x1, x2);
break;
case 3:
INST_NAME("FCOMP ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VCMP_F64(v1, d1);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 4:
INST_NAME("FSUB ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VSUB_F64(v1, v1, d1);
break;
case 5:
INST_NAME("FSUBR ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VSUB_F64(v1, d1, v1);
break;
case 6:
INST_NAME("FDIV ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VDIV_F64(v1, v1, d1);
break;
case 7:
INST_NAME("FDIVR ST0, float[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_F32(d1, s0);
VDIV_F64(v1, d1, v1);
break;
default:
DEFAULT;
}
}
return addr;
}
+377
View File
@@ -0,0 +1,377 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "emu/x87emu_private.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
static const double d_1 = 1.0;
static const double d_l2t = L2T;
static const double d_l2e = L2E;
static const double d_pi = PI;
static const double d_lg2 = LG2;
static const double d_ln2 = LN2;
static const double d_0 = 0.0;
uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
uint8_t ed;
uint8_t wback, wb1;
int fixedaddress;
int v1, v2;
int s0;
int i1, i2, i3;
int parity;
MAYUSE(s0);
MAYUSE(v2);
MAYUSE(v1);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FLD STx");
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
v2 = x87_do_push(dyn, ninst, x3);
VMOV_64(v2, v1);
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
INST_NAME("FXCH STx");
// swap the cache value, not the double value itself :p
i1 = x87_get_cache(dyn, ninst, x1, x2, nextop&7);
i2 = x87_get_cache(dyn, ninst, x1, x2, 0);
i3 = dyn->x87cache[i1];
dyn->x87cache[i1] = dyn->x87cache[i2];
dyn->x87cache[i2] = i3;
break;
case 0xD0:
INST_NAME("FNOP");
break;
case 0xE0:
INST_NAME("FCHS");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
VNEG_F64(v1, v1);
break;
case 0xE1:
INST_NAME("FABS");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
VABS_F64(v1, v1);
break;
case 0xE4:
INST_NAME("FTST");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
VCMP_F64_0(v1);
FCOM(x1, x2); // same flags...
break;
case 0xE5:
INST_NAME("FXAM");
x87_refresh(dyn, ninst, x1, x2, 0);
CALL(fpu_fxam, -1, 0); // should be possible inline, but is it worth it?
break;
case 0xE8:
INST_NAME("FLD1");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_1));
VLDR_64(v1, x2, 0);
break;
case 0xE9:
INST_NAME("FLDL2T");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_l2t));
VLDR_64(v1, x2, 0);
break;
case 0xEA:
INST_NAME("FLDL2E");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_l2e));
VLDR_64(v1, x2, 0);
break;
case 0xEB:
INST_NAME("FLDPI");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_pi));
VLDR_64(v1, x2, 0);
break;
case 0xEC:
INST_NAME("FLDLG2");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_lg2));
VLDR_64(v1, x2, 0);
break;
case 0xED:
INST_NAME("FLDLN2");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_ln2));
VLDR_64(v1, x2, 0);
break;
case 0xEE:
INST_NAME("FLDZ");
v1 = x87_do_push(dyn, ninst, x1);
MOV32(x2, (&d_0));
VLDR_64(v1, x2, 0);
break;
case 0xFA:
INST_NAME("FSQRT");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
VSQRT_F64(v1, v1);
break;
case 0xFC:
INST_NAME("FRNDINT");
// use C helper for now, nothing staightforward is available
x87_forget(dyn, ninst, x1, x2, 0);
CALL(arm_frndint, -1, 0);
/*
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
VCMP_F64_0(v1);
VMRS_APSR();
B_NEXT(cVS); // Unordered, skip
B_NEXT(cEQ); // Zero, skip
u8 = x87_setround(dyn, ninst, x1, x2, x3);
VCVT_S32_F64(x1, v1); // limit to 32bits....
VCVT_F64_S32(v1, x1);
x87_restoreround(dyn, ninst, u8);
*/
break;
case 0xF0:
INST_NAME("F2XM1");
x87_forget(dyn, ninst, x1, x2, 0);
CALL(arm_f2xm1, -1, 0);
break;
case 0xF1:
INST_NAME("FYL2X");
x87_forget(dyn, ninst, x1, x2, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fyl2x, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
case 0xF2:
INST_NAME("FTAN");
x87_forget(dyn, ninst, x1, x2, 0);
CALL(arm_ftan, -1, 0);
v1 = x87_do_push(dyn, ninst, x3);
MOV32(x2, (&d_1));
VLDR_64(v1, x2, 0);
break;
case 0xF3:
INST_NAME("FPATAN");
x87_forget(dyn, ninst, x1, x2, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fpatan, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
case 0xF4:
INST_NAME("FXTRACT");
x87_do_push_empty(dyn, ninst, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fxtract, -1, 0);
break;
case 0xF5:
INST_NAME("FPREM1");
x87_forget(dyn, ninst, x1, x2, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fprem1, -1, 0);
break;
case 0xF6:
INST_NAME("FDECSTP");
fpu_purgecache(dyn, ninst, x1, x2, x3);
LDR_IMM9(x2, xEmu, offsetof(x86emu_t, top));
SUB_IMM8(x2, x2, 1);
AND_IMM8(x2, x2, 7);
STR_IMM9(x2, xEmu, offsetof(x86emu_t, top));
break;
case 0xF7:
INST_NAME("FINCSTP");
fpu_purgecache(dyn, ninst, x1, x2, x3);
LDR_IMM9(x2, xEmu, offsetof(x86emu_t, top));
ADD_IMM8(x2, x2, 1);
AND_IMM8(x2, x2, 7);
STR_IMM9(x2, xEmu, offsetof(x86emu_t, top));
break;
case 0xF8:
INST_NAME("FPREM");
x87_forget(dyn, ninst, x1, x2, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fprem, -1, 0);
break;
case 0xF9:
INST_NAME("FYL2XP1");
x87_forget(dyn, ninst, x1, x2, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fyl2xp1, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
case 0xFB:
INST_NAME("FSINCOS");
x87_do_push_empty(dyn, ninst, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fsincos, -1, 0);
break;
case 0xFD:
INST_NAME("FSCALE");
x87_forget(dyn, ninst, x1, x2, 0);
x87_forget(dyn, ninst, x1, x2, 1);
CALL(arm_fscale, -1, 0);
break;
case 0xFE:
INST_NAME("FSIN");
x87_forget(dyn, ninst, x1, x2, 0);
CALL(arm_fsin, -1, 0);
break;
case 0xFF:
INST_NAME("FCOS");
x87_forget(dyn, ninst, x1, x2, 0);
CALL(arm_fcos, -1, 0);
break;
case 0xD1:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
case 0xD8:
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
case 0xE2:
case 0xE3:
case 0xE6:
case 0xE7:
case 0xEF:
DEFAULT;
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FLD ST0, float[ED]");
v1 = x87_do_push(dyn, ninst, x1);
s0 = fpu_get_scratch_single(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
LDR_IMM9(x2, ed, fixedaddress);
VMOVtoV(s0, x2);
}
VCVT_F64_F32(v1, s0);
break;
case 2:
INST_NAME("FST float[ED], ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
VCVT_F32_F64(s0, v1);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VSTR_32(s0, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
VMOVfrV(x2, s0);
STR_IMM9(x2, ed, fixedaddress);
}
break;
case 3:
INST_NAME("FSTP float[ED], ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
s0 = fpu_get_scratch_single(dyn);
VCVT_F32_F64(s0, v1);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VSTR_32(s0, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
VMOVfrV(x2, s0);
STR_IMM9(x2, ed, fixedaddress);
}
x87_do_pop(dyn, ninst, x3);
break;
case 4:
INST_NAME("FLDENV Ed");
fpu_purgecache(dyn, ninst, x1, x2, x3); // maybe only x87, not SSE?
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {
MOV_REG(x1, ed);
}
MOVW(x2, 0);
CALL(fpu_loadenv, -1, 0);
break;
case 5:
INST_NAME("FLDCW Ew");
GETEW(x1);
STRH_IMM8(x1, xEmu, offsetof(x86emu_t, cw)); // hopefully cw is not too far for an imm8
UBFX(x1, x1, 10, 2); // extract round
STR_IMM9(x1, xEmu, offsetof(x86emu_t, round));
break;
case 6:
INST_NAME("FNSTENV Ed");
fpu_purgecache(dyn, ninst, x1, x2, x3); // maybe only x87, not SSE?
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {
MOV_REG(x1, ed);
}
MOVW(x2, 0);
CALL(fpu_savenv, -1, 0);
break;
case 7:
INST_NAME("FNSTCW Ew");
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 255, 0);
ed = x1;
wb1 = 1;
LDRH_IMM8(x1, xEmu, offsetof(x86emu_t, cw));
EWBACK;
break;
default:
DEFAULT;
}
}
return addr;
}
+217
View File
@@ -0,0 +1,217 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecDA(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
int32_t j32;
uint8_t ed;
uint8_t wback;
int v1, v2;
int d0;
int s0;
int fixedaddress;
MAYUSE(s0);
MAYUSE(d0);
MAYUSE(v2);
MAYUSE(v1);
MAYUSE(ed);
MAYUSE(j32);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FCMOVB ST0, STx");
READFLAGS(X_CF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, 1<<F_CF);
VMOVcond_64(cNE, v1, v2); // F_CF==1
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
INST_NAME("FCMOVE ST0, STx");
READFLAGS(X_ZF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, 1<<F_ZF);
VMOVcond_64(cNE, v1, v2); // F_ZF==1
break;
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
INST_NAME("FCMOVBE ST0, STx");
READFLAGS(X_CF|X_ZF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, (1<<F_CF)|(1<<F_ZF));
VMOVcond_64(cNE, v1, v2); // F_CF==1 | F_ZF==1
break;
case 0xD8:
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
INST_NAME("FCMOVU ST0, STx");
READFLAGS(X_PF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, 1<<F_PF);
VMOVcond_64(cNE, v1, v2); // F_PF==1
break;
case 0xE9:
INST_NAME("FUCOMPP ST0, ST1");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, 1);
VCMP_F64(v1, v2);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
x87_do_pop(dyn, ninst, x3);
break;
case 0xE4:
case 0xF0:
case 0xF1:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
case 0xF8:
case 0xF9:
case 0xFD:
DEFAULT;
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FIADD ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VADD_F64(v1, v1, d0);
break;
case 1:
INST_NAME("FIMUL ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VMUL_F64(v1, v1, d0);
break;
case 2:
INST_NAME("FICOM ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VCMP_F64(v1, d0);
FCOM(x1, x2);
break;
case 3:
INST_NAME("FICOMP ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VCMP_F64(v1, d0);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 4:
INST_NAME("FISUB ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VSUB_F64(v1, v1, d0);
break;
case 5:
INST_NAME("FISUBR ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VSUB_F64(v1, d0, v1);
break;
case 6:
INST_NAME("FIDIV ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VDIV_F64(v1, v1, d0);
break;
case 7:
INST_NAME("FIDIVR ST0, Ed");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
GETED;
d0 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(d0, s0);
VDIV_F64(v1, d0, v1);
break;
}
}
return addr;
}
+290
View File
@@ -0,0 +1,290 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "emu/x87emu_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecDB(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
uint8_t u8;
int32_t j32;
uint8_t ed;
uint8_t wback;
int v1, v2;
int s0;
int fixedaddress;
int parity;
MAYUSE(s0);
MAYUSE(v1);
MAYUSE(v2);
MAYUSE(j32);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FCMOVNB ST0, STx");
READFLAGS(X_CF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, 1<<F_CF);
VMOVcond_64(cEQ, v1, v2); // F_CF==0
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
INST_NAME("FCMOVNE ST0, STx");
READFLAGS(X_ZF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, 1<<F_ZF);
VMOVcond_64(cEQ, v1, v2); // F_ZF==0
break;
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
INST_NAME("FCMOVNBE ST0, STx");
READFLAGS(X_CF|X_ZF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, (1<<F_CF)|(1<<F_ZF));
VMOVcond_64(cEQ, v1, v2); // F_CF==0 & F_ZF==0
break;
case 0xD8:
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
INST_NAME("FCMOVNU ST0, STx");
READFLAGS(X_PF);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
TSTS_IMM8(xFlags, 1<<F_PF);
VMOVcond_64(cEQ, v1, v2); // F_PF==0
break;
case 0xE1:
INST_NAME("FDISI8087_NOP"); // so.. NOP?
break;
case 0xE2:
INST_NAME("FNCLEX");
LDRH_IMM8(x2, xEmu, offsetof(x86emu_t, sw));
MOVW(x1, 0);
BFI(x2, x1, 0, 8); // IE .. PE, SF, ES
BFI(x2, x1, 15, 1); // B
STRH_IMM8(x2, xEmu, offsetof(x86emu_t, sw));
break;
case 0xE3:
INST_NAME("FNINIT");
fpu_purgecache(dyn, ninst, x1, x2, x3); // maybe only x87, not SSE?
CALL(reset_fpu, -1, 0);
break;
case 0xE8:
case 0xE9:
case 0xEA:
case 0xEB:
case 0xEC:
case 0xED:
case 0xEE:
case 0xEF:
INST_NAME("FUCOMI ST0, STx");
SETFLAGS(X_ALL, SF_SET);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOMI(x1, x2);
break;
case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
INST_NAME("FCOMI ST0, STx");
SETFLAGS(X_ALL, SF_SET);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOMI(x1, x2);
break;
case 0xE0:
case 0xE4:
case 0xE5:
case 0xE6:
case 0xE7:
DEFAULT;
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FILD ST0, Ed");
v1 = x87_do_push(dyn, ninst, x1);
s0 = fpu_get_scratch_single(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x2, &fixedaddress, 1023, 0);
VLDR_32(s0, ed, fixedaddress);
} else {
GETED;
VMOVtoV(s0, ed);
}
VCVT_F64_S32(v1, s0);
break;
case 1:
INST_NAME("FISTTP Ed, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 4095, 0);
ed = x1;
}
s0 = fpu_get_scratch_single(dyn);
MSR_nzcvq_0();
VMRS(x14); // Get FPCSR reg to clear exceptions flags
ORR_IMM8(x3, x14, 0b001, 6); // enable exceptions
BIC_IMM8(x3, x3, 0b10011111, 0);
VMSR(x3);
VCVT_S32_F64(s0, v1);
VMRS(x3); // get the FPCSR reg and test FPU exception (IO only)
VMOVfrV(ed, s0);
TSTS_IMM8_ROR(x3, 0b00000001, 0);
MOV_IMM_COND(cNE, ed, 0b10, 1); // 0x80000000
WBACK;
VMSR(x14); // put back values
x87_do_pop(dyn, ninst, x3);
break;
case 2:
INST_NAME("FIST Ed, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
u8 = x87_setround(dyn, ninst, x1, x2, x14); // x1 have the modified RPSCR reg
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 4095, 0);
ed = x1;
}
s0 = fpu_get_scratch_single(dyn);
MSR_nzcvq_0();
// x1 already have FPCSR reg to clear exceptions flags
ORR_IMM8(x3, x1, 0b001, 6); // enable exceptions
BIC_IMM8(x3, x3, 0b10011111, 0);
VMSR(x3);
VCVTR_S32_F64(s0, v1);
VMRS(x3); // get the FPCSR reg and test FPU execption (invalid operation only)
VMOVfrV(ed, s0);
TSTS_IMM8_ROR(x3, 0b00000001, 0);
MOV_IMM_COND(cNE, ed, 0b10, 1); // 0x80000000
WBACK;
x87_restoreround(dyn, ninst, u8);
break;
case 3:
INST_NAME("FISTP Ed, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
u8 = x87_setround(dyn, ninst, x1, x2, x14); // x1 have the modified RPSCR reg
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 4095, 0);
ed = x1;
}
s0 = fpu_get_scratch_single(dyn);
MSR_nzcvq_0();
// The FPCSR reg to clear exceptions flags
ORR_IMM8(x3, x1, 0b001, 6); // enable exceptions
BIC_IMM8(x3, x3, 0b10011111, 0);
VMSR(x3);
VCVTR_S32_F64(s0, v1);
VMRS(x3); // get the FPCSR reg and test FPU execption (denormal and overflow only)
VMOVfrV(ed, s0);
TSTS_IMM8_ROR(x3, 0b00000001, 0);
MOV_IMM_COND(cNE, ed, 0b10, 1); // 0x80000000
WBACK;
x87_do_pop(dyn, ninst, x3);
x87_restoreround(dyn, ninst, u8);
break;
case 5:
INST_NAME("FLD tbyte");
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(PK(0)==0xDB && ((PK(1)>>3)&7)==7) {
// the FLD is immediatly followed by an FSTP
LDR_IMM9(x2, ed, 0);
LDR_IMM9(x3, ed, 4);
LDRH_IMM8(x14, ed, 8);
// no persistant scratch register, so unrool both instruction here...
MESSAGE(LOG_DUMP, "\tHack: FSTP tbyte\n");
nextop = F8; //0xDB
nextop = F8; //modrm
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
STR_IMM9(x2, ed, 0);
STR_IMM9(x3, ed, 4);
STRH_IMM8(x14, ed, 8);
} else {
if(ed!=x1) {
MOV_REG(x1, ed);
}
x87_do_push_empty(dyn, ninst, x3);
CALL(arm_fld, -1, 0);
}
break;
case 7:
INST_NAME("FSTP tbyte");
x87_forget(dyn, ninst, x1, x3, 0);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {
MOV_REG(x1, ed);
}
CALL(arm_fstp, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
default:
DEFAULT;
}
}
return addr;
}
+284
View File
@@ -0,0 +1,284 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecDC(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
uint8_t wback;
int v1, v2;
int d1;
int fixedaddress;
int parity;
MAYUSE(d1);
MAYUSE(v2);
MAYUSE(v1);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FADD STx, ST0");
v2 = x87_get_st(dyn, ninst, x1, x2, 0);
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VADD_F64(v1, v1, v2);
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
INST_NAME("FMUL STx, ST0");
v2 = x87_get_st(dyn, ninst, x1, x2, 0);
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VMUL_F64(v1, v1, v2);
break;
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
INST_NAME("FCOM ST0, STx"); //yep
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
break;
case 0xD8:
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
INST_NAME("FCOMP ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xE0:
case 0xE1:
case 0xE2:
case 0xE3:
case 0xE4:
case 0xE5:
case 0xE6:
case 0xE7:
INST_NAME("FSUBR STx, ST0");
v2 = x87_get_st(dyn, ninst, x1, x2, 0);
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VSUB_F64(v1, v2, v1);
break;
case 0xE8:
case 0xE9:
case 0xEA:
case 0xEB:
case 0xEC:
case 0xED:
case 0xEE:
case 0xEF:
INST_NAME("FSUB STx, ST0");
v2 = x87_get_st(dyn, ninst, x1, x2, 0);
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VSUB_F64(v1, v1, v2);
break;
case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
INST_NAME("FDIVR STx, ST0");
v2 = x87_get_st(dyn, ninst, x1, x2, 0);
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VDIV_F64(v1, v2, v1);
break;
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
case 0xFC:
case 0xFD:
case 0xFE:
case 0xFF:
INST_NAME("FDIV STx, ST0");
v2 = x87_get_st(dyn, ninst, x1, x2, 0);
v1 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VDIV_F64(v1, v1, v2);
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FADD ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VADD_F64(v1, v1, d1);
break;
case 1:
INST_NAME("FMUL ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VMUL_F64(v1, v1, d1);
break;
case 2:
INST_NAME("FCOM ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VCMP_F64(v1, d1);
FCOM(x1, x2);
break;
case 3:
INST_NAME("FCOMP ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VCMP_F64(v1, d1);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 4:
INST_NAME("FSUB ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VSUB_F64(v1, v1, d1);
break;
case 5:
INST_NAME("FSUBR ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VSUB_F64(v1, d1, v1);
break;
case 6:
INST_NAME("FDIV ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VDIV_F64(v1, v1, d1);
break;
case 7:
INST_NAME("FDIVR ST0, double[ED]");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
d1 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 2);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 1023, 3);
VLDR_64(d1, wback, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, wback, fixedaddress);
LDR_IMM9(x3, wback, fixedaddress+4);
VMOVtoV_D(d1, x2, x3);
}
VDIV_F64(v1, d1, v1);
break;
}
}
return addr;
}
+227
View File
@@ -0,0 +1,227 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "emu/x87emu_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecDD(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
int fixedaddress;
int parity;
uint8_t ed;
int v1, v2;
MAYUSE(v2);
MAYUSE(v1);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FFREE STx");
break; // not handling Tag...
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
INST_NAME("FST ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VMOV_64(v2, v1);
break;
case 0xD8:
INST_NAME("FSTP ST0, ST0");
x87_do_pop(dyn, ninst, x3);
break;
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
INST_NAME("FSTP ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VMOV_64(v2, v1);
x87_do_pop(dyn, ninst, x3);
break;
case 0xE0:
case 0xE1:
case 0xE2:
case 0xE3:
case 0xE4:
case 0xE5:
case 0xE6:
case 0xE7:
INST_NAME("FUCOM ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
break;
case 0xE8:
case 0xE9:
case 0xEA:
case 0xEB:
case 0xEC:
case 0xED:
case 0xEE:
case 0xEF:
INST_NAME("FUCOMP ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
case 0xFC:
case 0xFD:
case 0xFE:
case 0xFF:
DEFAULT;
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FLD double");
v1 = x87_do_push(dyn, ninst, x1);
#if 0
// can bus error...
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VLDR_64(v1, ed, fixedaddress);
#else
parity = getedparity(dyn, ninst, addr, nextop, 3);
if (parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VLDR_64(v1, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, ed, fixedaddress);
LDR_IMM9(x3, ed, fixedaddress + 4);
VMOVtoV_D(v1, x2, x3);
}
#endif
break;
case 1:
INST_NAME("FISTTP i64, ST0");
x87_forget(dyn, ninst, x1, x2, 0);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(arm_fistt64, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
case 2:
INST_NAME("FST double");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
parity = getedparity(dyn, ninst, addr, nextop, 3);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VSTR_64(v1, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);
VMOVfrV_D(x2, x3, v1);
STR_IMM9(x2, ed, fixedaddress);
STR_IMM9(x3, ed, fixedaddress+4);
}
break;
case 3:
INST_NAME("FSTP double");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
parity = getedparity(dyn, ninst, addr, nextop, 3);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VSTR_64(v1, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);
VMOVfrV_D(x2, x3, v1);
STR_IMM9(x2, ed, fixedaddress);
STR_IMM9(x3, ed, fixedaddress+4);
}
x87_do_pop(dyn, ninst, x3);
break;
case 4:
INST_NAME("FRSTOR m108byte");
fpu_purgecache(dyn, ninst, x1, x2, x3);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(arm_frstor, -1, 0);
break;
case 6:
INST_NAME("FSAVE m108byte");
fpu_purgecache(dyn, ninst, x1, x2, x3);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(arm_fsave, -1, 0);
break;
case 7:
INST_NAME("FNSTSW m2byte");
fpu_purgecache(dyn, ninst, x1, x2, x3);
addr = geted(dyn, addr, ninst, nextop, &ed, x14, &fixedaddress, 0, 0);
LDR_IMM9(x1, xEmu, offsetof(x86emu_t, top));
MOVW(x2, offsetof(x86emu_t, sw));
ADD_REG_LSL_IMM5(x2, xEmu, x2, 0);
LDRH_IMM8(x3, x2, 0);
BFI(x3, x1, 11, 3); // inject TOP at bit 11 (3 bits)
STRH_IMM8(x3, ed, 0); // store whole sw flags
break;
default:
DEFAULT;
}
}
return addr;
}
+163
View File
@@ -0,0 +1,163 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecDE(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
int v1, v2;
MAYUSE(v2);
MAYUSE(v1);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FADDP STx, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VADD_F64(v2, v2, v1);
x87_do_pop(dyn, ninst, x3);
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
INST_NAME("FMULP STx, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VMUL_F64(v2, v2, v1);
x87_do_pop(dyn, ninst, x3);
break;
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
INST_NAME("FCOMP ST0, STx");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xD9:
INST_NAME("FCOMPP ST0, ST1");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, 1);
VCMP_F64(v1, v2);
FCOM(x1, x2);
x87_do_pop(dyn, ninst, x3);
x87_do_pop(dyn, ninst, x3);
break;
case 0xE0:
case 0xE1:
case 0xE2:
case 0xE3:
case 0xE4:
case 0xE5:
case 0xE6:
case 0xE7:
INST_NAME("FSUBRP STx, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VSUB_F64(v2, v1, v2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xE8:
case 0xE9:
case 0xEA:
case 0xEB:
case 0xEC:
case 0xED:
case 0xEE:
case 0xEF:
INST_NAME("FSUBP STx, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VSUB_F64(v2, v2, v1);
x87_do_pop(dyn, ninst, x3);
break;
case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
INST_NAME("FDIVRP STx, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VDIV_F64(v2, v1, v2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
case 0xFC:
case 0xFD:
case 0xFE:
case 0xFF:
INST_NAME("FDIVP STx, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VDIV_F64(v2, v2, v1);
x87_do_pop(dyn, ninst, x3);
break;
case 0xD8:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
DEFAULT;
break;
default:
switch((nextop>>3)&7) {
default:
DEFAULT;
}
}
return addr;
}
+254
View File
@@ -0,0 +1,254 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "emu/x87emu_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecDF(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
uint8_t u8;
int32_t j32;
uint8_t wback;
uint8_t ed;
int v1, v2;
int s0;
int fixedaddress;
MAYUSE(s0);
MAYUSE(v2);
MAYUSE(v1);
MAYUSE(j32);
switch(nextop) {
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
case 0xC6:
case 0xC7:
INST_NAME("FFREEP STx");
// not handling Tag...
x87_do_pop(dyn, ninst, x3);
break;
case 0xE0:
INST_NAME("FNSTSW AX");
LDR_IMM9(x2, xEmu, offsetof(x86emu_t, top));
LDRH_IMM8(x1, xEmu, offsetof(x86emu_t, sw));
BFI(x1, x2, 11, 3); // inject top
BFI(xEAX, x1, 0, 16);
break;
case 0xE8:
case 0xE9:
case 0xEA:
case 0xEB:
case 0xEC:
case 0xED:
case 0xEE:
case 0xEF:
INST_NAME("FUCOMIP ST0, STx");
SETFLAGS(X_ALL, SF_SET);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOMI(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
INST_NAME("FCOMIP ST0, STx");
SETFLAGS(X_ALL, SF_SET);
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
v2 = x87_get_st(dyn, ninst, x1, x2, nextop&7);
VCMP_F64(v1, v2);
FCOMI(x1, x2);
x87_do_pop(dyn, ninst, x3);
break;
case 0xC8:
case 0xC9:
case 0xCA:
case 0xCB:
case 0xCC:
case 0xCD:
case 0xCE:
case 0xCF:
case 0xD0:
case 0xD1:
case 0xD2:
case 0xD3:
case 0xD4:
case 0xD5:
case 0xD6:
case 0xD7:
case 0xD8:
case 0xD9:
case 0xDA:
case 0xDB:
case 0xDC:
case 0xDD:
case 0xDE:
case 0xDF:
case 0xE1:
case 0xE2:
case 0xE3:
case 0xE4:
case 0xE5:
case 0xE6:
case 0xE7:
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
case 0xFC:
case 0xFD:
case 0xFE:
case 0xFF:
DEFAULT;
break;
default:
switch((nextop>>3)&7) {
case 0:
INST_NAME("FILD ST0, Ew");
v1 = x87_do_push(dyn, ninst, x1);
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 255, 0);
LDRSH_IMM8(x1, wback, fixedaddress);
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, x1);
VCVT_F64_S32(v1, s0);
break;
case 1:
INST_NAME("FISTTP Ew, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 255, 0);
ed = x1;
s0 = fpu_get_scratch_single(dyn);
MSR_nzcvq_0();
VMRS(x14); // get fpscr
// x1 already have FPCSR reg to clear exceptions flags
ORR_IMM8(x3, x14, 0b001, 6); // enable exceptions
BIC_IMM8(x3, x3, 0b10011111, 0);
VMSR(x3);
VCVTR_S32_F64(s0, v1);
VMRS(x3); // get the FPCSR reg and test FPU execption (invalid operation only)
VMOVfrV(ed, s0);
TSTS_IMM8_ROR(x3, 0b00000001, 0);
SSAT_REG_LSL_IMM5_COND(cEQ, x3, 16, ed, 0);
CMPS_REG_LSL_IMM5_COND(cEQ, ed, x3, 0);
MOVW_COND(cNE, x3, 0x8000); // saturated
STRH_IMM8(x3, wback, fixedaddress);
x87_do_pop(dyn, ninst, x3);
VMSR(x14);
break;
case 2:
INST_NAME("FIST Ew, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
u8 = x87_setround(dyn, ninst, x1, x2, x14);
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 255, 0);
ed = x1;
s0 = fpu_get_scratch_single(dyn);
MSR_nzcvq_0();
// x1 already have FPCSR reg to clear exceptions flags
ORR_IMM8(x3, x1, 0b001, 6); // enable exceptions
BIC_IMM8(x3, x3, 0b10011111, 0);
VMSR(x3);
VCVTR_S32_F64(s0, v1);
VMRS(x3); // get the FPCSR reg and test FPU execption (invalid operation only)
VMOVfrV(ed, s0);
TSTS_IMM8_ROR(x3, 0b00000001, 0);
SSAT_REG_LSL_IMM5_COND(cEQ, x3, 16, ed, 0);
CMPS_REG_LSL_IMM5_COND(cEQ, ed, x3, 0);
MOVW_COND(cNE, x3, 0x8000); // saturated
STRH_IMM8(x3, wback, fixedaddress);
x87_restoreround(dyn, ninst, u8);
break;
case 3:
INST_NAME("FISTP Ew, ST0");
v1 = x87_get_st(dyn, ninst, x1, x2, 0);
u8 = x87_setround(dyn, ninst, x1, x2, x14);
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 255, 0);
ed = x1;
s0 = fpu_get_scratch_single(dyn);
MSR_nzcvq_0();
// x1 already have FPCSR reg to clear exceptions flags
ORR_IMM8(x3, x1, 0b001, 6); // enable exceptions
BIC_IMM8(x3, x3, 0b10011111, 0);
VMSR(x3);
VCVTR_S32_F64(s0, v1);
VMRS(x3); // get the FPCSR reg and test FPU execption (invalid operation only)
VMOVfrV(ed, s0);
TSTS_IMM8_ROR(x3, 0b00000001, 0);
SSAT_REG_LSL_IMM5_COND(cEQ, x3, 16, ed, 0);
CMPS_REG_LSL_IMM5_COND(cEQ, ed, x3, 0);
MOVW_COND(cNE, x3, 0x8000); // saturated
STRH_IMM8(x3, wback, fixedaddress);
x87_do_pop(dyn, ninst, x3);
x87_restoreround(dyn, ninst, u8);
break;
case 4:
INST_NAME("FBLD ST0, tbytes");
x87_do_push_empty(dyn, ninst, x1);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(fpu_fbld, -1, 0);
break;
case 5: // could be inlined for most thing, but is it usefull?
INST_NAME("FILD ST0, i64");
x87_do_push_empty(dyn, ninst, x1);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(arm_fild64, -1, 0);
break;
case 6:
INST_NAME("FBSTP tbytes, ST0");
x87_forget(dyn, ninst, x1, x2, 0);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(fpu_fbst, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
case 7: // could be inlined for most thing, but is it usefull?
INST_NAME("FISTP i64, ST0");
x87_forget(dyn, ninst, x1, x2, 0);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
if(ed!=x1) {MOV_REG(x1, ed);}
CALL(arm_fistp64, -1, 0);
x87_do_pop(dyn, ninst, x3);
break;
default:
DEFAULT;
}
}
return addr;
}
+744
View File
@@ -0,0 +1,744 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "../tools/bridge_private.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
// emit OR32 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch
void emit_or32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_or32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
ORRS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
ORR_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit OR32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_or32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOV32(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_or32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c>=0 && c<256) {
IFX(X_ALL) {
ORRS_IMM8(s1, s1, c, 0);
} else {
ORR_IMM8(s1, s1, c, 0);
}
} else {
IFX(X_PEND) {} else {MOV32(s3, c);}
IFX(X_ALL) {
ORRS_REG_LSL_IMM5(s1, s1, s3, 0);
} else {
ORR_REG_LSL_IMM5(s1, s1, s3, 0);
}
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit XOR32 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch
void emit_xor32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_xor32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
XORS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
XOR_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit XOR32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_xor32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOV32(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_xor32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c>=0 && c<256) {
IFX(X_ALL) {
XORS_IMM8(s1, s1, c);
} else {
XOR_IMM8(s1, s1, c);
}
} else {
IFX(X_PEND) {} else {MOV32(s3, c);}
IFX(X_ALL) {
XORS_REG_LSL_IMM5(s1, s1, s3, 0);
} else {
XOR_REG_LSL_IMM5(s1, s1, s3, 0);
}
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit AND32 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch
void emit_and32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_and32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
ANDS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
AND_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit AND32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_and32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOV32(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_and32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c>=0 && c<256) {
IFX(X_ALL) {
ANDS_IMM8(s1, s1, c);
} else {
AND_IMM8(s1, s1, c);
}
} else {
if(((~c)>=0 && (~c)<256)) {
IFX(X_ALL) {
BICS_IMM8_ROR(s1, s1, ~c, 0);
} else {
BIC_IMM8(s1, s1, ~c, 0);
}
} else {
IFX(X_PEND) {} else {MOV32(s3, c);}
IFX(X_ALL) {
ANDS_REG_LSL_IMM5(s1, s1, s3, 0);
} else {
AND_REG_LSL_IMM5(s1, s1, s3, 0);
}
}
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit OR8 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed)
void emit_or8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_or8);
} else IFX(X_ALL) {
SET_DFNONE(s3);
}
IFX(X_ALL) {
ORRS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
ORR_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 7);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit OR8 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_or8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOV32(s3, c&0xff);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_or8);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
ORRS_IMM8(s1, s1, c, 0);
} else {
ORR_IMM8(s1, s1, c, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 7);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit XOR8 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed)
void emit_xor8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_xor8);
} else IFX(X_ALL) {
SET_DFNONE(s3);
}
IFX(X_ALL) {
XORS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
XOR_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 7);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit XOR8 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_xor8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOV32(s3, c&0xff);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_xor8);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
XORS_IMM8(s1, s1, c);
} else {
XOR_IMM8(s1, s1, c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 7);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit AND8 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed)
void emit_and8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_and8);
} else IFX(X_ALL) {
SET_DFNONE(s3);
}
IFX(X_ALL) {
ANDS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
AND_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 7);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit AND8 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_and8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOV32(s3, c&0xff);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_and8);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
ANDS_IMM8(s1, s1, c);
} else {
AND_IMM8(s1, s1, c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 7);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit OR16 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed)
void emit_or16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_or16);
} else IFX(X_ALL) {
SET_DFNONE(s3);
}
IFX(X_ALL) {
ORRS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
ORR_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 15);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit OR16 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_or16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_or16);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c>=0 && c<256) {
IFX(X_ALL) {
ORRS_IMM8(s1, s1, c, 0);
} else {
ORR_IMM8(s1, s1, c, 0);
}
} else {
IFX(X_PEND) {} else {MOVW(s3, c);}
IFX(X_ALL) {
ORRS_REG_LSL_IMM5(s1, s1, s3, 0);
} else {
ORR_REG_LSL_IMM5(s1, s1, s3, 0);
}
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 15);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit XOR16 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed)
void emit_xor16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_xor16);
} else IFX(X_ALL) {
SET_DFNONE(s3);
}
IFX(X_ALL) {
XORS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
XOR_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 15);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit XOR16 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_xor16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_xor16);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c>=0 && c<256) {
IFX(X_ALL) {
XORS_IMM8(s1, s1, c);
} else {
XOR_IMM8(s1, s1, c);
}
} else {
IFX(X_PEND) {} else {MOVW(s3, c);}
IFX(X_ALL) {
XORS_REG_LSL_IMM5(s1, s1, s3, 0);
} else {
XOR_REG_LSL_IMM5(s1, s1, s3, 0);
}
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 15);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit AND16 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed)
void emit_and16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_and16);
} else IFX(X_ALL) {
SET_DFNONE(s3);
}
IFX(X_ALL) {
ANDS_REG_LSL_IMM5(s1, s1, s2, 0);
} else {
AND_REG_LSL_IMM5(s1, s1, s2, 0);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 15);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit AND16 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_and16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_and16);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c>=0 && c<256) {
IFX(X_ALL) {
ANDS_IMM8(s1, s1, c);
} else {
AND_IMM8(s1, s1, c);
}
} else {
IFX(X_PEND) {} else {MOVW(s3, c);}
IFX(X_ALL) {
ANDS_REG_LSL_IMM5(s1, s1, s3, 0);
} else {
AND_REG_LSL_IMM5(s1, s1, s3, 0);
}
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 15);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
+1860
View File
File diff suppressed because it is too large. Load diff
+462
View File
@@ -0,0 +1,462 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "../tools/bridge_private.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
// emit SHL32 instruction, from s1 , shift s2, store result in s1 using s3 and s4 as scratch. s3 can be same as s2
void emit_shl32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
int32_t j32;
MAYUSE(j32);
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_shl32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(F_OF) {
CMPS_IMM8(s2, 0);
IFX(F_OF) {
BIC_IMM8_COND(cEQ, xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_PEND) {
STR_IMM9_COND(cEQ, s1, xEmu, offsetof(x86emu_t, res));
}
B_NEXT(cEQ);
}
IFX(X_CF | X_OF) {
RSB_IMM8(s4, s2, 32);
MOV_REG_LSR_REG(s4, s1, s4);
BFI(xFlags, s4, F_CF, 1);
}
IFX(X_ZF) {
MOVS_REG_LSL_REG(s1, s1, s2);
} else {
MOV_REG_LSL_REG(s1, s1, s2);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
BIC_IMM8_COND(cNE, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s1, 31);
BFI(xFlags, s4, F_SF, 1);
}
IFX(X_OF) {
CMPS_IMM8(s2, 1); // if s3==1
IFX(X_SF) {} else {MOV_REG_LSR_IMM5_COND(cEQ, s4, s1, 31);}
XOR_REG_LSL_IMM5_COND(cEQ, s4, s4, xFlags, 0); // CF is set if OF is asked
BFI_COND(cEQ, xFlags, s4, F_OF, 1);
// else
BFC_COND(cNE, xFlags, F_OF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit SHL32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_shl32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_shl32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c==0) {
IFX(F_OF) {
BIC_IMM8(xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
IFX(X_CF) {
MOV_REG_LSR_IMM5(s3, s1, 32-c);
BFI(xFlags, s3, F_CF, 1);
}
IFX(X_ZF|X_OF) {
MOVS_REG_LSL_IMM5(s1, s1, c);
} else {
MOV_REG_LSL_IMM5(s1, s1, c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
BIC_IMM8_COND(cNE, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_OF) {
if(c==1) {
IFX(X_SF) {} else {MOV_REG_LSR_IMM5(s3, s1, 31);}
XOR_IMM8_COND(cCS, s3, s3, 1);
BFI(xFlags, s3, F_OF, 1);
} else {
BFC(xFlags, F_OF, 1);
}
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit SHR32 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s2 can be same as s3
void emit_shr32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
int32_t j32;
MAYUSE(j32);
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_shr32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
IFX(X_ALL) {
CMPS_IMM8(s2, 0); //if(!c)
IFX(X_PEND) {
STR_IMM9_COND(cEQ, s1, xEmu, offsetof(x86emu_t, res));
}
B_NEXT(cEQ);
}
IFX(X_ZF|X_CF) {
MOVS_REG_LSR_REG(s1, s1, s2);
} else {
MOV_REG_LSR_REG(s1, s1, s2);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_CF) {
ORR_IMM8_COND(cCS, xFlags, xFlags, 1<<F_CF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s1, 31);
BFI(xFlags, s4, F_SF, 1);
}
IFX(X_OF) {
CMPS_IMM8(s2, 1);
MOV_REG_LSR_IMM5_COND(cEQ, s4, s1, 30);
XOR_REG_LSR_IMM8_COND(cEQ, s4, s4, s4, 1);
BFI_COND(cEQ, xFlags, s4, F_OF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit SHR32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_shr32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_shr32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(!c) {
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
IFX(X_ZF|X_CF) {
MOVS_REG_LSR_IMM5(s1, s1, c);
} else {
MOV_REG_LSR_IMM5(s1, s1, c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_CF) {
ORR_IMM8_COND(cCS, xFlags, xFlags, 1<<F_CF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_OF) {
if(c==1) {
MOV_REG_LSR_IMM5(s4, s1, 30);
XOR_REG_LSR_IMM8(s4, s4, s4, 1);
BFI(xFlags, s4, F_OF, 1);
}
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit SAR32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_sar32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_sar32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(!c) {
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
IFX(X_ZF|X_CF) {
MOVS_REG_ASR_IMM5(s1, s1, c);
} else {
MOV_REG_ASR_IMM5(s1, s1, c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_CF) {
ORR_IMM8_COND(cCS, xFlags, xFlags, 1<<F_CF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit ROL32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_rol32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_rol32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(!c) {
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
MOV_REG_ROR_IMM5(s1, s1, 32-c);
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF) {
BFI(xFlags, s1, F_CF, 1);
}
IFX(X_OF) {
if(c==1) {
ADD_REG_LSR_IMM5(s3, s1, s1, 31);
BFI(xFlags, s3, F_OF, 1);
}
}
}
// emit ROR32 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch
void emit_ror32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4)
{
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_ror32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(!c) {
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
MOV_REG_ROR_IMM5(s1, s1, c);
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_CF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_CF, 1);
}
IFX(X_OF) {
if(c==1) {
MOV_REG_LSR_IMM5(s4, s1, 30);
XOR_REG_LSR_IMM8(s4, s4, s4, 1);
BFI(xFlags, s4, F_OF, 1);
}
}
}
// emit SHRD32 instruction, from s1, fill s2 , constant c, store result in s1 using s3 and s4 as scratch
void emit_shrd32c(dynarec_arm_t* dyn, int ninst, int s1, int s2, int32_t c, int s3, int s4)
{
c&=0x1f;
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
// same flags calc as shr32
SET_DF(s4, d_shr32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(!c) {
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
IFX(X_CF) {
MOVS_REG_LSR_IMM5(s1, s1, c);
} else {
MOV_REG_LSR_IMM5(s1, s1, c);
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
IFX(X_CF) {
ORR_IMM8_COND(cCS, xFlags, xFlags, 1<<F_CF, 0);
}
IFX(X_ZF) {
ORRS_REG_LSL_IMM5(s1, s1, s2, 32-c);
} else {
ORR_REG_LSL_IMM5(s1, s1, s2, 32-c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_OF) {
if(c==1) {
MOV_REG_LSR_IMM5(s4, s1, 30);
XOR_REG_LSR_IMM8(s4, s4, s4, 1);
BFI(xFlags, s4, F_OF, 1);
}
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
void emit_shld32c(dynarec_arm_t* dyn, int ninst, int s1, int s2, int32_t c, int s3, int s4)
{
c&=0x1f;
IFX(X_PEND) {
MOVW(s3, c);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
// same flags computation as with shl32
SET_DF(s4, d_shl32);
} else IFX(X_ALL) {
SET_DFNONE(s4);
}
if(c==0) {
IFX(F_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
return;
}
IFX(X_CF) {
MOV_REG_LSR_IMM5(s3, s1, 32-c);
BFI(xFlags, s3, F_CF, 1);
}
IFX(X_OF) {
MOVS_REG_LSL_IMM5(s1, s1, c);
} else {
MOV_REG_LSL_IMM5(s1, s1, c);
}
IFX(X_OF) {
if(c==1) {
UBFX(s3, s2, 0, 1);
XOR_IMM8_COND(cCS, s3, s3, 1);
BFI(xFlags, s3, F_OF, 1);
} else {
BFC(xFlags, F_OF, 1);
}
}
IFX(X_ZF) {
ORRS_REG_LSR_IMM5(s1, s1, s2, 32-c);
} else {
ORR_REG_LSR_IMM5(s1, s1, s2, 32-c);
}
IFX(X_PEND) {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
BIC_IMM8_COND(cNE, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s3, s1, 31);
BFI(xFlags, s3, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
+408
View File
@@ -0,0 +1,408 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "../tools/bridge_private.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
// emit CMP32 instruction, from cmp s1 , s2, using s3 and s4 as scratch
void emit_cmp32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX_PENDOR0 {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_cmp32);
} else {
SET_DFNONE(s4);
}
SUBS_REG_LSL_IMM5(s3, s1, s2, 0); // res = s1 - s2
IFX_PENDOR0 {
STR_IMM9(s3, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_OF) {
ORR_IMM8_COND(cVS, xFlags, xFlags, 0b10, 0x0b);
BIC_IMM8_COND(cVC, xFlags, xFlags, 0b10, 0x0b);
}
IFX(X_CF) {
// reversed carry
ORR_IMM8_COND(cCC, xFlags, xFlags, 1<<F_CF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 31);
BFI(xFlags, s4, F_SF, 1);
}
// and now the tricky ones (and mostly unused), PF and AF
IFX(X_AF) {
// bc = (res & (~d | s)) | (~d & s)
MVN_REG_LSL_IMM5(s4, s1, 0); // s4 = ~d
ORR_REG_LSL_IMM5(s4, s4, s2, 0); // s4 = ~d | s
AND_REG_LSL_IMM5(s4, s4, s3, 0); // s4 = res & (~d | s)
BIC_REG_LSL_IMM5(s3, s2, s1, 0); // loosing res... s3 = s & ~d
ORR_REG_LSL_IMM5(s3, s4, s3, 0); // s3 = (res & (~d | s)) | (s & ~d)
IFX(X_AF) {
MOV_REG_LSR_IMM5(s4, s3, 3);
BFI(xFlags, s4, F_AF, 1); // AF: bc & 0x08
}
}
IFX(X_PF) {
// PF: (((emu->x86emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0)
IFX(X_CF|X_AF) {
SUB_REG_LSL_IMM5(s3, s1, s2, 0);
}
AND_IMM8(s3, s3, 0xE0); // lsr 5 masking pre-applied
MOV32(s4, GetParityTab());
LDR_REG_LSR_IMM5(s4, s4, s3, 5-2); // x/32 and then *4 because array is integer
SUB_REG_LSL_IMM5(s3, s1, s2, 0);
AND_IMM8(s3, s3, 31);
MVN_REG_LSR_REG(s4, s4, s3);
BFI(xFlags, s4, F_PF, 1);
}
}
// emit CMP32 instruction, from cmp s1 , 0, using s3 and s4 as scratch
void emit_cmp32_0(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4)
{
IFX_PENDOR0 {
MOVW(s4, 0);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s4, xEmu, offsetof(x86emu_t, op2));
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
SET_DF(s4, d_cmp32);
} else {
SET_DFNONE(s4);
}
SUBS_IMM8(s3, s1, 0); // res = s1 - 0
// and now the tricky ones (and mostly unused), PF and AF
// bc = (res & (~d | s)) | (~d & s) => is 0 here...
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 31);
BFI(xFlags, s4, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit CMP16 instruction, from cmp s1 , s2, using s3 and s4 as scratch
void emit_cmp16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX_PENDOR0 {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s3, d_cmp16);
} else {
SET_DFNONE(s3);
}
SUB_REG_LSL_IMM5(s3, s1, s2, 0); // res = s1 - s2
IFX_PENDOR0 {
STR_IMM9(s3, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
MOVW(s4, 0xffff);
TSTS_REG_LSL_IMM5(s3, s4, 0);
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
BIC_IMM8_COND(cNE, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 15);
BFI(xFlags, s4, F_SF, 1);
}
// bc = (res & (~d | s)) | (~d & s)
IFX(X_CF|X_AF|X_OF) {
MVN_REG_LSL_IMM5(s4, s1, 0); // s4 = ~d
ORR_REG_LSL_IMM5(s4, s4, s2, 0); // s4 = ~d | s
AND_REG_LSL_IMM5(s4, s4, s3, 0); // s4 = res & (~d | s)
BIC_REG_LSL_IMM5(s3, s2, s1, 0); // loosing res... s3 = s & ~d
ORR_REG_LSL_IMM5(s3, s4, s3, 0); // s3 = (res & (~d | s)) | (s & ~d)
IFX(X_CF) {
MOV_REG_LSR_IMM5(s4, s3, 15);
BFI(xFlags, s4, F_CF, 1); // CF : bc & 0x8000
}
IFX(X_AF) {
MOV_REG_LSR_IMM5(s4, s3, 3);
BFI(xFlags, s4, F_AF, 1); // AF: bc & 0x08
}
IFX(X_OF) {
MOV_REG_LSR_IMM5(s4, s3, 14);
XOR_REG_LSR_IMM8(s4, s4, s4, 1);
BFI(xFlags, s4, F_OF, 1); // OF: ((bc >> 14) ^ ((bc>>14)>>1)) & 1
}
}
IFX(X_PF) {
IFX(X_CF|X_AF|X_OF) {
SUB_REG_LSL_IMM5(s3, s1, s2, 0);
}
AND_IMM8(s3, s3, 0xE0); // lsr 5 masking pre-applied
MOV32(s4, GetParityTab());
LDR_REG_LSR_IMM5(s4, s4, s3, 5-2); // x/32 and then *4 because array is integer
SUB_REG_LSL_IMM5(s3, s1, s2, 0);
AND_IMM8(s3, s3, 31);
MVN_REG_LSR_REG(s4, s4, s3);
BFI(xFlags, s4, F_PF, 1);
}
}
// emit CMP16 instruction, from cmp s1 , #0, using s3 and s4 as scratch
void emit_cmp16_0(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4)
{
IFX_PENDOR0 {
MOVW(s3, 0);
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s3, xEmu, offsetof(x86emu_t, op2));
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
SET_DF(s3, d_cmp16);
} else {
SET_DFNONE(s3);
}
// bc = (res & (~d | s)) | (~d & s) = 0
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_ZF) {
MOVW(s4, 0xffff);
TSTS_REG_LSL_IMM5(s1, s4, 0);
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s1, 15);
BFI(xFlags, s4, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit CMP8 instruction, from cmp s1 , s2, using s3 and s4 as scratch
void emit_cmp8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX_PENDOR0 {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
STR_IMM9(s2, xEmu, offsetof(x86emu_t, op2));
SET_DF(s4, d_cmp8);
} else {
SET_DFNONE(s4);
}
SUB_REG_LSL_IMM5(s3, s1, s2, 0); // res = s1 - s2
IFX_PENDOR0 {
STR_IMM9(s3, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
TSTS_IMM8(s3, 0xff);
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
BIC_IMM8_COND(cNE, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 7);
BFI(xFlags, s4, F_SF, 1);
}
// bc = (res & (~d | s)) | (~d & s)
IFX(X_CF|X_AF|X_OF) {
MVN_REG_LSL_IMM5(s4, s1, 0); // s4 = ~d
ORR_REG_LSL_IMM5(s4, s4, s2, 0); // s4 = ~d | s
AND_REG_LSL_IMM5(s4, s4, s3, 0); // s4 = res & (~d | s)
BIC_REG_LSL_IMM5(s3, s2, s1, 0); // loosing res... s3 = s & ~d
ORR_REG_LSL_IMM5(s3, s4, s3, 0); // s3 = (res & (~d | s)) | (s & ~d)
IFX(X_CF) {
MOV_REG_LSR_IMM5(s4, s3, 7);
BFI(xFlags, s4, F_CF, 1); // CF : bc & 0x80
}
IFX(X_AF) {
MOV_REG_LSR_IMM5(s4, s3, 3);
BFI(xFlags, s4, F_AF, 1); // AF: bc & 0x08
}
IFX(X_OF) {
MOV_REG_LSR_IMM5(s4, s3, 6);
XOR_REG_LSR_IMM8(s4, s4, s4, 1);
BFI(xFlags, s4, F_OF, 1); // OF: ((bc >> 6) ^ ((bc>>6)>>1)) & 1
}
}
IFX(X_PF) {
IFX(X_CF|X_AF|X_OF) {
SUB_REG_LSL_IMM5(s3, s1, s2, 0);
}
AND_IMM8(s3, s3, 0xE0); // lsr 5 masking pre-applied
MOV32(s4, GetParityTab());
LDR_REG_LSR_IMM5(s4, s4, s3, 5-2); // x/32 and then *4 because array is integer
SUB_REG_LSL_IMM5(s3, s1, s2, 0);
AND_IMM8(s3, s3, 31);
MVN_REG_LSR_REG(s4, s4, s3);
BFI(xFlags, s4, F_PF, 1);
}
}
// emit CMP8 instruction, from cmp s1 , 0, using s3 and s4 as scratch
void emit_cmp8_0(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4)
{
IFX_PENDOR0 {
STR_IMM9(s1, xEmu, offsetof(x86emu_t, op1));
MOVW(s4, 0);
STR_IMM9(s4, xEmu, offsetof(x86emu_t, op2));
STR_IMM9(s1, xEmu, offsetof(x86emu_t, res));
SET_DF(s3, d_cmp8);
} else {
SET_DFNONE(s4);
}
// bc = (res & (~d | s)) | (~d & s) = 0
IFX(X_CF | X_AF | X_ZF) {
BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0);
}
IFX(X_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_ZF) {
TSTS_IMM8(s1, 0xff);
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s1, 7);
BFI(xFlags, s4, F_SF, 1);
}
IFX(X_PF) {
emit_pf(dyn, ninst, s1, s3, s4);
}
}
// emit TEST32 instruction, from test s1 , s2, using s3 and s4 as scratch
void emit_test32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX_PENDOR0 {
SET_DF(s3, d_tst32);
} else {
SET_DFNONE(s4);
}
IFX(X_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
ANDS_REG_LSL_IMM5(s3, s1, s2, 0); // res = s1 & s2
IFX_PENDOR0 {
STR_IMM9(s3, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 31);
BFI(xFlags, s4, F_SF, 1);
}
// PF: (((emu->x86emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0)
IFX(X_PF) {
AND_IMM8(s3, s3, 0xE0); // lsr 5 masking pre-applied
MOV32(s4, GetParityTab());
LDR_REG_LSR_IMM5(s4, s4, s3, 5-2); // x/32 and then *4 because array is integer
AND_REG_LSL_IMM5(s3, s1, s2, 0);
AND_IMM8(s3, s3, 31);
MVN_REG_LSR_REG(s4, s4, s3);
BFI(xFlags, s4, F_PF, 1);
}
}
// emit TEST16 instruction, from test s1 , s2, using s3 and s4 as scratch
void emit_test16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX_PENDOR0 {
SET_DF(s3, d_tst16);
} else {
SET_DFNONE(s4);
}
IFX(X_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
ANDS_REG_LSL_IMM5(s3, s1, s2, 0); // res = s1 & s2
IFX_PENDOR0 {
STR_IMM9(s3, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 15);
BFI(xFlags, s4, F_SF, 1);
}
// PF: (((emu->x86emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0)
IFX(X_PF) {
AND_IMM8(s3, s3, 0xE0); // lsr 5 masking pre-applied
MOV32(s4, GetParityTab());
LDR_REG_LSR_IMM5(s4, s4, s3, 5-2); // x/32 and then *4 because array is integer
AND_REG_LSL_IMM5(s3, s1, s2, 0);
AND_IMM8(s3, s3, 31);
MVN_REG_LSR_REG(s4, s4, s3);
BFI(xFlags, s4, F_PF, 1);
}
}
// emit TEST8 instruction, from test s1 , s2, using s3 and s4 as scratch
void emit_test8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4)
{
IFX_PENDOR0 {
SET_DF(s3, d_tst8);
} else {
SET_DFNONE(s4);
}
IFX(X_OF) {
BFC(xFlags, F_OF, 1);
}
IFX(X_ZF|X_CF) {
BIC_IMM8(xFlags, xFlags, (1<<F_ZF)|(1<<F_CF), 0);
}
ANDS_REG_LSL_IMM5(s3, s1, s2, 0); // res = s1 & s2
IFX_PENDOR0 {
STR_IMM9(s3, xEmu, offsetof(x86emu_t, res));
}
IFX(X_ZF) {
ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0);
}
IFX(X_SF) {
MOV_REG_LSR_IMM5(s4, s3, 7);
BFI(xFlags, s4, F_SF, 1);
}
// PF: (((emu->x86emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0)
IFX(X_PF) {
AND_IMM8(s3, s3, 0xE0); // lsr 5 masking pre-applied
MOV32(s4, GetParityTab());
LDR_REG_LSR_IMM5(s4, s4, s3, 5-2); // x/32 and then *4 because array is integer
AND_REG_LSL_IMM5(s3, s1, s2, 0);
AND_IMM8(s3, s3, 31);
MVN_REG_LSR_REG(s4, s4, s3);
BFI(xFlags, s4, F_PF, 1);
}
}
+954
View File
@@ -0,0 +1,954 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_helper.h"
uintptr_t dynarecF0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop, opcode = F8;
uint8_t wback, wb1, wb2, gb1, gb2;
uint8_t ed, gd, u8;
int fixedaddress;
int32_t i32, j32;
MAYUSE(i32);
MAYUSE(j32);
MAYUSE(gb1);
MAYUSE(gb2);
MAYUSE(wb1);
MAYUSE(wb2);
switch(opcode) {
case 0x00:
INST_NAME("LOCK ADD Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGB(x2);
if((nextop&0xC0)==0xC0) {
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_add8(dyn, ninst, x1, x2, x14, x3, 0);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
LDREXB(x1, wback);
emit_add8(dyn, ninst, x1, x2, x14, x3, (wback==x3)?1:0);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x01:
INST_NAME("LOCK ADD Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_add32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_add32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x08:
INST_NAME("LOCK OR Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
if((nextop&0xC0)==0xC0) {
GETGB(x2);
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_or8(dyn, ninst, x1, x2, x14, x3);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
GETGB(x2);
LDREXB(x1, wback);
emit_or8(dyn, ninst, x1, x2, x14, x2);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x09:
INST_NAME("LOCK OR Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_or32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_or32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x10:
INST_NAME("LOCK ADC Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGB(x2);
if((nextop&0xC0)==0xC0) {
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_adc8(dyn, ninst, x1, x2, x14, x3, 0);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
LDREXB(x1, wback);
emit_adc8(dyn, ninst, x1, x2, x14, x3, (wback==x3)?1:0);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x11:
INST_NAME("LOCK ADC Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_adc32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_adc32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x18:
INST_NAME("LOCK SBB Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGB(x2);
if((nextop&0xC0)==0xC0) {
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_sbb8(dyn, ninst, x1, x2, x14, x3, 0);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
LDREXB(x1, wback);
emit_sbb8(dyn, ninst, x1, x2, x14, x3, (wback==x3)?1:0);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x19:
INST_NAME("LOCK SBB Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_sbb32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_sbb32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x20:
INST_NAME("LOCK AND Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
if((nextop&0xC0)==0xC0) {
GETGB(x2);
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_and8(dyn, ninst, x1, x2, x14, x3);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
GETGB(x2);
LDREXB(x1, wback);
emit_and8(dyn, ninst, x1, x2, x14, x2);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x21:
INST_NAME("LOCK AND Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_and32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_and32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x28:
INST_NAME("LOCK SUB Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGB(x2);
if((nextop&0xC0)==0xC0) {
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_sub8(dyn, ninst, x1, x2, x14, x3, 0);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
LDREXB(x1, wback);
emit_sub8(dyn, ninst, x1, x2, x14, x3, (wback==x3)?1:0);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x29:
INST_NAME("LOCK SUB Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_sub32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_sub32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x38:
INST_NAME("LOCK XOR Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
if((nextop&0xC0)==0xC0) {
GETGB(x2);
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x1, wback, wb2);
emit_xor8(dyn, ninst, x1, x2, x14, x3);
BFI(wback, ed, wb2*8, 8);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
GETGB(x2);
LDREXB(x1, wback);
emit_xor8(dyn, ninst, x1, x2, x14, x2);
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
}
break;
case 0x39:
INST_NAME("LOCK XOR Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_xor32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
LDREX(x1, wback);
emit_xor32(dyn, ninst, x1, gd, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 0x81:
case 0x83:
nextop = F8;
switch((nextop>>3)&7) {
case 0: //ADD
if(opcode==0x81) {
INST_NAME("LOCK ADD Ed, Id");
} else {
INST_NAME("LOCK ADD Ed, Ib");
}
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_add32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
TSTS_IMM8(wback, 0x3);
B_MARK(cNE);
MARKLOCK;
LDREX(x1, wback);
emit_add32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
B_NEXT(c__);
MARK; // unaligned! also, not enough
LDR_IMM9(x1, wback, 0);
LDREXB(x14, wback);
BFI(x1, x14, 0, 8); // re-inject
emit_add32c(dyn, ninst, x1, i32, x3, x14);
STREXB(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARK(cNE);
STR_IMM9(x1, wback, 0); // put the whole value
}
break;
case 1: //OR
if(opcode==0x81) {INST_NAME("LOCK OR Ed, Id");} else {INST_NAME("LOCK OR Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_or32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
MARKLOCK;
LDREX(x1, wback);
emit_or32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 2: //ADC
if(opcode==0x81) {INST_NAME("LOCK ADC Ed, Id");} else {INST_NAME("LOCK ADC Ed, Ib");}
READFLAGS(X_CF);
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_adc32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
MARKLOCK;
LDREX(x1, wback);
emit_adc32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 3: //SBB
if(opcode==0x81) {INST_NAME("LOCK SBB Ed, Id");} else {INST_NAME("LOCK SBB Ed, Ib");}
READFLAGS(X_CF);
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_sbb32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
MARKLOCK;
LDREX(x1, wback);
emit_sbb32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 4: //AND
if(opcode==0x81) {INST_NAME("LOCK AND Ed, Id");} else {INST_NAME("LOCK AND Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_and32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
MARKLOCK;
LDREX(x1, wback);
emit_and32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 5: //SUB
if(opcode==0x81) {INST_NAME("LOCK SUB Ed, Id");} else {INST_NAME("LOCK SUB Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_sub32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
TSTS_IMM8(wback, 0x3);
B_MARK(cNE);
MARKLOCK;
LDREX(x1, wback);
emit_sub32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
B_NEXT(c__);
MARK; // unaligned! also, not enough
LDR_IMM9(x1, wback, 0);
LDREXB(x14, wback);
BFI(x1, x14, 0, 8); // re-inject
emit_sub32c(dyn, ninst, x1, i32, x3, x14);
STREXB(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARK(cNE);
STR_IMM9(x1, wback, 0); // put the whole value
}
break;
case 6: //XOR
if(opcode==0x81) {INST_NAME("LOCK XOR Ed, Id");} else {INST_NAME("LOCK XOR Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
if((nextop&0xC0)==0xC0) {
if(opcode==0x81) i32 = F32S; else i32 = F8S;
ed = xEAX+(nextop&7);
emit_xor32c(dyn, ninst, ed, i32, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
if(opcode==0x81) i32 = F32S; else i32 = F8S;
MARKLOCK;
LDREX(x1, wback);
emit_xor32c(dyn, ninst, x1, i32, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
}
break;
case 7: //CMP
if(opcode==0x81) {INST_NAME("(LOCK) CMP Ed, Id");} else {INST_NAME("(LOCK) CMP Ed, Ib");}
SETFLAGS(X_ALL, SF_SET);
GETEDH(x1);
// No need to LOCK, this is readonly
if(opcode==0x81) i32 = F32S; else i32 = F8S;
if(i32) {
MOV32(x2, i32);
emit_cmp32(dyn, ninst, ed, x2, x3, x14);
} else {
emit_cmp32_0(dyn, ninst, ed, x3, x14);
}
break;
}
break;
// generic case, no lock needed, the value is only read (note that on x86 locked read is always followed wy a locked write)
#define GO(A) \
case A+0x02: \
case A+0x03: \
case A+0x04: \
case A+0x05:
GO(0x00);
GO(0x08);
GO(0x10);
GO(0x18);
GO(0x20);
GO(0x28);
GO(0x30);
#undef GO
case 0x86: // for this two, the lock is already done by the opcode, so just ignoring it
case 0x87:
--addr;
break;
case 0x90: // This is xchg reg, reg, so let's ignore the LOCK prefix...
case 0x91:
case 0x92:
case 0x93:
case 0x94:
case 0x95:
case 0x96:
case 0x97:
--addr;
break;
case 0x0F:
nextop = F8;
switch(nextop) {
case 0xB0:
INST_NAME("LOCK CMPXCHG Eb, Gb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
if((nextop&0xC0)==0xC0) {
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x2, wback, wb2);
ed = x2;
wb1 = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
LDREXB(x2, wback);
ed = x2;
wb1 = 1;
}
UXTB(x1, xEAX, 0);
CMPS_REG_LSL_IMM5(x1, ed, 0);
B_MARK(cNE);
// AL == Eb
GETGB(x1);
if(wb1) {
STREXB(x14, x1, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE); // write failed, try again
if(!(gb1==xEAX && gb2==0)) {
UXTB(x1, xEAX, 0); // readback AL if needed
}
} else {
BFI(wback, x1, wb2*8, 8);
}
// done
B_MARK3(c__);
MARK;
// AL != Eb
BFI(xEAX, ed, 0, 8);
MARK3;
// done, do the cmp now
emit_cmp8(dyn, ninst, x1, x2, x3, x14);
break;
case 0xB1:
INST_NAME("LOCK CMPXCHG Ed, Gd");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
MARKLOCK;
TSTS_IMM8(wback, 3); // can be unaligned it seems
LDREX_COND(cEQ, x1, wback);
LDR_IMM9_COND(cNE, x1, wback, 0);
LDREXB_COND(cNE, x3, wback); // dummy read, to arm the write...
ed = x1;
}
CMPS_REG_LSL_IMM5(xEAX, ed, 0);
B_MARK(cNE);
// EAX == Ed
if(wback) {
TSTS_IMM8(wback, 3);
STREX_COND(cEQ, x14, gd, wback);
STREXB_COND(cNE, x14, gd, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
TSTS_IMM8(wback, 3); // anoying, all those test
STR_IMM9_COND(cNE, gd, wback, 0);
emit_cmp32(dyn, ninst, xEAX, ed, x1, x14);
} else {
emit_cmp32(dyn, ninst, xEAX, ed, x1, x14);
MOV_REG(ed, gd);
}
// done
B_MARK3(c__); // not next, in case its called with a LOCK prefix
MARK;
// EAX != Ed
emit_cmp32(dyn, ninst, xEAX, ed, x3, x14);
MOV_REG(xEAX, ed);
MARK3
break;
case 0xB3:
INST_NAME("LOCK BTR Ed, Gd");
SETFLAGS(X_CF, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
UBFX(x1, gd, 5, 3); // r1 = (gd>>5);
ADD_REG_LSL_IMM5(x3, wback, x1, 2); //(&ed)+=r1*4;
wback = x3;
MARKLOCK;
LDREX(x1, wback);
ed = x1;
}
AND_IMM8(x2, gd, 0x1f);
MOV_REG_LSR_REG(x14, ed, x2);
ANDS_IMM8(x14, x14, 1);
BFI(xFlags, x14, F_CF, 1);
B_MARK3(cEQ); // bit already clear, jump to end of instruction
MOVW(x14, 1);
XOR_REG_LSL_REG(ed, ed, x14, x2);
if(wback) {
STREX(x14, ed, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
}
MARK3;
break;
case 0xBA:
nextop = F8;
switch((nextop>>3)&7) {
case 4:
INST_NAME("(LOCK) BT Ed, Ib");
SETFLAGS(X_CF, SF_SUBSET);
gd = x2;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
u8 = F8;
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x3, &fixedaddress, 4095-32, 0);
u8 = F8;
fixedaddress+=(u8>>5)*4;
LDR_IMM9(x1, ed, fixedaddress);
ed = x1;
}
u8&=0x1f;
if(u8) {
MOV_REG_LSR_IMM5(x1, ed, u8);
ed = x1;
}
BFI(xFlags, ed, F_CF, 1);
break;
case 5:
INST_NAME("LOCK BTS Ed, Ib");
SETFLAGS(X_CF, SF_SUBSET);
gd = x2;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
u8 = F8;
MOVW(gd, u8);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x3, &fixedaddress, 0, 0);
u8 = F8;
MOVW(gd, u8);
UBFX(x1, gd, 5, 3); // r1 = (gd>>5);
ADD_REG_LSL_IMM5(x3, ed, x1, 2); //(&ed)+=r1*4;
MARKLOCK;
LDREX(x1, x3);
ed = x1;
wback = x3;
}
AND_IMM8(x2, gd, 0x1f);
MOV_REG_LSR_REG(x14, ed, x2);
ANDS_IMM8(x14, x14, 1);
BFI(xFlags, x14, F_CF, 1);
B_MARK3(cNE); // bit already set, jump to next instruction
MOVW(x14, 1);
XOR_REG_LSL_REG(ed, ed, x14, x2);
if(wback) {
STREX(x14, ed, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
}
MARK3;
break;
case 6:
INST_NAME("LOCK BTR Ed, Ib");
SETFLAGS(X_CF, SF_SUBSET);
gd = x2;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
u8 = F8;
MOVW(gd, u8);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x3, &fixedaddress, 0, 0);
u8 = F8;
MOVW(gd, u8);
UBFX(x1, gd, 5, 3); // r1 = (gd>>5);
ADD_REG_LSL_IMM5(x3, ed, x1, 2); //(&ed)+=r1*4;
MARKLOCK;
LDREX(x1, x3);
ed = x1;
wback = x3;
}
AND_IMM8(x2, gd, 0x1f);
MOV_REG_LSR_REG(x14, ed, x2);
ANDS_IMM8(x14, x14, 1);
BFI(xFlags, x14, F_CF, 1);
B_MARK3(cEQ); // bit already clear, jump to next instruction
//MOVW(x14, 1); // already 0x01
XOR_REG_LSL_REG(ed, ed, x14, x2);
if(wback) {
STREX(x14, ed, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
}
MARK3;
break;
default:
DEFAULT;
}
break;
case 0xBB:
INST_NAME("LOCK BTC Ed, Gd");
SETFLAGS(X_CF, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
wback = 0;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
UBFX(x1, gd, 5, 3); // r1 = (gd>>5);
ADD_REG_LSL_IMM5(x3, wback, x1, 2); //(&ed)+=r1*4;
MARKLOCK;
LDREX(x1, x3);
ed = x1;
wback = x3;
}
AND_IMM8(x2, gd, 0x1f);
MOV_REG_LSR_REG(x14, ed, x2);
BFI(xFlags, x14, F_CF, 1);
MOVW(x14, 1);
XOR_REG_LSL_REG(ed, ed, x14, x2);
if(wback) {
STREX(x14, ed, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
}
break;
case 0xC0:
INST_NAME("LOCK XADD Gb, Eb");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGB(x1);
if((nextop&0xC0)==0xC0) {
wback = (nextop&7);
wb2 = (wback>>2);
wback = xEAX+(wback&3);
UXTB(x2, wback, wb2);
wb1 = 0;
ed = x2;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0);
MARKLOCK;
LDREXB(x2, wback);
wb1 = 1;
ed = x2;
}
BFI(gb1, ed, gb2*8, 8); // gb <- eb
emit_add8(dyn, ninst, ed, gd, x14, x3, 1);
if(wb1) {
STREXB(x14, ed, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
} else {
BFI(wback, ed, wb2*8, 8);
}
break;
case 0xC1:
INST_NAME("LOCK XADD Gd, Ed");
SETFLAGS(X_ALL, SF_SET);
nextop = F8;
GETGD;
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
if(gd!=ed) {
XOR_REG_LSL_IMM5(gd, gd, ed, 0); // swap gd, ed
XOR_REG_LSL_IMM5(ed, gd, ed, 0);
XOR_REG_LSL_IMM5(gd, gd, ed, 0);
}
emit_add32(dyn, ninst, ed, gd, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
TSTS_IMM8(wback, 3);
B_MARK(cNE); // unaligned
MARKLOCK;
LDREX(x1, wback);
ADD_REG_LSL_IMM5(x14, x1, gd, 0);
STREX(x3, x14, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
B_MARK2(c__);
MARK;
LDR_IMM9(x1, wback, 0);
LDREXB(x14, wback);
BFI(x1, x14, 0, 8);
ADD_REG_LSL_IMM5(x14, x1, gd, 0);
STREXB(x3, x14, wback);
CMPS_IMM8(x3, 0);
B_MARK(cNE);
STR_IMM9(x14, wback, 0);
MARK2;
IFX(X_ALL|X_PEND) {
MOV_REG(x2, x1);
emit_add32(dyn, ninst, x2, gd, x3, x14);
}
MOV_REG(gd, x1);
}
break;
case 0xC7:
INST_NAME("LOCK CMPXCHG8B Gq, Eq");
SETFLAGS(X_ZF, SF_SET);
nextop = F8;
addr = geted(dyn, addr, ninst, nextop, &wback, x1, &fixedaddress, 0, 0);
MARKLOCK;
TSTS_IMM8(wback, 7);
LDREXD_COND(cEQ, x2, wback);
LDREX_COND(cNE, x2, wback);
LDR_IMM9_COND(cNE, x3, wback, 4);
CMPS_REG_LSL_IMM5(xEAX, x2, 0);
B_MARK(cNE); // EAX != Ed[0]
CMPS_REG_LSL_IMM5(xEDX, x3, 0);
B_MARK(cNE); // EDX != Ed[1]
MOV_REG(x2, xEBX);
MOV_REG(x3, xECX);
TSTS_IMM8(wback, 7);
STREXD_COND(cEQ, x14, x2, wback);
STREX_COND(cNE, x14, x2, wback);
CMPS_IMM8(x14, 0);
B_MARKLOCK(cNE);
TSTS_IMM8(wback, 7);
STR_IMM9_COND(cNE, x3, wback, 4);
MOVW(x1, 1);
B_MARK3(c__);
MARK;
MOV_REG(xEAX, x2);
MOV_REG(xEDX, x3);
MOVW(x1, 0);
MARK3;
BFI(xFlags, x1, F_ZF, 1);
break;
default:
// dafault to NO LOCK
addr-=2;
}
break;
case 0xFF:
nextop = F8;
switch((nextop>>3)&7)
{
case 0: // INC Ed
INST_NAME("INC Ed");
SETFLAGS(X_ALL&~X_CF, SF_SUBSET);
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_inc32(dyn, ninst, ed, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
TSTS_IMM8(wback, 3);
B_MARK(cNE); // unaligned
MARKLOCK;
LDREX(x1, wback);
emit_inc32(dyn, ninst, x1, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
B_NEXT(c__);
MARK;
LDR_IMM9(x1, wback, 0);
LDREXB(x3, wback);
BFI(x1, x3, 0, 8);
emit_inc32(dyn, ninst, x1, x3, x14);
STREXB(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARK(cNE);
STR_IMM9(x1, wback, 0);
}
break;
case 1: //DEC Ed
INST_NAME("DEC Ed");
SETFLAGS(X_ALL&~X_CF, SF_SUBSET);
if((nextop&0xC0)==0xC0) {
ed = xEAX+(nextop&7);
emit_dec32(dyn, ninst, ed, x3, x14);
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0);
TSTS_IMM8(wback, 3);
B_MARK(cNE); // unaligned
MARKLOCK;
LDREX(x1, wback);
emit_dec32(dyn, ninst, x1, x3, x14);
STREX(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARKLOCK(cNE);
B_NEXT(c__);
MARK;
LDR_IMM9(x1, wback, 0);
LDREXB(x3, wback);
BFI(x1, x3, 0, 8);
emit_dec32(dyn, ninst, x1, x3, x14);
STREXB(x3, x1, wback);
CMPS_IMM8(x3, 0);
B_MARK(cNE);
STR_IMM9(x1, wback, 0);
}
break;
default:
// default to NO LOCK
addr-=2;
}
break;
default:
// default to NO LOCK
--addr;
}
return addr;
}
+341
View File
@@ -0,0 +1,341 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
// Get Ex as a double, not a quad (warning, x2 and x3 may get used)
#define GETEX(a) \
if((nextop&0xC0)==0xC0) { \
a = sse_get_reg(dyn, ninst, x1, nextop&7); \
} else { \
parity = getedparity(dyn, ninst, addr, nextop, 3); \
a = fpu_get_scratch_double(dyn); \
if(parity) { \
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3); \
VLDR_64(a, ed, fixedaddress); \
} else { \
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);\
LDR_IMM9(x2, ed, fixedaddress+0); \
LDR_IMM9(x3, ed, fixedaddress+4); \
VMOVtoV_D(a, x2, x3); \
} \
}
uintptr_t dynarecF20F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t nextop = F8;
uint8_t u8;
uint32_t u32;
uint8_t gd, ed;
uint8_t wback;
int v0, v1;
int d0, d1;
int s0;
int fixedaddress;
int parity;
MAYUSE(s0);
MAYUSE(d1);
MAYUSE(d0);
switch(nextop) {
case 0x10:
INST_NAME("MOVSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
v0 = sse_get_reg(dyn, ninst, x1, gd);
d0 = sse_get_reg(dyn, ninst, x1, nextop&7);
VMOVD(v0, d0);
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, ed, fixedaddress+0);
LDR_IMM9(x3, ed, fixedaddress+4);
VMOVtoV_D(v0, x2, x3);
VEOR(v0+1, v0+1, v0+1); // upper 64bits set to 0
}
break;
case 0x11:
INST_NAME("MOVSD Ex, Gx");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
if((nextop&0xC0)==0xC0) {
d0 = sse_get_reg(dyn, ninst, x1, nextop&7);
VMOVD(d0, v0);
} else {
VMOVfrV_D(x2, x3, v0);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);
STR_IMM9(x2, ed, fixedaddress+0);
STR_IMM9(x3, ed, fixedaddress+4);
}
break;
case 0x12:
INST_NAME("MOVDDUP Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
d0 = sse_get_reg(dyn, ninst, x1, nextop&7);
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VMOVD(v0, d0);
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-4, 0);
LDR_IMM9(x2, ed, fixedaddress+0);
LDR_IMM9(x3, ed, fixedaddress+4);
VMOVtoV_D(v0, x2, x3);
}
VMOVD(v0+1, v0);
break;
case 0x2A:
INST_NAME("CVTSI2SD Gx, Ed");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETED;
s0 = fpu_get_scratch_single(dyn);
VMOVtoV(s0, ed);
VCVT_F64_S32(v0, s0);
break;
case 0x2C:
INST_NAME("CVTTSD2SI Gd, Ex");
nextop = F8;
GETGD;
s0 = fpu_get_scratch_single(dyn);
if((nextop&0xC0)==0xC0) {
d0 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
d0 = fpu_get_scratch_double(dyn);
VLDR_64(d0, ed, fixedaddress);
}
VCVT_S32_F64(s0, d0);
VMOVfrV(gd, s0);
break;
case 0x2D:
INST_NAME("CVTSD2SI Gd, Ex");
u8 = sse_setround(dyn, ninst, x1, x2, x14);
nextop = F8;
GETGD;
s0 = fpu_get_scratch_single(dyn);
if((nextop&0xC0)==0xC0) {
d0 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
d0 = fpu_get_scratch_double(dyn);
VLDR_64(d0, ed, fixedaddress);
}
VCVTR_S32_F64(s0, d0);
VMOVfrV(gd, s0);
x87_restoreround(dyn, ninst, u8);
break;
case 0x51:
INST_NAME("SQRTSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
VSQRT_F64(v0, d0);
break;
case 0x58:
INST_NAME("ADDSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
VADD_F64(v0, v0, d0);
break;
case 0x59:
INST_NAME("MULSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
VMUL_F64(v0, v0, d0);
break;
case 0x5A:
INST_NAME("CVTSD2SS Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
d1 = fpu_get_scratch_double(dyn);
s0 = fpu_get_scratch_single(dyn);
VCVT_F32_F64(s0, d0);
VMOV_64(d1, v0);
VMOV_32(d1*2, s0);
VMOV_64(v0, d1);
break;
case 0x5C:
INST_NAME("SUBSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
VSUB_F64(v0, v0, d0);
break;
case 0x5D:
INST_NAME("MINSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
// MINSD: if any input is NaN, or Ex[0]<Gx[0], copy Ex[0] -> Gx[0]
VCMP_F64(v0, d0);
VMRS_APSR();
VMOVcond_64(cCS, v0, d0); // move v0 <- d0 if v0 or d0 unordered or v0 >= d0
break;
case 0x5E:
INST_NAME("DIVSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
VDIV_F64(v0, v0, d0);
break;
case 0x5F:
INST_NAME("MAXSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
// MAXSD: if any input is NaN, or Ex[0]>Gx[0], copy Ex[0] -> Gx[0]
VCMP_F64(d0, v0);
VMRS_APSR();
VMOVcond_64(cCS, v0, d0); // move v0 <- d0 if v0 or d0 is unordered or d0 >= v0
break;
case 0x70:
INST_NAME("PSHUFLW Gx, Ex, Ib");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
v1 = fpu_get_scratch_quad(dyn);
VLD1Q_64(v1, ed);
}
u8 = F8;
// only low part need to be suffled. VTBL only handle 8bits value, so the 16bits suffles need to be changed in 8bits
u32 = 0;
for (int i=0; i<2; ++i) {
u32 |= (((u8>>(i*2))&3)*2+0)<<(i*16+0);
u32 |= (((u8>>(i*2))&3)*2+1)<<(i*16+8);
}
MOV32(x2, u32);
u32 = 0;
for (int i=2; i<4; ++i) {
u32 |= (((u8>>(i*2))&3)*2+0)<<((i-2)*16+0);
u32 |= (((u8>>(i*2))&3)*2+1)<<((i-2)*16+8);
}
MOV32(x3, u32);
d0 = fpu_get_scratch_double(dyn);
VMOVtoV_D(d0, x2, x3);
VTBL1_8(v0, v1, d0);
if(v0!=v1) {
VMOVD(v0+1, v1+1);
}
break;
case 0x7C:
INST_NAME("HADDPS Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
v1 = fpu_get_scratch_quad(dyn);
VLD1Q_64(v1, ed);
}
VPADD_F32(v0, v0, v0+1);
if(v0==v1) {
VMOVD(v0+1, v0);
} else {
VPADD_F32(v0+1, v1, v1+1);
}
break;
case 0xC2:
INST_NAME("CMPSD Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETEX(d0);
u8 = F8;
if((u8&7)==6){
VCMP_F64(d0, v0);
} else {
VCMP_F64(v0, d0);
}
VMRS_APSR();
MOVW(x2, 0);
switch(u8&7) {
case 0: MVN_COND_REG_LSL_IMM5(cEQ, x2, x2, 0); break; // Equal
case 1: MVN_COND_REG_LSL_IMM5(cMI, x2, x2, 0); break; // Less than
case 2: MVN_COND_REG_LSL_IMM5(cLE, x2, x2, 0); break; // Less or equal
case 3: MVN_COND_REG_LSL_IMM5(cVS, x2, x2, 0); break; // NaN
case 4: MVN_COND_REG_LSL_IMM5(cNE, x2, x2, 0); break; // Not Equal (or unordered on ARM, not on X86...)
case 5: MVN_COND_REG_LSL_IMM5(cCS, x2, x2, 0); break; // Greater or equal or unordered
case 6: MVN_COND_REG_LSL_IMM5(cLT, x2, x2, 0); break; // Greater or unordered, test inverted, N!=V so unordereded or less than (inverted)
case 7: MVN_COND_REG_LSL_IMM5(cVC, x2, x2, 0); break; // not NaN
}
VMOVtoV_D(v0, x2, x2);
break;
case 0xF0:
INST_NAME("LDDQ Gx,Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VMOVQ(v0, v1);
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-12, 0);
LDR_IMM9(x2, ed, fixedaddress+0);
LDR_IMM9(x3, ed, fixedaddress+4);
VMOVtoV_D(v0, x2, x3);
LDR_IMM9(x2, ed, fixedaddress+8);
LDR_IMM9(x3, ed, fixedaddress+12);
VMOVtoV_D(v0+1, x2, x3);
}
break;
default:
DEFAULT;
}
return addr;
}
+658
View File
@@ -0,0 +1,658 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
// Get Ex as a single, not a quad, with b a intermediary double
#define GETEX(a, b) \
if((nextop&0xC0)==0xC0) { \
b = sse_get_reg(dyn, ninst, x1, nextop&7); \
if(b<16) \
a = b; \
else { \
a = fpu_get_scratch_double(dyn); \
VMOV_64(a, b); \
} \
a *= 2; \
} else { \
b = fpu_get_scratch_double(dyn); \
a = b*2; \
parity = getedparity(dyn, ninst, addr, nextop, 2); \
if(parity) { \
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 0); \
VLDR_32(a, ed, fixedaddress); \
} else { \
GETED; \
VMOVtoV(a, ed); \
} \
}
#define GETGX(a) \
gd = (nextop&0x38)>>3; \
a = sse_get_reg(dyn, ninst, x1, gd)
uintptr_t dynarecF30F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog)
{
uint8_t opcode = F8;
uint8_t nextop, u8;
int32_t j32;
uint32_t u32;
uint8_t gd, ed;
uint8_t wback;
int fixedaddress;
int v0, v1;
int s0, s1, s2;
int d0, d1;
int q0, q1;
int parity;
MAYUSE(q1);
MAYUSE(s1);
MAYUSE(s2);
MAYUSE(j32);
switch(opcode) {
case 0x10:
INST_NAME("MOVSS Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
v0 = sse_get_reg(dyn, ninst, x1, gd);
q0 = sse_get_reg(dyn, ninst, x1, nextop&7);
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOVD(d0, v0);
}
if(q0<16)
d1 = q0;
else {
d1 = fpu_get_scratch_double(dyn);
VMOVD(d1, q0);
}
VMOV_32(d0*2, d1*2);
if(v0!=d0) {
VMOVD(v0, d0);
}
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
LDR_IMM9(x2, ed, fixedaddress); // to avoid bus errors
VEORQ(v0, v0, v0);
VMOVtoDx_32(v0, 0, x2);
}
break;
case 0x11:
INST_NAME("MOVSS Ex, Gx");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
if((nextop&0xC0)==0xC0) {
q0 = sse_get_reg(dyn, ninst, x1, nextop&7);
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOVD(d0, v0);
}
if(q0<16)
d1 = q0;
else {
d1 = fpu_get_scratch_double(dyn);
VMOVD(d1, q0);
}
VMOV_32(d1*2, d0*2);
if(q0!=d1) {
VMOVD(q0, d1);
}
} else {
VMOVfrDx_32(x2, v0, 0);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
STR_IMM9(x2, ed, fixedaddress);
}
break;
case 0x12:
INST_NAME("MOVSLDUP Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
q1 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
q1 = fpu_get_scratch_quad(dyn);
VLD1Q_64(q1, ed);
}
q0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VDUP_32(q0+0, q1+0, 0);
VDUP_32(q0+1, q1+1, 0);
break;
case 0x16:
INST_NAME("MOVSHDUP Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
q1 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
q1 = fpu_get_scratch_quad(dyn);
VLD1Q_64(q1, ed);
}
q0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VDUP_32(q0+0, q1+0, 1);
VDUP_32(q0+1, q1+1, 1);
break;
case 0x1E:
INST_NAME("NOP / ENDBR32 / ENDBR64");
nextop = F8;
FAKEED;
break;
case 0x1F:
INST_NAME("REP NOP");
nextop = F8;
FAKEED;
break;
case 0x2A:
INST_NAME("CVTSI2SS Gx, Ed");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
GETED;
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
VMOVtoV(s0, ed);
VCVT_F32_S32(s0, s0);
if(d0!=v0) {
VMOV_64(v0, d0);
}
break;
case 0x2C:
INST_NAME("CVTTSS2SI Gd, Ex");
nextop = F8;
GETGD;
s0 = fpu_get_scratch_single(dyn);
if((nextop&0xC0)==0xC0) {
v0 = sse_get_reg(dyn, ninst, x1, nextop&7);
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
VMOV_32(s0, d0*2);
} else {
parity = getedparity(dyn, ninst, addr, nextop, 3);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VLDR_32(s0, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
LDR_IMM9(x2, ed, fixedaddress);
VMOVtoV(s0, x2);
}
}
VCVT_S32_F32(s0, s0);
VMOVfrV(gd, s0);
break;
case 0x2D:
INST_NAME("CVTSS2SI Gd, Ex");
u8 = sse_setround(dyn, ninst, x1, x2, x14);
nextop = F8;
GETGD;
s0 = fpu_get_scratch_single(dyn);
if((nextop&0xC0)==0xC0) {
v0 = sse_get_reg(dyn, ninst, x1, nextop&7);
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
VMOV_32(s0, d0*2);
} else {
parity = getedparity(dyn, ninst, addr, nextop, 3);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VLDR_32(s0, ed, fixedaddress);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095, 0);
LDR_IMM9(x2, ed, fixedaddress);
VMOVtoV(s0, x2);
}
}
VCVTR_S32_F32(s0, s0);
VMOVfrV(gd, s0);
x87_restoreround(dyn, ninst, u8);
break;
case 0x51:
INST_NAME("SQRTSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
VSQRT_F32(s0, s1);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x52:
INST_NAME("RSQRTSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
s2 = fpu_get_scratch_single(dyn);
// so here: F32: Imm8 = abcd efgh that gives => aBbbbbbc defgh000 00000000 00000000
// and want 1.0f = 0x3f800000
// so 00111111 10000000 00000000 00000000
// a = 0, b = 1, c = 1, d = 1, efgh=0
// 0b01110000
VMOV_i_32(s2, 0b01110000);
VSQRT_F32(s0, s1);
VDIV_F32(s0, s2, s0);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x53:
INST_NAME("RCPSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
s2 = fpu_get_scratch_single(dyn);
VMOV_i_32(s2, 0b01110000);
VDIV_F32(s0, s2, s1);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x58:
INST_NAME("ADDSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
VADD_F32(s0, s0, s1);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x59:
INST_NAME("MULSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
VMUL_F32(s0, s0, s1);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x5A:
INST_NAME("CVTSS2SD Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s0, d0);
VCVT_F64_F32(v0, s0);
break;
case 0x5B:
INST_NAME("CVTTPS2DQ Gx, Ex");
nextop = F8;
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
v1 = fpu_get_scratch_quad(dyn);
VLD1Q_64(v1, ed);
}
gd = (nextop&0x38)>>3;
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VCVTQ_S32_F32(v0, v1);
break;
case 0x5C:
INST_NAME("SUBSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
VSUB_F32(s0, s0, s1);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x5D:
INST_NAME("MINSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
// MINSS: if any input is NaN, or Ex[0]<Gx[0], copy Ex[0] -> Gx[0]
VCMP_F32(s0, s1);
VMRS_APSR();
VMOVcond_32(cCS, s0, s1); // move s0 <- s1 if s0 or s1 unordered or s0 >= s1
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x5E:
INST_NAME("DIVSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
VDIV_F32(s0, s0, s1);
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x5F:
INST_NAME("MAXSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
// MAXSS: if any input is NaN, or Ex[0]>Gx[0], copy Ex[0] -> Gx[0]
VCMP_F32(s1, s0);
VMRS_APSR();
VMOVcond_32(cCS, s0, s1); // move s0 <- s1 if s0 or s1 is unordered or s1 >= s0
if(v0!=d0) {
VMOV_64(v0, d0);
}
break;
case 0x6F:
INST_NAME("MOVDQU Gx,Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VMOVQ(v0, v1);
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-12, 0);
LDR_IMM9(x2, ed, fixedaddress+0);
LDR_IMM9(x3, ed, fixedaddress+4);
VMOVtoV_D(v0, x2, x3);
LDR_IMM9(x2, ed, fixedaddress+8);
LDR_IMM9(x3, ed, fixedaddress+12);
VMOVtoV_D(v0+1, x2, x3);
}
break;
case 0x70:
INST_NAME("PSHUFHW Gx, Ex, Ib");
nextop = F8;
gd = (nextop&0x38)>>3;
v0 = sse_get_reg(dyn, ninst, x1, gd);
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
v1 = fpu_get_scratch_quad(dyn);
VLD1Q_64(v1, ed);
}
u8 = F8;
// only high part need to be shuffled. VTBL only handle 8bits value, so the 16bits shuffles need to be changed in 8bits
u32 = 0;
for (int i=0; i<2; ++i) {
u32 |= (((u8>>(i*2))&3)*2+0)<<(i*16+0);
u32 |= (((u8>>(i*2))&3)*2+1)<<(i*16+8);
}
MOV32(x2, u32);
u32 = 0;
for (int i=2; i<4; ++i) {
u32 |= (((u8>>(i*2))&3)*2+0)<<((i-2)*16+0);
u32 |= (((u8>>(i*2))&3)*2+1)<<((i-2)*16+8);
}
MOV32(x3, u32);
d0 = fpu_get_scratch_double(dyn);
VMOVtoV_D(d0, x2, x3);
VTBL1_8(v0+1, v1+1, d0);
if(v0!=v1) {
VMOVD(v0, v1);
}
break;
case 0x7E:
INST_NAME("MOVQ Gx, Ex");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
VMOVD(v0, v1);
} else {
v0 = sse_get_reg_empty(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 0, 0);
VLD1_64(v0, ed);
}
VEOR(v0+1, v0+1, v0+1);
break;
case 0x7F:
INST_NAME("MOVDQU Ex,Gx");
nextop = F8;
gd = (nextop&0x38)>>3;
if((nextop&0xC0)==0xC0) {
v0 = sse_get_reg(dyn, ninst, x1, gd);
v1 = sse_get_reg_empty(dyn, ninst, x1, nextop&7);
VMOVQ(v1, v0);
} else {
v0 = sse_get_reg(dyn, ninst, x1, gd);
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-12, 0);
VMOVfrV_D(x2, x3, v0);
STR_IMM9(x2, ed, fixedaddress+0);
STR_IMM9(x3, ed, fixedaddress+4);
VMOVfrV_D(x2, x3, v0+1);
STR_IMM9(x2, ed, fixedaddress+8);
STR_IMM9(x3, ed, fixedaddress+12);
}
break;
case 0xBC:
INST_NAME("TZCNT Gd, Ed");
SETFLAGS(X_CF|X_ZF, SF_SET);
nextop = F8;
GETED;
GETGD;
SET_DFNONE(x3);
TSTS_REG_LSL_IMM5(ed, ed, 0);
MOVW_COND(cEQ, x3, 1);
MOVW_COND(cNE, x3, 0);
BFI(xFlags, x3, F_CF, 1); // CF = is source 0?
RBIT(x3, ed); // reverse
CLZ(gd, x3); // x2 gets leading 0 == TZCNT
TSTS_REG_LSL_IMM5(gd, gd, 0);
MOVW_COND(cEQ, x3, 1);
MOVW_COND(cNE, x3, 0);
BFI(xFlags, x3, F_ZF, 1); // ZF = is dest 0?
break;
case 0xC2:
INST_NAME("CMPSS Gx, Ex");
nextop = F8;
GETGX(v0);
GETEX(s1, v1);
if(v0==v1)
d0 = s1/2;
else
if(v0<16)
d0 = v0;
else {
d0 = fpu_get_scratch_double(dyn);
VMOV_64(d0, v0);
}
s0 = d0*2;
u8 = F8;
if((u8&7)==6){
VCMP_F32(s1, s0);
} else {
VCMP_F32(s0, s1);
}
VMRS_APSR();
MOVW(x2, 0);
switch(u8&7) {
case 0: MVN_COND_REG_LSL_IMM5(cEQ, x2, x2, 0); break; // Equal
case 1: MVN_COND_REG_LSL_IMM5(cMI, x2, x2, 0); break; // Less than
case 2: MVN_COND_REG_LSL_IMM5(cLE, x2, x2, 0); break; // Less or equal
case 3: MVN_COND_REG_LSL_IMM5(cVS, x2, x2, 0); break; // NaN
case 4: MVN_COND_REG_LSL_IMM5(cNE, x2, x2, 0); break; // Not Equal (or unordered on ARM, not on X86...)
case 5: MVN_COND_REG_LSL_IMM5(cCS, x2, x2, 0); break; // Greater or equal or unordered
case 6: MVN_COND_REG_LSL_IMM5(cLT, x2, x2, 0); break; // Greater or unordered, test inverted, N!=V so unordereded or less than (inverted)
case 7: MVN_COND_REG_LSL_IMM5(cVC, x2, x2, 0); break; // not NaN
}
VMOVtoDx_32(v0, 0, x2);
break;
case 0xE6:
INST_NAME("CVTDQ2PD Gx, Ex");
nextop = F8;
if((nextop&0xC0)==0xC0) {
v1 = sse_get_reg(dyn, ninst, x1, nextop&7);
if(v1<16)
v0 = v1;
else {
v0 = fpu_get_scratch_double(dyn);
VMOV_64(v0, v1); // vfpu opcode here
}
} else {
v0 = fpu_get_scratch_double(dyn);
parity = getedparity(dyn, ninst, addr, nextop, 3);
if(parity) {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 1023, 3);
VLDR_64(v0, ed, fixedaddress); // vfpu opcode here
} else {
addr = geted(dyn, addr, ninst, nextop, &ed, x1, &fixedaddress, 4095-8, 0);
LDR_IMM9(x2, ed, fixedaddress);
LDR_IMM9(x3, ed, fixedaddress+4);
VMOVtoV_D(v0, x2, x3);
}
}
gd = (nextop&0x38)>>3;
q0 = sse_get_reg_empty(dyn, ninst, x1, gd);
//v0 is a low reg now
VCVT_F64_S32(q0+1, v0*2+1);
VCVT_F64_S32(q0+0, v0*2+0);
break;
default:
DEFAULT;
}
return addr;
}
+354
View File
@@ -0,0 +1,354 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "tools/bridge_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "callback.h"
#include "emu/x86run_private.h"
#include "emu/x87emu_private.h"
#include "x86trace.h"
#include "signals.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "dynarec_arm_functions.h"
void arm_fstp(x86emu_t* emu, void* p)
{
if(ST0.q!=STld(0).ref)
D2LD(&ST0.d, p);
else
memcpy(p, &STld(0).ld, 10);
}
void arm_print_armreg(x86emu_t* emu, uintptr_t reg, uintptr_t n)
{
dynarec_log(LOG_DEBUG, "R%d=0x%x (%d)\n", n, reg, reg);
}
void arm_f2xm1(x86emu_t* emu)
{
ST0.d = exp2(ST0.d) - 1.0;
}
void arm_fyl2x(x86emu_t* emu)
{
ST(1).d = log2(ST0.d)*ST(1).d;
}
void arm_ftan(x86emu_t* emu)
{
ST0.d = tan(ST0.d);
}
void arm_fpatan(x86emu_t* emu)
{
ST1.d = atan2(ST1.d, ST0.d);
}
void arm_fxtract(x86emu_t* emu)
{
int32_t tmp32s = (ST1.q&0x7ff0000000000000LL)>>52;
tmp32s -= 1023;
ST1.d /= exp2(tmp32s);
ST0.d = tmp32s;
}
void arm_fprem(x86emu_t* emu)
{
int32_t tmp32s = ST0.d / ST1.d;
ST0.d -= ST1.d * tmp32s;
emu->sw.f.F87_C2 = 0;
emu->sw.f.F87_C0 = (tmp32s&1);
emu->sw.f.F87_C3 = ((tmp32s>>1)&1);
emu->sw.f.F87_C1 = ((tmp32s>>2)&1);
}
void arm_fyl2xp1(x86emu_t* emu)
{
ST(1).d = log2(ST0.d + 1.0)*ST(1).d;
}
void arm_fsincos(x86emu_t* emu)
{
sincos(ST1.d, &ST1.d, &ST0.d);
}
void arm_frndint(x86emu_t* emu)
{
ST0.d = fpu_round(emu, ST0.d);
}
void arm_fscale(x86emu_t* emu)
{
ST0.d *= exp2(trunc(ST1.d));
}
void arm_fsin(x86emu_t* emu)
{
ST0.d = sin(ST0.d);
}
void arm_fcos(x86emu_t* emu)
{
ST0.d = cos(ST0.d);
}
void arm_fbld(x86emu_t* emu, uint8_t* ed)
{
fpu_fbld(emu, ed);
}
void arm_fild64(x86emu_t* emu, int64_t* ed)
{
int64_t tmp;
memcpy(&tmp, ed, sizeof(tmp));
ST0.d = tmp;
STll(0).ll = tmp;
STll(0).ref = ST0.q;
}
void arm_fbstp(x86emu_t* emu, uint8_t* ed)
{
fpu_fbst(emu, ed);
}
void arm_fistp64(x86emu_t* emu, int64_t* ed)
{
// used of memcpy to avoid aligments issues
if(STll(0).ref==ST(0).q) {
memcpy(ed, &STll(0).ll, sizeof(int64_t));
} else {
int64_t tmp;
if(isgreater(ST0.d, (double)(int64_t)0x7fffffffffffffffLL) || isless(ST0.d, (double)(int64_t)0x8000000000000000LL) || !isfinite(ST0.d))
tmp = 0x8000000000000000LL;
else
tmp = fpu_round(emu, ST0.d);
memcpy(ed, &tmp, sizeof(tmp));
}
}
void arm_fistt64(x86emu_t* emu, int64_t* ed)
{
// used of memcpy to avoid aligments issues
int64_t tmp = ST0.d;
memcpy(ed, &tmp, sizeof(tmp));
}
void arm_fld(x86emu_t* emu, uint8_t* ed)
{
memcpy(&STld(0).ld, ed, 10);
LD2D(&STld(0), &ST(0).d);
STld(0).ref = ST0.q;
}
void arm_ud(x86emu_t* emu)
{
emit_signal(emu, SIGILL, (void*)R_EIP, 0);
}
void arm_fsave(x86emu_t* emu, uint8_t* ed)
{
fpu_savenv(emu, (char*)ed, 0);
uint8_t* p = ed;
p += 28;
for (int i=0; i<8; ++i) {
LD2D(p, &ST(i).d);
p+=10;
}
}
void arm_frstor(x86emu_t* emu, uint8_t* ed)
{
fpu_loadenv(emu, (char*)ed, 0);
uint8_t* p = ed;
p += 28;
for (int i=0; i<8; ++i) {
D2LD(&ST(i).d, p);
p+=10;
}
}
void arm_fprem1(x86emu_t* emu)
{
// simplified version
int32_t tmp32s = round(ST0.d / ST1.d);
ST0.d -= ST1.d*tmp32s;
emu->sw.f.F87_C2 = 0;
emu->sw.f.F87_C0 = (tmp32s&1);
emu->sw.f.F87_C3 = ((tmp32s>>1)&1);
emu->sw.f.F87_C1 = ((tmp32s>>2)&1);
}
// Get a FPU single scratch reg
int fpu_get_scratch_single(dynarec_arm_t* dyn)
{
return dyn->fpu_scratch++; // return an Sx
}
// Get a FPU double scratch reg
int fpu_get_scratch_double(dynarec_arm_t* dyn)
{
int i = (dyn->fpu_scratch+1)&(~1);
dyn->fpu_scratch = i+2;
return i/2; // return a Dx
}
// Get a FPU quad scratch reg
int fpu_get_scratch_quad(dynarec_arm_t* dyn)
{
if(dyn->fpu_scratch>4) {
if(dyn->fpu_extra_qscratch) {
dynarec_log(LOG_NONE, "Warning, Extra QScratch slot taken and need another one!\n");
} else
dyn->fpu_extra_qscratch = fpu_get_reg_quad(dyn);
return dyn->fpu_extra_qscratch;
}
int i = (dyn->fpu_scratch+3)&(~3);
dyn->fpu_scratch = i+4;
return i/2; // Return a Dx, not a Qx
}
// Reset scratch regs counter
void fpu_reset_scratch(dynarec_arm_t* dyn)
{
dyn->fpu_scratch = 0;
if(dyn->fpu_extra_qscratch) {
fpu_free_reg_quad(dyn, dyn->fpu_extra_qscratch);
dyn->fpu_extra_qscratch = 0;
}
}
#define FPUFIRST 8
// Get a FPU double reg
int fpu_get_reg_double(dynarec_arm_t* dyn)
{
// TODO: check upper limit?
int i=0;
while (dyn->fpuused[i]) ++i;
dyn->fpuused[i] = 1;
return i+FPUFIRST; // return a Dx
}
// Free a FPU double reg
void fpu_free_reg_double(dynarec_arm_t* dyn, int reg)
{
// TODO: check upper limit?
int i=reg-FPUFIRST;
dyn->fpuused[i] = 0;
}
// Get a FPU quad reg
int fpu_get_reg_quad(dynarec_arm_t* dyn)
{
int i=0;
while (dyn->fpuused[i] || dyn->fpuused[i+1]) i+=2;
dyn->fpuused[i] = dyn->fpuused[i+1] = 1;
return i+FPUFIRST; // Return a Dx, not a Qx
}
// Free a FPU quad reg
void fpu_free_reg_quad(dynarec_arm_t* dyn, int reg)
{
int i=reg-FPUFIRST;
dyn->fpuused[i] = dyn->fpuused[i+1] = 0;
}
// Reset fpu regs counter
void fpu_reset_reg(dynarec_arm_t* dyn)
{
dyn->fpu_reg = 0;
for (int i=0; i<24; ++i)
dyn->fpuused[i]=0;
}
#define F8 *(uint8_t*)(addr++)
#define F32 *(uint32_t*)(addr+=4, addr-4)
// Get if ED will have the correct parity. Not emiting anything. Parity is 2 for DWORD or 3 for QWORD
int getedparity(dynarec_arm_t* dyn, int ninst, uintptr_t addr, uint8_t nextop, int parity)
{
uint32_t tested = (1<<parity)-1;
if((nextop&0xC0)==0xC0)
return 0; // direct register, no parity...
if(!(nextop&0xC0)) {
if((nextop&7)==4) {
uint8_t sib = F8;
int sib_reg = (sib>>3)&7;
if((sib&0x7)==5) {
uint32_t tmp = F32;
if (sib_reg!=4) {
// if XXXXXX+reg<<N then check parity of XXXXX and N should be enough
return ((tmp&tested)==0 && (sib>>6)>=parity)?1:0;
} else {
// just a constant...
return (tmp&tested)?0:1;
}
} else {
if(sib_reg==4 && parity<3)
return 0; // simple [reg]
// don't try [reg1 + reg2<<N], unless reg1 is ESP
return ((sib&0x7)==4 && (sib>>6)>=parity)?1:0;
}
} else if((nextop&7)==5) {
uint32_t tmp = F32;
return (tmp&tested)?0:1;
} else {
return 0;
}
} else {
return 0; //Form [reg1 + reg2<<N + XXXXXX]
}
}
// Do the GETED, but don't emit anything...
uintptr_t fakeed(dynarec_arm_t* dyn, uintptr_t addr, int ninst, uint8_t nextop)
{
if((nextop&0xC0)==0xC0)
return addr;
if(!(nextop&0xC0)) {
if((nextop&7)==4) {
uint8_t sib = F8;
if((sib&0x7)==5) {
addr+=4;
}
} else if((nextop&7)==5) {
addr+=4;
}
} else {
if((nextop&7)==4) {
++addr;
}
if(nextop&0x80) {
addr+=4;
} else {
++addr;
}
}
return addr;
}
#undef F8
#undef F32
int isNativeCall(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t* calladdress, int* retn)
{
#define PK(a) *(uint8_t*)(addr+a)
#define PK32(a) *(uint32_t*)(addr+a)
if(!addr)
return 0;
if(PK(0)==0xff && PK(1)==0x25) { // absolute jump, maybe the GOT
uintptr_t a1 = (PK32(2)); // need to add a check to see if the address is from the GOT !
addr = *(uint32_t*)a1;
}
if(addr<0x10000) // too low, that is suspicious
return 0;
onebridge_t *b = (onebridge_t*)(addr);
if(b->CC==0xCC && b->S=='S' && b->C=='C' && b->w!=(wrapper_t)0 && b->f!=(uintptr_t)PltResolver) {
// found !
if(retn) *retn = (b->C3==0xC2)?b->N:0;
if(calladdress) *calladdress = addr+1;
return 1;
}
return 0;
#undef PK32
#undef PK
}
+61
View File
@@ -0,0 +1,61 @@
#ifndef __DYNAREC_ARM_FUNCTIONS_H__
#define __DYNAREC_ARM_FUNCTIONS_H__
typedef struct x86emu_s x86emu_t;
void arm_fstp(x86emu_t* emu, void* p);
void arm_print_armreg(x86emu_t* emu, uintptr_t reg, uintptr_t n);
void arm_f2xm1(x86emu_t* emu);
void arm_fyl2x(x86emu_t* emu);
void arm_ftan(x86emu_t* emu);
void arm_fpatan(x86emu_t* emu);
void arm_fxtract(x86emu_t* emu);
void arm_fprem(x86emu_t* emu);
void arm_fyl2xp1(x86emu_t* emu);
void arm_fsincos(x86emu_t* emu);
void arm_frndint(x86emu_t* emu);
void arm_fscale(x86emu_t* emu);
void arm_fsin(x86emu_t* emu);
void arm_fcos(x86emu_t* emu);
void arm_fbld(x86emu_t* emu, uint8_t* ed);
void arm_fild64(x86emu_t* emu, int64_t* ed);
void arm_fbstp(x86emu_t* emu, uint8_t* ed);
void arm_fistp64(x86emu_t* emu, int64_t* ed);
void arm_fistt64(x86emu_t* emu, int64_t* ed);
void arm_fld(x86emu_t* emu, uint8_t* ed);
void arm_fsave(x86emu_t* emu, uint8_t* ed);
void arm_frstor(x86emu_t* emu, uint8_t* ed);
void arm_fprem1(x86emu_t* emu);
void arm_ud(x86emu_t* emu);
// Get an FPU single scratch reg
int fpu_get_scratch_single(dynarec_arm_t* dyn);
// Get an FPU double scratch reg
int fpu_get_scratch_double(dynarec_arm_t* dyn);
// Get an FPU quad scratch reg
int fpu_get_scratch_quad(dynarec_arm_t* dyn);
// Reset scratch regs counter
void fpu_reset_scratch(dynarec_arm_t* dyn);
// Get an FPU double reg
int fpu_get_reg_double(dynarec_arm_t* dyn);
// Free a FPU double reg
void fpu_free_reg_double(dynarec_arm_t* dyn, int reg);
// Get an FPU quad reg
int fpu_get_reg_quad(dynarec_arm_t* dyn);
// Free a FPU quad reg
void fpu_free_reg_quad(dynarec_arm_t* dyn, int reg);
// Reset fpu regs counter
void fpu_reset_reg(dynarec_arm_t* dyn);
// Get if ED will have the correct parity. Not emiting anything. Parity is 2 for DWORD or 3 for QWORD
int getedparity(dynarec_arm_t* dyn, int ninst, uintptr_t addr, uint8_t nextop, int parity);
// Do the GETED, but don't emit anything...
uintptr_t fakeed(dynarec_arm_t* dyn, uintptr_t addr, int ninst, uint8_t nextop);
// Is what pointed at addr a native call? And if yes, to what function?
int isNativeCall(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t* calladdress, int* retn);
#endif //__DYNAREC_ARM_FUNCTIONS_H__
+1146
View File
File diff suppressed because it is too large. Load diff
+668
View File
@@ -0,0 +1,668 @@
#ifndef __DYNAREC_ARM_HELPER_H__
#define __DYNAREC_ARM_HELPER_H__
#if STEP == 0
#include "dynarec_arm_pass0.h"
#elif STEP == 1
#include "dynarec_arm_pass1.h"
#elif STEP == 2
#include "dynarec_arm_pass2.h"
#elif STEP == 3
#include "dynarec_arm_pass3.h"
#endif
#include "debug.h"
#include "arm_emitter.h"
#include "../emu/x86primop.h"
#define F8 *(uint8_t*)(addr++)
#define F8S *(int8_t*)(addr++)
#define F16 *(uint16_t*)(addr+=2, addr-2)
#define F16S *(int16_t*)(addr+=2, addr-2)
#define F32 *(uint32_t*)(addr+=4, addr-4)
#define F32S *(int32_t*)(addr+=4, addr-4)
#define PK(a) *(uint8_t*)(addr+a)
#define PK32(a) *(uint32_t*)(addr+a)
#define PK16(a) *(uint16_t*)(addr+a)
#define PKip(a) *(uint8_t*)(ip+a)
// GETGD get x86 register in gd
#define GETGD gd = xEAX+((nextop&0x38)>>3)
//GETED can use r1 for ed, and r2 for wback. wback is 0 if ed is xEAX..xEDI
#define GETED if((nextop&0xC0)==0xC0) { \
ed = xEAX+(nextop&7); \
wback = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 4095, 0); \
LDR_IMM9(x1, wback, fixedaddress); \
ed = x1; \
}
//GETEDH can use hint for ed, and r1 or r2 for wback (depending on hint). wback is 0 if ed is xEAX..xEDI
#define GETEDH(hint) if((nextop&0xC0)==0xC0) { \
ed = xEAX+(nextop&7); \
wback = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, (hint==x2)?x1:x2, &fixedaddress, 4095, 0); \
LDR_IMM9(hint, wback, fixedaddress); \
ed = hint; \
}
//GETEDW can use hint for wback and ret for ed. wback is 0 if ed is xEAX..xEDI
#define GETEDW(hint, ret) if((nextop&0xC0)==0xC0) { \
ed = xEAX+(nextop&7); \
MOV_REG(ret, ed); \
wback = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, hint, &fixedaddress, 4095, 0); \
ed = ret; \
LDR_IMM9(ed, wback, fixedaddress); \
}
// Write back ed in wback (if wback not 0)
#define WBACK if(wback) {STR_IMM9(ed, wback, fixedaddress);}
// Send back wb to either ed or wback
#define SBACK(wb) if(wback) {STR_IMM9(wb, wback, fixedaddress);} else {MOV_REG(ed, wb);}
//GETEDO can use r1 for ed, and r2 for wback. wback is 0 if ed is xEAX..xEDI
#define GETEDO(O) if((nextop&0xC0)==0xC0) { \
ed = xEAX+(nextop&7); \
wback = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0); \
LDR_REG_LSL_IMM5(x1, wback, O, 0); \
ed = x1; \
}
//GETEDO can use r1 for ed, and r2 for wback. wback is 0 if ed is xEAX..xEDI, else O is added to wback
#define GETEDO2(O) if((nextop&0xC0)==0xC0) { \
ed = xEAX+(nextop&7); \
wback = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, 0, 0); \
ADD_REG_LSL_IMM5(wback, wback, O, 0);\
LDR_IMM9(x1, wback, 0); \
ed = x1; \
}
#define WBACKO(O) if(wback) {STR_REG_LSL_IMM5(ed, wback, O, 0);}
//FAKEELike GETED, but doesn't get anything
#define FAKEED if((nextop&0xC0)!=0xC0) { \
addr = fakeed(dyn, addr, ninst, nextop); \
}
// GETGW extract x86 register in gd, that is i
#define GETGW(i) gd = xEAX+((nextop&0x38)>>3); UXTH(i, gd, 0); gd = i;
//GETEWW will use i for ed, and can use w for wback.
#define GETEWW(w, i) if((nextop&0xC0)==0xC0) { \
wback = xEAX+(nextop&7);\
UXTH(i, wback, 0); \
ed = i; \
wb1 = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, w, &fixedaddress, 255, 0); \
LDRH_IMM8(i, wback, fixedaddress); \
ed = i; \
wb1 = 1; \
}
//GETEW will use i for ed, and can use r3 for wback.
#define GETEW(i) if((nextop&0xC0)==0xC0) { \
wback = xEAX+(nextop&7);\
UXTH(i, wback, 0); \
ed = i; \
wb1 = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 255, 0); \
LDRH_IMM8(i, wback, fixedaddress); \
ed = i; \
wb1 = 1; \
}
//GETSEW will use i for ed, and can use r3 for wback. This is the Signed version
#define GETSEW(i) if((nextop&0xC0)==0xC0) { \
wback = xEAX+(nextop&7);\
SXTH(i, wback, 0); \
ed = i; \
wb1 = 0; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 255, 0); \
LDRSH_IMM8(i, wback, fixedaddress);\
ed = i; \
wb1 = 1; \
}
// Write ed back to original register / memory
#define EWBACK if(wb1) {STRH_IMM8(ed, wback, fixedaddress);} else {BFI(wback, ed, 0, 16);}
// Write w back to original register / memory
#define EWBACKW(w) if(wb1) {STRH_IMM8(w, wback, fixedaddress);} else {BFI(wback, w, 0, 16);}
// Write back gd in correct register
#define GWBACK BFI((xEAX+((nextop&0x38)>>3)), gd, 0, 16);
//GETEB will use i for ed, and can use r3 for wback.
#define GETEB(i) if((nextop&0xC0)==0xC0) { \
wback = (nextop&7); \
wb2 = (wback>>2); \
wback = xEAX+(wback&3); \
UXTB(i, wback, wb2); \
wb1 = 0; \
ed = i; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 4095, 0); \
LDRB_IMM9(i, wback, fixedaddress); \
wb1 = 1; \
ed = i; \
}
//GETEBO will use i for ed, i is also Offset, and can use r3 for wback.
#define GETEBO(i) if((nextop&0xC0)==0xC0) { \
wback = (nextop&7); \
wb2 = (wback>>2); \
wback = xEAX+(wback&3); \
UXTB(i, wback, wb2); \
wb1 = 0; \
ed = i; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 0, 0); \
ADD_REG_LSL_IMM5(wback, wback, i, 0); \
LDRB_IMM9(i, wback, fixedaddress); \
wb1 = 1; \
ed = i; \
}
//GETSEB sign extend EB, will use i for ed, and can use r3 for wback.
#define GETSEB(i) if((nextop&0xC0)==0xC0) { \
wback = (nextop&7); \
wb2 = (wback>>2); \
wback = xEAX+(wback&3); \
SXTB(i, wback, wb2); \
wb1 = 0; \
ed = i; \
} else { \
addr = geted(dyn, addr, ninst, nextop, &wback, x3, &fixedaddress, 255, 0); \
LDRSB_IMM8(i, wback, fixedaddress);\
wb1 = 1; \
ed = i; \
}
// Write eb (ed) back to original register / memory
#define EBBACK if(wb1) {STRB_IMM9(ed, wback, fixedaddress);} else {BFI(wback, ed, wb2*8, 8);}
//GETGB will use i for gd
#define GETGB(i) gd = (nextop&0x38)>>3; \
gb2 = ((gd&4)>>2); \
gb1 = xEAX+(gd&3); \
gd = i; \
UXTB(gd, gb1, gb2);
//GETSGB signe extend GB, will use i for gd
#define GETSGB(i) gd = (nextop&0x38)>>3; \
gb2 = ((gd&4)>>2); \
gb1 = xEAX+(gd&3); \
gd = i; \
SXTB(gd, gb1, gb2);
// Write gb (gd) back to original register / memory
#define GBBACK BFI(gb1, gd, gb2*8, 8);
// Get Direction with size Z and based of F_DF flag, on register r ready for LDR/STR fetching
// F_DF is 1<<10, so 1 ROR 11*2 (so F_OF)
#define GETDIR(r, A) \
TSTS_IMM8_ROR(xFlags, 1, 0x0b); \
MOVW(r, A); \
RSB_COND_IMM8(cNE, r, r, 0)
// CALL will use x14 for the call address. Return value can be put in ret (unless ret is -1)
// R0 will not be pushed/popd if ret is -2
#define CALL(F, ret, M) call_c(dyn, ninst, F, x14, ret, M, 1)
// CALL_ will use x3 for the call address. Return value can be put in ret (unless ret is -1)
// R0 will not be pushed/popd if ret is -2
#define CALL_(F, ret, M) call_c(dyn, ninst, F, x3, ret, M, 1)
// CALL_S will use x3 for the call address. Return value can be put in ret (unless ret is -1)
// R0 will not be pushed/popd if ret is -2. Flags are not save/restored
#define CALL_S(F, ret, M) call_c(dyn, ninst, F, x3, ret, M, 0)
#define MARK if(dyn->insts) {dyn->insts[ninst].mark = (uintptr_t)dyn->arm_size;}
#define GETMARK ((dyn->insts)?dyn->insts[ninst].mark:(dyn->arm_size+4))
#define MARK2 if(dyn->insts) {dyn->insts[ninst].mark2 = (uintptr_t)dyn->arm_size;}
#define GETMARK2 ((dyn->insts)?dyn->insts[ninst].mark2:(dyn->arm_size+4))
#define MARK3 if(dyn->insts) {dyn->insts[ninst].mark3 = (uintptr_t)dyn->arm_size;}
#define GETMARK3 ((dyn->insts)?dyn->insts[ninst].mark3:(dyn->arm_size+4))
#define MARKF if(dyn->insts) {dyn->insts[ninst].markf = (uintptr_t)dyn->arm_size;}
#define GETMARKF ((dyn->insts)?dyn->insts[ninst].markf:(dyn->arm_size+4))
#define MARKSEG if(dyn->insts) {dyn->insts[ninst].markseg = (uintptr_t)dyn->arm_size;}
#define GETMARKSEG ((dyn->insts)?dyn->insts[ninst].markseg:(dyn->arm_size+4))
#define MARKLOCK if(dyn->insts) {dyn->insts[ninst].marklock = (uintptr_t)dyn->arm_size;}
#define GETMARKLOCK ((dyn->insts)?dyn->insts[ninst].marklock:(dyn->arm_size+4))
// Branch to MARK if cond (use j32)
#define B_MARK(cond) \
j32 = GETMARK-(dyn->arm_size+8); \
Bcond(cond, j32)
// Branch to MARK2 if cond (use j32)
#define B_MARK2(cond) \
j32 = GETMARK2-(dyn->arm_size+8); \
Bcond(cond, j32)
// Branch to MARK3 if cond (use j32)
#define B_MARK3(cond) \
j32 = GETMARK3-(dyn->arm_size+8); \
Bcond(cond, j32)
// Branch to next instruction if cond (use j32)
#define B_NEXT(cond) \
j32 = (dyn->insts)?(dyn->insts[ninst].epilog-(dyn->arm_size+8)):0; \
Bcond(cond, j32)
// Branch to MARKSEG if cond (use j32)
#define B_MARKSEG(cond) \
j32 = GETMARKSEG-(dyn->arm_size+8); \
Bcond(cond, j32)
// Branch to MARKLOCK if cond (use j32)
#define B_MARKLOCK(cond) \
j32 = GETMARKLOCK-(dyn->arm_size+8); \
Bcond(cond, j32)
#define IFX(A) if(dyn->insts && (dyn->insts[ninst].x86.need_flags&(A)))
#define IFX_PENDOR0 if(dyn->insts && (dyn->insts[ninst].x86.need_flags&(X_PEND) || !dyn->insts[ninst].x86.need_flags))
#define IFXX(A) if(dyn->insts && (dyn->insts[ninst].x86.need_flags==(A)))
#define IFX2X(A, B) if(dyn->insts && (dyn->insts[ninst].x86.need_flags==(A) || dyn->insts[ninst].x86.need_flags==(B) || dyn->insts[ninst].x86.need_flags==((A)|(B))))
#define IFXN(A, B) if(dyn->insts && (dyn->insts[ninst].x86.need_flags&(A) && !(dyn->insts[ninst].x86.need_flags&(B))))
// Generate FCOM with s1 and s2 scratch regs (the VCMP is already done)
#define FCOM(s1, s2) \
VMRS_APSR(); /* 0b0100011100000000 */ \
LDRH_IMM8(s1, xEmu, offsetof(x86emu_t, sw)); /*offset is 8bits right?*/ \
BIC_IMM8(s1, s1, 0b01000111, 12); \
ORR_IMM8_COND(cVS, s1, s1, 0b01000101, 12); /* unordered */ \
ORR_IMM8_COND(cEQ, s1, s1, 0b01000000, 12); /* equal */ \
ORR_IMM8_COND(cMI, s1, s1, 0b00000001, 12); /* less than */ \
/* greater than leave 0 */ \
STRH_IMM8(s1, xEmu, offsetof(x86emu_t, sw))
// Generate FCOMI with s1 and s2 scratch regs (the VCMP is already done)
#define FCOMI(s1, s2) \
IFX(X_CF|X_PF|X_ZF|X_PEND) { \
VMRS_APSR(); /* 0b111 */ \
BIC_IMM8(xFlags, xFlags, 0b1000101, 0); \
ORR_IMM8_COND(cVS, xFlags, xFlags, 0b01000101, 0); /* unordered */ \
ORR_IMM8_COND(cEQ, xFlags, xFlags, 0b01000000, 0); /* zero */ \
ORR_IMM8_COND(cMI, xFlags, xFlags, 0b00000001, 0); /* less than */ \
/* greater than leave 0 */ \
} \
SET_DFNONE(s1); \
IFX(X_OF|X_PEND) { \
BFC(xFlags, F_OF, 1); \
} \
IFX(X_AF|X_PEND) { \
BFC(xFlags, F_AF, 1); \
} \
IFX(X_SF|X_PEND) { \
BFC(xFlags, F_SF, 1); \
} \
#define SET_DFNONE(S) if(!dyn->dfnone) {MOVW(S, d_none); STR_IMM9(S, xEmu, offsetof(x86emu_t, df)); dyn->dfnone=1;}
#define SET_DF(S, N) if(N) {MOVW(S, N); STR_IMM9(S, xEmu, offsetof(x86emu_t, df)); dyn->dfnone=0;} else SET_DFNONE(S)
#define SET_NODF() dyn->dfnone = 0
#define SET_DFOK() dyn->dfnone = 1
#ifndef READFLAGS
#define READFLAGS(A) \
if(((A)!=X_PEND) && dyn->state_flags!=SF_SET) { \
if(dyn->state_flags!=SF_PENDING) { \
LDR_IMM9(x3, xEmu, offsetof(x86emu_t, df)); \
TSTS_REG_LSL_IMM5(x3, x3, 0); \
j32 = (GETMARKF)-(dyn->arm_size+8); \
Bcond(cEQ, j32); \
} \
CALL_(UpdateFlags, -1, 0); \
MARKF; \
dyn->state_flags = SF_SET; \
SET_DFOK(); \
}
#endif
#ifndef SETFLAGS
#define SETFLAGS(A, B) \
if(dyn->state_flags!=SF_SET && B==SF_SUBSET && (dyn->insts[ninst].x86.need_flags&(~((A)|X_PEND)))) \
READFLAGS(dyn->insts[ninst].x86.need_flags&(~(A))); \
dyn->state_flags = (B==SF_SUBSET)?SF_SET:B
#endif
#ifndef JUMP
#define JUMP(A)
#endif
#ifndef BARRIER
#define BARRIER(A)
#endif
#ifndef BARRIER_NEXT
#define BARRIER_NEXT(A)
#endif
#define UFLAG_OP1(A) if(dyn->insts && dyn->insts[ninst].x86.need_flags) {STR_IMM9(A, xEmu, offsetof(x86emu_t, op1));}
#define UFLAG_OP2(A) if(dyn->insts && dyn->insts[ninst].x86.need_flags) {STR_IMM9(A, xEmu, offsetof(x86emu_t, op2));}
#define UFLAG_OP12(A1, A2) if(dyn->insts && dyn->insts[ninst].x86.need_flags) {STR_IMM9(A1, xEmu, offsetof(x86emu_t, op1));STR_IMM9(A2, 0, offsetof(x86emu_t, op2));}
#define UFLAG_RES(A) if(dyn->insts && dyn->insts[ninst].x86.need_flags) {STR_IMM9(A, xEmu, offsetof(x86emu_t, res));}
#define UFLAG_DF(r, A) if(dyn->insts && dyn->insts[ninst].x86.need_flags) {SET_DF(r, A)}
#define UFLAG_IF if(dyn->insts && dyn->insts[ninst].x86.need_flags)
#ifndef DEFAULT
#define DEFAULT *ok = -1; BARRIER(2)
#endif
#ifndef NEW_BARRIER_INST
#define NEW_BARRIER_INST
#endif
#if STEP < 2
#define PASS2IF(A, B) if(A)
#elif STEP == 2
#define PASS2IF(A, B) if(A) dyn->insts[ninst].pass2choice = B; if(dyn->insts[ninst].pass2choice == B)
#else
#define PASS2IF(A, B) if(dyn->insts[ninst].pass2choice == B)
#endif
void arm_epilog();
void* arm_next(x86emu_t* emu, uintptr_t addr);
#ifndef STEPNAME
#define STEPNAME3(N,M) N##M
#define STEPNAME2(N,M) STEPNAME3(N,M)
#define STEPNAME(N) STEPNAME2(N, STEP)
#endif
#define arm_pass STEPNAME(arm_pass)
#define dynarec00 STEPNAME(dynarec00)
#define dynarec0F STEPNAME(dynarec0F)
#define dynarecFS STEPNAME(dynarecFS)
#define dynarecGS STEPNAME(dynarecGS)
#define dynarec66 STEPNAME(dynarec66)
#define dynarec67 STEPNAME(dynarec67)
#define dynarecD8 STEPNAME(dynarecD8)
#define dynarecD9 STEPNAME(dynarecD9)
#define dynarecDA STEPNAME(dynarecDA)
#define dynarecDB STEPNAME(dynarecDB)
#define dynarecDC STEPNAME(dynarecDC)
#define dynarecDD STEPNAME(dynarecDD)
#define dynarecDE STEPNAME(dynarecDE)
#define dynarecDF STEPNAME(dynarecDF)
#define dynarecF0 STEPNAME(dynarecF0)
#define dynarec660F STEPNAME(dynarec660F)
#define dynarecF20F STEPNAME(dynarecF20F)
#define dynarecF30F STEPNAME(dynarecF30F)
#define geted STEPNAME(geted_)
#define geted16 STEPNAME(geted16_)
#define jump_to_epilog STEPNAME(jump_to_epilog_)
#define jump_to_next STEPNAME(jump_to_next_)
#define ret_to_epilog STEPNAME(ret_to_epilog_)
#define retn_to_epilog STEPNAME(retn_to_epilog_)
#define iret_to_epilog STEPNAME(iret_to_epilog_)
#define call_c STEPNAME(call_c_)
#define grab_fsdata STEPNAME(grab_fsdata_)
#define grab_tlsdata STEPNAME(grab_tlsdata_)
#define emit_cmp8 STEPNAME(emit_cmp8)
#define emit_cmp16 STEPNAME(emit_cmp16)
#define emit_cmp32 STEPNAME(emit_cmp32)
#define emit_cmp8_0 STEPNAME(emit_cmp8_0)
#define emit_cmp16_0 STEPNAME(emit_cmp16_0)
#define emit_cmp32_0 STEPNAME(emit_cmp32_0)
#define emit_test8 STEPNAME(emit_test8)
#define emit_test16 STEPNAME(emit_test16)
#define emit_test32 STEPNAME(emit_test32)
#define emit_add32 STEPNAME(emit_add32)
#define emit_add32c STEPNAME(emit_add32c)
#define emit_add8 STEPNAME(emit_add8)
#define emit_add8c STEPNAME(emit_add8c)
#define emit_sub32 STEPNAME(emit_sub32)
#define emit_sub32c STEPNAME(emit_sub32c)
#define emit_sub8 STEPNAME(emit_sub8)
#define emit_sub8c STEPNAME(emit_sub8c)
#define emit_or32 STEPNAME(emit_or32)
#define emit_or32c STEPNAME(emit_or32c)
#define emit_xor32 STEPNAME(emit_xor32)
#define emit_xor32c STEPNAME(emit_xor32c)
#define emit_and32 STEPNAME(emit_and32)
#define emit_and32c STEPNAME(emit_and32c)
#define emit_or8 STEPNAME(emit_or8)
#define emit_or8c STEPNAME(emit_or8c)
#define emit_xor8 STEPNAME(emit_xor8)
#define emit_xor8c STEPNAME(emit_xor8c)
#define emit_and8 STEPNAME(emit_and8)
#define emit_and8c STEPNAME(emit_and8c)
#define emit_add16 STEPNAME(emit_add16)
#define emit_add16c STEPNAME(emit_add16c)
#define emit_sub16 STEPNAME(emit_sub16)
#define emit_sub16c STEPNAME(emit_sub16c)
#define emit_or16 STEPNAME(emit_or16)
#define emit_or16c STEPNAME(emit_or16c)
#define emit_xor16 STEPNAME(emit_xor16)
#define emit_xor16c STEPNAME(emit_xor16c)
#define emit_and16 STEPNAME(emit_and16)
#define emit_and16c STEPNAME(emit_and16c)
#define emit_inc32 STEPNAME(emit_inc32)
#define emit_inc16 STEPNAME(emit_inc16)
#define emit_inc8 STEPNAME(emit_inc8)
#define emit_dec32 STEPNAME(emit_dec32)
#define emit_dec16 STEPNAME(emit_dec16)
#define emit_dec8 STEPNAME(emit_dec8)
#define emit_adc32 STEPNAME(emit_adc32)
#define emit_adc32c STEPNAME(emit_adc32c)
#define emit_adc8 STEPNAME(emit_adc8)
#define emit_adc8c STEPNAME(emit_adc8c)
#define emit_adc16 STEPNAME(emit_adc16)
#define emit_adc16c STEPNAME(emit_adc16c)
#define emit_sbb32 STEPNAME(emit_sbb32)
#define emit_sbb32c STEPNAME(emit_sbb32c)
#define emit_sbb8 STEPNAME(emit_sbb8)
#define emit_sbb8c STEPNAME(emit_sbb8c)
#define emit_sbb16 STEPNAME(emit_sbb16)
#define emit_sbb16c STEPNAME(emit_sbb16c)
#define emit_neg32 STEPNAME(emit_neg32)
#define emit_neg16 STEPNAME(emit_neg16)
#define emit_neg8 STEPNAME(emit_neg8)
#define emit_shl32 STEPNAME(emit_shl32)
#define emit_shl32c STEPNAME(emit_shl32c)
#define emit_shr32 STEPNAME(emit_shr32)
#define emit_shr32c STEPNAME(emit_shr32c)
#define emit_sar32c STEPNAME(emit_sar32c)
#define emit_rol32c STEPNAME(emit_rol32c)
#define emit_ror32c STEPNAME(emit_ror32c)
#define emit_shrd32c STEPNAME(emit_shrd32c)
#define emit_shld32c STEPNAME(emit_shld32c)
#define emit_pf STEPNAME(emit_pf)
#define x87_do_push STEPNAME(x87_do_push)
#define x87_do_push_empty STEPNAME(x87_do_push_empty)
#define x87_do_pop STEPNAME(x87_do_pop)
#define x87_get_cache STEPNAME(x87_get_cache)
#define x87_get_st STEPNAME(x87_get_st)
#define x87_refresh STEPNAME(x87_refresh)
#define x87_forget STEPNAME(x87_forget)
#define x87_reget_st STEPNAME(x87_reget_st)
#define x87_stackcount STEPNAME(x87_stackcount)
#define x87_setround STEPNAME(x87_setround)
#define x87_restoreround STEPNAME(x87_restoreround)
#define sse_setround STEPNAME(sse_setround)
#define mmx_get_reg STEPNAME(mmx_get_reg)
#define mmx_get_reg_empty STEPNAME(mmx_get_reg_empty)
#define sse_get_reg STEPNAME(sse_get_reg)
#define sse_get_reg_empty STEPNAME(sse_get_reg_empty)
#define fpu_pushcache STEPNAME(fpu_pushcache)
#define fpu_popcache STEPNAME(fpu_popcache)
#define fpu_reset STEPNAME(fpu_reset)
#define fpu_purgecache STEPNAME(fpu_purgecache)
#define x87_purgecache STEPNAME(x87_purgecache)
#define mmx_purgecache STEPNAME(mmx_purgecache)
#ifdef HAVE_TRACE
#define fpu_reflectcache STEPNAME(fpu_reflectcache)
#endif
// get the single reg that from the double "reg" (so Dx[idx])
#define fpu_get_single_reg STEPNAME(fpu_get_single_reg)
// put back (if needed) the single reg in place
#define fpu_putback_single_reg STEPNAME(fpu_putback_single_reg)
/* setup r2 to address pointed by */
uintptr_t geted(dynarec_arm_t* dyn, uintptr_t addr, int ninst, uint8_t nextop, uint8_t* ed, uint8_t hint, int* fixedaddress, uint32_t absmax, uint32_t mask);
/* setup r2 to address pointed by */
uintptr_t geted16(dynarec_arm_t* dyn, uintptr_t addr, int ninst, uint8_t nextop, uint8_t* ed, uint8_t hint, int* fixedaddress, uint32_t absmax, uint32_t mask);
// generic x86 helper
void jump_to_epilog(dynarec_arm_t* dyn, uintptr_t ip, int reg, int ninst);
void jump_to_next(dynarec_arm_t* dyn, uintptr_t ip, int reg, int ninst);
void ret_to_epilog(dynarec_arm_t* dyn, int ninst);
void retn_to_epilog(dynarec_arm_t* dyn, int ninst, int n);
void iret_to_epilog(dynarec_arm_t* dyn, int ninst);
void call_c(dynarec_arm_t* dyn, int ninst, void* fnc, int reg, int ret, uint32_t mask, int saveflags);
void grab_fsdata(dynarec_arm_t* dyn, uintptr_t addr, int ninst, int reg);
void grab_tlsdata(dynarec_arm_t* dyn, uintptr_t addr, int ninst, int reg);
void emit_lock(dynarec_arm_t* dyn, uintptr_t addr, int ninst);
void emit_unlock(dynarec_arm_t* dyn, uintptr_t addr, int ninst);
void emit_cmp8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_cmp16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_cmp32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_cmp8_0(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_cmp16_0(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_cmp32_0(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_test8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_test16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_test32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_add32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_add32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_add8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_add8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sub32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_sub32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sub8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_sub8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_or32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_or32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_xor32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_xor32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_and32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_and32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_or8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_or8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_xor8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_xor8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_and8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_and8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_add16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_add16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sub16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_sub16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_or16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_or16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_xor16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_xor16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_and16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_and16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_inc32(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_inc16(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_inc8(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_dec32(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_dec16(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_dec8(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_adc32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_adc32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_adc8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_adc8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_adc16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_adc16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sbb32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_sbb32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sbb8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_sbb8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sbb16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, int save_s4);
void emit_sbb16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_neg32(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_neg16(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_neg8(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
void emit_shl32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_shl32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_shr32(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4);
void emit_shr32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_sar32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_rol32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_ror32c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4);
void emit_shrd32c(dynarec_arm_t* dyn, int ninst, int s1, int s2, int32_t c, int s3, int s4);
void emit_shld32c(dynarec_arm_t* dyn, int ninst, int s1, int s2, int32_t c, int s3, int s4);
void emit_pf(dynarec_arm_t* dyn, int ninst, int s1, int s3, int s4);
// x87 helper
// cache of the local stack counter, to avoid upadte at every call
void x87_stackcount(dynarec_arm_t* dyn, int ninst, int scratch);
// fpu push. Return the Dd value to be used
int x87_do_push(dynarec_arm_t* dyn, int ninst, int s1);
// fpu push. Do not allocate a cache register. Needs a scratch register to do x87stack synch (or 0 to not do it)
void x87_do_push_empty(dynarec_arm_t* dyn, int ninst, int s1);
// fpu pop. All previous returned Dd should be considered invalid
void x87_do_pop(dynarec_arm_t* dyn, int ninst, int s1);
// get cache index for a x87 reg, create the entry if needed
int x87_get_cache(dynarec_arm_t* dyn, int ninst, int s1, int s2, int a);
// get vfpu register for a x87 reg, create the entry if needed
int x87_get_st(dynarec_arm_t* dyn, int ninst, int s1, int s2, int a);
// refresh a value from the cache ->emu (nothing done if value is not cached)
void x87_refresh(dynarec_arm_t* dyn, int ninst, int s1, int s2, int st);
// refresh a value from the cache ->emu and then forget the cache (nothing done if value is not cached)
void x87_forget(dynarec_arm_t* dyn, int ninst, int s1, int s2, int st);
// refresh the cache value from emu
void x87_reget_st(dynarec_arm_t* dyn, int ninst, int s1, int s2, int st);
// Set rounding according to cw flags, return reg to restore flags
int x87_setround(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3);
// Restore round flag
void x87_restoreround(dynarec_arm_t* dyn, int ninst, int s1);
// Set rounding according to mxcsr flags, return reg to restore flags
int sse_setround(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3);
//MMX helpers
// get neon register for a MMX reg, create the entry if needed
int mmx_get_reg(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int a);
// get neon register for a MMX reg, but don't try to synch it if it needed to be created
int mmx_get_reg_empty(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int a);
//SSE/SSE2 helpers
// get neon register for a SSE reg, create the entry if needed
int sse_get_reg(dynarec_arm_t* dyn, int ninst, int s1, int a);
// get neon register for a SSE reg, but don't try to synch it if it needed to be created
int sse_get_reg_empty(dynarec_arm_t* dyn, int ninst, int s1, int a);
// common coproc helpers
// reset the cache
void fpu_reset(dynarec_arm_t* dyn, int ninst);
// purge the FPU cache (needs 3 scratch registers)
void fpu_purgecache(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3);
void x87_purgecache(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3);
void mmx_purgecache(dynarec_arm_t* dyn, int ninst, int s1);
#ifdef HAVE_TRACE
void fpu_reflectcache(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3);
#endif
void fpu_pushcache(dynarec_arm_t* dyn, int ninst, int s1);
void fpu_popcache(dynarec_arm_t* dyn, int ninst, int s1);
// get the single reg that from the double "reg" (so Dx[idx])
int fpu_get_single_reg(dynarec_arm_t* dyn, int ninst, int reg, int idx);
// put back (if needed) the single reg in place
void fpu_putback_single_reg(dynarec_arm_t* dyn, int ninst, int reg, int idx, int s);
uintptr_t dynarec00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarec0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecFS(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecGS(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarec66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarec67(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecD8(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecD9(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecDA(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecDB(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecDC(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecDD(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecDE(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecDF(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecF0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarec660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecF20F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
uintptr_t dynarecF30F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, int* ok, int* need_epilog);
#if STEP < 2
#define PASS2(A)
#else
#define PASS2(A) A
#endif
#if STEP < 3
#define PASS3(A)
#else
#define PASS3(A) A
#endif
#if STEP < 3
#define MAYUSE(A) (void)A
#else
#define MAYUSE(A)
#endif
#endif //__DYNAREC_ARM_HELPER_H__
+116
View File
@@ -0,0 +1,116 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box86context.h"
#include "dynarec.h"
#include "emu/x86emu_private.h"
#include "emu/x86run_private.h"
#include "x86run.h"
#include "x86emu.h"
#include "box86stack.h"
#include "emu/x86run_private.h"
#include "x86trace.h"
#include "dynarec_arm.h"
#include "dynarec_arm_private.h"
#include "arm_printer.h"
#include "dynarec_arm_functions.h"
#include "dynarec_arm_helper.h"
#include "custommem.h"
#ifndef STEP
#error No STEP defined
#endif
uintptr_t arm_pass(dynarec_arm_t* dyn, uintptr_t addr)
{
int ok = 1;
int ninst = 0;
uintptr_t ip = addr;
uintptr_t init_addr = addr;
int need_epilog = 1;
dyn->sons_size = 0;
// Clean up (because there are multiple passes)
dyn->state_flags = 0;
dyn->dfnone = 0;
fpu_reset(dyn, ninst);
// ok, go now
INIT;
while(ok) {
ip = addr;
if(dyn->insts && (dyn->insts[ninst].x86.barrier==1)) {
NEW_BARRIER_INST;
}
NEW_INST;
fpu_reset_scratch(dyn);
#ifdef HAVE_TRACE
if(my_context->dec && box86_dynarec_trace) {
if((trace_end == 0)
|| ((ip >= trace_start) && (ip < trace_end))) {
MESSAGE(LOG_DUMP, "TRACE ----\n");
fpu_reflectcache(dyn, ninst, x1, x2, x3);
MOV32(x1, ip);
STM(xEmu, (1<<xEAX)|(1<<xEBX)|(1<<xECX)|(1<<xEDX)|(1<<xESI)|(1<<xEDI)|(1<<xESP)|(1<<xEBP));
STR_IMM9(x1, xEmu, offsetof(x86emu_t, ip));
MOVW(x2, 1);
CALL(PrintTrace, -1, 0);
MESSAGE(LOG_DUMP, "----------\n");
}
}
#endif
addr = dynarec00(dyn, addr, ip, ninst, &ok, &need_epilog);
INST_EPILOG;
if(dyn->insts && dyn->insts[ninst+1].x86.barrier) {
fpu_purgecache(dyn, ninst, x1, x2, x3);
if(dyn->insts[ninst+1].x86.barrier!=2) {
dyn->state_flags = 0;
dyn->dfnone = 0;
}
}
if(!ok && !need_epilog && dyn->insts && (addr < (dyn->start+dyn->isize))) {
ok = 1;
}
if(!ok && !need_epilog && !dyn->insts && getProtection(addr+3))
if(*(uint32_t*)addr!=0) { // check if need to continue (but is next 4 bytes are 0, stop)
uintptr_t next = get_closest_next(dyn, addr);
if(next && (
(((next-addr)<15) && is_nops(dyn, addr, next-addr))
||(((next-addr)<30) && is_instructions(dyn, addr, next-addr)) ))
{
dynarec_log(LOG_DEBUG, "Extend block %p, %p -> %p (ninst=%d)\n", dyn, (void*)addr, (void*)next, ninst);
ok = 1;
} else if(next && (next-addr)<30) {
dynarec_log(LOG_DEBUG, "Cannot extend block %p -> %p (%02X %02X %02X %02X %02X %02X %02X %02x)\n", (void*)addr, (void*)next, PK(0), PK(1), PK(2), PK(3), PK(4), PK(5), PK(6), PK(7));
}
}
if(ok<0) {ok = 0; need_epilog=1;}
++ninst;
#if STEP == 0
if(ok && !isJumpTableDefault((void*)addr))
#else
if(ok && dyn->insts && (ninst==dyn->size))
#endif
{
#if STEP == 3
dynarec_log(LOG_DEBUG, "Stopping block %p (%d / %d)\n",(void*)init_addr, ninst, dyn->size);
#endif
BARRIER(2);
fpu_purgecache(dyn, ninst, x1, x2, x3);
jump_to_next(dyn, addr, 0, ninst);
ok=0; need_epilog=0;
}
}
if(need_epilog) {
fpu_purgecache(dyn, ninst, x1, x2, x3);
jump_to_epilog(dyn, ip, 0, ninst); // no linker here, it's an unknow instruction
}
FINI;
MESSAGE(LOG_DUMP, "---- END OF BLOCK ---- (%d, %d sons)\n", dyn->size, dyn->sons_size);
return addr;
}
+25
View File
@@ -0,0 +1,25 @@
#define INIT uintptr_t sav_addr=addr
#define FINI dyn->isize = addr-sav_addr
#define MESSAGE(A, ...)
#define SETFLAGS(A, B)
#define READFLAGS(A)
#define EMIT(A)
#define JUMP(A) add_next(dyn, (uintptr_t)A)
#define NEW_INST ++dyn->size
#define INST_EPILOG
#define INST_NAME(name)
#define DEFAULT \
--dyn->size; \
*ok = -1; \
if(box86_dynarec_log>=LOG_INFO) {\
dynarec_log(LOG_NONE, "%p: Dynarec stopped because of Opcode %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", \
(void*)ip, PKip(0), \
PKip(1), PKip(2), PKip(3), \
PKip(4), PKip(5), PKip(6), \
PKip(7), PKip(8), PKip(9), \
PKip(10),PKip(11),PKip(12), \
PKip(13),PKip(14)); \
printFunctionAddr(ip, " => "); \
dynarec_log(LOG_NONE, "\n"); \
}
+17
View File
@@ -0,0 +1,17 @@
#define INIT
#define FINI \
dyn->insts[ninst].x86.addr = addr; \
if(ninst) dyn->insts[ninst-1].x86.size = dyn->insts[ninst].x86.addr - dyn->insts[ninst-1].x86.addr;
#define MESSAGE(A, ...)
#define EMIT(A)
#define READFLAGS(A) dyn->insts[ninst].x86.use_flags = A
#define SETFLAGS(A,B) {dyn->insts[ninst].x86.set_flags = A; dyn->insts[ninst].x86.state_flags = B;}
#define JUMP(A) dyn->insts[ninst].x86.jmp = A
#define BARRIER(A) dyn->insts[ninst].x86.barrier = A
#define BARRIER_NEXT(A) if(ninst<dyn->size) dyn->insts[ninst+1].x86.barrier = A
#define NEW_INST \
dyn->insts[ninst].x86.addr = ip; \
if(ninst) dyn->insts[ninst-1].x86.size = dyn->insts[ninst].x86.addr - dyn->insts[ninst-1].x86.addr;
#define INST_EPILOG
#define INST_NAME(name)
+9
View File
@@ -0,0 +1,9 @@
#define INIT dyn->arm_size = 0
#define FINI if(ninst) {dyn->insts[ninst].address = (dyn->insts[ninst-1].address+dyn->insts[ninst-1].size);}
#define MESSAGE(A, ...)
#define EMIT(A) dyn->insts[ninst].size+=4; dyn->arm_size+=4
#define NEW_INST if(ninst) {dyn->insts[ninst].address = (dyn->insts[ninst-1].address+dyn->insts[ninst-1].size);}
#define INST_EPILOG dyn->insts[ninst].epilog = dyn->arm_size;
#define INST_NAME(name)
#define NEW_BARRIER_INST if(ninst) ++dyn->sons_size
+34
View File
@@ -0,0 +1,34 @@
#define INIT
#define FINI
#define EMIT(A) \
if(box86_dynarec_dump) {dynarec_log(LOG_NONE, "\t%08x\t%s\n", (A), arm_print(A));} \
*(uint32_t*)(dyn->block) = A; \
dyn->block += 4; dyn->arm_size += 4;\
dyn->insts[ninst].size2 += 4
#define MESSAGE(A, ...) if(box86_dynarec_dump) dynarec_log(LOG_NONE, __VA_ARGS__)
#define NEW_INST
#define INST_EPILOG
#define INST_NAME(name) \
if(box86_dynarec_dump) {\
printf_x86_instruction(my_context->dec, &dyn->insts[ninst].x86, name); \
dynarec_log(LOG_NONE, "%s%p: %d emited opcodes, state=%d/%d, set=%X, use=%X, need=%X%s\n", \
(box86_dynarec_dump>1)?"\e[32m":"", \
(void*)(dyn->arm_start+dyn->insts[ninst].address), \
dyn->insts[ninst].size/4, \
dyn->insts[ninst].x86.state_flags, \
dyn->state_flags, \
dyn->insts[ninst].x86.set_flags, \
dyn->insts[ninst].x86.use_flags, \
dyn->insts[ninst].x86.need_flags, \
(box86_dynarec_dump>1)?"\e[m":""); \
}
#define NEW_BARRIER_INST \
if(ninst) { \
dyn->sons_x86[dyn->sons_size] = (uintptr_t)ip; \
dyn->sons_arm[dyn->sons_size] = dyn->block; \
MESSAGE(LOG_DUMP, "----> potential Son here\n");\
++dyn->sons_size; \
}
+58
View File
@@ -0,0 +1,58 @@
#ifndef __DYNAREC_ARM_PRIVATE_H_
#define __DYNAREC_ARM_PRIVATE_H_
#include "dynarec_private.h"
typedef struct x86emu_s x86emu_t;
typedef struct instruction_arm_s {
instruction_x86_t x86;
uintptr_t address; // (start) address of the arm emited instruction
uintptr_t epilog; // epilog of current instruction (can be start of next, of barrier stuff)
int size; // size of the arm emited instruction
int size2; // size of the arm emited instrucion after pass2
uintptr_t mark, mark2, mark3;
uintptr_t markf;
uintptr_t markseg;
uintptr_t marklock;
int pass2choice;// value for choices that are fixed on pass2 for pass3
uintptr_t natcall;
int retn;
} instruction_arm_t;
typedef struct dynarec_arm_s {
instruction_arm_t *insts;
int32_t size;
int32_t cap;
uintptr_t start; // start of the block
uint32_t isize; // size in byte of x86 instructions included
void* block; // memory pointer where next instruction is emited
uintptr_t arm_start; // start of the arm code
int arm_size; // size of emitted arm code
int state_flags;// actual state for on-demand flags
int x87cache[8];// cache status for the 8 x87 register behind the fpu stack
int x87reg[8]; // reg used for x87cache entry
int mmxcache[8];// cache status for the 8 MMX registers
int ssecache[8];// cache status for the 8 SSE(2) registers
int fpuused[24];// all 8..31 double reg from fpu, used by x87, sse and mmx
int x87stack; // cache stack counter
int x87count; // number of x87 register used
int mmxcount; // number of mmx register used (not both mmx and x87 at the same time)
int fpu_scratch;// scratch counter
int fpu_extra_qscratch; // some opcode need an extra quad scratch register
int fpu_reg; // x87/sse/mmx reg counter
int dfnone; // if defered flags is already set to df_none
uintptr_t* next; // variable array of "next" jump address
int next_sz;
int next_cap;
uintptr_t* sons_x86; // the x86 address of potential dynablock sons
void** sons_arm; // the arm address of potential dynablock sons
int sons_size; // number of potential dynablock sons
} dynarec_arm_t;
void add_next(dynarec_arm_t *dyn, uintptr_t addr);
uintptr_t get_closest_next(dynarec_arm_t *dyn, uintptr_t addr);
int is_nops(dynarec_arm_t *dyn, uintptr_t addr, int n);
int is_instructions(dynarec_arm_t *dyn, uintptr_t addr, int n);
#endif //__DYNAREC_ARM_PRIVATE_H_
+35
View File
@@ -0,0 +1,35 @@
#ifndef __DYNAREC_PRIVATE_H_
#define __DYNAREC_PRIVATE_H_
// all flags for the use_flags field
#define X_CF (1<<0)
#define X_PF (1<<1)
#define X_AF (1<<2)
#define X_ZF (1<<3)
#define X_SF (1<<4)
#define X_OF (1<<5)
#define X_ALL ((1<<6)-1)
#define X_PEND (0x1000)
// all state flags
#define SF_UNKNOWN 0
#define SF_SET 1
#define SF_PENDING 2
#define SF_MAYSET 3
#define SF_SUBSET 4
typedef struct instruction_x86_s {
uintptr_t addr; //address of the instruction
int32_t size; // size of the instruction
int barrier; // next instruction is a jump point, so no optim allowed
uintptr_t jmp; // offset to jump to, even if conditionnal (0 if not), no relative offset here
int jmp_insts; // instuction to jump to (-1 if out of the block)
uint32_t use_flags; // 0 or combination of X_?F
uint32_t set_flags; // 0 or combination of X_?F
uint32_t need_flags; // calculated
int state_flags; // One of SF_XXX state
} instruction_x86_t;
void printf_x86_instruction(zydis_dec_t* dec, instruction_x86_t* inst, const char* name);
#endif //__DYNAREC_PRIVATE_H_
+477
View File
@@ -0,0 +1,477 @@
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 op 0 N Q M 0 Vm VH\(op ? "SUB" : "ADD")\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 0 0 N Q M 1 Vm VQADD<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 0 1 N Q M 0 Vm VRHADD<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 0 Vn Vd 0 0 0 1 N Q M 1 Vm VAND<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 1 Vn Vd 0 0 0 1 N Q M 1 Vm VBIC<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 1 0 Vn Vd 0 0 0 1 N Q M 1 Vm @ m=n const char* op op,"MOV","ORR"@ m=n char lastop[6] !@ %@ lastop[0] = '\0'@ sprintf(lastop, ", %s", vecname[(q << 5) + 0x20 + n])@ @ V\op\<c> <Qd>, <Qm>\lastop\
NEON 1 1 1 1 0 0 1 0 0 D 1 1 Vn Vd 0 0 0 1 N Q M 1 Vm VORN<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D @<2> Vn Vd 0 0 0 1 N Q M 1 Vm @ param=0b00=0b01=0b10 const char* op op,"EOR","BSL","BIT","BIF"@ @ V\op\<c> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 0 N Q M 1 Vm VQSUB<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 1 N Q M op Vm @ op=0 const char* strict strict,"T","E"@ @ VCG\strict\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 0 N Q M 0 Vm VSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 0 N Q M 1 Vm VQSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 1 N Q M 0 Vm VRSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 1 N Q M 1 Vm VQRSHL<c>.<dt> <Qd>, <Qm>, <Qn>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 0 N Q M op Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ V\opname\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 1 N Q M 0 Vm VABD<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 1 N Q M 1 Vm VABA<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 op 0 D size Vn Vd 1 0 0 0 N Q M 0 Vm @ op=0 const char* opname opname,"ADD","SUB"@ @ V\opname\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm VTST<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm VCEQ<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 0 1 N Q M 0 Vm @ set size = 8 << size@ @ VML\(u ? "S" : "A")\<c>.I\%dsize\ <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 0 1 N Q M 1 Vm VMUL<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 1 0 N Q M op Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ VP\opname\<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm VQDMULH<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm VQRDMULH<c>.<dt> <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 1 1 N Q/=0 M 1 Vm VPADD<c>.<dt> <Dd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 0 D U sz/=0 Vn Vd 1 1 0 0 N Q M 1 Vm @ u=0 const char* y y,"A","S"@ @ VFM\y\<c>.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D U sz/=0 Vn Vd 1 1 0 1 N Q M 0 Vm @ u=0 const char* op op,"ADD","SUB"@ @ V\op\<c>.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D 0 sz/=0 Vn Vd 1 1 0 1 N Q/=0 M 0 Vm VPADD.F32 <Dd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 1 0 D 1 sz/=0 Vn Vd 1 1 0 1 N Q M 0 Vm VABD.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D op sz/=0 Vn Vd 1 1 0 1 N Q M 1 Vm VML\(op ? "S" : "A")\<c>.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D 0 sz/=0 Vn Vd 1 1 0 1 N Q M 1 Vm VMUL.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 sz/=0 Vn Vd 1 1 1 0 N Q M 0 Vm VCEQ.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D op sz/=0 Vn Vd 1 1 1 0 N Q M 0 Vm @ op=1 const char* strict strict,"T","E"@ @ VCG\strict\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D op sz/=0 Vn Vd 1 1 1 0 N Q M 1 Vm @ op=1 const char* strict strict,"T","E"@ @ VACG\strict\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D op sz/=0 Vn Vd 1 1 1 1 N Q M 0 Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ V\opname\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 0 D op sz/=0 Vn Vd 1 1 1 1 N Q M 0 Vm @ op=0 const char* opname opname,"MAX","MIN"@ @ VP\opname\.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 0 sz/=0 Vn Vd 1 1 1 1 N Q M 1 Vm VRECPS.F32 <Qd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 0 0 D 1 sz/=0 Vn Vd 1 1 1 1 N Q M 1 Vm VRSQRTS.F32 <Qd>, <Qn>, <Qm>
INVALIDATE 1 1 1 1 0 0 1 <1> 0 <23>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx0 0 Q op/=0 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx1 0 Q op/=0 1 imm4 VORR<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x0 0 Q op/=0 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x1 0 Q op/=0 1 imm4 VORR<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=11xx 0 Q op/=0 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx0 0 Q op/=1 1 imm4 VMVN<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=0xx1 0 Q op/=1 1 imm4 VBIC<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x0 0 Q op/=1 1 imm4 VMVN<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=10x1 0 Q op/=1 1 imm4 BIC<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=110x 0 Q op/=1 1 imm4 VMVN<c>.<dt> <Qd>, #<imm>
NEON 1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode/=1110 0 Q op/=1 1 imm4 VMOV<c>.<dt> <Qd>, #<imm>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 0 0 0 <11> 0 <2> 1 <4>
NEON 1 1 1 1 0 0 1 0 1 D 0 0 1 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.S8 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D 0 1 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.S16 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D 1 0 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.S32 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 0 0 1 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.U8 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 0 1 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.U16 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 1 0 0 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm VMOVL<c>.U32 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 0 0 L Q M 1 Vm VSHR<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 0 1 L Q M 1 Vm VSRA<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 1 0 L Q M 1 Vm VRSHR<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 1 1 L Q M 1 Vm VRSRA<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 1 1 D imm6 Vd 0 1 0 0 L Q M 1 Vm VSRI<c>.<size> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 0 1 D Imm6 Vd 0 1 0 1 L Q M 1 Vm VSHL<c>.I<size> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 1 1 D Imm6 Vd 0 1 0 1 L Q M 1 Vm VSLI<c>.<size> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D Imm6 Vd 0 1 1 op L Q M 1 Vm VQSHL\((u & op) ? "U" : "")\<c>.<dt> <Qd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 0 1 D imm6 Vd 1 0 0 0 0 0 M 1 Vm @ set ++size@ @ VSHRN<c>.I<size> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 0 1 D imm6 Vd 1 0 0 0 0 1 M 1 Vm VRSHRN<c>.I<size> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 0 op 0 0 M 1 Vm VQSHR\((u & op) ? "U" : "")\N<c>.<dt> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 0 op 0 1 M 1 Vm VQRSHR\((u & op) ? "U" : "")\N<c>.<dt> <Dd>, <Qm>, #<imm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 1 0 0 M 1 Vm VSHLL<c>.<dt> <Qd>, <Dm>, #\%d8 &l&l size\
NEON 1 1 1 1 0 0 1 U 1 D Imm6 Vd 1 0 1 0 0 0 M 1 Vm VSHLL<c>.<dt> <Qd>, <Dm>, #<imm>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 0 <9> 1 1 1 <1> 0 <2> 1 <4>
NEON 1 1 1 1 0 0 1 0 1 D IMM6 Vd 1 1 1 0 0 Q M 1 Vm VCVT<c>.F32.S32 <Qd>, <Qm>, #<fbits>
NEON 1 1 1 1 0 0 1 0 1 D IMM6 Vd 1 1 1 1 0 Q M 1 Vm VCVT<c>.S32.F32 <Qd>, <Qm>, #<fbits>
NEON 1 1 1 1 0 0 1 1 1 D IMM6 Vd 1 1 1 0 0 Q M 1 Vm VCVT<c>.F32.U32 <Qd>, <Qm>, #<fbits>
NEON 1 1 1 1 0 0 1 1 1 D IMM6 Vd 1 1 1 1 0 Q M 1 Vm VCVT<c>.U32.F32 <Qd>, <Qm>, #<fbits>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <18> 1 <4>
NEON 1 1 1 1 0 0 1 0 1 D 1 1 Vn Vd IMM4 N Q M 0 Vm VEXT<c>.8 <Qd>, <Qn>, <Qm>, #<imm>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=11 0 0 <4> 0 0 0 <2> <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=10 0 0 <4> 0 0 0 <2>/11 <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=10 0 0 <4> 0 0 0 <2>/01 <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=01 0 0 <4> 0 0 0 <2>/11 <2> 0 <4>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <2>/=00 0 0 <4> 0 0 0 <2>/=11 <2> 0 <4>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 0 0 @<2> Q M 0 Vm VREV\%d16 &l&l param\<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 0 1 0 U Q M 0 Vm VPADDL<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 0 Q M 0 Vm VCLS<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 1 Q M 0 Vm VCLZ<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=00 0 0 Vd 0 1 0 1 0 Q M 0 Vm VCNT<c>.8 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=00 0 0 Vd 0 1 0 1 1 Q M 0 Vm VMVN<c> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 0 U Q M 0 Vm VPADAL<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 0 Q M 0 Vm VQABS<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 1 Q M 0 Vm VQNEG<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 0 Q M 0 Vm VCGT<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 1 Q M 0 Vm VCGE<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 0 Q M 0 Vm VCEQ<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 1 Q M 0 Vm VCLE<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 0 0 Q M 0 Vm VCLT<c>.<dt> <Qd>, <Qm>, #0
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 0 Q M 0 Vm VABS<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 1 Q M 0 Vm VNEG<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=00 1 0 Vd 0 0 0 0 0 Q M 0 Vm VSWP<c> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 0 1 Q M 0 Vm VTRN<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 0 Q M 0 Vm VUZP<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 1 Q M 0 Vm VZIP<c>.\%d8 &l&l size\ <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 0 0 M 0 Vm VMOVN<c>.<dt> <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 0 1 M 0 Vm VQMOVUN<c>.S\%d16 &l&l size\ <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 1 U M 0 Vm @ set ++size@ @ VQMOVN<c>.<dt> <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 1 0 0 M 0 Vm VSHLL<c>.I\%d8 &l&l size\ <Qd>, <Dm>, #\%d8 &l&l size\
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=01 1 0 Vd 0 1 1 0 0 0 M 0 Vm VCVT<c>.F16.F32 <Dd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=01 1 0 Vd 0 1 1 1 0 0 M 0 Vm VCVT<c>.F32.F16 <Qd>, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 0 Q M 0 Vm VRECPE<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 1 Q M 0 Vm VRSQRTE<c>.<dt> <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 0 0 Q M 0 Vm VCVT<c>.F32.S32 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 0 1 Q M 0 Vm VCVT<c>.S32.F32 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 1 0 Q M 0 Vm VCVT<c>.F32.U32 <Qd>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 size/=10 1 1 Vd 0 1 1 1 1 Q M 0 Vm VCVT<c>.U32.F32 <Qd>, <Qm>
INVALIDATE 1 1 1 1 0 0 1 1 1 <1> 1 1 <8> 0 <6> 0 <4>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 Vn Vd 1 0 @<2> N op M 0 Vm @ param=0b00 char list[10] !@ sprintf(list, %)@ "{%s}", vecname[0x20 + n]@ "{%s-%s}", vecname[0x20 + n], vecname[0x20 + n + param]@ @ VTB\(op ? "X" : "L")\<c>.8 <Dd>, \list\, <Dm>
NEON 1 1 1 1 0 0 1 1 1 D 1 1 imm4 Vd 1 1 0 0 0 Q M 0 Vm VDUP<c>.\%dsize\ <Qd>, <Dm[x]>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <1> 1 1 <13> 0 <1> 0 <4>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 0 0 Q N 0 M 0 Vm VADD\(q ? "W" : "L")\<c>.<dt> <qd>, <Qn>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 0 1 Q N 0 M 0 Vm VSUB\(q ? "W" : "L")\<c>.<dt> <qd>, <Qn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm @ set size = 16 << size@ @ VADDHN<c>.I\%dsize\ <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm VRADDHN<c>.<dt> <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 1 0 1 N 0 M 0 Vm VABAL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm VSUBHN<c>.<dt> <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 1 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm VRSUBHN<c>.<dt> <Dd>, <Qn>, <Qm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 1 1 1 N 0 M 0 Vm VABDL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 1 0 op 0 N 0 M 0 Vm VML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 1 0 op 1 N 0 M 0 Vm VQDML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 1 1 0 0 N 0 M 0 Vm VMULL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 1 1 0 1 N 0 M 0 Vm VQDMULL<c>.<dt> <Qd>, <Dn>, <Dm>
NEON 1 1 1 1 0 0 1 U/=0 1 D size/=00 Vn Vd 1 1 1 0 N 0 M 0 Vm @ set uint8_t size = 0@ @ VMULL<c>.<dt> <Qd>, <Dn>, <Dm>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <16> 0 <1> 0 <4>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 0 op 0 F N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VML\(op ? "S" : "A")\<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 0 op 1 0 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 0 op 1 1 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQDML\(op ? "S" : "A")\L<c>.<dt> <Qd>, <Dn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 0 0 F N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VMUL<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 U 1 D size Vn Vd 1 0 1 0 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VMULL<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 0 1 D size Vn Vd 1 0 1 1 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQDMULL<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 1 0 0 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQDMULH<c>.<dt> <Qd>, <Qn>, <Dm[x]>
NEON 1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 1 0 1 N 1 M 0 Vm @ size=0b01=0b10 unsigned int decodedImm !@ decodedImm = m >> %; m %@ 3@ &= 0x7@ 4@ &= 0xF@ 5@ = 0x21@ @ VQRDMULH<c>.<dt> <Qd>, <Qn>, <Dm[x]>
INVALIDATE 1 1 1 1 0 0 1 <1> 1 <16> 0 <1> 0 <4>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 0 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 0 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 0 1 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 0 1 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd 1 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
INVALIDATE 1 1 1 1 0 1 0 0 1 <1> 0 0 <8> 1 1 <10>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 @<4> 1 1 1 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 @<4> 1 1 0 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 @<4> Rm @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VST1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> Rm @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VST3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VST4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\, \vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\, \vecname[0x26 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 0 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x23 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 0 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 0 1 size @<2> Rm @ param=0b00 char align[4] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 63 + param)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\, \vecname[0x24 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\-\vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 0 1 1 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 1 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 1 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 0 1 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x22 + d]\}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 1 0 size @<2> 1 1 1 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 1 0 size @<2> 1 1 0 1 @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd 1 0 1 0 size @<2> Rm @ param=0b00 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 32 << param)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\, \vecname[0x21 + d]\}, [<Rn>\align\], <Rm>
INVALIDATE 1 1 1 1 0 1 0 0 1 <1> 1 0 <8> 1 1 <10>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 @<4> 1 1 1 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 @<4> 1 1 0 1 @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 @<4> Rm @ set uint8_t temp = (2 << size) - 1@ set uint8_t temp2 = param & temp@ temp2=0=param>>1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 8 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ @ VLD1<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0=1 char align[5] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", 16 << size)@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD2<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> Rm @ set uint8_t temp = param & (1 << size)@ temp=0 uint8_t spacing spacing,0,1@ set uint8_t x = param >> (size + 1)@ @ VLD3<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\]}, [<Rn>], <Rm>
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 1 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> 1 1 0 1 @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\]!
NEON 1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 @<4> Rm @ size=0b00=0b01 uint8_t temp temp,1,1,3@ set uint8_t temp2 = param & temp@ temp2=0b0=0b1=0b10 char align[6] !@ %@ align[0] = '\0'@ sprintf(align, ":%d", (size ? 64 : 32))@ sprintf(align, ":128")@ sprintf(align, "???")@ set uint8_t x = param >> (size + 1)@ set int spacing = size ? ((param >> size) & 1) : 0@ @ VLD4<c>.\%d8 &l&l size\ {\vecname[0x20 + d]\[\%dx\], \vecname[0x21 + d + spacing]\[\%dx\], \vecname[0x22 + d + 2*spacing]\[\%dx\], \vecname[0x23 + d + 3*spacing]\[\%dx\]}, [<Rn>\align\], <Rm>
INVALIDATE 1 1 1 1 0 1 0 0 <3> 0 <20>
INVALIDATE 1 1 1 1 <28>
ARMS cond 0 0 0 0 0 0 0 S Rn Rd imm5 type 0 Rm AND{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 0 0 S Rd (0) (0) (0) (0) Rm 1 0 0 1 Rn MUL{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 0 U 0 0 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm STRH<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 0 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRD<c> <Rt>, <Rt2>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 0 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm STRD<c> <Rt>, <Rt2>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm LDRH<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRSB<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 0 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm LDRSH<c> <Rt>, [<Rn>], +/-<Rm>
ARMS cond 0 0 0 0 0 0 1 S Rn Rd imm5 type 0 Rm EOR{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 0 1 S Rd Ra Rm 1 0 0 1 Rn MLA{S}<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 0 U 0 1 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm STRHT<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm LDRHT<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRSBT<c> <Rt>, [<Rn>], +/-<Rm>
ARM_ cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm LDRSHT<c> <Rt>, [<Rn>], +/-<Rm>
ARMS cond 0 0 0 0 0 1 0 S Rn Rd imm5 type 0 Rm SUB{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 1 0 0 RdHi RdLo Rm 1 0 0 1 Rn UMAAL<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARM_ cond 0 0 0 0 U 1 0 0 Rn Rt imm4H 1 0 1 1 imm4L STRH<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 0 Rn Rt imm4H 1 1 0 1 imm4L LDRD<c> <Rt>, <Rt2>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 0 Rn Rt imm4H 1 1 1 1 imm4L STRD<c> <Rt>, <Rt2>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 1 Rn Rt imm4H 1 0 1 1 imm4L LDRH<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 1 Rn Rt imm4H 1 1 0 1 imm4L LDRSB<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 0 1 Rn Rt imm4H 1 1 1 1 imm4L LDRSH<c> <Rt>, [<Rn>], #+/-<imm8>
ARMS cond 0 0 0 0 0 1 1 S Rn Rd imm5 type 0 Rm RSB{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 0 1 1 0 Rd Ra Rm 1 0 0 1 Rn MLS<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 0 U 1 1 0 Rn Rt imm4H 1 0 1 1 imm4L STRHT<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 0 1 1 imm4L LDRHT<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 1 0 1 imm4L LDRSBT<c> <Rt>, [<Rn>], #+/-<imm8>
ARM_ cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 1 1 1 imm4L LDRSHT<c> <Rt>, [<Rn>], #+/-<imm8>
ARMS cond 0 0 0 0 1 0 0 S Rn Rd imm5 type 0 Rm ADD{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 0 0 S RdHi RdLo Rm 1 0 0 1 Rn UMULL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARMS cond 0 0 0 0 1 0 1 S Rn Rd imm5 type 0 Rm ADC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 0 1 S RdHi RdLo Rm 1 0 0 1 Rn UMLAL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARMS cond 0 0 0 0 1 1 0 S Rn Rd imm5 type 0 Rm SBC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 1 0 S RdHi RdLo Rm 1 0 0 1 Rn SMULL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARMS cond 0 0 0 0 1 1 1 S Rn Rd imm5 type 0 Rm RSC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 0 1 1 1 S RdHi RdLo Rm 1 0 0 1 Rn SMLAL{S}<c> <RdLo>, <RdHi>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 0 0 0 Rn SMLABB<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 0 1 0 Rn SMLATB<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 1 0 0 Rn SMLABT<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 1 1 0 Rn SMLATT<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 0 0 1 0 0 0 0 Rn Rt (0) (0) (0) (0) 1 0 0 1 Rm SWP<c> <Rt>, <Rm>, [<Rn>]
ARM_ cond 0 0 0 1 U 0 W 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm STRH<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 0 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRD<c> <Rt>, <Rt2>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 0 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm STRD<c> <Rt>, <Rt2>, [<Rn>, +/-<Rm>]{!}
ARMS cond 0 0 0 1 0 0 0 1 Rn (0) (0) (0) (0) imm5 type 0 Rm TST<c> <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 U 0 W 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm LDRH<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm LDRSB<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 U 0 W 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm LDRSH<c> <Rt>, [<Rn>, +/-<Rm>]{!}
ARM_ cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 0 1 Rm BX<c> <Rm>
ARM_ cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 1 0 Rm BXJ<c> <Rm>
ARM_ cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 1 1 Rm BLX<c> <Rm>
ARM_ cond/=1110 0 0 0 1 0 0 1 0 imm12 0 1 1 1 imm4 BKPT #<imm16>
ARMS cond 0 0 0 1 0 0 1 1 Rn (0) (0) (0) (0) imm5 type 0 Rm TEQ<c> <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 0 1 0 0 Rn Rt (0) (0) (0) (0) 1 0 0 1 Rm SWPB<c> <Rt>, <Rm>, [<Rn>]
ARM_ cond 0 0 0 1 0 1 1 0 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 0 1 Rm CLZ<c> <Rd>, <Rm>
ARM_ cond 0 0 0 1 U 1 W 0 Rn Rt imm4H 1 0 1 1 imm4L STRH<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 0 Rn Rt imm4H 1 1 0 1 imm4L LDRD<c> <Rt>, <Rt2>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 0 Rn Rt imm4H 1 1 1 1 imm4L STRD<c> <Rt>, <Rt2>, [<Rn>, #+/-<imm8>]{!}
ARMS cond 0 0 0 1 0 1 0 1 Rn (0) (0) (0) (0) imm5 type 0 Rm CMP<c> <Rn>, <Rm>{, <shift>}
ARMS cond 0 0 0 1 0 1 1 1 Rn (0) (0) (0) (0) imm5 type 0 Rm CMN<c> <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 U 1 W 1 Rn Rt imm4H 1 0 1 1 imm4L LDRH<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 1 Rn Rt imm4H 1 1 0 1 imm4L LDRSB<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARM_ cond 0 0 0 1 U 1 W 1 Rn Rt imm4H 1 1 1 1 imm4L LDRSH<c> <Rt>, [<Rn>, #+/-<imm8>]{!}
ARMS cond 0 0 0 1 1 0 0 S Rn Rd imm5 type 0 Rm ORR{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 1 0 0 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREX<c> <Rd>, <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 0 0 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREX<c> <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd 0 0 0 0 0 0 0 0 Rm MOV{S}<c> <Rd>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 0 0 0 Rm LSL{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 0 0 1 Rn LSL{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 0 1 0 Rm LSR{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 0 1 1 Rn LSR{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 1 0 0 Rm ASR{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 1 0 1 Rn ASR{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd 0 0 0 0 0 1 1 0 Rm RRX{S}<c> <Rd>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 1 1 0 Rm ROR{S}<c> <Rd>, <Rm>, #<imm>
ARM_ cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 1 1 1 Rn ROR{S}<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 0 0 1 1 0 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREXD<c> <Rd>, <Rt>, <Rt2>, [<Rn>]
ARM_ cond 0 0 0 1 1 0 1 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREXD<c> <Rt>, <Rt2>, [<Rn>]
ARMS cond 0 0 0 1 1 1 0 S Rn Rd imm5 type 0 Rm BIC{S}<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 1 1 0 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREXB<c> <Rd>, <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 1 0 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREXB<c> <Rt>, [<Rn>]
ARMS cond 0 0 0 1 1 1 1 S (0) (0) (0) (0) Rd imm5 type 0 Rm MVN{S}<c> <Rd>, <Rm>{, <shift>}
ARM_ cond 0 0 0 1 1 1 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt STREXH<c> <Rd>, <Rt>, [<Rn>]
ARM_ cond 0 0 0 1 1 1 1 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1) LDREXH<c> <Rt>, [<Rn>]
ARM_ cond 0 0 1 0 0 0 0 S Rn Rd imm12 AND{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 0 0 1 S Rn Rd imm12 EOR{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 0 1 0 S Rn Rd imm12 SUB{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 0 1 1 S Rn Rd imm12 RSB{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 0 0 S Rn Rd imm12 ADD{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 0 1 S Rn Rd imm12 ADC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 1 0 S Rn Rd imm12 SBC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 0 1 1 1 S Rn Rd imm12 RSC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 1 0 0 0 0 imm4 Rd imm12 MOVW<c> <Rd>, #<imm16>
ARM_ cond 0 0 1 1 0 0 0 1 Rn (0) (0) (0) (0) imm12 TST<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 0 0 0 NOP<c>
ARM_ cond 0 0 1 1 0 0 1 1 Rn (0) (0) (0) (0) imm12 TEQ<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 0 1 0 0 imm4 Rd imm12 MOVT<c> <Rd>, #<imm16>
ARM_ cond 0 0 1 1 0 1 0 1 Rn (0) (0) (0) (0) imm12 CMP<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 0 1 1 1 Rn (0) (0) (0) (0) imm12 CMN<c> <Rn>, #<const>
ARM_ cond 0 0 1 1 1 0 0 S Rn Rd imm12 ORR{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 1 1 0 1 S (0) (0) (0) (0) Rd imm12 MOV{S}<c> <Rd>, #<const>
ARM_ cond 0 0 1 1 1 1 0 S Rn Rd imm12 BIC{S}<c> <Rd>, <Rn>, #<const>
ARM_ cond 0 0 1 1 1 1 1 S (0) (0) (0) (0) Rd imm12 MVN{S}<c> <Rd>, #<const>
ARM_ cond 0 1 0 0 1 0 0 1 1 1 0 1 Rt 0 0 0 0 0 0 0 0 0 1 0 0 POP<c> {<Rt>}
ARM_ cond 0 1 0 0 U 0 0 0 Rn Rt imm12 STR<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 0 0 1 Rn Rt imm12 LDR<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 0 1 0 Rn Rt imm12 STRT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 0 1 1 Rn Rt imm12 LDRT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 0 0 Rn Rt imm12 STRB<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 0 1 Rn Rt imm12 LDRB<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 1 0 Rn Rt imm12 STRBT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 0 U 1 1 1 Rn Rt imm12 LDRBT<c> <Rt>, [<Rn>], #+/-<imm12>
ARM_ cond 0 1 0 1 0 0 1 0 1 1 0 1 Rt 0 0 0 0 0 0 0 0 0 1 0 0 PUSH<c> {<Rt>}
ARM_ cond 0 1 0 1 U 0 W 0 Rn Rt imm12 STR<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 0 1 U 0 W 1 Rn Rt imm12 LDR<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 0 1 U 1 W 0 Rn Rt imm12 STRB<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 0 1 U 1 W 1 Rn Rt imm12 LDRB<c> <Rt>, [<Rn>, #+/-<imm12>]{!}
ARM_ cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm SSAX<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm SSUB16<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm SSUB8<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm USAX<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm USUB16<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm USUB8<c> <Rd>, <Rn>, <Rm>
ARMs cond 0 1 1 0 1 0 0 0 Rn Rd imm5 0 0 1 Rm PKHBT<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARMs cond 0 1 1 0 1 0 0 0 Rn Rd imm5 1 0 1 Rm PKHTB<c> <Rd>, <Rn>, <Rm>{, <shift>}
ARM_ cond 0 1 1 0 1 0 0 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm SXTB16<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 0 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm SXTAB16<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARMs cond 0 1 1 0 1 0 1 sat_imm Rd imm5 sh 0 1 Rn SSAT<c> <Rd>, #<imm>, <Rn>{, <shift>}
ARM_ cond 0 1 1 0 1 0 1 0 sat_imm Rd (1) (1) (1) (1) 0 0 1 1 Rn SSAT16<c> <Rd>, #<imm>, <Rn>
ARM_ cond 0 1 1 0 1 0 1 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm SXTB<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 1 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm SXTAB<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 1 1 Rm REV<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 0 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 1 0 1 1 Rm REV16<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 0 1 1 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm SXTH<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 0 1 1 Rn Rd rotate (0) (0) 0 1 1 1 Rm SXTAH<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 0 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm UXTB16<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 0 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm UXTAB16<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARMs cond 0 1 1 0 1 1 1 sat_imm Rd imm5 sh 0 1 Rn USAT<c> <Rd>, #<imm>, <Rn>{, <shift>}
ARM_ cond 0 1 1 0 1 1 1 0 sat_imm Rd (1) (1) (1) (1) 0 0 1 1 Rn USAT16<c> <Rd>, #<imm>, <Rn>
ARM_ cond 0 1 1 0 1 1 1 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm UXTB<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 1 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm UXTAB<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 1 1 Rm RBIT<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 1 1 1 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm UXTH<c> <Rd>, <Rm>{, <rotation>}
ARM_ cond 0 1 1 0 1 1 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 1 0 1 1 Rm REVSH<c> <Rd>, <Rm>
ARM_ cond 0 1 1 0 1 1 1 1 Rn Rd rotate (0) (0) 0 1 1 1 Rm UXTAH<c> <Rd>, <Rn>, <Rm>{, <rotation>}
ARMs cond 0 1 1 0 U 0 0 0 Rn Rt imm5 type 0 Rm STR<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 0 0 1 Rn Rt imm5 type 0 Rm LDR<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 0 1 0 Rn Rt imm5 type 0 Rm STRT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 0 1 1 Rn Rt imm5 type 0 Rm LDRT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 0 0 Rn Rt imm5 type 0 Rm STRB<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 0 1 Rn Rt imm5 type 0 Rm LDRB<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 1 0 Rn Rt imm5 type 0 Rm STRBT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 0 U 1 1 1 Rn Rt imm5 type 0 Rm LDRBT<c> <Rt>, [<Rn>], +/-<Rm>{, <shift>}
ARMs cond 0 1 1 1 U 0 W 0 Rn Rt imm5 type 0 Rm STR<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARMs cond 0 1 1 1 U 0 W 1 Rn Rt imm5 type 0 Rm LDR<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARMs cond 0 1 1 1 U 1 W 0 Rn Rt imm5 type 0 Rm STRB<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARMs cond 0 1 1 1 U 1 W 1 Rn Rt imm5 type 0 Rm LDRB<c> <Rt>, [<Rn>, +/-<Rm>{, <shift>}]{!}
ARM_ cond 0 1 1 1 1 0 0 0 Rd 1 1 1 1 Rm 0 0 0 1 Rn USAD8<c> <Rd>, <Rn>, <Rm>
ARM_ cond 0 1 1 1 1 0 0 0 Rd Ra Rm 0 0 0 1 Rn USADA8<c> <Rd>, <Rn>, <Rm>, <Ra>
ARM_ cond 0 1 1 1 1 1 0 msb Rd lsb 0 0 1 1 1 1 1 BFC<c> <Rd>, #<lsb>, #<width>
ARM_ cond 0 1 1 1 1 1 0 msb Rd lsb 0 0 1 Rn BFI<c> <Rd>, <Rn>, #<lsb>, #<width>
ARM_ cond 0 1 1 1 1 1 1 widthm1 Rd lsb 1 0 1 Rn UBFX<c> <Rd>, <Rn>, #<lsb>, #<width>
ARM_ cond 1 0 0 0 0 0 W 0 Rn/=1101 register_list STMED<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 0 0 W 0 Rn register_list STMDA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 0 0 W 1 Rn/=1101 register_list LDMED<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 0 0 W 1 Rn register_list LDMDA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 1 0 W 0 Rn/=1101 register_list STMEA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 1 0 W 0 Rn register_list STM<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 0 1 0 0 1 Rn/=1101 register_list LDMEA<c> <Rn>, <registers>
ARM_ cond 1 0 0 0 1 0 1 1 1 1 0 1 register_list @ = const char* op @@ (reglist != 0) && ((reglist & (reglist - 1)) == 0)@ op,"POP","LDMEA"@ @ \op\<c> <registers>
ARM_ cond 1 0 0 0 1 0 W 1 Rn register_list LDM<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 0 0 0 0 Rn/=1101 register_list STMFD<c> <Rn>, <registers>
ARM_ cond 1 0 0 1 0 0 1 0 1 1 0 1 register_list @ = const char* op @@ (reglist != 0) && ((reglist & (reglist - 1)) == 0)@ op,"PUSH","STMFD"@ @ \op\<c> <registers>
ARM_ cond 1 0 0 1 0 0 W 0 Rn register_list STMDB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 0 0 W 1 Rn/=1101 register_list LDMFD<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 0 0 W 1 Rn register_list LDMDB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 0 Rn/=1101 register_list STMFA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 0 Rn register_list STMIB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 1 Rn/=1101 register_list LDMFA<c> <Rn>{!}, <registers>
ARM_ cond 1 0 0 1 1 0 W 1 Rn register_list LDMIB<c> <Rn>{!}, <registers>
ARM_ cond 1 0 1 0 imm24 B<c> <label>
ARM_ cond 1 0 1 1 imm24 BL<c> <label>
VFPU cond 1 1 0 0 0 1 0 0 Rn Rt 1 0 1 0 0 0 M 1 Vm VMOV<c> <Sm>, <Sm1>, <Rt>, <Rn>
VFPU cond 1 1 0 0 0 1 0 1 Rn Rt 1 0 1 0 0 0 M 1 Vm VMOV<c> <Rt>, <Rn>, <Sm>, <Sm1>
VFPU cond 1 1 0 0 0 1 0 0 Rn Rt 1 0 1 1 0 0 M 1 Vm VMOV<c> <Dm>, <Rt>, <Rn>
VFPU cond 1 1 0 0 0 1 0 1 Rn Rt 1 0 1 1 0 0 M 1 Vm VMOV<c> <Rt>, <Rn>, <Dm>
INVALIDATE <4> 1 1 0 0 0 <11> 1 0 1 <9>
INVALIDATE <4> 1 1 0 0 0 <11> 1 0 1 <9>
INVALIDATE <4> 1 1 0 1 1 <1> 1 <9> 1 0 1 <9>
INVALIDATE <4> 1 1 0 1 1 <1> 1 <9> 1 0 1 <9>
VFPU cond 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FSTMX<c> <LIst>
VFPU cond 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 sz imm8 VPUSH<c> <list>
VFPU cond 1 1 0 1 U D 0 0 Rn Vd 1 0 1 sz imm8 VSTR<c> <Dd>, [<Rn>{, #+/-<imm>}]
VFPU cond 1 1 0 @<2> D W 0 Rn Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FSTM\(param == 0b01 ? "IA" : "DB")\X<c> <Rn>{!}, <LIst>
VFPU cond 1 1 0 @<2> D W 0 Rn Vd 1 0 1 sz imm8 VSTM\(param == 0b01 ? "IA" : "DB")\<c> <Rn>{!}, <list>
VFPU cond 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FLDMX<c> <LIst>
VFPU cond 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 sz imm8 VPOP<c> <list>
VFPU cond 1 1 0 1 0 D 0 1 1 1 1 1 Vd 1 0 1 sz 0 0 0 0 0 0 0 0 VLDR<c> <Dd>, [PC, #-0]
VFPU cond 1 1 0 1 U D 0 1 1 1 1 1 Vd 1 0 1 sz imm8 VLDR<c> <Dd>, <label>
VFPU cond 1 1 0 1 U D 0 1 Rn Vd 1 0 1 sz imm8 VLDR<c> <Dd>, [<Rn>{, #+/-<imm>}]
VFPU cond 1 1 0 @<2> D W 1 Rn Vd 1 0 1 1 imm8/01 @ set --imm8@ @ FLDM\(param == 0b01 ? "IA" : "DB")\X<c> <Rn>{!}, <LIst>
VFPU cond 1 1 0 @<2> D W 1 Rn Vd 1 0 1 sz imm8 VLDM\(param == 0b01 ? "IA" : "DB")\<c> <Rn>{!}, <list>
INVALIDATE <4> 1 1 0 <25>
INVALIDATE <4> 1 1 1 0 0 0 <1> 0 <8> 1 0 1 1 <1> 1 0 1 (0) (0) (0) (0)
VFPU cond 1 1 1 0 0 0 0 0 Vn Rt 1 0 1 0 N (0) (0) 1 (0) (0) (0) (0) VMOV<c> <Sn>, <Rt>
VFPU cond 1 1 1 0 1 1 1 0 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0) VMSR<c> FPSCR, <Rt>
VFPU cond 1 1 1 0 0 @<2> 0 Vd Rt 1 0 1 1 D @<2> 1 (0) (0) (0) (0) @ set uint8_t opc = (param1_2 << 2) + param2_2@ = uint8_t shift @@ (opc & 0b1000) == 0b1000@ @@ (opc & 0b1001) == 0b0001@ @@ (opc & 0b1011) == 0b0000@ shift,0,1,2,0xFF@ set uint8_t decodedImm = (opc & 0x7) >> shift@ @ VMOV<c>.\%d8 &l&l shift\ <Dd[x]>, <Rt>
VFPU cond 1 1 1 0 1 0 Q 0 Vd Rt 1 0 1 1 D 0 0 1 (0) (0) (0) (0) VDUP<c>.32 <Qd>, <Rt>
VFPU cond 1 1 1 0 1 0 Q 0 Vd Rt 1 0 1 1 D 0 1 1 (0) (0) (0) (0) VDUP<c>.16 <Qd>, <Rt>
VFPU cond 1 1 1 0 1 1 Q 0 Vd Rt 1 0 1 1 D 0 0 1 (0) (0) (0) (0) VDUP<c>.8 <Qd>, <Rt>
VFPU cond 1 1 1 0 0 0 0 1 Vn Rt 1 0 1 0 N (0) (0) 1 (0) (0) (0) (0) VMOV<c> <Rt>, <Sn>
VFPU cond 1 1 1 0 1 1 1 1 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0) VMRS<c> <Rt>, FPSCR
VFPU cond 1 1 1 0 U @<2> 1 Vn Rt 1 0 1 1 N @<2> 1 (0) (0) (0) (0) @ set uint8_t opc = (u << 4) + (param1_2 << 2) + param2_2@ = uint8_t shift, size @@ (opc & 0b01000) == 0b01000@ @@ (opc & 0b01001) == 0b00001@ @@ (opc & 0b11011) == 0b00000@ shift,0,1,2,0xFF;size,0,1,2,4@ set uint8_t decodedImm = (opc & 0x7) >> shift@ @ VMOV<c>.<dt> <Rt>, <Dn[x]>
INVALIDATE <4> 1 1 1 0 <12> 1 0 1 <4> 1 <4>
VFPU cond 1 1 1 0 0 D 0 0 Vn Vd 1 0 1 sz N op M 0 Vm VML\(op ? "S" : "A")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm VNML\(op ? "S" : "A")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 0 M 0 Vm VMUL<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 1 M 0 Vm VNMUL<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 0 M 0 Vm VADD<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 1 M 0 Vm VSUB<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 0 0 Vn Vd 1 0 1 sz N 0 M 0 Vm VDIV<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm VFNM\(op ? "A" : "S")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 1 0 Vn Vd 1 0 1 sz N op M 0 Vm VFM\(op ? "S" : "A")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dn>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 @<4> Vd 1 0 1 0 (0) 0 (0) 0 @<4> @ set int8_t sign = (param1_4 >> 3) ? -1 : 1@ set uint8_t exp = ((param1_4 & 0b111) ^ 0b100)@ set float mantissa = 16 + param2_4@ set float imm = sign * (1 << exp) * mantissa / 128.@ @ VMOV<c>.F32 <Sd>, #\%fimm\
VFPU cond 1 1 1 0 1 D 1 1 @<4> Vd 1 0 1 1 (0) 0 (0) 0 @<4> @ set int8_t sign = (param1_4 >> 3) ? -1 : 1@ set uint8_t exp = ((param1_4 & 0b111) ^ 0b100)@ set double mantissa = 16 + param2_4@ set double imm = sign * (1 << exp) * mantissa / 128.@ @ VMOV<c>.F64 <Dd>, #\%fimm\
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 0 1 M 0 Vm VMOV<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 1 1 M 0 Vm VABS<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 0 1 M 0 Vm VNEG<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 1 1 M 0 Vm VSQRT<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 1 0 Vd 1 0 1 (0) @<1> 1 M 0 Vm VCVT\(param ? "T" : "B")\<c>.F32.F16 <Sd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 0 0 1 1 Vd 1 0 1 (0) @<1> 1 M 0 Vm VCVT\(param ? "T" : "B")\<c>.F16.F32 <Sd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 0 1 0 0 Vd 1 0 1 sz op 1 M 0 Vm VCMP\(op ? "E" : "")\<c>.F\(size ? "64" : "32")\ <Dd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 0 1 0 1 Vd 1 0 1 sz op 1 (0) 0 (0) (0) (0) (0) VCMP\(op ? "E" : "")\<c>.F\(size ? "64" : "32")\ <Dd>, #0.0
VFPU cond 1 1 1 0 1 D 1 1 0 1 1 1 Vd 1 0 1 0 1 1 M 0 Vm VCVT<c>.F64.F32 <Dd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 0 1 1 1 Vd 1 0 1 1 1 1 M 0 Vm VCVT<c>.F32.F64 <Sd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 1 0 0 0 Vd 1 0 1 sz op 1 M 0 Vm VCVT<c>.F\(size ? "64" : "32")\.\(op ? "S" : "U")\32 <Dd>, <Sm>
VFPU cond 1 1 1 0 1 D 1 1 1 0 1 U Vd 1 0 1 sz op 1 i 0 imm4 @ set uint8_t td = (u << 2) + op + 1@ td=0b001=0b010=0b101 const char* Td Td,"S16","U16","S32","U32"@ set imm5 = (16 << op) - (imm5 >> 4) - ((imm5 & 0xF) << 1)@ @ VCVT<c>.F\(size ? "64" : "32")\.\Td\ <Dd>, <Dd>, #<imm>
VFPU cond 1 1 1 0 1 D 1 1 1 1 0 U Vd 1 0 1 sz op 1 M 0 Vm VCVT\(op ? "" : "R")\<c>.\(u ? "U" : "S")\32.F\(size ? "64" : "32")\ <Sd>, <Dm>
VFPU cond 1 1 1 0 1 D 1 1 1 1 1 U Vd 1 0 1 sz op 1 i 0 imm4 @ set uint8_t td = (u << 2) + op + 1@ td=0b001=0b010=0b101 const char* Td Td,"S16","U16","S32","U32"@ set imm5 = (16 << op) - (imm5 >> 4) - ((imm5 & 0xF) << 1)@ @ VCVT<c>.\Td\.F\(size ? "64" : "32")\ <Dd>, <Dd>, #<imm>
INVALIDATE <32>
-494
View File
@@ -1,494 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <elf.h>
#include <sys/mman.h>
#include "box86version.h"
#include "elfloader.h"
#include "debug.h"
#include "elfload_dump.h"
#include "elfloader_private.h"
#include "librarian.h"
#include "x86run.h"
#include "bridge.h"
#include "wrapper.h"
#include "box86context.h"
#include "library.h"
#include "x86emu.h"
void FreeElfHeader(elfheader_t** head)
{
if(!head || !*head)
return;
elfheader_t *h = *head;
free(h->name);
free(h->PHEntries);
free(h->SHEntries);
free(h->SHStrTab);
free(h->StrTab);
free(h->Dynamic);
free(h->DynStr);
free(h->SymTab);
free(h->DynSym);
FreeElfMemory(h);
free(h);
*head = NULL;
}
int CalcLoadAddr(elfheader_t* head)
{
head->memsz = 0;
head->paddr = head->vaddr = (uintptr_t)~0;
head->align = 1;
for (int i=0; i<head->numPHEntries; ++i)
if(head->PHEntries[i].p_type == PT_LOAD) {
if(head->paddr > head->PHEntries[i].p_paddr)
head->paddr = head->PHEntries[i].p_paddr;
if(head->vaddr > head->PHEntries[i].p_vaddr)
head->vaddr = head->PHEntries[i].p_vaddr;
}
if(head->vaddr==~0 || head->paddr==~0) {
printf_log(LOG_NONE, "Error: v/p Addr for Elf Load not set\n");
return 1;
}
head->stacksz = 1024*1024; //1M stack size default?
head->stackalign = 4; // default align for stack
for (int i=0; i<head->numPHEntries; ++i) {
if(head->PHEntries[i].p_type == PT_LOAD) {
uintptr_t phend = head->PHEntries[i].p_vaddr - head->vaddr + head->PHEntries[i].p_memsz;
if(phend > head->memsz)
head->memsz = phend;
if(head->PHEntries[i].p_align > head->align)
head->align = head->PHEntries[i].p_align;
}
if(head->PHEntries[i].p_type == PT_GNU_STACK) {
if(head->stacksz < head->PHEntries[i].p_memsz)
head->stacksz = head->PHEntries[i].p_memsz;
if(head->stackalign < head->PHEntries[i].p_align)
head->stackalign = head->PHEntries[i].p_align;
}
}
printf_log(LOG_DEBUG, "Elf Addr(v/p)=%p/%p Memsize=0x%x (align=0x%x)\n", (void*)head->vaddr, (void*)head->paddr, head->memsz, head->align);
printf_log(LOG_DEBUG, "Elf Stack Memsize=%u (align=%u)\n", head->stacksz, head->stackalign);
return 0;
}
const char* ElfName(elfheader_t* head)
{
return head->name;
}
int AllocElfMemory(elfheader_t* head)
{
#if 0
printf_log(LOG_DEBUG, "Allocating memory for Elf \"%s\"\n", head->name);
if (posix_memalign((void**)&head->memory, head->align, head->memsz)) {
printf_log(LOG_NONE, "Cannot allocate aligned memory (0x%x/0x%x) for elf \"%s\"\n", head->memsz, head->align, head->name);
return 1;
}
printf_log(LOG_DEBUG, "Address is %p\n", head->memory);
printf_log(LOG_DEBUG, "And setting memory access to PROT_READ | PROT_WRITE | PROT_EXEC\n");
if (mprotect(head->memory, head->memsz, PROT_READ | PROT_WRITE | PROT_EXEC)) {
printf_log(LOG_NONE, "Cannot protect memory for elf \"%s\"\n", head->name);
// memory protect error not fatal for now....
}
#else
printf_log(LOG_DEBUG, "Allocating 0x%x memory @%p for Elf \"%s\"\n", head->memsz, (void*)head->vaddr, head->name);
void* p = mmap((void*)head->vaddr, head->memsz
, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_ANONYMOUS | ((head->vaddr)?MAP_FIXED:0)
, -1, 0);
if(p==MAP_FAILED) {
printf_log(LOG_NONE, "Cannot create memory map (@%p 0x%x/0x%x) for elf \"%s\"\n", (void*)head->vaddr, head->memsz, head->align, head->name);
return 1;
}
head->memory = p;
memset(p, 0, head->memsz);
head->delta = (intptr_t)p - (intptr_t)head->vaddr;
printf_log(LOG_DEBUG, "Got %p (delta=%p)\n", p, (void*)head->delta);
#endif
return 0;
}
void FreeElfMemory(elfheader_t* head)
{
if(head->memory)
munmap((void*)head->memory, head->memsz);
}
int LoadElfMemory(FILE* f, elfheader_t* head)
{
for (int i=0; i<head->numPHEntries; ++i) {
if(head->PHEntries[i].p_type == PT_LOAD) {
Elf32_Phdr * e = &head->PHEntries[i];
char* dest = (char*)e->p_paddr + head->delta;
printf_log(LOG_DEBUG, "Loading block #%i @%p (0x%x/0x%x)\n", i, dest, e->p_filesz, e->p_memsz);
fseek(f, e->p_offset, SEEK_SET);
if(fread(dest, e->p_filesz, 1, f)!=1) {
printf_log(LOG_NONE, "Fail to read PT_LOAD part #%d\n", i);
return 1;
}
// zero'd difference between filesz and memsz
if(e->p_filesz != e->p_memsz)
memset(dest+e->p_filesz, 0, e->p_memsz - e->p_filesz);
}
}
return 0;
}
int RelocateElfREL(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rel *rel)
{
for (int i=0; i<cnt; ++i) {
Elf32_Sym *sym = &head->DynSym[ELF32_R_SYM(rel[i].r_info)];
const char* symname = SymName(head, sym);
uint32_t *p = (uint32_t*)(rel[i].r_offset + head->delta);
uintptr_t offs = 0;
uint32_t sz = 0;
uintptr_t end = 0;
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end, 0);
uintptr_t globoffs, globend;
int t = ELF32_R_TYPE(rel[i].r_info);
switch(t) {
case R_386_NONE:
// can be ignored
printf_log(LOG_DEBUG, "Ignoring %s @%p (%p)\n", DumpRelType(t), p, (void*)(p?(*p):0));
break;
case R_386_PC32:
offs = (*p) + (offs - (uintptr_t)p);
printf_log(LOG_DEBUG, "Apply R_386_PC32 @%p with sym=%s (%p -> %p)\n", p, symname, *(void**)p, (void*)(*(uintptr_t*)p+offs));
*p += offs;
break;
case R_386_GLOB_DAT:
// Look for same symbol already loaded but not in self
if (GetGlobalSymbolStartEnd(maplib, symname, &globoffs, &globend, 1)) {
offs = globoffs;
end = globend;
}
if (!offs) {
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_GLOB_DAT @%p (%p)\n", symname, p, *(void**)p);
// return -1;
} else {
printf_log(LOG_DEBUG, "Apply R_386_GLOB_DAT @%p (%p -> %p) on sym=%s\n", p, (void*)(p?(*p):0), (void*)offs, symname);
*p = offs;
}
break;
case R_386_RELATIVE:
printf_log(LOG_DEBUG, "Apply R_386_RELATIVE @%p (%p -> %p)\n", p, *(void**)p, (void*)((*p)+head->delta));
*p += head->delta;
break;
case R_386_32:
if (!offs) {
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_32 @%p (%p)\n", symname, p, *(void**)p);
// return -1;
} else {
printf_log(LOG_DEBUG, "Apply R_386_32 @%p with sym=%s (%p -> %p)\n", p, symname, *(void**)p, (void*)(offs+*(uint32_t*)p));
*p += offs;
}
break;
//case R_386_TLS_DTPMOD32:
// try to use _dl_next_tls_modid() ?
case R_386_TLS_DTPOFF32:
case R_386_JMP_SLOT:
if (!offs) {
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_JMP_SLOT @%p (%p)\n", symname, p, *(void**)p);
// return -1;
} else {
if(p) {
printf_log(LOG_DEBUG, "Apply R_386_JMP_SLOT @%p with sym=%s (%p -> %p)\n", p, symname, *(void**)p, (void*)offs);
*p = offs;
} else {
printf_log(LOG_NONE, "Warning, Symbol %s found, but Jump Slot Offset is NULL \n", symname);
}
}
break;
case R_386_COPY:
if(offs) {
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end, 1); // get original copy if any
printf_log(LOG_DEBUG, "Apply R_386_COPY @%p with sym=%s, @%p size=%d (", p, symname, (void*)offs, sym->st_size);
memmove(p, (void*)offs, sym->st_size);
if(LOG_DEBUG<=box86_log) {
uint32_t*k = (uint32_t*)p;
for (int i=0; i<sym->st_size; i+=4, ++k)
printf_log(LOG_DEBUG, "%s0x%08X", i?" ":"", *k);
printf_log(LOG_DEBUG, ")\n");
}
} else {
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_COPY @%p (%p)\n", symname, p, *(void**)p);
}
break;
default:
printf_log(LOG_INFO, "Warning, don't know of to handle rel #%d %s (%p)\n", i, DumpRelType(ELF32_R_TYPE(rel[i].r_info)), p);
}
}
return 0;
}
int RelocateElfRELA(lib_t *maplib, elfheader_t* head, int cnt, Elf32_Rela *rela)
{
for (int i=0; i<cnt; ++i) {
Elf32_Sym *sym = &head->DynSym[ELF32_R_SYM(rela[i].r_info)];
const char* symname = SymName(head, sym);
uint32_t *p = (uint32_t*)(rela[i].r_offset + head->delta);
uintptr_t offs = 0;
uint32_t sz = 0;
uintptr_t end = 0;
switch(ELF32_R_TYPE(rela[i].r_info)) {
case R_386_NONE:
case R_386_PC32:
// can be ignored
break;
case R_386_COPY:
GetGlobalSymbolStartEnd(maplib, symname, &offs, &end,1);
if(offs) {
// add r_addend to p?
printf_log(LOG_DEBUG, "Apply R_386_COPY @%p with sym=%s, @%p size=%d\n", p, symname, (void*)offs, sym->st_size);
memcpy(p, (void*)(offs+rela[i].r_addend), sym->st_size);
} else {
printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_386_COPY @%p (%p)\n", symname, p, *(void**)p);
}
break;
default:
printf_log(LOG_INFO, "Warning, don't know of to handle rel #%d %s on %s\n", i, DumpRelType(ELF32_R_TYPE(rela[i].r_info)), symname);
}
}
return 0;
}
int RelocateElf(lib_t *maplib, elfheader_t* head)
{
if(head->rel) {
int cnt = head->relsz / head->relent;
DumpRelTable(head, cnt, (Elf32_Rel *)(head->rel + head->delta), "Rel");
printf_log(LOG_DEBUG, "Applying %d Relocation(s) for %s\n", cnt, head->name);
if(RelocateElfREL(maplib, head, cnt, (Elf32_Rel *)(head->rel + head->delta)))
return -1;
}
if(head->rela) {
int cnt = head->relasz / head->relaent;
DumpRelATable(head, cnt, (Elf32_Rela *)(head->rela + head->delta), "RelA");
printf_log(LOG_DEBUG, "Applying %d Relocation(s) with Addend for %s\n", cnt, head->name);
if(RelocateElfRELA(maplib, head, cnt, (Elf32_Rela *)(head->rela + head->delta)))
return -1;
}
return 0;
}
int RelocateElfPlt(box86context_t* context, lib_t *maplib, elfheader_t* head)
{
if(head->pltrel) {
int cnt = head->pltsz / head->pltent;
if(head->pltrel==DT_REL) {
DumpRelTable(head, cnt, (Elf32_Rel *)(head->jmprel + head->delta), "PLT");
printf_log(LOG_DEBUG, "Applying %d PLT Relocation(s) for %s\n", cnt, head->name);
if(RelocateElfREL(maplib, head, cnt, (Elf32_Rel *)(head->jmprel + head->delta)))
return -1;
} else if(head->pltrel==DT_RELA) {
DumpRelATable(head, cnt, (Elf32_Rela *)(head->jmprel + head->delta), "PLT");
printf_log(LOG_DEBUG, "Applying %d PLT Relocation(s) with Addend for %s\n", cnt, head->name);
if(RelocateElfRELA(maplib, head, cnt, (Elf32_Rela *)(head->jmprel + head->delta)))
return -1;
}
if(head->gotplt) {
if(pltResolver==~0) {
pltResolver = AddBridge(context->system, vFEpp, PltResolver); // should be vFEuu
}
*(uintptr_t*)(head->gotplt+head->delta+8) = pltResolver;
printf_log(LOG_DEBUG, "PLT Resolver injected at %p\n", (void*)(head->gotplt+head->delta+8));
}
}
return 0;
}
void CalcStack(elfheader_t* elf, uint32_t* stacksz, int* stackalign)
{
if(*stacksz < elf->stacksz)
*stacksz = elf->stacksz;
if(*stackalign < elf->stackalign)
*stackalign = elf->stackalign;
}
Elf32_Sym* GetFunction(elfheader_t* h, const char* name)
{
// TODO: create a hash on named to avoid this loop
for (int i=0; i<h->numSymTab; ++i) {
if(h->SymTab[i].st_info == 18) { // TODO: this "18" is probably defined somewhere
const char * symname = h->StrTab+h->SymTab[i].st_name;
if(strcmp(symname, name)==0) {
return h->SymTab+i;
}
}
}
return NULL;
}
uintptr_t GetFunctionAddress(elfheader_t* h, const char* name)
{
Elf32_Sym* sym = GetFunction(h, name);
if(sym) return sym->st_value;
return 0;
}
uintptr_t GetEntryPoint(lib_t* maplib, elfheader_t* h)
{
uintptr_t ep = h->entrypoint + h->delta;
printf_log(LOG_DEBUG, "Entry Point is %p\n", (void*)ep);
if(box86_log>=LOG_DUMP) {
printf_log(LOG_DUMP, "(short) Dump of Entry point\n");
int sz = 64;
uintptr_t lastbyte = GetLastByte(h);
if (ep + sz > lastbyte)
sz = lastbyte - ep;
DumpBinary((char*)ep, sz);
}
/*
// but instead of regular entrypoint, lets grab "main", it will be easier to manage I guess
uintptr_t m = FindSymbol(maplib, "main");
if(m) {
ep = m;
printf_log(LOG_DEBUG, "Using \"main\" as Entry Point @%p\n", ep);
if(box86_log>=LOG_DUMP) {
printf_log(LOG_DUMP, "(short) Dump of Entry point\n");
int sz = 64;
uintptr_t lastbyte = GetLastByte(h);
if (ep + sz > lastbyte)
sz = lastbyte - ep;
DumpBinary((char*)ep, sz);
}
}
*/
return ep;
}
uintptr_t GetLastByte(elfheader_t* h)
{
return (uintptr_t)h->memory + h->delta + h->memsz;
}
void AddGlobalsSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, elfheader_t* h)
{
// info == 161 => OBJECT UNIQUE
// info == 33 => OBJECT WEAK
printf_log(LOG_DUMP, "Will look for Symbol to add in SymTable(%d)\n", h->numSymTab);
for (int i=0; i<h->numSymTab; ++i) {
const char * symname = h->StrTab+h->SymTab[i].st_name;
if(((h->SymTab[i].st_info & 2) || (h->SymTab[i].st_info == 17)
|| (h->SymTab[i].st_info == 161 && !FindGlobalSymbol(maplib, symname))
|| (h->SymTab[i].st_info == 33)
)
&& (h->SymTab[i].st_other==0) && (h->SymTab[i].st_shndx!=0)) {
if(!h->SymTab[i].st_value && FindGlobalSymbol(maplib, symname))
break;
uintptr_t offs = h->SymTab[i].st_value + h->delta;
uint32_t sz = h->SymTab[i].st_size;
printf_log(LOG_DUMP, "Adding Symbol \"%s\" with offset=%p sz=%d\n", symname, (void*)offs, sz);
AddSymbol(mapsymbols, symname, offs, sz);
}
}
printf_log(LOG_DUMP, "Will look for Symbol to add in DynSym (%d)\n", h->numDynSym);
for (int i=0; i<h->numDynSym; ++i) {
const char * symname = h->DynStr+h->DynSym[i].st_name;
if(((h->DynSym[i].st_info & 2) || (h->DynSym[i].st_info == 17)
|| (h->DynSym[i].st_info == 161 && !FindGlobalSymbol(maplib, symname))
|| (h->DynSym[i].st_info == 33)
)
&& (h->DynSym[i].st_other==0) && (h->DynSym[i].st_shndx!=0 && h->DynSym[i].st_shndx<62521)) {
if(!h->DynSym[i].st_value && FindGlobalSymbol(maplib, symname))
break;
uintptr_t offs = h->DynSym[i].st_value + h->delta;
uint32_t sz = h->DynSym[i].st_size;
printf_log(LOG_DUMP, "Adding Symbol \"%s\" with offset=%p sz=%d\n", symname, (void*)offs, sz);
AddSymbol(mapsymbols, symname, offs, sz);
}
}
}
/*
$ORIGIN – Provides the directory the object was loaded from. This token is typical
used for locating dependencies in unbundled packages. For more details of this
token expansion, see “Locating Associated Dependencies”
$OSNAME – Expands to the name of the operating system (see the uname(1) man
page description of the -s option). For more details of this token expansion, see
“System Specific Shared Objects”
$OSREL – Expands to the operating system release level (see the uname(1) man
page description of the -r option). For more details of this token expansion, see
“System Specific Shared Objects”
$PLATFORM – Expands to the processor type of the current machine (see the
uname(1) man page description of the -i option). For more details of this token
expansion, see “System Specific Shared Objects”
*/
int LoadNeededLib(elfheader_t* h, lib_t *maplib, box86context_t *box86, x86emu_t* emu)
{
DumpDynamicNeeded(h);
// reverse order on needed libs
for (int i=h->numDynamic-1; i>=0; --i)
if(h->Dynamic[i].d_tag==DT_NEEDED) {
char *needed = h->DynStrTab+h->delta+h->Dynamic[i].d_un.d_val;
// TODO: Add LD_LIBRARY_PATH and RPATH Handling
if(AddNeededLib(maplib, needed, box86, emu)) {
printf_log(LOG_INFO, "Error loading needed lib: \"%s\"\n", needed);
return 1; //error...
}
}
return 0;
}
void RunElfInit(elfheader_t* h, x86emu_t *emu)
{
if(h->init_done || !h->initentry)
return;
uintptr_t p = h->initentry + h->delta;
box86context_t* context = GetEmuContext(emu);
if(context->deferedInit) {
if(context->deferedInitSz==context->deferedInitCap) {
context->deferedInitCap += 4;
context->deferedInitList = (elfheader_t**)realloc(context->deferedInitList, context->deferedInitCap*sizeof(elfheader_t*));
}
context->deferedInitList[context->deferedInitSz++] = h;
return;
}
printf_log(LOG_DEBUG, "Calling Init for %s @%p\n", ElfName(h), (void*)p);
EmuCall(emu, p);
h->init_done = 1;
return;
}
void RunDeferedElfInit(x86emu_t *emu)
{
box86context_t* context = GetEmuContext(emu);
if(!context->deferedInit)
return;
context->deferedInit = 0;
if(!context->deferedInitList)
return;
for (int i=0; i<context->deferedInitSz; ++i)
RunElfInit(context->deferedInitList[i], emu);
free(context->deferedInitList);
context->deferedInitList = NULL;
context->deferedInitCap = context->deferedInitSz = 0;
}
void RunElfFini(elfheader_t* h, x86emu_t *emu)
{
if(h->fini_done || !h->finientry)
return;
uintptr_t p = h->finientry + h->delta;
printf_log(LOG_DEBUG, "Calling Fini for %s @%p\n", ElfName(h), (void*)p);
EmuCall(emu, p);
h->fini_done = 1;
return;
}
uintptr_t GetElfInit(elfheader_t* h)
{
return h->initentry + h->delta;
}
uintptr_t GetElfFini(elfheader_t* h)
{
return h->finientry + h->delta;
}
-33
View File
@@ -1,33 +0,0 @@
#ifndef __ELF_LOADER_H_
#define __ELF_LOADER_H_
#include <stdio.h>
typedef struct elfheader_s elfheader_t;
typedef struct lib_s lib_t;
typedef struct kh_mapsymbols_s kh_mapsymbols_t;
typedef struct box86context_s box86context_t;
typedef struct x86emu_s x86emu_t;
void* LoadAndCheckElfHeader(FILE* f, const char* name, int exec); // exec : 0 = lib, 1 = exec
void FreeElfHeader(elfheader_t** head);
const char* ElfName(elfheader_t* head);
// return 0 if OK
int CalcLoadAddr(elfheader_t* head);
int AllocElfMemory(elfheader_t* head);
void FreeElfMemory(elfheader_t* head);
int LoadElfMemory(FILE* f, elfheader_t* head);
int RelocateElf(lib_t *maplib, elfheader_t* head);
int RelocateElfPlt(box86context_t* context, lib_t *maplib, elfheader_t* head);
void CalcStack(elfheader_t* h, uint32_t* stacksz, int* stackalign);
uintptr_t GetEntryPoint(lib_t* maplib, elfheader_t* h);
uintptr_t GetLastByte(elfheader_t* h);
void AddGlobalsSymbols(lib_t *maplib, kh_mapsymbols_t* mapsymbols, elfheader_t* h);
int LoadNeededLib(elfheader_t* h, lib_t *maplib, box86context_t* box86, x86emu_t* emu);
uintptr_t GetElfInit(elfheader_t* h);
uintptr_t GetElfFini(elfheader_t* h);
void RunElfInit(elfheader_t* h, x86emu_t *emu);
void RunElfFini(elfheader_t* h, x86emu_t *emu);
void RunDeferedElfInit(x86emu_t *emu);
#endif //__ELF_LOADER_H_
-271
View File
@@ -1,271 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <elf.h>
#include "box86version.h"
#include "elfloader.h"
#include "debug.h"
#include "elfload_dump.h"
#include "elfloader_private.h"
#ifndef PN_XNUM
#define PN_XNUM (0xffff)
#endif
int LoadSH(FILE *f, Elf32_Shdr *s, void** SH, const char* name, uint32_t type)
{
if(type && (s->sh_type != type)) {
printf_log(LOG_INFO, "Section Header \"%s\" (off=%d, size=%d) has incorect type (%d != %d)\n", name, s->sh_offset, s->sh_size, s->sh_type, type);
return -1;
}
if (type==SHT_SYMTAB && s->sh_size%sizeof(Elf32_Sym)) {
printf_log(LOG_INFO, "Section Header \"%s\" (off=%d, size=%d) has size (not multiple of %d)\n", name, s->sh_offset, s->sh_size, sizeof(Elf32_Sym));
}
*SH = calloc(1, s->sh_size);
fseek(f, s->sh_offset ,SEEK_SET);
if(fread(*SH, s->sh_size, 1, f)!=1) {
printf_log(LOG_INFO, "Cannot read Section Header \"%s\" (off=%d, size=%d)\n", name, s->sh_offset, s->sh_size);
return -1;
}
return 0;
}
int FindSection(Elf32_Shdr *s, int n, char* SHStrTab, const char* name)
{
for (int i=0; i<n; ++i) {
if(s[i].sh_type!=SHT_NULL)
if(!strcmp(SHStrTab+s[i].sh_name, name))
return i;
}
return 0;
}
void LoadNamedSection(FILE *f, Elf32_Shdr *s, int size, char* SHStrTab, const char* name, const char* clearname, uint32_t type, void** what, int* num)
{
int n = FindSection(s, size, SHStrTab, name);
printf_log(LOG_DEBUG, "Loading %s (idx = %d)\n", clearname, n);
if(n)
LoadSH(f, s+n, what, name, type);
if(type==SHT_SYMTAB || type==SHT_DYNSYM) {
if(*what && num)
*num = s[n].sh_size / sizeof(Elf32_Sym);
} else if(type==SHT_DYNAMIC) {
if(*what && num)
*num = s[n].sh_size / sizeof(Elf32_Dyn);
}
}
void* LoadAndCheckElfHeader(FILE* f, const char* name, int exec)
{
Elf32_Ehdr header;
if(fread(&header, sizeof(Elf32_Ehdr), 1, f)!=1) {
printf_log(LOG_INFO, "Cannot read ELF Header\n");
return NULL;
}
if(memcmp(header.e_ident, ELFMAG, SELFMAG)!=0) {
printf_log(LOG_INFO, "Not an ELF file (sign=%c%c%c%c)\n", header.e_ident[0], header.e_ident[1], header.e_ident[2], header.e_ident[3]);
return NULL;
}
if(header.e_ident[EI_CLASS]!=ELFCLASS32) {
printf_log(LOG_INFO, "Not an 32bits ELF (%d)\n", header.e_ident[EI_CLASS]);
return NULL;
}
if(header.e_ident[EI_DATA]!=ELFDATA2LSB) {
printf_log(LOG_INFO, "Not an LittleEndian ELF (%d)\n", header.e_ident[EI_DATA]);
return NULL;
}
if(header.e_ident[EI_VERSION]!=EV_CURRENT) {
printf_log(LOG_INFO, "Incorrect ELF version (%d)\n", header.e_ident[EI_VERSION]);
return NULL;
}
if(header.e_ident[EI_OSABI]!=ELFOSABI_LINUX && header.e_ident[EI_OSABI]!=ELFOSABI_NONE && header.e_ident[EI_OSABI]!=ELFOSABI_SYSV) {
printf_log(LOG_INFO, "Not a Linux ELF (%d)\n",header.e_ident[EI_OSABI]);
return NULL;
}
if(header.e_type != ET_EXEC && header.e_type != ET_DYN) {
printf_log(LOG_INFO, "Not an Executable (%d)\n", header.e_type);
return NULL;
}
if(header.e_machine != EM_386) {
printf_log(LOG_INFO, "Not an i386 ELF (%d)\n", header.e_machine);
return NULL;
}
if(header.e_entry == 0) {
printf_log(LOG_INFO, "No entry point in ELF\n");
return NULL;
}
if(header.e_phentsize != sizeof(Elf32_Phdr)) {
printf_log(LOG_INFO, "Program Header Entry size incorrect (%d != %d)\n", header.e_phentsize, sizeof(Elf32_Phdr));
return NULL;
}
if(header.e_shentsize != sizeof(Elf32_Shdr)) {
printf_log(LOG_INFO, "Section Header Entry size incorrect (%d != %d)\n", header.e_shentsize, sizeof(Elf32_Shdr));
return NULL;
}
elfheader_t *h = calloc(1, sizeof(elfheader_t));
h->name = strdup(name);
h->entrypoint = header.e_entry;
h->numPHEntries = header.e_phnum;
h->numSHEntries = header.e_shnum;
h->SHIdx = header.e_shstrndx;
// special cases for nums
if(h->numSHEntries == 0) {
printf_log(LOG_DEBUG, "Read number of Sections in 1st Section\n");
// read 1st section header and grab actual number from here
fseek(f, header.e_shoff, SEEK_SET);
Elf32_Shdr section;
if(fread(&section, sizeof(Elf32_Shdr), 1, f)!=1) {
free(h);
printf_log(LOG_INFO, "Cannot read Initial Section Header\n");
return NULL;
}
h->numSHEntries = section.sh_size;
}
// now read all section headers
printf_log(LOG_DEBUG, "Read %d Section header\n", h->numSHEntries);
h->SHEntries = (Elf32_Shdr*)calloc(h->numSHEntries, sizeof(Elf32_Shdr));
fseek(f, header.e_shoff ,SEEK_SET);
if(fread(h->SHEntries, sizeof(Elf32_Shdr), h->numSHEntries, f)!=h->numSHEntries) {
FreeElfHeader(&h);
printf_log(LOG_INFO, "Cannot read all Section Header\n");
return NULL;
}
if(h->numPHEntries == PN_XNUM) {
printf_log(LOG_DEBUG, "Read number of Program Header in 1st Section\n");
// read 1st section header and grab actual number from here
h->numPHEntries = h->SHEntries[0].sh_info;
}
printf_log(LOG_DEBUG, "Read %d Program header\n", h->numPHEntries);
h->PHEntries = (Elf32_Phdr*)calloc(h->numPHEntries, sizeof(Elf32_Phdr));
fseek(f, header.e_phoff ,SEEK_SET);
if(fread(h->PHEntries, sizeof(Elf32_Phdr), h->numPHEntries, f)!=h->numPHEntries) {
FreeElfHeader(&h);
printf_log(LOG_INFO, "Cannot read all Program Header\n");
return NULL;
}
if(h->SHIdx == SHN_XINDEX) {
printf_log(LOG_DEBUG, "Read number of String Table in 1st Section\n");
h->SHIdx = h->SHEntries[0].sh_link;
}
if(h->SHIdx > h->numSHEntries) {
printf_log(LOG_INFO, "Incoherent Section String Table Index : %d / %d\n", h->SHIdx, h->numSHEntries);
FreeElfHeader(&h);
return NULL;
}
// load Section table
printf_log(LOG_DEBUG, "Loading Sections Table String (idx = %d)\n", h->SHIdx);
if(LoadSH(f, h->SHEntries+h->SHIdx, (void*)&h->SHStrTab, ".shstrtab", SHT_STRTAB)) {
FreeElfHeader(&h);
return NULL;
}
if(box86_log>=LOG_DUMP) DumpMainHeader(&header, h);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".strtab", "SymTab Strings", SHT_STRTAB, (void**)&h->StrTab, NULL);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".symtab", "SymTab", SHT_SYMTAB, (void**)&h->SymTab, &h->numSymTab);
if(box86_log>=LOG_DUMP && h->SymTab) DumpSymTab(h);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynamic", "Dynamic", SHT_DYNAMIC, (void**)&h->Dynamic, &h->numDynamic);
if(box86_log>=LOG_DUMP && h->Dynamic) DumpDynamicSections(h);
// grab DT_REL & DT_RELA stuffs
// also grab the DT_STRTAB string table
{
for (int i=0; i<h->numDynamic; ++i) {
if(h->Dynamic[i].d_tag == DT_REL)
h->rel = h->Dynamic[i].d_un.d_ptr;
else if(h->Dynamic[i].d_tag == DT_RELSZ)
h->relsz = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_RELENT)
h->relent = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_RELA)
h->rela = h->Dynamic[i].d_un.d_ptr;
else if(h->Dynamic[i].d_tag == DT_RELASZ)
h->relasz = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_RELAENT)
h->relaent = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_PLTREL)
h->pltrel = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_PLTRELSZ)
h->pltsz = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_JMPREL)
h->jmprel = h->Dynamic[i].d_un.d_val;
else if(h->Dynamic[i].d_tag == DT_STRTAB)
h->DynStrTab = (char*)(h->Dynamic[i].d_un.d_ptr);
else if(h->Dynamic[i].d_tag == DT_STRSZ)
h->szDynStrTab = h->Dynamic[i].d_un.d_val;
}
if(h->rel) {
if(h->relent != sizeof(Elf32_Rel)) {
printf_log(LOG_NONE, "Rel Table Entry size invalid (0x%x should be 0x%x)\n", h->relent, sizeof(Elf32_Rel));
FreeElfHeader(&h);
return NULL;
}
printf_log(LOG_DEBUG, "Rel Table @%p (0x%x/0x%x)\n", (void*)h->rel, h->relsz, h->relent);
}
if(h->rela) {
if(h->relaent != sizeof(Elf32_Rela)) {
printf_log(LOG_NONE, "RelA Table Entry size invalid (0x%x should be 0x%x)\n", h->relaent, sizeof(Elf32_Rela));
FreeElfHeader(&h);
return NULL;
}
printf_log(LOG_DEBUG, "RelA Table @%p (0x%x/0x%x)\n", (void*)h->rela, h->relasz, h->relaent);
}
if(h->jmprel) {
if(h->pltrel == DT_REL) {
h->pltent = sizeof(Elf32_Rel);
} else if(h->pltrel == DT_RELA) {
h->pltent = sizeof(Elf32_Rela);
} else {
printf_log(LOG_NONE, "PLT Table type is unknown (size = 0x%x, type=%d)\n", h->pltsz, h->pltrel);
FreeElfHeader(&h);
return NULL;
}
if((h->pltsz / h->pltent)*h->pltent != h->pltsz) {
printf_log(LOG_NONE, "PLT Table Entry size invalid (0x%x, ent=0x%x, type=%d)\n", h->pltsz, h->pltent, h->pltrel);
FreeElfHeader(&h);
return NULL;
}
printf_log(LOG_DEBUG, "PLT Table @%p (type=%d 0x%x/0x%0x)\n", (void*)h->jmprel, h->pltrel, h->pltsz, h->pltent);
}
if(h->DynStrTab && h->szDynStrTab) {
//DumpDynamicNeeded(h); cannot dump now, it's not loaded yet
}
}
// look for PLT Offset
int ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".got.plt");
if(ii) {
h->gotplt = h->SHEntries[ii].sh_addr;
printf_log(LOG_DEBUG, "The GOT.PLT Table is at address %p\n", (void*)h->gotplt);
}
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".got");
if(ii) {
h->got = h->SHEntries[ii].sh_addr;
printf_log(LOG_DEBUG, "The GOT Table is at address %p\n", (void*)h->got);
}
// look for .init entry point
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".init");
if(ii) {
h->initentry = h->SHEntries[ii].sh_addr;
printf_log(LOG_DEBUG, "The .init is at address %p\n", (void*)h->initentry);
}
// look for .fini entry point
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".fini");
if(ii) {
h->finientry = h->SHEntries[ii].sh_addr;
printf_log(LOG_DEBUG, "The .fini is at address %p\n", (void*)h->finientry);
}
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynstr", "DynSym Strings", SHT_STRTAB, (void**)&h->DynStr, NULL);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynsym", "DynSym", SHT_DYNSYM, (void**)&h->DynSym, &h->numDynSym);
if(box86_log>=LOG_DUMP && h->DynSym) DumpDynSym(h);
return h;
}
@@ -40,6 +40,7 @@ const char* DumpSection(Elf32_Shdr *s, char* SST) {
GO(SHT_HIPROC);
GO(SHT_LOUSER);
GO(SHT_HIUSER);
#if defined(SHT_GNU_versym) && defined(SHT_GNU_ATTRIBUTES)
GO(SHT_GNU_versym);
GO(SHT_GNU_ATTRIBUTES);
GO(SHT_GNU_HASH);
@@ -51,6 +52,7 @@ const char* DumpSection(Elf32_Shdr *s, char* SST) {
GO(SHT_SUNW_syminfo);
GO(SHT_GNU_verdef);
GO(SHT_GNU_verneed);
#endif
#undef GO
default:
sprintf(buff, "0x%X unknown type", s->sh_type);
@@ -98,6 +100,7 @@ const char* DumpDynamic(Elf32_Dyn *s) {
GO(DT_RUNPATH, 0);
GO(DT_FLAGS, 0);
GO(DT_ENCODING, 0);
#if defined(DT_NUM) && defined(DT_TLSDESC_PLT)
GO(DT_NUM, 0);
GO(DT_VALRNGLO, 0);
GO(DT_GNU_PRELINKED, 0);
@@ -133,6 +136,7 @@ const char* DumpDynamic(Elf32_Dyn *s) {
GO(DT_VERNEEDNUM, 0);
GO(DT_AUXILIARY, 0);
GO(DT_FILTER, 0);
#endif
#undef GO
default:
sprintf(buff, "0x%X unknown type", s->d_tag);
@@ -154,11 +158,13 @@ const char* DumpPHEntry(Elf32_Phdr *e)
GO(PT_SHLIB);
GO(PT_PHDR);
GO(PT_TLS);
#ifdef PT_NUM
GO(PT_NUM);
GO(PT_LOOS);
GO(PT_GNU_EH_FRAME);
GO(PT_GNU_STACK);
GO(PT_GNU_RELRO);
#endif
#undef GO
default: sprintf(buff, "type: %x, Off=%x vaddr=%p paddr=%p filesz=%u memsz=%u flags=%x align=%u", e->p_type, e->p_offset, (void*)e->p_vaddr, (void*)e->p_paddr, e->p_filesz, e->p_memsz, e->p_flags, e->p_align); break;
}
@@ -183,9 +189,11 @@ const char* DumpRelType(int t)
GO(R_386_GOTOFF);
GO(R_386_GOTPC);
GO(R_386_PC8);
GO(R_386_TLS_TPOFF);
GO(R_386_TLS_GD_32);
GO(R_386_TLS_DTPMOD32);
GO(R_386_TLS_DTPOFF32);
GO(R_386_TLS_TPOFF32);
#undef GO
default: sprintf(buff, "type: 0x%x (unknown)", t); break;
}
@@ -283,6 +291,22 @@ void DumpDynamicNeeded(elfheader_t *h)
}
}
void DumpDynamicRPath(elfheader_t *h)
{
if(box86_log>=LOG_DUMP && h->DynStrTab) {
printf_log(LOG_DUMP, "ELF Dump DT_RPATH/DT_RUNPATH=====\n");
for (int i=0; i<h->numDynamic; ++i) {
if(h->Dynamic[i].d_tag==DT_RPATH) {
printf_log(LOG_DUMP, " RPATH : %s\n", h->DynStrTab+h->Dynamic[i].d_un.d_val + h->delta);
}
if(h->Dynamic[i].d_tag==DT_RUNPATH) {
printf_log(LOG_DUMP, " RUNPATH : %s\n", h->DynStrTab+h->Dynamic[i].d_un.d_val + h->delta);
}
}
printf_log(LOG_DUMP, "=====ELF Dump DT_RPATH/DT_RUNPATH\n");
}
}
void DumpRelTable(elfheader_t *h, int cnt, Elf32_Rel *rel, const char* name)
{
if(box86_log>=LOG_DUMP) {
+1338
View File
File diff suppressed because it is too large. Load diff
@@ -1,8 +1,18 @@
#ifndef __ELFLOADER_PRIVATE_H_
#define __ELFLOADER_PRIVATE_H_
#ifdef DYNAREC
typedef struct dynablocklist_s dynablocklist_t;
#endif
typedef struct library_s library_t;
typedef struct needed_libs_s needed_libs_t;
#include <pthread.h>
struct elfheader_s {
char* name;
char* path; // Resolved path to file
int numPHEntries;
Elf32_Phdr *PHEntries;
int numSHEntries;
@@ -20,12 +30,20 @@ struct elfheader_s {
int numDynamic;
char* DynStrTab;
int szDynStrTab;
Elf32_Half* VerSym;
Elf32_Verneed* VerNeed;
int szVerNeed;
int e_type;
intptr_t delta; // should be 0
uintptr_t entrypoint;
uintptr_t initentry;
uintptr_t initarray;
int initarray_sz;
uintptr_t finientry;
uintptr_t finiarray;
int finiarray_sz;
uintptr_t rel;
int relsz;
@@ -38,7 +56,14 @@ struct elfheader_s {
int pltent;
uint32_t pltrel;
uintptr_t gotplt;
uintptr_t gotplt_end;
uintptr_t pltgot;
uintptr_t got;
uintptr_t got_end;
uintptr_t plt;
uintptr_t plt_end;
uintptr_t text;
int textsz;
uintptr_t paddr;
uintptr_t vaddr;
@@ -46,11 +71,22 @@ struct elfheader_s {
uint32_t memsz;
uint32_t stacksz;
int stackalign;
uint32_t tlssize;
int tlsalign;
int32_t tlsbase; // the base of the tlsdata in the global tlsdata (always negative)
int init_done;
int fini_done;
char* memory; // char* and not void* to allow math on memory pointer
void** multiblock;
uintptr_t* multiblock_offs;
uint32_t* multiblock_size;
int multiblock_n;
library_t *lib;
needed_libs_t *neededlibs;
};
#define R_386_NONE 0
@@ -65,4 +101,6 @@ struct elfheader_s {
#define R_386_GOTOFF 9
#define R_386_GOTPC 10
elfheader_t* ParseElfHeader(FILE* f, const char* name, int exec);
#endif //__ELFLOADER_PRIVATE_H_
+359
View File
@@ -0,0 +1,359 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <elf.h>
#include "box86version.h"
#include "elfloader.h"
#include "debug.h"
#include "elfload_dump.h"
#include "elfloader_private.h"
#ifndef PN_XNUM
#define PN_XNUM (0xffff)
#endif
int LoadSH(FILE *f, Elf32_Shdr *s, void** SH, const char* name, uint32_t type)
{
if(type && (s->sh_type != type)) {
printf_log(LOG_INFO, "Section Header \"%s\" (off=%d, size=%d) has incorect type (%d != %d)\n", name, s->sh_offset, s->sh_size, s->sh_type, type);
return -1;
}
if (type==SHT_SYMTAB && s->sh_size%sizeof(Elf32_Sym)) {
printf_log(LOG_INFO, "Section Header \"%s\" (off=%d, size=%d) has size (not multiple of %d)\n", name, s->sh_offset, s->sh_size, sizeof(Elf32_Sym));
}
*SH = calloc(1, s->sh_size);
fseeko64(f, s->sh_offset ,SEEK_SET);
if(fread(*SH, s->sh_size, 1, f)!=1) {
printf_log(LOG_INFO, "Cannot read Section Header \"%s\" (off=%d, size=%d)\n", name, s->sh_offset, s->sh_size);
return -1;
}
return 0;
}
int FindSection(Elf32_Shdr *s, int n, char* SHStrTab, const char* name)
{
for (int i=0; i<n; ++i) {
if(s[i].sh_type!=SHT_NULL)
if(!strcmp(SHStrTab+s[i].sh_name, name))
return i;
}
return 0;
}
void LoadNamedSection(FILE *f, Elf32_Shdr *s, int size, char* SHStrTab, const char* name, const char* clearname, uint32_t type, void** what, int* num)
{
int n = FindSection(s, size, SHStrTab, name);
printf_log(LOG_DEBUG, "Loading %s (idx = %d)\n", clearname, n);
if(n)
LoadSH(f, s+n, what, name, type);
if(type==SHT_SYMTAB || type==SHT_DYNSYM) {
if(*what && num)
*num = s[n].sh_size / sizeof(Elf32_Sym);
} else if(type==SHT_DYNAMIC) {
if(*what && num)
*num = s[n].sh_size / sizeof(Elf32_Dyn);
}
}
elfheader_t* ParseElfHeader(FILE* f, const char* name, int exec)
{
Elf32_Ehdr header;
int level = (exec)?LOG_INFO:LOG_DEBUG;
if(fread(&header, sizeof(Elf32_Ehdr), 1, f)!=1) {
printf_log(level, "Cannot read ELF Header\n");
return NULL;
}
if(memcmp(header.e_ident, ELFMAG, SELFMAG)!=0) {
printf_log(LOG_INFO, "Not an ELF file (sign=%c%c%c%c)\n", header.e_ident[0], header.e_ident[1], header.e_ident[2], header.e_ident[3]);
return NULL;
}
if(header.e_ident[EI_CLASS]!=ELFCLASS32) {
if(header.e_ident[EI_CLASS]==ELFCLASS64) {
printf_log(LOG_INFO, "This is a 64bits ELF! box86 can only run 32bits ELF!\n");
} else {
printf_log(LOG_INFO, "Not a 32bits ELF (%d)\n", header.e_ident[EI_CLASS]);
}
return NULL;
}
if(header.e_ident[EI_DATA]!=ELFDATA2LSB) {
printf_log(LOG_INFO, "Not a LittleEndian ELF (%d)\n", header.e_ident[EI_DATA]);
return NULL;
}
if(header.e_ident[EI_VERSION]!=EV_CURRENT) {
printf_log(LOG_INFO, "Incorrect ELF version (%d)\n", header.e_ident[EI_VERSION]);
return NULL;
}
if(header.e_ident[EI_OSABI]!=ELFOSABI_LINUX && header.e_ident[EI_OSABI]!=ELFOSABI_NONE && header.e_ident[EI_OSABI]!=ELFOSABI_SYSV) {
printf_log(LOG_INFO, "Not a Linux ELF (%d)\n",header.e_ident[EI_OSABI]);
return NULL;
}
if(header.e_type != ET_EXEC && header.e_type != ET_DYN) {
printf_log(LOG_INFO, "Not an Executable (%d)\n", header.e_type);
return NULL;
}
if(header.e_machine != EM_386) {
printf_log(level, "Not an i386 ELF (%d)\n", header.e_machine);
return NULL;
}
if(header.e_entry == 0 && exec) {
printf_log(LOG_INFO, "No entry point in ELF\n");
return NULL;
}
if(header.e_phentsize != sizeof(Elf32_Phdr)) {
printf_log(LOG_INFO, "Program Header Entry size incorrect (%d != %d)\n", header.e_phentsize, sizeof(Elf32_Phdr));
return NULL;
}
if(header.e_shentsize != sizeof(Elf32_Shdr) && header.e_shentsize != 0) {
printf_log(LOG_INFO, "Section Header Entry size incorrect (%d != %d)\n", header.e_shentsize, sizeof(Elf32_Shdr));
return NULL;
}
elfheader_t *h = calloc(1, sizeof(elfheader_t));
h->name = strdup(name);
h->entrypoint = header.e_entry;
h->numPHEntries = header.e_phnum;
h->numSHEntries = header.e_shnum;
h->SHIdx = header.e_shstrndx;
h->e_type = header.e_type;
if(header.e_shentsize && header.e_shnum) {
// special cases for nums
if(h->numSHEntries == 0) {
printf_log(LOG_DEBUG, "Read number of Sections in 1st Section\n");
// read 1st section header and grab actual number from here
fseeko64(f, header.e_shoff, SEEK_SET);
Elf32_Shdr section;
if(fread(&section, sizeof(Elf32_Shdr), 1, f)!=1) {
free(h);
printf_log(LOG_INFO, "Cannot read Initial Section Header\n");
return NULL;
}
h->numSHEntries = section.sh_size;
}
// now read all section headers
printf_log(LOG_DEBUG, "Read %d Section header\n", h->numSHEntries);
h->SHEntries = (Elf32_Shdr*)calloc(h->numSHEntries, sizeof(Elf32_Shdr));
fseeko64(f, header.e_shoff ,SEEK_SET);
if(fread(h->SHEntries, sizeof(Elf32_Shdr), h->numSHEntries, f)!=h->numSHEntries) {
FreeElfHeader(&h);
printf_log(LOG_INFO, "Cannot read all Section Header\n");
return NULL;
}
if(h->numPHEntries == PN_XNUM) {
printf_log(LOG_DEBUG, "Read number of Program Header in 1st Section\n");
// read 1st section header and grab actual number from here
h->numPHEntries = h->SHEntries[0].sh_info;
}
}
printf_log(LOG_DEBUG, "Read %d Program header\n", h->numPHEntries);
h->PHEntries = (Elf32_Phdr*)calloc(h->numPHEntries, sizeof(Elf32_Phdr));
fseeko64(f, header.e_phoff ,SEEK_SET);
if(fread(h->PHEntries, sizeof(Elf32_Phdr), h->numPHEntries, f)!=h->numPHEntries) {
FreeElfHeader(&h);
printf_log(LOG_INFO, "Cannot read all Program Header\n");
return NULL;
}
if(header.e_shentsize && header.e_shnum) {
if(h->SHIdx == SHN_XINDEX) {
printf_log(LOG_DEBUG, "Read number of String Table in 1st Section\n");
h->SHIdx = h->SHEntries[0].sh_link;
}
if(h->SHIdx > h->numSHEntries) {
printf_log(LOG_INFO, "Incoherent Section String Table Index : %d / %d\n", h->SHIdx, h->numSHEntries);
FreeElfHeader(&h);
return NULL;
}
// load Section table
printf_log(LOG_DEBUG, "Loading Sections Table String (idx = %d)\n", h->SHIdx);
if(LoadSH(f, h->SHEntries+h->SHIdx, (void*)&h->SHStrTab, ".shstrtab", SHT_STRTAB)) {
FreeElfHeader(&h);
return NULL;
}
if(box86_log>=LOG_DUMP) DumpMainHeader(&header, h);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".strtab", "SymTab Strings", SHT_STRTAB, (void**)&h->StrTab, NULL);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".symtab", "SymTab", SHT_SYMTAB, (void**)&h->SymTab, &h->numSymTab);
if(box86_log>=LOG_DUMP && h->SymTab) DumpSymTab(h);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynamic", "Dynamic", SHT_DYNAMIC, (void**)&h->Dynamic, &h->numDynamic);
if(box86_log>=LOG_DUMP && h->Dynamic) DumpDynamicSections(h);
// grab DT_REL & DT_RELA stuffs
// also grab the DT_STRTAB string table
{
for (int i=0; i<h->numDynamic; ++i) {
Elf32_Dyn d = h->Dynamic[i];
Elf32_Word val = d.d_un.d_val;
Elf32_Addr ptr = d.d_un.d_ptr;
switch (d.d_tag) {
case DT_REL:
h->rel = ptr;
break;
case DT_RELSZ:
h->relsz = val;
break;
case DT_RELENT:
h->relent = val;
break;
case DT_RELA:
h->rela = ptr;
break;
case DT_RELASZ:
h->relasz = val;
break;
case DT_RELAENT:
h->relaent = val;
break;
case DT_PLTGOT:
h->pltgot = val;
break;
case DT_PLTREL:
h->pltrel = val;
break;
case DT_PLTRELSZ:
h->pltsz = val;
break;
case DT_JMPREL:
h->jmprel = val;
break;
case DT_STRTAB:
h->DynStrTab = (char *)(ptr);
break;
case DT_STRSZ:
h->szDynStrTab = val;
break;
case DT_INIT: // Entry point
h->initentry = ptr;
printf_log(LOG_DEBUG, "The DT_INIT is at address %p\n", (void*)h->initentry);
break;
case DT_INIT_ARRAY:
h->initarray = ptr;
printf_log(LOG_DEBUG, "The DT_INIT_ARRAY is at address %p\n", (void*)h->initarray);
break;
case DT_INIT_ARRAYSZ:
h->initarray_sz = val / sizeof(Elf32_Addr);
printf_log(LOG_DEBUG, "The DT_INIT_ARRAYSZ is %d\n", h->initarray_sz);
break;
case DT_FINI: // Exit hook
h->finientry = ptr;
printf_log(LOG_DEBUG, "The DT_FINI is at address %p\n", (void*)h->finientry);
break;
case DT_FINI_ARRAY:
h->finiarray = ptr;
printf_log(LOG_DEBUG, "The DT_FINI_ARRAY is at address %p\n", (void*)h->finiarray);
break;
case DT_FINI_ARRAYSZ:
h->finiarray_sz = val / sizeof(Elf32_Addr);
printf_log(LOG_DEBUG, "The DT_FINI_ARRAYSZ is %d\n", h->finiarray_sz);
break;
case DT_VERNEEDNUM:
h->szVerNeed = val / sizeof(Elf32_Verneed);
printf_log(LOG_DEBUG, "The DT_VERNEEDNUM is %d\n", h->szVerNeed);
break;
case DT_VERNEED:
h->VerNeed = (Elf32_Verneed*)ptr;
printf_log(LOG_DEBUG, "The DT_VERNEED is at address %p\n", h->VerNeed);
break;
}
}
if(h->rel) {
if(h->relent != sizeof(Elf32_Rel)) {
printf_log(LOG_NONE, "Rel Table Entry size invalid (0x%x should be 0x%x)\n", h->relent, sizeof(Elf32_Rel));
FreeElfHeader(&h);
return NULL;
}
printf_log(LOG_DEBUG, "Rel Table @%p (0x%x/0x%x)\n", (void*)h->rel, h->relsz, h->relent);
}
if(h->rela) {
if(h->relaent != sizeof(Elf32_Rela)) {
printf_log(LOG_NONE, "RelA Table Entry size invalid (0x%x should be 0x%x)\n", h->relaent, sizeof(Elf32_Rela));
FreeElfHeader(&h);
return NULL;
}
printf_log(LOG_DEBUG, "RelA Table @%p (0x%x/0x%x)\n", (void*)h->rela, h->relasz, h->relaent);
}
if(h->jmprel) {
if(h->pltrel == DT_REL) {
h->pltent = sizeof(Elf32_Rel);
} else if(h->pltrel == DT_RELA) {
h->pltent = sizeof(Elf32_Rela);
} else {
printf_log(LOG_NONE, "PLT Table type is unknown (size = 0x%x, type=%d)\n", h->pltsz, h->pltrel);
FreeElfHeader(&h);
return NULL;
}
if((h->pltsz / h->pltent)*h->pltent != h->pltsz) {
printf_log(LOG_NONE, "PLT Table Entry size invalid (0x%x, ent=0x%x, type=%d)\n", h->pltsz, h->pltent, h->pltrel);
FreeElfHeader(&h);
return NULL;
}
printf_log(LOG_DEBUG, "PLT Table @%p (type=%d 0x%x/0x%0x)\n", (void*)h->jmprel, h->pltrel, h->pltsz, h->pltent);
}
if(h->DynStrTab && h->szDynStrTab) {
//DumpDynamicNeeded(h); cannot dump now, it's not loaded yet
}
}
// look for PLT Offset
int ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".got.plt");
if(ii) {
h->gotplt = h->SHEntries[ii].sh_addr;
h->gotplt_end = h->gotplt + h->SHEntries[ii].sh_size;
printf_log(LOG_DEBUG, "The GOT.PLT Table is at address %p\n", (void*)h->gotplt);
}
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".got");
if(ii) {
h->got = h->SHEntries[ii].sh_addr;
h->got_end = h->got + h->SHEntries[ii].sh_size;
printf_log(LOG_DEBUG, "The GOT Table is at address %p..%p\n", (void*)h->got, (void*)h->got_end);
}
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".plt");
if(ii) {
h->plt = h->SHEntries[ii].sh_addr;
h->plt_end = h->plt + h->SHEntries[ii].sh_size;
printf_log(LOG_DEBUG, "The PLT Table is at address %p..%p\n", (void*)h->plt, (void*)h->plt_end);
}
// grab version of symbols
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".gnu.version");
if(ii) {
h->VerSym = (Elf32_Half*)(h->SHEntries[ii].sh_addr);
printf_log(LOG_DEBUG, "The .gnu.version is at address %p\n", h->VerSym);
}
// grab .text for main code
ii = FindSection(h->SHEntries, h->numSHEntries, h->SHStrTab, ".text");
if(ii) {
h->text = (uintptr_t)(h->SHEntries[ii].sh_addr);
h->textsz = h->SHEntries[ii].sh_size;
printf_log(LOG_DEBUG, "The .text is at address %p, and is %d big\n", (void*)h->text, h->textsz);
}
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynstr", "DynSym Strings", SHT_STRTAB, (void**)&h->DynStr, NULL);
LoadNamedSection(f, h->SHEntries, h->numSHEntries, h->SHStrTab, ".dynsym", "DynSym", SHT_DYNSYM, (void**)&h->DynSym, &h->numDynSym);
if(box86_log>=LOG_DUMP && h->DynSym) DumpDynSym(h);
}
return h;
}
const char* GetSymbolVersion(elfheader_t* h, int version)
{
if(!h->VerNeed || (version<2))
return NULL;
Elf32_Verneed *ver = (Elf32_Verneed*)((uintptr_t)h->VerNeed + h->delta);
while(ver) {
Elf32_Vernaux *aux = (Elf32_Vernaux*)((uintptr_t)ver + ver->vn_aux);
for(int j=0; j<ver->vn_cnt; ++j) {
if(aux->vna_other==version)
return h->DynStr+aux->vna_name;
aux = (Elf32_Vernaux*)((uintptr_t)aux + aux->vna_next);
}
ver = ver->vn_next?((Elf32_Verneed*)((uintptr_t)ver + ver->vn_next)):NULL;
}
return NULL;
}
+151
View File
@@ -0,0 +1,151 @@
// ModRM utilities macros
#define getecommon(A, T) \
if(!(nextop&0xC0)) { \
if((nextop&7)==4) { \
uint8_t sib = F8; \
uintptr_t base = ((sib&0x7)==5)?(F32):(emu->regs[(sib&0x7)].dword[0]); \
base += (emu->sbiidx[(sib>>3)&7]->sdword[0] << (sib>>6)); \
A = (T*)base; \
} else if((nextop&7)==5) { \
A = (T*)(F32); \
} else { \
A = (T*)(emu->regs[nextop&7].dword[0]); \
} \
} else { \
uintptr_t base; \
if((nextop&7)==4) { \
uint8_t sib = F8; \
base = emu->regs[(sib&0x7)].dword[0]; \
base += (emu->sbiidx[(sib>>3)&7]->sdword[0] << (sib>>6)); \
} else { \
base = emu->regs[(nextop&0x7)].dword[0]; \
} \
base+=(nextop&0x80)?(F32S):(F8S); \
A = (T*)base; \
}
#define getecommono(A, T, O) \
if(!(nextop&0xC0)) { \
if((nextop&7)==4) { \
uint8_t sib = F8; \
uintptr_t base = ((sib&0x7)==5)?(F32):(emu->regs[(sib&0x7)].dword[0]); \
base += (emu->sbiidx[(sib>>3)&7]->sdword[0] << (sib>>6)); \
A = (T*)(base+O); \
} else if((nextop&7)==5) { \
A = (T*)(F32+O); \
} else { \
A = (T*)(emu->regs[nextop&7].dword[0]+O); \
} \
} else { \
uintptr_t base; \
if((nextop&7)==4) { \
uint8_t sib = F8; \
base = emu->regs[(sib&0x7)].dword[0]; \
base += (emu->sbiidx[(sib>>3)&7]->sdword[0] << (sib>>6)); \
} else { \
base = emu->regs[(nextop&0x7)].dword[0]; \
} \
base+=(nextop&0x80)?(F32S):(F8S); \
A = (T*)(base+O); \
}
#define getecommon16(A, T) \
{ \
uint32_t m = nextop&0xC7; \
uint32_t base = 0; \
switch(m&7) { \
case 0: base = R_BX+R_SI; break; \
case 1: base = R_BX+R_DI; break; \
case 2: base = R_BP+R_SI; break; \
case 3: base = R_BP+R_DI; break; \
case 4: base = R_SI; break; \
case 5: base = R_DI; break; \
case 6: base = R_BP; break; \
case 7: base = R_BX; break; \
} \
switch((m>>6)&3) { \
case 0: if(m==6) base = F16; break; \
case 1: base += F8S; break; \
case 2: base += F16S; break; \
} \
A = (T*)base; \
}
#define getecommon16o(A, T, O) \
{ \
uint32_t m = nextop&0xC7; \
uint32_t base = 0; \
switch(m&7) { \
case 0: base = R_BX+R_SI; break; \
case 1: base = R_BX+R_DI; break; \
case 2: base = R_BP+R_SI; break; \
case 3: base = R_BP+R_DI; break; \
case 4: base = R_SI; break; \
case 5: base = R_DI; break; \
case 6: base = R_BP; break; \
case 7: base = R_BX; break; \
} \
switch((m>>6)&3) { \
case 0: if(m==6) base = F16; break; \
case 1: base += F8S; break; \
case 2: base += F16S; break; \
} \
A = (T*)(base+O); \
}
#define geteb(A) \
if((nextop&0xC0)==0xC0) { \
A = (reg32_t*)&emu->regs[(nextop&3)].byte[((nextop&0x4)>>2)]; \
} else getecommon(A, reg32_t)
#define getebo(A, O) \
if((nextop&0xC0)==0xC0) { \
A = (reg32_t*)&emu->regs[(nextop&3)].byte[((nextop&0x4)>>2)]; \
} else getecommono(A, reg32_t, O)
#define geted(A) \
if((nextop&0xC0)==0xC0) { \
A = &emu->regs[(nextop&7)]; \
} else getecommon(A, reg32_t)
#define getedo(A, O) \
if((nextop&0xC0)==0xC0) { \
A = &emu->regs[(nextop&7)]; \
} else getecommono(A, reg32_t, O)
#define getem(A) \
if((nextop&0xC0)==0xC0) { \
A = &emu->mmx87[(nextop&7)]; \
} else getecommon(A, mmx87_regs_t)
#define getex(A) \
if((nextop&0xC0)==0xC0) { \
A = &emu->xmm[(nextop&7)]; \
} else getecommon(A, sse_regs_t)
#define getew16(A) \
if((nextop&0xC0)==0xC0) { \
A = &emu->regs[(nextop&7)]; \
} else getecommon16(A, reg32_t)
#define getew16o(A, O) \
if((nextop&0xC0)==0xC0) { \
A = &emu->regs[(nextop&7)]; \
} else getecommon16o(A, reg32_t, O)
// Macros for ModR/M gets
#define GET_EB geteb(oped)
#define GET_ED geted(oped)
#define GET_ED_OFFS(o) getedo(oped, o)
#define GET_EB_OFFS(o) getebo(oped, o)
#define GET_EM getem(opem)
#define GET_EX getex(opex)
#define GET_EW16 getew16(oped)
#define GET_EW16_OFFS(o) getew16o(oped, o)
#define EB oped
#define ED oped
#define EM opem
#define EX opex
#define GB emu->regs[(nextop>>3)&3].byte[(nextop>>5)&0x1]
#define GD emu->regs[((nextop&0x38)>>3)]
#define GM emu->mmx87[((nextop&0x38)>>3)]
#define GX emu->xmm[((nextop&0x38)>>3)]
// Alias
#define GET_EW GET_ED
#define GET_EW_OFFS GET_ED_OFFS
#define EW ED
#define GW GD
+1404
View File
File diff suppressed because it is too large. Load diff
+191 -14
View File
@@ -2,16 +2,29 @@
goto *opcodes66[opcode];
#define GO(B, OP) \
_66_##B##_0: \
nextop = F8; \
GET_EB; \
EB->byte[0] = OP##8(emu, EB->byte[0], GB); \
NEXT; \
_66_##B##_1: \
nextop = F8; \
GET_EW; \
EW->word[0] = OP##16(emu, EW->word[0], GW.word[0]); \
NEXT; \
_66_##B##_2: \
nextop = F8; \
GET_EB; \
GB = OP##8(emu, GB, EB->byte[0]); \
NEXT; \
_66_##B##_3: \
nextop = F8; \
GET_EW; \
GW.word[0] = OP##16(emu, GW.word[0], EW->word[0]); \
NEXT; \
_66_##B##_4: \
R_AL = OP##8(emu, R_AL, F8); \
NEXT; \
_66_##B##_5: \
R_AX = OP##16(emu, R_AX, F16); \
NEXT;
@@ -25,11 +38,41 @@
GO(0x30, xor) /* XOR 0x31 ~> 0x35 */
//GO(0x38, cmp) /* CMP 0x39 ~> 0x3D */
#undef GO
_66_0x06: /* PUSH ES */
Push16(emu, emu->segs[_ES]);
NEXT;
_66_0x07: /* POP ES */
emu->segs[_ES] = Pop16(emu); // no check, no use....
emu->segs_serial[_ES] = 0;
NEXT;
_66_0x0F: /* 66 0f prefix */
#include "run660f.h"
emu->old_ip = R_EIP;
R_EIP = ip-2; // don't count 66 0F yet
Run660F(emu); // implemented in Run660f.c
ip = R_EIP;
if(emu->quit) goto fini;
STEP
NEXT;
_66_0x1F: /* POP DS */
emu->segs[_DS] = Pop16(emu); // no check, no use....
emu->segs_serial[_DS] = 0;
NEXT;
_66_0x26: /* ES: */
// ignored
opcode = F8;
goto *opcodes66[opcode];
_66_0x2E: /* CS: */
// ignored
NEXT;
opcode = F8;
goto *opcodes66[opcode];
_66_0x36: /* SS: */
// ignored
opcode = F8;
goto *opcodes66[opcode];
_66_0x39:
nextop = F8;
GET_EW;
@@ -66,17 +109,74 @@
tmp8u = opcode&7;
emu->regs[tmp8u].word[0] = dec16(emu, emu->regs[tmp8u].word[0]);
NEXT;
_66_0x50:
_66_0x51:
_66_0x52:
_66_0x53:
_66_0x54:
_66_0x55:
_66_0x56:
_66_0x57: /* PUSH Reg */
tmp8u = opcode&7;
Push16(emu, emu->regs[tmp8u].word[0]);
NEXT;
_66_0x58:
_66_0x59:
_66_0x5A:
_66_0x5B:
_66_0x5C:
_66_0x5D:
_66_0x5E:
_66_0x5F: /* POP Reg */
tmp8u = opcode&7;
emu->regs[tmp8u].word[0] = Pop16(emu);
NEXT;
_66_0x60: /* PUSHA */
tmp16u = R_SP;
Push16(emu, R_AX);
Push16(emu, R_CX);
Push16(emu, R_DX);
Push16(emu, R_BX);
Push16(emu, tmp16u);
Push16(emu, R_BP);
Push16(emu, R_SI);
Push16(emu, R_DI);
NEXT;
_66_0x61: /* POPA */
R_DI = Pop16(emu);
R_SI = Pop16(emu);
R_BP = Pop16(emu);
R_ESP+=2; // POP ESP
R_BX = Pop16(emu);
R_DX = Pop16(emu);
R_CX = Pop16(emu);
R_AX = Pop16(emu);
NEXT;
_66_0x64:
R_EIP = ip-2;
RunFS66(emu, GetFSBaseEmu(emu));
ip = R_EIP;
STEP;
NEXT;
_66_0x66:
goto _0x66; // 0x66 0x66 => can remove one 0x66
_66_0x68: /* PUSH u16 */
tmp16u = F16;
Push16(emu, tmp16u);
NEXT;
_66_0x69: /* IMUL Gw,Ew,Iw */
nextop = F8;
GET_EW;
tmp16u = F16;
GW.word[0] = imul16(emu, EW->word[0], tmp16u);
NEXT;
_66_0x6A: /* PUSH Ib (as signed word) */
tmp16s = F8S;
Push16(emu, (uint16_t)tmp16s);
NEXT;
_66_0x6B: /* IMUL Gw,Ew,Ib */
nextop = F8;
GET_EW;
@@ -131,26 +231,53 @@
GET_EW;
GW.word[0] = EW->word[0];
NEXT;
_66_0x8C: /* MOV Ew,Seg */
nextop = F8;
GET_EW;
EW->word[0] = emu->segs[(nextop&0x38)>>3];
NEXT;
_66_0x8E: /* MOV Seg,Ew */
nextop = F8;
GET_EW;
emu->segs[((nextop&0x38)>>3)] = EW->word[0];
emu->segs_serial[((nextop&0x38)>>3)] = 0;
NEXT;
_66_0x8F: /* POP Ew */
nextop = F8;
GET_EW;
EW->dword[0] = Pop16(emu);
EW->word[0] = Pop16(emu);
NEXT;
_66_0x90: /* NOP */
NEXT;
_66_0x92: /* XCHG DX,AX */
_66_0x91:
_66_0x92:
_66_0x93:
_66_0x94:
_66_0x95:
_66_0x96:
_66_0x97: /* XCHG reg,EAX */
tmp16u = R_AX;
R_AX = R_DX;
R_DX = tmp16u;
R_AX = emu->regs[opcode&7].word[0];
emu->regs[opcode&7].word[0] = tmp16u;
NEXT;
_66_0x98: /* CBW */
emu->regs[_AX].sword[0] = emu->regs[_AX].sbyte[0];
NEXT;
_66_0x99: /* CWD */
R_DX=(R_AX & 0x8000)?0xFFFF:0x0000;
R_DX=((R_AX & 0x8000)?0xFFFF:0x0000);
NEXT;
_66_0x9C: /* PUSHFW */
CHECK_FLAGS(emu);
Push16(emu, (uint16_t)emu->eflags.x32);
NEXT;
_66_0x9D: /* POPFW */
CHECK_FLAGS(emu);
emu->eflags.x32 &=0xffff0000;
emu->eflags.x32 |= (Pop16(emu) & 0x3F7FD7) | 0x2;
NEXT;
_66_0xA1: /* MOV AX,Ow */
@@ -174,6 +301,11 @@
R_ESI += tmp8s;
cmp16(emu, tmp16u2, tmp16u);
NEXT;
_66_0xA9: /* TEST AX,Iw */
test16(emu, R_AX, F16);
NEXT;
_66_0xAB: /* STOSW */
tmp8s = ACCESS_FLAG(F_DF)?-2:+2;
*(uint16_t*)R_EDI = R_AX;
@@ -223,6 +355,22 @@
EW->word[0] = F16;
NEXT;
_66_0xCB: /* FAR RET */
ip = Pop(emu);
emu->segs[_CS] = Pop(emu); // no check, no use....
emu->segs_serial[_CS] = 0;
// need to check status of CS register!
STEP
NEXT;
_66_0xCC: /* INT3 */
emu->old_ip = R_EIP;
R_EIP = ip-1;
if(my_context->signals[SIGTRAP])
raise(SIGTRAP);
ip = R_EIP;
if(emu->quit) goto fini;
STEP
NEXT;
_66_0xD1: /* GRP2 Ew,1 */
_66_0xD3: /* GRP2 Ew,CL */
nextop = F8;
@@ -241,21 +389,31 @@
NEXT;
_66_0xD9:
emu->old_ip = old_ip;
emu->old_ip = R_EIP;
R_EIP = ip;
Run66D9(emu);
ip = R_EIP;
if(emu->quit) goto fini;
STEP
NEXT;
_66_0xDD:
emu->old_ip = old_ip;
emu->old_ip = R_EIP;
R_EIP = ip;
Run66DD(emu);
ip = R_EIP;
if(emu->quit) goto fini;
STEP
NEXT;
_66_0xF0: /* LOCK prefix */
emu->old_ip = R_EIP;
R_EIP = ip - 2;
RunLock66(emu);
ip = R_EIP;
if(emu->quit) goto fini;
STEP
NEXT;
_66_0xF2: /* REPNZ prefix */
_66_0xF3: /* REPZ prefix */
@@ -263,6 +421,14 @@
tmp8s = ACCESS_FLAG(F_DF)?-2:+2;
tmp32u = R_ECX;
switch(nextop) {
case 0xA4: /* REP MOVSB */
while(tmp32u) {
--tmp32u;
*(uint8_t*)R_EDI = *(uint8_t*)R_ESI;
R_EDI += tmp8s;
R_ESI += tmp8s;
}
break;
case 0xA5: /* REP MOVSW */
while(tmp32u) {
--tmp32u;
@@ -272,6 +438,8 @@
}
break;
case 0xA7: /* REP(N)Z CMPSW */
tmp16u = 0;
tmp16u2 = 0;
while(tmp32u) {
--tmp32u;
tmp16u = *(uint16_t*)R_EDI;
@@ -298,6 +466,7 @@
}
break;
case 0xAF: /* REP(N)Z SCASW */
tmp16u = 0;
while(tmp32u) {
--tmp32u;
tmp16u = *(uint16_t*)R_EDI;
@@ -341,6 +510,14 @@
break;
}
NEXT;
_66_0xF8: /* CLC */
CHECK_FLAGS(emu);
CLEAR_FLAG(F_CF);
NEXT;
_66_0xF9: /* STC */
CHECK_FLAGS(emu);
SET_FLAG(F_CF);
NEXT;
_66_0xFF: /* GRP 5 Ew */
nextop = F8;
@@ -352,8 +529,11 @@
case 1: /* DEC Ed */
EW->word[0] = dec16(emu, EW->word[0]);
break;
case 6:
Push16(emu, EW->word[0]);
break;
default:
emu->old_ip = old_ip;
emu->old_ip = R_EIP;
R_EIP = ip;
printf_log(LOG_NONE, "Illegal Opcode 66 %02X %02X\n", opcode, nextop);
emu->quit=1;
@@ -361,6 +541,3 @@
goto fini;
}
NEXT;
+11 -8
View File
@@ -1,3 +1,5 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
nextop = F8;
switch(nextop) {
case 0xC0:
@@ -88,7 +90,7 @@
if(!(((uintptr_t)ED)&3))
ST0.d += *(float*)ED;
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
ST0.d += f;
}
break;
@@ -97,7 +99,7 @@
if(!(((uintptr_t)ED)&3))
ST0.d *= *(float*)ED;
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
ST0.d *= f;
}
break;
@@ -106,7 +108,7 @@
if(!(((uintptr_t)ED)&3))
fpu_fcom(emu, *(float*)ED);
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
fpu_fcom(emu, f);
}
break;
@@ -115,7 +117,7 @@
if(!(((uintptr_t)ED)&3))
fpu_fcom(emu, *(float*)ED);
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
fpu_fcom(emu, f);
}
fpu_do_pop(emu);
@@ -125,7 +127,7 @@
if(!(((uintptr_t)ED)&3))
ST0.d -= *(float*)ED;
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
ST0.d -= f;
}
break;
@@ -134,7 +136,7 @@
if(!(((uintptr_t)ED)&3))
ST0.d = *(float*)ED - ST0.d;
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
ST0.d = f - ST0.d;
}
break;
@@ -143,7 +145,7 @@
if(!(((uintptr_t)ED)&3))
ST0.d /= *(float*)ED;
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
ST0.d /= f;
}
break;
@@ -152,7 +154,7 @@
if(!(((uintptr_t)ED)&3))
ST0.d = *(float*)ED / ST0.d;
else {
*(uint32_t*)&f = ED->dword[0];
memcpy(&f, ED, sizeof(float));
ST0.d = f / ST0.d;
}
break;
@@ -160,3 +162,4 @@
goto _default;
}
}
#pragma GCC diagnostic pop
+97 -31
View File
@@ -8,9 +8,9 @@
case 0xC5:
case 0xC6:
case 0xC7: /* FLD STx */
ll = ST(nextop&7).ll;
ll = ST(nextop&7).q;
fpu_do_push(emu);
ST0.ll = ll;
ST0.q = ll;
break;
case 0xC8:
case 0xC9:
@@ -20,9 +20,9 @@
case 0xCD:
case 0xCE:
case 0xCF: /* FXCH STx */
ll = ST(nextop&7).ll;
ST(nextop&7).ll = ST0.ll;
ST0.ll = ll;
ll = ST(nextop&7).q;
ST(nextop&7).q = ST0.q;
ST0.q = ll;
break;
case 0xD0: /* FNOP */
@@ -35,6 +35,9 @@
ST0.d = fabs(ST0.d);
break;
case 0xE4: /* FTST */
fpu_ftst(emu);
break;
case 0xE5: /* FXAM */
fpu_fxam(emu);
break;
@@ -67,26 +70,83 @@
fpu_do_push(emu);
ST0.d = 0.0;
break;
case 0xF2: /* FTAN */
case 0xF0: /* F2XM1 */
ST0.d = exp2(ST0.d) - 1.0;
break;
case 0xF1: /* FYL2X */
ST(1).d *= log2(ST0.d);
fpu_do_pop(emu);
break;
case 0xF2: /* FPTAN */
ST0.d = tan(ST0.d);
fpu_do_push(emu);
ST0.d = 1.0;
emu->sw.f.F87_C2 = 0;
break;
case 0xF3: /* FPATAN */
ST1.d = atan2(ST1.d, ST0.d);
fpu_do_pop(emu);
break;
case 0xF8: /* FPREM */
tmp32s = ST0.d / ST1.d;
ST0.d -= ST1.d * tmp32s;
emu->sw.f.F87_C2 = 0;
emu->sw.f.F87_C0 = (tmp32s&1);
emu->sw.f.F87_C3 = ((tmp32s>>1)&1);
emu->sw.f.F87_C1 = ((tmp32s>>2)&1);
case 0xF4: /* FXTRACT */
ST0.d = frexp(ST0.d, &tmp32s);
fpu_do_push(emu);
ST0.d = tmp32s;
break;
case 0xF8: /* FPREM */
{
int e0, e1;
frexp(ST0.d, &e0);
frexp(ST1.d, &e1);
tmp32s = e0 - e1;
}
if(tmp32s<64)
{
ll = (int64_t)floor(ST0.d/ST1.d);
ST0.d = ST0.d - (ST1.d*ll);
emu->sw.f.F87_C2 = 0;
emu->sw.f.F87_C1 = (ll&1)?1:0;
emu->sw.f.F87_C3 = (ll&2)?1:0;
emu->sw.f.F87_C0 = (ll&4)?1:0;
} else {
ll = (int64_t)(floor((ST0.d/ST1.d))/exp2(tmp32s - 32));
ST0.d = ST0.d - ST1.d*ll*exp2(tmp32s - 32);
emu->sw.f.F87_C2 = 1;
}
break;
case 0xF5: /* FPREM1 */
// get exponant(ST(0))-exponant(ST(1)) in temp32s
{
int e0, e1;
frexp(ST0.d, &e0);
frexp(ST1.d, &e1);
tmp32s = e0 - e1;
}
if(tmp32s<64)
{
ll = (int64_t)round(ST0.d/ST1.d);
ST0.d = ST0.d - (ST1.d*ll);
emu->sw.f.F87_C2 = 0;
emu->sw.f.F87_C1 = (ll&1)?1:0;
emu->sw.f.F87_C3 = (ll&2)?1:0;
emu->sw.f.F87_C0 = (ll&4)?1:0;
} else {
ll = (int64_t)(trunc((ST0.d/ST1.d))/exp2(tmp32s - 32));
ST0.d = ST0.d - ST1.d*ll*exp2(tmp32s - 32);
emu->sw.f.F87_C2 = 1;
}
break;
case 0xF6: /* FDECSTP */
emu->top=(emu->top-1)&7; // this will probably break a few things
break;
case 0xF7: /* FINCSTP */
emu->top=(emu->top+1)&7; // this will probably break a few things
break;
case 0xF9: /* FYL2XP1 */
ST(1).d *= log2(ST0.d + 1.0);
fpu_do_pop(emu);
break;
case 0xFA: /* FSQRT */
ST0.d = sqrt(ST0.d);
break;
@@ -97,7 +157,10 @@
case 0xFC: /* FRNDINT */
ST0.d = fpu_round(emu, ST0.d);
break;
case 0xFD: /* FSCALE */
// this could probably be done by just altering the exponant part of the float...
ST0.d *= exp2(trunc(ST1.d));
break;
case 0xFE: /* FSIN */
ST0.d = sin(ST0.d);
break;
@@ -121,33 +184,39 @@
case 0xDF:
case 0xE2:
case 0xE3:
case 0xE4:
case 0xE6:
case 0xE7:
case 0xEF:
case 0xF0:
case 0xF1:
case 0xF4:
case 0xF5:
case 0xF6:
case 0xF7:
case 0xF9:
case 0xFD:
goto _default;
default:
switch((nextop>>3)&7) {
case 0: /* FLD ST0, Ed float */
GET_ED;
fpu_do_push(emu);
ST0.d = *(float*)ED;
if(!(((uintptr_t)ED)&3))
ST0.d = *(float*)ED;
else {
memcpy(&f, ED, sizeof(float));
ST0.d = f;
}
break;
case 2: /* FST Ed, ST0 */
GET_ED;
*(float*)ED = ST0.d;
if(!(((uintptr_t)ED)&3))
*(float*)ED = ST0.d;
else {
f = ST0.d;
memcpy(ED, &f, sizeof(float));
}
break;
case 3: /* FSTP Ed, ST0 */
GET_ED;
*(float*)ED = ST0.d;
if(!(((uintptr_t)ED)&3))
*(float*)ED = ST0.d;
else {
f = ST0.d;
memcpy(ED, &f, sizeof(float));
}
fpu_do_pop(emu);
break;
case 4: /* FLDENV m */
@@ -165,9 +234,6 @@
// warning, incomplete
GET_ED;
fpu_savenv(emu, (char*)ED, 0);
ED->dword[0] = emu->cw;
ED->dword[1] = emu->sw.x16;
// tagword: 2bits*8
// intruction pointer: 48bits
// data (operand) pointer: 48bits
// last opcode: 11bits save: 16bits restaured (1st and 2nd opcode only)
+19 -8
View File
@@ -11,7 +11,7 @@
case 0xC7:
CHECK_FLAGS(emu);
if(ACCESS_FLAG(F_CF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xC8: /* FCMOVE ST(0), ST(i) */
case 0xC9:
@@ -23,7 +23,7 @@
case 0xCF:
CHECK_FLAGS(emu);
if(ACCESS_FLAG(F_ZF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xD0: /* FCMOVBE ST(0), ST(i) */
case 0xD1:
@@ -35,7 +35,7 @@
case 0xD7:
CHECK_FLAGS(emu);
if(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xD8: /* FCMOVU ST(0), ST(i) */
case 0xD9:
@@ -47,7 +47,7 @@
case 0xDF:
CHECK_FLAGS(emu);
if(ACCESS_FLAG(F_PF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xE9: /* FUCOMPP */
@@ -78,19 +78,30 @@
GET_ED;
ST0.d *= ED->sdword[0];
break;
case 2: /* FICOM ST0, Ed int */
GET_ED;
fpu_fcom(emu, ED->sdword[0]);
break;
case 3: /* FICOMP ST0, Ed int */
GET_ED;
fpu_fcom(emu, ED->sdword[0]);
fpu_do_pop(emu);
break;
case 4: /* FISUB ST0, Ed int */
GET_ED;
ST0.d -= ED->sdword[0];
break;
case 5: /* FISUBR ST0, Ed int */
GET_ED;
ST0.d = ED->sdword[0] - ST0.d;
ST0.d = (double)ED->sdword[0] - ST0.d;
break;
case 6: /* FIDIV ST0, Ed int */
GET_ED;
ST0.d /= ED->sdword[0];
break;
case 7: /* FIDIVR ST0, Ed int */
GET_ED;
ST0.d = ED->sdword[0] / ST0.d;
ST0.d = (double)ED->sdword[0] / ST0.d;
break;
default:
goto _default;
}
}
+31 -18
View File
@@ -10,7 +10,7 @@
case 0xC7:
CHECK_FLAGS(emu);
if(!ACCESS_FLAG(F_CF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xC8: /* FCMOVNE ST(0), ST(i) */
case 0xC9:
@@ -22,7 +22,7 @@
case 0xCF:
CHECK_FLAGS(emu);
if(!ACCESS_FLAG(F_ZF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xD0: /* FCMOVNBE ST(0), ST(i) */
case 0xD1:
@@ -34,7 +34,7 @@
case 0xD7:
CHECK_FLAGS(emu);
if(!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xD8: /* FCMOVNU ST(0), ST(i) */
case 0xD9:
@@ -46,9 +46,11 @@
case 0xDF:
CHECK_FLAGS(emu);
if(!ACCESS_FLAG(F_PF))
ST0.ll = ST(nextop&7).ll;
ST0.q = ST(nextop&7).q;
break;
case 0xE1: /* FDISI8087_NOP */
break;
case 0xE2: /* FNCLEX */
//Clears the floating-point exception flags (PE, UE, OE, ZE, DE, and IE),
// the exception summary status flag (ES), the stack fault flag (SF), and the busy flag (B) in the FPU status word
@@ -87,7 +89,6 @@
fpu_fcomi(emu, ST(nextop&7).d);
break;
case 0xE0:
case 0xE1:
case 0xE4:
case 0xE5:
case 0xE6:
@@ -95,36 +96,48 @@
goto _default;
default:
switch((nextop>>3)&7) {
case 0: /* FILD ST0, Gd */
case 0: /* FILD ST0, Ed */
GET_ED;
fpu_do_push(emu);
ST0.d = ED->sdword[0];
break;
case 2: /* FIST Ed, ST0 */
case 1: /* FISTTP Ed, ST0 */
GET_ED;
tmp32s = ST0.d; // TODO: Handling of FPU Exception and rounding
if(tmp32s==0x7fffffff && isgreater(ST0.d, (double)(int32_t)0x7fffffff))
tmp32s = 0x80000000;
ED->sdword[0] = tmp32s;
break;
case 3: /* FISTP Ed, ST0 */
GET_ED;
tmp32s = ST0.d; // TODO: Handling of FPU Exception and rounding
tmp32s = ST0.d; // TODO: Handling of FPU Exception
if(tmp32s==0x7fffffff && isgreater(ST0.d, (double)(int32_t)0x7fffffff))
tmp32s = 0x80000000;
fpu_do_pop(emu);
ED->sdword[0] = tmp32s;
break;
case 5: /* FLD ST0, Gt */
case 2: /* FIST Ed, ST0 */
GET_ED;
if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x7fffffff) || !isfinite(ST0.d))
ED->sdword[0] = 0x80000000;
else {
volatile int32_t tmp = fpu_round(emu, ST0.d); // tmp to avoid BUS ERROR
ED->sdword[0] = tmp;
}
break;
case 3: /* FISTP Ed, ST0 */
GET_ED;
if(isgreater(ST0.d, (double)(int32_t)0x7fffffff) || isless(ST0.d, -(double)(int32_t)0x7fffffff) || !isfinite(ST0.d))
ED->sdword[0] = 0x80000000;
else {
volatile int32_t tmp = fpu_round(emu, ST0.d); // tmp to avoid BUS ERROR
ED->sdword[0] = tmp;
}
fpu_do_pop(emu);
break;
case 5: /* FLD ST0, Et */
GET_ED;
fpu_do_push(emu);
memcpy(&STld(0).ld, ED, 10);
LD2D(&STld(0), &ST(0).d);
STld(0).ref = ST0.ll;
STld(0).ref = ST0.q;
break;
case 7: /* FSTP tbyte */
GET_ED;
if(ST0.ll!=STld(0).ref)
if(ST0.q!=STld(0).ref)
D2LD(&ST0.d, ED);
else
memcpy(ED, &STld(0).ld, 10);
Loaded 100 of 624 files, more files were not shown because too many files have changed in this diff. Show more