Commit Graph

377 Commits

Author SHA1 Message Date
Ben Vanik 8207bb8088 negx 2013-05-25 01:35:19 -07:00
Ben Vanik 07d0dd98b6 slwx, ignoring twi. 2013-05-25 01:31:38 -07:00
Ben Vanik ed401449b7 Only create the shared return block if required. 2013-05-25 00:45:16 -07:00
Ben Vanik da62ec56f9 Adding the ret required for tail calls. 2013-05-25 00:41:01 -07:00
Ben Vanik fb22aeb5ac Fixing assertion warnings from asmjit. 2013-05-25 00:40:30 -07:00
Ben Vanik f3552ff9a5 Implementing RtlImageXexHeaderField better. 2013-05-25 00:08:01 -07:00
Ben Vanik eac03765db Adding addx. Whoops. 2013-05-25 00:07:35 -07:00
Ben Vanik 12b2dc153e Disabling the faked KeDebugMonitorData. 2013-05-24 23:43:11 -07:00
Ben Vanik 04485b6460 rlwimix/rlwinmx. 2013-05-24 23:34:52 -07:00
Ben Vanik ef3bd6cc53 Fixing disasm of subfic, fixing neg->not, fixing tests to use 8bits. 2013-05-24 23:03:35 -07:00
Ben Vanik 6320ef6b7e Fixing conditionals to use cmp instead of test. 2013-05-24 22:21:05 -07:00
Ben Vanik 7bf69f66fd Logging out the condition register values. 2013-05-24 22:03:57 -07:00
Ben Vanik 2586c10cc5 addzex. 2013-05-24 21:54:04 -07:00
Ben Vanik 9883f32fb7 Fixing logger initialization when codegen logging is disabled. 2013-05-24 21:49:03 -07:00
Rick Gibbed ba718de434 Further corrections on cr checks. 2013-05-24 21:34:03 -07:00
Ben Vanik 1354b9975f Adding basic branch indirection, which doesn't work but is ready to do so. 2013-05-24 21:18:30 -07:00
Ben Vanik c6ed7ff9cf Fixing cr5+ checks. 2013-05-24 20:48:04 -07:00
Ben Vanik 346a27ddf8 Trying again to fix compares. 2013-05-24 20:40:00 -07:00
Ben Vanik e7556a09f8 Fixing bad or during cr0 update - need to be overwriting. 2013-05-24 20:26:06 -07:00
Ben Vanik 68f1eb7f69 Fixing carry and compare flags. 2013-05-24 20:20:18 -07:00
Ben Vanik 97b0e2aa3d Fixing comparison between two gpvars. 2013-05-24 20:09:11 -07:00
Ben Vanik 5e66f7b04b Adding a bunch of nops around trace calls.
5 before, 2 after (so it's easy to see what goes with what).
2013-05-24 19:59:51 -07:00
Ben Vanik 1ad0bb7843 cmp/cmpi/cmpl/cmpli.
May not be right.
2013-05-24 19:52:00 -07:00
Ben Vanik 6cd8495ea2 extsbx. 2013-05-24 19:45:48 -07:00
Ben Vanik 8976f1b046 subfx + subficx. 2013-05-24 19:16:01 -07:00
Ben Vanik 69ebedb43f addic + subfex. 2013-05-24 19:10:54 -07:00
Ben Vanik dc40f28795 addx and switching commenting style on the rest of the unported instrs. 2013-05-24 18:49:14 -07:00
Ben Vanik 1e67547a6b Fixing conditional branch logic. 2013-05-24 18:44:32 -07:00
Ben Vanik 2ab01af0bd Breaking on indirect branches. 2013-05-24 18:34:08 -07:00
Ben Vanik 692f85ed4f Very, very basic branching. Most compares not yet implemented. 2013-05-24 18:28:52 -07:00
Ben Vanik 7e3268621d Optimizing the mr case. 2013-05-24 17:59:01 -07:00
Ben Vanik 748bfe509f Handling null ptr in NtFreeVirtualMemory. 2013-05-24 17:33:57 -07:00
Ben Vanik 21b0d25131 Fixing memory address truncation. 2013-05-24 17:08:12 -07:00
Ben Vanik fcf478ba55 Log all incoming registers on each instruction execute. 2013-05-24 16:53:27 -07:00
Ben Vanik 15cfbd3736 The various _ptr helpers in asmjit are useless. 2013-05-24 16:34:24 -07:00
Ben Vanik e6320dada5 Most of the memory instructions.
Not sure this is correct, as it crashes pretty early on.
2013-05-24 16:16:39 -07:00
Ben Vanik e724fe3e60 Adding some ALU instructions. 2013-05-24 14:21:39 -07:00
Ben Vanik 8965caa833 Adding an option to disable register caching.
Until things work I'm not going to bother with that optimization.
2013-05-24 11:18:50 -07:00
Ben Vanik b8323c3055 Preparing some control instructions for proper emitting. 2013-05-24 03:51:58 -07:00
Ben Vanik bf8f068fa5 Disabling tail calls. 2013-05-24 03:29:21 -07:00
Ben Vanik 2242778fff Fixing trace calls. Disabling logging of redirector. 2013-05-24 02:42:41 -07:00
Ben Vanik eb9b9b0321 Adding bl (unconditional only). 2013-05-24 02:21:12 -07:00
Ben Vanik 2153256109 Fixing line endings. 2013-05-24 01:41:02 -07:00
Ben Vanik 605d66ecf6 Adding the first instructions, mfspr/mtspr. 2013-05-24 01:37:02 -07:00
Ben Vanik 71bd3c799f Local variables setup and spilling/filling. 2013-05-24 00:50:56 -07:00
Ben Vanik 376226c59a Adding basic block labels.
Probably correct.
2013-05-24 00:06:46 -07:00
Ben Vanik a81babac1e Adding comments to the disasm and implementing kernel calls. 2013-05-23 23:39:48 -07:00
Ben Vanik 74ae66aa0a Cleanup and tracing. 2013-05-23 23:22:27 -07:00
Ben Vanik d7d0b94aab x64 emitter now generating redirection blocks and patching them up. 2013-05-23 22:09:04 -07:00
Ben Vanik 12444f6305 Compiles, runs, and hangs in normal wait. 2013-05-23 18:46:09 -07:00
Ben Vanik 1b833b6789 Removing libjit backend. 2013-05-23 18:05:03 -07:00
Ben Vanik bedf86d259 Adding 'x64' backend.
Does not compile.
2013-05-23 18:04:12 -07:00
Ben Vanik 86002b2f44 Removing old llvm cruft. 2013-05-23 17:51:03 -07:00
Ben Vanik 63cee87420 Removing library loader, as it's not used. 2013-05-23 17:50:05 -07:00
Ben Vanik 57b486c4ad Removing libjit, because it is pretty terrible. 2013-05-23 17:48:01 -07:00
Ben Vanik eee856be04 Tweaking things again. Now not getting very far. Sigh. 2013-05-23 15:52:57 -07:00
Ben Vanik f08e80efbc Fixing calling into code. Interpreter can now be used. 2013-05-23 15:44:45 -07:00
Ben Vanik 9487fa027c libjit doesn't encode mov with imm64 offsets, fixing. 2013-05-23 13:55:09 -07:00
Ben Vanik 70a9a1053e The previous truncation was useless. 2013-05-23 13:16:39 -07:00
Ben Vanik 89672e111d Optimizing memory accesses a bit by letting libjit use relative addressing. 2013-05-23 11:46:26 -07:00
Ben Vanik fc8eb3d40a Adding disassembly to traces and bumping libjit. 2013-05-23 11:39:29 -07:00
Ben Vanik 730dba4aea Adding addzex. 2013-05-23 02:13:04 -07:00
Ben Vanik d6f2a0b3f0 Adding --trace_branches.
Simple output right now, can always be enhanced.
2013-05-23 01:31:41 -07:00
Ben Vanik 4495637616 Making sure shim calls are cdecl. 2013-05-23 01:04:14 -07:00
Ben Vanik 6bde04de26 Flushing logging. 2013-05-23 00:26:55 -07:00
Ben Vanik 1a01d365b5 Making code dumps conditional on --log_codegen 2013-05-22 22:01:34 -07:00
Ben Vanik fcb66660c0 (partial) addx and logging compiled addresses. 2013-05-22 21:53:21 -07:00
Ben Vanik 5cb8cf2630 Hacky ALU ops. Need overflow checks. 2013-05-22 21:14:16 -07:00
Ben Vanik 9ed911cdad Fixing comparisons and disabling OutputDebugString logging. 2013-05-22 21:11:27 -07:00
Ben Vanik 2d01dced5a Adding back invalid instruction logs. 2013-05-22 20:58:48 -07:00
Ben Vanik f2c16c24f3 Basic control instructions (no indirection branches yet). 2013-05-22 20:15:04 -07:00
Ben Vanik 1bcb3e8f92 Many more ALU instructions. 2013-05-22 18:51:06 -07:00
Ben Vanik 64b619023d Adding back in quite a few instructions. 2013-05-22 18:03:43 -07:00
Ben Vanik c0dd60bde8 Adding memory access/etc.
Needs byte swapping.
2013-05-22 15:02:26 -07:00
Ben Vanik 7227ba2693 Setting up register fill/spill. 2013-05-22 13:37:44 -07:00
Ben Vanik 16d2b73a73 Main codegen loop now running through instructions. 2013-05-22 13:10:07 -07:00
Ben Vanik dad99769cb Prepping for basic block generation. 2013-05-22 11:53:52 -07:00
Ben Vanik 33e2bc01ee Kernel call thunks and cleanup on exports. 2013-05-22 11:30:53 -07:00
Ben Vanik 37f93d2974 Calling to/from native works! 2013-05-22 11:13:27 -07:00
Ben Vanik a064e68621 Fixing more warnings. 2013-05-21 16:19:11 -07:00
Ben Vanik 720651ba9e Removing wslay socket support in prep for switch to mongoose.
Work on #21.
2013-05-21 16:16:33 -07:00
Ben Vanik 1ec06bd7d0 Tweaking compile options and switching back to VS2010. 2013-05-21 16:08:56 -07:00
Ben Vanik 85804f7415 Initial libjit skeleton.
Not currently generating instructions, but most of the flow is right up to
that point. A lot of work required to refactor the emitter, but wanted to
get this checked in.
2013-05-21 15:36:58 -07:00
Ben Vanik 94e3e592dd Making disassembly much faster by moving string processing to only the
dump path.
2013-05-19 19:32:55 -07:00
Ben Vanik 7d93795c10 Fixing Windows compilation errors. 2013-05-19 09:29:31 -07:00
Ben Vanik 1ce68ca7fe Removing LLVM submodule and build information.
Code is still present until transitioned over to libjit.
2013-05-19 09:29:22 -07:00
Ben Vanik 0aa7d1ec05 Adding libjit.
Removing some old xethunk cruft.
2013-05-19 09:23:50 -07:00
Ben Vanik b018b6fe56 Broken, incomplete, but need to move forward with rewrite. 2013-04-21 12:34:20 -07:00
Ben Vanik 4987147055 Moving disasm functions to ppc/. 2013-03-30 02:01:33 -07:00
Ben Vanik 85bdbd24d1 In-progress work: refactoring PAL not to be instanced.
This removes a lot of useless passing around of the PAL object.
2013-03-29 05:07:32 -07:00
Ben Vanik c46093266e Tracking code low/high addresses per module. 2013-02-24 11:45:16 -08:00
Ben Vanik 690e59ca3e Fixing OSX build. 2013-02-10 12:38:50 -08:00
Ben Vanik bfda368ab5 Compiling on linux. 2013-02-10 12:21:56 -08:00
Ben Vanik 3cae7ed714 Converting logging to ASCII and other Windows fixes. 2013-02-09 08:05:39 -08:00
Ben Vanik 338b890ef5 Fixing VC++ warnings and errors. 2013-02-08 22:07:38 -08:00
Ben Vanik c1e2119db4 Moving socket stuff to core/.
Stubbed win32 methods.
2013-02-06 22:55:18 -08:00
Ben Vanik 2c42ea909b Removing the dependency on OpenSSL, as it sucks. 2013-02-06 21:47:05 -08:00
Ben Vanik 7435a327f7 Windows compat fixes. 2013-02-06 10:04:34 -08:00
Ben Vanik 2521d64615 Fixing decryption key choice to be more robust. 2013-02-06 03:07:57 -08:00
Ben Vanik da23c00d31 Simple thread PAL type (until core/ is rewritten). 2013-02-06 02:44:15 -08:00
Ben Vanik 88431eadce Screw convention; moving include files alongside source files.
They now will show up in xcode/etc.
2013-02-06 02:19:50 -08:00
Ben Vanik 3dfd9c4b00 Tweaks to get the generator running on the next app. 2013-02-03 23:26:20 -08:00
Ben Vanik f1ea74dcff Setting the condition bit in stwcx. 2013-02-03 21:45:44 -08:00
Ben Vanik 7fed5cf579 Last of the integer memory instructions and a lot of the fp ones. 2013-02-03 21:41:38 -08:00
Ben Vanik 4204bc5575 More instructions. 2013-02-03 16:02:09 -08:00
Ben Vanik 59ccfdd999 Read and write map files. 2013-02-03 03:34:43 -08:00
Ben Vanik a020072ed7 Splitting up the symbol database code to make it easier to work with. 2013-02-03 00:50:39 -08:00
Ben Vanik 63f0785ecf Rearranging --abort_before_entry. 2013-02-03 00:34:45 -08:00
Ben Vanik 4f9e6b0547 More debugger work.
Posix only right now.
2013-02-03 00:29:40 -08:00
Ben Vanik 5650cf92ab Initial the websocket implementation.
Not yet running on other threads, but can read/write to a websocket from
a browser.
2013-02-02 02:50:56 -08:00
Ben Vanik c2fbafdc28 Skeleton of the debugger host. 2013-02-01 05:37:42 -08:00
Ben Vanik b6a9dfe7e0 Tweaking output. 2013-02-01 00:21:59 -08:00
Ben Vanik 44b39c797b Fixing ? operator parens issues. 2013-01-31 22:07:56 -08:00
Ben Vanik e8dd27f490 Tweaks to the tweaks.
SDB needs a rewrite.
2013-01-31 22:00:43 -08:00
Ben Vanik 837a414249 Minor tweaks to the SDB to get parsing of real games a bit further.
Unfortunately it looks like issue #10 will have to be addressed before
anything can progress :(
2013-01-31 21:40:07 -08:00
Ben Vanik 7f846afdfc Adding support for disc images.
With this, games can now be loaded! Of course, prep fails.
2013-01-31 20:11:13 -08:00
Ben Vanik f78fdba9c3 Wiring up xex loading via the new virtual filesystem.
File resolution is hacked, but works well enough for testing.
2013-01-31 16:52:50 -08:00
Ben Vanik 59189f12ab Skeleton for the virtual filesystem. 2013-01-31 13:27:00 -08:00
Ben Vanik c77bcbf879 Better module handling. 2013-01-31 11:27:05 -08:00
Ben Vanik 9cfc01940e Thread IDs in critical sections. 2013-01-31 03:01:57 -08:00
Ben Vanik 56912aa2bd Rough CriticalSection work. 2013-01-31 02:50:37 -08:00
Ben Vanik fdbd30acb7 Partially implemented string functions. 2013-01-31 00:19:48 -08:00
Ben Vanik 49af0dbc85 Real modules and threads (mostly).
Need events/waiting to get proper launch thread behavior.
2013-01-30 22:44:32 -08:00
Ben Vanik 2ecacedaa6 Cleaning up LLVM exports and adding an access violation trap. 2013-01-30 14:52:41 -08:00
Ben Vanik 23378443e8 Kernel function work. 2013-01-30 14:26:28 -08:00
Ben Vanik 42009cda88 Fixes to get things compiling on OSX again. 2013-01-30 11:03:19 -08:00
Ben Vanik 1585730ec1 Running on Windows!
Minus gflags parsing right now.
2013-01-30 02:48:34 -08:00
Ben Vanik 94d55b5056 GYP updates for Windows.
This will break OSX for a moment.
2013-01-30 02:19:38 -08:00
Ben Vanik 9e05d44723 Implementing (maybe working) Win32 memory.cc. 2013-01-30 01:45:55 -08:00
Ben Vanik ae4d8ad40e Code fixes to get things somewhat compiling on Windows. 2013-01-30 01:35:08 -08:00
Ben Vanik f117f870fb Cleaning up build warnings. 2013-01-29 20:27:24 -08:00
Ben Vanik 80d74dbe03 Implementing rlwimi. 2013-01-29 18:35:51 -08:00
Ben Vanik 9c86c29140 Setting up locals in codegen based on disassembly results. 2013-01-29 17:47:34 -08:00
Ben Vanik d3054839b7 Now tracking register accesses for each function. 2013-01-29 13:07:59 -08:00
Ben Vanik d1333db404 Disassembly for implemented control/memory instructions. 2013-01-29 01:55:03 -08:00
Ben Vanik 8a560e4cbe Adding disassembler bits for alu. 2013-01-29 00:41:39 -08:00
Ben Vanik 775c97bf53 Beginning work on disassembler functions.
Ideally, this would be automated, but it's easier to just do it manually.
2013-01-28 21:37:03 -08:00
Ben Vanik 7b62fa96bd Progress on ghetto memory allocator. 2013-01-28 21:36:03 -08:00
Ben Vanik 0fde6135a0 Fixing XO instruction decoding. 2013-01-28 15:31:46 -08:00
Ben Vanik 9b0cb94e43 Fixing kernel exported variables. 2013-01-28 14:51:23 -08:00
Ben Vanik 9ad6bb917f RtlImageXexHeaderField stub. 2013-01-28 14:25:16 -08:00
Ben Vanik e93908dd72 Skeleton code for more kernel calls. 2013-01-28 13:28:22 -08:00
Ben Vanik 6c4af5aa70 Kernel calls and variables now working and tracing better. 2013-01-28 12:36:39 -08:00
Ben Vanik 5c2060af72 Now running up to the first required kernel call.
If memory address validation is turned off it runs a lot further.
2013-01-28 03:03:37 -08:00
Ben Vanik 46d5a0b51d Executing a bunch of instructions!
Very hacky module startup code, but can now start XEXs! Time to start
implementing kernel stuff.
2013-01-27 22:14:24 -08:00
Ben Vanik 92a3e19cd9 Fixing to allow multiple executions/process. 2013-01-27 19:33:57 -08:00
Ben Vanik 12d9c3d15e First instruction executed in the test runner!
Fixes #7.
2013-01-27 17:49:32 -08:00
Ben Vanik bba99d4a22 Refactoring to allow for raw binary loading. 2013-01-27 12:48:10 -08:00
Ben Vanik d9b08f569f Adding a bunch of instructions. 2013-01-26 21:51:31 -08:00
Ben Vanik 733fe85d37 Cleaning up function registers and setting up CR. 2013-01-26 01:25:31 -08:00
Ben Vanik 9b3d96a8ae Cleaning up instruction decoding names to match the docs better. 2013-01-25 23:45:13 -08:00
Ben Vanik ffdc1e5d4b Hacking on some instructions. 2013-01-25 23:32:37 -08:00
Ben Vanik ebda245773 Better handling of invalid/unimplemented instructions. 2013-01-25 00:51:56 -08:00
Ben Vanik dcb958de54 Adding better register tracking through locals and fixing branches.
LLVM does an amazing job of optimizing this. There are many opportunities
to make it better, too, by preventing spilling where not required or only
spilling/filling things when needed.
2013-01-25 00:32:42 -08:00
Ben Vanik 47481fecf7 Adding tracing methods. 2013-01-24 00:10:24 -08:00
Ben Vanik 385a4ee23b Cleaning up function creation. 2013-01-23 22:38:59 -08:00
Ben Vanik a10a05b6f2 Misc output cleanup and a test run script. 2013-01-23 21:59:26 -08:00
Ben Vanik 860a0739ec Adding gflags to handle command line flags.
It sucks, but is the best there is without using boost.
2013-01-23 21:31:23 -08:00
Ben Vanik 91f9e8b7bb Generating a lot of code!
Still a few missing instructions/variants and other issues, but a big and
valid LLVM module is being generated.
2013-01-22 00:22:27 -08:00
Ben Vanik 791f14182c Fixing a bunch of valgrind errors and reworking globals. 2013-01-21 14:31:59 -08:00
Ben Vanik b29dd22850 Adding instruction emitting functions.
All empty, all ready to go!
2013-01-21 11:55:42 -08:00
Ben Vanik 95a8be078b Rearranging code a bit to keep things cleaner. 2013-01-21 10:58:52 -08:00
Ben Vanik b91d550ef1 Adding instruction generation loop.
Not yet doing anything, but close.
2013-01-21 01:11:57 -08:00
Ben Vanik 25af5f410a Cleaning up the names in imports/functions. 2013-01-21 00:13:00 -08:00
Ben Vanik 68cc34bb79 Fixing up basic block targets and such. 2013-01-20 17:27:49 -08:00
Ben Vanik 852536ae0a Basic function analysis.
Finds basic blocks and estimates proper function bounds.
Seems legit for compiled code.
2013-01-20 16:46:08 -08:00
Ben Vanik d4b0bf73c1 Prepping flow for basic block building. 2013-01-20 09:48:39 -08:00
Ben Vanik ca2908db32 Converting everything to C++ cause I'm a masochist. 2013-01-20 01:13:59 -08:00
Ben Vanik 8a5dcbc1dd Hacky state for instruction gen. 2013-01-19 11:04:22 -08:00
Ben Vanik ea5154af0f Codegen experimentation. 2013-01-19 05:26:01 -08:00
Ben Vanik c18e94c5be Fleshing out the symbol database.
Now detecting a lot of functions via method hints and generating stub
functions. A few holes (in the test xex), but enough to move forward with
codegen.
2013-01-17 23:18:09 -08:00
Ben Vanik 6c5432eb45 Symbol database skeleton. 2013-01-14 00:02:24 -08:00
Ben Vanik bfec194533 Adding instruction table and basic PPC state.
Can decode a single instruction.
2013-01-13 21:25:28 -08:00
Ben Vanik 099e37490a Work on CPU, codegen skeleton, and thunk. 2013-01-13 15:48:18 -08:00
Ben Vanik 2f4bc598e5 CPU skeleton. 2013-01-13 00:34:08 -08:00
Ben Vanik bcd575f9b0 Massive dump of xenia-info required code.
This is a working xenia-info for xex files (no gdfs files yet).
2013-01-12 23:25:41 -08:00
Ben Vanik 7e4a9220d7 Initial project skeleton.
This includes a working gyp-based build of an executable that uses LLVM.
2013-01-11 01:23:08 -08:00